Hello Guest

Setting target SPIR-V version

  • 7 Replies
  • 5761 Views
Setting target SPIR-V version
« on: June 05, 2021, 23:49:44 »
Hello.

I am working on a ray tracer using the KHR extensions. When I attempt to compile my closest hit shader I see this error message: "error: 'GL_EXT_ray_tracing' : not supported for current targeted SPIR-V version". I interpret this to mean that I need to set the target SPIR-V version using shaderc_compile_options_set_target_spirv(long options, int version). Is this correct? If so, what do I use as the argument for 'options'?

Re: Setting target SPIR-V version
« Reply #1 on: June 06, 2021, 13:41:16 »
Is the underlying Vulkan SDK at least version 1.2.131.2? From my preliminary searches, it sounds like this is the minimum version required for the KHR extensions.

Re: Setting target SPIR-V version
« Reply #2 on: June 06, 2021, 15:50:47 »
Here are some things I have found:

1. It looks like 'shaderc_compile_options_initialize' can be used to obtain the 'options' argument for 'shaderc_compile_options_set_target_spirv'. However, when I set the target SPIR-V version to 'shaderc_spirv_version_1_4' compilation continues to fail ("error: 'GL_EXT_ray_tracing' : not supported for current targeted SPIR-V version"). When I attempt to check the version by printing the results of 'shaderc_get_spv_version' I get: "66816.4". (Edit: 'shaderc_spirv_version_1_5' is defined as 0x10500, which is 66816. I was printing 'version' + "." + 'revision'. I guess setting to a lower version is ignored?)

2. Using command line glslc from version 1.2.162.1 of the Vulkan SDK successfully compiles the shader: "C:/VulkanSDK/1.2.162.1/Bin32/glslc.exe closestHitBasic.rchit -o closestHitBasic.spv --target-spv=spv1.4". (Edit: I have found that LWJGL 3.3.0 has version 1.2.172 of the Vulkan SDK, so I am confused why ShaderC is telling me GL_EXT_ray_tracing is not supported)

Any assistance is greatly appreciated.
« Last Edit: June 07, 2021, 14:31:31 by cpope9141 »

Re: Setting target SPIR-V version
« Reply #3 on: June 08, 2021, 15:51:24 »
I have found this issue on github: https://github.com/google/shaderc/issues/1088

So far my only work around is to use the command line to compile ray tracing shaders, then create a shader module from that byte code.

Is there an ordering of these function calls (set env/version) that I may have incorrect? I have tried setting env/version before and after 'shaderc_compiler_initialize'.

Constructive suggestions appreciated.
« Last Edit: June 08, 2021, 16:55:07 by cpope9141 »


Re: Setting target SPIR-V version
« Reply #5 on: June 09, 2021, 17:23:58 »
Works for me: https://github.com/LWJGL/lwjgl3-demos/blob/main/src/org/lwjgl/demo/vulkan/VKUtil.java#L62-L63

I was looking at these examples earlier this morning. The only difference I can see between what I have tried and the demo is your use of 'shaderc_compile_options_set_include_callbacks'.

I'll see if I can get your demos running and continue to debug. Thanks for the response.

Re: Setting target SPIR-V version
« Reply #6 on: June 09, 2021, 22:04:01 »
long result = shaderc_compile_into_spv(compiler, source, type, absolutePath, "main", NULL);

I never replaced NULL with 'options'... On the up side, I have a better overview of ShaderC now.
« Last Edit: June 10, 2021, 12:41:35 by cpope9141 »

Re: Setting target SPIR-V version
« Reply #7 on: June 26, 2021, 23:44:26 »
-
« Last Edit: June 26, 2021, 23:48:44 by cpope9141 »