Fixed descriptor types for compute pipelines (use storage instead of sampled for compute image reads and write) (Refs #157, Refs#210)

This commit is contained in:
saschawillems 2016-08-06 23:08:31 +02:00
parent ed71ae00c3
commit 0119d2fc51

View file

@ -188,7 +188,7 @@ public:
VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM,
&textureColorMap, &textureColorMap,
false, false,
VK_IMAGE_USAGE_SAMPLED_BIT); VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT);
} }
void buildCommandBuffers() void buildCommandBuffers()
@ -365,11 +365,11 @@ public:
{ {
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2), vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2),
// Graphics pipeline uses image samplers for display // 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 // Compute pipeline uses a sampled image for reading
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1), vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1),
// Compute pipelines uses a storage image to write result // Compute pipelines uses a storage image for image reads and writes
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1), vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2),
}; };
VkDescriptorPoolCreateInfo descriptorPoolInfo = VkDescriptorPoolCreateInfo descriptorPoolInfo =
@ -579,7 +579,7 @@ public:
std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings = { std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings = {
// Binding 0 : Sampled image (read) // Binding 0 : Sampled image (read)
vkTools::initializers::descriptorSetLayoutBinding( vkTools::initializers::descriptorSetLayoutBinding(
VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
VK_SHADER_STAGE_COMPUTE_BIT, VK_SHADER_STAGE_COMPUTE_BIT,
0), 0),
// Binding 1 : Sampled image (write) // Binding 1 : Sampled image (write)
@ -629,7 +629,7 @@ public:
// Binding 0 : Sampled image (read) // Binding 0 : Sampled image (read)
vkTools::initializers::writeDescriptorSet( vkTools::initializers::writeDescriptorSet(
computeDescriptorSet, computeDescriptorSet,
VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
0, 0,
&computeTexDescriptors[0]), &computeTexDescriptors[0]),
// Binding 1 : Sampled image (write) // Binding 1 : Sampled image (write)