X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Frendering%2Fframe-buffer-impl.cpp;h=e26b0eea5a8bc8f7aa0ec6312dcdf7a7801f1af0;hb=79881246746f65474b24ea4fe14151ccef8df3f4;hp=2b42e416eb2c604ea8c05aebc22175073ad5819d;hpb=094df0544050c853dd5114b13ad582a7fa2f8d06;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/rendering/frame-buffer-impl.cpp b/dali/internal/event/rendering/frame-buffer-impl.cpp index 2b42e41..e26b0ee 100644 --- a/dali/internal/event/rendering/frame-buffer-impl.cpp +++ b/dali/internal/event/rendering/frame-buffer-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -21,9 +21,6 @@ // INTERNAL INCLUDES #include #include -#include -#include -#include namespace Dali { @@ -37,14 +34,6 @@ FrameBufferPtr FrameBuffer::New( uint32_t width, uint32_t height, Mask attachmen return frameBuffer; } -FrameBufferPtr FrameBuffer::New( Dali::Integration::RenderSurface& renderSurface, Mask attachments ) -{ - Dali::PositionSize positionSize = renderSurface.GetPositionSize(); - FrameBufferPtr frameBuffer( new FrameBuffer( positionSize.width, positionSize.height, attachments ) ); - frameBuffer->Initialize( &renderSurface ); - return frameBuffer; -} - Render::FrameBuffer* FrameBuffer::GetRenderObject() const { return mRenderObject; @@ -53,28 +42,17 @@ Render::FrameBuffer* FrameBuffer::GetRenderObject() const FrameBuffer::FrameBuffer( uint32_t width, uint32_t height, Mask attachments ) : mEventThreadServices( EventThreadServices::Get() ), mRenderObject( NULL ), - mColor( NULL ), + mColor{ nullptr }, mWidth( width ), mHeight( height ), mAttachments( attachments ), - mIsSurfaceBacked( false ) + mColorAttachmentCount( 0 ) { } -void FrameBuffer::Initialize( Integration::RenderSurface* renderSurface ) +void FrameBuffer::Initialize() { - mIsSurfaceBacked = ( renderSurface != nullptr ); - - // If render surface backed, create a different scene object - // Make Render::FrameBuffer as a base class, and implement Render::TextureFrameBuffer & Render::WindowFrameBuffer - if ( mIsSurfaceBacked ) - { - mRenderObject = new Render::SurfaceFrameBuffer( renderSurface ); - } - else - { - mRenderObject = new Render::TextureFrameBuffer( mWidth, mHeight, mAttachments ); - } + mRenderObject = new Render::FrameBuffer( mWidth, mHeight, mAttachments ); OwnerPointer< Render::FrameBuffer > transferOwnership( mRenderObject ); AddFrameBuffer( mEventThreadServices.GetUpdateManager(), transferOwnership ); @@ -82,28 +60,33 @@ void FrameBuffer::Initialize( Integration::RenderSurface* renderSurface ) void FrameBuffer::AttachColorTexture( TexturePtr texture, uint32_t mipmapLevel, uint32_t layer ) { - if ( mIsSurfaceBacked ) + if( ( texture->GetWidth() / ( 1u << mipmapLevel ) != mWidth ) || + ( texture->GetHeight() / ( 1u << mipmapLevel ) != mHeight ) ) + { + DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Size mismatch \n" ); + } + else if ( mColorAttachmentCount >= Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ) { - DALI_LOG_ERROR( "Attempted to attach color texture to a render surface backed FrameBuffer \n" ); + DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Exceeded maximum supported color attachments.\n" ); } else { - if( ( texture->GetWidth() / ( 1u << mipmapLevel ) == mWidth ) && - ( texture->GetHeight() / ( 1u << mipmapLevel ) == mHeight ) ) - { - mColor = texture; - AttachColorTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel, layer ); - } - else - { - DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Size mismatch \n" ); - } + mColor[mColorAttachmentCount] = texture; + ++mColorAttachmentCount; + + AttachColorTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel, layer ); } } -Texture* FrameBuffer::GetColorTexture() +Texture* FrameBuffer::GetColorTexture(uint8_t index) const +{ + return ( index >= mColorAttachmentCount ) ? nullptr : mColor[index].Get(); +} + +void FrameBuffer::SetSize( uint32_t width, uint32_t height ) { - return mIsSurfaceBacked ? nullptr : mColor.Get(); + mWidth = width; + mHeight = height; } FrameBuffer::~FrameBuffer()