Skip to content
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

Compile all shaders and count errors #1126

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Vovan675
Copy link
Contributor

Try to compile as many shaders as possible. If any of them are not compiled, just output error and skip it. At the end, print out how many errors occurred.
This makes life easier if you have some testing in one shader and broke it, but want to compile another one. Or, if you don't have glslang compiler that supports ray tracing extensions, it will just skip it and compile all other shaders.
Without this fix, I need to remove ray tracing shaders because my glslang compiler doesn't support it, otherwise I won't be able to compile SSAO shaders.

@joshohagan
Copy link

You can clone my forked repository which compiles shaders using CMake on the master branch (much easier than using a python script): https://github.com/joshohagan/VulkanSamples/tree/master

@SaschaWillems
Copy link
Owner

if you don't have glslang compiler that supports ray tracing extensions

What compiler is that? glslangvalidator has support for ray tracing and I'm not aware of any recent version that doesn't support the RT shader types.

@Vovan675
Copy link
Contributor Author

I just tried to use glslandvalidator from vulkan sdk (1.3.275.0) bin folder

@SaschaWillems
Copy link
Owner

The one from the SDK works fine with ray tracing. If a shader files running this script, it's mostly a problem with the script. If you post the error you get, I'll take a look.

@Vovan675
Copy link
Contributor Author

Vovan675 commented May 30, 2024

When I am running glsl's compileshaders.py I get this. Maybe we need to up target spirv version or something. But handling these errors and don't stop on them I think more desirable than just stopping compiling other shaders)

F:/Repositories/Vulkan/shaders/glsl\rayquery\scene.frag
ERROR: F:/Repositories/Vulkan/shaders/glsl\rayquery\scene.frag:2: 'GL_EXT_ray_tracing' : not supported for current targeted SPIR-V version
ERROR: F:/Repositories/Vulkan/shaders/glsl\rayquery\scene.frag:2: '#extension' : extra tokens -- expected newline
ERROR: F:/Repositories/Vulkan/shaders/glsl\rayquery\scene.frag:2: '' : compilation terminated
ERROR: 3 compilation errors.  No code generated.

@SaschaWillems
Copy link
Owner

That's the script's fault. This is for inline ray tracing, which is using the fragment shader stage, so the rt stage handling doesn't work there. I'll take a look at that.

SaschaWillems added a commit that referenced this pull request Jun 4, 2024
Will no longer fail with certain shaderStages
Refs #1126
@SaschaWillems
Copy link
Owner

I have pushed a fix for both the GLSL and HLSL compilation scripts. Both should now be able to compile all shaders using the compilers from the SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants