From: David Steele Date: Wed, 19 Apr 2023 16:22:19 +0000 (+0100) Subject: Added element_count for sampler uniform arrays. X-Git-Tag: dali_2.2.24~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F291639%2F2;p=platform%2Fcore%2Fuifw%2Fdali-core.git 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 --- 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});