-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vkCmdPushConstants() in MatrixStack::record() can sometimes cause Vulkan validation-error VUID-01795 #1223
Comments
I now added a stripped down version of the The original vsg-View-PushConst-bug.cpp code has some additional code for experimentation + it also contains a |
I imagine the most correct & least invasive way to fix this, would be to have some kind of meta-data/trait attached to the PushConstantRanges pushConstantRanges; stored in the vsg::PipelineLayout. And finally this meta-data/trait could be fetched during MatrixStack::record() and be used to decide if PS: Maybe the code that is currently in PSS: @robertosfield |
I'm not in position to look into this, but hopefully will be able to reproduce it and ponder on how best to resolve it in the next few weeks. |
Describe the bug
TLDR:
Minimal repro code https://github.com/drywolf/vsg-View-vkCmdPushConstants-bug
(see vsg-View-PushConst-bug-minimal.cpp)
Some context:
sampler2D
and are writing to the bound vsg::Image attachmentsThe Bug:
Recently we have found that under some circumstances in our app, we are getting VUID-vkCmdPushConstants-offset-01795 Vulkan validation-errors.
It took some debugging into the VulkanSceneGraph code itself to figure out what was causing it.
We are rendering Fullscreen-Passes using pretty much the exact same VSG mechanisms & C++ classes that are otherwise used for the 3D scene rendering.
Because of that, when VSG encounters our Fullscreen-Passes, it also calls the following code:
void RecordTraversal::apply(const Command& command)
(source)vsg::StateStack::record()
(source)MatrixStack::record()
(source)vkCmdPushConstants(commandBuffer, pipeline, stageFlags, offset, sizeof(newmatrix), newmatrix.data());
As long as our Fullscreen-Shaders did not use any Push-Constants, the check for
if (pipeline == 0 || stageFlags == 0)
prevented thevkCmdPushConstants()
call for the projection & model-view matrices from happening.But recently we added a Fullscreen-Pass that was using Push-Constants to pass a single
vsg::vec4
to the fullscreen-shader.In this case we started seeing the
VUID-vkCmdPushConstants-offset-01795
validation error.PS: the
vsg::Commands
overload ofvoid RecordTraversal::apply()
is calling into exactly the same function-callstack as shown above.(it can lead to the exact same problem)
To Reproduce
Steps to reproduce the behavior:
BugScenario
code invsg-View-PushConst-bug.cpp
vsg-View-PushConst-bug.exe
executableVUID-01795
in consoleExpected behavior
vkCmdPushConstants()
inMatrixStack::record()
should only be called when actively requested/configuredmat4
push-constants that are used specifically only for the VSG pbr/phong/flat shaders, should only be set when one of these shader-sets is currently activeThe text was updated successfully, but these errors were encountered: