Skip to content

Commit e0b3870

Browse files
committed
SPV_QCOM_image_processing3
1 parent 6337eb6 commit e0b3870

4 files changed

Lines changed: 29 additions & 5 deletions

File tree

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ vars = {
1414

1515
're2_revision': '972a15cedd008d846f1a39b2e88ce48d7f166cbd',
1616

17-
'spirv_headers_revision': '1a22b167081842915a1c78a0b5b5a353a23284aa',
17+
'spirv_headers_revision': 'ecb0849421c798f37d8ff82b28bb728a55eee2b5',
1818

1919
'mimalloc_revision': 'b1963961a5cdb1996c9ad2e356014089b7a94ea3',
2020
}

include/spirv-tools/libspirv.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ typedef enum spv_operand_type_t {
337337
SPV_OPERAND_TYPE_OPTIONAL_CAPABILITY,
338338
SPV_OPERAND_TYPE_VARIABLE_CAPABILITY,
339339

340+
// Enum type from SPV_QCOM_image_processing3
341+
SPV_OPERAND_TYPE_GATHER_MODES,
342+
340343
// This is a sentinel value, and does not represent an operand type.
341344
// It should come last.
342345
SPV_OPERAND_TYPE_NUM_OPERAND_TYPES,

source/operand.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ const char* spvOperandTypeStr(spv_operand_type_t type) {
207207
return "cooperative vector matrix layout";
208208
case SPV_OPERAND_TYPE_COMPONENT_TYPE:
209209
return "component type";
210+
case SPV_OPERAND_TYPE_GATHER_MODES:
211+
return "gather modes";
210212

211213
case SPV_OPERAND_TYPE_KERNEL_PROPERTY_FLAGS:
212214
return "kernel property flags";
@@ -339,6 +341,7 @@ bool spvOperandIsConcrete(spv_operand_type_t type) {
339341
case SPV_OPERAND_TYPE_TENSOR_CLAMP_MODE:
340342
case SPV_OPERAND_TYPE_COOPERATIVE_VECTOR_MATRIX_LAYOUT:
341343
case SPV_OPERAND_TYPE_COMPONENT_TYPE:
344+
case SPV_OPERAND_TYPE_GATHER_MODES:
342345
case SPV_OPERAND_TYPE_KERNEL_PROPERTY_FLAGS:
343346
case SPV_OPERAND_TYPE_SHDEBUG100_BUILD_IDENTIFIER_FLAGS:
344347
case SPV_OPERAND_TYPE_SHDEBUG100_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING:

source/val/validate_image.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)