]> git.tdb.fi Git - libs/gl.git/commitdiff
Add a function to query if a uniform is a storage image
authorMikko Rasa <tdb@tdb.fi>
Tue, 18 Jul 2023 08:12:57 +0000 (11:12 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 18 Jul 2023 08:28:33 +0000 (11:28 +0300)
source/backends/vulkan/program_backend.cpp
source/core/reflectdata.h

index 8ad2205d2675001f2603c8ce7a398018f7cbd80d..8c2a5c3345f5090a8331bc08003c0f57ca48798e 100644 (file)
@@ -138,10 +138,10 @@ void VulkanProgram::finalize_uniforms()
                                bindings.emplace_back();
                                VkDescriptorSetLayoutBinding &binding = bindings.back();
                                binding.binding = u.binding&0xFFFFF;
-                               if(is_sampled_image(u.type))
-                                       binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
-                               else
+                               if(u.is_storage_image())
                                        binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
+                               else
+                                       binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
                                binding.descriptorCount = 1;
                                binding.stageFlags = stage_flags;
                                binding.pImmutableSamplers = 0;
index a48dda6d2a4e6b7aee6ac34c53c98794cc3eec40..83b01671efc81965659ce4abb3a0defaee94cda4 100644 (file)
@@ -40,6 +40,8 @@ struct ReflectData
                DataType type = VOID;
                Tag tag;
                int binding = -1;
+
+               bool is_storage_image() const { return is_image(type) && !is_sampled_image(type); }
        };
 
        struct BlockInfo