]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/program_backend.cpp
Support compute shaders and compute operations
[libs/gl.git] / source / backends / vulkan / program_backend.cpp
index 9402226b1e68917bf00273bd10ae31ff519d3f4c..993a3e38ef965d11b838fb9b41653cb2fe5b3b29 100644 (file)
@@ -138,7 +138,10 @@ void VulkanProgram::finalize_uniforms()
                                bindings.emplace_back();
                                VkDescriptorSetLayoutBinding &binding = bindings.back();
                                binding.binding = u.binding&0xFFFFF;
-                               binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
+                               if(is_sampled_image(u.type))
+                                       binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
+                               else
+                                       binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
                                binding.descriptorCount = 1;
                                binding.stageFlags = stage_flags;
                                binding.pImmutableSamplers = 0;
@@ -172,6 +175,11 @@ void VulkanProgram::finalize_uniforms()
 #endif
 }
 
+bool VulkanProgram::is_compute() const
+{
+       return stage_flags&VK_SHADER_STAGE_COMPUTE_BIT;
+}
+
 void VulkanProgram::set_debug_name(const string &name)
 {
 #ifdef DEBUG