From 10ee92feb00712f444783032f5c9ee798887670d Mon Sep 17 00:00:00 2001 From: Wooyoung Kim Date: Wed, 20 Mar 2024 15:56:00 -0700 Subject: [PATCH] Support for SPV_QCOM_image_processing2 (#3539) --- SPIRV/CMakeLists.txt | 1 + SPIRV/GLSL.ext.QCOM.h | 2 + SPIRV/GlslangToSpv.cpp | 69 +++++++++ SPIRV/doc.cpp | 37 +++++ SPIRV/spirv.hpp | 26 ++-- .../spv.tpipBlockMatchGatherSAD.frag.out | 124 +++++++++++++++++ .../spv.tpipBlockMatchGatherSSD.frag.out | 124 +++++++++++++++++ .../spv.tpipBlockMatchWindowSAD.frag.out | 131 ++++++++++++++++++ .../spv.tpipBlockMatchWindowSSD.frag.out | 131 ++++++++++++++++++ Test/spv.tpipBlockMatchGatherSAD.frag | 38 +++++ Test/spv.tpipBlockMatchGatherSSD.frag | 38 +++++ Test/spv.tpipBlockMatchWindowSAD.frag | 39 ++++++ Test/spv.tpipBlockMatchWindowSSD.frag | 40 ++++++ glslang/Include/intermediate.h | 6 + glslang/MachineIndependent/Initialize.cpp | 16 +++ glslang/MachineIndependent/Versions.cpp | 3 + glslang/MachineIndependent/Versions.h | 1 + gtests/Spv.FromFile.cpp | 4 + 18 files changed, 822 insertions(+), 8 deletions(-) create mode 100644 Test/baseResults/spv.tpipBlockMatchGatherSAD.frag.out create mode 100644 Test/baseResults/spv.tpipBlockMatchGatherSSD.frag.out create mode 100644 Test/baseResults/spv.tpipBlockMatchWindowSAD.frag.out create mode 100644 Test/baseResults/spv.tpipBlockMatchWindowSSD.frag.out create mode 100644 Test/spv.tpipBlockMatchGatherSAD.frag create mode 100644 Test/spv.tpipBlockMatchGatherSSD.frag create mode 100644 Test/spv.tpipBlockMatchWindowSAD.frag create mode 100644 Test/spv.tpipBlockMatchWindowSSD.frag diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt index 1ccd60093..3b6bfb455 100644 --- a/SPIRV/CMakeLists.txt +++ b/SPIRV/CMakeLists.txt @@ -63,6 +63,7 @@ set(HEADERS GLSL.ext.AMD.h GLSL.ext.NV.h GLSL.ext.ARM.h + GLSL.ext.QCOM.h NonSemanticDebugPrintf.h NonSemanticShaderDebugInfo100.h) diff --git a/SPIRV/GLSL.ext.QCOM.h b/SPIRV/GLSL.ext.QCOM.h index f13bb6935..b52990f02 100644 --- a/SPIRV/GLSL.ext.QCOM.h +++ b/SPIRV/GLSL.ext.QCOM.h @@ -37,5 +37,7 @@ static const int GLSLextQCOMRevision = 1; //SPV_QCOM_image_processing const char* const E_SPV_QCOM_image_processing = "SPV_QCOM_image_processing"; +//SPV_QCOM_image_processing2 +const char* const E_SPV_QCOM_image_processing2 = "SPV_QCOM_image_processing2"; #endif // #ifndef GLSLextQCOM_H diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 187ecc0b5..baf3fd762 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -228,6 +228,7 @@ protected: spv::Id getSymbolId(const glslang::TIntermSymbol* node); void addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier & qualifier); void addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor); + void addImageProcessing2QCOMDecoration(spv::Id id, bool isForGather); spv::Id createSpvConstant(const glslang::TIntermTyped&); spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&, int& nextConst, bool specConstant); @@ -3370,6 +3371,20 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.addExtension(spv::E_SPV_QCOM_image_processing); break; + case glslang::EOpImageBlockMatchWindowSSDQCOM: + case glslang::EOpImageBlockMatchWindowSADQCOM: + builder.addCapability(spv::CapabilityTextureBlockMatchQCOM); + builder.addExtension(spv::E_SPV_QCOM_image_processing); + builder.addCapability(spv::CapabilityTextureBlockMatch2QCOM); + builder.addExtension(spv::E_SPV_QCOM_image_processing2); + break; + + case glslang::EOpImageBlockMatchGatherSSDQCOM: + case glslang::EOpImageBlockMatchGatherSADQCOM: + builder.addCapability(spv::CapabilityTextureBlockMatch2QCOM); + builder.addExtension(spv::E_SPV_QCOM_image_processing2); + break; + case glslang::EOpFetchMicroTriangleVertexPositionNV: case glslang::EOpFetchMicroTriangleVertexBarycentricNV: builder.addExtension(spv::E_SPV_NV_displacement_micromap); @@ -9268,6 +9283,30 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: opCode = spv::OpFetchMicroTriangleVertexPositionNV; break; + case glslang::EOpImageBlockMatchWindowSSDQCOM: + typeId = builder.makeVectorType(builder.makeFloatType(32), 4); + opCode = spv::OpImageBlockMatchWindowSSDQCOM; + addImageProcessing2QCOMDecoration(operands[0], false); + addImageProcessing2QCOMDecoration(operands[2], false); + break; + case glslang::EOpImageBlockMatchWindowSADQCOM: + typeId = builder.makeVectorType(builder.makeFloatType(32), 4); + opCode = spv::OpImageBlockMatchWindowSADQCOM; + addImageProcessing2QCOMDecoration(operands[0], false); + addImageProcessing2QCOMDecoration(operands[2], false); + break; + case glslang::EOpImageBlockMatchGatherSSDQCOM: + typeId = builder.makeVectorType(builder.makeFloatType(32), 4); + opCode = spv::OpImageBlockMatchGatherSSDQCOM; + addImageProcessing2QCOMDecoration(operands[0], true); + addImageProcessing2QCOMDecoration(operands[2], true); + break; + case glslang::EOpImageBlockMatchGatherSADQCOM: + typeId = builder.makeVectorType(builder.makeFloatType(32), 4); + opCode = spv::OpImageBlockMatchGatherSADQCOM; + addImageProcessing2QCOMDecoration(operands[0], true); + addImageProcessing2QCOMDecoration(operands[2], true); + break; default: return 0; } @@ -9788,6 +9827,36 @@ void TGlslangToSpvTraverser::addImageProcessingQCOMDecoration(spv::Id id, spv::D } } +void TGlslangToSpvTraverser::addImageProcessing2QCOMDecoration(spv::Id id, bool isForGather) +{ + if (isForGather) { + return addImageProcessingQCOMDecoration(id, spv::DecorationBlockMatchTextureQCOM); + } + + auto addDecor = + [this](spv::Id id, spv::Decoration decor) { + spv::Id tsopc = this->builder.getOpCode(id); + if (tsopc == spv::OpLoad) { + spv::Id tsid = this->builder.getIdOperand(id, 0); + if (this->glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) { + assert(iOSet.count(tsid) > 0); + } + this->builder.addDecoration(tsid, decor); + } + }; + + spv::Id opc = builder.getOpCode(id); + bool isInterfaceObject = (opc != spv::OpSampledImage); + + if (!isInterfaceObject) { + addDecor(builder.getIdOperand(id, 0), spv::DecorationBlockMatchTextureQCOM); + addDecor(builder.getIdOperand(id, 1), spv::DecorationBlockMatchSamplerQCOM); + } else { + addDecor(id, spv::DecorationBlockMatchTextureQCOM); + addDecor(id, spv::DecorationBlockMatchSamplerQCOM); + } +} + // Make a full tree of instructions to build a SPIR-V specialization constant, // or regular constant if possible. // diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index 4ed6acfe4..26e4b1018 100755 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -319,6 +319,7 @@ const char* DecorationString(int decoration) case DecorationWeightTextureQCOM: return "DecorationWeightTextureQCOM"; case DecorationBlockMatchTextureQCOM: return "DecorationBlockMatchTextureQCOM"; + case DecorationBlockMatchSamplerQCOM: return "DecorationBlockMatchSamplerQCOM"; case DecorationExplicitInterpAMD: return "ExplicitInterpAMD"; case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; case DecorationPassthroughNV: return "PassthroughNV"; @@ -1577,6 +1578,10 @@ const char* OpcodeString(int op) case OpImageBoxFilterQCOM: return "OpImageBoxFilterQCOM"; case OpImageBlockMatchSADQCOM: return "OpImageBlockMatchSADQCOM"; case OpImageBlockMatchSSDQCOM: return "OpImageBlockMatchSSDQCOM"; + case OpImageBlockMatchWindowSSDQCOM: return "OpImageBlockMatchWindowSSDQCOM"; + case OpImageBlockMatchWindowSADQCOM: return "OpImageBlockMatchWindowSADQCOM"; + case OpImageBlockMatchGatherSSDQCOM: return "OpImageBlockMatchGatherSSDQCOM"; + case OpImageBlockMatchGatherSADQCOM: return "OpImageBlockMatchGatherSADQCOM"; default: return "Bad"; @@ -3433,6 +3438,38 @@ void Parameterize() InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'block size'"); InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageBlockMatchSSDQCOM].setResultAndType(true, true); + + InstructionDesc[OpImageBlockMatchWindowSSDQCOM].operands.push(OperandId, "'target texture'"); + InstructionDesc[OpImageBlockMatchWindowSSDQCOM].operands.push(OperandId, "'target coordinates'"); + InstructionDesc[OpImageBlockMatchWindowSSDQCOM].operands.push(OperandId, "'reference texture'"); + InstructionDesc[OpImageBlockMatchWindowSSDQCOM].operands.push(OperandId, "'reference coordinates'"); + InstructionDesc[OpImageBlockMatchWindowSSDQCOM].operands.push(OperandId, "'block size'"); + InstructionDesc[OpImageBlockMatchWindowSSDQCOM].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageBlockMatchWindowSSDQCOM].setResultAndType(true, true); + + InstructionDesc[OpImageBlockMatchWindowSADQCOM].operands.push(OperandId, "'target texture'"); + InstructionDesc[OpImageBlockMatchWindowSADQCOM].operands.push(OperandId, "'target coordinates'"); + InstructionDesc[OpImageBlockMatchWindowSADQCOM].operands.push(OperandId, "'reference texture'"); + InstructionDesc[OpImageBlockMatchWindowSADQCOM].operands.push(OperandId, "'reference coordinates'"); + InstructionDesc[OpImageBlockMatchWindowSADQCOM].operands.push(OperandId, "'block size'"); + InstructionDesc[OpImageBlockMatchWindowSADQCOM].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageBlockMatchWindowSADQCOM].setResultAndType(true, true); + + InstructionDesc[OpImageBlockMatchGatherSSDQCOM].operands.push(OperandId, "'target texture'"); + InstructionDesc[OpImageBlockMatchGatherSSDQCOM].operands.push(OperandId, "'target coordinates'"); + InstructionDesc[OpImageBlockMatchGatherSSDQCOM].operands.push(OperandId, "'reference texture'"); + InstructionDesc[OpImageBlockMatchGatherSSDQCOM].operands.push(OperandId, "'reference coordinates'"); + InstructionDesc[OpImageBlockMatchGatherSSDQCOM].operands.push(OperandId, "'block size'"); + InstructionDesc[OpImageBlockMatchGatherSSDQCOM].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageBlockMatchGatherSSDQCOM].setResultAndType(true, true); + + InstructionDesc[OpImageBlockMatchGatherSADQCOM].operands.push(OperandId, "'target texture'"); + InstructionDesc[OpImageBlockMatchGatherSADQCOM].operands.push(OperandId, "'target coordinates'"); + InstructionDesc[OpImageBlockMatchGatherSADQCOM].operands.push(OperandId, "'reference texture'"); + InstructionDesc[OpImageBlockMatchGatherSADQCOM].operands.push(OperandId, "'reference coordinates'"); + InstructionDesc[OpImageBlockMatchGatherSADQCOM].operands.push(OperandId, "'block size'"); + InstructionDesc[OpImageBlockMatchGatherSADQCOM].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageBlockMatchGatherSADQCOM].setResultAndType(true, true); }); } diff --git a/SPIRV/spirv.hpp b/SPIRV/spirv.hpp index f163f3afc..6eceabe67 100644 --- a/SPIRV/spirv.hpp +++ b/SPIRV/spirv.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 The Khronos Group Inc. +// Copyright (c) 2014-2024 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and/or associated documentation files (the "Materials"), @@ -174,7 +174,7 @@ enum ExecutionMode { ExecutionModeStencilRefUnchangedBackAMD = 5082, ExecutionModeStencilRefGreaterBackAMD = 5083, ExecutionModeStencilRefLessBackAMD = 5084, - ExecutionModeQuadDerivativesKHR = 5088, + ExecutionModeQuadDerivativesKHR = 5088, ExecutionModeRequireFullQuadsKHR = 5089, ExecutionModeOutputLinesEXT = 5269, ExecutionModeOutputLinesNV = 5269, @@ -200,7 +200,7 @@ enum ExecutionMode { ExecutionModeNoGlobalOffsetINTEL = 5895, ExecutionModeNumSIMDWorkitemsINTEL = 5896, ExecutionModeSchedulerTargetFmaxMhzINTEL = 5903, - ExecutionModeMaximallyReconvergesKHR = 6023, + ExecutionModeMaximallyReconvergesKHR = 6023, ExecutionModeStreamingInterfaceINTEL = 6154, ExecutionModeNamedBarrierCountINTEL = 6417, ExecutionModeMax = 0x7fffffff, @@ -518,6 +518,7 @@ enum Decoration { DecorationNoUnsignedWrap = 4470, DecorationWeightTextureQCOM = 4487, DecorationBlockMatchTextureQCOM = 4488, + DecorationBlockMatchSamplerQCOM = 4499, DecorationExplicitInterpAMD = 4999, DecorationOverrideCoverageNV = 5248, DecorationPassthroughNV = 5250, @@ -725,8 +726,6 @@ enum BuiltIn { BuiltInHitTriangleVertexPositionsKHR = 5335, BuiltInHitMicroTriangleVertexPositionsNV = 5337, BuiltInHitMicroTriangleVertexBarycentricsNV = 5344, - BuiltInHitKindFrontFacingMicroTriangleNV = 5405, - BuiltInHitKindBackFacingMicroTriangleNV = 5406, BuiltInIncomingRayFlagsKHR = 5351, BuiltInIncomingRayFlagsNV = 5351, BuiltInRayGeometryIndexKHR = 5352, @@ -734,6 +733,8 @@ enum BuiltIn { BuiltInSMCountNV = 5375, BuiltInWarpIDNV = 5376, BuiltInSMIDNV = 5377, + BuiltInHitKindFrontFacingMicroTriangleNV = 5405, + BuiltInHitKindBackFacingMicroTriangleNV = 5406, BuiltInCullMaskKHR = 6021, BuiltInMax = 0x7fffffff, }; @@ -1035,6 +1036,7 @@ enum Capability { CapabilityTextureSampleWeightedQCOM = 4484, CapabilityTextureBoxFilterQCOM = 4485, CapabilityTextureBlockMatchQCOM = 4486, + CapabilityTextureBlockMatch2QCOM = 4498, CapabilityFloat16ImageAMD = 5008, CapabilityImageGatherBiasLodAMD = 5009, CapabilityFragmentMaskAMD = 5010, @@ -1103,12 +1105,12 @@ enum Capability { CapabilityDemoteToHelperInvocation = 5379, CapabilityDemoteToHelperInvocationEXT = 5379, CapabilityDisplacementMicromapNV = 5380, - CapabilityRayTracingDisplacementMicromapNV = 5409, CapabilityRayTracingOpacityMicromapEXT = 5381, CapabilityShaderInvocationReorderNV = 5383, CapabilityBindlessTextureNV = 5390, CapabilityRayQueryPositionFetchKHR = 5391, CapabilityAtomicFloat16VectorNV = 5404, + CapabilityRayTracingDisplacementMicromapNV = 5409, CapabilitySubgroupShuffleINTEL = 5568, CapabilitySubgroupBufferBlockIOINTEL = 5569, CapabilitySubgroupImageBlockIOINTEL = 5570, @@ -1698,6 +1700,10 @@ enum Op { OpImageBoxFilterQCOM = 4481, OpImageBlockMatchSSDQCOM = 4482, OpImageBlockMatchSADQCOM = 4483, + OpImageBlockMatchWindowSSDQCOM = 4500, + OpImageBlockMatchWindowSADQCOM = 4501, + OpImageBlockMatchGatherSSDQCOM = 4502, + OpImageBlockMatchGatherSADQCOM = 4503, OpGroupIAddNonUniformAMD = 5000, OpGroupFAddNonUniformAMD = 5001, OpGroupFMinNonUniformAMD = 5002, @@ -2381,8 +2387,6 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpGroupNonUniformLogicalXor: *hasResult = true; *hasResultType = true; break; case OpGroupNonUniformQuadBroadcast: *hasResult = true; *hasResultType = true; break; case OpGroupNonUniformQuadSwap: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformQuadAllKHR: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformQuadAnyKHR: *hasResult = true; *hasResultType = true; break; case OpCopyLogical: *hasResult = true; *hasResultType = true; break; case OpPtrEqual: *hasResult = true; *hasResultType = true; break; case OpPtrNotEqual: *hasResult = true; *hasResultType = true; break; @@ -2425,6 +2429,10 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break; case OpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break; case OpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBlockMatchWindowSSDQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBlockMatchWindowSADQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBlockMatchGatherSSDQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBlockMatchGatherSADQCOM: *hasResult = true; *hasResultType = true; break; case OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; @@ -2436,6 +2444,8 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break; case OpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break; case OpReadClockKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformQuadAllKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformQuadAnyKHR: *hasResult = true; *hasResultType = true; break; case OpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break; case OpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break; case OpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break; diff --git a/Test/baseResults/spv.tpipBlockMatchGatherSAD.frag.out b/Test/baseResults/spv.tpipBlockMatchGatherSAD.frag.out new file mode 100644 index 000000000..be4c16176 --- /dev/null +++ b/Test/baseResults/spv.tpipBlockMatchGatherSAD.frag.out @@ -0,0 +1,124 @@ +spv.tpipBlockMatchGatherSAD.frag +Validation failed +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 72 + + Capability Shader + Capability Bad + Extension "SPV_QCOM_image_processing2" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 13 41 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_QCOM_image_processing2" + Name 4 "main" + Name 9 "tgt_coords" + Name 13 "v_texcoord" + Name 26 "ref_coords" + Name 37 "blockSize" + Name 41 "fragColor" + Name 44 "tex2D_src1" + Name 48 "samp" + Name 53 "tex2D_src2" + Name 61 "target_samp" + Name 64 "ref_samp" + Name 71 "tex2DArray_weights" + Decorate 13(v_texcoord) Location 0 + Decorate 41(fragColor) Location 0 + Decorate 44(tex2D_src1) DescriptorSet 0 + Decorate 44(tex2D_src1) Binding 1 + Decorate 48(samp) DescriptorSet 0 + Decorate 48(samp) Binding 3 + Decorate 53(tex2D_src2) DescriptorSet 0 + Decorate 53(tex2D_src2) Binding 2 + Decorate 44(tex2D_src1) DecorationBlockMatchTextureQCOM + Decorate 53(tex2D_src2) DecorationBlockMatchTextureQCOM + Decorate 61(target_samp) DescriptorSet 0 + Decorate 61(target_samp) Binding 4 + Decorate 64(ref_samp) DescriptorSet 0 + Decorate 64(ref_samp) Binding 5 + Decorate 61(target_samp) DecorationBlockMatchTextureQCOM + Decorate 64(ref_samp) DecorationBlockMatchTextureQCOM + Decorate 71(tex2DArray_weights) DescriptorSet 0 + Decorate 71(tex2DArray_weights) Binding 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 2 + 8: TypePointer Function 7(ivec2) + 10: TypeFloat 32 + 11: TypeVector 10(float) 4 + 12: TypePointer Input 11(fvec4) + 13(v_texcoord): 12(ptr) Variable Input + 14: 6(int) Constant 0 + 15: TypePointer Input 10(float) + 19: TypePointer Function 6(int) + 21: 6(int) Constant 1 + 27: 6(int) Constant 2 + 32: 6(int) Constant 3 + 38: 6(int) Constant 4 + 39: 7(ivec2) ConstantComposite 38 38 + 40: TypePointer Output 11(fvec4) + 41(fragColor): 40(ptr) Variable Output + 42: TypeImage 10(float) 2D sampled format:Unknown + 43: TypePointer UniformConstant 42 + 44(tex2D_src1): 43(ptr) Variable UniformConstant + 46: TypeSampler + 47: TypePointer UniformConstant 46 + 48(samp): 47(ptr) Variable UniformConstant + 50: TypeSampledImage 42 + 53(tex2D_src2): 43(ptr) Variable UniformConstant + 60: TypePointer UniformConstant 50 + 61(target_samp): 60(ptr) Variable UniformConstant + 64(ref_samp): 60(ptr) Variable UniformConstant + 69: TypeImage 10(float) 2D array sampled format:Unknown + 70: TypePointer UniformConstant 69 +71(tex2DArray_weights): 70(ptr) Variable UniformConstant + 4(main): 2 Function None 3 + 5: Label + 9(tgt_coords): 8(ptr) Variable Function + 26(ref_coords): 8(ptr) Variable Function + 37(blockSize): 8(ptr) Variable Function + 16: 15(ptr) AccessChain 13(v_texcoord) 14 + 17: 10(float) Load 16 + 18: 6(int) ConvertFToU 17 + 20: 19(ptr) AccessChain 9(tgt_coords) 14 + Store 20 18 + 22: 15(ptr) AccessChain 13(v_texcoord) 21 + 23: 10(float) Load 22 + 24: 6(int) ConvertFToU 23 + 25: 19(ptr) AccessChain 9(tgt_coords) 14 + Store 25 24 + 28: 15(ptr) AccessChain 13(v_texcoord) 27 + 29: 10(float) Load 28 + 30: 6(int) ConvertFToU 29 + 31: 19(ptr) AccessChain 26(ref_coords) 14 + Store 31 30 + 33: 15(ptr) AccessChain 13(v_texcoord) 32 + 34: 10(float) Load 33 + 35: 6(int) ConvertFToU 34 + 36: 19(ptr) AccessChain 26(ref_coords) 21 + Store 36 35 + Store 37(blockSize) 39 + 45: 42 Load 44(tex2D_src1) + 49: 46 Load 48(samp) + 51: 50 SampledImage 45 49 + 52: 7(ivec2) Load 9(tgt_coords) + 54: 42 Load 53(tex2D_src2) + 55: 46 Load 48(samp) + 56: 50 SampledImage 54 55 + 57: 7(ivec2) Load 26(ref_coords) + 58: 7(ivec2) Load 37(blockSize) + 59: 11(fvec4) ImageBlockMatchGatherSADQCOM 51 52 56 57 58 + Store 41(fragColor) 59 + 62: 50 Load 61(target_samp) + 63: 7(ivec2) Load 9(tgt_coords) + 65: 50 Load 64(ref_samp) + 66: 7(ivec2) Load 26(ref_coords) + 67: 7(ivec2) Load 37(blockSize) + 68: 11(fvec4) ImageBlockMatchGatherSADQCOM 62 63 65 66 67 + Store 41(fragColor) 68 + Return + FunctionEnd diff --git a/Test/baseResults/spv.tpipBlockMatchGatherSSD.frag.out b/Test/baseResults/spv.tpipBlockMatchGatherSSD.frag.out new file mode 100644 index 000000000..5b63e49d2 --- /dev/null +++ b/Test/baseResults/spv.tpipBlockMatchGatherSSD.frag.out @@ -0,0 +1,124 @@ +spv.tpipBlockMatchGatherSSD.frag +Validation failed +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 72 + + Capability Shader + Capability Bad + Extension "SPV_QCOM_image_processing2" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 13 41 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_QCOM_image_processing2" + Name 4 "main" + Name 9 "tgt_coords" + Name 13 "v_texcoord" + Name 26 "ref_coords" + Name 37 "blockSize" + Name 41 "fragColor" + Name 44 "tex2D_src1" + Name 48 "samp" + Name 53 "tex2D_src2" + Name 61 "target_samp" + Name 64 "ref_samp" + Name 71 "tex2DArray_weights" + Decorate 13(v_texcoord) Location 0 + Decorate 41(fragColor) Location 0 + Decorate 44(tex2D_src1) DescriptorSet 0 + Decorate 44(tex2D_src1) Binding 1 + Decorate 48(samp) DescriptorSet 0 + Decorate 48(samp) Binding 3 + Decorate 53(tex2D_src2) DescriptorSet 0 + Decorate 53(tex2D_src2) Binding 2 + Decorate 44(tex2D_src1) DecorationBlockMatchTextureQCOM + Decorate 53(tex2D_src2) DecorationBlockMatchTextureQCOM + Decorate 61(target_samp) DescriptorSet 0 + Decorate 61(target_samp) Binding 4 + Decorate 64(ref_samp) DescriptorSet 0 + Decorate 64(ref_samp) Binding 5 + Decorate 61(target_samp) DecorationBlockMatchTextureQCOM + Decorate 64(ref_samp) DecorationBlockMatchTextureQCOM + Decorate 71(tex2DArray_weights) DescriptorSet 0 + Decorate 71(tex2DArray_weights) Binding 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 2 + 8: TypePointer Function 7(ivec2) + 10: TypeFloat 32 + 11: TypeVector 10(float) 4 + 12: TypePointer Input 11(fvec4) + 13(v_texcoord): 12(ptr) Variable Input + 14: 6(int) Constant 0 + 15: TypePointer Input 10(float) + 19: TypePointer Function 6(int) + 21: 6(int) Constant 1 + 27: 6(int) Constant 2 + 32: 6(int) Constant 3 + 38: 6(int) Constant 4 + 39: 7(ivec2) ConstantComposite 38 38 + 40: TypePointer Output 11(fvec4) + 41(fragColor): 40(ptr) Variable Output + 42: TypeImage 10(float) 2D sampled format:Unknown + 43: TypePointer UniformConstant 42 + 44(tex2D_src1): 43(ptr) Variable UniformConstant + 46: TypeSampler + 47: TypePointer UniformConstant 46 + 48(samp): 47(ptr) Variable UniformConstant + 50: TypeSampledImage 42 + 53(tex2D_src2): 43(ptr) Variable UniformConstant + 60: TypePointer UniformConstant 50 + 61(target_samp): 60(ptr) Variable UniformConstant + 64(ref_samp): 60(ptr) Variable UniformConstant + 69: TypeImage 10(float) 2D array sampled format:Unknown + 70: TypePointer UniformConstant 69 +71(tex2DArray_weights): 70(ptr) Variable UniformConstant + 4(main): 2 Function None 3 + 5: Label + 9(tgt_coords): 8(ptr) Variable Function + 26(ref_coords): 8(ptr) Variable Function + 37(blockSize): 8(ptr) Variable Function + 16: 15(ptr) AccessChain 13(v_texcoord) 14 + 17: 10(float) Load 16 + 18: 6(int) ConvertFToU 17 + 20: 19(ptr) AccessChain 9(tgt_coords) 14 + Store 20 18 + 22: 15(ptr) AccessChain 13(v_texcoord) 21 + 23: 10(float) Load 22 + 24: 6(int) ConvertFToU 23 + 25: 19(ptr) AccessChain 9(tgt_coords) 14 + Store 25 24 + 28: 15(ptr) AccessChain 13(v_texcoord) 27 + 29: 10(float) Load 28 + 30: 6(int) ConvertFToU 29 + 31: 19(ptr) AccessChain 26(ref_coords) 14 + Store 31 30 + 33: 15(ptr) AccessChain 13(v_texcoord) 32 + 34: 10(float) Load 33 + 35: 6(int) ConvertFToU 34 + 36: 19(ptr) AccessChain 26(ref_coords) 21 + Store 36 35 + Store 37(blockSize) 39 + 45: 42 Load 44(tex2D_src1) + 49: 46 Load 48(samp) + 51: 50 SampledImage 45 49 + 52: 7(ivec2) Load 9(tgt_coords) + 54: 42 Load 53(tex2D_src2) + 55: 46 Load 48(samp) + 56: 50 SampledImage 54 55 + 57: 7(ivec2) Load 26(ref_coords) + 58: 7(ivec2) Load 37(blockSize) + 59: 11(fvec4) ImageBlockMatchGatherSSDQCOM 51 52 56 57 58 + Store 41(fragColor) 59 + 62: 50 Load 61(target_samp) + 63: 7(ivec2) Load 9(tgt_coords) + 65: 50 Load 64(ref_samp) + 66: 7(ivec2) Load 26(ref_coords) + 67: 7(ivec2) Load 37(blockSize) + 68: 11(fvec4) ImageBlockMatchGatherSSDQCOM 62 63 65 66 67 + Store 41(fragColor) 68 + Return + FunctionEnd diff --git a/Test/baseResults/spv.tpipBlockMatchWindowSAD.frag.out b/Test/baseResults/spv.tpipBlockMatchWindowSAD.frag.out new file mode 100644 index 000000000..afadf0304 --- /dev/null +++ b/Test/baseResults/spv.tpipBlockMatchWindowSAD.frag.out @@ -0,0 +1,131 @@ +spv.tpipBlockMatchWindowSAD.frag +Validation failed +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 72 + + Capability Shader + Capability TextureBlockMatchQCOM + Capability Bad + Extension "SPV_QCOM_image_processing" + Extension "SPV_QCOM_image_processing2" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 13 41 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_QCOM_image_processing" + SourceExtension "GL_QCOM_image_processing2" + Name 4 "main" + Name 9 "tgt_coords" + Name 13 "v_texcoord" + Name 26 "ref_coords" + Name 37 "blockSize" + Name 41 "fragColor" + Name 44 "tex2D_src1" + Name 48 "samp" + Name 53 "tex2D_src2" + Name 61 "target_samp" + Name 64 "ref_samp" + Name 71 "tex2DArray_weights" + Decorate 13(v_texcoord) Location 0 + Decorate 41(fragColor) Location 0 + Decorate 44(tex2D_src1) DescriptorSet 0 + Decorate 44(tex2D_src1) Binding 1 + Decorate 48(samp) DescriptorSet 0 + Decorate 48(samp) Binding 3 + Decorate 53(tex2D_src2) DescriptorSet 0 + Decorate 53(tex2D_src2) Binding 2 + Decorate 44(tex2D_src1) DecorationBlockMatchTextureQCOM + Decorate 48(samp) DecorationBlockMatchSamplerQCOM + Decorate 53(tex2D_src2) DecorationBlockMatchTextureQCOM + Decorate 48(samp) DecorationBlockMatchSamplerQCOM + Decorate 61(target_samp) DescriptorSet 0 + Decorate 61(target_samp) Binding 4 + Decorate 64(ref_samp) DescriptorSet 0 + Decorate 64(ref_samp) Binding 5 + Decorate 61(target_samp) DecorationBlockMatchTextureQCOM + Decorate 61(target_samp) DecorationBlockMatchSamplerQCOM + Decorate 64(ref_samp) DecorationBlockMatchTextureQCOM + Decorate 64(ref_samp) DecorationBlockMatchSamplerQCOM + Decorate 71(tex2DArray_weights) DescriptorSet 0 + Decorate 71(tex2DArray_weights) Binding 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 2 + 8: TypePointer Function 7(ivec2) + 10: TypeFloat 32 + 11: TypeVector 10(float) 4 + 12: TypePointer Input 11(fvec4) + 13(v_texcoord): 12(ptr) Variable Input + 14: 6(int) Constant 0 + 15: TypePointer Input 10(float) + 19: TypePointer Function 6(int) + 21: 6(int) Constant 1 + 27: 6(int) Constant 2 + 32: 6(int) Constant 3 + 38: 6(int) Constant 4 + 39: 7(ivec2) ConstantComposite 38 38 + 40: TypePointer Output 11(fvec4) + 41(fragColor): 40(ptr) Variable Output + 42: TypeImage 10(float) 2D sampled format:Unknown + 43: TypePointer UniformConstant 42 + 44(tex2D_src1): 43(ptr) Variable UniformConstant + 46: TypeSampler + 47: TypePointer UniformConstant 46 + 48(samp): 47(ptr) Variable UniformConstant + 50: TypeSampledImage 42 + 53(tex2D_src2): 43(ptr) Variable UniformConstant + 60: TypePointer UniformConstant 50 + 61(target_samp): 60(ptr) Variable UniformConstant + 64(ref_samp): 60(ptr) Variable UniformConstant + 69: TypeImage 10(float) 2D array sampled format:Unknown + 70: TypePointer UniformConstant 69 +71(tex2DArray_weights): 70(ptr) Variable UniformConstant + 4(main): 2 Function None 3 + 5: Label + 9(tgt_coords): 8(ptr) Variable Function + 26(ref_coords): 8(ptr) Variable Function + 37(blockSize): 8(ptr) Variable Function + 16: 15(ptr) AccessChain 13(v_texcoord) 14 + 17: 10(float) Load 16 + 18: 6(int) ConvertFToU 17 + 20: 19(ptr) AccessChain 9(tgt_coords) 14 + Store 20 18 + 22: 15(ptr) AccessChain 13(v_texcoord) 21 + 23: 10(float) Load 22 + 24: 6(int) ConvertFToU 23 + 25: 19(ptr) AccessChain 9(tgt_coords) 14 + Store 25 24 + 28: 15(ptr) AccessChain 13(v_texcoord) 27 + 29: 10(float) Load 28 + 30: 6(int) ConvertFToU 29 + 31: 19(ptr) AccessChain 26(ref_coords) 14 + Store 31 30 + 33: 15(ptr) AccessChain 13(v_texcoord) 32 + 34: 10(float) Load 33 + 35: 6(int) ConvertFToU 34 + 36: 19(ptr) AccessChain 26(ref_coords) 21 + Store 36 35 + Store 37(blockSize) 39 + 45: 42 Load 44(tex2D_src1) + 49: 46 Load 48(samp) + 51: 50 SampledImage 45 49 + 52: 7(ivec2) Load 9(tgt_coords) + 54: 42 Load 53(tex2D_src2) + 55: 46 Load 48(samp) + 56: 50 SampledImage 54 55 + 57: 7(ivec2) Load 26(ref_coords) + 58: 7(ivec2) Load 37(blockSize) + 59: 11(fvec4) ImageBlockMatchWindowSADQCOM 51 52 56 57 58 + Store 41(fragColor) 59 + 62: 50 Load 61(target_samp) + 63: 7(ivec2) Load 9(tgt_coords) + 65: 50 Load 64(ref_samp) + 66: 7(ivec2) Load 26(ref_coords) + 67: 7(ivec2) Load 37(blockSize) + 68: 11(fvec4) ImageBlockMatchWindowSADQCOM 62 63 65 66 67 + Store 41(fragColor) 68 + Return + FunctionEnd diff --git a/Test/baseResults/spv.tpipBlockMatchWindowSSD.frag.out b/Test/baseResults/spv.tpipBlockMatchWindowSSD.frag.out new file mode 100644 index 000000000..864a8bcac --- /dev/null +++ b/Test/baseResults/spv.tpipBlockMatchWindowSSD.frag.out @@ -0,0 +1,131 @@ +spv.tpipBlockMatchWindowSSD.frag +Validation failed +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 72 + + Capability Shader + Capability TextureBlockMatchQCOM + Capability Bad + Extension "SPV_QCOM_image_processing" + Extension "SPV_QCOM_image_processing2" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 13 41 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_QCOM_image_processing" + SourceExtension "GL_QCOM_image_processing2" + Name 4 "main" + Name 9 "tgt_coords" + Name 13 "v_texcoord" + Name 26 "ref_coords" + Name 37 "blockSize" + Name 41 "fragColor" + Name 44 "tex2D_src1" + Name 48 "samp" + Name 53 "tex2D_src2" + Name 61 "target_samp" + Name 64 "ref_samp" + Name 71 "tex2DArray_weights" + Decorate 13(v_texcoord) Location 0 + Decorate 41(fragColor) Location 0 + Decorate 44(tex2D_src1) DescriptorSet 0 + Decorate 44(tex2D_src1) Binding 1 + Decorate 48(samp) DescriptorSet 0 + Decorate 48(samp) Binding 3 + Decorate 53(tex2D_src2) DescriptorSet 0 + Decorate 53(tex2D_src2) Binding 2 + Decorate 44(tex2D_src1) DecorationBlockMatchTextureQCOM + Decorate 48(samp) DecorationBlockMatchSamplerQCOM + Decorate 53(tex2D_src2) DecorationBlockMatchTextureQCOM + Decorate 48(samp) DecorationBlockMatchSamplerQCOM + Decorate 61(target_samp) DescriptorSet 0 + Decorate 61(target_samp) Binding 4 + Decorate 64(ref_samp) DescriptorSet 0 + Decorate 64(ref_samp) Binding 5 + Decorate 61(target_samp) DecorationBlockMatchTextureQCOM + Decorate 61(target_samp) DecorationBlockMatchSamplerQCOM + Decorate 64(ref_samp) DecorationBlockMatchTextureQCOM + Decorate 64(ref_samp) DecorationBlockMatchSamplerQCOM + Decorate 71(tex2DArray_weights) DescriptorSet 0 + Decorate 71(tex2DArray_weights) Binding 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 2 + 8: TypePointer Function 7(ivec2) + 10: TypeFloat 32 + 11: TypeVector 10(float) 4 + 12: TypePointer Input 11(fvec4) + 13(v_texcoord): 12(ptr) Variable Input + 14: 6(int) Constant 0 + 15: TypePointer Input 10(float) + 19: TypePointer Function 6(int) + 21: 6(int) Constant 1 + 27: 6(int) Constant 2 + 32: 6(int) Constant 3 + 38: 6(int) Constant 4 + 39: 7(ivec2) ConstantComposite 38 38 + 40: TypePointer Output 11(fvec4) + 41(fragColor): 40(ptr) Variable Output + 42: TypeImage 10(float) 2D sampled format:Unknown + 43: TypePointer UniformConstant 42 + 44(tex2D_src1): 43(ptr) Variable UniformConstant + 46: TypeSampler + 47: TypePointer UniformConstant 46 + 48(samp): 47(ptr) Variable UniformConstant + 50: TypeSampledImage 42 + 53(tex2D_src2): 43(ptr) Variable UniformConstant + 60: TypePointer UniformConstant 50 + 61(target_samp): 60(ptr) Variable UniformConstant + 64(ref_samp): 60(ptr) Variable UniformConstant + 69: TypeImage 10(float) 2D array sampled format:Unknown + 70: TypePointer UniformConstant 69 +71(tex2DArray_weights): 70(ptr) Variable UniformConstant + 4(main): 2 Function None 3 + 5: Label + 9(tgt_coords): 8(ptr) Variable Function + 26(ref_coords): 8(ptr) Variable Function + 37(blockSize): 8(ptr) Variable Function + 16: 15(ptr) AccessChain 13(v_texcoord) 14 + 17: 10(float) Load 16 + 18: 6(int) ConvertFToU 17 + 20: 19(ptr) AccessChain 9(tgt_coords) 14 + Store 20 18 + 22: 15(ptr) AccessChain 13(v_texcoord) 21 + 23: 10(float) Load 22 + 24: 6(int) ConvertFToU 23 + 25: 19(ptr) AccessChain 9(tgt_coords) 14 + Store 25 24 + 28: 15(ptr) AccessChain 13(v_texcoord) 27 + 29: 10(float) Load 28 + 30: 6(int) ConvertFToU 29 + 31: 19(ptr) AccessChain 26(ref_coords) 14 + Store 31 30 + 33: 15(ptr) AccessChain 13(v_texcoord) 32 + 34: 10(float) Load 33 + 35: 6(int) ConvertFToU 34 + 36: 19(ptr) AccessChain 26(ref_coords) 21 + Store 36 35 + Store 37(blockSize) 39 + 45: 42 Load 44(tex2D_src1) + 49: 46 Load 48(samp) + 51: 50 SampledImage 45 49 + 52: 7(ivec2) Load 9(tgt_coords) + 54: 42 Load 53(tex2D_src2) + 55: 46 Load 48(samp) + 56: 50 SampledImage 54 55 + 57: 7(ivec2) Load 26(ref_coords) + 58: 7(ivec2) Load 37(blockSize) + 59: 11(fvec4) ImageBlockMatchWindowSSDQCOM 51 52 56 57 58 + Store 41(fragColor) 59 + 62: 50 Load 61(target_samp) + 63: 7(ivec2) Load 9(tgt_coords) + 65: 50 Load 64(ref_samp) + 66: 7(ivec2) Load 26(ref_coords) + 67: 7(ivec2) Load 37(blockSize) + 68: 11(fvec4) ImageBlockMatchWindowSSDQCOM 62 63 65 66 67 + Store 41(fragColor) 68 + Return + FunctionEnd diff --git a/Test/spv.tpipBlockMatchGatherSAD.frag b/Test/spv.tpipBlockMatchGatherSAD.frag new file mode 100644 index 000000000..d793a5e60 --- /dev/null +++ b/Test/spv.tpipBlockMatchGatherSAD.frag @@ -0,0 +1,38 @@ +#version 450 +#extension GL_QCOM_image_processing2 : require + +precision highp float; + +// fragment shader inputs and outputs +layout (location = 0) in vec4 v_texcoord; + +layout (location = 0) out vec4 fragColor; + +// fragment shader resources +layout(set = 0, binding = 0) uniform texture2DArray tex2DArray_weights; +layout(set = 0, binding = 1) uniform texture2D tex2D_src1; +layout(set = 0, binding = 2) uniform texture2D tex2D_src2; +layout(set = 0, binding = 3) uniform sampler samp; +layout(set = 0, binding = 4) uniform sampler2D target_samp; +layout(set = 0, binding = 5) uniform sampler2D ref_samp; + +void main() +{ + + uvec2 tgt_coords; tgt_coords.x = uint(v_texcoord.x); tgt_coords.x = uint(v_texcoord.y); + uvec2 ref_coords; ref_coords.x = uint(v_texcoord.z); ref_coords.y = uint(v_texcoord.w); + uvec2 blockSize = uvec2(4, 4); + fragColor = textureBlockMatchGatherSADQCOM( + sampler2D(tex2D_src1, samp), // target texture + tgt_coords, // target coords + sampler2D(tex2D_src2, samp), // reference texture + ref_coords, // reference coords + blockSize); // block size + fragColor = textureBlockMatchGatherSADQCOM( + target_samp, // target texture + tgt_coords, // target coords + ref_samp, // reference texture + ref_coords, // reference coords + blockSize); // block size +} + diff --git a/Test/spv.tpipBlockMatchGatherSSD.frag b/Test/spv.tpipBlockMatchGatherSSD.frag new file mode 100644 index 000000000..d3a0bcea1 --- /dev/null +++ b/Test/spv.tpipBlockMatchGatherSSD.frag @@ -0,0 +1,38 @@ +#version 450 +#extension GL_QCOM_image_processing2 : require + +precision highp float; + +// fragment shader inputs and outputs +layout (location = 0) in vec4 v_texcoord; + +layout (location = 0) out vec4 fragColor; + +// fragment shader resources +layout(set = 0, binding = 0) uniform texture2DArray tex2DArray_weights; +layout(set = 0, binding = 1) uniform texture2D tex2D_src1; +layout(set = 0, binding = 2) uniform texture2D tex2D_src2; +layout(set = 0, binding = 3) uniform sampler samp; +layout(set = 0, binding = 4) uniform sampler2D target_samp; +layout(set = 0, binding = 5) uniform sampler2D ref_samp; + +void main() +{ + + uvec2 tgt_coords; tgt_coords.x = uint(v_texcoord.x); tgt_coords.x = uint(v_texcoord.y); + uvec2 ref_coords; ref_coords.x = uint(v_texcoord.z); ref_coords.y = uint(v_texcoord.w); + uvec2 blockSize = uvec2(4, 4); + fragColor = textureBlockMatchGatherSSDQCOM( + sampler2D(tex2D_src1, samp), // target texture + tgt_coords, // target coords + sampler2D(tex2D_src2, samp), // reference texture + ref_coords, // reference coords + blockSize); // block size + fragColor = textureBlockMatchGatherSSDQCOM( + target_samp, // target texture + tgt_coords, // target coords + ref_samp, // reference texture + ref_coords, // reference coords + blockSize); // block size +} + diff --git a/Test/spv.tpipBlockMatchWindowSAD.frag b/Test/spv.tpipBlockMatchWindowSAD.frag new file mode 100644 index 000000000..468b8d85f --- /dev/null +++ b/Test/spv.tpipBlockMatchWindowSAD.frag @@ -0,0 +1,39 @@ +#version 450 +#extension GL_QCOM_image_processing : require +#extension GL_QCOM_image_processing2 : require + +precision highp float; + +// fragment shader inputs and outputs +layout (location = 0) in vec4 v_texcoord; + +layout (location = 0) out vec4 fragColor; + +// fragment shader resources +layout(set = 0, binding = 0) uniform texture2DArray tex2DArray_weights; +layout(set = 0, binding = 1) uniform texture2D tex2D_src1; +layout(set = 0, binding = 2) uniform texture2D tex2D_src2; +layout(set = 0, binding = 3) uniform sampler samp; +layout(set = 0, binding = 4) uniform sampler2D target_samp; +layout(set = 0, binding = 5) uniform sampler2D ref_samp; + +void main() +{ + + uvec2 tgt_coords; tgt_coords.x = uint(v_texcoord.x); tgt_coords.x = uint(v_texcoord.y); + uvec2 ref_coords; ref_coords.x = uint(v_texcoord.z); ref_coords.y = uint(v_texcoord.w); + uvec2 blockSize = uvec2(4, 4); + fragColor = textureBlockMatchWindowSADQCOM( + sampler2D(tex2D_src1, samp), // target texture + tgt_coords, // target coords + sampler2D(tex2D_src2, samp), // reference texture + ref_coords, // reference coords + blockSize); // block size + fragColor = textureBlockMatchWindowSADQCOM( + target_samp, // target texture + tgt_coords, // target coords + ref_samp, // reference texture + ref_coords, // reference coords + blockSize); // block size +} + diff --git a/Test/spv.tpipBlockMatchWindowSSD.frag b/Test/spv.tpipBlockMatchWindowSSD.frag new file mode 100644 index 000000000..fee1bb4ab --- /dev/null +++ b/Test/spv.tpipBlockMatchWindowSSD.frag @@ -0,0 +1,40 @@ +#version 450 +#extension GL_QCOM_image_processing : require +#extension GL_QCOM_image_processing2 : require + +precision highp float; + +// fragment shader inputs and outputs +layout (location = 0) in vec4 v_texcoord; + +layout (location = 0) out vec4 fragColor; + +// fragment shader resources +layout(set = 0, binding = 0) uniform texture2DArray tex2DArray_weights; +layout(set = 0, binding = 1) uniform texture2D tex2D_src1; +layout(set = 0, binding = 2) uniform texture2D tex2D_src2; +layout(set = 0, binding = 3) uniform sampler samp; +layout(set = 0, binding = 4) uniform sampler2D target_samp; +layout(set = 0, binding = 5) uniform sampler2D ref_samp; + +void main() +{ + + uvec2 tgt_coords; tgt_coords.x = uint(v_texcoord.x); tgt_coords.x = uint(v_texcoord.y); + uvec2 ref_coords; ref_coords.x = uint(v_texcoord.z); ref_coords.y = uint(v_texcoord.w); + uvec2 blockSize = uvec2(4, 4); + fragColor = textureBlockMatchWindowSSDQCOM( + sampler2D(tex2D_src1, samp), // target texture + tgt_coords, // target coords + sampler2D(tex2D_src2, samp), // reference texture + ref_coords, // reference coords + blockSize); // block size + fragColor = textureBlockMatchWindowSSDQCOM( + target_samp, // target texture + tgt_coords, // target coords + ref_samp, // reference texture + ref_coords, // reference coords + blockSize); // block size +} + + diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index c7640ec37..bcce91d3a 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -1111,6 +1111,12 @@ enum TOperator { EOpImageBoxFilterQCOM, EOpImageBlockMatchSADQCOM, EOpImageBlockMatchSSDQCOM, + + // Image processing2 + EOpImageBlockMatchWindowSSDQCOM, + EOpImageBlockMatchWindowSADQCOM, + EOpImageBlockMatchGatherSSDQCOM, + EOpImageBlockMatchGatherSADQCOM, }; enum TLinkType { diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 858ae6ade..8e742eab4 100755 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -4233,6 +4233,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "vec4 textureBoxFilterQCOM(sampler2D, vec2, vec2);" "vec4 textureBlockMatchSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);" "vec4 textureBlockMatchSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);" + + "vec4 textureBlockMatchWindowSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);" + "vec4 textureBlockMatchWindowSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);" + "vec4 textureBlockMatchGatherSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);" + "vec4 textureBlockMatchGatherSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);" "\n"); } @@ -8909,10 +8914,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 140)) { + symbolTable.setFunctionExtensions("textureWeightedQCOM", 1, &E_GL_QCOM_image_processing); symbolTable.setFunctionExtensions("textureBoxFilterQCOM", 1, &E_GL_QCOM_image_processing); symbolTable.setFunctionExtensions("textureBlockMatchSADQCOM", 1, &E_GL_QCOM_image_processing); symbolTable.setFunctionExtensions("textureBlockMatchSSDQCOM", 1, &E_GL_QCOM_image_processing); + + symbolTable.setFunctionExtensions("textureBlockMatchWindowSSDQCOM", 1, &E_GL_QCOM_image_processing2); + symbolTable.setFunctionExtensions("textureBlockMatchWindowSADQCOM", 1, &E_GL_QCOM_image_processing2); + symbolTable.setFunctionExtensions("textureBlockMatchGatherSSDQCOM", 1, &E_GL_QCOM_image_processing2); + symbolTable.setFunctionExtensions("textureBlockMatchGatherSADQCOM", 1, &E_GL_QCOM_image_processing2); } break; @@ -10117,6 +10128,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("textureBoxFilterQCOM", EOpImageBoxFilterQCOM); symbolTable.relateToOperator("textureBlockMatchSADQCOM", EOpImageBlockMatchSADQCOM); symbolTable.relateToOperator("textureBlockMatchSSDQCOM", EOpImageBlockMatchSSDQCOM); + + symbolTable.relateToOperator("textureBlockMatchWindowSSDQCOM", EOpImageBlockMatchWindowSSDQCOM); + symbolTable.relateToOperator("textureBlockMatchWindowSADQCOM", EOpImageBlockMatchWindowSADQCOM); + symbolTable.relateToOperator("textureBlockMatchGatherSSDQCOM", EOpImageBlockMatchGatherSSDQCOM); + symbolTable.relateToOperator("textureBlockMatchGatherSADQCOM", EOpImageBlockMatchGatherSADQCOM); } if (profile != EEsProfile && spvVersion.spv == 0) { diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 25d49858c..44ba9e061 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -315,6 +315,7 @@ void TParseVersions::initializeExtensionBehavior() // QCOM extensionBehavior[E_GL_QCOM_image_processing] = EBhDisable; + extensionBehavior[E_GL_QCOM_image_processing2] = EBhDisable; // AEP extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable; @@ -446,6 +447,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_shader_non_constant_global_initializers 1\n" "#define GL_QCOM_image_processing 1\n" + "#define GL_QCOM_image_processing2 1\n" ; if (version >= 300) { @@ -572,6 +574,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_NV_shader_invocation_reorder 1\n" "#define GL_QCOM_image_processing 1\n" + "#define GL_QCOM_image_processing2 1\n" "#define GL_EXT_shader_explicit_arithmetic_types 1\n" "#define GL_EXT_shader_explicit_arithmetic_types_int8 1\n" diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index a2f61dfc7..cfaeb1ff1 100755 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -292,6 +292,7 @@ const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]); const char* const E_GL_QCOM_image_processing = "GL_QCOM_image_processing"; +const char* const E_GL_QCOM_image_processing2 = "GL_QCOM_image_processing2"; // AEP const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a"; diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index e111168aa..e820962df 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -845,6 +845,10 @@ INSTANTIATE_TEST_SUITE_P( "spv.tpipBlockMatchSSD.frag", "spv.tpipBlockMatchSAD.frag", "spv.tpipTextureArrays.frag", + "spv.tpipBlockMatchGatherSAD.frag", + "spv.tpipBlockMatchGatherSSD.frag", + "spv.tpipBlockMatchWindowSAD.frag", + "spv.tpipBlockMatchWindowSSD.frag", })), FileNameAsCustomTestSuffix );