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)
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)
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; }
+
template <typename T>
inline bool GetUniformValue( const char* name, T& value ) const
{
// 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(); }
TraceCallStack mTexParamaterTrace;
TraceCallStack mDrawTrace;
TraceCallStack mDepthFunctionTrace;
+ TraceCallStack mStencilFunctionTrace;
// Shaders & Uniforms
GLuint mLastShaderIdUsed;
}
ScissorParams mScissorParams;
+ ColorMaskParams mColorMaskParams;
};
template <>
-#ifndef __TEST_TRACE_CALL_STACK_H__
-#define __TEST_TRACE_CALL_STACK_H__
+#ifndef TEST_TRACE_CALL_STACK_H
+#define TEST_TRACE_CALL_STACK_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
#include <string>
#include <vector>
#include <map>
+#include <sstream>
namespace Dali
{
class TraceCallStack
{
public:
+
/// Typedef for passing and storing named parameters
typedef std::map< std::string, std::string > NamedParams;
*/
void Reset();
+ /**
+ * Method to display contents of the TraceCallStack.
+ * @return A string containing a list of function calls and parameters (may contain newline characters)
+ */
+ std::string GetTraceString()
+ {
+ std::stringstream traceStream;
+ int functionCount = mCallStack.size();
+ for( int i = 0; i < functionCount; ++i )
+ {
+ Dali::TraceCallStack::FunctionCall functionCall = mCallStack[ i ];
+ traceStream << "StackTrace: Index:" << i << ", Function:" << functionCall.method << ", ParamList:" << functionCall.paramList << std::endl;
+ }
+
+ return traceStream.str();
+ }
+
private:
bool mTraceActive; ///< True if the trace is active
} // namespace dali
-#endif //__TEST_TRACE_CALL_STACK_H__
+#endif // TEST_TRACE_CALL_STACK_H