From 4fae86b7418b845088a7d6957c26d5c7187e4912 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 5 Dec 2023 08:03:07 -0800 Subject: [PATCH] [Impeller] Document what some of this shader metadata is. (flutter/engine#48647) ext_res_0 ?!! its just `binding` but for Metal. --- .../src/flutter/impeller/core/shader_types.h | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/engine/src/flutter/impeller/core/shader_types.h b/engine/src/flutter/impeller/core/shader_types.h index 9e549a0c2f..3fd9c71829 100644 --- a/engine/src/flutter/impeller/core/shader_types.h +++ b/engine/src/flutter/impeller/core/shader_types.h @@ -79,10 +79,20 @@ struct ShaderMetadata { std::vector members; }; +/// @brief Metadata required to bind a buffer. +/// +/// OpenGL binding requires the usage of the separate shader metadata struct. struct ShaderUniformSlot { + /// @brief The name of the uniform slot. const char* name; + + /// @brief `ext_res_0` is the Metal binding value. size_t ext_res_0; + + /// @brief The Vulkan descriptor set index. size_t set; + + /// @brief The Vulkan binding value. size_t binding; }; @@ -127,11 +137,25 @@ struct ShaderStageBufferLayout { } }; +/// @brief Metadata required to bind a texture and sampler. +/// +/// OpenGL binding requires the usage of the separate shader metadata struct. struct SampledImageSlot { + /// @brief The name of the texture slot. const char* name; + + /// @brief This value is `ext_res_0`, the Metal binding value for the texture. size_t texture_index; + + /// @brief This value is `ext_res_1`, the Metal binding value for the sampler. + /// + /// Since only combined texture and samplers are used, this index is unused. size_t sampler_index; + + /// @brief The Vulkan binding value for a combined texture and sampler. size_t binding; + + /// @brief The Vulkan descriptor set index. size_t set; constexpr bool HasTexture() const { return texture_index < 32u; }