From 0a3b16c39206e0fb8afc214706d1b6c6360be180 Mon Sep 17 00:00:00 2001 From: David Steele Date: Wed, 19 Apr 2023 17:22:19 +0100 Subject: [PATCH] Added element_count for sampler uniform arrays. Graphics interface didn't differentiate between non-array uniforms and uniform array elements. Added element_count to show that. (Used mainly in graphics backend implementation). Change-Id: I7f3d9eead85dc029e93337c88bb38de1ce3e2fa5 --- dali/graphics-api/graphics-reflection.h | 6 ++++-- dali/graphics-api/graphics-types.h | 4 +++- dali/internal/render/shaders/program.cpp | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dali/graphics-api/graphics-reflection.h b/dali/graphics-api/graphics-reflection.h index b6e187b..5203c65 100644 --- a/dali/graphics-api/graphics-reflection.h +++ b/dali/graphics-api/graphics-reflection.h @@ -2,7 +2,7 @@ #define DALI_GRAPHICS_REFLECTION_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -166,7 +166,9 @@ public: // Sampler /** - * @brief Gets all the sampler uniforms + * @brief Gets all the sampler uniforms. In the case of arrays of samplers, + * it contains only the name of the sampler array without the [N] size, but, + * the element count is set to N. * * @return A vector of the sampler uniforms */ diff --git a/dali/graphics-api/graphics-types.h b/dali/graphics-api/graphics-types.h index 6d6eb40..45b8e6f 100644 --- a/dali/graphics-api/graphics-types.h +++ b/dali/graphics-api/graphics-types.h @@ -1150,6 +1150,7 @@ struct UniformInfo uint32_t bufferIndex{0u}; uint32_t offset{0u}; uint32_t location{0u}; + uint32_t elementCount{0u}; bool operator==(const UniformInfo& rhs) { @@ -1158,7 +1159,8 @@ struct UniformInfo binding == rhs.binding && bufferIndex == rhs.bufferIndex && offset == rhs.offset && - location == rhs.location; + location == rhs.location && + elementCount == rhs.elementCount; } }; diff --git a/dali/internal/render/shaders/program.cpp b/dali/internal/render/shaders/program.cpp index 4cfbcb4..f6d9f97 100644 --- a/dali/internal/render/shaders/program.cpp +++ b/dali/internal/render/shaders/program.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -143,7 +143,7 @@ void Program::BuildReflection(const Graphics::Reflection& graphicsReflection) } // add samplers - auto samplers = graphicsReflection.GetSamplers(); + auto samplers = graphicsReflection.GetSamplers(); // Only holds first element of arrays without []. for(const auto& sampler : samplers) { mReflection.emplace_back(ReflectionUniformInfo{CalculateHash(sampler.name), false, sampler}); -- 2.7.4