SPIR-V Macro Compiling

Started by
2 comments, last by Matias Goldberg 9 years ago

There's no Vulkan subforum yet so..

I believe the Spir-v specification has been released, i was wondering if there was any sort of feature that would allow for shaders that use macros (in GLSL) to change the functionality of the shader. In most cases it would pretty much be a "static if" statement that just choose which block of code to run. Is there anything in the specification that complements this? Or would i essentially need to compile all variants of my shader and create an archive file to store and retrieve them appropriately?

Advertisement

Why dont you try to compile your GLSL to SPIRV? Reference compiler

Funnily enough there is also this site (try at your own risk).

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

There's no runtime conditional compilation stuff in SPIR-V. You would create all variants, or use static/uniform/coherent branching to select.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Errr... SPIR-V is not a language, it's an IR/IL that aims to be simple to reduce the chance or driver errors. Such functionality you describe would be implemented by the compiler that produces the SPIR-V; as it is pointless to burden the driver with that.
You can come up with your own language that compiles into SPIR-V if you want.

This topic is closed to new replies.

Advertisement