shader-slang / slang

Making it easier to work with shaders
http://shader-slang.com
Other
2.95k stars 210 forks source link

Compiling shaders with debug info on spirv_1_0 profile produces validation error #5640

Open Beyley opened 4 days ago

Beyley commented 4 days ago
VUID-VkShaderModuleCreateInfo-pCode-08742(ERROR / SPEC): msgNum: -60244330 - Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08742 ] | MessageID = 0xfc68be96 | vkCreateShaderModule():  SPIR-V Extension SPV_KHR_non_semantic_info was declared, but one of the following requirements is required (1.3.0 (0x00403000) or VK_KHR_shader_non_semantic_info). The Vulkan spec states: If pCode is a pointer to SPIR-V code, and pCode declares any of the SPIR-V extensions listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-08742)
    Objects: 0
VUID-VkShaderModuleCreateInfo-pCode-08742(ERROR / SPEC): msgNum: -60244330 - Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08742 ] | MessageID = 0xfc68be96 | vkCreateShaderModule():  SPIR-V Extension SPV_KHR_non_semantic_info was declared, but one of the following requirements is required (1.3.0 (0x00403000) or VK_KHR_shader_non_semantic_info). The Vulkan spec states: If pCode is a pointer to SPIR-V code, and pCode declares any of the SPIR-V extensions listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-08742)
    Objects: 0

Other than that, the shader does work perfectly, even though spirv_1_0 through slang's direct SPIRV output is not officially supported at the moment.

Passing -g0 fixes the problem. Perhaps there should be a dedicated warning/note that KHR_shader_non_semantic_info is required vulkan-side when compiling with debug info? I'm attempting to use Slang with SDL_gpu, which always uses Vulkan 1.0 and does not define that extension.

cheneym2 commented 3 days ago

Thank you for the suggestion. It's possible to add another warning along the same lines as the general warning about spirv_1_0 that would help point users to specify "-g0" in case their implementation does not support the "SPV_KHR_non_semantic_info".

For reference, the general warning about spirv_1_0 I'm referring to is this one:

(0): warning 50011: Slang's SPIR-V backend only supports SPIR-V version 1.3 and later. Use -emit-spirv-via-glsl option to produce SPIR-V 1.0 through 1.2.

csyonghe commented 3 days ago

It seems like we should emit a warning when -g and spirv < 1.3 is specified, and then remove the -g option.