KhronosGroup / Vulkan-LoaderAndValidationLayers

**Deprecated repository** for Vulkan loader and validation layers
Apache License 2.0
414 stars 172 forks source link

No warning before a crash if pipeline layout has _no_ descriptor sets, but the shader declares uniform inputs #2624

Open jherico opened 6 years ago

jherico commented 6 years ago

I'm working on a shader where the inputs are declared like so:


layout (location = 0) in vec4 inPos;

layout (binding = 0) uniform Camera {
    mat4 projection;
    mat4 view;
} camera;

layout(push_constant) uniform PushConsts {
    mat4 orientation;
    vec4 color;
} pushConsts;

currently my pipeline layout creation code looks like this:

vk::PushConstantRange pushConstantRange{ vk::ShaderStageFlagBits::eVertex, 0, sizeof(SkyGrids::PushContstants) };
_skyGrids.pipelineLayout = _device.createPipelineLayout({ {}, 0, nullptr, 1, &pushConstantRange });

If I comment out the camera uniform block in the inputs of my shader, my pipeline gets created just fine. However, if I leave it there, when I try to create a pipeline I get an initialization error back, but no validation message beforehand.

Should not the validation layers be able to detect that you're attempting to create a shader that requires a descriptor set, when you've supplied none in the pipeline layout?

chrisforbes commented 6 years ago

Yes, we should be detecting this case.