I am trying to use a push constant to pass a transformation matrix to a vertex shader. The validation layer is giving me the error that:
"validation layer: Push constant range covering variable starting at offset 0 not accessible from stage VK_SHADER_STAGE_VERTEX_BIT"
Oddly enough it seems to be working, the transformation matrix is doing what is expected in the shader and I tested with a fragment shader using colors and got the same error (for VK_SHADER_STAGE_FRAGMENT_BIT). The error is thrown on a call to vkCreateGraphicsPipelines().
Here is the relevant c++ code:
VkPushConstantRange pushConstantRange = VkPushConstantRange();
pushConstantRange.size = sizeof(glm::mat4);
pushConstantRange.offset = 0;
pushConstantRange.stageFlags = VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
VkPipelineLayoutCreateInfo pipelineLayoutInfo = {};
pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pipelineLayoutInfo.setLayoutCount = 2;
pipelineLayoutInfo.pSetLayouts = descriptorSetLayouts;
pipelineLayoutInfo.pushConstantRangeCount = 1;
pipelineLayoutInfo.pPushConstantRanges = &pushConstantRange;
The push constant layout in the shader is:
layout(push_constant) uniform modelBlock {
mat4 model;
} modelPushConstant;
It seems to me that the vertex shader definitely does have access to this variable as it is used successfully. What is going on and how would I fix it?