Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Vulkan insisting this image must be FLOAT components when sampling?

Tags:

vulkan

My shaders index into a sampler and image, but when I sample from an image (I only get the error if I sample in the shader) I get an error:

Descriptor in binding #0 index 0 requires FLOAT component type, but bound descriptor format is VK_FORMAT_R8G8B8A8_UINT. The Vulkan spec states: Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid if they are statically used by the VkPipeline bound to the pipeline bind point used by this command

It's true, I'm guilty of binding an R8G8B8A8_UINT image to index [0], and I try sample it, but why is it insisting it should be FLOAT component type?

I sample the image in my shader like this:

layout(set = 0, binding = 0) uniform texture2D textures[20];
layout(set = 0, binding = 1) uniform sampler samplers[4];

texture(sampler2D(textures[0], samplers[0]), vec2(inPosAndCoords.zw) ); 

And that error fires. Why is it insisting that the components for the image be FLOAT?

like image 726
Zebrafish Avatar asked Mar 05 '26 20:03

Zebrafish


1 Answers

Why is it insisting that the components for the image be FLOAT?

Because that's what your shader asked for. The basic type for an image format is baked into the image's GLSL type.

texture2D is a 2D texture with a floating-point format. utexture2D is a 2D texture with an unsigned integer format.

like image 181
Nicol Bolas Avatar answered Mar 08 '26 21:03

Nicol Bolas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!