Skip to content

Commit 7fa1f02

Browse files
authored
assembler, disassembler support fo SPV_QCOM_image_processing3 (KhronosGroup#6776)
Addes new operand type SPV_OPERAND_TYPE_GATHER_MODES. This is not actually used since the gather mode operand is provided as an ID.
1 parent 667f063 commit 7fa1f02

5 files changed

Lines changed: 35 additions & 2 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': '575b6512579ebde466ed3dfc04e413439d14d95d',
17+
'spirv_headers_revision': '8d56066eee52f490535afd5731d5ae2fffc85036',
1818

1919
'mimalloc_revision': 'fef6b0dd70f9d7fa0750b0d0b9fbb471203b94cd',
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+
// 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/binary.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,8 @@ spv_result_t Parser::parseOperand(size_t inst_offset,
744744
case SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER:
745745
case SPV_OPERAND_TYPE_LOAD_CACHE_CONTROL:
746746
case SPV_OPERAND_TYPE_STORE_CACHE_CONTROL:
747-
case SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS: {
747+
case SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS:
748+
case SPV_OPERAND_TYPE_GATHER_MODES: {
748749
// A single word that is a plain enum value.
749750

750751
// Map an optional operand type to its corresponding concrete type.

source/operand.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ const char* spvOperandTypeStr(spv_operand_type_t type) {
225225
return "NonSemantic.Shader.DebugInfo.100 debug operation";
226226
case SPV_OPERAND_TYPE_SHDEBUG100_DEBUG_TYPE_QUALIFIER:
227227
return "NonSemantic.Shader.DebugInfo.100 debug type qualifier";
228+
case SPV_OPERAND_TYPE_GATHER_MODES:
229+
return "gather modes";
228230

229231
case SPV_OPERAND_TYPE_NONE:
230232
return "NONE";
@@ -347,6 +349,7 @@ bool spvOperandIsConcrete(spv_operand_type_t type) {
347349
case SPV_OPERAND_TYPE_SHDEBUG100_DEBUG_INFO_FLAGS:
348350
case SPV_OPERAND_TYPE_SHDEBUG100_DEBUG_OPERATION:
349351
case SPV_OPERAND_TYPE_SHDEBUG100_DEBUG_TYPE_QUALIFIER:
352+
case SPV_OPERAND_TYPE_GATHER_MODES:
350353
return true;
351354
default:
352355
break;

test/text_to_binary.extension_test.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,5 +1727,31 @@ TEST_F(TextToBinaryTest, ConstantDataNonUTF) {
17271727
spvContextDestroy(context);
17281728
}
17291729

1730+
// SPV_QCOM_image_processing3
1731+
INSTANTIATE_TEST_SUITE_P(
1732+
SPV_QCOM_image_processing3, ExtensionRoundTripTest,
1733+
Combine(
1734+
Values(SPV_ENV_UNIVERSAL_1_4, SPV_ENV_UNIVERSAL_1_6, SPV_ENV_VULKAN_1_1,
1735+
SPV_ENV_VULKAN_1_4),
1736+
ValuesIn(std::vector<AssemblyCase>{
1737+
{"OpExtension \"SPV_QCOM_image_processing3\"\n",
1738+
MakeInstruction(spv::Op::OpExtension,
1739+
MakeVector("SPV_QCOM_image_processing3"))},
1740+
{"OpCapability ImageGatherLinearQCOM\n",
1741+
MakeInstruction(
1742+
spv::Op::OpCapability,
1743+
{(uint32_t)spv::Capability::ImageGatherLinearQCOM})},
1744+
{"OpCapability ImageGatherExtendedModesQCOM\n",
1745+
MakeInstruction(
1746+
spv::Op::OpCapability,
1747+
{(uint32_t)spv::Capability::ImageGatherExtendedModesQCOM})},
1748+
{"%2 = OpImageGatherQCOM %1 %3 %4 %5 %6\n",
1749+
MakeInstruction(spv::Op::OpImageGatherQCOM, {1, 2, 3, 4, 5, 6})},
1750+
// Prove that we parse image operands afterward
1751+
{"%2 = OpImageGatherQCOM %1 %3 %4 %5 %6 Lod %7\n",
1752+
MakeInstruction(spv::Op::OpImageGatherQCOM,
1753+
{1, 2, 3, 4, 5, 6, 2, 7})},
1754+
})));
1755+
17301756
} // namespace
17311757
} // namespace spvtools

0 commit comments

Comments
 (0)