From: Francisco Santos Date: Wed, 20 May 2015 18:06:49 +0000 (+0100) Subject: Fixes crash after merge from tizen. X-Git-Tag: dali_1.0.47~8^2^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F39682%2F4;p=platform%2Fcore%2Fuifw%2Fdali-core.git Fixes crash after merge from tizen. Change-Id: Ic322d76fb22ddb18cd3c558e89583ceb0b0c3c09 --- diff --git a/dali/internal/render/data-providers/property-buffer-data-provider.h b/dali/internal/render/data-providers/property-buffer-data-provider.h index 474f890..f2a9ba7 100644 --- a/dali/internal/render/data-providers/property-buffer-data-provider.h +++ b/dali/internal/render/data-providers/property-buffer-data-provider.h @@ -50,13 +50,6 @@ public: } /** - * Check if the data has changed - * @param[in] bufferIndex Index to access double buffered values - * @return true if the data has changed - */ - virtual bool HasDataChanged( BufferIndex bufferIndex ) const = 0; - - /** * Get the number of attributes * @param[in] bufferIndex Index to access double buffered values * @return the number of attributes diff --git a/dali/internal/render/renderers/render-geometry.cpp b/dali/internal/render/renderers/render-geometry.cpp index 1a7044d..4713775 100644 --- a/dali/internal/render/renderers/render-geometry.cpp +++ b/dali/internal/render/renderers/render-geometry.cpp @@ -87,24 +87,24 @@ void RenderGeometry::UploadVertexData( BufferIndex bufferIndex, const RenderDataProvider* dataProviders ) { - if( mDataNeedsUploading ) // @todo Or if any of the property buffers are dirty + if( mDataNeedsUploading ) { - DoUpload( context, bufferIndex, dataProviders ); + SetUpPropertyBuffers( context, bufferIndex, dataProviders ); - mDataNeedsUploading = false; - } + for( unsigned int i = 0; i < mVertexBuffers.Count(); ++i ) + { + mVertexBuffers[i]->Upload( context, bufferIndex ); + } + if( mIndexBuffer ) + { + mIndexBuffer->Upload( context, bufferIndex ); + } - for( unsigned int i = 0; i < mVertexBuffers.Count(); ++i ) - { - mVertexBuffers[i]->Upload( context, bufferIndex ); - } - if( mIndexBuffer ) - { - mIndexBuffer->Upload( context, bufferIndex ); + mDataNeedsUploading = false; } } -void RenderGeometry::DoUpload( +void RenderGeometry::SetUpPropertyBuffers( Context& context, BufferIndex bufferIndex, const RenderDataProvider* dataProvider ) diff --git a/dali/internal/render/renderers/render-geometry.h b/dali/internal/render/renderers/render-geometry.h index f4c7a19..f52ab35 100644 --- a/dali/internal/render/renderers/render-geometry.h +++ b/dali/internal/render/renderers/render-geometry.h @@ -103,9 +103,9 @@ private: * @param[in] bufferIndex The current buffer index * @param[in] dataProviders The data providers (to fetch geometry from) */ - void DoUpload( Context& context, - BufferIndex bufferIndex, - const RenderDataProvider* dataProviders ); + void SetUpPropertyBuffers( Context& context, + BufferIndex bufferIndex, + const RenderDataProvider* dataProviders ); /** * Bind the geometry buffers diff --git a/dali/internal/render/renderers/render-renderer-property-buffer.cpp b/dali/internal/render/renderers/render-renderer-property-buffer.cpp index c1418db..3741063 100644 --- a/dali/internal/render/renderers/render-renderer-property-buffer.cpp +++ b/dali/internal/render/renderers/render-renderer-property-buffer.cpp @@ -168,7 +168,7 @@ void RenderPropertyBuffer::Upload( Context& context, BufferIndex bufferIndex ) } // Update the GpuBuffer - if ( mGpuBuffer && mDataProvider.HasDataChanged( bufferIndex ) ) + if ( mGpuBuffer ) { std::size_t dataSize = mDataProvider.GetDataSize( bufferIndex ); DALI_ASSERT_DEBUG( dataSize && "No data in the property buffer!" ); diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index 40fb042..7b7f2cd 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -55,6 +55,11 @@ void NewRenderer::SetRenderDataProvider( RenderDataProvider* dataProvider ) mRenderGeometry.GeometryUpdated(); } +void NewRenderer::SetGeometryUpdated( ) +{ + mRenderGeometry.GeometryUpdated(); +} + // Note - this is currently called from UpdateThread, PrepareRenderInstructions, // as an optimisation. // @todo MESH_REWORK Should use Update thread objects only in PrepareRenderInstructions. diff --git a/dali/internal/render/renderers/render-renderer.h b/dali/internal/render/renderers/render-renderer.h index efed81d..b01d4b1 100644 --- a/dali/internal/render/renderers/render-renderer.h +++ b/dali/internal/render/renderers/render-renderer.h @@ -66,6 +66,11 @@ public: */ void SetRenderDataProvider( RenderDataProvider* dataProviders ); + /** + * Set flag that says that Geometry has been updated. + */ + void SetGeometryUpdated(); + public: // Implementation of Renderer /** * @copydoc SceneGraph::Renderer::RequiresDepthTest() diff --git a/dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp b/dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp index 1b2dc56..148e09b 100644 --- a/dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp +++ b/dali/internal/update/node-attachments/scene-graph-renderer-attachment.cpp @@ -367,6 +367,27 @@ void RendererAttachment::DoPrepareRender( BufferIndex updateBufferIndex ) mRegenerateUniformMap--; } + bool geometryDataChanged = false; + if( PropertyBuffer* indexBuffer = mGeometry->GetIndexBuffer() ) + { + geometryDataChanged = indexBuffer->HasDataChanged(updateBufferIndex); + } + Vector& vertexBuffers = mGeometry->GetVertexBuffers(); + Vector::ConstIterator end = vertexBuffers.End(); + for( Vector::Iterator it = vertexBuffers.Begin(); + it != end; + ++it ) + { + geometryDataChanged = geometryDataChanged || (*it)->HasDataChanged(updateBufferIndex); + } + if( geometryDataChanged ) + { + //TODO: MESH_REWORK : use buffer data cache and remove all this + typedef Message< NewRenderer > DerivedType; + unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) ); + new (slot) DerivedType( mRenderer, &NewRenderer::SetGeometryUpdated ); + } + if( mResendDataProviders ) { RenderDataProvider* dataProvider = NewRenderDataProvider();