summaryrefslogtreecommitdiff
path: root/thirdparty/glslang/SPIRV
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/glslang/SPIRV')
-rw-r--r--thirdparty/glslang/SPIRV/GlslangToSpv.cpp219
-rw-r--r--thirdparty/glslang/SPIRV/SPVRemapper.cpp18
-rw-r--r--thirdparty/glslang/SPIRV/SpvBuilder.cpp31
-rw-r--r--thirdparty/glslang/SPIRV/SpvBuilder.h1
-rw-r--r--thirdparty/glslang/SPIRV/SpvPostProcess.cpp39
-rw-r--r--thirdparty/glslang/SPIRV/SpvTools.cpp2
-rw-r--r--thirdparty/glslang/SPIRV/disassemble.cpp47
-rw-r--r--thirdparty/glslang/SPIRV/doc.cpp6
-rw-r--r--thirdparty/glslang/SPIRV/spirv.hpp209
-rw-r--r--thirdparty/glslang/SPIRV/spvIR.h22
10 files changed, 140 insertions, 454 deletions
diff --git a/thirdparty/glslang/SPIRV/GlslangToSpv.cpp b/thirdparty/glslang/SPIRV/GlslangToSpv.cpp
index 39941d3752..c323bcdb09 100644
--- a/thirdparty/glslang/SPIRV/GlslangToSpv.cpp
+++ b/thirdparty/glslang/SPIRV/GlslangToSpv.cpp
@@ -1256,10 +1256,8 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
if (type.getBasicType() == glslang::EbtRayQuery)
return spv::StorageClassPrivate;
#ifndef GLSLANG_WEB
- if (type.getQualifier().isSpirvByReference()) {
- if (type.getQualifier().isParamInput() || type.getQualifier().isParamOutput())
- return spv::StorageClassFunction;
- }
+ if (type.getQualifier().isSpirvByReference())
+ return spv::StorageClassFunction;
#endif
if (type.getQualifier().isPipeInput())
return spv::StorageClassInput;
@@ -1664,22 +1662,9 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
case EShLangCompute:
builder.addCapability(spv::CapabilityShader);
- if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
- std::vector<spv::Id> dimConstId;
- for (int dim = 0; dim < 3; ++dim) {
- bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet);
- dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst));
- if (specConst) {
- builder.addDecoration(dimConstId.back(), spv::DecorationSpecId,
- glslangIntermediate->getLocalSizeSpecId(dim));
- }
- }
- builder.addExecutionModeId(shaderEntry, spv::ExecutionModeLocalSizeId, dimConstId);
- } else {
- builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
- glslangIntermediate->getLocalSize(1),
- glslangIntermediate->getLocalSize(2));
- }
+ builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
+ glslangIntermediate->getLocalSize(1),
+ glslangIntermediate->getLocalSize(2));
if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) {
builder.addCapability(spv::CapabilityComputeDerivativeGroupQuadsNV);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupQuadsNV);
@@ -1783,22 +1768,9 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
case EShLangMeshNV:
builder.addCapability(spv::CapabilityMeshShadingNV);
builder.addExtension(spv::E_SPV_NV_mesh_shader);
- if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
- std::vector<spv::Id> dimConstId;
- for (int dim = 0; dim < 3; ++dim) {
- bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet);
- dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst));
- if (specConst) {
- builder.addDecoration(dimConstId.back(), spv::DecorationSpecId,
- glslangIntermediate->getLocalSizeSpecId(dim));
- }
- }
- builder.addExecutionModeId(shaderEntry, spv::ExecutionModeLocalSizeId, dimConstId);
- } else {
- builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
- glslangIntermediate->getLocalSize(1),
- glslangIntermediate->getLocalSize(2));
- }
+ builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
+ glslangIntermediate->getLocalSize(1),
+ glslangIntermediate->getLocalSize(2));
if (glslangIntermediate->getStage() == EShLangMeshNV) {
builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices,
glslangIntermediate->getVertices());
@@ -1858,10 +1830,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
std::vector<spv::Id> operandIds;
assert(!modeId.second.empty());
for (auto extraOperand : modeId.second) {
- if (extraOperand->getType().getQualifier().isSpecConstant())
- operandIds.push_back(getSymbolId(extraOperand->getAsSymbolNode()));
- else
- operandIds.push_back(createSpvConstant(*extraOperand));
+ int nextConst = 0;
+ spv::Id operandId = createSpvConstantFromConstUnionArray(
+ extraOperand->getType(), extraOperand->getConstArray(), nextConst, false);
+ operandIds.push_back(operandId);
}
builder.addExecutionModeId(shaderEntry, static_cast<spv::ExecutionMode>(modeId.first), operandIds);
}
@@ -3412,7 +3384,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
const auto& spirvInst = node->getSpirvInstruction();
if (spirvInst.set == "") {
std::vector<spv::IdImmediate> idImmOps;
- for (unsigned int i = 0; i < glslangOperands.size(); ++i) {
+ for (int i = 0; i < glslangOperands.size(); ++i) {
if (glslangOperands[i]->getAsTyped()->getQualifier().isSpirvLiteral()) {
// Translate the constant to a literal value
std::vector<unsigned> literals;
@@ -3805,16 +3777,7 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T
switch (node->getFlowOp()) {
case glslang::EOpKill:
- if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
- if (glslangIntermediate->getSource() == glslang::EShSourceHlsl) {
- builder.addCapability(spv::CapabilityDemoteToHelperInvocation);
- builder.createNoResultOp(spv::OpDemoteToHelperInvocationEXT);
- } else {
- builder.makeStatementTerminator(spv::OpTerminateInvocation, "post-terminate-invocation");
- }
- } else {
- builder.makeStatementTerminator(spv::OpKill, "post-discard");
- }
+ builder.makeStatementTerminator(spv::OpKill, "post-discard");
break;
case glslang::EOpTerminateInvocation:
builder.addExtension(spv::E_SPV_KHR_terminate_invocation);
@@ -3977,14 +3940,12 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler)
builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float_fetch);
builder.addCapability(spv::CapabilityFloat16ImageAMD);
return builder.makeFloatType(16);
- case glslang::EbtInt64:
+ case glslang::EbtInt64: return builder.makeIntType(64);
builder.addExtension(spv::E_SPV_EXT_shader_image_int64);
- builder.addCapability(spv::CapabilityInt64ImageEXT);
- return builder.makeIntType(64);
- case glslang::EbtUint64:
+ builder.addCapability(spv::CapabilityFloat16ImageAMD);
+ case glslang::EbtUint64: return builder.makeUintType(64);
builder.addExtension(spv::E_SPV_EXT_shader_image_int64);
- builder.addCapability(spv::CapabilityInt64ImageEXT);
- return builder.makeUintType(64);
+ builder.addCapability(spv::CapabilityFloat16ImageAMD);
#endif
default:
assert(0);
@@ -4185,55 +4146,68 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
const auto& spirvType = type.getSpirvType();
const auto& spirvInst = spirvType.spirvInst;
- std::vector<spv::IdImmediate> operands;
+ std::vector<spv::Id> operands;
for (const auto& typeParam : spirvType.typeParams) {
- // Constant expression
- if (typeParam.constant->isLiteral()) {
- if (typeParam.constant->getBasicType() == glslang::EbtFloat) {
- float floatValue = static_cast<float>(typeParam.constant->getConstArray()[0].getDConst());
- unsigned literal = *reinterpret_cast<unsigned*>(&floatValue);
- operands.push_back({false, literal});
- } else if (typeParam.constant->getBasicType() == glslang::EbtInt) {
- unsigned literal = typeParam.constant->getConstArray()[0].getIConst();
- operands.push_back({false, literal});
- } else if (typeParam.constant->getBasicType() == glslang::EbtUint) {
- unsigned literal = typeParam.constant->getConstArray()[0].getUConst();
- operands.push_back({false, literal});
- } else if (typeParam.constant->getBasicType() == glslang::EbtBool) {
- unsigned literal = typeParam.constant->getConstArray()[0].getBConst();
- operands.push_back({false, literal});
- } else if (typeParam.constant->getBasicType() == glslang::EbtString) {
- auto str = typeParam.constant->getConstArray()[0].getSConst()->c_str();
- unsigned literal = 0;
- char* literalPtr = reinterpret_cast<char*>(&literal);
- unsigned charCount = 0;
- char ch = 0;
- do {
- ch = *(str++);
- *(literalPtr++) = ch;
- ++charCount;
- if (charCount == 4) {
- operands.push_back({false, literal});
- literalPtr = reinterpret_cast<char*>(&literal);
- charCount = 0;
- }
- } while (ch != 0);
+ if (typeParam.isConstant) {
+ // Constant expression
+ if (typeParam.constant->isLiteral()) {
+ if (typeParam.constant->getBasicType() == glslang::EbtFloat) {
+ float floatValue = static_cast<float>(typeParam.constant->getConstArray()[0].getDConst());
+ unsigned literal = *reinterpret_cast<unsigned*>(&floatValue);
+ operands.push_back(literal);
+ } else if (typeParam.constant->getBasicType() == glslang::EbtInt) {
+ unsigned literal = typeParam.constant->getConstArray()[0].getIConst();
+ operands.push_back(literal);
+ } else if (typeParam.constant->getBasicType() == glslang::EbtUint) {
+ unsigned literal = typeParam.constant->getConstArray()[0].getUConst();
+ operands.push_back(literal);
+ } else if (typeParam.constant->getBasicType() == glslang::EbtBool) {
+ unsigned literal = typeParam.constant->getConstArray()[0].getBConst();
+ operands.push_back(literal);
+ } else if (typeParam.constant->getBasicType() == glslang::EbtString) {
+ auto str = typeParam.constant->getConstArray()[0].getSConst()->c_str();
+ unsigned literal = 0;
+ char* literalPtr = reinterpret_cast<char*>(&literal);
+ unsigned charCount = 0;
+ char ch = 0;
+ do {
+ ch = *(str++);
+ *(literalPtr++) = ch;
+ ++charCount;
+ if (charCount == 4) {
+ operands.push_back(literal);
+ literalPtr = reinterpret_cast<char*>(&literal);
+ charCount = 0;
+ }
+ } while (ch != 0);
- // Partial literal is padded with 0
- if (charCount > 0) {
- for (; charCount < 4; ++charCount)
- *(literalPtr++) = 0;
- operands.push_back({false, literal});
- }
- } else
- assert(0); // Unexpected type
- } else
- operands.push_back({true, createSpvConstant(*typeParam.constant)});
+ // Partial literal is padded with 0
+ if (charCount > 0) {
+ for (; charCount < 4; ++charCount)
+ *(literalPtr++) = 0;
+ operands.push_back(literal);
+ }
+ } else
+ assert(0); // Unexpected type
+ } else {
+ int nextConst = 0;
+ spv::Id constant = createSpvConstantFromConstUnionArray(
+ typeParam.constant->getType(), typeParam.constant->getConstArray(), nextConst, false);
+ operands.push_back(constant);
+ }
+ } else {
+ // Type specifier
+ spv::Id typeId = convertGlslangToSpvType(*typeParam.type);
+ operands.push_back(typeId);
+ }
}
- assert(spirvInst.set == ""); // Currently, couldn't be extended instructions.
- spvType = builder.makeGenericType(static_cast<spv::Op>(spirvInst.id), operands);
-
+ if (spirvInst.set == "")
+ spvType = builder.createOp(static_cast<spv::Op>(spirvInst.id), spv::NoType, operands);
+ else {
+ spvType = builder.createBuiltinCall(
+ spv::NoType, getExtBuiltins(spirvInst.set.c_str()), spirvInst.id, operands);
+ }
break;
}
#endif
@@ -7532,8 +7506,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
break;
case glslang::EOpReadFirstInvocation:
opCode = spv::OpSubgroupFirstInvocationKHR;
- if (builder.isVectorType(typeId))
- return CreateInvocationsVectorOperation(opCode, groupOperation, typeId, operands);
break;
case glslang::EOpBallot:
{
@@ -7658,7 +7630,7 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv
assert(op == spv::OpGroupFMin || op == spv::OpGroupUMin || op == spv::OpGroupSMin ||
op == spv::OpGroupFMax || op == spv::OpGroupUMax || op == spv::OpGroupSMax ||
op == spv::OpGroupFAdd || op == spv::OpGroupIAdd || op == spv::OpGroupBroadcast ||
- op == spv::OpSubgroupReadInvocationKHR || op == spv::OpSubgroupFirstInvocationKHR ||
+ op == spv::OpSubgroupReadInvocationKHR ||
op == spv::OpGroupFMinNonUniformAMD || op == spv::OpGroupUMinNonUniformAMD ||
op == spv::OpGroupSMinNonUniformAMD ||
op == spv::OpGroupFMaxNonUniformAMD || op == spv::OpGroupUMaxNonUniformAMD ||
@@ -7687,8 +7659,6 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv
spvGroupOperands.push_back(scalar);
spv::IdImmediate operand = { true, operands[1] };
spvGroupOperands.push_back(operand);
- } else if (op == spv::OpSubgroupFirstInvocationKHR) {
- spvGroupOperands.push_back(scalar);
} else if (op == spv::OpGroupBroadcast) {
spv::IdImmediate scope = { true, builder.makeUintConstant(spv::ScopeSubgroup) };
spvGroupOperands.push_back(scope);
@@ -8751,18 +8721,8 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutOffset);
}
- if (symbol->getQualifier().hasLocation()) {
- if (!(glslangIntermediate->isRayTracingStage() && glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_ray_tracing)
- && (builder.getStorageClass(id) == spv::StorageClassRayPayloadKHR ||
- builder.getStorageClass(id) == spv::StorageClassIncomingRayPayloadKHR ||
- builder.getStorageClass(id) == spv::StorageClassCallableDataKHR ||
- builder.getStorageClass(id) == spv::StorageClassIncomingCallableDataKHR))) {
- // Location values are used to link TraceRayKHR and ExecuteCallableKHR to corresponding variables
- // but are not valid in SPIRV since they are supported only for Input/Output Storage classes.
- builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation);
- }
- }
-
+ if (symbol->getQualifier().hasLocation())
+ builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation);
builder.addDecoration(id, TranslateInvariantDecoration(symbol->getType().getQualifier()));
if (symbol->getQualifier().hasStream() && glslangIntermediate->isMultiStream()) {
builder.addCapability(spv::CapabilityGeometryStreams);
@@ -8796,16 +8756,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
// add built-in variable decoration
if (builtIn != spv::BuiltInMax) {
- // WorkgroupSize deprecated in spirv1.6
- if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_6 ||
- builtIn != spv::BuiltInWorkgroupSize)
- builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn);
- }
-
- // Add volatile decoration to HelperInvocation for spirv1.6 and beyond
- if (builtIn == spv::BuiltInHelperInvocation &&
- glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
- builder.addDecoration(id, spv::DecorationVolatile);
+ builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn);
}
#ifndef GLSLANG_WEB
@@ -8890,12 +8841,12 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
std::vector<spv::Id> operandIds;
assert(!decorateId.second.empty());
for (auto extraOperand : decorateId.second) {
- if (extraOperand->getQualifier().isSpecConstant())
- operandIds.push_back(getSymbolId(extraOperand->getAsSymbolNode()));
- else
- operandIds.push_back(createSpvConstant(*extraOperand));
+ int nextConst = 0;
+ spv::Id operandId = createSpvConstantFromConstUnionArray(
+ extraOperand->getType(), extraOperand->getConstArray(), nextConst, false);
+ operandIds.push_back(operandId);
}
- builder.addDecorationId(id, static_cast<spv::Decoration>(decorateId.first), operandIds);
+ builder.addDecoration(id, static_cast<spv::Decoration>(decorateId.first), operandIds);
}
// Add spirv_decorate_string
diff --git a/thirdparty/glslang/SPIRV/SPVRemapper.cpp b/thirdparty/glslang/SPIRV/SPVRemapper.cpp
index fdfbeb90cd..56d6d5d4a5 100644
--- a/thirdparty/glslang/SPIRV/SPVRemapper.cpp
+++ b/thirdparty/glslang/SPIRV/SPVRemapper.cpp
@@ -297,21 +297,15 @@ namespace spv {
std::string spirvbin_t::literalString(unsigned word) const
{
std::string literal;
- const spirword_t * pos = spv.data() + word;
literal.reserve(16);
- do {
- spirword_t word = *pos;
- for (int i = 0; i < 4; i++) {
- char c = word & 0xff;
- if (c == '\0')
- return literal;
- literal += c;
- word >>= 8;
- }
- pos++;
- } while (true);
+ const char* bytes = reinterpret_cast<const char*>(spv.data() + word);
+
+ while (bytes && *bytes)
+ literal += *bytes++;
+
+ return literal;
}
void spirvbin_t::applyMap()
diff --git a/thirdparty/glslang/SPIRV/SpvBuilder.cpp b/thirdparty/glslang/SPIRV/SpvBuilder.cpp
index 36a3f09744..e83306ebcb 100644
--- a/thirdparty/glslang/SPIRV/SpvBuilder.cpp
+++ b/thirdparty/glslang/SPIRV/SpvBuilder.cpp
@@ -427,37 +427,6 @@ Id Builder::makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols)
return type->getResultId();
}
-Id Builder::makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands)
-{
- // try to find it
- Instruction* type;
- for (int t = 0; t < (int)groupedTypes[opcode].size(); ++t) {
- type = groupedTypes[opcode][t];
- if (static_cast<size_t>(type->getNumOperands()) != operands.size())
- continue; // Number mismatch, find next
-
- bool match = true;
- for (int op = 0; match && op < (int)operands.size(); ++op) {
- match = (operands[op].isId ? type->getIdOperand(op) : type->getImmediateOperand(op)) == operands[op].word;
- }
- if (match)
- return type->getResultId();
- }
-
- // not found, make it
- type = new Instruction(getUniqueId(), NoType, opcode);
- for (size_t op = 0; op < operands.size(); ++op) {
- if (operands[op].isId)
- type->addIdOperand(operands[op].word);
- else
- type->addImmediateOperand(operands[op].word);
- }
- groupedTypes[opcode].push_back(type);
- constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
- module.mapInstruction(type);
-
- return type->getResultId();
-}
// TODO: performance: track arrays per stride
// If a stride is supplied (non-zero) make an array.
diff --git a/thirdparty/glslang/SPIRV/SpvBuilder.h b/thirdparty/glslang/SPIRV/SpvBuilder.h
index c72d9b287e..251b9ee823 100644
--- a/thirdparty/glslang/SPIRV/SpvBuilder.h
+++ b/thirdparty/glslang/SPIRV/SpvBuilder.h
@@ -181,7 +181,6 @@ public:
Id makeSamplerType();
Id makeSampledImageType(Id imageType);
Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols);
- Id makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands);
// accelerationStructureNV type
Id makeAccelerationStructureType();
diff --git a/thirdparty/glslang/SPIRV/SpvPostProcess.cpp b/thirdparty/glslang/SPIRV/SpvPostProcess.cpp
index dd6dabce0d..23d7b5a461 100644
--- a/thirdparty/glslang/SPIRV/SpvPostProcess.cpp
+++ b/thirdparty/glslang/SPIRV/SpvPostProcess.cpp
@@ -44,8 +44,10 @@
#include <algorithm>
#include "SpvBuilder.h"
-#include "spirv.hpp"
+#include "spirv.hpp"
+#include "GlslangToSpv.h"
+#include "SpvBuilder.h"
namespace spv {
#include "GLSL.std.450.h"
#include "GLSL.ext.KHR.h"
@@ -111,6 +113,8 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
}
}
break;
+ case OpAccessChain:
+ case OpPtrAccessChain:
case OpCopyObject:
break;
case OpFConvert:
@@ -157,43 +161,26 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
switch (inst.getImmediateOperand(1)) {
case GLSLstd450Frexp:
case GLSLstd450FrexpStruct:
- if (getSpvVersion() < spv::Spv_1_3 && containsType(typeId, OpTypeInt, 16))
+ if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeInt, 16))
addExtension(spv::E_SPV_AMD_gpu_shader_int16);
break;
case GLSLstd450InterpolateAtCentroid:
case GLSLstd450InterpolateAtSample:
case GLSLstd450InterpolateAtOffset:
- if (getSpvVersion() < spv::Spv_1_3 && containsType(typeId, OpTypeFloat, 16))
+ if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeFloat, 16))
addExtension(spv::E_SPV_AMD_gpu_shader_half_float);
break;
default:
break;
}
break;
- case OpAccessChain:
- case OpPtrAccessChain:
- if (isPointerType(typeId))
- break;
- if (basicTypeOp == OpTypeInt) {
- if (width == 16)
- addCapability(CapabilityInt16);
- else if (width == 8)
- addCapability(CapabilityInt8);
- }
default:
- if (basicTypeOp == OpTypeInt) {
- if (width == 16)
- addCapability(CapabilityInt16);
- else if (width == 8)
- addCapability(CapabilityInt8);
- else if (width == 64)
- addCapability(CapabilityInt64);
- } else if (basicTypeOp == OpTypeFloat) {
- if (width == 16)
- addCapability(CapabilityFloat16);
- else if (width == 64)
- addCapability(CapabilityFloat64);
- }
+ if (basicTypeOp == OpTypeFloat && width == 16)
+ addCapability(CapabilityFloat16);
+ if (basicTypeOp == OpTypeInt && width == 16)
+ addCapability(CapabilityInt16);
+ if (basicTypeOp == OpTypeInt && width == 8)
+ addCapability(CapabilityInt8);
break;
}
}
diff --git a/thirdparty/glslang/SPIRV/SpvTools.cpp b/thirdparty/glslang/SPIRV/SpvTools.cpp
index e8f825119a..8acf9b139a 100644
--- a/thirdparty/glslang/SPIRV/SpvTools.cpp
+++ b/thirdparty/glslang/SPIRV/SpvTools.cpp
@@ -68,8 +68,6 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
}
case glslang::EShTargetVulkan_1_2:
return spv_target_env::SPV_ENV_VULKAN_1_2;
- case glslang::EShTargetVulkan_1_3:
- return spv_target_env::SPV_ENV_VULKAN_1_3;
default:
break;
}
diff --git a/thirdparty/glslang/SPIRV/disassemble.cpp b/thirdparty/glslang/SPIRV/disassemble.cpp
index 74dd605409..73c988c5b3 100644
--- a/thirdparty/glslang/SPIRV/disassemble.cpp
+++ b/thirdparty/glslang/SPIRV/disassemble.cpp
@@ -43,7 +43,6 @@
#include <stack>
#include <sstream>
#include <cstring>
-#include <utility>
#include "disassemble.h"
#include "doc.h"
@@ -101,7 +100,6 @@ protected:
void outputMask(OperandClass operandClass, unsigned mask);
void disassembleImmediates(int numOperands);
void disassembleIds(int numOperands);
- std::pair<int, std::string> decodeString();
int disassembleString();
void disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands);
@@ -292,44 +290,31 @@ void SpirvStream::disassembleIds(int numOperands)
}
}
-// decode string from words at current position (non-consuming)
-std::pair<int, std::string> SpirvStream::decodeString()
+// return the number of operands consumed by the string
+int SpirvStream::disassembleString()
{
- std::string res;
- int wordPos = word;
- char c;
- bool done = false;
+ int startWord = word;
+
+ out << " \"";
+ const char* wordString;
+ bool done = false;
do {
- unsigned int content = stream[wordPos];
+ unsigned int content = stream[word];
+ wordString = (const char*)&content;
for (int charCount = 0; charCount < 4; ++charCount) {
- c = content & 0xff;
- content >>= 8;
- if (c == '\0') {
+ if (*wordString == 0) {
done = true;
break;
}
- res += c;
+ out << *(wordString++);
}
- ++wordPos;
- } while(! done);
-
- return std::make_pair(wordPos - word, res);
-}
-
-// return the number of operands consumed by the string
-int SpirvStream::disassembleString()
-{
- out << " \"";
-
- std::pair<int, std::string> decoderes = decodeString();
+ ++word;
+ } while (! done);
- out << decoderes.second;
out << "\"";
- word += decoderes.first;
-
- return decoderes.first;
+ return word - startWord;
}
void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
@@ -346,7 +331,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
nextNestedControl = 0;
}
} else if (opCode == OpExtInstImport) {
- idDescriptor[resultId] = decodeString().second;
+ idDescriptor[resultId] = (const char*)(&stream[word]);
}
else {
if (resultId != 0 && idDescriptor[resultId].size() == 0) {
@@ -443,7 +428,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
--numOperands;
// Get names for printing "(XXX)" for readability, *after* this id
if (opCode == OpName)
- idDescriptor[stream[word - 1]] = decodeString().second;
+ idDescriptor[stream[word - 1]] = (const char*)(&stream[word]);
break;
case OperandVariableIds:
disassembleIds(numOperands);
diff --git a/thirdparty/glslang/SPIRV/doc.cpp b/thirdparty/glslang/SPIRV/doc.cpp
index 9a569e0d7f..dbdf7077a6 100644
--- a/thirdparty/glslang/SPIRV/doc.cpp
+++ b/thirdparty/glslang/SPIRV/doc.cpp
@@ -900,12 +900,6 @@ const char* CapabilityString(int info)
case CapabilityDeviceGroup: return "DeviceGroup";
case CapabilityMultiView: return "MultiView";
- case CapabilityDenormPreserve: return "DenormPreserve";
- case CapabilityDenormFlushToZero: return "DenormFlushToZero";
- case CapabilitySignedZeroInfNanPreserve: return "SignedZeroInfNanPreserve";
- case CapabilityRoundingModeRTE: return "RoundingModeRTE";
- case CapabilityRoundingModeRTZ: return "RoundingModeRTZ";
-
case CapabilityStencilExportEXT: return "StencilExportEXT";
case CapabilityFloat16ImageAMD: return "Float16ImageAMD";
diff --git a/thirdparty/glslang/SPIRV/spirv.hpp b/thirdparty/glslang/SPIRV/spirv.hpp
index 3d500ebbd9..e0fe24980d 100644
--- a/thirdparty/glslang/SPIRV/spirv.hpp
+++ b/thirdparty/glslang/SPIRV/spirv.hpp
@@ -49,12 +49,12 @@ namespace spv {
typedef unsigned int Id;
-#define SPV_VERSION 0x10600
-#define SPV_REVISION 1
+#define SPV_VERSION 0x10500
+#define SPV_REVISION 4
static const unsigned int MagicNumber = 0x07230203;
-static const unsigned int Version = 0x00010600;
-static const unsigned int Revision = 1;
+static const unsigned int Version = 0x00010500;
+static const unsigned int Revision = 4;
static const unsigned int OpCodeMask = 0xffff;
static const unsigned int WordCountShift = 16;
@@ -65,7 +65,6 @@ enum SourceLanguage {
SourceLanguageOpenCL_C = 3,
SourceLanguageOpenCL_CPP = 4,
SourceLanguageHLSL = 5,
- SourceLanguageCPP_for_OpenCL = 6,
SourceLanguageMax = 0x7fffffff,
};
@@ -353,8 +352,6 @@ enum ImageOperandsShift {
ImageOperandsVolatileTexelKHRShift = 11,
ImageOperandsSignExtendShift = 12,
ImageOperandsZeroExtendShift = 13,
- ImageOperandsNontemporalShift = 14,
- ImageOperandsOffsetsShift = 16,
ImageOperandsMax = 0x7fffffff,
};
@@ -378,8 +375,6 @@ enum ImageOperandsMask {
ImageOperandsVolatileTexelKHRMask = 0x00000800,
ImageOperandsSignExtendMask = 0x00001000,
ImageOperandsZeroExtendMask = 0x00002000,
- ImageOperandsNontemporalMask = 0x00004000,
- ImageOperandsOffsetsMask = 0x00010000,
};
enum FPFastMathModeShift {
@@ -496,7 +491,6 @@ enum Decoration {
DecorationPerPrimitiveNV = 5271,
DecorationPerViewNV = 5272,
DecorationPerTaskNV = 5273,
- DecorationPerVertexKHR = 5285,
DecorationPerVertexNV = 5285,
DecorationNonUniform = 5300,
DecorationNonUniformEXT = 5300,
@@ -504,10 +498,6 @@ enum Decoration {
DecorationRestrictPointerEXT = 5355,
DecorationAliasedPointer = 5356,
DecorationAliasedPointerEXT = 5356,
- DecorationBindlessSamplerNV = 5398,
- DecorationBindlessImageNV = 5399,
- DecorationBoundSamplerNV = 5400,
- DecorationBoundImageNV = 5401,
DecorationSIMTCallINTEL = 5599,
DecorationReferencedIndirectlyINTEL = 5602,
DecorationClobberINTEL = 5607,
@@ -547,7 +537,6 @@ enum Decoration {
DecorationFunctionFloatingPointModeINTEL = 6080,
DecorationSingleElementVectorINTEL = 6085,
DecorationVectorComputeCallableFunctionINTEL = 6087,
- DecorationMediaBlockIOINTEL = 6140,
DecorationMax = 0x7fffffff,
};
@@ -632,9 +621,7 @@ enum BuiltIn {
BuiltInLayerPerViewNV = 5279,
BuiltInMeshViewCountNV = 5280,
BuiltInMeshViewIndicesNV = 5281,
- BuiltInBaryCoordKHR = 5286,
BuiltInBaryCoordNV = 5286,
- BuiltInBaryCoordNoPerspKHR = 5287,
BuiltInBaryCoordNoPerspNV = 5287,
BuiltInFragSizeEXT = 5292,
BuiltInFragmentSizeNV = 5292,
@@ -735,7 +722,6 @@ enum FunctionControlShift {
FunctionControlDontInlineShift = 1,
FunctionControlPureShift = 2,
FunctionControlConstShift = 3,
- FunctionControlOptNoneINTELShift = 16,
FunctionControlMax = 0x7fffffff,
};
@@ -745,7 +731,6 @@ enum FunctionControlMask {
FunctionControlDontInlineMask = 0x00000002,
FunctionControlPureMask = 0x00000004,
FunctionControlConstMask = 0x00000008,
- FunctionControlOptNoneINTELMask = 0x00010000,
};
enum MemorySemanticsShift {
@@ -926,7 +911,6 @@ enum Capability {
CapabilityGroupNonUniformQuad = 68,
CapabilityShaderLayer = 69,
CapabilityShaderViewportIndex = 70,
- CapabilityUniformDecoration = 71,
CapabilityFragmentShadingRateKHR = 4422,
CapabilitySubgroupBallotKHR = 4423,
CapabilityDrawParameters = 4427,
@@ -975,7 +959,6 @@ enum Capability {
CapabilityFragmentFullyCoveredEXT = 5265,
CapabilityMeshShadingNV = 5266,
CapabilityImageFootprintNV = 5282,
- CapabilityFragmentBarycentricKHR = 5284,
CapabilityFragmentBarycentricNV = 5284,
CapabilityComputeDerivativeGroupQuadsNV = 5288,
CapabilityFragmentDensityEXT = 5291,
@@ -1020,9 +1003,7 @@ enum Capability {
CapabilityFragmentShaderShadingRateInterlockEXT = 5372,
CapabilityShaderSMBuiltinsNV = 5373,
CapabilityFragmentShaderPixelInterlockEXT = 5378,
- CapabilityDemoteToHelperInvocation = 5379,
CapabilityDemoteToHelperInvocationEXT = 5379,
- CapabilityBindlessTextureNV = 5390,
CapabilitySubgroupShuffleINTEL = 5568,
CapabilitySubgroupBufferBlockIOINTEL = 5569,
CapabilitySubgroupImageBlockIOINTEL = 5570,
@@ -1047,7 +1028,6 @@ enum Capability {
CapabilityFPGAMemoryAttributesINTEL = 5824,
CapabilityFPFastMathModeINTEL = 5837,
CapabilityArbitraryPrecisionIntegersINTEL = 5844,
- CapabilityArbitraryPrecisionFloatingPointINTEL = 5845,
CapabilityUnstructuredLoopControlsINTEL = 5886,
CapabilityFPGALoopControlsINTEL = 5888,
CapabilityKernelAttributesINTEL = 5892,
@@ -1056,26 +1036,14 @@ enum Capability {
CapabilityFPGAClusterAttributesINTEL = 5904,
CapabilityLoopFuseINTEL = 5906,
CapabilityFPGABufferLocationINTEL = 5920,
- CapabilityArbitraryPrecisionFixedPointINTEL = 5922,
CapabilityUSMStorageClassesINTEL = 5935,
CapabilityIOPipesINTEL = 5943,
CapabilityBlockingPipesINTEL = 5945,
CapabilityFPGARegINTEL = 5948,
- CapabilityDotProductInputAll = 6016,
- CapabilityDotProductInputAllKHR = 6016,
- CapabilityDotProductInput4x8Bit = 6017,
- CapabilityDotProductInput4x8BitKHR = 6017,
- CapabilityDotProductInput4x8BitPacked = 6018,
- CapabilityDotProductInput4x8BitPackedKHR = 6018,
- CapabilityDotProduct = 6019,
- CapabilityDotProductKHR = 6019,
- CapabilityBitInstructions = 6025,
CapabilityAtomicFloat32AddEXT = 6033,
CapabilityAtomicFloat64AddEXT = 6034,
CapabilityLongConstantCompositeINTEL = 6089,
- CapabilityOptNoneINTEL = 6094,
CapabilityAtomicFloat16AddEXT = 6095,
- CapabilityDebugInfoModuleINTEL = 6114,
CapabilityMax = 0x7fffffff,
};
@@ -1154,32 +1122,6 @@ enum FPOperationMode {
FPOperationModeMax = 0x7fffffff,
};
-enum QuantizationModes {
- QuantizationModesTRN = 0,
- QuantizationModesTRN_ZERO = 1,
- QuantizationModesRND = 2,
- QuantizationModesRND_ZERO = 3,
- QuantizationModesRND_INF = 4,
- QuantizationModesRND_MIN_INF = 5,
- QuantizationModesRND_CONV = 6,
- QuantizationModesRND_CONV_ODD = 7,
- QuantizationModesMax = 0x7fffffff,
-};
-
-enum OverflowModes {
- OverflowModesWRAP = 0,
- OverflowModesSAT = 1,
- OverflowModesSAT_ZERO = 2,
- OverflowModesSAT_SYM = 3,
- OverflowModesMax = 0x7fffffff,
-};
-
-enum PackedVectorFormat {
- PackedVectorFormatPackedVectorFormat4x8Bit = 0,
- PackedVectorFormatPackedVectorFormat4x8BitKHR = 0,
- PackedVectorFormatMax = 0x7fffffff,
-};
-
enum Op {
OpNop = 0,
OpUndef = 1,
@@ -1537,18 +1479,6 @@ enum Op {
OpConvertUToAccelerationStructureKHR = 4447,
OpIgnoreIntersectionKHR = 4448,
OpTerminateRayKHR = 4449,
- OpSDot = 4450,
- OpSDotKHR = 4450,
- OpUDot = 4451,
- OpUDotKHR = 4451,
- OpSUDot = 4452,
- OpSUDotKHR = 4452,
- OpSDotAccSat = 4453,
- OpSDotAccSatKHR = 4453,
- OpUDotAccSat = 4454,
- OpUDotAccSatKHR = 4454,
- OpSUDotAccSat = 4455,
- OpSUDotAccSatKHR = 4455,
OpTypeRayQueryKHR = 4472,
OpRayQueryInitializeKHR = 4473,
OpRayQueryTerminateKHR = 4474,
@@ -1587,16 +1517,8 @@ enum Op {
OpCooperativeMatrixLengthNV = 5362,
OpBeginInvocationInterlockEXT = 5364,
OpEndInvocationInterlockEXT = 5365,
- OpDemoteToHelperInvocation = 5380,
OpDemoteToHelperInvocationEXT = 5380,
OpIsHelperInvocationEXT = 5381,
- OpConvertUToImageNV = 5391,
- OpConvertUToSamplerNV = 5392,
- OpConvertImageToUNV = 5393,
- OpConvertSamplerToUNV = 5394,
- OpConvertUToSampledImageNV = 5395,
- OpConvertSampledImageToUNV = 5396,
- OpSamplerImageAddressingModeNV = 5397,
OpSubgroupShuffleINTEL = 5571,
OpSubgroupShuffleDownINTEL = 5572,
OpSubgroupShuffleUpINTEL = 5573,
@@ -1621,7 +1543,7 @@ enum Op {
OpUSubSatINTEL = 5596,
OpIMul32x16INTEL = 5597,
OpUMul32x16INTEL = 5598,
- OpConstantFunctionPointerINTEL = 5600,
+ OpConstFunctionPointerINTEL = 5600,
OpFunctionPointerCallINTEL = 5601,
OpAsmTargetINTEL = 5609,
OpAsmINTEL = 5610,
@@ -1755,59 +1677,7 @@ enum Op {
OpVariableLengthArrayINTEL = 5818,
OpSaveMemoryINTEL = 5819,
OpRestoreMemoryINTEL = 5820,
- OpArbitraryFloatSinCosPiINTEL = 5840,
- OpArbitraryFloatCastINTEL = 5841,
- OpArbitraryFloatCastFromIntINTEL = 5842,
- OpArbitraryFloatCastToIntINTEL = 5843,
- OpArbitraryFloatAddINTEL = 5846,
- OpArbitraryFloatSubINTEL = 5847,
- OpArbitraryFloatMulINTEL = 5848,
- OpArbitraryFloatDivINTEL = 5849,
- OpArbitraryFloatGTINTEL = 5850,
- OpArbitraryFloatGEINTEL = 5851,
- OpArbitraryFloatLTINTEL = 5852,
- OpArbitraryFloatLEINTEL = 5853,
- OpArbitraryFloatEQINTEL = 5854,
- OpArbitraryFloatRecipINTEL = 5855,
- OpArbitraryFloatRSqrtINTEL = 5856,
- OpArbitraryFloatCbrtINTEL = 5857,
- OpArbitraryFloatHypotINTEL = 5858,
- OpArbitraryFloatSqrtINTEL = 5859,
- OpArbitraryFloatLogINTEL = 5860,
- OpArbitraryFloatLog2INTEL = 5861,
- OpArbitraryFloatLog10INTEL = 5862,
- OpArbitraryFloatLog1pINTEL = 5863,
- OpArbitraryFloatExpINTEL = 5864,
- OpArbitraryFloatExp2INTEL = 5865,
- OpArbitraryFloatExp10INTEL = 5866,
- OpArbitraryFloatExpm1INTEL = 5867,
- OpArbitraryFloatSinINTEL = 5868,
- OpArbitraryFloatCosINTEL = 5869,
- OpArbitraryFloatSinCosINTEL = 5870,
- OpArbitraryFloatSinPiINTEL = 5871,
- OpArbitraryFloatCosPiINTEL = 5872,
- OpArbitraryFloatASinINTEL = 5873,
- OpArbitraryFloatASinPiINTEL = 5874,
- OpArbitraryFloatACosINTEL = 5875,
- OpArbitraryFloatACosPiINTEL = 5876,
- OpArbitraryFloatATanINTEL = 5877,
- OpArbitraryFloatATanPiINTEL = 5878,
- OpArbitraryFloatATan2INTEL = 5879,
- OpArbitraryFloatPowINTEL = 5880,
- OpArbitraryFloatPowRINTEL = 5881,
- OpArbitraryFloatPowNINTEL = 5882,
OpLoopControlINTEL = 5887,
- OpFixedSqrtINTEL = 5923,
- OpFixedRecipINTEL = 5924,
- OpFixedRsqrtINTEL = 5925,
- OpFixedSinINTEL = 5926,
- OpFixedCosINTEL = 5927,
- OpFixedSinCosINTEL = 5928,
- OpFixedSinPiINTEL = 5929,
- OpFixedCosPiINTEL = 5930,
- OpFixedSinCosPiINTEL = 5931,
- OpFixedLogINTEL = 5932,
- OpFixedExpINTEL = 5933,
OpPtrCastToCrossWorkgroupINTEL = 5934,
OpCrossWorkgroupCastToPtrINTEL = 5938,
OpReadPipeBlockingINTEL = 5946,
@@ -2199,12 +2069,6 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break;
case OpIgnoreIntersectionKHR: *hasResult = false; *hasResultType = false; break;
case OpTerminateRayKHR: *hasResult = false; *hasResultType = false; break;
- case OpSDot: *hasResult = true; *hasResultType = true; break;
- case OpUDot: *hasResult = true; *hasResultType = true; break;
- case OpSUDot: *hasResult = true; *hasResultType = true; break;
- case OpSDotAccSat: *hasResult = true; *hasResultType = true; break;
- case OpUDotAccSat: *hasResult = true; *hasResultType = true; break;
- case OpSUDotAccSat: *hasResult = true; *hasResultType = true; break;
case OpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break;
case OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break;
case OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break;
@@ -2241,15 +2105,8 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpCooperativeMatrixLengthNV: *hasResult = true; *hasResultType = true; break;
case OpBeginInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break;
case OpEndInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break;
- case OpDemoteToHelperInvocation: *hasResult = false; *hasResultType = false; break;
+ case OpDemoteToHelperInvocationEXT: *hasResult = false; *hasResultType = false; break;
case OpIsHelperInvocationEXT: *hasResult = true; *hasResultType = true; break;
- case OpConvertUToImageNV: *hasResult = true; *hasResultType = true; break;
- case OpConvertUToSamplerNV: *hasResult = true; *hasResultType = true; break;
- case OpConvertImageToUNV: *hasResult = true; *hasResultType = true; break;
- case OpConvertSamplerToUNV: *hasResult = true; *hasResultType = true; break;
- case OpConvertUToSampledImageNV: *hasResult = true; *hasResultType = true; break;
- case OpConvertSampledImageToUNV: *hasResult = true; *hasResultType = true; break;
- case OpSamplerImageAddressingModeNV: *hasResult = false; *hasResultType = false; break;
case OpSubgroupShuffleINTEL: *hasResult = true; *hasResultType = true; break;
case OpSubgroupShuffleDownINTEL: *hasResult = true; *hasResultType = true; break;
case OpSubgroupShuffleUpINTEL: *hasResult = true; *hasResultType = true; break;
@@ -2274,7 +2131,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpUSubSatINTEL: *hasResult = true; *hasResultType = true; break;
case OpIMul32x16INTEL: *hasResult = true; *hasResultType = true; break;
case OpUMul32x16INTEL: *hasResult = true; *hasResultType = true; break;
- case OpConstantFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break;
+ case OpConstFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break;
case OpFunctionPointerCallINTEL: *hasResult = true; *hasResultType = true; break;
case OpAsmTargetINTEL: *hasResult = true; *hasResultType = true; break;
case OpAsmINTEL: *hasResult = true; *hasResultType = true; break;
@@ -2406,59 +2263,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break;
case OpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break;
case OpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break;
- case OpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatLog1pINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatExpINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatExp2INTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatExp10INTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatExpm1INTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatSinINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatCosINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatSinCosINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatSinPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatCosPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatASinINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatASinPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatACosINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatACosPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatATanINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatATanPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatATan2INTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatPowINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break;
- case OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break;
case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break;
- case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedSinINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedCosINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedLogINTEL: *hasResult = true; *hasResultType = true; break;
- case OpFixedExpINTEL: *hasResult = true; *hasResultType = true; break;
case OpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break;
case OpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break;
case OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break;
diff --git a/thirdparty/glslang/SPIRV/spvIR.h b/thirdparty/glslang/SPIRV/spvIR.h
index 5249a5ba73..486e80d000 100644
--- a/thirdparty/glslang/SPIRV/spvIR.h
+++ b/thirdparty/glslang/SPIRV/spvIR.h
@@ -111,23 +111,27 @@ public:
void addStringOperand(const char* str)
{
- unsigned int word = 0;
- unsigned int shiftAmount = 0;
+ unsigned int word;
+ char* wordString = (char*)&word;
+ char* wordPtr = wordString;
+ int charCount = 0;
char c;
-
do {
c = *(str++);
- word |= ((unsigned int)c) << shiftAmount;
- shiftAmount += 8;
- if (shiftAmount == 32) {
+ *(wordPtr++) = c;
+ ++charCount;
+ if (charCount == 4) {
addImmediateOperand(word);
- word = 0;
- shiftAmount = 0;
+ wordPtr = wordString;
+ charCount = 0;
}
} while (c != 0);
// deal with partial last word
- if (shiftAmount > 0) {
+ if (charCount > 0) {
+ // pad with 0s
+ for (; charCount < 4; ++charCount)
+ *(wordPtr++) = 0;
addImmediateOperand(word);
}
}