Vulkan-ValidationLayers
Vulkan-ValidationLayers copied to clipboard
Shader instrumentation failed on MoltenVK
Environment:
- OS: macOS
- GPU and driver version: M2
- SDK or header version if building from repo: 1.3.275
- Options enabled (synchronization, best practices, etc.):
Describe the Issue
Shader instrumentation leads to generation invalid MSL shader
Expected behavior
Shader instrumentation doesn't lead to generation invalid MSL shader
Valid Usage ID N/A
Additional context
Terminal output
[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed (Error code 3):
program_source:116:84: error: cannot assign resource locations to 'spvDescriptorSet7'
vertex main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer7& spvDescriptorSet7 [[buffer(7)]], constant uint* spvBufferSizeConstants [[buffer(28)]], constant constants& pc [[buffer(8)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]])
^
program_source:53:31: note: attribute 'id' set location to 0, but minimum is 1
device inst_OutputBuffer* inst_output_buffer [[id(0)]];
^ ~~~~~
program_source:120:131: error: reinterpret_cast from 'device metal::float4x4' (aka 'device matrix<float, 4, 4>') to 'ulong' (aka 'unsigned long') is not allowed
bool _177 = inst_buff_addr_search_and_test(3642182712u, 148u, uint4(0u, gl_VertexIndex, gl_InstanceIndex, 0u), as_type<ulong>(reinterpret_cast<ulong>(pc.perFrame->proj)), 64u, (*spvDescriptorSet7.inst_output_buffer), spvDescriptorSet7_inst_output_bufferBufferSize, (*spvDescriptorSet7.inst_buff_addr_input_buffer));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:131:131: error: reinterpret_cast from 'device metal::float4x4' (aka 'device matrix<float, 4, 4>') to 'ulong' (aka 'unsigned long') is not allowed
bool _190 = inst_buff_addr_search_and_test(3642182712u, 164u, uint4(0u, gl_VertexIndex, gl_InstanceIndex, 0u), as_type<ulong>(reinterpret_cast<ulong>(pc.perFrame->view)), 64u, (*spvDescriptorSet7.inst_output_buffer), spvDescriptorSet7_inst_output_bufferBufferSize, (*spvDescriptorSet7.inst_buff_addr_input_buffer));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:142:131: error: reinterpret_cast from 'device metal::float4x4' (aka 'device matrix<float, 4, 4>') to 'ulong' (aka 'unsigned long') is not allowed
bool _203 = inst_buff_addr_search_and_test(3642182712u, 180u, uint4(0u, gl_VertexIndex, gl_InstanceIndex, 0u), as_type<ulong>(reinterpret_cast<ulong>(pc.perObject->model)), 64u, (*spvDescriptorSet7.inst_output_buffer), spvDescriptorSet7_inst_output_bufferBufferSize, (*spvDescriptorSet7.inst_buff_addr_input_buffer));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.
[mvk-error] VK_ERROR_INVALID_SHADER_NV: Vertex shader function could not be compiled into pipeline. See previous logged error.
Assertion failed: (false), function Assert, file LVK.cpp, line 210.
Compiler failed to build request
Reproduction
- Checkout
https://github.com/corporateshark/lightweightvk
- Follow instructions in https://github.com/corporateshark/lightweightvk/blob/main/README.md and generate XCode Project
- Change line https://github.com/corporateshark/lightweightvk/blob/7d0560f9594af9bf14876c83205e45de9a8522b3/lvk/vulkan/VulkanUtils.cpp#L593 to
.target_language_version = GLSLANG_TARGET_SPV_1_5,
- Launch Tiny_MeshLarge