Skip to content

SPIR-V id 13 is the wrong kind of value: expected 'pointer' but got 'invalid' #11475

@Please-just-dont

Description

@Please-just-dont

Linux Mint 22.2

  • GPU and driver version (Intel(R) UHD Graphics 770 (RPL-S / Raptor Lake)--- Mesa 25.3.3):
  • Vulkan SDK version: 1.4.335.0
  • GPU-assisted validation

Describe the Issue
With GPU-assisted validation turned on.

Error:

SPIR-V offset 1888: SPIR-V parsing FAILED:
    SPIR-V id 13 is the wrong kind of value: expected 'pointer' but got 'invalid'
    1888 bytes into the SPIR-V binary

spirv_to_nir failed (VK_ERROR_UNKNOWN)

In the following vertex shader:


layout (location = 0) out float3 outEyespacePosition;
layout (location = 1) out float2 outTexcoords;

// VERTEX SHADER
[shader("vertex")]
void main(out float4 sv_position: SV_Position, uint sv_vertex_id: SV_VertexID, uint vk_instance_id: SV_VulkanInstanceID)
{
    outEyespacePosition = float3(0, 0, 0);
    outTexcoords = float2(0, 0);
}

// FRAGMENT SHADER
layout (location = 0) in float3 inEyeSpacePosition;
layout (location = 0) out float4 outColour;

[shader("fragment")]
void main()
{
    outColour = float4(0, 0, 0, 0);
} 

Compiled with slangc with:

slangc -o out_filename -lang slang -matrix-layout-row-major -O0 -preserve-params shader.slang

Error is logged from Validation Layers when calling vkCreateGraphicsPipelines. Error goes goes away if:

  1. BOTH uint sv_vertex_id: SV_VertexID AND uint vk_instance_id: SV_VulkanInstanceID .... arguments are removed.
  2. -preserve-params command when invoking slangc is remove

Here is the SPIRV disassembly:


; SPIR-V
; Version: 1.3
; Generator: Khronos Slang Compiler; 0
; Bound: 26
; Schema: 0
               OpCapability DrawParameters
               OpCapability Shader
               OpMemoryModel Logical GLSL450
               OpEntryPoint Vertex %main "main" %entryPointParam_main_outEyespacePosition %entryPointParam_main_outTexcoords
               OpSource Slang 1
               OpName %entryPointParam_main_outEyespacePosition "entryPointParam_main.outEyespacePosition"
               OpName %entryPointParam_main_outTexcoords "entryPointParam_main.outTexcoords"
               OpName %main "main"
               OpDecorate %entryPointParam_main_outEyespacePosition Location 0
               OpDecorate %entryPointParam_main_outTexcoords Location 1
               OpDecorate %gl_Position BuiltIn Position
               OpDecorate %gl_VertexIndex BuiltIn VertexIndex
               OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
               OpDecorate %15 BuiltIn BaseVertex
      %float = OpTypeFloat 32
    %v3float = OpTypeVector %float 3
%_ptr_Output_v3float = OpTypePointer Output %v3float
    %v2float = OpTypeVector %float 2
%_ptr_Output_v2float = OpTypePointer Output %v2float
    %v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
        %int = OpTypeInt 32 1
%_ptr_Input_int = OpTypePointer Input %int
       %void = OpTypeVoid
         %18 = OpTypeFunction %void
    %float_0 = OpConstant %float 0
         %20 = OpConstantComposite %v3float %float_0 %float_0 %float_0
         %23 = OpConstantComposite %v2float %float_0 %float_0
%entryPointParam_main_outEyespacePosition = OpVariable %_ptr_Output_v3float Output
%entryPointParam_main_outTexcoords = OpVariable %_ptr_Output_v2float Output
%gl_Position = OpVariable %_ptr_Output_v4float Output
%gl_VertexIndex = OpVariable %_ptr_Input_int Input
%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
         %15 = OpVariable %_ptr_Input_int Input
       %main = OpFunction %void None %18
         %19 = OpLabel
               OpStore %entryPointParam_main_outEyespacePosition %20
               OpStore %entryPointParam_main_outTexcoords %23
               OpReturn
               OpFunctionEnd

Metadata

Metadata

Labels

GPU-AVGPU Assisted Validation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions