|
@@ -1,7 +1,7 @@
|
|
//
|
|
//
|
|
// Copyright (C) 2014-2016 LunarG, Inc.
|
|
// Copyright (C) 2014-2016 LunarG, Inc.
|
|
// Copyright (C) 2015-2020 Google, Inc.
|
|
// Copyright (C) 2015-2020 Google, Inc.
|
|
-// Copyright (C) 2017 ARM Limited.
|
|
|
|
|
|
+// Copyright (C) 2017, 2022-2024 Arm Limited.
|
|
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
|
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
|
//
|
|
//
|
|
// All rights reserved.
|
|
// All rights reserved.
|
|
@@ -204,7 +204,8 @@ protected:
|
|
spv::Id createBinaryMatrixOperation(spv::Op, OpDecorations&, spv::Id typeId, spv::Id left, spv::Id right);
|
|
spv::Id createBinaryMatrixOperation(spv::Op, OpDecorations&, spv::Id typeId, spv::Id left, spv::Id right);
|
|
spv::Id createUnaryOperation(glslang::TOperator op, OpDecorations&, spv::Id typeId, spv::Id operand,
|
|
spv::Id createUnaryOperation(glslang::TOperator op, OpDecorations&, spv::Id typeId, spv::Id operand,
|
|
glslang::TBasicType typeProxy,
|
|
glslang::TBasicType typeProxy,
|
|
- const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags);
|
|
|
|
|
|
+ const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags,
|
|
|
|
+ const glslang::TType &opType);
|
|
spv::Id createUnaryMatrixOperation(spv::Op op, OpDecorations&, spv::Id typeId, spv::Id operand,
|
|
spv::Id createUnaryMatrixOperation(spv::Op op, OpDecorations&, spv::Id typeId, spv::Id operand,
|
|
glslang::TBasicType typeProxy);
|
|
glslang::TBasicType typeProxy);
|
|
spv::Id createConversion(glslang::TOperator op, OpDecorations&, spv::Id destTypeId, spv::Id operand,
|
|
spv::Id createConversion(glslang::TOperator op, OpDecorations&, spv::Id destTypeId, spv::Id operand,
|
|
@@ -213,7 +214,8 @@ protected:
|
|
spv::Id makeSmearedConstant(spv::Id constant, int vectorSize);
|
|
spv::Id makeSmearedConstant(spv::Id constant, int vectorSize);
|
|
spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId,
|
|
spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId,
|
|
std::vector<spv::Id>& operands, glslang::TBasicType typeProxy,
|
|
std::vector<spv::Id>& operands, glslang::TBasicType typeProxy,
|
|
- const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags);
|
|
|
|
|
|
+ const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags,
|
|
|
|
+ const glslang::TType &opType);
|
|
spv::Id createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& operands,
|
|
spv::Id createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& operands,
|
|
glslang::TBasicType typeProxy);
|
|
glslang::TBasicType typeProxy);
|
|
spv::Id CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation,
|
|
spv::Id CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation,
|
|
@@ -226,6 +228,7 @@ protected:
|
|
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);
|
|
void addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor);
|
|
void addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor);
|
|
|
|
+ void addImageProcessing2QCOMDecoration(spv::Id id, bool isForGather);
|
|
spv::Id createSpvConstant(const glslang::TIntermTyped&);
|
|
spv::Id createSpvConstant(const glslang::TIntermTyped&);
|
|
spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&,
|
|
spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&,
|
|
int& nextConst, bool specConstant);
|
|
int& nextConst, bool specConstant);
|
|
@@ -1163,6 +1166,7 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy
|
|
case glslang::ElfR64i:
|
|
case glslang::ElfR64i:
|
|
builder.addExtension(spv::E_SPV_EXT_shader_image_int64);
|
|
builder.addExtension(spv::E_SPV_EXT_shader_image_int64);
|
|
builder.addCapability(spv::CapabilityInt64ImageEXT);
|
|
builder.addCapability(spv::CapabilityInt64ImageEXT);
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1558,8 +1562,13 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
|
|
this->options.generateDebugInfo = true;
|
|
this->options.generateDebugInfo = true;
|
|
|
|
|
|
if (this->options.generateDebugInfo) {
|
|
if (this->options.generateDebugInfo) {
|
|
- builder.setEmitOpLines();
|
|
|
|
- builder.setSourceFile(glslangIntermediate->getSourceFile());
|
|
|
|
|
|
+ if (this->options.emitNonSemanticShaderDebugInfo) {
|
|
|
|
+ builder.setEmitNonSemanticShaderDebugInfo(this->options.emitNonSemanticShaderDebugSource);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ builder.setEmitSpirvDebugInfo();
|
|
|
|
+ }
|
|
|
|
+ builder.setDebugSourceFile(glslangIntermediate->getSourceFile());
|
|
|
|
|
|
// Set the source shader's text. If for SPV version 1.0, include
|
|
// Set the source shader's text. If for SPV version 1.0, include
|
|
// a preamble in comments stating the OpModuleProcessed instructions.
|
|
// a preamble in comments stating the OpModuleProcessed instructions.
|
|
@@ -1584,9 +1593,6 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
|
|
builder.addInclude(iItr->first, iItr->second);
|
|
builder.addInclude(iItr->first, iItr->second);
|
|
}
|
|
}
|
|
|
|
|
|
- builder.setEmitNonSemanticShaderDebugInfo(this->options.emitNonSemanticShaderDebugInfo);
|
|
|
|
- builder.setEmitNonSemanticShaderDebugSource(this->options.emitNonSemanticShaderDebugSource);
|
|
|
|
-
|
|
|
|
stdBuiltins = builder.import("GLSL.std.450");
|
|
stdBuiltins = builder.import("GLSL.std.450");
|
|
|
|
|
|
spv::AddressingModel addressingModel = spv::AddressingModelLogical;
|
|
spv::AddressingModel addressingModel = spv::AddressingModelLogical;
|
|
@@ -1635,6 +1641,24 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
|
|
builder.addExtension(spv::E_SPV_KHR_subgroup_uniform_control_flow);
|
|
builder.addExtension(spv::E_SPV_KHR_subgroup_uniform_control_flow);
|
|
builder.addExecutionMode(shaderEntry, spv::ExecutionModeSubgroupUniformControlFlowKHR);
|
|
builder.addExecutionMode(shaderEntry, spv::ExecutionModeSubgroupUniformControlFlowKHR);
|
|
}
|
|
}
|
|
|
|
+ if (glslangIntermediate->getMaximallyReconverges()) {
|
|
|
|
+ builder.addExtension(spv::E_SPV_KHR_maximal_reconvergence);
|
|
|
|
+ builder.addExecutionMode(shaderEntry, spv::ExecutionModeMaximallyReconvergesKHR);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (glslangIntermediate->getQuadDerivMode())
|
|
|
|
+ {
|
|
|
|
+ builder.addCapability(spv::CapabilityQuadControlKHR);
|
|
|
|
+ builder.addExtension(spv::E_SPV_KHR_quad_control);
|
|
|
|
+ builder.addExecutionMode(shaderEntry, spv::ExecutionModeQuadDerivativesKHR);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (glslangIntermediate->getReqFullQuadsMode())
|
|
|
|
+ {
|
|
|
|
+ builder.addCapability(spv::CapabilityQuadControlKHR);
|
|
|
|
+ builder.addExtension(spv::E_SPV_KHR_quad_control);
|
|
|
|
+ builder.addExecutionMode(shaderEntry, spv::ExecutionModeRequireFullQuadsKHR);
|
|
|
|
+ }
|
|
|
|
|
|
unsigned int mode;
|
|
unsigned int mode;
|
|
switch (glslangIntermediate->getStage()) {
|
|
switch (glslangIntermediate->getStage()) {
|
|
@@ -2019,7 +2043,9 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
|
|
{
|
|
{
|
|
// We update the line information even though no code might be generated here
|
|
// We update the line information even though no code might be generated here
|
|
// This is helpful to yield correct lines for control flow instructions
|
|
// This is helpful to yield correct lines for control flow instructions
|
|
- builder.setLine(symbol->getLoc().line, symbol->getLoc().getFilename());
|
|
|
|
|
|
+ if (!linkageOnly) {
|
|
|
|
+ builder.setDebugSourceLocation(symbol->getLoc().line, symbol->getLoc().getFilename());
|
|
|
|
+ }
|
|
|
|
|
|
SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder);
|
|
SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder);
|
|
if (symbol->getType().isStruct())
|
|
if (symbol->getType().isStruct())
|
|
@@ -2128,7 +2154,7 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
|
|
|
|
|
|
bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node)
|
|
bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node)
|
|
{
|
|
{
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
if (node->getLeft()->getAsSymbolNode() != nullptr && node->getLeft()->getType().isStruct()) {
|
|
if (node->getLeft()->getAsSymbolNode() != nullptr && node->getLeft()->getType().isStruct()) {
|
|
glslangTypeToIdMap[node->getLeft()->getType().getStruct()] = node->getLeft()->getAsSymbolNode()->getId();
|
|
glslangTypeToIdMap[node->getLeft()->getType().getStruct()] = node->getLeft()->getAsSymbolNode()->getId();
|
|
}
|
|
}
|
|
@@ -2173,7 +2199,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
|
|
spv::Id rValue = accessChainLoad(node->getRight()->getType());
|
|
spv::Id rValue = accessChainLoad(node->getRight()->getType());
|
|
|
|
|
|
// reset line number for assignment
|
|
// reset line number for assignment
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
if (node->getOp() != glslang::EOpAssign) {
|
|
if (node->getOp() != glslang::EOpAssign) {
|
|
// the left is also an r-value
|
|
// the left is also an r-value
|
|
@@ -2506,7 +2532,7 @@ spv::Id TGlslangToSpvTraverser::translateForcedType(spv::Id object)
|
|
|
|
|
|
bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node)
|
|
bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node)
|
|
{
|
|
{
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder);
|
|
SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder);
|
|
if (node->getType().getQualifier().isSpecConstant())
|
|
if (node->getType().getQualifier().isSpecConstant())
|
|
@@ -2670,7 +2696,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
|
|
// if not, then possibly an operation
|
|
// if not, then possibly an operation
|
|
if (! result)
|
|
if (! result)
|
|
result = createUnaryOperation(node->getOp(), decorations, resultType(), operand,
|
|
result = createUnaryOperation(node->getOp(), decorations, resultType(), operand,
|
|
- node->getOperand()->getBasicType(), lvalueCoherentFlags);
|
|
|
|
|
|
+ node->getOperand()->getBasicType(), lvalueCoherentFlags, node->getType());
|
|
|
|
|
|
// it could be attached to a SPIR-V intruction
|
|
// it could be attached to a SPIR-V intruction
|
|
if (!result) {
|
|
if (!result) {
|
|
@@ -2763,6 +2789,11 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
+ case glslang::EOpAssumeEXT:
|
|
|
|
+ builder.addCapability(spv::CapabilityExpectAssumeKHR);
|
|
|
|
+ builder.addExtension(spv::E_SPV_KHR_expect_assume);
|
|
|
|
+ builder.createNoResultOp(spv::OpAssumeTrueKHR, operand);
|
|
|
|
+ return false;
|
|
case glslang::EOpEmitStreamVertex:
|
|
case glslang::EOpEmitStreamVertex:
|
|
builder.createNoResultOp(spv::OpEmitStreamVertex, operand);
|
|
builder.createNoResultOp(spv::OpEmitStreamVertex, operand);
|
|
return false;
|
|
return false;
|
|
@@ -2894,11 +2925,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
return false;
|
|
return false;
|
|
} else {
|
|
} else {
|
|
if (node->getOp() == glslang::EOpScope)
|
|
if (node->getOp() == glslang::EOpScope)
|
|
- builder.enterScope(0);
|
|
|
|
|
|
+ builder.enterLexicalBlock(0);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (sequenceDepth > 1 && node->getOp() == glslang::EOpScope)
|
|
if (sequenceDepth > 1 && node->getOp() == glslang::EOpScope)
|
|
- builder.leaveScope();
|
|
|
|
|
|
+ builder.leaveLexicalBlock();
|
|
--sequenceDepth;
|
|
--sequenceDepth;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2925,6 +2956,9 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
}
|
|
}
|
|
case glslang::EOpFunction:
|
|
case glslang::EOpFunction:
|
|
if (visit == glslang::EvPreVisit) {
|
|
if (visit == glslang::EvPreVisit) {
|
|
|
|
+ if (options.generateDebugInfo) {
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
+ }
|
|
if (isShaderEntryPoint(node)) {
|
|
if (isShaderEntryPoint(node)) {
|
|
inEntryPoint = true;
|
|
inEntryPoint = true;
|
|
builder.setBuildPoint(shaderEntry->getLastBlock());
|
|
builder.setBuildPoint(shaderEntry->getLastBlock());
|
|
@@ -2933,10 +2967,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
} else {
|
|
} else {
|
|
handleFunctionEntry(node);
|
|
handleFunctionEntry(node);
|
|
}
|
|
}
|
|
- if (options.generateDebugInfo) {
|
|
|
|
|
|
+ if (options.generateDebugInfo && !options.emitNonSemanticShaderDebugInfo) {
|
|
const auto& loc = node->getLoc();
|
|
const auto& loc = node->getLoc();
|
|
const char* sourceFileName = loc.getFilename();
|
|
const char* sourceFileName = loc.getFilename();
|
|
- spv::Id sourceFileId = sourceFileName ? builder.getStringId(sourceFileName) : builder.getSourceFile();
|
|
|
|
|
|
+ spv::Id sourceFileId = sourceFileName ? builder.getStringId(sourceFileName) : builder.getMainFileId();
|
|
currentFunction->setDebugLineInfo(sourceFileId, loc.line, loc.column);
|
|
currentFunction->setDebugLineInfo(sourceFileId, loc.line, loc.column);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -2954,7 +2988,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
return false;
|
|
return false;
|
|
case glslang::EOpFunctionCall:
|
|
case glslang::EOpFunctionCall:
|
|
{
|
|
{
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
if (node->isUserDefined())
|
|
if (node->isUserDefined())
|
|
result = handleUserFunctionCall(node);
|
|
result = handleUserFunctionCall(node);
|
|
if (result) {
|
|
if (result) {
|
|
@@ -3020,7 +3054,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
case glslang::EOpConstructF16Mat4x3:
|
|
case glslang::EOpConstructF16Mat4x3:
|
|
case glslang::EOpConstructF16Mat4x4:
|
|
case glslang::EOpConstructF16Mat4x4:
|
|
isMatrix = true;
|
|
isMatrix = true;
|
|
- // fall through
|
|
|
|
|
|
+ [[fallthrough]];
|
|
case glslang::EOpConstructFloat:
|
|
case glslang::EOpConstructFloat:
|
|
case glslang::EOpConstructVec2:
|
|
case glslang::EOpConstructVec2:
|
|
case glslang::EOpConstructVec3:
|
|
case glslang::EOpConstructVec3:
|
|
@@ -3075,7 +3109,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
case glslang::EOpConstructCooperativeMatrixNV:
|
|
case glslang::EOpConstructCooperativeMatrixNV:
|
|
case glslang::EOpConstructCooperativeMatrixKHR:
|
|
case glslang::EOpConstructCooperativeMatrixKHR:
|
|
{
|
|
{
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
std::vector<spv::Id> arguments;
|
|
std::vector<spv::Id> arguments;
|
|
translateArguments(*node, arguments, lvalueCoherentFlags);
|
|
translateArguments(*node, arguments, lvalueCoherentFlags);
|
|
spv::Id constructed;
|
|
spv::Id constructed;
|
|
@@ -3191,7 +3225,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
|
|
|
|
case glslang::EOpAtomicStore:
|
|
case glslang::EOpAtomicStore:
|
|
noReturnValue = true;
|
|
noReturnValue = true;
|
|
- // fallthrough
|
|
|
|
|
|
+ [[fallthrough]];
|
|
case glslang::EOpAtomicLoad:
|
|
case glslang::EOpAtomicLoad:
|
|
atomic = true;
|
|
atomic = true;
|
|
break;
|
|
break;
|
|
@@ -3221,6 +3255,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
binOp = node->getOp();
|
|
binOp = node->getOp();
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+ case glslang::EOpExpectEXT:
|
|
|
|
+ builder.addCapability(spv::CapabilityExpectAssumeKHR);
|
|
|
|
+ builder.addExtension(spv::E_SPV_KHR_expect_assume);
|
|
|
|
+ binOp = node->getOp();
|
|
|
|
+ break;
|
|
|
|
+
|
|
case glslang::EOpIgnoreIntersectionNV:
|
|
case glslang::EOpIgnoreIntersectionNV:
|
|
case glslang::EOpTerminateRayNV:
|
|
case glslang::EOpTerminateRayNV:
|
|
case glslang::EOpTraceNV:
|
|
case glslang::EOpTraceNV:
|
|
@@ -3288,7 +3328,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
case glslang::EOpHitObjectRecordHitWithIndexMotionNV:
|
|
case glslang::EOpHitObjectRecordHitWithIndexMotionNV:
|
|
case glslang::EOpReorderThreadNV:
|
|
case glslang::EOpReorderThreadNV:
|
|
noReturnValue = true;
|
|
noReturnValue = true;
|
|
- //Fallthrough
|
|
|
|
|
|
+ [[fallthrough]];
|
|
case glslang::EOpHitObjectIsEmptyNV:
|
|
case glslang::EOpHitObjectIsEmptyNV:
|
|
case glslang::EOpHitObjectIsMissNV:
|
|
case glslang::EOpHitObjectIsMissNV:
|
|
case glslang::EOpHitObjectIsHitNV:
|
|
case glslang::EOpHitObjectIsHitNV:
|
|
@@ -3331,6 +3371,20 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
builder.addExtension(spv::E_SPV_QCOM_image_processing);
|
|
builder.addExtension(spv::E_SPV_QCOM_image_processing);
|
|
break;
|
|
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::EOpFetchMicroTriangleVertexPositionNV:
|
|
case glslang::EOpFetchMicroTriangleVertexBarycentricNV:
|
|
case glslang::EOpFetchMicroTriangleVertexBarycentricNV:
|
|
builder.addExtension(spv::E_SPV_NV_displacement_micromap);
|
|
builder.addExtension(spv::E_SPV_NV_displacement_micromap);
|
|
@@ -3361,7 +3415,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
right->traverse(this);
|
|
right->traverse(this);
|
|
spv::Id rightId = accessChainLoad(right->getType());
|
|
spv::Id rightId = accessChainLoad(right->getType());
|
|
|
|
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
OpDecorations decorations = { precision,
|
|
OpDecorations decorations = { precision,
|
|
TranslateNoContractionDecoration(node->getType().getQualifier()),
|
|
TranslateNoContractionDecoration(node->getType().getQualifier()),
|
|
TranslateNonUniformDecoration(node->getType().getQualifier()) };
|
|
TranslateNonUniformDecoration(node->getType().getQualifier()) };
|
|
@@ -3596,7 +3650,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
lvalueCoherentFlags = builder.getAccessChain().coherentFlags;
|
|
lvalueCoherentFlags = builder.getAccessChain().coherentFlags;
|
|
lvalueCoherentFlags |= TranslateCoherent(glslangOperands[arg]->getAsTyped()->getType());
|
|
lvalueCoherentFlags |= TranslateCoherent(glslangOperands[arg]->getAsTyped()->getType());
|
|
} else {
|
|
} else {
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
glslang::TOperator glslangOp = node->getOp();
|
|
glslang::TOperator glslangOp = node->getOp();
|
|
if (arg == 1 &&
|
|
if (arg == 1 &&
|
|
(glslangOp == glslang::EOpRayQueryGetIntersectionType ||
|
|
(glslangOp == glslang::EOpRayQueryGetIntersectionType ||
|
|
@@ -3648,7 +3702,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
if (node->getOp() == glslang::EOpCooperativeMatrixLoad ||
|
|
if (node->getOp() == glslang::EOpCooperativeMatrixLoad ||
|
|
node->getOp() == glslang::EOpCooperativeMatrixLoadNV) {
|
|
node->getOp() == glslang::EOpCooperativeMatrixLoadNV) {
|
|
std::vector<spv::IdImmediate> idImmOps;
|
|
std::vector<spv::IdImmediate> idImmOps;
|
|
@@ -3739,7 +3793,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
glslang::TBasicType typeProxy = (node->getOp() == glslang::EOpAtomicStore)
|
|
glslang::TBasicType typeProxy = (node->getOp() == glslang::EOpAtomicStore)
|
|
? node->getSequence()[0]->getAsTyped()->getBasicType() : node->getBasicType();
|
|
? node->getSequence()[0]->getAsTyped()->getBasicType() : node->getBasicType();
|
|
result = createAtomicOperation(node->getOp(), precision, resultType(), operands, typeProxy,
|
|
result = createAtomicOperation(node->getOp(), precision, resultType(), operands, typeProxy,
|
|
- lvalueCoherentFlags);
|
|
|
|
|
|
+ lvalueCoherentFlags, node->getType());
|
|
} else if (node->getOp() == glslang::EOpSpirvInst) {
|
|
} else if (node->getOp() == glslang::EOpSpirvInst) {
|
|
const auto& spirvInst = node->getSpirvInstruction();
|
|
const auto& spirvInst = node->getSpirvInstruction();
|
|
if (spirvInst.set == "") {
|
|
if (spirvInst.set == "") {
|
|
@@ -3786,7 +3840,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|
result = createUnaryOperation(
|
|
result = createUnaryOperation(
|
|
node->getOp(), decorations,
|
|
node->getOp(), decorations,
|
|
resultType(), operands.front(),
|
|
resultType(), operands.front(),
|
|
- glslangOperands[0]->getAsTyped()->getBasicType(), lvalueCoherentFlags);
|
|
|
|
|
|
+ glslangOperands[0]->getAsTyped()->getBasicType(), lvalueCoherentFlags, node->getType());
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
@@ -3888,7 +3942,7 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
|
|
node->getFalseBlock()->traverse(this);
|
|
node->getFalseBlock()->traverse(this);
|
|
spv::Id falseValue = accessChainLoad(node->getFalseBlock()->getAsTyped()->getType());
|
|
spv::Id falseValue = accessChainLoad(node->getFalseBlock()->getAsTyped()->getType());
|
|
|
|
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
// done if void
|
|
// done if void
|
|
if (node->getBasicType() == glslang::EbtVoid)
|
|
if (node->getBasicType() == glslang::EbtVoid)
|
|
@@ -4096,7 +4150,7 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
|
|
// instructions in it, since the body/test may have arbitrary instructions,
|
|
// instructions in it, since the body/test may have arbitrary instructions,
|
|
// including merges of its own.
|
|
// including merges of its own.
|
|
builder.setBuildPoint(&blocks.head);
|
|
builder.setBuildPoint(&blocks.head);
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, control, operands);
|
|
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, control, operands);
|
|
if (node->testFirst() && node->getTest()) {
|
|
if (node->testFirst() && node->getTest()) {
|
|
spv::Block& test = builder.makeNewBlock();
|
|
spv::Block& test = builder.makeNewBlock();
|
|
@@ -4119,7 +4173,7 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
|
|
node->getTerminal()->traverse(this);
|
|
node->getTerminal()->traverse(this);
|
|
builder.createBranch(&blocks.head);
|
|
builder.createBranch(&blocks.head);
|
|
} else {
|
|
} else {
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
builder.createBranch(&blocks.body);
|
|
builder.createBranch(&blocks.body);
|
|
|
|
|
|
breakForLoop.push(true);
|
|
breakForLoop.push(true);
|
|
@@ -4154,7 +4208,7 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T
|
|
if (node->getExpression())
|
|
if (node->getExpression())
|
|
node->getExpression()->traverse(this);
|
|
node->getExpression()->traverse(this);
|
|
|
|
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
switch (node->getFlowOp()) {
|
|
switch (node->getFlowOp()) {
|
|
case glslang::EOpKill:
|
|
case glslang::EOpKill:
|
|
@@ -5738,7 +5792,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
|
if (! node->isImage() && ! node->isTexture())
|
|
if (! node->isImage() && ! node->isTexture())
|
|
return spv::NoResult;
|
|
return spv::NoResult;
|
|
|
|
|
|
- builder.setLine(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
+ builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
|
|
|
|
|
|
// Process a GLSL texturing op (will be SPV image)
|
|
// Process a GLSL texturing op (will be SPV image)
|
|
|
|
|
|
@@ -6041,7 +6095,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
|
operands.push_back(*opIt);
|
|
operands.push_back(*opIt);
|
|
|
|
|
|
return createAtomicOperation(node->getOp(), precision, resultType(), operands, typeProxy,
|
|
return createAtomicOperation(node->getOp(), precision, resultType(), operands, typeProxy,
|
|
- lvalueCoherentFlags);
|
|
|
|
|
|
+ lvalueCoherentFlags, node->getType());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -6566,6 +6620,10 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD
|
|
binOp = isUnsigned ? spv::OpUMul32x16INTEL : spv::OpIMul32x16INTEL;
|
|
binOp = isUnsigned ? spv::OpUMul32x16INTEL : spv::OpIMul32x16INTEL;
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+ case glslang::EOpExpectEXT:
|
|
|
|
+ binOp = spv::OpExpectKHR;
|
|
|
|
+ break;
|
|
|
|
+
|
|
case glslang::EOpLessThan:
|
|
case glslang::EOpLessThan:
|
|
case glslang::EOpGreaterThan:
|
|
case glslang::EOpGreaterThan:
|
|
case glslang::EOpLessThanEqual:
|
|
case glslang::EOpLessThanEqual:
|
|
@@ -6788,7 +6846,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, OpDecora
|
|
}
|
|
}
|
|
|
|
|
|
spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDecorations& decorations, spv::Id typeId,
|
|
spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDecorations& decorations, spv::Id typeId,
|
|
- spv::Id operand, glslang::TBasicType typeProxy, const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags)
|
|
|
|
|
|
+ spv::Id operand, glslang::TBasicType typeProxy, const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags,
|
|
|
|
+ const glslang::TType &opType)
|
|
{
|
|
{
|
|
spv::Op unaryOp = spv::OpNop;
|
|
spv::Op unaryOp = spv::OpNop;
|
|
int extBuiltins = -1;
|
|
int extBuiltins = -1;
|
|
@@ -7076,7 +7135,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe
|
|
// Handle all of the atomics in one place, in createAtomicOperation()
|
|
// Handle all of the atomics in one place, in createAtomicOperation()
|
|
std::vector<spv::Id> operands;
|
|
std::vector<spv::Id> operands;
|
|
operands.push_back(operand);
|
|
operands.push_back(operand);
|
|
- return createAtomicOperation(op, decorations.precision, typeId, operands, typeProxy, lvalueCoherentFlags);
|
|
|
|
|
|
+ return createAtomicOperation(op, decorations.precision, typeId, operands, typeProxy, lvalueCoherentFlags, opType);
|
|
}
|
|
}
|
|
|
|
|
|
case glslang::EOpBitFieldReverse:
|
|
case glslang::EOpBitFieldReverse:
|
|
@@ -7169,7 +7228,9 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe
|
|
case glslang::EOpSubgroupExclusiveXor:
|
|
case glslang::EOpSubgroupExclusiveXor:
|
|
case glslang::EOpSubgroupQuadSwapHorizontal:
|
|
case glslang::EOpSubgroupQuadSwapHorizontal:
|
|
case glslang::EOpSubgroupQuadSwapVertical:
|
|
case glslang::EOpSubgroupQuadSwapVertical:
|
|
- case glslang::EOpSubgroupQuadSwapDiagonal: {
|
|
|
|
|
|
+ case glslang::EOpSubgroupQuadSwapDiagonal:
|
|
|
|
+ case glslang::EOpSubgroupQuadAll:
|
|
|
|
+ case glslang::EOpSubgroupQuadAny: {
|
|
std::vector<spv::Id> operands;
|
|
std::vector<spv::Id> operands;
|
|
operands.push_back(operand);
|
|
operands.push_back(operand);
|
|
return createSubgroupOperation(op, typeId, operands, typeProxy);
|
|
return createSubgroupOperation(op, typeId, operands, typeProxy);
|
|
@@ -7792,7 +7853,7 @@ spv::Id TGlslangToSpvTraverser::makeSmearedConstant(spv::Id constant, int vector
|
|
// For glslang ops that map to SPV atomic opCodes
|
|
// For glslang ops that map to SPV atomic opCodes
|
|
spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv::Decoration /*precision*/,
|
|
spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv::Decoration /*precision*/,
|
|
spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy,
|
|
spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy,
|
|
- const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags)
|
|
|
|
|
|
+ const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags, const glslang::TType &opType)
|
|
{
|
|
{
|
|
spv::Op opCode = spv::OpNop;
|
|
spv::Op opCode = spv::OpNop;
|
|
|
|
|
|
@@ -7803,14 +7864,20 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
|
opCode = spv::OpAtomicIAdd;
|
|
opCode = spv::OpAtomicIAdd;
|
|
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
|
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
|
opCode = spv::OpAtomicFAddEXT;
|
|
opCode = spv::OpAtomicFAddEXT;
|
|
- builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_add);
|
|
|
|
- if (typeProxy == glslang::EbtFloat16) {
|
|
|
|
- builder.addExtension(spv::E_SPV_EXT_shader_atomic_float16_add);
|
|
|
|
- builder.addCapability(spv::CapabilityAtomicFloat16AddEXT);
|
|
|
|
- } else if (typeProxy == glslang::EbtFloat) {
|
|
|
|
- builder.addCapability(spv::CapabilityAtomicFloat32AddEXT);
|
|
|
|
|
|
+ if (typeProxy == glslang::EbtFloat16 &&
|
|
|
|
+ (opType.getVectorSize() == 2 || opType.getVectorSize() == 4)) {
|
|
|
|
+ builder.addExtension(spv::E_SPV_NV_shader_atomic_fp16_vector);
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat16VectorNV);
|
|
} else {
|
|
} else {
|
|
- builder.addCapability(spv::CapabilityAtomicFloat64AddEXT);
|
|
|
|
|
|
+ builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_add);
|
|
|
|
+ if (typeProxy == glslang::EbtFloat16) {
|
|
|
|
+ builder.addExtension(spv::E_SPV_EXT_shader_atomic_float16_add);
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat16AddEXT);
|
|
|
|
+ } else if (typeProxy == glslang::EbtFloat) {
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat32AddEXT);
|
|
|
|
+ } else {
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat64AddEXT);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -7823,13 +7890,19 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
|
case glslang::EOpAtomicCounterMin:
|
|
case glslang::EOpAtomicCounterMin:
|
|
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
|
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
|
opCode = spv::OpAtomicFMinEXT;
|
|
opCode = spv::OpAtomicFMinEXT;
|
|
- builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_min_max);
|
|
|
|
- if (typeProxy == glslang::EbtFloat16)
|
|
|
|
- builder.addCapability(spv::CapabilityAtomicFloat16MinMaxEXT);
|
|
|
|
- else if (typeProxy == glslang::EbtFloat)
|
|
|
|
- builder.addCapability(spv::CapabilityAtomicFloat32MinMaxEXT);
|
|
|
|
- else
|
|
|
|
- builder.addCapability(spv::CapabilityAtomicFloat64MinMaxEXT);
|
|
|
|
|
|
+ if (typeProxy == glslang::EbtFloat16 &&
|
|
|
|
+ (opType.getVectorSize() == 2 || opType.getVectorSize() == 4)) {
|
|
|
|
+ builder.addExtension(spv::E_SPV_NV_shader_atomic_fp16_vector);
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat16VectorNV);
|
|
|
|
+ } else {
|
|
|
|
+ builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_min_max);
|
|
|
|
+ if (typeProxy == glslang::EbtFloat16)
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat16MinMaxEXT);
|
|
|
|
+ else if (typeProxy == glslang::EbtFloat)
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat32MinMaxEXT);
|
|
|
|
+ else
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat64MinMaxEXT);
|
|
|
|
+ }
|
|
} else if (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) {
|
|
} else if (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) {
|
|
opCode = spv::OpAtomicUMin;
|
|
opCode = spv::OpAtomicUMin;
|
|
} else {
|
|
} else {
|
|
@@ -7841,13 +7914,19 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
|
case glslang::EOpAtomicCounterMax:
|
|
case glslang::EOpAtomicCounterMax:
|
|
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
|
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
|
opCode = spv::OpAtomicFMaxEXT;
|
|
opCode = spv::OpAtomicFMaxEXT;
|
|
- builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_min_max);
|
|
|
|
- if (typeProxy == glslang::EbtFloat16)
|
|
|
|
- builder.addCapability(spv::CapabilityAtomicFloat16MinMaxEXT);
|
|
|
|
- else if (typeProxy == glslang::EbtFloat)
|
|
|
|
- builder.addCapability(spv::CapabilityAtomicFloat32MinMaxEXT);
|
|
|
|
- else
|
|
|
|
- builder.addCapability(spv::CapabilityAtomicFloat64MinMaxEXT);
|
|
|
|
|
|
+ if (typeProxy == glslang::EbtFloat16 &&
|
|
|
|
+ (opType.getVectorSize() == 2 || opType.getVectorSize() == 4)) {
|
|
|
|
+ builder.addExtension(spv::E_SPV_NV_shader_atomic_fp16_vector);
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat16VectorNV);
|
|
|
|
+ } else {
|
|
|
|
+ builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_min_max);
|
|
|
|
+ if (typeProxy == glslang::EbtFloat16)
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat16MinMaxEXT);
|
|
|
|
+ else if (typeProxy == glslang::EbtFloat)
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat32MinMaxEXT);
|
|
|
|
+ else
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat64MinMaxEXT);
|
|
|
|
+ }
|
|
} else if (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) {
|
|
} else if (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) {
|
|
opCode = spv::OpAtomicUMax;
|
|
opCode = spv::OpAtomicUMax;
|
|
} else {
|
|
} else {
|
|
@@ -7872,6 +7951,12 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
|
case glslang::EOpAtomicExchange:
|
|
case glslang::EOpAtomicExchange:
|
|
case glslang::EOpImageAtomicExchange:
|
|
case glslang::EOpImageAtomicExchange:
|
|
case glslang::EOpAtomicCounterExchange:
|
|
case glslang::EOpAtomicCounterExchange:
|
|
|
|
+ if ((typeProxy == glslang::EbtFloat16) &&
|
|
|
|
+ (opType.getVectorSize() == 2 || opType.getVectorSize() == 4)) {
|
|
|
|
+ builder.addExtension(spv::E_SPV_NV_shader_atomic_fp16_vector);
|
|
|
|
+ builder.addCapability(spv::CapabilityAtomicFloat16VectorNV);
|
|
|
|
+ }
|
|
|
|
+
|
|
opCode = spv::OpAtomicExchange;
|
|
opCode = spv::OpAtomicExchange;
|
|
break;
|
|
break;
|
|
case glslang::EOpAtomicCompSwap:
|
|
case glslang::EOpAtomicCompSwap:
|
|
@@ -8274,6 +8359,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
|
case glslang::EOpSubgroupElect:
|
|
case glslang::EOpSubgroupElect:
|
|
builder.addCapability(spv::CapabilityGroupNonUniform);
|
|
builder.addCapability(spv::CapabilityGroupNonUniform);
|
|
break;
|
|
break;
|
|
|
|
+ case glslang::EOpSubgroupQuadAll:
|
|
|
|
+ case glslang::EOpSubgroupQuadAny:
|
|
|
|
+ builder.addExtension(spv::E_SPV_KHR_quad_control);
|
|
|
|
+ builder.addCapability(spv::CapabilityQuadControlKHR);
|
|
|
|
+ [[fallthrough]];
|
|
case glslang::EOpSubgroupAll:
|
|
case glslang::EOpSubgroupAll:
|
|
case glslang::EOpSubgroupAny:
|
|
case glslang::EOpSubgroupAny:
|
|
case glslang::EOpSubgroupAllEqual:
|
|
case glslang::EOpSubgroupAllEqual:
|
|
@@ -8293,6 +8383,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
|
builder.addCapability(spv::CapabilityGroupNonUniform);
|
|
builder.addCapability(spv::CapabilityGroupNonUniform);
|
|
builder.addCapability(spv::CapabilityGroupNonUniformBallot);
|
|
builder.addCapability(spv::CapabilityGroupNonUniformBallot);
|
|
break;
|
|
break;
|
|
|
|
+ case glslang::EOpSubgroupRotate:
|
|
|
|
+ case glslang::EOpSubgroupClusteredRotate:
|
|
|
|
+ builder.addExtension(spv::E_SPV_KHR_subgroup_rotate);
|
|
|
|
+ builder.addCapability(spv::CapabilityGroupNonUniformRotateKHR);
|
|
|
|
+ break;
|
|
case glslang::EOpSubgroupShuffle:
|
|
case glslang::EOpSubgroupShuffle:
|
|
case glslang::EOpSubgroupShuffleXor:
|
|
case glslang::EOpSubgroupShuffleXor:
|
|
builder.addCapability(spv::CapabilityGroupNonUniform);
|
|
builder.addCapability(spv::CapabilityGroupNonUniform);
|
|
@@ -8381,7 +8476,9 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
|
// Figure out which opcode to use.
|
|
// Figure out which opcode to use.
|
|
switch (op) {
|
|
switch (op) {
|
|
case glslang::EOpSubgroupElect: opCode = spv::OpGroupNonUniformElect; break;
|
|
case glslang::EOpSubgroupElect: opCode = spv::OpGroupNonUniformElect; break;
|
|
|
|
+ case glslang::EOpSubgroupQuadAll: opCode = spv::OpGroupNonUniformQuadAllKHR; break;
|
|
case glslang::EOpSubgroupAll: opCode = spv::OpGroupNonUniformAll; break;
|
|
case glslang::EOpSubgroupAll: opCode = spv::OpGroupNonUniformAll; break;
|
|
|
|
+ case glslang::EOpSubgroupQuadAny: opCode = spv::OpGroupNonUniformQuadAnyKHR; break;
|
|
case glslang::EOpSubgroupAny: opCode = spv::OpGroupNonUniformAny; break;
|
|
case glslang::EOpSubgroupAny: opCode = spv::OpGroupNonUniformAny; break;
|
|
case glslang::EOpSubgroupAllEqual: opCode = spv::OpGroupNonUniformAllEqual; break;
|
|
case glslang::EOpSubgroupAllEqual: opCode = spv::OpGroupNonUniformAllEqual; break;
|
|
case glslang::EOpSubgroupBroadcast: opCode = spv::OpGroupNonUniformBroadcast; break;
|
|
case glslang::EOpSubgroupBroadcast: opCode = spv::OpGroupNonUniformBroadcast; break;
|
|
@@ -8398,6 +8495,8 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
|
case glslang::EOpSubgroupShuffleXor: opCode = spv::OpGroupNonUniformShuffleXor; break;
|
|
case glslang::EOpSubgroupShuffleXor: opCode = spv::OpGroupNonUniformShuffleXor; break;
|
|
case glslang::EOpSubgroupShuffleUp: opCode = spv::OpGroupNonUniformShuffleUp; break;
|
|
case glslang::EOpSubgroupShuffleUp: opCode = spv::OpGroupNonUniformShuffleUp; break;
|
|
case glslang::EOpSubgroupShuffleDown: opCode = spv::OpGroupNonUniformShuffleDown; break;
|
|
case glslang::EOpSubgroupShuffleDown: opCode = spv::OpGroupNonUniformShuffleDown; break;
|
|
|
|
+ case glslang::EOpSubgroupRotate:
|
|
|
|
+ case glslang::EOpSubgroupClusteredRotate: opCode = spv::OpGroupNonUniformRotateKHR; break;
|
|
case glslang::EOpSubgroupAdd:
|
|
case glslang::EOpSubgroupAdd:
|
|
case glslang::EOpSubgroupInclusiveAdd:
|
|
case glslang::EOpSubgroupInclusiveAdd:
|
|
case glslang::EOpSubgroupExclusiveAdd:
|
|
case glslang::EOpSubgroupExclusiveAdd:
|
|
@@ -8578,7 +8677,10 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
|
|
|
|
|
|
// Every operation begins with the Execution Scope operand.
|
|
// Every operation begins with the Execution Scope operand.
|
|
spv::IdImmediate executionScope = { true, builder.makeUintConstant(spv::ScopeSubgroup) };
|
|
spv::IdImmediate executionScope = { true, builder.makeUintConstant(spv::ScopeSubgroup) };
|
|
- spvGroupOperands.push_back(executionScope);
|
|
|
|
|
|
+ // All other ops need the execution scope. Quad Control Ops don't need scope, it's always Quad.
|
|
|
|
+ if (opCode != spv::OpGroupNonUniformQuadAllKHR && opCode != spv::OpGroupNonUniformQuadAnyKHR) {
|
|
|
|
+ spvGroupOperands.push_back(executionScope);
|
|
|
|
+ }
|
|
|
|
|
|
// Next, for all operations that use a Group Operation, push that as an operand.
|
|
// Next, for all operations that use a Group Operation, push that as an operand.
|
|
if (groupOperation != spv::GroupOperationMax) {
|
|
if (groupOperation != spv::GroupOperationMax) {
|
|
@@ -8821,6 +8923,8 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
|
case glslang::EOpSubgroupShuffleXor:
|
|
case glslang::EOpSubgroupShuffleXor:
|
|
case glslang::EOpSubgroupShuffleUp:
|
|
case glslang::EOpSubgroupShuffleUp:
|
|
case glslang::EOpSubgroupShuffleDown:
|
|
case glslang::EOpSubgroupShuffleDown:
|
|
|
|
+ case glslang::EOpSubgroupRotate:
|
|
|
|
+ case glslang::EOpSubgroupClusteredRotate:
|
|
case glslang::EOpSubgroupClusteredAdd:
|
|
case glslang::EOpSubgroupClusteredAdd:
|
|
case glslang::EOpSubgroupClusteredMul:
|
|
case glslang::EOpSubgroupClusteredMul:
|
|
case glslang::EOpSubgroupClusteredMin:
|
|
case glslang::EOpSubgroupClusteredMin:
|
|
@@ -9179,6 +9283,30 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
|
opCode = spv::OpFetchMicroTriangleVertexPositionNV;
|
|
opCode = spv::OpFetchMicroTriangleVertexPositionNV;
|
|
break;
|
|
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:
|
|
default:
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -9699,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,
|
|
// Make a full tree of instructions to build a SPIR-V specialization constant,
|
|
// or regular constant if possible.
|
|
// or regular constant if possible.
|
|
//
|
|
//
|
|
@@ -10064,7 +10222,6 @@ spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name)
|
|
if (extBuiltinMap.find(name) != extBuiltinMap.end())
|
|
if (extBuiltinMap.find(name) != extBuiltinMap.end())
|
|
return extBuiltinMap[name];
|
|
return extBuiltinMap[name];
|
|
else {
|
|
else {
|
|
- builder.addExtension(name);
|
|
|
|
spv::Id extBuiltins = builder.import(name);
|
|
spv::Id extBuiltins = builder.import(name);
|
|
extBuiltinMap[name] = extBuiltins;
|
|
extBuiltinMap[name] = extBuiltins;
|
|
return extBuiltins;
|
|
return extBuiltins;
|