Skip to content

False positive in VUID 04924 - missing updated spec wording #5819

@HansKristian-Work

Description

@HansKristian-Work

This SPIR-V trips the validator:

; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 11
; Bound: 36
; Schema: 0
               OpCapability Tessellation
          %1 = OpExtInstImport "GLSL.std.450"
               OpMemoryModel Logical GLSL450
               OpEntryPoint TessellationEvaluation %main "main" %_ %FOO
               OpExecutionMode %main Triangles
               OpExecutionMode %main SpacingEqual
               OpExecutionMode %main VertexOrderCcw
               OpSource GLSL 460
               OpSourceExtension "GL_EXT_nonuniform_qualifier"
               OpName %main "main"
               OpName %gl_PerVertex "gl_PerVertex"
               OpMemberName %gl_PerVertex 0 "gl_Position"
               OpMemberName %gl_PerVertex 1 "gl_PointSize"
               OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
               OpMemberName %gl_PerVertex 3 "gl_CullDistance"
               OpName %_ ""
               OpName %FOO "FOO"
               OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
               OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
               OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
               OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
               OpDecorate %gl_PerVertex Block
               OpDecorate %FOO Component 2
               OpDecorate %FOO Location 1
       %void = OpTypeVoid
          %3 = OpTypeFunction %void
      %float = OpTypeFloat 32
    %v4float = OpTypeVector %float 4
       %uint = OpTypeInt 32 0
     %uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
          %_ = OpVariable %_ptr_Output_gl_PerVertex Output
        %int = OpTypeInt 32 1
      %int_0 = OpConstant %int 0
    %v2float = OpTypeVector %float 2
     %uint_2 = OpConstant %uint 2
%_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2
    %uint_32 = OpConstant %uint 32
%_arr__arr_v2float_uint_2_uint_32 = OpTypeArray %_arr_v2float_uint_2 %uint_32
%_ptr_Input__arr__arr_v2float_uint_2_uint_32 = OpTypePointer Input %_arr__arr_v2float_uint_2_uint_32
        %FOO = OpVariable %_ptr_Input__arr__arr_v2float_uint_2_uint_32 Input
%_ptr_Input_v2float = OpTypePointer Input %v2float
      %int_1 = OpConstant %int 1
     %uint_0 = OpConstant %uint 0
%_ptr_Output_float = OpTypePointer Output %float
       %main = OpFunction %void None %3
          %5 = OpLabel
         %24 = OpAccessChain %_ptr_Input_v2float %FOO %int_0 %int_0
         %25 = OpLoad %v2float %24
         %27 = OpAccessChain %_ptr_Input_v2float %FOO %int_1 %int_1
         %28 = OpLoad %v2float %27
         %29 = OpFAdd %v2float %25 %28
         %32 = OpAccessChain %_ptr_Output_float %_ %int_0 %uint_0
         %33 = OpCompositeExtract %float %29 0
               OpStore %32 %33
         %34 = OpAccessChain %_ptr_Output_float %_ %int_0 %uint_1
         %35 = OpCompositeExtract %float %29 1
               OpStore %34 %35
               OpReturn
               OpFunctionEnd

Reference GLSL:

#version 460
#extension GL_EXT_nonuniform_qualifier : require
layout(triangles) in;


layout(location = 1, component = 2) in vec2 FOO[][2];


void main()
{
	gl_Position.xy = FOO[0][0] + FOO[1][1];
}
error: line 43: [VUID-StandaloneSpirv-Component-04924] Component decoration specified for type '18[%_arr_v2float_uint_2]' that is not a scalar or vector
  %FOO = OpVariable %_ptr_Input__arr__arr_v2float_uint_2_uint_32 Input

However, the spec language says:

VUID-StandaloneSpirv-Component-04924
The Component decorations must not be used with any type that is not a scalar or vector, or an array of such a type

Vulkan spec update 1.3.245 has this line:

+  * Fix standalone SPIR-V VU 04924 to clarify components can also be arrays
+    of scalars or vectors (internal issue 3411).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions