From 76574e7f786505c8aa3566f9337677d7ad8e98f8 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Tue, 1 Sep 2020 18:01:54 +0900 Subject: [PATCH] Revert "Renaming PropertyBuffer to VertexBuffer" This reverts commit 4d58486b08bef675a2414fd9cd523ab64af40b05. --- automated-tests/src/dali/CMakeLists.txt | 2 +- .../dali/dali-test-suite-utils/mesh-builder.cpp | 6 +- .../src/dali/dali-test-suite-utils/mesh-builder.h | 2 +- automated-tests/src/dali/utc-Dali-Geometry.cpp | 30 ++--- automated-tests/src/dali/utc-Dali-MeshMaterial.cpp | 6 +- ...ertexBuffer.cpp => utc-Dali-PropertyBuffer.cpp} | 124 +++++++++--------- automated-tests/src/dali/utc-Dali-Renderer.cpp | 2 +- dali/integration-api/profiling.cpp | 6 +- .../property-buffer-impl.cpp} | 44 +++---- .../property-buffer-impl.h} | 50 +++---- dali/internal/event/rendering/geometry-impl.cpp | 8 +- dali/internal/event/rendering/geometry-impl.h | 8 +- dali/internal/event/rendering/texture-set-impl.h | 4 +- dali/internal/file.list | 4 +- dali/internal/render/common/render-manager.cpp | 26 ++-- dali/internal/render/common/render-manager.h | 31 ++--- .../data-providers/property-buffer-data-provider.h | 145 +++++++++++++++++++++ .../render/data-providers/render-data-provider.h | 5 +- dali/internal/render/renderers/render-geometry.cpp | 14 +- dali/internal/render/renderers/render-geometry.h | 18 +-- ...ertex-buffer.cpp => render-property-buffer.cpp} | 20 +-- ...er-vertex-buffer.h => render-property-buffer.h} | 30 ++--- .../update/controllers/render-message-dispatcher.h | 7 +- .../manager/render-instruction-processor.cpp | 1 + dali/internal/update/manager/update-manager.cpp | 36 ++--- dali/internal/update/manager/update-manager.h | 68 +++++----- dali/public-api/dali-core.h | 2 +- dali/public-api/file.list | 4 +- dali/public-api/rendering/geometry.cpp | 2 +- dali/public-api/rendering/geometry.h | 14 +- dali/public-api/rendering/property-buffer.cpp | 72 ++++++++++ .../{vertex-buffer.h => property-buffer.h} | 65 ++++----- dali/public-api/rendering/vertex-buffer.cpp | 72 ---------- 33 files changed, 541 insertions(+), 387 deletions(-) rename automated-tests/src/dali/{utc-Dali-VertexBuffer.cpp => utc-Dali-PropertyBuffer.cpp} (65%) rename dali/internal/event/{rendering/vertex-buffer-impl.cpp => common/property-buffer-impl.cpp} (85%) rename dali/internal/event/{rendering/vertex-buffer-impl.h => common/property-buffer-impl.h} (70%) create mode 100644 dali/internal/render/data-providers/property-buffer-data-provider.h rename dali/internal/render/renderers/{render-vertex-buffer.cpp => render-property-buffer.cpp} (85%) rename dali/internal/render/renderers/{render-vertex-buffer.h => render-property-buffer.h} (86%) create mode 100644 dali/public-api/rendering/property-buffer.cpp rename dali/public-api/rendering/{vertex-buffer.h => property-buffer.h} (75%) delete mode 100644 dali/public-api/rendering/vertex-buffer.cpp diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt index afa6443..e4ecbfe 100644 --- a/automated-tests/src/dali/CMakeLists.txt +++ b/automated-tests/src/dali/CMakeLists.txt @@ -61,6 +61,7 @@ SET(TC_SOURCES utc-Dali-PixelData.cpp utc-Dali-Processors.cpp utc-Dali-PropertyArray.cpp + utc-Dali-PropertyBuffer.cpp utc-Dali-PropertyMap.cpp utc-Dali-PropertyNotification.cpp utc-Dali-PropertyTypes.cpp @@ -100,7 +101,6 @@ SET(TC_SOURCES utc-Dali-Vector2.cpp utc-Dali-Vector3.cpp utc-Dali-Vector4.cpp - utc-Dali-VertexBuffer.cpp utc-Dali-WeakHandle.cpp utc-Dali-WheelEvent.cpp ) diff --git a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp index 3d7c359..2e8f724 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp @@ -38,19 +38,19 @@ TextureSet CreateTextureSet( Texture texture ) return textureSet; } -VertexBuffer CreateVertexBuffer() +PropertyBuffer CreatePropertyBuffer() { Property::Map texturedQuadVertexFormat; texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; - VertexBuffer vertexData = VertexBuffer::New( texturedQuadVertexFormat ); + PropertyBuffer vertexData = PropertyBuffer::New( texturedQuadVertexFormat ); return vertexData; } Geometry CreateQuadGeometry(void) { - VertexBuffer vertexData = CreateVertexBuffer(); + PropertyBuffer vertexData = CreatePropertyBuffer(); const float halfQuadSize = .5f; struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; TexturedQuadVertex texturedQuadVertexData[4] = { diff --git a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h index e593d38..37d13ec 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h +++ b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h @@ -28,7 +28,7 @@ Shader CreateShader(); TextureSet CreateTextureSet(); TextureSet CreateTextureSet( Texture texture ); Geometry CreateQuadGeometry(); -VertexBuffer CreateVertexBuffer(); +PropertyBuffer CreatePropertyBuffer(); } diff --git a/automated-tests/src/dali/utc-Dali-Geometry.cpp b/automated-tests/src/dali/utc-Dali-Geometry.cpp index dbbb0f8..7fe2e63 100644 --- a/automated-tests/src/dali/utc-Dali-Geometry.cpp +++ b/automated-tests/src/dali/utc-Dali-Geometry.cpp @@ -37,7 +37,7 @@ namespace struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; -VertexBuffer CreateVertexBuffer( const std::string& aPosition, const std::string& aTexCoord ) +PropertyBuffer CreateVertexBuffer( const std::string& aPosition, const std::string& aTexCoord ) { const float halfQuadSize = .5f; TexturedQuadVertex texturedQuadVertexData[4] = { @@ -50,7 +50,7 @@ VertexBuffer CreateVertexBuffer( const std::string& aPosition, const std::string vertexFormat[aPosition] = Property::VECTOR2; vertexFormat[aTexCoord] = Property::VECTOR2; - VertexBuffer vertexData = VertexBuffer::New( vertexFormat ); + PropertyBuffer vertexData = PropertyBuffer::New( vertexFormat ); vertexData.SetData( texturedQuadVertexData, 4 ); return vertexData; @@ -114,7 +114,7 @@ int UtcDaliGeometryMoveConstructor(void) DALI_TEST_EQUALS( 1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); DALI_TEST_EQUALS( 0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION ); - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); + PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); geometry.AddVertexBuffer( vertexBuffer ); DALI_TEST_EQUALS( 1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION ); @@ -136,7 +136,7 @@ int UtcDaliGeometryMoveAssignment(void) DALI_TEST_EQUALS( 1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION ); DALI_TEST_EQUALS( 0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION ); - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); + PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); geometry.AddVertexBuffer( vertexBuffer ); DALI_TEST_EQUALS( 1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION ); @@ -178,7 +178,7 @@ int UtcDaliGeometryAddVertexBuffer(void) tet_infoline("Test AddVertexBuffer"); - VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); + PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); Geometry geometry = Geometry::New(); geometry.AddVertexBuffer( vertexBuffer1 ); @@ -206,7 +206,7 @@ int UtcDaliGeometryAddVertexBuffer(void) // add the second vertex buffer application.GetGlAbstraction().ResetBufferDataCalls(); - VertexBuffer vertexBuffer2 = CreateVertexBuffer( "aPosition2", "aTexCoord2" ); + PropertyBuffer vertexBuffer2 = CreateVertexBuffer( "aPosition2", "aTexCoord2" ); geometry.AddVertexBuffer( vertexBuffer2 ); application.SendNotification(); application.Render(0); @@ -230,9 +230,9 @@ int UtcDaliGeometryGetNumberOfVertexBuffers(void) TestApplication application; tet_infoline("Test GetNumberOfVertexBuffers"); - VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); - VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" ); - VertexBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3" ); + PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); + PropertyBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" ); + PropertyBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3" ); Geometry geometry = Geometry::New(); geometry.AddVertexBuffer( vertexBuffer1 ); @@ -254,8 +254,8 @@ int UtcDaliGeometryRemoveVertexBuffer(void) tet_infoline("Test RemoveVertexBuffer"); - VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); - VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" ); + PropertyBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" ); + PropertyBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" ); Geometry geometry = Geometry::New(); geometry.AddVertexBuffer( vertexBuffer1 ); @@ -288,7 +288,7 @@ int UtcDaliGeometrySetIndexBuffer(void) tet_infoline("Test SetIndexBuffer"); - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); + PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); Geometry geometry = Geometry::New(); geometry.AddVertexBuffer( vertexBuffer ); @@ -346,7 +346,7 @@ int UtcDaliGeometrySetGetGeometryType01(void) tet_infoline("Test SetType and GetType: without index buffer"); unsigned int numVertex = 4u; - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); + PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); Geometry geometry = Geometry::New(); geometry.AddVertexBuffer( vertexBuffer ); @@ -475,7 +475,7 @@ int UtcDaliGeometrySetGetGeometryType02(void) unsigned int numVertex = 4u; unsigned int numIndex = 6u; // 6 unsigned short - VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); + PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" ); Geometry geometry = Geometry::New(); @@ -619,7 +619,7 @@ int UtcDaliGeometryAddVertexBufferNegative(void) Dali::Geometry instance; try { - Dali::VertexBuffer arg1; + Dali::PropertyBuffer arg1; instance.AddVertexBuffer(arg1); DALI_TEST_CHECK(false); // Should not get here } diff --git a/automated-tests/src/dali/utc-Dali-MeshMaterial.cpp b/automated-tests/src/dali/utc-Dali-MeshMaterial.cpp index e453dbd..fc696f5 100644 --- a/automated-tests/src/dali/utc-Dali-MeshMaterial.cpp +++ b/automated-tests/src/dali/utc-Dali-MeshMaterial.cpp @@ -77,8 +77,10 @@ void mesh_material_test_cleanup(void) * * Check rendered vertex buffer is the right size for the initial property buffer * - * Check VertexBuffer set via SetData renders as expected - * Check IndexBuffer set via properties renders as expected + * Check PropertyBuffer set via SetData can be read thru property system + * Check PropertyBuffer property setters / getters + * Check vertex PropertyBuffer set via properties renders as expected + * Check Index propertyBuffer set via properties renders as expected * * Check geometry type renders correctly as the matching GL draw call and type * diff --git a/automated-tests/src/dali/utc-Dali-VertexBuffer.cpp b/automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp similarity index 65% rename from automated-tests/src/dali/utc-Dali-VertexBuffer.cpp rename to automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp index b19278c..d59dcac 100644 --- a/automated-tests/src/dali/utc-Dali-VertexBuffer.cpp +++ b/automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp @@ -22,17 +22,17 @@ using namespace Dali; #include -void vertexBuffer_test_startup(void) +void propertyBuffer_test_startup(void) { test_return_value = TET_UNDEF; } -void vertexBuffer_test_cleanup(void) +void propertyBuffer_test_cleanup(void) { test_return_value = TET_PASS; } -int UtcDaliVertexBufferNew01(void) +int UtcDaliPropertyBufferNew01(void) { TestApplication application; @@ -40,21 +40,21 @@ int UtcDaliVertexBufferNew01(void) texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); + PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat ); - DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION ); + DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION ); END_TEST; } -int UtcDaliVertexBufferNew02(void) +int UtcDaliPropertyBufferNew02(void) { TestApplication application; - VertexBuffer vertexBuffer; - DALI_TEST_EQUALS( (bool)vertexBuffer, false, TEST_LOCATION ); + PropertyBuffer propertyBuffer; + DALI_TEST_EQUALS( (bool)propertyBuffer, false, TEST_LOCATION ); END_TEST; } -int UtcDaliVertexBufferDownCast01(void) +int UtcDaliPropertyBufferDownCast01(void) { TestApplication application; @@ -62,92 +62,92 @@ int UtcDaliVertexBufferDownCast01(void) texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); + PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat ); - BaseHandle handle(vertexBuffer); - VertexBuffer vertexBuffer2 = VertexBuffer::DownCast(handle); - DALI_TEST_EQUALS( (bool)vertexBuffer2, true, TEST_LOCATION ); + BaseHandle handle(propertyBuffer); + PropertyBuffer propertyBuffer2 = PropertyBuffer::DownCast(handle); + DALI_TEST_EQUALS( (bool)propertyBuffer2, true, TEST_LOCATION ); END_TEST; } -int UtcDaliVertexBufferDownCast02(void) +int UtcDaliPropertyBufferDownCast02(void) { TestApplication application; Handle handle = Handle::New(); // Create a custom object - VertexBuffer vertexBuffer = VertexBuffer::DownCast(handle); - DALI_TEST_EQUALS( (bool)vertexBuffer, false, TEST_LOCATION ); + PropertyBuffer propertyBuffer = PropertyBuffer::DownCast(handle); + DALI_TEST_EQUALS( (bool)propertyBuffer, false, TEST_LOCATION ); END_TEST; } -int UtcDaliVertexBufferCopyConstructor(void) +int UtcDaliPropertyBufferCopyConstructor(void) { TestApplication application; - VertexBuffer vertexBuffer = CreateVertexBuffer(); + PropertyBuffer propertyBuffer = CreatePropertyBuffer(); - VertexBuffer vertexBufferCopy(vertexBuffer); + PropertyBuffer propertyBufferCopy(propertyBuffer); - DALI_TEST_EQUALS( (bool)vertexBufferCopy, true, TEST_LOCATION ); - DALI_TEST_EQUALS( vertexBufferCopy.GetSize(), 0u, TEST_LOCATION ); + DALI_TEST_EQUALS( (bool)propertyBufferCopy, true, TEST_LOCATION ); + DALI_TEST_EQUALS( propertyBufferCopy.GetSize(), 0u, TEST_LOCATION ); END_TEST; } -int UtcDaliVertexBufferAssignmentOperator(void) +int UtcDaliPropertyBufferAssignmentOperator(void) { TestApplication application; - VertexBuffer vertexBuffer = CreateVertexBuffer(); + PropertyBuffer propertyBuffer = CreatePropertyBuffer(); - VertexBuffer vertexBuffer2; - DALI_TEST_EQUALS( (bool)vertexBuffer2, false, TEST_LOCATION ); + PropertyBuffer propertyBuffer2; + DALI_TEST_EQUALS( (bool)propertyBuffer2, false, TEST_LOCATION ); - vertexBuffer2 = vertexBuffer; - DALI_TEST_EQUALS( (bool)vertexBuffer2, true, TEST_LOCATION ); - DALI_TEST_EQUALS( vertexBuffer2.GetSize(), 0u, TEST_LOCATION ); + propertyBuffer2 = propertyBuffer; + DALI_TEST_EQUALS( (bool)propertyBuffer2, true, TEST_LOCATION ); + DALI_TEST_EQUALS( propertyBuffer2.GetSize(), 0u, TEST_LOCATION ); END_TEST; } -int UtcDaliVertexBufferMoveConstructor(void) +int UtcDaliPropertyBufferMoveConstructor(void) { TestApplication application; - VertexBuffer vertexBuffer = CreateVertexBuffer(); - DALI_TEST_CHECK( vertexBuffer ); - DALI_TEST_EQUALS( 1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, vertexBuffer.GetSize(), TEST_LOCATION ); + PropertyBuffer propertyBuffer = CreatePropertyBuffer(); + DALI_TEST_CHECK( propertyBuffer ); + DALI_TEST_EQUALS( 1, propertyBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( 0u, propertyBuffer.GetSize(), TEST_LOCATION ); - VertexBuffer move = std::move( vertexBuffer ); + PropertyBuffer move = std::move( propertyBuffer ); DALI_TEST_CHECK( move ); DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); DALI_TEST_EQUALS( 0u, move.GetSize(), TEST_LOCATION ); - DALI_TEST_CHECK( !vertexBuffer ); + DALI_TEST_CHECK( !propertyBuffer ); END_TEST; } -int UtcDaliVertexBufferMoveAssignment(void) +int UtcDaliPropertyBufferMoveAssignment(void) { TestApplication application; - VertexBuffer vertexBuffer = CreateVertexBuffer(); - DALI_TEST_CHECK( vertexBuffer ); - DALI_TEST_EQUALS( 1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); - DALI_TEST_EQUALS( 0u, vertexBuffer.GetSize(), TEST_LOCATION ); + PropertyBuffer propertyBuffer = CreatePropertyBuffer(); + DALI_TEST_CHECK( propertyBuffer ); + DALI_TEST_EQUALS( 1, propertyBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( 0u, propertyBuffer.GetSize(), TEST_LOCATION ); - VertexBuffer move; - move = std::move( vertexBuffer ); + PropertyBuffer move; + move = std::move( propertyBuffer ); DALI_TEST_CHECK( move ); DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION ); DALI_TEST_EQUALS( 0u, move.GetSize(), TEST_LOCATION ); - DALI_TEST_CHECK( !vertexBuffer ); + DALI_TEST_CHECK( !propertyBuffer ); END_TEST; } -int UtcDaliVertexBufferSetData01(void) +int UtcDaliPropertyBufferSetData01(void) { TestApplication application; @@ -156,8 +156,8 @@ int UtcDaliVertexBufferSetData01(void) texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; { - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); - DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION ); + PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat ); + DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION ); const float halfQuadSize = .5f; struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; @@ -167,10 +167,10 @@ int UtcDaliVertexBufferSetData01(void) { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) }, { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } }; - vertexBuffer.SetData( texturedQuadVertexData, 4 ); + propertyBuffer.SetData( texturedQuadVertexData, 4 ); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer ); + geometry.AddVertexBuffer( propertyBuffer ); Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); @@ -199,7 +199,7 @@ int UtcDaliVertexBufferSetData01(void) END_TEST; } -int UtcDaliVertexBufferSetData02(void) +int UtcDaliPropertyBufferSetData02(void) { TestApplication application; @@ -207,8 +207,8 @@ int UtcDaliVertexBufferSetData02(void) texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2; - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); - DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION ); + PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat ); + DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION ); const float halfQuadSize = .5f; struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; @@ -218,10 +218,10 @@ int UtcDaliVertexBufferSetData02(void) { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) }, { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } }; - vertexBuffer.SetData( texturedQuadVertexData, 4 ); + propertyBuffer.SetData( texturedQuadVertexData, 4 ); Geometry geometry = Geometry::New(); - geometry.AddVertexBuffer( vertexBuffer ); + geometry.AddVertexBuffer( propertyBuffer ); Shader shader = CreateShader(); Renderer renderer = Renderer::New(geometry, shader); @@ -244,8 +244,8 @@ int UtcDaliVertexBufferSetData02(void) DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION ); } - // Re-upload the data on the vertexBuffer - vertexBuffer.SetData( texturedQuadVertexData, 4 ); + // Re-upload the data on the propertyBuffer + propertyBuffer.SetData( texturedQuadVertexData, 4 ); application.SendNotification(); application.Render(0); @@ -271,7 +271,7 @@ int UtcDaliVertexBufferSetData02(void) END_TEST; } -int UtcDaliVertexBufferInvalidTypeN(void) +int UtcDaliPropertyBufferInvalidTypeN(void) { TestApplication application; @@ -281,21 +281,21 @@ int UtcDaliVertexBufferInvalidTypeN(void) try { - VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat ); + PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat ); tet_result(TET_FAIL); } catch ( Dali::DaliException& e ) { - DALI_TEST_ASSERT( e, "Property::Type not supported in VertexBuffer", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "Property::Type not supported in PropertyBuffer", TEST_LOCATION ); } END_TEST; } -int UtcDaliVertexBufferSetDataNegative(void) +int UtcDaliPropertyBufferSetDataNegative(void) { TestApplication application; - Dali::VertexBuffer instance; + Dali::PropertyBuffer instance; try { void* arg1(nullptr); @@ -310,10 +310,10 @@ int UtcDaliVertexBufferSetDataNegative(void) END_TEST; } -int UtcDaliVertexBufferGetSizeNegative(void) +int UtcDaliPropertyBufferGetSizeNegative(void) { TestApplication application; - Dali::VertexBuffer instance; + Dali::PropertyBuffer instance; try { instance.GetSize(); diff --git a/automated-tests/src/dali/utc-Dali-Renderer.cpp b/automated-tests/src/dali/utc-Dali-Renderer.cpp index 7b700ce..3430f45 100644 --- a/automated-tests/src/dali/utc-Dali-Renderer.cpp +++ b/automated-tests/src/dali/utc-Dali-Renderer.cpp @@ -2028,7 +2028,7 @@ int UtcDaliRendererSetIndexRange(void) }; Property::Map vertexFormat; vertexFormat["aPosition"] = Property::VECTOR2; - VertexBuffer vertexBuffer = VertexBuffer::New( vertexFormat ); + PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat ); vertexBuffer.SetData( shapes, sizeof(shapes)/sizeof(shapes[0])); // -------------------------------------------------------------------------- diff --git a/dali/integration-api/profiling.cpp b/dali/integration-api/profiling.cpp index 03458cd..86c7f5e 100644 --- a/dali/integration-api/profiling.cpp +++ b/dali/integration-api/profiling.cpp @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include #include @@ -103,8 +103,8 @@ const std::size_t GEOMETRY_MEMORY_SIZE( sizeof( Internal::Geometry ) + sizeof( Internal::Render::Geometry) ); const std::size_t PROPERTY_BUFFER_MEMORY_SIZE( - sizeof( Internal::VertexBuffer ) + - sizeof( Internal::Render::VertexBuffer ) ); + sizeof( Internal::PropertyBuffer ) + + sizeof( Internal::Render::PropertyBuffer ) ); const std::size_t TEXTURE_SET_MEMORY_SIZE( sizeof( Internal::TextureSet ) + sizeof( Internal::SceneGraph::TextureSet ) ); diff --git a/dali/internal/event/rendering/vertex-buffer-impl.cpp b/dali/internal/event/common/property-buffer-impl.cpp similarity index 85% rename from dali/internal/event/rendering/vertex-buffer-impl.cpp rename to dali/internal/event/common/property-buffer-impl.cpp index e8f8931..30688d2 100644 --- a/dali/internal/event/rendering/vertex-buffer-impl.cpp +++ b/dali/internal/event/common/property-buffer-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -16,10 +16,10 @@ */ // CLASS HEADER -#include +#include // INTERNAL INCLUDES -#include +#include #include #if defined (ANDROID) || defined(WIN32) @@ -135,24 +135,24 @@ uint32_t GetPropertyImplementationAlignment( Property::Type& propertyType ) } // unnamed namespace -VertexBufferPtr VertexBuffer::New( Dali::Property::Map& format ) +PropertyBufferPtr PropertyBuffer::New( Dali::Property::Map& format ) { DALI_ASSERT_ALWAYS( format.Count() && "Format cannot be empty." ); - VertexBufferPtr vertexBuffer( new VertexBuffer() ); - vertexBuffer->Initialize( format ); + PropertyBufferPtr propertyBuffer( new PropertyBuffer() ); + propertyBuffer->Initialize( format ); - return vertexBuffer; + return propertyBuffer; } -void VertexBuffer::SetData( const void* data, uint32_t size ) +void PropertyBuffer::SetData( const void* data, uint32_t size ) { mSize = size; // size is the number of elements uint32_t bufferSize = mBufferFormatSize * mSize; // create a new DALi vector to store the buffer data - // the heap allocated vector will end up being owned by Render::VertexBuffer + // the heap allocated vector will end up being owned by Render::PropertyBuffer OwnerPointer< Vector > bufferCopy = new Dali::Vector(); bufferCopy->Resize( bufferSize ); @@ -162,28 +162,28 @@ void VertexBuffer::SetData( const void* data, uint32_t size ) std::copy( source, source + bufferSize, destination ); // Ownership of the bufferCopy is passed to the message ( uses an owner pointer ) - SceneGraph::SetVertexBufferData( mEventThreadServices.GetUpdateManager(), *mRenderObject, bufferCopy, mSize ); + SceneGraph::SetPropertyBufferData( mEventThreadServices.GetUpdateManager(), *mRenderObject, bufferCopy, mSize ); } -uint32_t VertexBuffer::GetSize() const +uint32_t PropertyBuffer::GetSize() const { return mSize; } -const Render::VertexBuffer* VertexBuffer::GetRenderObject() const +const Render::PropertyBuffer* PropertyBuffer::GetRenderObject() const { return mRenderObject; } -VertexBuffer::~VertexBuffer() +PropertyBuffer::~PropertyBuffer() { if( EventThreadServices::IsCoreRunning() && mRenderObject) { - SceneGraph::RemoveVertexBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject ); + SceneGraph::RemovePropertyBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject ); } } -VertexBuffer::VertexBuffer() +PropertyBuffer::PropertyBuffer() : mEventThreadServices( EventThreadServices::Get() ), mRenderObject( NULL ), mBufferFormatSize( 0 ), @@ -191,16 +191,16 @@ VertexBuffer::VertexBuffer() { } -void VertexBuffer::Initialize( Dali::Property::Map& formatMap ) +void PropertyBuffer::Initialize( Dali::Property::Map& formatMap ) { - mRenderObject = new Render::VertexBuffer(); - OwnerPointer< Render::VertexBuffer > transferOwnership( mRenderObject ); - SceneGraph::AddVertexBuffer( mEventThreadServices.GetUpdateManager(), transferOwnership ); + mRenderObject = new Render::PropertyBuffer(); + OwnerPointer< Render::PropertyBuffer > transferOwnership( mRenderObject ); + SceneGraph::AddPropertyBuffer( mEventThreadServices.GetUpdateManager(), transferOwnership ); uint32_t numComponents = static_cast( formatMap.Count() ); // Create the format - OwnerPointer< Render::VertexBuffer::Format> format = new Render::VertexBuffer::Format(); + OwnerPointer< Render::PropertyBuffer::Format> format = new Render::PropertyBuffer::Format(); format->components.resize( numComponents ); uint32_t currentAlignment = 0u; @@ -226,7 +226,7 @@ void VertexBuffer::Initialize( Dali::Property::Map& formatMap ) ( type == Property::ARRAY ) || ( type == Property::MAP ) ) { - DALI_ABORT( "Property::Type not supported in VertexBuffer" ); + DALI_ABORT( "Property::Type not supported in PropertyBuffer" ); } uint32_t elementSize = GetPropertyImplementationSize( type ); uint32_t elementAlignment = GetPropertyImplementationAlignment( type ); @@ -269,7 +269,7 @@ void VertexBuffer::Initialize( Dali::Property::Map& formatMap ) mBufferFormatSize = format->size; - SceneGraph::SetVertexBufferFormat(mEventThreadServices.GetUpdateManager(), *mRenderObject, format ); + SceneGraph::SetPropertyBufferFormat(mEventThreadServices.GetUpdateManager(), *mRenderObject, format ); } uint32_t GetPropertyImplementationSize( Property::Type& propertyType ) diff --git a/dali/internal/event/rendering/vertex-buffer-impl.h b/dali/internal/event/common/property-buffer-impl.h similarity index 70% rename from dali/internal/event/rendering/vertex-buffer-impl.h rename to dali/internal/event/common/property-buffer-impl.h index d6207e0..2f57eaf 100644 --- a/dali/internal/event/rendering/vertex-buffer-impl.h +++ b/dali/internal/event/common/property-buffer-impl.h @@ -1,8 +1,8 @@ -#ifndef DALI_INTERNAL_VERTEX_BUFFER_H -#define DALI_INTERNAL_VERTEX_BUFFER_H +#ifndef DALI_INTERNAL_PROPERTY_BUFFER_H +#define DALI_INTERNAL_PROPERTY_BUFFER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -24,28 +24,28 @@ #include #include // Dali::Property::Map #include -#include +#include namespace Dali { namespace Internal { -class VertexBuffer; -typedef IntrusivePtr VertexBufferPtr; +class PropertyBuffer; +typedef IntrusivePtr PropertyBufferPtr; /** - * VertexBuffer is an object that contains an array of structures of values that + * PropertyBuffer is an object that contains an array of structures of values that * can be accessed as properties. */ -class VertexBuffer : public BaseObject +class PropertyBuffer : public BaseObject { public: /** * @copydoc PropertBuffer::New() */ - static VertexBufferPtr New( Dali::Property::Map& format ); + static PropertyBufferPtr New( Dali::Property::Map& format ); /** * @copydoc PropertBuffer::SetData() @@ -60,23 +60,23 @@ public: public: // Default property extensions from Object /** - * @brief Get the render thread side of the VertexBuffer + * @brief Get the render thread side of the PropertyBuffer * - * @return The render thread side of this VertexBuffer + * @return The render thread side of this PropertyBuffer */ - const Render::VertexBuffer* GetRenderObject() const; + const Render::PropertyBuffer* GetRenderObject() const; protected: /** * @brief Destructor */ - ~VertexBuffer(); + ~PropertyBuffer(); private: // implementation /** * @brief Default constructor */ - VertexBuffer(); + PropertyBuffer(); /** * Second stage initialization @@ -84,12 +84,12 @@ private: // implementation void Initialize( Dali::Property::Map& format ); private: // unimplemented methods - VertexBuffer( const VertexBuffer& ); - VertexBuffer& operator=( const VertexBuffer& ); + PropertyBuffer( const PropertyBuffer& ); + PropertyBuffer& operator=( const PropertyBuffer& ); private: // data EventThreadServices& mEventThreadServices; /// struct PropertyImplementationType { - // typedef ... Type; not defined, only support types declared below + // typedef ... Type; not defined, only support types declared bellow }; template<> struct PropertyImplementationType< Property::BOOLEAN > { typedef bool Type; }; template<> struct PropertyImplementationType< Property::FLOAT > { typedef float Type; }; @@ -117,24 +117,24 @@ uint32_t GetPropertyImplementationSize( Property::Type& propertyType ); } // namespace Internal // Helpers for public-api forwarding methods -inline Internal::VertexBuffer& GetImplementation(Dali::VertexBuffer& handle) +inline Internal::PropertyBuffer& GetImplementation(Dali::PropertyBuffer& handle) { - DALI_ASSERT_ALWAYS(handle && "VertexBuffer handle is empty"); + DALI_ASSERT_ALWAYS(handle && "PropertyBuffer handle is empty"); BaseObject& object = handle.GetBaseObject(); - return static_cast(object); + return static_cast(object); } -inline const Internal::VertexBuffer& GetImplementation(const Dali::VertexBuffer& handle) +inline const Internal::PropertyBuffer& GetImplementation(const Dali::PropertyBuffer& handle) { - DALI_ASSERT_ALWAYS(handle && "VertexBuffer handle is empty"); + DALI_ASSERT_ALWAYS(handle && "PropertyBuffer handle is empty"); const BaseObject& object = handle.GetBaseObject(); - return static_cast(object); + return static_cast(object); } } // namespace Dali -#endif // DALI_INTERNAL_VERTEX_BUFFER_H +#endif // DALI_INTERNAL_PROPERTY_BUFFER_H diff --git a/dali/internal/event/rendering/geometry-impl.cpp b/dali/internal/event/rendering/geometry-impl.cpp index 5e7d540..57469e5 100644 --- a/dali/internal/event/rendering/geometry-impl.cpp +++ b/dali/internal/event/rendering/geometry-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -35,7 +35,7 @@ GeometryPtr Geometry::New() return geometry; } -uint32_t Geometry::AddVertexBuffer( VertexBuffer& vertexBuffer ) +uint32_t Geometry::AddVertexBuffer( PropertyBuffer& vertexBuffer ) { mVertexBuffers.push_back( &vertexBuffer ); SceneGraph::AttachVertexBufferMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, *vertexBuffer.GetRenderObject() ); @@ -49,8 +49,8 @@ uint32_t Geometry::GetNumberOfVertexBuffers() const void Geometry::RemoveVertexBuffer( uint32_t index ) { - const Render::VertexBuffer& renderVertexBuffer = static_cast( *(mVertexBuffers[index]->GetRenderObject()) ); - SceneGraph::RemoveVertexBufferMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, renderVertexBuffer ); + const Render::PropertyBuffer& renderPropertyBuffer = static_cast( *(mVertexBuffers[index]->GetRenderObject()) ); + SceneGraph::RemoveVertexBufferMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, renderPropertyBuffer ); mVertexBuffers.erase( mVertexBuffers.begin() + index ); } diff --git a/dali/internal/event/rendering/geometry-impl.h b/dali/internal/event/rendering/geometry-impl.h index d1cc60d..018fea4 100644 --- a/dali/internal/event/rendering/geometry-impl.h +++ b/dali/internal/event/rendering/geometry-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GEOMETRY_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -28,7 +28,7 @@ #include // Dali::Internal::Connectable #include // Dali::Internal::ObjectConnector #include // Dali::Internal::Object -#include // Dali::Internal::VertexBuffer +#include // Dali::Internal::PropertyBuffer #include namespace Dali @@ -60,7 +60,7 @@ public: /** * @copydoc Dali::Geometry::AddVertexBuffer() */ - uint32_t AddVertexBuffer( VertexBuffer& vertexBuffer ); + uint32_t AddVertexBuffer( PropertyBuffer& vertexBuffer ); /** * @copydoc Dali::Geometry::GetNumberOfVertexBuffers() @@ -122,7 +122,7 @@ private: // data EventThreadServices& mEventThreadServices; /// mVertexBuffers; ///< Vector of intrusive pointers to vertex buffers + std::vector mVertexBuffers; ///< Vector of intrusive pointers to vertex buffers Dali::Geometry::Type mType; ///< Geometry type (cached) }; diff --git a/dali/internal/event/rendering/texture-set-impl.h b/dali/internal/event/rendering/texture-set-impl.h index 6c4a8b8..295b322 100644 --- a/dali/internal/event/rendering/texture-set-impl.h +++ b/dali/internal/event/rendering/texture-set-impl.h @@ -26,10 +26,10 @@ #include // Dali::IntrusivePtr #include // Dali::TextureSet #include // Dali::Internal::Object +#include // Dali::Internal::PropertyBuffer #include // Dali::Internal::Sampler -#include // Dali::Internal::Shader #include // Dali::Internal::Texture - +#include // Dali::Internal::Shader namespace Dali { diff --git a/dali/internal/file.list b/dali/internal/file.list index ec9807f..6312383 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -32,6 +32,7 @@ SET( internal_src_files ${internal_src_dir}/event/common/object-impl.cpp ${internal_src_dir}/event/common/object-registry-impl.cpp ${internal_src_dir}/event/common/projection.cpp + ${internal_src_dir}/event/common/property-buffer-impl.cpp ${internal_src_dir}/event/common/property-conditions-impl.cpp ${internal_src_dir}/event/common/property-metadata.cpp ${internal_src_dir}/event/common/property-notification-impl.cpp @@ -89,7 +90,6 @@ SET( internal_src_files ${internal_src_dir}/event/rendering/renderer-impl.cpp ${internal_src_dir}/event/rendering/sampler-impl.cpp ${internal_src_dir}/event/rendering/shader-impl.cpp - ${internal_src_dir}/event/rendering/vertex-buffer-impl.cpp ${internal_src_dir}/event/size-negotiation/memory-pool-relayout-container.cpp ${internal_src_dir}/event/size-negotiation/relayout-controller-impl.cpp @@ -108,7 +108,7 @@ SET( internal_src_files ${internal_src_dir}/render/queue/render-queue.cpp ${internal_src_dir}/render/renderers/render-frame-buffer.cpp ${internal_src_dir}/render/renderers/render-geometry.cpp - ${internal_src_dir}/render/renderers/render-vertex-buffer.cpp + ${internal_src_dir}/render/renderers/render-property-buffer.cpp ${internal_src_dir}/render/renderers/render-renderer.cpp ${internal_src_dir}/render/renderers/render-texture.cpp ${internal_src_dir}/render/shaders/program.cpp diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index eaee361..c2b26e9 100755 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -159,7 +159,7 @@ struct RenderManager::Impl OwnerContainer< Render::Sampler* > samplerContainer; ///< List of owned samplers OwnerContainer< Render::Texture* > textureContainer; ///< List of owned textures OwnerContainer< Render::FrameBuffer* > frameBufferContainer; ///< List of owned framebuffers - OwnerContainer< Render::VertexBuffer* > vertexBufferContainer; ///< List of owned vertex buffers + OwnerContainer< Render::PropertyBuffer* > propertyBufferContainer; ///< List of owned property buffers OwnerContainer< Render::Geometry* > geometryContainer; ///< List of owned Geometries bool lastFrameWasRendered; ///< Keeps track of the last frame being rendered due to having render instructions @@ -393,24 +393,24 @@ void RenderManager::AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer->AttachDepthStencilTexture( mImpl->context, texture, mipmapLevel ); } -void RenderManager::AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& vertexBuffer ) +void RenderManager::AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer ) { - mImpl->vertexBufferContainer.PushBack( vertexBuffer.Release() ); + mImpl->propertyBufferContainer.PushBack( propertyBuffer.Release() ); } -void RenderManager::RemoveVertexBuffer( Render::VertexBuffer* vertexBuffer ) +void RenderManager::RemovePropertyBuffer( Render::PropertyBuffer* propertyBuffer ) { - mImpl->vertexBufferContainer.EraseObject( vertexBuffer ); + mImpl->propertyBufferContainer.EraseObject( propertyBuffer ); } -void RenderManager::SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format ) +void RenderManager::SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ) { - vertexBuffer->SetFormat( format.Release() ); + propertyBuffer->SetFormat( format.Release() ); } -void RenderManager::SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector >& data, uint32_t size ) +void RenderManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ) { - vertexBuffer->SetData( data.Release(), size ); + propertyBuffer->SetData( data.Release(), size ); } void RenderManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& indices ) @@ -428,7 +428,7 @@ void RenderManager::RemoveGeometry( Render::Geometry* geometry ) mImpl->geometryContainer.EraseObject( geometry ); } -void RenderManager::AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ) +void RenderManager::AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ) { DALI_ASSERT_DEBUG( NULL != geometry ); @@ -437,13 +437,13 @@ void RenderManager::AttachVertexBuffer( Render::Geometry* geometry, Render::Vert { if ( iter == geometry ) { - iter->AddVertexBuffer( vertexBuffer ); + iter->AddPropertyBuffer( propertyBuffer ); break; } } } -void RenderManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ) +void RenderManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ) { DALI_ASSERT_DEBUG( NULL != geometry ); @@ -452,7 +452,7 @@ void RenderManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::Vert { if ( iter == geometry ) { - iter->RemoveVertexBuffer( vertexBuffer ); + iter->RemovePropertyBuffer( propertyBuffer ); break; } } diff --git a/dali/internal/render/common/render-manager.h b/dali/internal/render/common/render-manager.h index dd6ce7a..57b25f6 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -22,9 +22,9 @@ #include #include #include -#include #include -#include +#include +#include namespace Dali { @@ -62,6 +62,7 @@ class RenderQueue; class RenderInstruction; class RenderInstructionContainer; class Shader; +class PropertyBufferDataProvider; class Scene; /** @@ -181,17 +182,17 @@ public: /** * Add a property buffer to the render manager. - * @param[in] vertexBuffer The property buffer to add. + * @param[in] propertyBuffer The property buffer to add. * @post propertBuffer is owned by RenderManager */ - void AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& vertexBuffer ); + void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer ); /** * Remove a property buffer from the render manager. - * @param[in] vertexBuffer The property buffer to remove. - * @post vertexBuffer is destroyed. + * @param[in] propertyBuffer The property buffer to remove. + * @post propertyBuffer is destroyed. */ - void RemoveVertexBuffer( Render::VertexBuffer* vertexBuffer ); + void RemovePropertyBuffer( Render::PropertyBuffer* propertyBuffer ); /** * Add a geometry to the render manager. @@ -210,32 +211,32 @@ public: /** * Adds a property buffer to a geometry from the render manager. * @param[in] geometry The geometry - * @param[in] vertexBuffer The property buffer to remove. + * @param[in] propertyBuffer The property buffer to remove. */ - void AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ); + void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); /** * Remove a property buffer from a Render::Geometry from the render manager. * @param[in] geometry The geometry - * @param[in] vertexBuffer The property buffer to remove. + * @param[in] propertyBuffer The property buffer to remove. * @post property buffer is destroyed. */ - void RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ); + void RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); /** * Sets the format of an existing property buffer - * @param[in] vertexBuffer The property buffer. + * @param[in] propertyBuffer The property buffer. * @param[in] format The new format of the buffer */ - void SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format ); + void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ); /** * Sets the data of an existing property buffer - * @param[in] vertexBuffer The property buffer. + * @param[in] propertyBuffer The property buffer. * @param[in] data The new data of the buffer * @param[in] size The new size of the buffer */ - void SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector >& data, uint32_t size ); + void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ); /** * Sets the data for the index buffer of an existing geometry diff --git a/dali/internal/render/data-providers/property-buffer-data-provider.h b/dali/internal/render/data-providers/property-buffer-data-provider.h new file mode 100644 index 0000000..51c8f64 --- /dev/null +++ b/dali/internal/render/data-providers/property-buffer-data-provider.h @@ -0,0 +1,145 @@ +#ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_BUFFER_DATA_PROVIDER_H +#define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_BUFFER_DATA_PROVIDER_H + +/* + * Copyright (c) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ +namespace Internal +{ +namespace SceneGraph +{ + +class PropertyBufferDataProvider +{ +public: + + /** + * Type for the data contained in the buffer + */ + typedef Dali::Vector< char > BufferType; + +public: + /** + * Constructor + */ + PropertyBufferDataProvider() + { + } + + /** + * Get the number of attributes + * @param[in] bufferIndex Index to access double buffered values + * @return the number of attributes + */ + virtual unsigned int GetAttributeCount( BufferIndex bufferIndex ) const = 0; + + /** + * Get the name of an attribute + * @param[in] bufferIndex Index to access double buffered values + * @param[in] index Index of the attribute + * @return the name of the attribute + */ + virtual const std::string& GetAttributeName( BufferIndex bufferIndex, unsigned int index ) const = 0; + + /** + * Get the byte size of an attribute + * @param[in] bufferIndex Index to access double buffered values + * @param[in] index Index of the attribute + * @return the byte size of the attribute + */ + virtual size_t GetAttributeSize( BufferIndex bufferIndex, unsigned int index ) const = 0; + + /** + * Get the type of an attribute + * @param[in] bufferIndex Index to access double buffered values + * @param[in] index Index of the attribute + * @return the type of the attribute + */ + virtual Property::Type GetAttributeType( BufferIndex bufferIndex, unsigned int index ) const = 0; + + /** + * Get the byte offset of an attribute + * @param[in] bufferIndex Index to access double buffered values + * @param[in] index Index of the attribute + * @return the byte offset of the attribute + */ + virtual size_t GetAttributeOffset( BufferIndex bufferIndex, unsigned int index ) const = 0; + + /** + * Get the property buffer data + * @param[in] bufferIndex Index to access double buffered values + * @return the property buffer's data array + */ + virtual const BufferType& GetData( BufferIndex bufferIndex ) const = 0; + + /** + * Get the size of the property buffer in bytes + * @param[in] bufferIndex Index to access double buffered values + * @return the size in bytes + */ + virtual size_t GetDataSize( BufferIndex bufferIndex ) const = 0; + + /** + * Get the size of an element of the buffer in bytes + * @param[in] bufferIndex Index to access double buffered values + * @return the element size in bytes + */ + virtual size_t GetElementSize( BufferIndex bufferIndex ) const = 0; + + /** + * Get the number of elements + * @param[in] bufferIndex Index to access double buffered values + * @return the number of elements + */ + virtual unsigned int GetElementCount( BufferIndex bufferIndex ) const = 0; + + /** + * Get Id of the GPU buffer associated with this propertyBuffer + * @param[in] bufferIndex Index to access double buffered values + * @return the Id + */ + virtual unsigned int GetGpuBufferId( BufferIndex bufferIndex ) const = 0; + + /** + * Checks if data in the PropertyBuffer has changed repect previous frame + * @param[in] bufferIndex Index to access double buffered values + * @return true if data has changed, false otherwise + */ + virtual bool HasDataChanged( BufferIndex bufferIndex ) const = 0; + +protected: + /** + * No deletion through this interface + */ + virtual ~PropertyBufferDataProvider() + { + } +}; + +} // namespace SceneGraph +} // namespace Internal +} // namespace Dali + +#endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_BUFFER_DATA_PROVIDER_H diff --git a/dali/internal/render/data-providers/render-data-provider.h b/dali/internal/render/data-providers/render-data-provider.h index 2ca0a45..3d5573e 100755 --- a/dali/internal/render/data-providers/render-data-provider.h +++ b/dali/internal/render/data-providers/render-data-provider.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,7 @@ struct BlendingOptions; namespace SceneGraph { +class PropertyBuffer; class Shader; class Renderer; @@ -48,6 +50,7 @@ class Renderer; class RenderDataProvider { public: + typedef Dali::Vector< const PropertyBufferDataProvider* > VertexBuffers; typedef std::vector< Render::Sampler* > Samplers; /** diff --git a/dali/internal/render/renderers/render-geometry.cpp b/dali/internal/render/renderers/render-geometry.cpp index 592ec6d..17ba522 100644 --- a/dali/internal/render/renderers/render-geometry.cpp +++ b/dali/internal/render/renderers/render-geometry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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,7 +21,7 @@ #include #include #include -#include +#include #include namespace Dali @@ -53,9 +53,9 @@ void Geometry::GlContextDestroyed() { } -void Geometry::AddVertexBuffer( Render::VertexBuffer* vertexBuffer ) +void Geometry::AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer ) { - mVertexBuffers.PushBack( vertexBuffer ); + mVertexBuffers.PushBack( propertyBuffer ); mAttributesChanged = true; } @@ -65,14 +65,14 @@ void Geometry::SetIndexBuffer( Dali::Vector& indices ) mIndicesChanged = true; } -void Geometry::RemoveVertexBuffer( const Render::VertexBuffer* vertexBuffer ) +void Geometry::RemovePropertyBuffer( const Render::PropertyBuffer* propertyBuffer ) { const auto&& end = mVertexBuffers.End(); for( auto&& iter = mVertexBuffers.Begin(); iter != end; ++iter ) { - if( *iter == vertexBuffer ) + if( *iter == propertyBuffer ) { - //This will delete the gpu buffer associated to the RenderVertexBuffer if there is one + //This will delete the gpu buffer associated to the RenderPropertyBuffer if there is one mVertexBuffers.Remove( iter ); mAttributesChanged = true; break; diff --git a/dali/internal/render/renderers/render-geometry.h b/dali/internal/render/renderers/render-geometry.h index c8ac1e5..f08cbce 100644 --- a/dali/internal/render/renderers/render-geometry.h +++ b/dali/internal/render/renderers/render-geometry.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_RENDER_GEOMETRY_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -37,7 +37,7 @@ class GpuBuffer; namespace Render { -class VertexBuffer; +class PropertyBuffer; /** * This class encapsulates the GPU buffers. It is used to upload vertex data @@ -68,9 +68,9 @@ public: /** * Adds a property buffer to the geometry - * @param[in] dataProvider The VertexBuffer data provider + * @param[in] dataProvider The PropertyBuffer data provider */ - void AddVertexBuffer( Render::VertexBuffer* vertexBuffer ); + void AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer ); /** * Set the data for the index buffer to be used by the geometry @@ -79,10 +79,10 @@ public: void SetIndexBuffer( Dali::Vector& indices ); /** - * Removes a VertexBuffer from the geometry - * @param[in] vertexBuffer The property buffer to be removed + * Removes a PropertyBuffer from the geometry + * @param[in] propertyBuffer The property buffer to be removed */ - void RemoveVertexBuffer( const Render::VertexBuffer* vertexBuffer ); + void RemovePropertyBuffer( const Render::PropertyBuffer* propertyBuffer ); /** * Gets the attribute locations on the shader for the attributes defined in the geometry RenderBuffers @@ -137,8 +137,8 @@ public: private: - // VertexBuffers - Vector< Render::VertexBuffer* > mVertexBuffers; + // PropertyBuffers + Vector< Render::PropertyBuffer* > mVertexBuffers; Dali::Vector< uint16_t > mIndices; OwnerPointer< GpuBuffer > mIndexBuffer; diff --git a/dali/internal/render/renderers/render-vertex-buffer.cpp b/dali/internal/render/renderers/render-property-buffer.cpp similarity index 85% rename from dali/internal/render/renderers/render-vertex-buffer.cpp rename to dali/internal/render/renderers/render-property-buffer.cpp index 981dba7..5976020 100644 --- a/dali/internal/render/renderers/render-vertex-buffer.cpp +++ b/dali/internal/render/renderers/render-property-buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -15,8 +15,8 @@ * */ -#include -#include // Dali::Internal::VertexBuffer +#include +#include // Dali::Internal::PropertyBuffer namespace { @@ -116,7 +116,7 @@ namespace Internal namespace Render { -VertexBuffer::VertexBuffer() +PropertyBuffer::PropertyBuffer() :mFormat(NULL), mData(NULL), mGpuBuffer(NULL), @@ -125,24 +125,24 @@ VertexBuffer::VertexBuffer() { } -VertexBuffer::~VertexBuffer() +PropertyBuffer::~PropertyBuffer() { } -void VertexBuffer::SetFormat( VertexBuffer::Format* format ) +void PropertyBuffer::SetFormat( PropertyBuffer::Format* format ) { mFormat = format; mDataChanged = true; } -void VertexBuffer::SetData( Dali::Vector* data, uint32_t size ) +void PropertyBuffer::SetData( Dali::Vector* data, uint32_t size ) { mData = data; mSize = size; mDataChanged = true; } -bool VertexBuffer::Update( Context& context ) +bool PropertyBuffer::Update( Context& context ) { if( !mData || !mFormat || !mSize ) { @@ -169,7 +169,7 @@ bool VertexBuffer::Update( Context& context ) return true; } -void VertexBuffer::BindBuffer( Context& context, GpuBuffer::Target target ) +void PropertyBuffer::BindBuffer( Context& context, GpuBuffer::Target target ) { if(mGpuBuffer) { @@ -177,7 +177,7 @@ void VertexBuffer::BindBuffer( Context& context, GpuBuffer::Target target ) } } -uint32_t VertexBuffer::EnableVertexAttributes( Context& context, Vector& vAttributeLocation, uint32_t locationBase ) +uint32_t PropertyBuffer::EnableVertexAttributes( Context& context, Vector& vAttributeLocation, uint32_t locationBase ) { const uint32_t attributeCount = static_cast( mFormat->components.size() ); diff --git a/dali/internal/render/renderers/render-vertex-buffer.h b/dali/internal/render/renderers/render-property-buffer.h similarity index 86% rename from dali/internal/render/renderers/render-vertex-buffer.h rename to dali/internal/render/renderers/render-property-buffer.h index f2b02b8..c0f82fa 100644 --- a/dali/internal/render/renderers/render-vertex-buffer.h +++ b/dali/internal/render/renderers/render-property-buffer.h @@ -1,8 +1,8 @@ -#ifndef DALI_INTERNAL_RENDER_VERTEX_BUFFER_H -#define DALI_INTERNAL_RENDER_VERTEX_BUFFER_H +#ifndef DALI_INTERNAL_RENDER_PROPERTY_BUFFER_H +#define DALI_INTERNAL_RENDER_PROPERTY_BUFFER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -32,7 +32,7 @@ namespace Internal namespace Render { -class VertexBuffer +class PropertyBuffer { public: @@ -45,7 +45,7 @@ public: }; /** - * Structure that holds the meta-data of the format of VertexBuffer. + * Structure that holds the meta-data of the format of PropertyBuffer. */ struct Format { @@ -56,27 +56,27 @@ public: /** * @brief Default constructor */ - VertexBuffer(); + PropertyBuffer(); /** * @brief Destructor */ - ~VertexBuffer(); + ~PropertyBuffer(); /** * @brief Set the format of the buffer * * This function takes ownership of the pointer * - * @param[in] format The format for the VertexBuffer + * @param[in] format The format for the PropertyBuffer */ - void SetFormat( VertexBuffer::Format* format ); + void SetFormat( PropertyBuffer::Format* format ); /** - * @brief Set the data of the VertexBuffer + * @brief Set the data of the PropertyBuffer * * This function takes ownership of the pointer - * @param[in] data The new data of the VertexBuffer + * @param[in] data The new data of the PropertyBuffer * @param[in] size The new size of the buffer */ void SetData( Dali::Vector* data, uint32_t size ); @@ -180,15 +180,15 @@ public: return reinterpret_cast( &data->operator[]( 0 ) ); } - inline const VertexBuffer::Format* GetFormat() const + inline const PropertyBuffer::Format* GetFormat() const { return mFormat.Get(); } private: - OwnerPointer< VertexBuffer::Format > mFormat; ///< Format of the buffer + OwnerPointer< PropertyBuffer::Format > mFormat; ///< Format of the buffer OwnerPointer< Dali::Vector< uint8_t > > mData; ///< Data - OwnerPointer< GpuBuffer > mGpuBuffer; ///< Pointer to the GpuBuffer associated with this RenderVertexBuffer + OwnerPointer< GpuBuffer > mGpuBuffer; ///< Pointer to the GpuBuffer associated with this RenderPropertyBuffer uint32_t mSize; ///< Number of Elements in the buffer bool mDataChanged; ///< Flag to know if data has changed in a frame @@ -201,4 +201,4 @@ private: } // namespace Dali -#endif // DALI_INTERNAL_RENDER_VERTEX_BUFFER_H +#endif // DALI_INTERNAL_RENDER_PROPERTY_BUFFER_H diff --git a/dali/internal/update/controllers/render-message-dispatcher.h b/dali/internal/update/controllers/render-message-dispatcher.h index fab009c..30e1866 100644 --- a/dali/internal/update/controllers/render-message-dispatcher.h +++ b/dali/internal/update/controllers/render-message-dispatcher.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDER_MESSAGE_DISPATCHER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -20,7 +20,9 @@ // INTERNAL INCLUDES #include +#include #include +#include namespace Dali { @@ -33,13 +35,12 @@ namespace Render { class RenderTracker; } - namespace SceneGraph { class RenderManager; class RenderQueue; - +class PropertyBufferDataProvider; /** * A utility class for sending messages to the render-thread. */ diff --git a/dali/internal/update/manager/render-instruction-processor.cpp b/dali/internal/update/manager/render-instruction-processor.cpp index 35a1839..3e71956 100644 --- a/dali/internal/update/manager/render-instruction-processor.cpp +++ b/dali/internal/update/manager/render-instruction-processor.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include namespace diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 1b1c5e4..2d04a1e 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -1247,51 +1247,51 @@ void UpdateManager::SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, u new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetWrapMode, sampler, rWrapMode, sWrapMode, tWrapMode ); } -void UpdateManager::AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& vertexBuffer ) +void UpdateManager::AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer ) { // Message has ownership of format while in transit from update -> render - typedef MessageValue1< RenderManager, OwnerPointer< Render::VertexBuffer > > DerivedType; + typedef MessageValue1< RenderManager, OwnerPointer< Render::PropertyBuffer > > 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::AddVertexBuffer, vertexBuffer ); + new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddPropertyBuffer, propertyBuffer ); } -void UpdateManager::RemoveVertexBuffer( Render::VertexBuffer* vertexBuffer ) +void UpdateManager::RemovePropertyBuffer( Render::PropertyBuffer* propertyBuffer ) { - typedef MessageValue1< RenderManager, Render::VertexBuffer* > DerivedType; + typedef MessageValue1< RenderManager, Render::PropertyBuffer* > 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::RemoveVertexBuffer, vertexBuffer ); + new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemovePropertyBuffer, propertyBuffer ); } -void UpdateManager::SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format ) +void UpdateManager::SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ) { // Message has ownership of format while in transit from update -> render - typedef MessageValue2< RenderManager, Render::VertexBuffer*, OwnerPointer< Render::VertexBuffer::Format > > DerivedType; + typedef MessageValue2< RenderManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format > > 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::SetVertexBufferFormat, vertexBuffer, format ); + new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetPropertyBufferFormat, propertyBuffer, format ); } -void UpdateManager::SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector >& data, uint32_t size ) +void UpdateManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ) { // Message has ownership of format while in transit from update -> render - typedef MessageValue3< RenderManager, Render::VertexBuffer*, OwnerPointer< Dali::Vector >, uint32_t > DerivedType; + typedef MessageValue3< RenderManager, Render::PropertyBuffer*, OwnerPointer< Dali::Vector >, 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::SetVertexBufferData, vertexBuffer, data, size ); + new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetPropertyBufferData, propertyBuffer, data, size ); } void UpdateManager::AddGeometry( OwnerPointer< Render::Geometry >& geometry ) @@ -1339,26 +1339,26 @@ void UpdateManager::SetIndexBuffer( Render::Geometry* geometry, Dali::VectorrenderManager, geometry, indices ); } -void UpdateManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ) +void UpdateManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ) { - typedef MessageValue2< RenderManager, Render::Geometry*, Render::VertexBuffer* > DerivedType; + typedef MessageValue2< RenderManager, Render::Geometry*, Render::PropertyBuffer* > 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::RemoveVertexBuffer, geometry, vertexBuffer ); + new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveVertexBuffer, geometry, propertyBuffer ); } -void UpdateManager::AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ) +void UpdateManager::AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ) { - typedef MessageValue2< RenderManager, Render::Geometry*, Render::VertexBuffer* > DerivedType; + typedef MessageValue2< RenderManager, Render::Geometry*, Render::PropertyBuffer* > 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::AttachVertexBuffer, geometry, vertexBuffer ); + new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AttachVertexBuffer, geometry, propertyBuffer ); } void UpdateManager::AddTexture( OwnerPointer< Render::Texture >& texture ) diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index 3050851..fdadd69 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -42,7 +42,7 @@ #include #include #include // for OwnerPointer< Shader > -#include +#include #include namespace Dali @@ -83,7 +83,7 @@ class RenderManager; class RenderTaskList; class RenderTaskProcessor; class RenderQueue; -class VertexBuffer; +class PropertyBuffer; struct NodeDepthPair { @@ -470,31 +470,31 @@ public: * @post Sends a message to RenderManager to add the property buffer. * The property buffer will be owned by RenderManager */ - void AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& propertryBuffer ); + void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertryBuffer ); /** - * Removes an existing VertexBuffer from RenderManager + * Removes an existing PropertyBuffer from RenderManager * @param[in] propertryBuffer The property buffer to remove * @post The property buffer will be destroyed in the render thread */ - void RemoveVertexBuffer( Render::VertexBuffer* propertryBuffer ); + void RemovePropertyBuffer( Render::PropertyBuffer* propertryBuffer ); /** * Sets the format of an existing property buffer - * @param[in] vertexBuffer The property buffer. + * @param[in] propertyBuffer The property buffer. * @param[in] format The new format of the buffer * @post Sends a message to RenderManager to set the new format to the property buffer. */ - void SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format ); + void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ); /** * Sets the data of an existing property buffer - * @param[in] vertexBuffer The property buffer. + * @param[in] propertyBuffer The property buffer. * @param[in] data The new data of the buffer * @param[in] size The new size of the buffer * @post Sends a message to RenderManager to set the new data to the property buffer. */ - void SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector >& data, uint32_t size ); + void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ); /** * Adds a geometry to the RenderManager @@ -528,16 +528,16 @@ public: /** * Adds a vertex buffer to a geometry * @param[in] geometry The geometry - * @param[in] vertexBuffer The property buffer + * @param[in] propertyBuffer The property buffer */ - void AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ); + void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); /** * Removes a vertex buffer from a geometry * @param[in] geometry The geometry - * @param[in] vertexBuffer The property buffer + * @param[in] propertyBuffer The property buffer */ - void RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ); + void RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); /** * Adds a texture to the render manager @@ -1233,51 +1233,51 @@ inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode ); } -inline void AddVertexBuffer( UpdateManager& manager, OwnerPointer< Render::VertexBuffer >& vertexBuffer ) +inline void AddPropertyBuffer( UpdateManager& manager, OwnerPointer< Render::PropertyBuffer >& propertyBuffer ) { - // Message has ownership of vertexBuffer while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer< Render::VertexBuffer > > LocalType; + // Message has ownership of propertyBuffer while in transit from event -> update + typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > 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::AddVertexBuffer, vertexBuffer ); + new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, propertyBuffer ); } -inline void RemoveVertexBuffer( UpdateManager& manager, Render::VertexBuffer& vertexBuffer ) +inline void RemovePropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer ) { - typedef MessageValue1< UpdateManager, Render::VertexBuffer* > LocalType; + typedef MessageValue1< UpdateManager, Render::PropertyBuffer* > 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::RemoveVertexBuffer, &vertexBuffer ); + new (slot) LocalType( &manager, &UpdateManager::RemovePropertyBuffer, &propertyBuffer ); } -inline void SetVertexBufferFormat( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format ) +inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ) { - // Message has ownership of VertexBuffer::Format while in transit from event -> update - typedef MessageValue2< UpdateManager, Render::VertexBuffer*, OwnerPointer< Render::VertexBuffer::Format> > LocalType; + // Message has ownership of PropertyBuffer::Format while in transit from event -> update + typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > 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::SetVertexBufferFormat, &vertexBuffer, format ); + new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format ); } -inline void SetVertexBufferData( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Vector >& data, uint32_t size ) +inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ) { - // Message has ownership of VertexBuffer data while in transit from event -> update - typedef MessageValue3< UpdateManager, Render::VertexBuffer*, OwnerPointer< Vector >, uint32_t > LocalType; + // Message has ownership of PropertyBuffer data while in transit from event -> update + typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector >, 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::SetVertexBufferData, &vertexBuffer, data, size ); + new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size ); } inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry ) @@ -1303,26 +1303,26 @@ inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry ) new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry ); } -inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer ) +inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer ) { - typedef MessageValue2< UpdateManager, Render::Geometry*, Render::VertexBuffer* > LocalType; + typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > 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::AttachVertexBuffer, &geometry, const_cast(&vertexBuffer) ); + new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast(&vertexBuffer) ); } -inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer ) +inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer ) { - typedef MessageValue2< UpdateManager, Render::Geometry*, Render::VertexBuffer* > LocalType; + typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > 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::RemoveVertexBuffer, &geometry, const_cast(&vertexBuffer) ); + new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast(&vertexBuffer) ); } // Custom message type for SetIndexBuffer() used to move data with Vector::Swap() diff --git a/dali/public-api/dali-core.h b/dali/public-api/dali-core.h index a53cb12..e7c07ea 100644 --- a/dali/public-api/dali-core.h +++ b/dali/public-api/dali-core.h @@ -106,12 +106,12 @@ #include #include +#include #include #include #include #include #include -#include #include #include diff --git a/dali/public-api/file.list b/dali/public-api/file.list index 9675830..c7b000f 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -67,7 +67,7 @@ SET( public_api_src_files ${public_api_src_dir}/render-tasks/render-task-list.cpp ${public_api_src_dir}/rendering/frame-buffer.cpp ${public_api_src_dir}/rendering/geometry.cpp - ${public_api_src_dir}/rendering/vertex-buffer.cpp + ${public_api_src_dir}/rendering/property-buffer.cpp ${public_api_src_dir}/rendering/texture.cpp ${public_api_src_dir}/rendering/texture-set.cpp ${public_api_src_dir}/rendering/renderer.cpp @@ -216,7 +216,7 @@ SET( public_api_core_render_tasks_header_files SET( public_api_core_rendering_header_files ${public_api_src_dir}/rendering/frame-buffer.h ${public_api_src_dir}/rendering/geometry.h - ${public_api_src_dir}/rendering/vertex-buffer.h + ${public_api_src_dir}/rendering/property-buffer.h ${public_api_src_dir}/rendering/texture.h ${public_api_src_dir}/rendering/texture-set.h ${public_api_src_dir}/rendering/renderer.h diff --git a/dali/public-api/rendering/geometry.cpp b/dali/public-api/rendering/geometry.cpp index 58b54be..b1d0766 100644 --- a/dali/public-api/rendering/geometry.cpp +++ b/dali/public-api/rendering/geometry.cpp @@ -51,7 +51,7 @@ Geometry::Geometry( Geometry&& rhs ) = default; Geometry& Geometry::operator=( Geometry&& rhs ) = default; -std::size_t Geometry::AddVertexBuffer( VertexBuffer& vertexBuffer ) +std::size_t Geometry::AddVertexBuffer( PropertyBuffer& vertexBuffer ) { DALI_ASSERT_ALWAYS( vertexBuffer && "VertexBuffer is not initialized "); return GetImplementation(*this).AddVertexBuffer( GetImplementation( vertexBuffer ) ); diff --git a/dali/public-api/rendering/geometry.h b/dali/public-api/rendering/geometry.h index 56cb874..a898e56 100644 --- a/dali/public-api/rendering/geometry.h +++ b/dali/public-api/rendering/geometry.h @@ -25,7 +25,7 @@ // INTERNAL INCLUDES #include // Dali::Handle #include // DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX -#include // Dali::VertexBuffer +#include // Dali::PropertyBuffer namespace Dali { @@ -131,19 +131,19 @@ public: Geometry& operator=( Geometry&& rhs ); /** - * @brief Adds a VertexBuffer to be used as source of geometry vertices. + * @brief Adds a PropertyBuffer to be used as source of geometry vertices. * - * @SINCE_1_9.27 - * @param[in] vertexBuffer VertexBuffer to be used as source of geometry vertices + * @SINCE_1_1.43 + * @param[in] vertexBuffer PropertyBuffer to be used as source of geometry vertices * @return Index of the newly added buffer, can be used with RemoveVertexBuffer to remove * this buffer if no longer required */ - std::size_t AddVertexBuffer( VertexBuffer& vertexBuffer ); + std::size_t AddVertexBuffer( PropertyBuffer& vertexBuffer ); /** * @brief Retrieves the number of vertex buffers that have been added to this geometry. * - * @SINCE_1_9.27 + * @SINCE_1_1.43 * @return Number of vertex buffers that have been added to this geometry */ std::size_t GetNumberOfVertexBuffers() const; @@ -152,7 +152,7 @@ public: * @brief Removes a vertex buffer. * The index must be between 0 and GetNumberOfVertexBuffers(). * - * @SINCE_1_9.27 + * @SINCE_1_1.43 * @param[in] index Index to the vertex buffer to remove */ void RemoveVertexBuffer( std::size_t index ); diff --git a/dali/public-api/rendering/property-buffer.cpp b/dali/public-api/rendering/property-buffer.cpp new file mode 100644 index 0000000..839f202 --- /dev/null +++ b/dali/public-api/rendering/property-buffer.cpp @@ -0,0 +1,72 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// INTERNAL INCLUDES +#include // Dali::Property::Map +#include // Dali::Internal::PropertyBuffer + +namespace Dali +{ + +PropertyBuffer PropertyBuffer::New( Dali::Property::Map& bufferFormat ) +{ + Internal::PropertyBufferPtr propertyBuffer = Internal::PropertyBuffer::New( bufferFormat ); + + return PropertyBuffer( propertyBuffer.Get() ); +} + +PropertyBuffer::PropertyBuffer() +{ +} + +PropertyBuffer::~PropertyBuffer() +{ +} + +PropertyBuffer::PropertyBuffer( const PropertyBuffer& handle ) = default; + +PropertyBuffer PropertyBuffer::DownCast( BaseHandle handle ) +{ + return PropertyBuffer( dynamic_cast(handle.GetObjectPtr())); +} + +PropertyBuffer& PropertyBuffer::operator=( const PropertyBuffer& handle ) = default; + +PropertyBuffer::PropertyBuffer( PropertyBuffer&& rhs ) = default; + +PropertyBuffer& PropertyBuffer::operator=( PropertyBuffer&& rhs ) = default; + +void PropertyBuffer::SetData( const void* data, std::size_t size ) +{ + GetImplementation(*this).SetData( data, static_cast( size ) ); // only support 4,294,967,295 bytes +} + +std::size_t PropertyBuffer::GetSize() const +{ + return GetImplementation(*this).GetSize(); +} + + +PropertyBuffer::PropertyBuffer( Internal::PropertyBuffer* pointer ) +: BaseHandle( pointer ) +{ +} + +} // namespace Dali diff --git a/dali/public-api/rendering/vertex-buffer.h b/dali/public-api/rendering/property-buffer.h similarity index 75% rename from dali/public-api/rendering/vertex-buffer.h rename to dali/public-api/rendering/property-buffer.h index 69f46c5..c6037e4 100644 --- a/dali/public-api/rendering/vertex-buffer.h +++ b/dali/public-api/rendering/property-buffer.h @@ -1,5 +1,5 @@ -#ifndef DALI_VERTEX_BUFFER_H -#define DALI_VERTEX_BUFFER_H +#ifndef DALI_PROPERTY_BUFFER_H +#define DALI_PROPERTY_BUFFER_H /* * Copyright (c) 2020 Samsung Electronics Co., Ltd. @@ -35,13 +35,13 @@ namespace Dali namespace Internal DALI_INTERNAL { -class VertexBuffer; +class PropertyBuffer; } /** - * @brief VertexBuffer is a handle to an object that contains a buffer of structured data. + * @brief PropertyBuffer is a handle to an object that contains a buffer of structured properties. * - * VertexBuffers can be used to provide data to Geometry objects. + * PropertyBuffers can be used to provide data to Geometry objects. * * Example: * @@ -56,7 +56,7 @@ class VertexBuffer; * Property::Map texturedQuadVertexFormat; * texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; * texturedQuadVertexFormat["aTexCoord"] = Property::VECTOR2; - * VertexBuffer texturedQuadVertices = VertexBuffer::New( texturedQuadVertexFormat ); + * PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat ); * texturedQuadVertices.SetData( texturedQuadVertexData, 4 ); * * // Create indices @@ -69,76 +69,77 @@ class VertexBuffer; * * @SINCE_1_1.43 */ -class DALI_CORE_API VertexBuffer : public BaseHandle +class DALI_CORE_API PropertyBuffer : public BaseHandle { public: /** - * @brief Creates a VertexBuffer. + * @brief Creates a PropertyBuffer. + * Static property buffers use less memory. * - * @SINCE_1_9.27 + * @SINCE_1_1.43 * @param[in] bufferFormat Map of names and types that describes the components of the buffer - * @return Handle to a newly allocated VertexBuffer + * @return Handle to a newly allocated PropertyBuffer */ - static VertexBuffer New( Dali::Property::Map& bufferFormat ); + static PropertyBuffer New( Dali::Property::Map& bufferFormat ); /** * @brief Default constructor, creates an empty handle. * - * @SINCE_1_9.27 + * @SINCE_1_1.43 */ - VertexBuffer(); + PropertyBuffer(); /** * @brief Destructor. * - * @SINCE_1_9.27 + * @SINCE_1_1.43 */ - ~VertexBuffer(); + ~PropertyBuffer(); /** * @brief Copy constructor, creates a new handle to the same object. * - * @SINCE_1_9.27 + * @SINCE_1_1.43 * @param[in] handle Handle to an object */ - VertexBuffer( const VertexBuffer& handle ); + PropertyBuffer( const PropertyBuffer& handle ); /** * @brief Downcasts to a property buffer handle. * If not, a property buffer the returned property buffer handle is left uninitialized. * - * @SINCE_1_9.27 + * @SINCE_1_1.43 * @param[in] handle Handle to an object * @return Property buffer handle or an uninitialized handle */ - static VertexBuffer DownCast( BaseHandle handle ); + static PropertyBuffer DownCast( BaseHandle handle ); /** * @brief Assignment operator, changes this handle to point at the same object. * - * @SINCE_1_9.27 + * @SINCE_1_1.43 * @param[in] handle Handle to an object * @return Reference to the assigned object */ - VertexBuffer& operator=( const VertexBuffer& handle ); + PropertyBuffer& operator=( const PropertyBuffer& handle ); /** * @brief Move constructor. * - * @SINCE_1_9.27 + * @SINCE_1_9.22 * @param[in] rhs A reference to the moved handle */ - VertexBuffer( VertexBuffer&& rhs ); + PropertyBuffer( PropertyBuffer&& rhs ); /** * @brief Move assignment operator. * - * @SINCE_1_9.27 + * @SINCE_1_9.22 * @param[in] rhs A reference to the moved handle * @return A reference to this handle */ - VertexBuffer& operator=( VertexBuffer&& rhs ); + PropertyBuffer& operator=( PropertyBuffer&& rhs ); /** * @brief Updates the whole buffer information. @@ -155,10 +156,10 @@ public: * Dali::Vector2 uv; * }; * Vertex vertices[ 10 ] = { ... }; - * vertexBuffer.SetData( vertices ); + * propertyBuffer.SetData( vertices ); * * - * @SINCE_1_9.27 + * @SINCE_1_1.43 * @param[in] data A pointer to the data that will be copied to the buffer * @param[in] size Number of elements to expand or contract the buffer */ @@ -167,7 +168,7 @@ public: /** * @brief Gets the number of elements in the buffer. * - * @SINCE_1_9.27 + * @SINCE_1_1.43 * @return Number of elements to expand or contract the buffer */ std::size_t GetSize() const; @@ -177,10 +178,10 @@ public: /** * @brief The constructor. * @note Not intended for application developers. - * @SINCE_1_9.27 - * @param[in] pointer A pointer to a newly allocated VertexBuffer + * @SINCE_1_1.43 + * @param[in] pointer A pointer to a newly allocated PropertyBuffer */ - explicit DALI_INTERNAL VertexBuffer( Internal::VertexBuffer* pointer ); + explicit DALI_INTERNAL PropertyBuffer( Internal::PropertyBuffer* pointer ); }; /** @@ -188,4 +189,4 @@ public: */ } // namespace Dali -#endif // DALI_VERTEX_BUFFER_H +#endif // DALI_PROPERTY_BUFFER_H diff --git a/dali/public-api/rendering/vertex-buffer.cpp b/dali/public-api/rendering/vertex-buffer.cpp deleted file mode 100644 index 3b7873d..0000000 --- a/dali/public-api/rendering/vertex-buffer.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL INCLUDES -#include // Dali::Property::Map -#include // Dali::Internal::VertexBuffer - -namespace Dali -{ - -VertexBuffer VertexBuffer::New( Dali::Property::Map& bufferFormat ) -{ - Internal::VertexBufferPtr vertexBuffer = Internal::VertexBuffer::New( bufferFormat ); - - return VertexBuffer( vertexBuffer.Get() ); -} - -VertexBuffer::VertexBuffer() -{ -} - -VertexBuffer::~VertexBuffer() -{ -} - -VertexBuffer::VertexBuffer( const VertexBuffer& handle ) = default; - -VertexBuffer VertexBuffer::DownCast( BaseHandle handle ) -{ - return VertexBuffer( dynamic_cast(handle.GetObjectPtr())); -} - -VertexBuffer& VertexBuffer::operator=( const VertexBuffer& handle ) = default; - -VertexBuffer::VertexBuffer( VertexBuffer&& rhs ) = default; - -VertexBuffer& VertexBuffer::operator=( VertexBuffer&& rhs ) = default; - -void VertexBuffer::SetData( const void* data, std::size_t size ) -{ - GetImplementation(*this).SetData( data, static_cast( size ) ); // only support 4,294,967,295 bytes -} - -std::size_t VertexBuffer::GetSize() const -{ - return GetImplementation(*this).GetSize(); -} - - -VertexBuffer::VertexBuffer( Internal::VertexBuffer* pointer ) -: BaseHandle( pointer ) -{ -} - -} // namespace Dali -- 2.7.4