Closed 16uhrpasing closed 3 years ago
Could you provide a full .cpp that recreates the problem, copying pasting parts of possible example that recreates a problems is really prone to deviation between the copy and pasting and what you have, so the results I might get could well diverge and won't have any means of checking what you fully mean,
Also could you provide a stack trace, and details of your OS & hardware.
Sorry for the delay, here are the tests I did with the corresponding stack traces and a README. shader error VSG.zip
Thanks for the zip file. I have begun investigating. The insource version works for me - I'm using Linux, latest VSG/vsgXchange master, NVidia drivers and VulkanSDK 1.2.162.0, but it creates a Vulkan debug error, running the vsgdraw I see that it's also generating a Vulkan debug error, but I this Vulkan debug error looks unrelated to the issue you're seeing so I'll follow that one up separately. The error is:
UNASSIGNED-CoreValidation-DrawState-InvalidRenderArea(ERROR / SPEC): msgNum: 1149387633 - Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidRe nderArea ] Object 0: handle = 0x90000000009, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x44824371 | Cannot execute a render pass with renderArea not within the bound of the framebuffer. RenderArea: x 0, y 0, width 1280, height 1024. Framebuffer: width 1280, height 1016. Objects: 1
I think this particular error is due to the Window manager resizing the window after it's been created, and the state setup not handling this resize. I will just need to strep through the vsgdraw code to see what needs to be update - this example used to run without Vulkan debug errors so it might be recent VukanSDK are just a bit tighter.
The vsgonv/source.cpp version crashes for me, initially via an exception due to the shader files not being found, then once I fixed the path issue a seg fault in the NVidia driver. My track trace looks like:
/lib/x86_64-linux-gnu/libnvidia-glvkspirv.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glvkspirv.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.27
/lib/x86_64-linux-gnu/libnvidia-glcore.so.465.27
vsg::GraphicsPipeline::Implementation::Implementation(vsg::Context&,
vsg::Device, vsg::RenderPass, vsg::PipelineLayout*, std::v
ector<vsg::ref_ptr
()
()
I don't have Windows so can't review the stack trace included in your .zip file, could you post an ascii version of the stack trace?
When I run with -d to get the Vulkan debug layer I see:
UNASSIGNED-CoreValidation-Shader-InconsistentSpirv(ERROR / SPEC): msgNum: 7060244 - Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x556615807328, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Invalid opcode: 4352 Objects: 1 [0] 0x556615807328, type: 3, name: NULL
When I run vsgconv on the vert.vert and vert.frag myself and then use the resulting .spv the same application runs correctly, and I just see the same Vulkan debug error as seen with vsgdraw and above.
Could you try VulkanSDK 1.162.0 to see if that works for you? I will update to the latest VulkanSDK and see if that has an influence on my results.
I have updated to VulkanSDK 1.176.1 and recompiled the VSG/vsgXchange and recreated the vert.spv and frag.spv files and they work fine. The .spv you supplied that had been created by your vsgoonv do still fail with the Vulkan debug error:
UNASSIGNED-CoreValidation-Shader-InconsistentSpirv(ERROR / SPEC): msgNum: 7060244 - Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x557d09711068, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Invalid opcode: 4352 Objects: 1 [0] 0x557d09711068, type: 3, name: NULL
What is the commit # you are using for the VSG and vsgXchange?
Could you try updating VSG and vsgXchange to their respective masters?
Apart from the vsgdraw Vulkan debug error I don't have anything else I can investigate as all the suggested tests are working OK.
I updated everything to the respective masters and rebuilt it completely - the vsgconv SPIRV's and the inline shader work perfectly now. I'm assuming that I previously didn't link the glslang library correctly in the VSG Cmake configuration.
Edit: Thank you very much for this awesome piece of software and the awesome support.
I did make some improvements of the glslang integration to handle custom SPRIV and glsl versioning, perhaps you were using a VSG rev that predated this.
On Sun, 18 Jul 2021 at 17:47, 16uhrpasing @.***> wrote:
Closed #293 https://github.com/vsg-dev/VulkanSceneGraph/issues/293.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vsg-dev/VulkanSceneGraph/issues/293#event-5035213697, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKEGUHXB6Z6G7UB54BEXALTYMASHANCNFSM475BNR7Q .
Hi,
I'm using the VulkanSDK 1.2.176.1 and the latest version of VSG. If I compile my shaders with the glslangValidator and use them via vsg::ShaderStage::read, everything works fine. If I use the exact same source code as a const char * via ShaderStage::create, the program breaks.
Reproduce in vsgdraw from vsgExamples:
const auto vertShader = R"(
version 450
layout(push_constant) uniform PushConstants { mat4 projection; mat4 modelview; } pc;
layout(location = 0) in vec3 inPosition; layout(location = 0) out vec3 fragColor; layout(location = 1) in vec3 inColor; layout(location = 1) out vec2 fragTexCoord; layout(location = 2) in vec2 inTexCoord;
void main() { gl_Position = (pc.projection pc.modelview) vec4(inPosition, 1.0); fragColor = inColor; fragTexCoord = inTexCoord; } )";
const auto fragShader = R"(
version 450
layout(binding = 0) uniform sampler2D texSampler;
layout(location = 0) out vec4 outColor; layout(location = 1) in vec2 fragTexCoord; layout(location = 0) in vec3 fragColor;
void main() { outColor = texture(texSampler, fragTexCoord)*vec4(fragColor,1.0f); } )";
replace the "//load shaders" ShaderStage::read call with auto vertexShader = vsg::ShaderStage::create(VK_SHADER_STAGE_VERTEX_BIT, "main", vertShader); auto fragmentShader = vsg::ShaderStage::create(VK_SHADER_STAGE_FRAGMENT_BIT, "main", fragShader);
-> vsg::Exception at memory location XYZ
compile the exact same source with glslangValidator to the .spv format and use in ShaderStage::create -> works