From 0119d2fc516a7106c1d75c9f9227e05d2f47d71a Mon Sep 17 00:00:00 2001 From: saschawillems Date: Sat, 6 Aug 2016 23:08:31 +0200 Subject: [PATCH] Fixed descriptor types for compute pipelines (use storage instead of sampled for compute image reads and write) (Refs #157, Refs#210) --- computeshader/computeshader.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/computeshader/computeshader.cpp b/computeshader/computeshader.cpp index 16ed73ce..d9e7c298 100644 --- a/computeshader/computeshader.cpp +++ b/computeshader/computeshader.cpp @@ -188,7 +188,7 @@ public: VK_FORMAT_R8G8B8A8_UNORM, &textureColorMap, false, - VK_IMAGE_USAGE_SAMPLED_BIT); + VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT); } void buildCommandBuffers() @@ -365,11 +365,11 @@ public: { vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2), // Graphics pipeline uses image samplers for display - vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 4), + vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2), // Compute pipeline uses a sampled image for reading vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1), - // Compute pipelines uses a storage image to write result - vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1), + // Compute pipelines uses a storage image for image reads and writes + vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2), }; VkDescriptorPoolCreateInfo descriptorPoolInfo = @@ -579,7 +579,7 @@ public: std::vector setLayoutBindings = { // Binding 0 : Sampled image (read) vkTools::initializers::descriptorSetLayoutBinding( - VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, + VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_SHADER_STAGE_COMPUTE_BIT, 0), // Binding 1 : Sampled image (write) @@ -629,7 +629,7 @@ public: // Binding 0 : Sampled image (read) vkTools::initializers::writeDescriptorSet( computeDescriptorSet, - VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, + VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 0, &computeTexDescriptors[0]), // Binding 1 : Sampled image (write)