@@ -6672,6 +6672,67 @@ TEST_F(ValidateBuiltIns, PrimitiveIdInFragmentWithMeshCapability) {
66726672 EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3));
66736673}
66746674
6675+ // https://github.com/KhronosGroup/SPIRV-Tools/issues/6237
6676+ TEST_F(ValidateBuiltIns, MeshBuiltinUnsignedInt) {
6677+ const std::string spirv = R"(
6678+ OpCapability FragmentShadingRateKHR
6679+ OpCapability MeshShadingEXT
6680+ OpExtension "SPV_EXT_mesh_shader"
6681+ OpExtension "SPV_KHR_fragment_shading_rate"
6682+ OpMemoryModel Logical GLSL450
6683+ OpEntryPoint MeshEXT %main "main" %gl_MeshPrimitivesEXT
6684+ OpExecutionModeId %main LocalSizeId %uint_1 %uint_1 %uint_1
6685+ OpExecutionMode %main OutputVertices 81
6686+ OpExecutionMode %main OutputPrimitivesEXT 32
6687+ OpExecutionMode %main OutputTrianglesEXT
6688+ OpDecorate %gl_MeshPerPrimitiveEXT Block
6689+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 0 BuiltIn PrimitiveId
6690+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 0 PerPrimitiveEXT
6691+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 1 BuiltIn Layer
6692+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 1 PerPrimitiveEXT
6693+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 2 BuiltIn ViewportIndex
6694+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 2 PerPrimitiveEXT
6695+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 3 BuiltIn CullPrimitiveEXT
6696+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 3 PerPrimitiveEXT
6697+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 4 BuiltIn PrimitiveShadingRateKHR
6698+ OpMemberDecorate %gl_MeshPerPrimitiveEXT 4 PerPrimitiveEXT
6699+ %void = OpTypeVoid
6700+ %4 = OpTypeFunction %void
6701+ %uint = OpTypeInt 32 0
6702+ %int = OpTypeInt 32 1
6703+ %bool = OpTypeBool
6704+ %int_0 = OpConstant %int 0
6705+ %uint_0 = OpConstant %uint 0
6706+ %uint_1 = OpConstant %uint 1
6707+ %uint_2 = OpConstant %uint 2
6708+ %uint_3 = OpConstant %uint 3
6709+ %uint_4 = OpConstant %uint 4
6710+ %uint_81 = OpConstant %uint 81
6711+ %uint_32 = OpConstant %uint 32
6712+ %gl_MeshPerPrimitiveEXT = OpTypeStruct %uint %uint %uint %bool %uint
6713+ %_arr_gl_MeshPerPrimitiveEXT_uint_32 = OpTypeArray %gl_MeshPerPrimitiveEXT %uint_32
6714+ %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 = OpTypePointer Output %_arr_gl_MeshPerPrimitiveEXT_uint_32
6715+ %gl_MeshPrimitivesEXT = OpVariable %_ptr_Output__arr_gl_MeshPerPrimitiveEXT_uint_32 Output
6716+ %_ptr_Output_uint = OpTypePointer Output %uint
6717+ %main = OpFunction %void None %4
6718+ %6 = OpLabel
6719+ OpSetMeshOutputsEXT %uint_81 %uint_32
6720+ %20 = OpAccessChain %_ptr_Output_uint %gl_MeshPrimitivesEXT %int_0 %uint_0
6721+ OpStore %20 %uint_1
6722+ %22 = OpAccessChain %_ptr_Output_uint %gl_MeshPrimitivesEXT %int_0 %uint_1
6723+ OpStore %22 %uint_2
6724+ %24 = OpAccessChain %_ptr_Output_uint %gl_MeshPrimitivesEXT %int_0 %uint_2
6725+ OpStore %24 %uint_3
6726+ %26 = OpAccessChain %_ptr_Output_uint %gl_MeshPrimitivesEXT %int_0 %uint_4
6727+ OpStore %26 %uint_4
6728+ OpReturn
6729+ OpFunctionEnd
6730+ )";
6731+
6732+ CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_3);
6733+ EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_3));
6734+ }
6735+
66756736} // namespace
66766737} // namespace val
66776738} // namespace spvtools
0 commit comments