END_TEST;
}
+int UtcDaliFrameBufferAttachDepthTexture01(void)
+{
+ TestApplication application;
+
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL );
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ frameBuffer.AttachColorTexture( texture );
+
+ Texture textureDepth = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_UNSIGNED_INT, width, height );
+ DevelFrameBuffer::AttachDepthTexture( frameBuffer, textureDepth );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFrameBufferAttachDepthStencilTexture01(void)
+{
+ TestApplication application;
+
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL );
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ frameBuffer.AttachColorTexture( texture );
+
+ Texture textureStencil = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height );
+ DevelFrameBuffer::AttachDepthStencilTexture( frameBuffer, textureStencil );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliFrameBufferGetColorTexture01(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliFrameBufferGetDepthTexture01(void)
+{
+ TestApplication application;
+
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ frameBuffer.AttachColorTexture( texture );
+
+ Texture textureDepth = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_FLOAT, width, height );
+ DevelFrameBuffer::AttachDepthTexture( frameBuffer, textureDepth );
+
+ DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthTexture( frameBuffer ), textureDepth, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFrameBufferGetDepthStencilTexture01(void)
+{
+ TestApplication application;
+
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ frameBuffer.AttachColorTexture( texture );
+
+ Texture textureStencil = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height );
+ DevelFrameBuffer::AttachDepthStencilTexture( frameBuffer, textureStencil );
+
+ DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthStencilTexture( frameBuffer ), textureStencil, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliFramebufferContextLoss(void)
{
tet_infoline("UtcDaliFramebufferContextLoss\n");
tet_infoline("UtcDaliPixelHasAlpha");
- TestPixelEnumSize( 56 );
+ TestPixelEnumSize( 59 );
DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::INVALID ) == false ); // For completeness
DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB16F ) == false );
DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB32F ) == false );
+ DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_UNSIGNED_INT ) == false );
+ DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_FLOAT ) == false );
+ DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_STENCIL ) == false );
+
END_TEST;
}
tet_infoline("UtcDaliPixelGetBytesPerPixel");
// Be sure that the number of cases tested below is correct:
- TestPixelEnumSize( 56 );
+ TestPixelEnumSize( 59 );
DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::INVALID ) == 0 ); // For completeness
DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB16F ) == 12 );
DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB32F ) == 24 );
+ DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_UNSIGNED_INT ) == 4 );
+ DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_FLOAT ) == 4 );
+ DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_STENCIL ) == 4 );
+
END_TEST;
}
int bitMask = 0;
// Be sure that the number of cases tested below is correct:
- TestPixelEnumSize( 56 );
+ TestPixelEnumSize( 59 );
Pixel::GetAlphaOffsetAndMask( Pixel::INVALID, byteOffset, bitMask ); // For completeness
DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
Pixel::GetAlphaOffsetAndMask( Pixel::RGB32F, byteOffset, bitMask );
DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
+ Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_UNSIGNED_INT, byteOffset, bitMask );
+ DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
+ Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_FLOAT, byteOffset, bitMask );
+ DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
+ Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_STENCIL, byteOffset, bitMask );
+ DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
+
+ END_TEST;
+}
+
+int UtcDaliPixelConvertGlFormat(void)
+{
+ tet_infoline("UtcDaliPixelConvertGlFormat");
+
+ unsigned int pixelDataType, internalFormat;
+ Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_UNSIGNED_INT, pixelDataType, internalFormat );
+ DALI_TEST_CHECK( pixelDataType == GL_UNSIGNED_INT );
+ DALI_TEST_CHECK( internalFormat == GL_DEPTH_COMPONENT );
+
+ Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_FLOAT, pixelDataType, internalFormat );
+ DALI_TEST_CHECK( pixelDataType == GL_FLOAT );
+ DALI_TEST_CHECK( internalFormat == GL_DEPTH_COMPONENT );
+
+ Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_STENCIL, pixelDataType, internalFormat );
+ DALI_TEST_CHECK( pixelDataType == GL_UNSIGNED_INT_24_8 );
+ DALI_TEST_CHECK( internalFormat == GL_DEPTH_STENCIL );
END_TEST;
}
${devel_api_core_scripting_header_files}
${devel_api_core_threading_header_files}
${devel_api_core_update_header_files}
-)
+)
\ No newline at end of file
namespace DevelFrameBuffer
{
+void AttachDepthTexture( FrameBuffer frameBuffer, Texture& texture )
+{
+ AttachDepthTexture( frameBuffer, texture, 0u );
+}
+
+void AttachDepthTexture( FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel )
+{
+ if( texture )
+ {
+ Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
+ GetImplementation( frameBuffer ).AttachDepthTexture( texturePtr, mipmapLevel );
+ }
+}
+
+void AttachDepthStencilTexture( FrameBuffer frameBuffer, Texture& texture )
+{
+ AttachDepthStencilTexture( frameBuffer, texture, 0u );
+}
+
+void AttachDepthStencilTexture( FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel )
+{
+ if( texture )
+ {
+ Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
+ GetImplementation( frameBuffer ).AttachDepthStencilTexture( texturePtr, mipmapLevel );
+ }
+}
+
Texture GetColorTexture( const FrameBuffer frameBuffer, uint8_t index )
{
Internal::Texture* texturePtr = GetImplementation( frameBuffer ).GetColorTexture(index);
return Dali::Texture( texturePtr );
}
+Texture GetDepthTexture( FrameBuffer frameBuffer )
+{
+ Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetDepthTexture();
+ return Dali::Texture( texturePtr );
+}
+
+Texture GetDepthStencilTexture( FrameBuffer frameBuffer )
+{
+ Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetDepthStencilTexture();
+ return Dali::Texture( texturePtr );
+}
+
} // namespace DevelFrameBuffer
} // namespace Dali
constexpr uint8_t MAX_COLOR_ATTACHMENTS = 8;
/**
+ * @brief Attach the base LOD of a depth texture to the framebuffer.
+ * @note This causes a depth attachment to be added.
+ *
+ * @param[in] frameBuffer A handle to the framebuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @note The texture has to have same size as that of FrameBuffer
+ * otherwise it won't be attached.
+ */
+void AttachDepthTexture( FrameBuffer frameBuffer, Texture& texture );
+
+/**
+ * @brief Attach a depth texture to the framebuffer.
+ * @note This causes a depth attachment to be added.
+ *
+ * @param[in] frameBuffer A handle to the framebuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ * @note The mipmapped texture has to have same size as that of FrameBuffer
+ * otherwise it won't be attached.
+ */
+void AttachDepthTexture( FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel );
+
+/**
+ * @brief Attach the base LOD of a stencil texture to the framebuffer.
+ * @note This causes a stencil attachment to be added.
+ *
+ * @param[in] frameBuffer A handle to the framebuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @note The texture has to have same size as that of FrameBuffer
+ * otherwise it won't be attached.
+ */
+void AttachDepthStencilTexture( FrameBuffer frameBuffer, Texture& texture );
+
+/**
+ * @brief Attach a depth/stencil texture to the framebuffer.
+ * @note This causes a depth/stencil attachment to be added.
+ *
+ * @param[in] frameBuffer A handle to the framebuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ * @note The mipmapped texture has to have same size as that of FrameBuffer
+ * otherwise it won't be attached.
+ */
+void AttachDepthStencilTexture( FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel );
+
+/**
* @brief Gets the color texture at the given @a index used as output in the FrameBuffer.
*
* @param[in] frameBuffer A handle to the framebuffer
*/
Texture GetColorTexture( const FrameBuffer frameBuffer, uint8_t index );
+/**
+ * @brief Gets the depth texture used as output in the FrameBuffer.
+ *
+ * @param[in] frameBuffer A handle to the framebuffer
+ *
+ * @return A handle to the texture used as depth output, or an uninitialized handle
+ */
+Texture GetDepthTexture( FrameBuffer frameBuffer );
+
+/**
+ * @brief Gets the depth/stencil texture used as output in the FrameBuffer.
+ *
+ * @param[in] frameBuffer A handle to the framebuffer
+ *
+ * @return A handle to the texture used as stencil output, or an uninitialized handle
+ */
+Texture GetDepthStencilTexture( FrameBuffer frameBuffer );
+
} // namespace DevelFrameBuffer
} // namespace Dali
break;
}
+ // GLES 3.0 depth and stencil formats
+ case Pixel::DEPTH_UNSIGNED_INT:
+ {
+ pixelDataType = GL_UNSIGNED_INT;
+ internalFormat = GL_DEPTH_COMPONENT;
+ break;
+ }
+ case Pixel::DEPTH_FLOAT:
+ {
+ pixelDataType = GL_FLOAT;
+ internalFormat = GL_DEPTH_COMPONENT;
+ break;
+ }
+ case Pixel::DEPTH_STENCIL:
+ {
+ pixelDataType = GL_UNSIGNED_INT_24_8;
+ internalFormat = GL_DEPTH_STENCIL;
+ break;
+ }
+
case INVALID:
{
DALI_LOG_ERROR( "Invalid pixel format for bitmap\n" );
case Dali::Pixel::RGB16F:
case Dali::Pixel::RGB32F:
+ case Dali::Pixel::DEPTH_UNSIGNED_INT:
+ case Dali::Pixel::DEPTH_FLOAT:
+ case Dali::Pixel::DEPTH_STENCIL:
{
DALI_LOG_ERROR("Pixel format not compatible.\n");
byteOffset=0;
: mEventThreadServices( EventThreadServices::Get() ),
mRenderObject( NULL ),
mColor{ nullptr },
+ mDepth( nullptr ),
+ mStencil( nullptr ),
mWidth( width ),
mHeight( height ),
mAttachments( attachments ),
}
}
+void FrameBuffer::AttachDepthTexture( TexturePtr texture, uint32_t mipmapLevel )
+{
+ if( ( texture->GetWidth() / ( 1u << mipmapLevel ) != mWidth ) ||
+ ( texture->GetHeight() / ( 1u << mipmapLevel ) != mHeight ) )
+ {
+ DALI_LOG_ERROR( "Failed to attach depth texture to FrameBuffer: Size mismatch \n" );
+ }
+ else
+ {
+ mDepth = texture;
+ AttachDepthTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel );
+ }
+}
+
+void FrameBuffer::AttachDepthStencilTexture( TexturePtr texture, unsigned int mipmapLevel )
+{
+ if( ( texture->GetWidth() / ( 1u << mipmapLevel ) != mWidth ) ||
+ ( texture->GetHeight() / ( 1u << mipmapLevel ) != mHeight ) )
+ {
+ DALI_LOG_ERROR( "Failed to attach depth/stencil texture to FrameBuffer: Size mismatch \n" );
+ }
+ else
+ {
+ mStencil = texture;
+ AttachDepthStencilTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel );
+ }
+}
+
Texture* FrameBuffer::GetColorTexture(uint8_t index) const
{
return ( index >= mColorAttachmentCount ) ? nullptr : mColor[index].Get();
}
+Texture* FrameBuffer::GetDepthTexture() const
+{
+ return ( mDepth ) ? mDepth.Get() : nullptr;
+}
+
+Texture* FrameBuffer::GetDepthStencilTexture() const
+{
+ return ( mStencil ) ? mStencil.Get() : nullptr;
+}
+
void FrameBuffer::SetSize( uint32_t width, uint32_t height )
{
mWidth = width;
void AttachColorTexture( TexturePtr texture, uint32_t mipmapLevel, uint32_t layer );
/**
+ * @copydoc Dali::DevelFrameBuffer::AttachDepthTexture()
+ */
+ void AttachDepthTexture( TexturePtr texture, uint32_t mipmapLevel );
+
+ /**
+ * @copydoc Dali::DevelFrameBuffer::AttachDepthStencilTexture()
+ */
+ void AttachDepthStencilTexture( TexturePtr texture, uint32_t mipmapLevel );
+
+ /**
* @copydoc Dali::FrameBuffer::GetColorTexture()
*/
Texture* GetColorTexture(uint8_t index) const;
/**
+ * @copydoc Dali::DevelFrameBuffer::GetDepthTexture()
+ */
+ Texture* GetDepthTexture() const;
+
+ /**
+ * @copydoc Dali::DevelFrameBuffer::GetDepthStencilTexture()
+ */
+ Texture* GetDepthStencilTexture() const;
+
+ /**
* @brief Sets the frame buffer size.
* @param[in] width The width size
* @param[in] height The height size
Internal::Render::FrameBuffer* mRenderObject; ///< The Render::Texture associated to this texture
TexturePtr mColor[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
+ TexturePtr mDepth;
+ TexturePtr mStencil;
uint32_t mWidth;
uint32_t mHeight;
Mask mAttachments; ///< Bit-mask of type FrameBuffer::Attachment::Mask
frameBuffer->AttachColorTexture( mImpl->context, texture, mipmapLevel, layer );
}
+void RenderManager::AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+{
+ frameBuffer->AttachDepthTexture( mImpl->context, texture, mipmapLevel );
+}
+
+void RenderManager::AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+{
+ frameBuffer->AttachDepthStencilTexture( mImpl->context, texture, mipmapLevel );
+}
+
void RenderManager::AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer )
{
mImpl->propertyBufferContainer.PushBack( propertyBuffer.Release() );
void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
/**
+ * Attach a texture as depth output to an existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
+ * Attach a texture as depth/stencil output to an existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
* Initializes a Scene to the render manager
* @param[in] scene The Scene to initialize
*/
context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
}
+void FrameBuffer::AttachDepthTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel )
+{
+ context.BindFramebuffer( GL_FRAMEBUFFER, mId );
+
+ // Create a depth attachment.
+ if( texture->GetType() == TextureType::TEXTURE_2D )
+ {
+ context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, texture->GetId(), mipmapLevel );
+ }
+
+ context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
+}
+
+void FrameBuffer::AttachDepthStencilTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel )
+{
+ context.BindFramebuffer( GL_FRAMEBUFFER, mId );
+
+ // Create a depth/stencil attachment.
+ if( texture->GetType() == TextureType::TEXTURE_2D )
+ {
+ context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, texture->GetId(), mipmapLevel );
+ }
+
+ context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
+}
+
void FrameBuffer::Bind( Context& context )
{
context.BindFramebuffer( GL_FRAMEBUFFER, mId );
void AttachColorTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
/**
+ * @brief Attach a texture for depth rendering. Valid only for Framebuffers with DEPTH attachments.
+ * @param[in] context The GL context
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
+ * @brief Attach a texture for depth/stencil rendering. Valid only for Framebuffers with DEPTH_STENCIL attachments.
+ * @param[in] context The GL context
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthStencilTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
* @brief Get the number of textures bound to this frame buffer as color attachments.
* @return The number of color attachments.
*/
break;
}
+ // GLES 3.0 depth and stencil formats
+ case Pixel::DEPTH_UNSIGNED_INT:
+ {
+ glFormat = GL_DEPTH_COMPONENT;
+ pixelDataType = GL_UNSIGNED_INT;
+ break;
+ }
+
+ case Pixel::DEPTH_FLOAT:
+ {
+ glFormat = GL_DEPTH_COMPONENT;
+ pixelDataType = GL_FLOAT;
+ break;
+ }
+
+ case Pixel::DEPTH_STENCIL:
+ {
+ glFormat = GL_DEPTH_STENCIL;
+ pixelDataType = GL_UNSIGNED_INT_24_8;
+ break;
+ }
+
case Pixel::INVALID:
{
DALI_LOG_ERROR( "Invalid pixel format for bitmap\n" );
glInternalFormat = GL_R11F_G11F_B10F;
break;
}
+ case Pixel::DEPTH_FLOAT:
+ {
+ glInternalFormat = GL_DEPTH_COMPONENT32F;
+ break;
+ }
+ case Pixel::DEPTH_STENCIL:
+ {
+ glInternalFormat = GL_DEPTH24_STENCIL8;
+ break;
+ }
default:
{
glInternalFormat = glFormat;
case Pixel::BGRA8888:
case Pixel::RGB16F:
case Pixel::RGB32F:
+ case Pixel::DEPTH_UNSIGNED_INT:
+ case Pixel::DEPTH_FLOAT:
+ case Pixel::DEPTH_STENCIL:
case Pixel::INVALID:
{
return false;
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AttachColorTextureToFrameBuffer, frameBuffer, texture, mipmapLevel, layer );
}
+void UpdateManager::AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+{
+ typedef MessageValue3< RenderManager, Render::FrameBuffer*, Render::Texture*, uint32_t > DerivedType;
+
+ // Reserve some memory inside the render queue
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+
+ // Construct message in the render queue memory; note that delete should not be called on the return value
+ new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AttachDepthTextureToFrameBuffer, frameBuffer, texture, mipmapLevel );
+}
+
+void UpdateManager::AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+{
+ typedef MessageValue3< RenderManager, Render::FrameBuffer*, Render::Texture*, uint32_t > DerivedType;
+
+ // Reserve some memory inside the render queue
+ uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
+
+ // Construct message in the render queue memory; note that delete should not be called on the return value
+ new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AttachDepthStencilTextureToFrameBuffer, frameBuffer, texture, mipmapLevel );
+}
+
} // namespace SceneGraph
} // namespace Internal
void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face );
/**
+ * Attach a texture as depth output to an existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
+ * Attach a texture as depth/stencil output to an existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
* This is called when the surface of the scene has been replaced.
* @param[in] scene The scene.
*/
new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
}
+inline void AttachDepthTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+{
+ typedef MessageValue3< UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t > LocalType;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel );
+}
+
+inline void AttachDepthStencilTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
+{
+ typedef MessageValue3< UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t > LocalType;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel );
+}
+
inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths )
{
typedef MessageValue1< UpdateManager, OwnerPointer< NodeDepths > > LocalType;
case COMPRESSED_RGB_PVRTC_4BPPV1:
case RGB16F:
case RGB32F:
+ case DEPTH_UNSIGNED_INT:
+ case DEPTH_FLOAT:
+ case DEPTH_STENCIL:
case INVALID:
{
return false;
case BGR8888:
case RGBA8888:
case BGRA8888:
+ case DEPTH_UNSIGNED_INT:
+ case DEPTH_FLOAT:
+ case DEPTH_STENCIL:
{
return 4;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
case RGB16F:
case RGB32F:
+ case DEPTH_UNSIGNED_INT:
+ case DEPTH_FLOAT:
+ case DEPTH_STENCIL:
case INVALID:
{
- DALI_LOG_ERROR("Pixel formats for compressed images are not compatible with simple masking-out of per-pixel alpha.\n");
+ DALI_LOG_ERROR("Pixel formats are not compatible with simple masking-out of per-pixel alpha.\n");
byteOffset=0;
bitMask=0;
break;
RGB16F, ///< Color depth 48-bit, 16-16-16 half floating point. @SINCE_1_2.60
RGB32F, ///< Color depth 96-bit, 32-32-32 floating point. @SINCE_1_2.60
+ DEPTH_UNSIGNED_INT, ///< Unsigned int depth format 32-bit. @SINCE_1_9.9
+ DEPTH_FLOAT, ///< Float depth format 32-bit. @SINCE_1_9.9
+
+ DEPTH_STENCIL ///< Depth stencil 32-bit, 24 bit for depth, 8 bit for stencil. @SINCE_1_9.9
///! Update LAST_VALID_PIXEL_FORMAT below if you add an enum value here.
};
*
* Sync it to the last value above.
*/
-const Format LAST_VALID_PIXEL_FORMAT = RGB32F;
+const Format LAST_VALID_PIXEL_FORMAT = DEPTH_STENCIL;
/**
* @brief Whether specified pixel format contains an alpha value.
*
* @SINCE_1_1.43
* @param[in] texture The texture that will be used as output when rendering
- * @note The texture has to have the same size than the FrameBuffer
+ * @note The texture has to have same size as that of FrameBuffer
* otherwise it won't be attached.
*/
void AttachColorTexture( Texture& texture );
* @param[in] texture The texture that will be used as output when rendering
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
- * @note The specified texture mipmap has to have the same size than the FrameBuffer
+ * @note The mipmapped texture has to have same size as that of FrameBuffer
* otherwise it won't be attached.
*/
void AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer );