0
\$\begingroup\$

I have set up a shader like so. Instead of having all projection view model in a single object, I want to have them as separate bindings.

#version 450
layout (location = 0) in vec3 aPosition;
layout (location = 1) in vec4 aColor;
layout(binding = 0) uniform mat4 projection;
layout(binding = 1) uniform mat4 view;
layout(binding = 2) uniform mat4 model;
layout(location = 0) out vec4 fragColor;
void main() {
 gl_Position = vec4(aPosition, 1.0);
 fragColor = aColor;
}

However when compiling the shader I get the following errors:

main:4: error: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan
main:4: error: 'binding' : requires block, or sampler/image, or atomic-counter type
main:5: error: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan
main:5: error: 'binding' : requires block, or sampler/image, or atomic-counter type
main:6: error: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan
main:6: error: 'binding' : requires block, or sampler/image, or atomic-counter type

How can I create individual bindings + set up individual Descriptor Layout/Buffer/Pools/Sets?

\$\endgroup\$
1
  • \$\begingroup\$ "error: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan" suggests that the answer is "you can't", don't you think? \$\endgroup\$ yesterday

0

You must log in to answer this question.

Browse other questions tagged .