KhronosGroup / OpenXR-Tutorials

OpenXR Tutorials
https://www.openxr-tutorial.com/
Apache License 2.0
84 stars 15 forks source link

Should there be both GLSL_COMPILER and GLSLANG_VALIDATOR in the CMake configuration? #93

Closed wsherman64 closed 11 months ago

wsherman64 commented 11 months ago

In past builds, I found that of the two GLSL configuration options (GLSLANG_VALIDATOR and GLSL_COMPILER), I only need to actually set GLSLANG_VALIDATOR to get the build to compile. (Apparently, the program glslangValidator is actually a functional GLSL compiler, not just a validator as I thought was implied by the name, so a separate compiler isn't needed -- but this isn't the fault of any of us.)

But I thought I'd experiment to see whether one setting is preferred over the other. And I found that whenever I set GLSL_COMPILER to point to glslangValidator, I get a build error -- so it would seem that some other shader compile option is engaged when GLSL_COMPILER has a value.

So I don't know if there's a good solution, but for me at least, I was confused by the two options, and at first thought that by not setting GLSL_COMPILER I wouldn't get a build. So my question is, can we just get rid of GLSL_COMPILER? (or maybe only on Linux systems?)

Just wondering -- with the goal of making things simple for future tutoriants (tutorial students).

rvkennedy commented 11 months ago

See #91 - the two tools do produce different results at least on Linux, and in the case of glslangValidator, there are issues with what it produces.

AndrewRichards-Code commented 11 months ago

For Android builds, GLSL_COMPILER / glslc is the only compiler available inside the Android NDK, plus not all versions of the Vulkan SDK contain a glslc binary as in @wsherman64's case.

We need both compilers to have the best compatibility across platforms and SDKs - The issue of bad SPIR-V from glslangValidator on Linux is a separate issue (#91).

Yes, the compiler options are different between glslangValidator and glslc, which is annoying.

The two compiler setup isn't ideal for tutorial students, but there's no real way around it.