Use stencil buffer when use SceneView's FrameBuffer 30/280630/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 1 Sep 2022 11:07:48 +0000 (20:07 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 2 Sep 2022 13:43:12 +0000 (22:43 +0900)
There is no reason to block the Stencil buffer for FBO.

Change-Id: I272d4143f47a9ed27e49719fb8294d4c3ee646da
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp

index e6416e3..7a31046 100644 (file)
@@ -46,28 +46,32 @@ TestGlAbstraction::~TestGlAbstraction()
 
 void TestGlAbstraction::Initialize()
 {
 
 void TestGlAbstraction::Initialize()
 {
-  mCurrentProgram                  = 0;
-  mCompileStatus                   = GL_TRUE;
-  mLinkStatus                      = GL_TRUE;
-  mGetErrorResult                  = 0;
-  mGetStringResult                 = NULL;
-  mIsBufferResult                  = 0;
-  mIsEnabledResult                 = 0;
-  mIsFramebufferResult             = 0;
-  mIsProgramResult                 = 0;
-  mIsRenderbufferResult            = 0;
-  mIsShaderResult                  = 0;
-  mIsTextureResult                 = 0;
-  mActiveTextureUnit               = 0;
-  mCheckFramebufferStatusResult    = 0;
-  mFramebufferStatus               = 0;
-  mFramebufferDepthAttached        = 0;
-  mFramebufferStencilAttached      = 0;
-  mFramebufferColorAttachmentCount = 0;
-  mFrameBufferColorStatus          = 0;
-  mNumBinaryFormats                = 0;
-  mBinaryFormats                   = 0;
-  mProgramBinaryLength             = 0;
+  mCurrentProgram                         = 0;
+  mCompileStatus                          = GL_TRUE;
+  mLinkStatus                             = GL_TRUE;
+  mGetErrorResult                         = 0;
+  mGetStringResult                        = NULL;
+  mIsBufferResult                         = 0;
+  mIsEnabledResult                        = 0;
+  mIsFramebufferResult                    = 0;
+  mIsProgramResult                        = 0;
+  mIsRenderbufferResult                   = 0;
+  mIsShaderResult                         = 0;
+  mIsTextureResult                        = 0;
+  mActiveTextureUnit                      = 0;
+  mCheckFramebufferStatusResult           = 0;
+  mFramebufferStatus                      = 0;
+  mFramebufferDepthAttached               = 0;
+  mFramebufferStencilAttached             = 0;
+  mFramebufferDepthStencilAttached        = 0;
+  mFramebufferColorAttachmentCount        = 0;
+  mFrameBufferColorStatus                 = 0;
+  mFramebufferDepthAttachmentCount        = 0;
+  mFramebufferStencilAttachmentCount      = 0;
+  mFramebufferDepthStencilAttachmentCount = 0;
+  mNumBinaryFormats                       = 0;
+  mBinaryFormats                          = 0;
+  mProgramBinaryLength                    = 0;
 
   mVertexAttribArrayChanged = false;
   mGetProgramBinaryCalled   = false;
 
   mVertexAttribArrayChanged = false;
   mGetProgramBinaryCalled   = false;
index a1f8405..f6878ae 100644 (file)
@@ -299,6 +299,21 @@ public:
     return mFramebufferColorAttachmentCount;
   }
 
     return mFramebufferColorAttachmentCount;
   }
 
+  inline GLuint CheckFramebufferDepthAttachmentCount()
+  {
+    return mFramebufferDepthAttachmentCount;
+  }
+
+  inline GLuint CheckFramebufferStencilAttachmentCount()
+  {
+    return mFramebufferStencilAttachmentCount;
+  }
+
+  inline GLuint CheckFramebufferDepthStencilAttachmentCount()
+  {
+    return mFramebufferDepthStencilAttachmentCount;
+  }
+
   inline GLenum CheckFramebufferDepthAttachment()
   {
     return mFramebufferDepthAttached;
   inline GLenum CheckFramebufferDepthAttachment()
   {
     return mFramebufferDepthAttached;
@@ -309,6 +324,11 @@ public:
     return mFramebufferStencilAttached;
   }
 
     return mFramebufferStencilAttached;
   }
 
