From: Eunki, Hong Date: Thu, 8 Dec 2022 09:29:52 +0000 (+0900) Subject: [Tizen] Fix attribute cache bug X-Git-Tag: accepted/tizen/7.0/unified/20221212.015717^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=d7caa6ccb37233818a207b7f909d8d5affd6c7ce [Tizen] Fix attribute cache bug Change-Id: I3b309833a0865ad175fabf376913c3ad91e64d4a Signed-off-by: Eunki, Hong --- diff --git a/dali/internal/graphics/gles-impl/gles-context.cpp b/dali/internal/graphics/gles-impl/gles-context.cpp index 1d981bc..9c5fa87 100644 --- a/dali/internal/graphics/gles-impl/gles-context.cpp +++ b/dali/internal/graphics/gles-impl/gles-context.cpp @@ -64,6 +64,12 @@ struct Context::Impl mProgramVAOCurrentState = iter->second; gl.BindVertexArray(iter->second); } + + // We should re-check enable attribute usage because geometry might be changed. + for(const auto& attr : vertexInputState.attributes) + { + gl.EnableVertexAttribArray(attr.location); + } return; } diff --git a/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp b/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp index 05776c2..b7ad58c 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp +++ b/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp @@ -219,6 +219,8 @@ void Reflection::BuildVertexAttributeReflection() mVertexInputAttributes.clear(); mVertexInputAttributes.resize(nAttribs); + + int maxLocationValue = nAttribs - 1; name = new GLchar[maxLength]; for(int i = 0; i < nAttribs; i++) @@ -228,13 +230,20 @@ void Reflection::BuildVertexAttributeReflection() if(location >= 0) { + if(maxLocationValue < location) + { + maxLocationValue = location; + mVertexInputAttributes.resize(maxLocationValue + 1u); + } + AttributeInfo attributeInfo; attributeInfo.location = location; attributeInfo.name = name; attributeInfo.format = GetVertexAttributeTypeFormat(type); - mVertexInputAttributes.insert(mVertexInputAttributes.begin() + location, attributeInfo); + mVertexInputAttributes[location] = std::move(attributeInfo); } } + delete[] name; }