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

When compiling shaders with target environment errors occur. #1410

Open
DevAlgos opened this issue Apr 26, 2024 · 0 comments
Open

When compiling shaders with target environment errors occur. #1410

DevAlgos opened this issue Apr 26, 2024 · 0 comments

Comments

@DevAlgos
Copy link

I have been using shaderc in project to compile shaders in runtime rather than through the command line then provide the spirv file. when compiling the glsl file it works when using normal compiler options where nothing is set, however recently I needed some extra functionality with ray tracing which requires a higher version of spirv. I set the target enviorment here

shaderc::Compiler Compiler;
shaderc::CompileOptions Options;

Options.SetIncluder(std::make_unique<Includer>());
Options.SetTargetEnvironment(shaderc_target_env_vulkan, shaderc_env_version_vulkan_1_3);

Where i set the target enviroment, however now I am recieving errors regarding curtain extensions being needed such as SPV_KHR_storage_buffer_storage_c

The exact error:

2 VUID-VkShaderModuleCreateInfo-pCode-08737 Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08737 ] | MessageID = 0xa5625282 | vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
2nd operand of TypePointer: operand StorageBuffer(12) requires one of these extensions: SPV_KHR_storage_buffer_storage_class SPV_KHR_variable_pointers
%_ptr_StorageBuffer_PerInstanceBuffer = OpTypePointer StorageBuffer %PerInstanceBuffer
. The Vulkan spec states: If pCode is a pointer to SPIR-V code, pCode must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-08737)

Even when supplying these extensions despite them being core in vulkan 1.1 and I am using vulkan 1.3 It still gives these errors when compiling the shaders. When removing Options.SetTargetEnviroments(), it complains about needing a higher spirv version for raytracing

Exact Error:

assembly compilation failed ../Core/Source/Core/Render/Shaders/Miss.rmiss:2: error: 'GL_EXT_ray_tracing' : not supported for current targeted SPIR-V version

I have also tried to use Options.SetTargetSpirv() however this results in the same error.

My version:

C:\VulkanSDK\1.3.280.0\Bin>glslc --version
shaderc v2023.8 v2024.0
spirv-tools v2024.1 v2022.4-451-g04896c46
glslang 11.1.0-937-gd73712b8

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

No branches or pull requests

1 participant