+  inline GLenum CheckFramebufferDepthStencilAttachment()
+  {
+    return mFramebufferDepthStencilAttached;
+  }
+
   inline void Clear(GLbitfield mask) override
   {
     mClearCount++;
   inline void Clear(GLbitfield mask) override
   {
     mClearCount++;
@@ -630,8 +650,9 @@ public:
     }
     else if(attachment == GL_DEPTH_STENCIL_ATTACHMENT)
     {
     }
     else if(attachment == GL_DEPTH_STENCIL_ATTACHMENT)
     {
-      mFramebufferStencilAttached = true;
-      mFramebufferDepthAttached   = true;
+      mFramebufferStencilAttached      = true;
+      mFramebufferDepthAttached        = true;
+      mFramebufferDepthStencilAttached = true;
     }
   }
 
     }
   }
 
@@ -650,6 +671,20 @@ public:
         ++mFramebufferColorAttachmentCount;
       }
     }
         ++mFramebufferColorAttachmentCount;
       }
     }
+    else if(attachment == GL_DEPTH_ATTACHMENT)
+    {
+      ++mFramebufferDepthAttachmentCount;
+    }
+    else if(attachment == GL_STENCIL_ATTACHMENT)
+    {
+      ++mFramebufferStencilAttachmentCount;
+    }
+    else if(attachment == GL_DEPTH_STENCIL_ATTACHMENT)
+    {
+      ++mFramebufferDepthAttachmentCount;
+      ++mFramebufferStencilAttachmentCount;
+      ++mFramebufferDepthStencilAttachmentCount;
+    }
   }
 
   inline void FrontFace(GLenum mode) override
   }
 
   inline void FrontFace(GLenum mode) override
@@ -2491,8 +2526,12 @@ public:
   GLint                                 mFramebufferStatus;
   GLenum                                mFramebufferDepthAttached;
   GLenum                                mFramebufferStencilAttached;
   GLint                                 mFramebufferStatus;
   GLenum                                mFramebufferDepthAttached;
   GLenum                                mFramebufferStencilAttached;
+  GLenum                                mFramebufferDepthStencilAttached;
   GLuint                                mFramebufferColorAttachmentCount;
   GLuint                                mFrameBufferColorStatus;
   GLuint                                mFramebufferColorAttachmentCount;
   GLuint                                mFrameBufferColorStatus;
+  GLuint                                mFramebufferDepthAttachmentCount;
+  GLuint                                mFramebufferStencilAttachmentCount;
+  GLuint                                mFramebufferDepthStencilAttachmentCount;
   GLint                                 mNumBinaryFormats;
   GLint                                 mBinaryFormats;
   GLint                                 mProgramBinaryLength;
   GLint                                 mNumBinaryFormats;
   GLint                                 mBinaryFormats;
   GLint                                 mProgramBinaryLength;
index c43334e..659dd5a 100644 (file)
@@ -360,7 +360,7 @@ void SceneView::UpdateRenderTask()
 
         // create offscreen buffer of new size to render our child actors to
         mTexture      = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, unsigned(size.width), unsigned(size.height));
 
         // create offscreen buffer of new size to render our child actors to
         mTexture      = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, unsigned(size.width), unsigned(size.height));
-        mRenderTarget = FrameBuffer::New(size.width, size.height, FrameBuffer::Attachment::DEPTH);
+        mRenderTarget = FrameBuffer::New(size.width, size.height, FrameBuffer::Attachment::DEPTH_STENCIL);
         mRenderTarget.AttachColorTexture(mTexture);
         Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(mRenderTarget, 0u);
 
         mRenderTarget.AttachColorTexture(mTexture);
         Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(mRenderTarget, 0u);