Jump to content
  • Advertisement

Recommended Posts

Posted (edited)

I have 10 samplers as an uniform array in a fragment shader. When rendering, I only used 3 of them. So the descriptor set layout and descriptor set only have 3 combined image samplers. That's why I am getting this validation layer warning:

validation layer: Shader expects at least 10 descriptors for binding 0.1 but only 3 provided

Is there any way to get rid of this other than changing 

layout(set = 0, binding = 1) uniform sampler2D lightTextureArray[10];


layout(set = 0, binding = 1) uniform sampler2D lightTextureArray[3];

If I fill up remaining descriptors with default image info (use null handle for view and sampler), the validation layer will complain about invalid combined image sampler/view or something like that. The only way I can think of now is to repeat the existing descriptors. Is there any other way to get around this? What is the standard way to solve this problem?

Edited by acerskyline

Share this post

Link to post
Share on other sites

The descriptor layout must have the same number of bindings that you specify in the shader, and have valid descriptors bound to them, according to the spec. Apparently, most implementations are fine with invalid descriptors if they are not dynamically used, but the validation layers will warn you regardless.
To get rid of the warning, you can use the approach you mentioned and fill the remaining ones with whatever compatible samplers you have. Personally, I create dummy objects for these cases (e.g. a simple generic sampler, a 1x1 image, etc.) that I reuse everywhere necessary.
Another way is to use VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT, if supported, which allows bindings to not contain valid descriptors if they are not dynamically used.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!