@@ -385,6 +385,7 @@ OpCapability ImageQuery
385385OpCapability ImageGatherExtended
386386OpCapability InputAttachment
387387OpCapability SampledRect
388+ OpCapability Int16
388389)" ;
389390
390391 ss << capabilities_and_extensions;
@@ -394,6 +395,7 @@ OpMemoryModel Physical32 OpenCL
394395%func = OpTypeFunction %void
395396%bool = OpTypeBool
396397%f32 = OpTypeFloat 32
398+ %u16 = OpTypeInt 16 0
397399%u32 = OpTypeInt 32 0
398400%u32vec2 = OpTypeVector %u32 2
399401%f32vec2 = OpTypeVector %f32 2
@@ -408,6 +410,8 @@ OpMemoryModel Physical32 OpenCL
408410%f32_0_25 = OpConstant %f32 0.25
409411%f32_0_75 = OpConstant %f32 0.75
410412
413+ %u16_0 = OpConstant %u16 0
414+
411415%u32_0 = OpConstant %u32 0
412416%u32_1 = OpConstant %u32 1
413417%u32_2 = OpConstant %u32 2
@@ -4618,7 +4622,19 @@ TEST_F(ValidateImage, QuerySizeLodWrongLodType) {
46184622 CompileSuccessfully (GenerateKernelCode (body).c_str ());
46194623 ASSERT_EQ (SPV_ERROR_INVALID_DATA, ValidateInstructions ());
46204624 EXPECT_THAT (getDiagnosticString (),
4621- HasSubstr (" Expected Level of Detail to be int scalar" ));
4625+ HasSubstr (" Expected Level of Detail to be a 32-bit int scalar" ));
4626+ }
4627+
4628+ TEST_F (ValidateImage, QuerySizeLodWrong16Bit) {
4629+ const std::string body = R"(
4630+ %img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001
4631+ %res1 = OpImageQuerySizeLod %u32vec2 %img %u16_0
4632+ )" ;
4633+
4634+ CompileSuccessfully (GenerateKernelCode (body).c_str ());
4635+ ASSERT_EQ (SPV_ERROR_INVALID_DATA, ValidateInstructions ());
4636+ EXPECT_THAT (getDiagnosticString (),
4637+ HasSubstr (" Expected Level of Detail to be a 32-bit int scalar" ));
46224638}
46234639
46244640TEST_F (ValidateImage, QuerySizeSuccess) {
0 commit comments