I have a vertex shader with a push constant block containing one float:
layout(push_constant) uniform pushConstants { float test1; } u_pushConstants;
And a fragment shader with another push-constant block with a different float value:
layout(push_constant) uniform pushConstants { float test2; } u_pushConstants;
test1 and test2 must be different.
The push-constant ranges for the pipeline layout are defined as follows:
std::array<vk::PushConstantRange,2> ranges = { vk::PushConstantRange{ vk::ShaderStageFlagBits::eVertex, 0, sizeof(float) }, vk::PushConstantRange{ vk::ShaderStageFlagBits::eFragment, sizeof(float),
The actual constants are then pushed during rendering as follows:
std::array<float,1> constants = {123.f}; commandBufferDraw.pushConstants( pipelineLayout, vk::ShaderStageFlagBits::eVertex, 0, sizeof(float), constants.data() ); std::array<float,1> constants = {456.f}; commandBufferDraw.pushConstants( pipelineLayout, vk::ShaderStageFlagBits::eFragment, sizeof(float),
However, when checking the values inside the shaders, both values have the value 123. It seems that the offsets are completely ignored. Am I using them incorrectly?