From b49330a83a1f09d3437225e31619f94efdf97cf3 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 1 Sep 2022 20:07:48 +0900 Subject: [PATCH] Use stencil buffer when use SceneView's FrameBuffer There is no reason to block the Stencil buffer for FBO. Change-Id: I272d4143f47a9ed27e49719fb8294d4c3ee646da Signed-off-by: Eunki, Hong --- .../test-gl-abstraction.cpp | 48 ++++++++++++---------- .../dali-toolkit-test-utils/test-gl-abstraction.h | 43 ++++++++++++++++++- .../controls/scene-view/scene-view-impl.cpp | 2 +- 3 files changed, 68 insertions(+), 25 deletions(-) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp index e6416e3..7a31046 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp @@ -46,28 +46,32 @@ TestGlAbstraction::~TestGlAbstraction() 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; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h index a1f8405..f6878ae 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h @@ -299,6 +299,21 @@ public: return mFramebufferColorAttachmentCount; } + inline GLuint CheckFramebufferDepthAttachmentCount() + { + return mFramebufferDepthAttachmentCount; + } + + inline GLuint CheckFramebufferStencilAttachmentCount() + { + return mFramebufferStencilAttachmentCount; + } + + inline GLuint CheckFramebufferDepthStencilAttachmentCount() + { + return mFramebufferDepthStencilAttachmentCount; + } + inline GLenum CheckFramebufferDepthAttachment() { return mFramebufferDepthAttached; @@ -309,6 +324,11 @@ public: return mFramebufferStencilAttached; } + inline GLenum CheckFramebufferDepthStencilAttachment() + { + return mFramebufferDepthStencilAttached; + } + inline void Clear(GLbitfield mask) override { mClearCount++; @@ -630,8 +650,9 @@ public: } else if(attachment == GL_DEPTH_STENCIL_ATTACHMENT) { - mFramebufferStencilAttached = true; - mFramebufferDepthAttached = true; + mFramebufferStencilAttached = true; + mFramebufferDepthAttached = true; + mFramebufferDepthStencilAttached = true; } } @@ -650,6 +671,20 @@ public: ++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 @@ -2491,8 +2526,12 @@ public: GLint mFramebufferStatus; GLenum mFramebufferDepthAttached; GLenum mFramebufferStencilAttached; + GLenum mFramebufferDepthStencilAttached; GLuint mFramebufferColorAttachmentCount; GLuint mFrameBufferColorStatus; + GLuint mFramebufferDepthAttachmentCount; + GLuint mFramebufferStencilAttachmentCount; + GLuint mFramebufferDepthStencilAttachmentCount; GLint mNumBinaryFormats; GLint mBinaryFormats; GLint mProgramBinaryLength; diff --git a/dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp b/dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp index c43334e..659dd5a 100644 --- a/dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp +++ b/dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp @@ -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)); - 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); -- 2.7.4