@@ -637,7 +637,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
637637 if (opcode != spv::Op::OpImageGather &&
638638 opcode != spv::Op::OpImageDrefGather &&
639639 opcode != spv::Op::OpImageSparseGather &&
640- opcode != spv::Op::OpImageSparseDrefGather) {
640+ opcode != spv::Op::OpImageSparseDrefGather &&
641+ opcode != spv::Op::OpImageGatherQCOM) {
641642 return _.diag (SPV_ERROR_INVALID_DATA , inst)
642643 << _.VkErrorID (10213 )
643644 << " Image Operand Offset can only be used with "
@@ -652,7 +653,8 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
652653 if (opcode != spv::Op::OpImageGather &&
653654 opcode != spv::Op::OpImageDrefGather &&
654655 opcode != spv::Op::OpImageSparseGather &&
655- opcode != spv::Op::OpImageSparseDrefGather) {
656+ opcode != spv::Op::OpImageSparseDrefGather &&
657+ opcode != spv::Op::OpImageGatherQCOM) {
656658 return _.diag (SPV_ERROR_INVALID_DATA , inst)
657659 << " Image Operand ConstOffsets can only be used with "
658660 " OpImageGather and OpImageDrefGather" ;
@@ -1199,6 +1201,7 @@ bool IsAllowedSampledImageOperand(spv::Op opcode, ValidationState_t& _) {
11991201 case spv::Op::OpImageBlockMatchWindowSSDQCOM:
12001202 case spv::Op::OpImageBlockMatchGatherSADQCOM:
12011203 case spv::Op::OpImageBlockMatchGatherSSDQCOM:
1204+ case spv::Op::OpImageGatherQCOM:
12021205 case spv::Op::OpImageSampleFootprintNV:
12031206 return true ;
12041207 case spv::Op::OpStore:
@@ -1225,6 +1228,7 @@ spv_result_t ValidateImageCoordinate(ValidationState_t& _,
12251228 opcode == spv::Op::OpImageSampleProjDrefImplicitLod ||
12261229 opcode == spv::Op::OpImageSampleProjDrefExplicitLod ||
12271230 opcode == spv::Op::OpImageGather ||
1231+ opcode == spv::Op::OpImageGatherQCOM ||
12281232 opcode == spv::Op::OpImageDrefGather ||
12291233 opcode == spv::Op::OpImageQueryLod ||
12301234 opcode == spv::Op::OpImageSparseSampleImplicitLod ||
@@ -1853,8 +1857,10 @@ spv_result_t ValidateImageGather(ValidationState_t& _,
18531857 ValidateImageCoordinate (_, inst, info, /* word_index = */ 3 ))
18541858 return result;
18551859
1860+ unsigned n_additional_operands = 0 ;
18561861 if (opcode == spv::Op::OpImageGather ||
1857- opcode == spv::Op::OpImageSparseGather) {
1862+ opcode == spv::Op::OpImageSparseGather ||
1863+ opcode == spv::Op::OpImageGatherQCOM) {
18581864 const uint32_t component = inst->GetOperandAs <uint32_t >(4 );
18591865 const uint32_t component_index_type = _.GetTypeId (component);
18601866 if (!_.IsIntScalarType (component_index_type, 32 )) {
@@ -1869,14 +1875,24 @@ spv_result_t ValidateImageGather(ValidationState_t& _,
18691875 " environment" ;
18701876 }
18711877 }
1878+ if (opcode == spv::Op::OpImageGatherQCOM) {
1879+ const uint32_t mode = inst->GetOperandAs <uint32_t >(5 );
1880+ const uint32_t mode_index_type = _.GetTypeId (mode);
1881+ if (!_.IsIntScalarType (mode_index_type) ||
1882+ _.GetBitWidth (mode_index_type) != 32 ) {
1883+ return _.diag (SPV_ERROR_INVALID_DATA , inst)
1884+ << " Expected Mode to be 32-bit int scalar" ;
1885+ }
1886+ n_additional_operands += 1 ;
1887+ }
18721888 } else {
18731889 assert (opcode == spv::Op::OpImageDrefGather ||
18741890 opcode == spv::Op::OpImageSparseDrefGather);
18751891 if (spv_result_t result = ValidateImageDref (_, inst, info)) return result;
18761892 }
18771893
18781894 if (spv_result_t result =
1879- ValidateImageOperands (_, inst, info, /* word_index = */ 7 ))
1895+ ValidateImageOperands (_, inst, info, /* word_index = */ ( 7 + n_additional_operands) ))
18801896 return result;
18811897
18821898 return SPV_SUCCESS ;
@@ -2689,6 +2705,7 @@ spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) {
26892705 case spv::Op::OpImageDrefGather:
26902706 case spv::Op::OpImageSparseGather:
26912707 case spv::Op::OpImageSparseDrefGather:
2708+ case spv::Op::OpImageGatherQCOM:
26922709 return ValidateImageGather (_, inst);
26932710
26942711 case spv::Op::OpImageRead:
@@ -2794,6 +2811,7 @@ bool IsImageInstruction(const spv::Op opcode) {
27942811 case spv::Op::OpImageBlockMatchWindowSSDQCOM:
27952812 case spv::Op::OpImageBlockMatchGatherSADQCOM:
27962813 case spv::Op::OpImageBlockMatchGatherSSDQCOM:
2814+ case spv::Op::OpImageGatherQCOM:
27972815 return true ;
27982816 default :
27992817 break ;
0 commit comments