mirror of
https://github.com/KhronosGroup/glslang
synced 2024-09-19 12:19:53 +00:00
A couple of fixes to the GL_QCOM_image_processing2 support (#3578)
1) handle the extension requirements of GL_QCOM_image_processing2 correctly 2) add QCOM image processing decorations to ids only once.
This commit is contained in:
parent
b9b8fd917b
commit
a4f870053f
@ -227,6 +227,7 @@ protected:
|
|||||||
spv::Id createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId);
|
spv::Id createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId);
|
||||||
spv::Id getSymbolId(const glslang::TIntermSymbol* node);
|
spv::Id getSymbolId(const glslang::TIntermSymbol* node);
|
||||||
void addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier & qualifier);
|
void addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier & qualifier);
|
||||||
|
bool hasQCOMImageProceessingDecoration(spv::Id id, spv::Decoration decor);
|
||||||
void addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor);
|
void addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor);
|
||||||
void addImageProcessing2QCOMDecoration(spv::Id id, bool isForGather);
|
void addImageProcessing2QCOMDecoration(spv::Id id, bool isForGather);
|
||||||
spv::Id createSpvConstant(const glslang::TIntermTyped&);
|
spv::Id createSpvConstant(const glslang::TIntermTyped&);
|
||||||
@ -283,6 +284,7 @@ protected:
|
|||||||
spv::Id taskPayloadID;
|
spv::Id taskPayloadID;
|
||||||
// Used later for generating OpTraceKHR/OpExecuteCallableKHR/OpHitObjectRecordHit*/OpHitObjectGetShaderBindingTableData
|
// Used later for generating OpTraceKHR/OpExecuteCallableKHR/OpHitObjectRecordHit*/OpHitObjectGetShaderBindingTableData
|
||||||
std::unordered_map<unsigned int, glslang::TIntermSymbol *> locationToSymbol[4];
|
std::unordered_map<unsigned int, glslang::TIntermSymbol *> locationToSymbol[4];
|
||||||
|
std::unordered_map<spv::Id, std::vector<spv::Decoration> > idToQCOMDecorations;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -3382,6 +3384,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|||||||
|
|
||||||
case glslang::EOpImageBlockMatchGatherSSDQCOM:
|
case glslang::EOpImageBlockMatchGatherSSDQCOM:
|
||||||
case glslang::EOpImageBlockMatchGatherSADQCOM:
|
case glslang::EOpImageBlockMatchGatherSADQCOM:
|
||||||
|
builder.addCapability(spv::CapabilityTextureBlockMatchQCOM);
|
||||||
|
builder.addExtension(spv::E_SPV_QCOM_image_processing);
|
||||||
builder.addCapability(spv::CapabilityTextureBlockMatch2QCOM);
|
builder.addCapability(spv::CapabilityTextureBlockMatch2QCOM);
|
||||||
builder.addExtension(spv::E_SPV_QCOM_image_processing2);
|
builder.addExtension(spv::E_SPV_QCOM_image_processing2);
|
||||||
break;
|
break;
|
||||||
@ -9834,6 +9838,16 @@ void TGlslangToSpvTraverser::addMeshNVDecoration(spv::Id id, int member, const g
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TGlslangToSpvTraverser::hasQCOMImageProceessingDecoration(spv::Id id, spv::Decoration decor)
|
||||||
|
{
|
||||||
|
std::vector<spv::Decoration> &decoVec = idToQCOMDecorations[id];
|
||||||
|
for ( auto d : decoVec ) {
|
||||||
|
if ( d == decor )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void TGlslangToSpvTraverser::addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor)
|
void TGlslangToSpvTraverser::addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor)
|
||||||
{
|
{
|
||||||
spv::Op opc = builder.getOpCode(id);
|
spv::Op opc = builder.getOpCode(id);
|
||||||
@ -9844,7 +9858,10 @@ void TGlslangToSpvTraverser::addImageProcessingQCOMDecoration(spv::Id id, spv::D
|
|||||||
|
|
||||||
if (opc == spv::OpLoad) {
|
if (opc == spv::OpLoad) {
|
||||||
spv::Id texid = builder.getIdOperand(id, 0);
|
spv::Id texid = builder.getIdOperand(id, 0);
|
||||||
builder.addDecoration(texid, decor);
|
if (!hasQCOMImageProceessingDecoration(texid, decor)) {//
|
||||||
|
builder.addDecoration(texid, decor);
|
||||||
|
idToQCOMDecorations[texid].push_back(decor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9862,7 +9879,10 @@ void TGlslangToSpvTraverser::addImageProcessing2QCOMDecoration(spv::Id id, bool
|
|||||||
if (this->glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) {
|
if (this->glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) {
|
||||||
assert(iOSet.count(tsid) > 0);
|
assert(iOSet.count(tsid) > 0);
|
||||||
}
|
}
|
||||||
this->builder.addDecoration(tsid, decor);
|
if (!hasQCOMImageProceessingDecoration(tsid, decor)) {
|
||||||
|
this->builder.addDecoration(tsid, decor);
|
||||||
|
idToQCOMDecorations[tsid].push_back(decor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1064,6 +1064,7 @@ const char* CapabilityString(int info)
|
|||||||
case CapabilityTextureSampleWeightedQCOM: return "TextureSampleWeightedQCOM";
|
case CapabilityTextureSampleWeightedQCOM: return "TextureSampleWeightedQCOM";
|
||||||
case CapabilityTextureBoxFilterQCOM: return "TextureBoxFilterQCOM";
|
case CapabilityTextureBoxFilterQCOM: return "TextureBoxFilterQCOM";
|
||||||
case CapabilityTextureBlockMatchQCOM: return "TextureBlockMatchQCOM";
|
case CapabilityTextureBlockMatchQCOM: return "TextureBlockMatchQCOM";
|
||||||
|
case CapabilityTextureBlockMatch2QCOM: return "TextureBlockMatch2QCOM";
|
||||||
|
|
||||||
default: return "Bad";
|
default: return "Bad";
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
spv.tpipBlockMatchGatherSAD.frag
|
spv.tpipBlockMatchGatherSAD.frag
|
||||||
Validation failed
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 8000b
|
// Generated by (magic number): 8000b
|
||||||
// Id's are bound by 72
|
// Id's are bound by 72
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability Bad
|
Capability TextureBlockMatchQCOM
|
||||||
|
Capability TextureBlockMatch2QCOM
|
||||||
|
Extension "SPV_QCOM_image_processing"
|
||||||
Extension "SPV_QCOM_image_processing2"
|
Extension "SPV_QCOM_image_processing2"
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 13 41
|
EntryPoint Fragment 4 "main" 13 41
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
Source GLSL 450
|
Source GLSL 450
|
||||||
|
SourceExtension "GL_QCOM_image_processing"
|
||||||
SourceExtension "GL_QCOM_image_processing2"
|
SourceExtension "GL_QCOM_image_processing2"
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
Name 9 "tgt_coords"
|
Name 9 "tgt_coords"
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
spv.tpipBlockMatchGatherSSD.frag
|
spv.tpipBlockMatchGatherSSD.frag
|
||||||
Validation failed
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 8000b
|
// Generated by (magic number): 8000b
|
||||||
// Id's are bound by 72
|
// Id's are bound by 72
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability Bad
|
Capability TextureBlockMatchQCOM
|
||||||
|
Capability TextureBlockMatch2QCOM
|
||||||
|
Extension "SPV_QCOM_image_processing"
|
||||||
Extension "SPV_QCOM_image_processing2"
|
Extension "SPV_QCOM_image_processing2"
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 13 41
|
EntryPoint Fragment 4 "main" 13 41
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
Source GLSL 450
|
Source GLSL 450
|
||||||
|
SourceExtension "GL_QCOM_image_processing"
|
||||||
SourceExtension "GL_QCOM_image_processing2"
|
SourceExtension "GL_QCOM_image_processing2"
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
Name 9 "tgt_coords"
|
Name 9 "tgt_coords"
|
||||||
|
@ -6,7 +6,7 @@ Validation failed
|
|||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability TextureBlockMatchQCOM
|
Capability TextureBlockMatchQCOM
|
||||||
Capability Bad
|
Capability TextureBlockMatch2QCOM
|
||||||
Extension "SPV_QCOM_image_processing"
|
Extension "SPV_QCOM_image_processing"
|
||||||
Extension "SPV_QCOM_image_processing2"
|
Extension "SPV_QCOM_image_processing2"
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
@ -39,7 +39,6 @@ Validation failed
|
|||||||
Decorate 44(tex2D_src1) DecorationBlockMatchTextureQCOM
|
Decorate 44(tex2D_src1) DecorationBlockMatchTextureQCOM
|
||||||
Decorate 48(samp) DecorationBlockMatchSamplerQCOM
|
Decorate 48(samp) DecorationBlockMatchSamplerQCOM
|
||||||
Decorate 53(tex2D_src2) DecorationBlockMatchTextureQCOM
|
Decorate 53(tex2D_src2) DecorationBlockMatchTextureQCOM
|
||||||
Decorate 48(samp) DecorationBlockMatchSamplerQCOM
|
|
||||||
Decorate 61(target_samp) DescriptorSet 0
|
Decorate 61(target_samp) DescriptorSet 0
|
||||||
Decorate 61(target_samp) Binding 4
|
Decorate 61(target_samp) Binding 4
|
||||||
Decorate 64(ref_samp) DescriptorSet 0
|
Decorate 64(ref_samp) DescriptorSet 0
|
||||||
|
@ -6,7 +6,7 @@ Validation failed
|
|||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability TextureBlockMatchQCOM
|
Capability TextureBlockMatchQCOM
|
||||||
Capability Bad
|
Capability TextureBlockMatch2QCOM
|
||||||
Extension "SPV_QCOM_image_processing"
|
Extension "SPV_QCOM_image_processing"
|
||||||
Extension "SPV_QCOM_image_processing2"
|
Extension "SPV_QCOM_image_processing2"
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
@ -39,7 +39,6 @@ Validation failed
|
|||||||
Decorate 44(tex2D_src1) DecorationBlockMatchTextureQCOM
|
Decorate 44(tex2D_src1) DecorationBlockMatchTextureQCOM
|
||||||
Decorate 48(samp) DecorationBlockMatchSamplerQCOM
|
Decorate 48(samp) DecorationBlockMatchSamplerQCOM
|
||||||
Decorate 53(tex2D_src2) DecorationBlockMatchTextureQCOM
|
Decorate 53(tex2D_src2) DecorationBlockMatchTextureQCOM
|
||||||
Decorate 48(samp) DecorationBlockMatchSamplerQCOM
|
|
||||||
Decorate 61(target_samp) DescriptorSet 0
|
Decorate 61(target_samp) DescriptorSet 0
|
||||||
Decorate 61(target_samp) Binding 4
|
Decorate 61(target_samp) Binding 4
|
||||||
Decorate 64(ref_samp) DescriptorSet 0
|
Decorate 64(ref_samp) DescriptorSet 0
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#version 450
|
#version 450
|
||||||
|
#extension GL_QCOM_image_processing : require
|
||||||
#extension GL_QCOM_image_processing2 : require
|
#extension GL_QCOM_image_processing2 : require
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#version 450
|
#version 450
|
||||||
|
#extension GL_QCOM_image_processing : require
|
||||||
#extension GL_QCOM_image_processing2 : require
|
#extension GL_QCOM_image_processing2 : require
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
Loading…
Reference in New Issue
Block a user