-#ifndef __TEST_GL_ABSTRACTION_H__
-#define __TEST_GL_ABSTRACTION_H__
+#ifndef TEST_GL_ABSTRACTION_H
+#define TEST_GL_ABSTRACTION_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <sstream>
#include <string>
+#include <cstring>
#include <map>
#include <cstdio>
-#include <cstring> // strcpy
+#include <cstring> // for strcmp
+#include <typeinfo>
+
+// INTERNAL INCLUDES
#include <dali/public-api/dali-core.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
-
-// INTERNAL INCLUDES
-#include "test-trace-call-stack.h"
+#include <test-trace-call-stack.h>
+#include <test-compare-types.h>
namespace Dali
{
"aBoneIndices" // ATTRIB_BONE_INDICES
};
-class DALI_IMPORT_API TestGlAbstraction: public Dali::Integration::GlAbstraction
+class DALI_CORE_API TestGlAbstraction: public Dali::Integration::GlAbstraction
{
public:
TestGlAbstraction();
void Initialize();
void PreRender();
- void PostRender(unsigned int timeDelta);
+ void PostRender();
+
+ bool IsSurfacelessContextSupported() const;
+
+ bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const;
/* OpenGL ES 2.0 */
{
std::stringstream out;
out << program << ", " << shader;
- mShaderTrace.PushCall("AttachShader", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["program"] = ToString(program);
+ namedParams["shader"] = ToString(shader);
+ mShaderTrace.PushCall("AttachShader", out.str(), namedParams);
}
inline void BindAttribLocation( GLuint program, GLuint index, const char* name )
std::stringstream out;
out << target << ", " << texture;
- mTextureTrace.PushCall("BindTexture", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["texture"] = ToString(texture);
+
+ mTextureTrace.PushCall("BindTexture", out.str(), namedParams);
}
inline void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
inline void ClearStencil(GLint s)
{
+ std::stringstream out;
+ out << s;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["s"] = ToString( s );
+
+ mStencilFunctionTrace.PushCall( "ClearStencil", out.str(), namedParams );
}
inline void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{
+ mColorMaskParams.red = red;
+ mColorMaskParams.green = green;
+ mColorMaskParams.blue = blue;
+ mColorMaskParams.alpha = alpha;
}
inline void CompileShader(GLuint shader)
{
std::stringstream out;
out << shader;
- mShaderTrace.PushCall("CompileShader", out.str());
+ TraceCallStack::NamedParams namedParams;
+ namedParams["shader"] = ToString(shader);
+
+ mShaderTrace.PushCall("CompileShader", out.str(), namedParams);
}
inline void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
{
+ std::stringstream out;
+ out << target<<", "<<level<<", "<<width << ", " << height;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
+ namedParams["internalformat"] = ToString(internalformat);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ namedParams["border"] = ToString(border);
+ namedParams["size"] = ToString(imageSize);
+
+ mTextureTrace.PushCall("CompressedTexImage2D", out.str(), namedParams);
}
inline void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
{
+ std::stringstream out;
+ out << target << ", "<<level <<", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
+ namedParams["xoffset"] = ToString(xoffset);
+ namedParams["yoffset"] = ToString(yoffset);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ mTextureTrace.PushCall("CompressedTexSubImage2D", out.str(), namedParams);
}
inline void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
{
std::stringstream out;
out << type;
- mShaderTrace.PushCall("CreateShader", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["type"] = ToString(type);
+ mShaderTrace.PushCall("CreateShader", out.str(), namedParams);
return ++mLastShaderIdUsed;
}
{
std::stringstream out;
out << mode;
- mCullFaceTrace.PushCall("CullFace", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["program"] = ToString(mode);
+
+ mCullFaceTrace.PushCall("CullFace", out.str(), namedParams);
}
inline void DeleteBuffers(GLsizei n, const GLuint* buffers)
{
std::stringstream out;
out << program;
- mShaderTrace.PushCall("DeleteProgram", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["program"] = ToString(program);
+
+ mShaderTrace.PushCall("DeleteProgram", out.str(), namedParams);
}
inline void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
{
std::stringstream out;
out << shader;
- mShaderTrace.PushCall("DeleteShader", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["shader"] = ToString(shader);
+
+ mShaderTrace.PushCall("DeleteShader", out.str(), namedParams);
}
inline void DeleteTextures(GLsizei n, const GLuint* textures)
{
std::stringstream out;
- out << n << ", " << textures << " = [" ;
+ out << n << ", " << textures << " = [";
+
+ TraceCallStack::NamedParams namedParams;
for(GLsizei i=0; i<n; i++)
{
- out << textures[i] << ", " ;
+ out << textures[i] << ", ";
+ std::stringstream paramName;
+ paramName<<"texture["<<i<<"]";
+ namedParams[paramName.str()] = ToString(textures[i]);
mDeletedTextureIds.push_back(textures[i]);
+ mNumGeneratedTextures--;
}
out << "]";
- mTextureTrace.PushCall("DeleteTextures", out.str());
+
+ mTextureTrace.PushCall("DeleteTextures", out.str(), namedParams);
}
inline bool CheckNoTexturesDeleted()
inline void DepthFunc(GLenum func)
{
+ std::stringstream out;
+ out << func;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["func"] = ToString(func);
+
+ mDepthFunctionTrace.PushCall("DepthFunc", out.str(), namedParams);
}
inline void DepthMask(GLboolean flag)
{
+ mLastDepthMask = flag;
+ }
+
+ inline bool GetLastDepthMask() const
+ {
+ return mLastDepthMask;
}
inline void DepthRangef(GLclampf zNear, GLclampf zFar)
{
std::stringstream out;
out << program << ", " << shader;
- mShaderTrace.PushCall("DetachShader", out.str());
+ TraceCallStack::NamedParams namedParams;
+ namedParams["program"] = ToString(program);
+ namedParams["shader"] = ToString(shader);
+ mShaderTrace.PushCall("DetachShader", out.str(), namedParams);
}
inline void Disable(GLenum cap)
{
std::stringstream out;
out << cap;
- mCullFaceTrace.PushCall("Disable", out.str());
+ TraceCallStack::NamedParams namedParams;
+ namedParams["cap"] = ToString(cap);
+ mEnableDisableTrace.PushCall("Disable", out.str(), namedParams);
}
inline void DisableVertexAttribArray(GLuint index)
{
std::stringstream out;
out << mode << ", " << first << ", " << count;
- mDrawTrace.PushCall("DrawArrays", out.str());
+ TraceCallStack::NamedParams namedParams;
+ namedParams["mode"] = ToString(mode);
+ namedParams["first"] = ToString(first);
+ namedParams["count"] = ToString(count);
+ mDrawTrace.PushCall("DrawArrays", out.str(), namedParams);
}
inline void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
{
std::stringstream out;
out << mode << ", " << count << ", " << type << ", indices";
- mDrawTrace.PushCall("DrawElements", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["mode"] = ToString(mode);
+ namedParams["count"] = ToString(count);
+ namedParams["type"] = ToString(type);
+ // Skip void pointers - are they of any use?
+ mDrawTrace.PushCall("DrawElements", out.str(), namedParams);
}
inline void Enable(GLenum cap)
{
std::stringstream out;
out << cap;
- mCullFaceTrace.PushCall("Enable", out.str());
+ TraceCallStack::NamedParams namedParams;
+ namedParams["cap"] = ToString(cap);
+ mEnableDisableTrace.PushCall("Enable", out.str(), namedParams);
}
inline void EnableVertexAttribArray(GLuint index)
inline void GenerateMipmap(GLenum target)
{
+ std::stringstream out;
+ out<<target;
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+
+ mTextureTrace.PushCall("GenerateMipmap", out.str(), namedParams);
}
inline void GenFramebuffers(GLsizei n, GLuint* framebuffers)
return mNextTextureIds;
}
- inline void GenTextures(GLsizei n, GLuint* textures)
+ inline void GenTextures(GLsizei count, GLuint* textures)
{
- for( int i=0; i<n; ++i )
+ for( int i=0; i<count; ++i )
{
if( !mNextTextureIds.empty() )
{
{
*(textures+i) = ++mLastAutoTextureIdUsed;
}
+ mNumGeneratedTextures++;
}
+ TraceCallStack::NamedParams namedParams;
+ namedParams["count"] = ToString(count);
+
std::stringstream out;
- for(int i=0; i<n; i++)
+ for(int i=0; i<count; i++)
{
out << textures[i];
- if(i<n-1)
+ if(i<count-1)
{
out << ", ";
}
+ std::ostringstream oss;
+ oss<<"indices["<<i<<"]";
+ namedParams[oss.str()] = ToString(textures[i]);
}
- mTextureTrace.PushCall("GenTextures", out.str());
+
+ mTextureTrace.PushCall("GenTextures", out.str(), namedParams);
+ }
+
+ inline GLuint GetLastGenTextureId()
+ {
+ return mLastAutoTextureIdUsed;
+ }
+ inline GLuint GetNumGeneratedTextures()
+ {
+ return mNumGeneratedTextures;
}
inline void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
inline void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
{
+ switch(index)
+ {
+ case 0:
+ *length = snprintf(name, bufsize, "sTexture");
+ *type = GL_SAMPLER_2D;
+ *size = 1;
+ break;
+ case 1:
+ *length = snprintf(name, bufsize, "sEffect");
+ *type = GL_SAMPLER_2D;
+ *size = 1;
+ break;
+ case 2:
+ *length = snprintf(name, bufsize, "sGloss");
+ *type = GL_SAMPLER_2D;
+ *size = 1;
+ break;
+ default:
+ break;
+ }
}
inline void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
inline void GetProgramiv(GLuint program, GLenum pname, GLint* params)
{
- switch( pname ) {
+ switch( pname )
+ {
case GL_LINK_STATUS:
*params = mLinkStatus;
break;
case GL_PROGRAM_BINARY_LENGTH_OES:
*params = mProgramBinaryLength;
break;
+ case GL_ACTIVE_UNIFORMS:
+ *params = mNumberOfActiveUniforms;
+ break;
+ case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+ *params = 100;
+ break;
}
}
{
}
-
inline void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
}
{
std::stringstream out;
out << program;
- mShaderTrace.PushCall("LinkProgram", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["program"] = ToString(program);
+ mShaderTrace.PushCall("LinkProgram", out.str(), namedParams);
+
+ mNumberOfActiveUniforms=3;
+ GetUniformLocation(program, "sTexture");
+ GetUniformLocation(program, "sEffect");
+ GetUniformLocation(program, "sGloss");
}
inline void PixelStorei(GLenum pname, GLint param)
mScissorParams.y = y;
mScissorParams.width = width;
mScissorParams.height = height;
+
+ std::stringstream out;
+ out << x << ", " << y << ", " << width << ", " << height;
+ TraceCallStack::NamedParams namedParams;
+ namedParams["x"] = ToString( x );
+ namedParams["y"] = ToString( y );
+ namedParams["width"] = ToString( width );
+ namedParams["height"] = ToString( height );
+ mScissorTrace.PushCall( "Scissor", out.str(), namedParams );
}
inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
{
const std::string shaderSource = mShaderSources[shader];
- if( static_cast<int>(shaderSource.length()) < bufsize )
+ const int shaderSourceLength = static_cast<int>(shaderSource.length());
+ if( shaderSourceLength < bufsize )
{
- strcpy(source, shaderSource.c_str());
- *length = shaderSource.length();
+ strncpy( source, shaderSource.c_str(), shaderSourceLength );
+ *length = shaderSourceLength;
}
else
{
inline void StencilFunc(GLenum func, GLint ref, GLuint mask)
{
+ std::stringstream out;
+ out << func << ", " << ref << ", " << mask;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["func"] = ToString( func );
+ namedParams["ref"] = ToString( ref );
+ namedParams["mask"] = ToString( mask );
+
+ mStencilFunctionTrace.PushCall( "StencilFunc", out.str(), namedParams );
}
inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
{
+ std::stringstream out;
+ out << face << ", " << func << ", " << ref << ", " << mask;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["face"] = ToString( face );
+ namedParams["func"] = ToString( func );
+ namedParams["ref"] = ToString( ref );
+ namedParams["mask"] = ToString( mask );
+
+ mStencilFunctionTrace.PushCall( "StencilFuncSeparate", out.str(), namedParams );
}
inline void StencilMask(GLuint mask)
{
+ std::stringstream out;
+ out << mask;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["mask"] = ToString( mask );
+
+ mStencilFunctionTrace.PushCall( "StencilMask", out.str(), namedParams );
}
inline void StencilMaskSeparate(GLenum face, GLuint mask)
{
+ std::stringstream out;
+ out << face << ", " << mask;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["face"] = ToString( face );
+ namedParams["mask"] = ToString( mask );
+
+ mStencilFunctionTrace.PushCall( "StencilMaskSeparate", out.str(), namedParams );
}
inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
{
+ std::stringstream out;
+ out << fail << ", " << zfail << ", " << zpass;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["fail"] = ToString( fail );
+ namedParams["zfail"] = ToString( zfail );
+ namedParams["zpass"] = ToString( zpass );
+
+ mStencilFunctionTrace.PushCall( "StencilOp", out.str(), namedParams );
}
inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
{
+ std::stringstream out;
+ out << face << ", " << fail << ", " << zfail << "," << zpass;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["face"] = ToString( face );
+ namedParams["fail"] = ToString( fail );
+ namedParams["zfail"] = ToString( zfail );
+ namedParams["zpass"] = ToString( zpass );
+
+ mStencilFunctionTrace.PushCall( "StencilOpSeparate", out.str(), namedParams );
}
inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
{
std::stringstream out;
- out << width << ", " << height;
- mTextureTrace.PushCall("TexImage2D", out.str());
+ out << target<<", "<<level<<", "<<width << ", " << height;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
+ namedParams["internalformat"] = ToString(internalformat);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ namedParams["border"] = ToString(border);
+ namedParams["format"] = ToString(format);
+ namedParams["type"] = ToString(type);
+
+ mTextureTrace.PushCall("TexImage2D", out.str(), namedParams);
}
inline void TexParameterf(GLenum target, GLenum pname, GLfloat param)
{
std::stringstream out;
out << target << ", " << pname << ", " << param;
- mTexParamaterTrace.PushCall("TexParameterf", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["pname"] = ToString(pname);
+ namedParams["param"] = ToString(param);
+
+ mTexParamaterTrace.PushCall("TexParameterf", out.str(), namedParams);
}
inline void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
{
std::stringstream out;
out << target << ", " << pname << ", " << params[0];
- mTexParamaterTrace.PushCall("TexParameterfv", out.str());
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["pname"] = ToString(pname);
+ namedParams["params[0]"] = ToString(params[0]);
+
+ mTexParamaterTrace.PushCall("TexParameterfv", out.str(), namedParams);
}
inline void TexParameteri(GLenum target, GLenum pname, GLint param)
{
std::stringstream out;
out << target << ", " << pname << ", " << param;
- mTexParamaterTrace.PushCall("TexParameteri", out.str());
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["pname"] = ToString(pname);
+ namedParams["param"] = ToString(param);
+ mTexParamaterTrace.PushCall("TexParameteri", out.str(), namedParams);
}
inline void TexParameteriv(GLenum target, GLenum pname, const GLint* params)
{
std::stringstream out;
out << target << ", " << pname << ", " << params[0];
- mTexParamaterTrace.PushCall("TexParameteriv", out.str());
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["pname"] = ToString(pname);
+ namedParams["params[0]"] = ToString(params[0]);
+ mTexParamaterTrace.PushCall("TexParameteriv", out.str(), namedParams);
}
inline void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
{
std::stringstream out;
- out << xoffset << ", " << yoffset << ", " << width << ", " << height;
- mTextureTrace.PushCall("TexSubImage2D", out.str());
+ out << target << ", "<<level <<", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
+
+ TraceCallStack::NamedParams namedParams;
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
+ namedParams["xoffset"] = ToString(xoffset);
+ namedParams["yoffset"] = ToString(yoffset);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ mTextureTrace.PushCall("TexSubImage2D", out.str(), namedParams);
}
- inline void Uniform1f(GLint location, GLfloat x)
+ inline void Uniform1f(GLint location, GLfloat value )
{
- if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, x ) )
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
+ if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, value ) )
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params;
+ for( int i = 0; i < count; ++i )
+ {
+ params = params + ToString( v[i] ) + ",";
+ }
+
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, v[i] ) )
inline void Uniform1i(GLint location, GLint x)
{
+ std::string params = ToString( x );
+
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, location, x ) )
{
mGetErrorResult = GL_INVALID_OPERATION;
inline void Uniform1iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram,
inline void Uniform2f(GLint location, GLfloat x, GLfloat y)
{
+ std::string params = ToString( x ) + "," + ToString( y );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
location,
Vector2( x, y ) ) )
inline void Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
inline void Uniform2i(GLint location, GLint x, GLint y)
{
+ std::string params = ToString( x ) + "," + ToString( y );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform2iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms3f.SetUniformValue( mCurrentProgram,
location,
Vector3( x, y, z ) ) )
inline void Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms3f.SetUniformValue(
inline void Uniform3i(GLint location, GLint x, GLint y, GLint z)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform3iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms4f.SetUniformValue( mCurrentProgram,
location,
Vector4( x, y, z, w ) ) )
inline void Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms4f.SetUniformValue(
inline void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform4iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
}
inline void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniformsMat3.SetUniformValue(
inline void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniformsMat4.SetUniformValue(
inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
+ std::string commaString(", ");
+ std::string params( std::to_string(x) + commaString + std::to_string(y) + commaString + std::to_string(width) + commaString + std::to_string(height) );
+
+ mViewportTrace.PushCall("Viewport", params);
}
/* OpenGL ES 3.0 */
{
}
+private:
+
+ inline void AddUniformCallToTraceStack( GLint location, std::string& value )
+ {
+ std::string name = "<not found>";
+ bool matched = false;
+
+ UniformIDMap& map = mUniforms[mCurrentProgram];
+ for (UniformIDMap::iterator it=map.begin(); it!=map.end(); ++it)
+ {
+ if( it->second == location )
+ {
+ name = it->first;
+ matched = true;
+ break;
+ }
+ }
+
+ if ( matched )
+ {
+ mSetUniformTrace.PushCall( name, value );
+ }
+ }
+
+
public: // TEST FUNCTIONS
inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; }
inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; }
inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); }
inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; }
+ //Methods for Enable/Disable call verification
+ inline void EnableEnableDisableCallTrace(bool enable) { mEnableDisableTrace.Enable(enable); }
+ inline void ResetEnableDisableCallStack() { mEnableDisableTrace.Reset(); }
+ inline TraceCallStack& GetEnableDisableTrace() { return mEnableDisableTrace; }
+
//Methods for Shader verification
inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); }
inline void ResetShaderCallStack() { mShaderTrace.Reset(); }
inline void ResetDrawCallStack() { mDrawTrace.Reset(); }
inline TraceCallStack& GetDrawTrace() { return mDrawTrace; }
+ //Methods for Depth function verification
+ inline void EnableDepthFunctionCallTrace(bool enable) { mDepthFunctionTrace.Enable(enable); }
+ inline void ResetDepthFunctionCallStack() { mDepthFunctionTrace.Reset(); }
+ inline TraceCallStack& GetDepthFunctionTrace() { return mDepthFunctionTrace; }
+
+ //Methods for Stencil function verification
+ inline void EnableStencilFunctionCallTrace(bool enable) { mStencilFunctionTrace.Enable(enable); }
+ inline void ResetStencilFunctionCallStack() { mStencilFunctionTrace.Reset(); }
+ inline TraceCallStack& GetStencilFunctionTrace() { return mStencilFunctionTrace; }
+
+ //Methods for Scissor verification
+ inline void EnableScissorCallTrace(bool enable) { mScissorTrace.Enable(enable); }
+ inline void ResetScissorCallStack() { mScissorTrace.Reset(); }
+ inline TraceCallStack& GetScissorTrace() { return mScissorTrace; }
+
+ //Methods for Uniform function verification
+ inline void EnableSetUniformCallTrace(bool enable) { mSetUniformTrace.Enable(enable); }
+ inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); }
+ inline TraceCallStack& GetSetUniformTrace() { return mSetUniformTrace; }
+
+ //Methods for Viewport verification
+ inline void EnableViewportCallTrace(bool enable) { mViewportTrace.Enable(enable); }
+ inline void ResetViewportCallStack() { mViewportTrace.Reset(); }
+ inline TraceCallStack& GetViewportTrace() { return mViewportTrace; }
+
template <typename T>
inline bool GetUniformValue( const char* name, T& value ) const
{
return false;
}
-
-
inline GLuint GetLastShaderCompiled() const
{
return mLastShaderCompiled;
// Methods to check scissor tests
inline const ScissorParams& GetScissorParams() const { return mScissorParams; }
+ struct ColorMaskParams
+ {
+ GLboolean red;
+ GLboolean green;
+ GLboolean blue;
+ GLboolean alpha;
+
+ ColorMaskParams() : red( true ), green( true ), blue( true ), alpha( true ) { }
+ };
+
inline bool GetProgramBinaryCalled() const { return mGetProgramBinaryCalled; }
inline unsigned int GetClearCountCalled() const { return mClearCount; }
+ inline const ColorMaskParams& GetColorMaskParams() const { return mColorMaskParams; }
+
typedef std::vector<size_t> BufferDataCalls;
inline const BufferDataCalls& GetBufferDataCalls() const { return mBufferDataCalls; }
inline void ResetBufferDataCalls() { mBufferDataCalls.clear(); }
BufferDataCalls mBufferDataCalls;
BufferSubDataCalls mBufferSubDataCalls;
GLuint mLinkStatus;
+ GLint mNumberOfActiveUniforms;
GLint mGetAttribLocationResult;
GLenum mGetErrorResult;
GLubyte* mGetStringResult;
GLenum mLastBlendFuncSrcAlpha;
GLenum mLastBlendFuncDstAlpha;
+ GLboolean mLastDepthMask;
+
// Data for manipulating the IDs returned by GenTextures
GLuint mLastAutoTextureIdUsed;
+ GLuint mNumGeneratedTextures;
std::vector<GLuint> mNextTextureIds;
std::vector<GLuint> mDeletedTextureIds;
std::vector<GLuint> mBoundTextures;
ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ];
TraceCallStack mCullFaceTrace;
+ TraceCallStack mEnableDisableTrace;
TraceCallStack mShaderTrace;
TraceCallStack mTextureTrace;
TraceCallStack mTexParamaterTrace;
TraceCallStack mDrawTrace;
+ TraceCallStack mDepthFunctionTrace;
+ TraceCallStack mStencilFunctionTrace;
+ TraceCallStack mScissorTrace;
+ TraceCallStack mSetUniformTrace;
+ TraceCallStack mViewportTrace;
// Shaders & Uniforms
GLuint mLastShaderIdUsed;
T uniformValue;
if ( GetUniformValue( program, uniform, uniformValue ) )
{
- return value == uniformValue;
+ return CompareType<T>(value, uniformValue, Math::MACHINE_EPSILON_10);
}
return false;
}
ScissorParams mScissorParams;
+ ColorMaskParams mColorMaskParams;
};
template <>
bool BlendDisabled(const Dali::TraceCallStack& callStack);
-
-
-#endif // __TEST_GL_ES_H__
+#endif // TEST_GL_ABSTRACTION_H