Changed descriptor type for compute shader image read, updated shaders
This commit is contained in:
parent
86d286b46e
commit
2b7e887bfc
10 changed files with 17 additions and 10 deletions
|
|
@ -194,7 +194,7 @@ public:
|
||||||
VK_FORMAT_R8G8B8A8_UNORM,
|
VK_FORMAT_R8G8B8A8_UNORM,
|
||||||
&textureColorMap,
|
&textureColorMap,
|
||||||
false,
|
false,
|
||||||
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT);
|
VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildCommandBuffers()
|
void buildCommandBuffers()
|
||||||
|
|
@ -424,8 +424,10 @@ 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, 4),
|
||||||
// Compute pipeline uses storage images image loads and stores
|
// Compute pipeline uses a sampled image for reading
|
||||||
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2),
|
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),
|
||||||
};
|
};
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo descriptorPoolInfo =
|
VkDescriptorPoolCreateInfo descriptorPoolInfo =
|
||||||
|
|
@ -644,7 +646,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_STORAGE_IMAGE,
|
VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||||
VK_SHADER_STAGE_COMPUTE_BIT,
|
VK_SHADER_STAGE_COMPUTE_BIT,
|
||||||
0),
|
0),
|
||||||
// Binding 1 : Sampled image (write)
|
// Binding 1 : Sampled image (write)
|
||||||
|
|
@ -705,7 +707,7 @@ public:
|
||||||
// Binding 0 : Sampled image (read)
|
// Binding 0 : Sampled image (read)
|
||||||
vkTools::initializers::writeDescriptorSet(
|
vkTools::initializers::writeDescriptorSet(
|
||||||
computeDescriptorSet,
|
computeDescriptorSet,
|
||||||
VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
|
VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||||
0,
|
0,
|
||||||
&computeTexDescriptors[0]),
|
&computeTexDescriptors[0]),
|
||||||
// Binding 1 : Sampled image (write)
|
// Binding 1 : Sampled image (write)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#extension GL_ARB_shading_language_420pack : enable
|
#extension GL_ARB_shading_language_420pack : enable
|
||||||
|
|
||||||
layout (local_size_x = 16, local_size_y = 16) in;
|
layout (local_size_x = 16, local_size_y = 16) in;
|
||||||
layout (binding = 0, rgba8) uniform image2D inputImage;
|
layout (binding = 0, rgba8) uniform readonly image2D inputImage;
|
||||||
layout (binding = 1, rgba8) uniform image2D resultImage;
|
layout (binding = 1, rgba8) uniform image2D resultImage;
|
||||||
|
|
||||||
float conv(in float[9] kernel, in float[9] data, in float denom, in float offset)
|
float conv(in float[9] kernel, in float[9] data, in float denom, in float offset)
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -3,8 +3,8 @@
|
||||||
#extension GL_ARB_separate_shader_objects : enable
|
#extension GL_ARB_separate_shader_objects : enable
|
||||||
#extension GL_ARB_shading_language_420pack : enable
|
#extension GL_ARB_shading_language_420pack : enable
|
||||||
|
|
||||||
layout (local_size_x =16, local_size_y = 16) in;
|
layout (local_size_x = 16, local_size_y = 16) in;
|
||||||
layout (binding = 0, rgba8) uniform image2D inputImage;
|
layout (binding = 0, rgba8) uniform readonly image2D inputImage;
|
||||||
layout (binding = 1, rgba8) uniform image2D resultImage;
|
layout (binding = 1, rgba8) uniform image2D resultImage;
|
||||||
|
|
||||||
float conv(in float[9] kernel, in float[9] data, in float denom, in float offset)
|
float conv(in float[9] kernel, in float[9] data, in float denom, in float offset)
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -3,8 +3,8 @@
|
||||||
#extension GL_ARB_separate_shader_objects : enable
|
#extension GL_ARB_separate_shader_objects : enable
|
||||||
#extension GL_ARB_shading_language_420pack : enable
|
#extension GL_ARB_shading_language_420pack : enable
|
||||||
|
|
||||||
layout (local_size_x =16, local_size_y = 16) in;
|
layout (local_size_x = 16, local_size_y = 16) in;
|
||||||
layout (binding = 0, rgba8) uniform image2D inputImage;
|
layout (binding = 0, rgba8) uniform readonly image2D inputImage;
|
||||||
layout (binding = 1, rgba8) uniform image2D resultImage;
|
layout (binding = 1, rgba8) uniform image2D resultImage;
|
||||||
|
|
||||||
float conv(in float[9] kernel, in float[9] data, in float denom, in float offset)
|
float conv(in float[9] kernel, in float[9] data, in float denom, in float offset)
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -14,6 +14,11 @@ layout (binding = 0) uniform UBO
|
||||||
|
|
||||||
layout (location = 0) out vec2 outUV;
|
layout (location = 0) out vec2 outUV;
|
||||||
|
|
||||||
|
out gl_PerVertex
|
||||||
|
{
|
||||||
|
vec4 gl_Position;
|
||||||
|
};
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
outUV = inUV;
|
outUV = inUV;
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue