summaryrefslogtreecommitdiff
path: root/dali
diff options
context:
space:
mode:
authorAdam Bialogonski <adam.b@samsung.com>2024-06-25 12:29:06 +0100
committerAdam Bialogonski <adam.b@samsung.com>2024-06-28 10:36:16 +0100
commit81d18d371252d46e77ac38f52b1429a7efbf55fe (patch)
tree94fb458148e4696352f92001a3467d9def7cf7c1 /dali
parent4b30ceaa32ed1d30cd4834fdfda387479aa339c7 (diff)
downloaddali-adaptor-81d18d371252d46e77ac38f52b1429a7efbf55fe.tar.gz
dali-adaptor-81d18d371252d46e77ac38f52b1429a7efbf55fe.tar.bz2
dali-adaptor-81d18d371252d46e77ac38f52b1429a7efbf55fe.zip
GLES reflection supports array element stride for UBO members.
Change-Id: Ic703df5c5909d7b56de3d5870fb18b3b2adda3f4
Diffstat (limited to 'dali')
-rw-r--r--dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp b/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp
index 27e2b3b10..5766dc744 100644
--- a/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp
+++ b/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp
@@ -399,6 +399,32 @@ void Reflection::BuildUniformBlockReflection()
blockIndex++;
}
+ // Calculate array element stride for uniform blocks (not needed for standalone block)
+ if(mUniformBlocks.size() > 1)
+ {
+ for(auto i = 1u; i < mUniformBlocks.size(); ++i)
+ {
+ auto& block = mUniformBlocks[i];
+
+ // check last member
+ auto& lastMember = block.members.back();
+ if(lastMember.elementCount > 0)
+ {
+ lastMember.elementStride = (block.size - lastMember.offset) / lastMember.elementCount;
+ }
+
+ // update other arrays in this block
+ for(auto memberIndex = 0u; memberIndex < block.members.size() - 1; ++memberIndex)
+ {
+ auto& member = block.members[memberIndex];
+ if(member.elementCount > 0)
+ {
+ member.elementStride = (block.members[memberIndex+1].offset - member.offset) / member.elementCount;
+ }
+ }
+ }
+ }
+
// count uniform size
auto& defaultUniformBlock = mUniformBlocks[0]; // Standalone block
defaultUniformBlock.size = 0;
@@ -507,12 +533,13 @@ bool Reflection::GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInf
for(auto i = 0u; i < out.members.size(); ++i)
{
const auto& memberUniform = block.members[i];
- out.members[i].name = memberUniform.name;
- out.members[i].binding = block.binding;
- out.members[i].uniformClass = Graphics::UniformClass::UNIFORM;
- out.members[i].offset = memberUniform.offset;
- out.members[i].location = memberUniform.location;
- out.members[i].elementCount = memberUniform.elementCount;
+ out.members[i].name = memberUniform.name;
+ out.members[i].binding = block.binding;
+ out.members[i].uniformClass = Graphics::UniformClass::UNIFORM;
+ out.members[i].offset = memberUniform.offset;
+ out.members[i].location = memberUniform.location;
+ out.members[i].elementCount = memberUniform.elementCount;
+ out.members[i].elementStride = memberUniform.elementStride;
}
return true;