X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Frenderers%2Frender-property-buffer.cpp;h=5976020533f9ef6d6c370ae70f7f24b2695f22f0;hb=e8e38595cefb3d47ae789b26ce4581f518f18662;hp=eb17d9e6196005322b42bc032d5f1d20d27980fd;hpb=2f99fe6e68e7b8f01e40a505501c3529f0511a3b;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/renderers/render-property-buffer.cpp b/dali/internal/render/renderers/render-property-buffer.cpp index eb17d9e..5976020 100644 --- a/dali/internal/render/renderers/render-property-buffer.cpp +++ b/dali/internal/render/renderers/render-property-buffer.cpp @@ -1,3 +1,19 @@ +/* + * 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. + * 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. + * + */ #include #include // Dali::Internal::PropertyBuffer @@ -5,7 +21,6 @@ namespace { -using namespace Dali; using Dali::Property; using Dali::Internal::PropertyImplementationType; @@ -19,6 +34,7 @@ Dali::GLenum GetPropertyImplementationGlType( Property::Type propertyType ) case Property::STRING: case Property::ARRAY: case Property::MAP: + case Property::EXTENTS: case Property::RECTANGLE: case Property::ROTATION: { @@ -50,9 +66,9 @@ Dali::GLenum GetPropertyImplementationGlType( Property::Type propertyType ) return type; } -size_t GetPropertyImplementationGlSize( Property::Type propertyType ) +Dali::GLint GetPropertyImplementationGlSize( Property::Type propertyType ) { - size_t size = 1u; + Dali::GLint size = 1u; switch( propertyType ) { @@ -60,6 +76,7 @@ size_t GetPropertyImplementationGlSize( Property::Type propertyType ) case Property::STRING: case Property::ARRAY: case Property::MAP: + case Property::EXTENTS: case Property::RECTANGLE: case Property::ROTATION: { @@ -118,14 +135,14 @@ void PropertyBuffer::SetFormat( PropertyBuffer::Format* format ) mDataChanged = true; } -void PropertyBuffer::SetData( Dali::Vector* data, size_t size ) +void PropertyBuffer::SetData( Dali::Vector* data, uint32_t size ) { mData = data; mSize = size; mDataChanged = true; } -bool PropertyBuffer::Update( Context& context, bool isIndexBuffer ) +bool PropertyBuffer::Update( Context& context ) { if( !mData || !mFormat || !mSize ) { @@ -143,31 +160,7 @@ bool PropertyBuffer::Update( Context& context, bool isIndexBuffer ) if ( mGpuBuffer ) { DALI_ASSERT_DEBUG( mSize && "No data in the property buffer!" ); - - const void *data = &((*mData)[0]); - std::size_t dataSize = GetDataSize(); - - // Index buffer needs to be unsigned short which is not supported by the property system - Vector ushortData; - if( isIndexBuffer ) - { - ushortData.Resize(mSize); - const unsigned int* unsignedData = static_cast(data); - for( unsigned int i = 0; i < mSize; ++i ) - { - ushortData[i] = unsignedData[i]; - } - data = &(ushortData[0]); - dataSize = ushortData.Size() * sizeof( unsigned short ); - } - - GpuBuffer::Target target = GpuBuffer::ARRAY_BUFFER; - if(isIndexBuffer) - { - target = GpuBuffer::ELEMENT_ARRAY_BUFFER; - } - mGpuBuffer->UpdateDataBuffer( dataSize, data, GpuBuffer::STATIC_DRAW, target ); - + mGpuBuffer->UpdateDataBuffer( context, GetDataSize(), &((*mData)[0]), GpuBuffer::STATIC_DRAW, GpuBuffer::ARRAY_BUFFER ); } mDataChanged = false; @@ -176,22 +169,21 @@ bool PropertyBuffer::Update( Context& context, bool isIndexBuffer ) return true; } -void PropertyBuffer::BindBuffer(GpuBuffer::Target target) +void PropertyBuffer::BindBuffer( Context& context, GpuBuffer::Target target ) { if(mGpuBuffer) { - mGpuBuffer->Bind(target); + mGpuBuffer->Bind(context, target); } } -unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vector& vAttributeLocation, unsigned int locationBase ) +uint32_t PropertyBuffer::EnableVertexAttributes( Context& context, Vector& vAttributeLocation, uint32_t locationBase ) { - - unsigned int attributeCount = mFormat->components.size(); + const uint32_t attributeCount = static_cast( mFormat->components.size() ); GLsizei elementSize = mFormat->size; - for( unsigned int i = 0; i < attributeCount; ++i ) + for( uint32_t i = 0; i < attributeCount; ++i ) { GLint attributeLocation = vAttributeLocation[i+locationBase]; if( attributeLocation != -1 ) @@ -199,7 +191,7 @@ unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vectorcomponents[i].size; - size_t attributeOffset = mFormat->components[i].offset; + uint32_t attributeOffset = mFormat->components[i].offset; const Property::Type attributeType = mFormat->components[i].type; context.VertexAttribPointer( attributeLocation, @@ -207,12 +199,11 @@ unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vector( attributeOffset ) ); } } return attributeCount; - } } //Render