1 #ifndef __TEST_GL_ABSTRACTION_H__
2 #define __TEST_GL_ABSTRACTION_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
26 #include <cstring> // for strcmp
29 #include <dali/public-api/dali-core.h>
30 #include <dali/integration-api/core.h>
31 #include <dali/integration-api/gl-abstraction.h>
32 #include <dali/integration-api/gl-defines.h>
33 #include "test-trace-call-stack.h"
38 static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 64;
39 static const char *mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] =
41 "aPosition", // ATTRIB_POSITION
42 "aNormal", // ATTRIB_NORMAL
43 "aTexCoord", // ATTRIB_TEXCOORD
44 "aColor", // ATTRIB_COLOR
45 "aBoneWeights", // ATTRIB_BONE_WEIGHTS
46 "aBoneIndices" // ATTRIB_BONE_INDICES
49 class DALI_IMPORT_API TestGlAbstraction: public Dali::Integration::GlAbstraction
61 inline void ActiveTexture( GLenum textureUnit )
63 mActiveTextureUnit = textureUnit - GL_TEXTURE0;
66 inline GLenum GetActiveTextureUnit() const
68 return mActiveTextureUnit + GL_TEXTURE0;
71 inline void AttachShader( GLuint program, GLuint shader )
73 std::stringstream out;
74 out << program << ", " << shader;
75 mShaderTrace.PushCall("AttachShader", out.str());
78 inline void BindAttribLocation( GLuint program, GLuint index, const char* name )
82 inline void BindBuffer( GLenum target, GLuint buffer )
86 inline void BindFramebuffer( GLenum target, GLuint framebuffer )
89 mFramebufferStatus |= 2;
92 inline void BindRenderbuffer( GLenum target, GLuint renderbuffer )
97 * This method can be used by test cases, to query the texture IDs that have been bound by BindTexture.
98 * @return A vector containing the IDs that were bound.
100 inline const std::vector<GLuint>& GetBoundTextures() const
102 return mBoundTextures;
106 * Query the texture IDs that have been bound with BindTexture, with a specific active texture unit.
107 * @param[in] activeTextureUnit The specific active texture unit.
108 * @return A vector containing the IDs that were bound.
110 inline const std::vector<GLuint>& GetBoundTextures( GLuint activeTextureUnit ) const
112 return mActiveTextures[ activeTextureUnit - GL_TEXTURE0 ].mBoundTextures;
116 * This method can be used by test cases, to clear the record of texture IDs that have been bound by BindTexture.
118 inline void ClearBoundTextures()
120 mBoundTextures.clear();
122 for( unsigned int i=0; i<MIN_TEXTURE_UNIT_LIMIT; ++i )
124 mActiveTextures[ i ].mBoundTextures.clear();
128 inline void BindTexture( GLenum target, GLuint texture )
130 // Record the bound textures for future checks
133 mBoundTextures.push_back( texture );
135 if( mActiveTextureUnit < MIN_TEXTURE_UNIT_LIMIT )
137 mActiveTextures[ mActiveTextureUnit ].mBoundTextures.push_back( texture );
141 std::stringstream out;
142 out << target << ", " << texture;
143 mTextureTrace.PushCall("BindTexture", out.str());
146 inline void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
148 mLastBlendColor.r = red;
149 mLastBlendColor.g = green;
150 mLastBlendColor.b = blue;
151 mLastBlendColor.a = alpha;
154 inline const Vector4& GetLastBlendColor() const
156 return mLastBlendColor;
159 inline void BlendEquation( GLenum mode )
161 mLastBlendEquationRgb = mode;
162 mLastBlendEquationAlpha = mode;
165 inline void BlendEquationSeparate( GLenum modeRgb, GLenum modeAlpha )
167 mLastBlendEquationRgb = modeRgb;
168 mLastBlendEquationAlpha = modeAlpha;
171 inline GLenum GetLastBlendEquationRgb() const
173 return mLastBlendEquationRgb;
176 inline GLenum GetLastBlendEquationAlpha() const
178 return mLastBlendEquationAlpha;
181 inline void BlendFunc(GLenum sfactor, GLenum dfactor)
183 mLastBlendFuncSrcRgb = sfactor;
184 mLastBlendFuncDstRgb = dfactor;
185 mLastBlendFuncSrcAlpha = sfactor;
186 mLastBlendFuncDstAlpha = dfactor;
189 inline void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
191 mLastBlendFuncSrcRgb = srcRGB;
192 mLastBlendFuncDstRgb = dstRGB;
193 mLastBlendFuncSrcAlpha = srcAlpha;
194 mLastBlendFuncDstAlpha = dstAlpha;
197 inline GLenum GetLastBlendFuncSrcRgb() const
199 return mLastBlendFuncSrcRgb;
202 inline GLenum GetLastBlendFuncDstRgb() const
204 return mLastBlendFuncDstRgb;
207 inline GLenum GetLastBlendFuncSrcAlpha() const
209 return mLastBlendFuncSrcAlpha;
212 inline GLenum GetLastBlendFuncDstAlpha() const
214 return mLastBlendFuncDstAlpha;
217 inline void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
219 mBufferDataCalls.push_back(size);
222 inline void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
224 mBufferSubDataCalls.push_back(size);
227 inline GLenum CheckFramebufferStatus(GLenum target)
229 //If it has the three last bits set to 1 - 111, then the three minimum functions to create a
230 //Framebuffer texture have been called
231 if( mFramebufferStatus == 7 )
233 return GL_FRAMEBUFFER_COMPLETE;
236 return mCheckFramebufferStatusResult;
239 inline GLenum CheckFramebufferColorAttachment()
241 return mFramebufferColorAttached;
244 inline GLenum CheckFramebufferDepthAttachment()
246 return mFramebufferDepthAttached;
249 inline GLenum CheckFramebufferStencilAttachment()
251 return mFramebufferStencilAttached;
254 inline void Clear(GLbitfield mask)
257 mLastClearBitMask = mask;
260 inline void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
264 inline void ClearDepthf(GLclampf depth)
268 inline void ClearStencil(GLint s)
272 inline void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
276 inline void CompileShader(GLuint shader)
278 std::stringstream out;
280 mShaderTrace.PushCall("CompileShader", out.str());
283 inline void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
287 inline void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
291 inline void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
295 inline void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
299 inline GLuint CreateProgram(void)
301 mShaderTrace.PushCall("CreateProgram", "");
303 ++mLastProgramIdUsed;
304 mUniforms[mLastProgramIdUsed] = UniformIDMap();
305 return mLastProgramIdUsed;
308 inline GLuint CreateShader(GLenum type)
310 std::stringstream out;
312 mShaderTrace.PushCall("CreateShader", out.str());
314 return ++mLastShaderIdUsed;
317 inline void CullFace(GLenum mode)
319 std::stringstream out;
321 mCullFaceTrace.PushCall("CullFace", out.str());
324 inline void DeleteBuffers(GLsizei n, const GLuint* buffers)
328 inline void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
332 inline void DeleteProgram(GLuint program)
334 std::stringstream out;
336 mShaderTrace.PushCall("DeleteProgram", out.str());
339 inline void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
343 inline void DeleteShader(GLuint shader)
345 std::stringstream out;
347 mShaderTrace.PushCall("DeleteShader", out.str());
350 inline void DeleteTextures(GLsizei n, const GLuint* textures)
352 std::stringstream out;
353 out << n << ", " << textures << " = [" ;
355 for(GLsizei i=0; i<n; i++)
357 out << textures[i] << ", " ;
358 mDeletedTextureIds.push_back(textures[i]);
361 mTextureTrace.PushCall("DeleteTextures", out.str());
364 inline bool CheckNoTexturesDeleted()
366 return mDeletedTextureIds.size() == 0;
369 inline bool CheckTextureDeleted( GLuint textureId )
373 for(std::vector<GLuint>::iterator iter=mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter)
375 if(*iter == textureId)
384 inline void ClearDeletedTextures()
386 mDeletedTextureIds.clear();
389 inline void DepthFunc(GLenum func)
393 inline void DepthMask(GLboolean flag)
397 inline void DepthRangef(GLclampf zNear, GLclampf zFar)
401 inline void DetachShader(GLuint program, GLuint shader)
403 std::stringstream out;
404 out << program << ", " << shader;
405 mShaderTrace.PushCall("DetachShader", out.str());
408 inline void Disable(GLenum cap)
410 std::stringstream out;
412 mCullFaceTrace.PushCall("Disable", out.str());
415 inline void DisableVertexAttribArray(GLuint index)
417 SetVertexAttribArray( index, false );
420 inline void DrawArrays(GLenum mode, GLint first, GLsizei count)
422 std::stringstream out;
423 out << mode << ", " << first << ", " << count;
424 mDrawTrace.PushCall("DrawArrays", out.str());
427 inline void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
429 std::stringstream out;
430 out << mode << ", " << count << ", " << type << ", indices";
431 mDrawTrace.PushCall("DrawElements", out.str());
434 inline void Enable(GLenum cap)
436 std::stringstream out;
438 mCullFaceTrace.PushCall("Enable", out.str());
441 inline void EnableVertexAttribArray(GLuint index)
443 SetVertexAttribArray( index, true);
446 inline void Finish(void)
450 inline void Flush(void)
454 inline void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
456 if (attachment == GL_DEPTH_ATTACHMENT)
458 mFramebufferDepthAttached = true;
460 else if (attachment == GL_STENCIL_ATTACHMENT)
462 mFramebufferStencilAttached = true;
466 inline void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
469 mFramebufferStatus |= 4;
471 //We check 4 attachment colors
472 if ((attachment == GL_COLOR_ATTACHMENT0) || (attachment == GL_COLOR_ATTACHMENT1) || (attachment == GL_COLOR_ATTACHMENT2) || (attachment == GL_COLOR_ATTACHMENT4))
474 mFramebufferColorAttached = true;
478 inline void FrontFace(GLenum mode)
482 inline void GenBuffers(GLsizei n, GLuint* buffers)
484 // avoids an assert in GpuBuffers
488 inline void GenerateMipmap(GLenum target)
492 inline void GenFramebuffers(GLsizei n, GLuint* framebuffers)
494 for( int i = 0; i < n; i++ )
496 framebuffers[i] = i + 1;
499 //Add 001 bit, this function needs to be called the first one in the chain
500 mFramebufferStatus = 1;
503 inline void GenRenderbuffers(GLsizei n, GLuint* renderbuffers)
505 for( int i = 0; i < n; i++ )
507 renderbuffers[i] = i + 1;
512 * This method can be used by test cases, to manipulate the texture IDs generated by GenTextures.
513 * @param[in] ids A vector containing the next IDs to be generated
515 inline void SetNextTextureIds( const std::vector<GLuint>& ids )
517 mNextTextureIds = ids;
520 inline const std::vector<GLuint>& GetNextTextureIds()
522 return mNextTextureIds;
525 inline void GenTextures(GLsizei n, GLuint* textures)
527 for( int i=0; i<n; ++i )
529 if( !mNextTextureIds.empty() )
531 *(textures+i) = mNextTextureIds[0];
532 mNextTextureIds.erase( mNextTextureIds.begin() );
536 *(textures+i) = ++mLastAutoTextureIdUsed;
540 std::stringstream out;
541 for(int i=0; i<n; i++)
549 mTextureTrace.PushCall("GenTextures", out.str());
552 inline void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
556 inline void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
560 inline void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
564 inline int GetAttribLocation(GLuint program, const char* name)
566 std::string attribName(name);
568 for( unsigned int i = 0; i < ATTRIB_TYPE_LAST; ++i )
570 if( mStdAttribs[i] == attribName )
576 // 0 is a valid location
580 inline void GetBooleanv(GLenum pname, GLboolean* params)
584 inline void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
588 inline GLenum GetError(void)
590 return mGetErrorResult;
593 inline void GetFloatv(GLenum pname, GLfloat* params)
597 inline void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
601 inline void GetIntegerv(GLenum pname, GLint* params)
605 case GL_MAX_TEXTURE_SIZE:
608 case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
611 case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
612 *params = mNumBinaryFormats;
614 case GL_PROGRAM_BINARY_FORMATS_OES:
615 *params = mBinaryFormats;
620 inline void GetProgramiv(GLuint program, GLenum pname, GLint* params)
624 *params = mLinkStatus;
626 case GL_PROGRAM_BINARY_LENGTH_OES:
627 *params = mProgramBinaryLength;
632 inline void GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
637 inline void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
641 inline void GetShaderiv(GLuint shader, GLenum pname, GLint* params)
644 case GL_COMPILE_STATUS:
645 *params = mCompileStatus;
650 inline void GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
654 inline void GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
658 inline const GLubyte* GetString(GLenum name)
660 return mGetStringResult;
663 inline void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
667 inline void GetTexParameteriv(GLenum target, GLenum pname, GLint* params)
671 inline void GetUniformfv(GLuint program, GLint location, GLfloat* params)
675 inline void GetUniformiv(GLuint program, GLint location, GLint* params)
679 inline GLint GetUniformLocation(GLuint program, const char* name)
681 ProgramUniformMap::iterator it = mUniforms.find(program);
682 if( it == mUniforms.end() )
684 // Not a valid program ID
685 mGetErrorResult = GL_INVALID_OPERATION;
689 UniformIDMap& uniformIDs = it->second;
690 UniformIDMap::iterator it2 = uniformIDs.find( name );
691 if( it2 == uniformIDs.end() )
693 // Uniform not found, so add it...
694 uniformIDs[name] = ++mLastUniformIdUsed;
695 return mLastUniformIdUsed;
701 inline void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
705 inline void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
709 inline void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
713 inline void Hint(GLenum target, GLenum mode)
717 inline GLboolean IsBuffer(GLuint buffer)
719 return mIsBufferResult;
722 inline GLboolean IsEnabled(GLenum cap)
724 return mIsEnabledResult;
727 inline GLboolean IsFramebuffer(GLuint framebuffer)
729 return mIsFramebufferResult;
732 inline GLboolean IsProgram(GLuint program)
734 return mIsProgramResult;
737 inline GLboolean IsRenderbuffer(GLuint renderbuffer)
739 return mIsRenderbufferResult;
742 inline GLboolean IsShader(GLuint shader)
744 return mIsShaderResult;
747 inline GLboolean IsTexture(GLuint texture)
749 return mIsTextureResult;
752 inline void LineWidth(GLfloat width)
756 inline void LinkProgram(GLuint program)
758 std::stringstream out;
760 mShaderTrace.PushCall("LinkProgram", out.str());
763 inline void PixelStorei(GLenum pname, GLint param)
767 inline void PolygonOffset(GLfloat factor, GLfloat units)
771 inline void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
775 inline void ReleaseShaderCompiler(void)
779 inline void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
783 inline void SampleCoverage(GLclampf value, GLboolean invert)
787 inline void Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
789 mScissorParams.x = x;
790 mScissorParams.y = y;
791 mScissorParams.width = width;
792 mScissorParams.height = height;
795 inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
799 inline void ShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
801 std::string stringBuilder;
802 for(int i = 0; i < count; ++i)
804 stringBuilder += string[i];
806 mShaderSources[shader] = stringBuilder;
807 mLastShaderCompiled = shader;
810 inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
812 const std::string shaderSource = mShaderSources[shader];
813 if( static_cast<int>(shaderSource.length()) < bufsize )
815 strcpy(source, shaderSource.c_str());
816 *length = shaderSource.length();
820 *length = bufsize -1;
821 strncpy(source, shaderSource.c_str(), *length);
822 source[*length] = 0x0;
826 inline std::string GetShaderSource(GLuint shader)
828 return mShaderSources[shader];
831 inline void StencilFunc(GLenum func, GLint ref, GLuint mask)
835 inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
839 inline void StencilMask(GLuint mask)
843 inline void StencilMaskSeparate(GLenum face, GLuint mask)
847 inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
851 inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
855 inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
857 std::stringstream out;
858 out << width << ", " << height;
859 mTextureTrace.PushCall("TexImage2D", out.str());
862 inline void TexParameterf(GLenum target, GLenum pname, GLfloat param)
864 std::stringstream out;
865 out << target << ", " << pname << ", " << param;
866 mTexParamaterTrace.PushCall("TexParameterf", out.str());
869 inline void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
871 std::stringstream out;
872 out << target << ", " << pname << ", " << params[0];
873 mTexParamaterTrace.PushCall("TexParameterfv", out.str());
876 inline void TexParameteri(GLenum target, GLenum pname, GLint param)
878 std::stringstream out;
879 out << target << ", " << pname << ", " << param;
880 mTexParamaterTrace.PushCall("TexParameteri", out.str());
883 inline void TexParameteriv(GLenum target, GLenum pname, const GLint* params)
885 std::stringstream out;
886 out << target << ", " << pname << ", " << params[0];
887 mTexParamaterTrace.PushCall("TexParameteriv", out.str());
890 inline void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
892 std::stringstream out;
893 out << xoffset << ", " << yoffset << ", " << width << ", " << height;
894 mTextureTrace.PushCall("TexSubImage2D", out.str());
897 inline void Uniform1f(GLint location, GLfloat x)
899 if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, x ) )
901 mGetErrorResult = GL_INVALID_OPERATION;
905 inline void Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
907 for( int i = 0; i < count; ++i )
909 if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, v[i] ) )
911 mGetErrorResult = GL_INVALID_OPERATION;
917 inline void Uniform1i(GLint location, GLint x)
919 if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, location, x ) )
921 mGetErrorResult = GL_INVALID_OPERATION;
925 inline void Uniform1iv(GLint location, GLsizei count, const GLint* v)
927 for( int i = 0; i < count; ++i )
929 if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram,
933 mGetErrorResult = GL_INVALID_OPERATION;
939 inline void Uniform2f(GLint location, GLfloat x, GLfloat y)
941 if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
945 mGetErrorResult = GL_INVALID_OPERATION;
949 inline void Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
951 for( int i = 0; i < count; ++i )
953 if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
955 Vector2( v[2*i], v[2*i+1] ) ) )
957 mGetErrorResult = GL_INVALID_OPERATION;
963 inline void Uniform2i(GLint location, GLint x, GLint y)
967 inline void Uniform2iv(GLint location, GLsizei count, const GLint* v)
971 inline void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
973 if( ! mProgramUniforms3f.SetUniformValue( mCurrentProgram,
975 Vector3( x, y, z ) ) )
977 mGetErrorResult = GL_INVALID_OPERATION;
981 inline void Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
983 for( int i = 0; i < count; ++i )
985 if( ! mProgramUniforms3f.SetUniformValue(
988 Vector3( v[3*i], v[3*i+1], v[3*i+2] ) ) )
990 mGetErrorResult = GL_INVALID_OPERATION;
996 inline void Uniform3i(GLint location, GLint x, GLint y, GLint z)
1000 inline void Uniform3iv(GLint location, GLsizei count, const GLint* v)
1004 inline void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1006 if( ! mProgramUniforms4f.SetUniformValue( mCurrentProgram,
1008 Vector4( x, y, z, w ) ) )
1010 mGetErrorResult = GL_INVALID_OPERATION;
1014 inline void Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
1016 for( int i = 0; i < count; ++i )
1018 if( ! mProgramUniforms4f.SetUniformValue(
1021 Vector4( v[4*i], v[4*i+1], v[4*i+2], v[4*i+3] ) ) )
1023 mGetErrorResult = GL_INVALID_OPERATION;
1029 inline void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
1033 inline void Uniform4iv(GLint location, GLsizei count, const GLint* v)
1037 inline void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1041 inline void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1043 for( int i = 0; i < count; ++i )
1045 if( ! mProgramUniformsMat3.SetUniformValue(
1048 Matrix3( value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8] ) ) )
1050 mGetErrorResult = GL_INVALID_OPERATION;
1056 inline void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1058 for( int i = 0; i < count; ++i )
1060 if( ! mProgramUniformsMat4.SetUniformValue(
1065 mGetErrorResult = GL_INVALID_OPERATION;
1071 inline void UseProgram(GLuint program)
1073 mCurrentProgram = program;
1076 inline void ValidateProgram(GLuint program)
1080 inline void VertexAttrib1f(GLuint indx, GLfloat x)
1084 inline void VertexAttrib1fv(GLuint indx, const GLfloat* values)
1088 inline void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
1092 inline void VertexAttrib2fv(GLuint indx, const GLfloat* values)
1096 inline void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
1100 inline void VertexAttrib3fv(GLuint indx, const GLfloat* values)
1104 inline void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1108 inline void VertexAttrib4fv(GLuint indx, const GLfloat* values)
1112 inline void VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
1116 inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
1122 inline void ReadBuffer(GLenum mode)
1126 inline void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
1130 inline void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
1134 inline void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
1138 inline void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
1142 inline void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
1146 inline void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
1150 inline void GenQueries(GLsizei n, GLuint* ids)
1154 inline void DeleteQueries(GLsizei n, const GLuint* ids)
1158 inline GLboolean IsQuery(GLuint id)
1163 inline void BeginQuery(GLenum target, GLuint id)
1167 inline void EndQuery(GLenum target)
1171 inline void GetQueryiv(GLenum target, GLenum pname, GLint* params)
1175 inline void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
1179 inline GLboolean UnmapBuffer(GLenum target)
1184 inline void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
1188 inline void DrawBuffers(GLsizei n, const GLenum* bufs)
1192 inline void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1196 inline void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1200 inline void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1204 inline void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1208 inline void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1212 inline void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1216 inline void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
1220 inline void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
1224 inline void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
1228 inline GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
1233 inline void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
1237 inline void BindVertexArray(GLuint array)
1241 inline void DeleteVertexArrays(GLsizei n, const GLuint* arrays)
1245 inline void GenVertexArrays(GLsizei n, GLuint* arrays)
1249 inline GLboolean IsVertexArray(GLuint array)
1254 inline void GetIntegeri_v(GLenum target, GLuint index, GLint* data)
1258 inline void BeginTransformFeedback(GLenum primitiveMode)
1262 inline void EndTransformFeedback(void)
1266 inline void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
1270 inline void BindBufferBase(GLenum target, GLuint index, GLuint buffer)
1274 inline void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
1278 inline void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
1282 inline void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
1286 inline void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
1290 inline void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
1294 inline void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
1298 inline void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
1302 inline void VertexAttribI4iv(GLuint index, const GLint* v)
1306 inline void VertexAttribI4uiv(GLuint index, const GLuint* v)
1310 inline void GetUniformuiv(GLuint program, GLint location, GLuint* params)
1314 inline GLint GetFragDataLocation(GLuint program, const GLchar *name)
1319 inline void Uniform1ui(GLint location, GLuint v0)
1323 inline void Uniform2ui(GLint location, GLuint v0, GLuint v1)
1327 inline void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
1331 inline void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
1335 inline void Uniform1uiv(GLint location, GLsizei count, const GLuint* value)
1339 inline void Uniform2uiv(GLint location, GLsizei count, const GLuint* value)
1343 inline void Uniform3uiv(GLint location, GLsizei count, const GLuint* value)
1347 inline void Uniform4uiv(GLint location, GLsizei count, const GLuint* value)
1351 inline void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
1355 inline void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
1359 inline void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
1363 inline void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
1367 inline const GLubyte* GetStringi(GLenum name, GLuint index)
1372 inline void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
1376 inline void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
1380 inline void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
1384 inline GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
1386 return GL_INVALID_INDEX;
1389 inline void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
1393 inline void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
1397 inline void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
1401 inline void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
1405 inline void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
1409 inline GLsync FenceSync(GLenum condition, GLbitfield flags)
1414 inline GLboolean IsSync(GLsync sync)
1419 inline void DeleteSync(GLsync sync)
1423 inline GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
1428 inline void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
1432 inline void GetInteger64v(GLenum pname, GLint64* params)
1436 inline void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
1440 inline void GetInteger64i_v(GLenum target, GLuint index, GLint64* data)
1444 inline void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
1448 inline void GenSamplers(GLsizei count, GLuint* samplers)
1452 inline void DeleteSamplers(GLsizei count, const GLuint* samplers)
1456 inline GLboolean IsSampler(GLuint sampler)
1461 inline void BindSampler(GLuint unit, GLuint sampler)
1465 inline void SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
1469 inline void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
1473 inline void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
1477 inline void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
1481 inline void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
1485 inline void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
1489 inline void VertexAttribDivisor(GLuint index, GLuint divisor)
1493 inline void BindTransformFeedback(GLenum target, GLuint id)
1497 inline void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
1501 inline void GenTransformFeedbacks(GLsizei n, GLuint* ids)
1505 inline GLboolean IsTransformFeedback(GLuint id)
1510 inline void PauseTransformFeedback(void)
1514 inline void ResumeTransformFeedback(void)
1518 inline void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
1520 mGetProgramBinaryCalled = true;
1523 inline void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
1527 inline void ProgramParameteri(GLuint program, GLenum pname, GLint value)
1531 inline void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
1535 inline void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
1539 inline void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
1543 inline void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
1547 inline void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
1551 public: // TEST FUNCTIONS
1552 inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; }
1553 inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; }
1554 inline void SetGetAttribLocationResult( int result) { mGetAttribLocationResult = result; }
1555 inline void SetGetErrorResult( GLenum result) { mGetErrorResult = result; }
1556 inline void SetGetStringResult( GLubyte* result) { mGetStringResult = result; }
1557 inline void SetIsBufferResult( GLboolean result) { mIsBufferResult = result; }
1558 inline void SetIsEnabledResult( GLboolean result) { mIsEnabledResult = result; }
1559 inline void SetIsFramebufferResult( GLboolean result) { mIsFramebufferResult = result; }
1560 inline void SetIsProgramResult( GLboolean result) { mIsProgramResult = result; }
1561 inline void SetIsRenderbufferResult( GLboolean result) { mIsRenderbufferResult = result; }
1562 inline void SetIsShaderResult( GLboolean result) { mIsShaderResult = result; }
1563 inline void SetIsTextureResult( GLboolean result) { mIsTextureResult = result; }
1564 inline void SetCheckFramebufferStatusResult( GLenum result) { mCheckFramebufferStatusResult = result; }
1565 inline void SetNumBinaryFormats( GLint numFormats ) { mNumBinaryFormats = numFormats; }
1566 inline void SetBinaryFormats( GLint binaryFormats ) { mBinaryFormats = binaryFormats; }
1567 inline void SetProgramBinaryLength( GLint length ) { mProgramBinaryLength = length; }
1569 inline bool GetVertexAttribArrayState(GLuint index)
1571 if( index >= MAX_ATTRIBUTE_CACHE_SIZE )
1576 return mVertexAttribArrayState[ index ];
1578 inline void ClearVertexAttribArrayChanged() { mVertexAttribArrayChanged = false; }
1579 inline bool GetVertexAttribArrayChanged() { return mVertexAttribArrayChanged; }
1581 //Methods for CullFace verification
1582 inline void EnableCullFaceCallTrace(bool enable) { mCullFaceTrace.Enable(enable); }
1583 inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); }
1584 inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; }
1586 //Methods for Shader verification
1587 inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); }
1588 inline void ResetShaderCallStack() { mShaderTrace.Reset(); }
1589 inline TraceCallStack& GetShaderTrace() { return mShaderTrace; }
1591 //Methods for Texture verification
1592 inline void EnableTextureCallTrace(bool enable) { mTextureTrace.Enable(enable); }
1593 inline void ResetTextureCallStack() { mTextureTrace.Reset(); }
1594 inline TraceCallStack& GetTextureTrace() { return mTextureTrace; }
1596 //Methods for Texture verification
1597 inline void EnableTexParameterCallTrace(bool enable) { mTexParamaterTrace.Enable(enable); }
1598 inline void ResetTexParameterCallStack() { mTexParamaterTrace.Reset(); }
1599 inline TraceCallStack& GetTexParameterTrace() { return mTexParamaterTrace; }
1601 //Methods for Draw verification
1602 inline void EnableDrawCallTrace(bool enable) { mDrawTrace.Enable(enable); }
1603 inline void ResetDrawCallStack() { mDrawTrace.Reset(); }
1604 inline TraceCallStack& GetDrawTrace() { return mDrawTrace; }
1606 template <typename T>
1607 inline bool GetUniformValue( const char* name, T& value ) const
1609 for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
1610 program_it != mUniforms.end();
1613 const UniformIDMap &uniformIDs = program_it->second;
1615 UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
1616 if( uniform_it != uniformIDs.end() )
1618 // found one matching uniform name, lets check the value...
1619 GLuint programId = program_it->first;
1620 GLint uniformId = uniform_it->second;
1622 const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
1623 return mProgramUniforms.GetUniformValue( programId, uniformId, value );
1630 template <typename T>
1631 inline bool CheckUniformValue( const char* name, const T& value ) const
1633 for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
1634 program_it != mUniforms.end();
1637 const UniformIDMap &uniformIDs = program_it->second;
1639 UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
1640 if( uniform_it != uniformIDs.end() )
1642 // found one matching uniform name, lets check the value...
1643 GLuint programId = program_it->first;
1644 GLint uniformId = uniform_it->second;
1646 const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
1647 if( mProgramUniforms.CheckUniformValue( programId, uniformId, value ) )
1649 // the value matches
1655 fprintf(stderr, "Not found, printing possible values:\n" );
1656 for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
1657 program_it != mUniforms.end();
1660 const UniformIDMap &uniformIDs = program_it->second;
1662 UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
1663 if( uniform_it != uniformIDs.end() )
1665 // found one matching uniform name, lets check the value...
1666 GLuint programId = program_it->first;
1667 GLint uniformId = uniform_it->second;
1669 const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
1671 if ( mProgramUniforms.GetUniformValue(programId, uniformId, origValue) )
1673 std::stringstream out;
1674 out << uniform_it->first << ": " << origValue;
1675 fprintf(stderr, "%s\n", out.str().c_str() );
1682 template <typename T>
1683 inline bool GetUniformValue( GLuint programId, GLuint uniformId, T& outValue) const
1685 const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( outValue );
1686 return mProgramUniforms.GetUniformValue( programId, uniformId, outValue );
1689 inline bool GetUniformIds( const char* name, GLuint& programId, GLuint& uniformId ) const
1691 for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
1692 program_it != mUniforms.end();
1695 const UniformIDMap &uniformIDs = program_it->second;
1697 UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
1698 if( uniform_it != uniformIDs.end() )
1700 programId = program_it->first;
1701 uniformId = uniform_it->second;
1710 inline GLuint GetLastShaderCompiled() const
1712 return mLastShaderCompiled;
1715 inline GLuint GetLastProgramCreated() const
1717 return mLastProgramIdUsed;
1720 inline GLbitfield GetLastClearMask() const
1722 return mLastClearBitMask;
1727 ATTRIB_UNKNOWN = -1,
1732 ATTRIB_BONE_WEIGHTS,
1733 ATTRIB_BONE_INDICES,
1737 struct ScissorParams
1744 ScissorParams() : x( 0 ), y( 0 ), width( 0 ), height( 0 ) { }
1747 // Methods to check scissor tests
1748 inline const ScissorParams& GetScissorParams() const { return mScissorParams; }
1750 inline bool GetProgramBinaryCalled() const { return mGetProgramBinaryCalled; }
1752 inline unsigned int GetClearCountCalled() const { return mClearCount; }
1754 typedef std::vector<size_t> BufferDataCalls;
1755 inline const BufferDataCalls& GetBufferDataCalls() const { return mBufferDataCalls; }
1756 inline void ResetBufferDataCalls() { mBufferDataCalls.clear(); }
1758 typedef std::vector<size_t> BufferSubDataCalls;
1759 inline const BufferSubDataCalls& GetBufferSubDataCalls() const { return mBufferSubDataCalls; }
1760 inline void ResetBufferSubDataCalls() { mBufferSubDataCalls.clear(); }
1763 GLuint mCurrentProgram;
1764 GLuint mCompileStatus;
1765 BufferDataCalls mBufferDataCalls;
1766 BufferSubDataCalls mBufferSubDataCalls;
1768 GLint mGetAttribLocationResult;
1769 GLenum mGetErrorResult;
1770 GLubyte* mGetStringResult;
1771 GLboolean mIsBufferResult;
1772 GLboolean mIsEnabledResult;
1773 GLboolean mIsFramebufferResult;
1774 GLboolean mIsProgramResult;
1775 GLboolean mIsRenderbufferResult;
1776 GLboolean mIsShaderResult;
1777 GLboolean mIsTextureResult;
1778 GLenum mActiveTextureUnit;
1779 GLenum mCheckFramebufferStatusResult;
1780 GLint mFramebufferStatus;
1781 GLenum mFramebufferColorAttached;
1782 GLenum mFramebufferDepthAttached;
1783 GLenum mFramebufferStencilAttached;
1784 GLint mNumBinaryFormats;
1785 GLint mBinaryFormats;
1786 GLint mProgramBinaryLength;
1787 bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE];
1788 bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed
1789 bool mGetProgramBinaryCalled;
1790 typedef std::map< GLuint, std::string> ShaderSourceMap;
1791 ShaderSourceMap mShaderSources;
1792 GLuint mLastShaderCompiled;
1793 GLbitfield mLastClearBitMask;
1794 unsigned int mClearCount;
1796 Vector4 mLastBlendColor;
1797 GLenum mLastBlendEquationRgb;
1798 GLenum mLastBlendEquationAlpha;
1799 GLenum mLastBlendFuncSrcRgb;
1800 GLenum mLastBlendFuncDstRgb;
1801 GLenum mLastBlendFuncSrcAlpha;
1802 GLenum mLastBlendFuncDstAlpha;
1804 // Data for manipulating the IDs returned by GenTextures
1805 GLuint mLastAutoTextureIdUsed;
1806 std::vector<GLuint> mNextTextureIds;
1807 std::vector<GLuint> mDeletedTextureIds;
1808 std::vector<GLuint> mBoundTextures;
1810 struct ActiveTextureType
1812 std::vector<GLuint> mBoundTextures;
1815 ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ];
1817 TraceCallStack mCullFaceTrace;
1818 TraceCallStack mShaderTrace;
1819 TraceCallStack mTextureTrace;
1820 TraceCallStack mTexParamaterTrace;
1821 TraceCallStack mDrawTrace;
1823 // Shaders & Uniforms
1824 GLuint mLastShaderIdUsed;
1825 GLuint mLastProgramIdUsed;
1826 GLuint mLastUniformIdUsed;
1827 typedef std::map< std::string, GLint > UniformIDMap;
1828 typedef std::map< GLuint, UniformIDMap > ProgramUniformMap;
1829 ProgramUniformMap mUniforms;
1831 template <typename T>
1832 struct ProgramUniformValue : public std::map< GLuint, std::map< GLint, T > >
1835 typedef std::map< GLint, T > UniformValueMap;
1836 typedef std::map< GLuint, UniformValueMap > Map;
1838 bool SetUniformValue( GLuint program, GLuint uniform, const T& value )
1845 typename Map::iterator it = Map::find( program );
1846 if( it == Map::end() )
1848 // if its the first uniform for this program add it
1849 std::pair< typename Map::iterator, bool > result =
1850 Map::insert( typename Map::value_type( program, UniformValueMap() ) );
1854 UniformValueMap& uniforms = it->second;
1855 uniforms[uniform] = value;
1860 bool CheckUniformValue( GLuint program, GLuint uniform, const T& value ) const
1863 if ( GetUniformValue( program, uniform, uniformValue ) )
1865 return value == uniformValue;
1871 bool GetUniformValue( GLuint program, GLuint uniform, T& value ) const
1878 typename Map::const_iterator it = Map::find( program );
1879 if( it == Map::end() )
1881 // Uniform values always initialised as 0
1886 const UniformValueMap& uniforms = it->second;
1887 typename UniformValueMap::const_iterator it2 = uniforms.find( uniform );
1888 if( it2 == uniforms.end() )
1890 // Uniform values always initialised as 0
1894 value = it2->second;
1901 ProgramUniformValue<int> mProgramUniforms1i;
1902 ProgramUniformValue<float> mProgramUniforms1f;
1903 ProgramUniformValue<Vector2> mProgramUniforms2f;
1904 ProgramUniformValue<Vector3> mProgramUniforms3f;
1905 ProgramUniformValue<Vector4> mProgramUniforms4f;
1906 ProgramUniformValue<Matrix> mProgramUniformsMat4;
1907 ProgramUniformValue<Matrix3> mProgramUniformsMat3;
1909 inline const ProgramUniformValue<int>& GetProgramUniformsForType( const int ) const
1911 return mProgramUniforms1i;
1913 inline const ProgramUniformValue<float>& GetProgramUniformsForType( const float ) const
1915 return mProgramUniforms1f;
1917 inline const ProgramUniformValue<Vector2>& GetProgramUniformsForType( const Vector2& ) const
1919 return mProgramUniforms2f;
1921 inline const ProgramUniformValue<Vector3>& GetProgramUniformsForType( const Vector3& ) const
1923 return mProgramUniforms3f;
1925 inline const ProgramUniformValue<Vector4>& GetProgramUniformsForType( const Vector4& ) const
1927 return mProgramUniforms4f;
1929 inline const ProgramUniformValue<Matrix>& GetProgramUniformsForType( const Matrix& ) const
1931 return mProgramUniformsMat4;
1933 inline const ProgramUniformValue<Matrix3>& GetProgramUniformsForType( const Matrix3& ) const
1935 return mProgramUniformsMat3;
1937 inline void SetVertexAttribArray(GLuint index, bool state)
1939 if( index >= MAX_ATTRIBUTE_CACHE_SIZE )
1944 mVertexAttribArrayState[ index ] = state;
1945 mVertexAttribArrayChanged = true;
1948 ScissorParams mScissorParams;
1952 inline int TestGlAbstraction::ProgramUniformValue<int>::GetZero() const
1958 inline float TestGlAbstraction::ProgramUniformValue<float>::GetZero() const
1964 inline Vector2 TestGlAbstraction::ProgramUniformValue<Vector2>::GetZero() const
1966 return Vector2::ZERO;
1970 inline Vector3 TestGlAbstraction::ProgramUniformValue<Vector3>::GetZero() const
1972 return Vector3::ZERO;
1976 inline Vector4 TestGlAbstraction::ProgramUniformValue<Vector4>::GetZero() const
1978 return Vector4::ZERO;
1982 inline Matrix TestGlAbstraction::ProgramUniformValue<Matrix>::GetZero() const
1988 inline Matrix3 TestGlAbstraction::ProgramUniformValue<Matrix3>::GetZero() const
1990 return Matrix3( Matrix() );
1995 bool BlendEnabled(const Dali::TraceCallStack& callStack);
1996 bool BlendDisabled(const Dali::TraceCallStack& callStack);
2001 #endif // __TEST_GL_ES_H__