Syncing common test files.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-gl-abstraction.h
index c69e4e3..098f555 100644 (file)
@@ -59,7 +59,9 @@ public:
   void PreRender();
   void PostRender();
 
   void PreRender();
   void PostRender();
 
-  void ConvertTexture( uint8_t* buffer, GLenum& imageGlFormat, const uint32_t dataSize, const GLenum textureGlFormat, const bool isSubImage );
+  bool IsSurfacelessContextSupported() const;
+
+  bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const;
 
   /* OpenGL ES 2.0 */
 
 
   /* OpenGL ES 2.0 */
 
@@ -250,9 +252,9 @@ public:
     return mCheckFramebufferStatusResult;
   }
 
     return mCheckFramebufferStatusResult;
   }
 
-  inline GLenum CheckFramebufferColorAttachment()
+  inline GLuint CheckFramebufferColorAttachmentCount()
   {
   {
-    return mFramebufferColorAttached;
+    return mFramebufferColorAttachmentCount;
   }
 
   inline GLenum CheckFramebufferDepthAttachment()
   }
 
   inline GLenum CheckFramebufferDepthAttachment()
@@ -273,6 +275,15 @@ public:
 
   inline void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
   {
 
   inline void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
   {
+    mLastClearColor.r = red;
+    mLastClearColor.g = green;
+    mLastClearColor.b = blue;
+    mLastClearColor.a = alpha;
+  }
+
+  inline const Vector4& GetLastClearColor() const
+  {
+    return mLastClearColor;
   }
 
   inline void ClearDepthf(GLclampf depth)
   }
 
   inline void ClearDepthf(GLclampf depth)
@@ -573,9 +584,14 @@ public:
     mFramebufferStatus |= 4;
 
     //We check 4 attachment colors
     mFramebufferStatus |= 4;
 
     //We check 4 attachment colors
-    if ((attachment == GL_COLOR_ATTACHMENT0) || (attachment == GL_COLOR_ATTACHMENT1) || (attachment == GL_COLOR_ATTACHMENT2)  || (attachment == GL_COLOR_ATTACHMENT4))
+    if ((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS))
     {
     {
-      mFramebufferColorAttached = true;
+      uint8_t mask = 1 << (attachment - GL_COLOR_ATTACHMENT0);
+      if ((mFrameBufferColorStatus & mask) == 0)
+      {
+        mFrameBufferColorStatus |= mask;
+        ++mFramebufferColorAttachmentCount;
+      }
     }
   }
 
     }
   }
 
@@ -1434,6 +1450,10 @@ public:
 
   inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
   {
 
   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 */
   }
 
   /* OpenGL ES 3.0 */
@@ -1972,6 +1992,11 @@ public: // TEST FUNCTIONS
   inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); }
   inline TraceCallStack& GetSetUniformTrace() { return mSetUniformTrace; }
 
   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
   {
   template <typename T>
   inline bool GetUniformValue( const char* name, T& value ) const
   {
@@ -2158,9 +2183,10 @@ private:
   GLenum     mActiveTextureUnit;
   GLenum     mCheckFramebufferStatusResult;
   GLint      mFramebufferStatus;
   GLenum     mActiveTextureUnit;
   GLenum     mCheckFramebufferStatusResult;
   GLint      mFramebufferStatus;
-  GLenum     mFramebufferColorAttached;
   GLenum     mFramebufferDepthAttached;
   GLenum     mFramebufferStencilAttached;
   GLenum     mFramebufferDepthAttached;
   GLenum     mFramebufferStencilAttached;
+  GLuint     mFramebufferColorAttachmentCount;
+  GLuint     mFrameBufferColorStatus;
   GLint      mNumBinaryFormats;
   GLint      mBinaryFormats;
   GLint      mProgramBinaryLength;
   GLint      mNumBinaryFormats;
   GLint      mBinaryFormats;
   GLint      mProgramBinaryLength;
@@ -2171,6 +2197,7 @@ private:
   ShaderSourceMap mShaderSources;
   GLuint     mLastShaderCompiled;
   GLbitfield mLastClearBitMask;
   ShaderSourceMap mShaderSources;
   GLuint     mLastShaderCompiled;
   GLbitfield mLastClearBitMask;
+  Vector4 mLastClearColor;
   unsigned int mClearCount;
 
   Vector4 mLastBlendColor;
   unsigned int mClearCount;
 
   Vector4 mLastBlendColor;
@@ -2207,6 +2234,7 @@ private:
   TraceCallStack mStencilFunctionTrace;
   TraceCallStack mScissorTrace;
   TraceCallStack mSetUniformTrace;
   TraceCallStack mStencilFunctionTrace;
   TraceCallStack mScissorTrace;
   TraceCallStack mSetUniformTrace;
+  TraceCallStack mViewportTrace;
 
   // Shaders & Uniforms
   GLuint mLastShaderIdUsed;
 
   // Shaders & Uniforms
   GLuint mLastShaderIdUsed;