Updated glslang.

This commit is contained in:
Бранимир Караџић 2023-01-14 18:26:29 -08:00
parent 466c6a4e95
commit 3d65c8d8a1
57 changed files with 7433 additions and 5709 deletions

View File

@ -102,7 +102,7 @@ bool InitThread()
return false;
}
if (OS_GetTLSValue(ThreadInitializeIndex) != 0)
if (OS_GetTLSValue(ThreadInitializeIndex) != nullptr)
return true;
if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) {
@ -130,8 +130,8 @@ bool DetachThread()
//
// Function is re-entrant and this thread may not have been initialized.
//
if (OS_GetTLSValue(ThreadInitializeIndex) != 0) {
if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) {
if (OS_GetTLSValue(ThreadInitializeIndex) != nullptr) {
if (!OS_SetTLSValue(ThreadInitializeIndex, nullptr)) {
assert(0 && "DetachThread(): Unable to clear init flag.");
success = false;
}

35
3rdparty/glslang/SPIRV/GLSL.ext.ARM.h vendored Normal file
View File

@ -0,0 +1,35 @@
/*
** Copyright (c) 2022 ARM Limited
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
** to deal in the Materials without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Materials, and to permit persons to whom the
** Materials are furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Materials.
**
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
** IN THE MATERIALS.
*/
#ifndef GLSLextARM_H
#define GLSLextARM_H
static const int GLSLextARMVersion = 100;
static const int GLSLextARMRevision = 1;
static const char * const E_SPV_ARM_core_builtins = "SPV_ARM_core_builtins";
#endif // #ifndef GLSLextARM_H

View File

@ -81,4 +81,7 @@ const char* const E_SPV_NV_cooperative_matrix = "SPV_NV_cooperative_matrix";
//SPV_NV_shader_sm_builtins
const char* const E_SPV_NV_shader_sm_builtins = "SPV_NV_shader_sm_builtins";
//SPV_NV_shader_execution_reorder
const char* const E_SPV_NV_shader_invocation_reorder = "SPV_NV_shader_invocation_reorder";
#endif // #ifndef GLSLextNV_H

View File

@ -49,6 +49,7 @@ namespace spv {
#include "GLSL.ext.EXT.h"
#include "GLSL.ext.AMD.h"
#include "GLSL.ext.NV.h"
#include "GLSL.ext.ARM.h"
#include "NonSemanticDebugPrintf.h"
}
@ -277,12 +278,10 @@ protected:
// requiring local translation to and from SPIR-V type on every access.
// Maps <builtin-variable-id -> AST-required-type-id>
std::unordered_map<spv::Id, spv::Id> forceType;
// Used later for generating OpTraceKHR/OpExecuteCallableKHR
std::unordered_map<unsigned int, glslang::TIntermSymbol *> locationToSymbol[2];
// Used by Task shader while generating opearnds for OpEmitMeshTasksEXT
spv::Id taskPayloadID;
// Used later for generating OpTraceKHR/OpExecuteCallableKHR/OpHitObjectRecordHit*/OpHitObjectGetShaderBindingTableData
std::unordered_map<unsigned int, glslang::TIntermSymbol *> locationToSymbol[4];
};
//
@ -391,6 +390,7 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useSto
case glslang::EvqHitAttr: return spv::DecorationBlock;
case glslang::EvqCallableData: return spv::DecorationBlock;
case glslang::EvqCallableDataIn: return spv::DecorationBlock;
case glslang::EvqHitObjectAttrNV: return spv::DecorationBlock;
#endif
default:
assert(0);
@ -468,6 +468,7 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T
case glslang::EvqHitAttr:
case glslang::EvqCallableData:
case glslang::EvqCallableDataIn:
case glslang::EvqHitObjectAttrNV:
return spv::DecorationMax;
#endif
default:
@ -1106,6 +1107,28 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
builder.addExtension(spv::E_SPV_NV_shader_sm_builtins);
builder.addCapability(spv::CapabilityShaderSMBuiltinsNV);
return spv::BuiltInSMIDNV;
// ARM builtins
case glslang::EbvCoreCountARM:
builder.addExtension(spv::E_SPV_ARM_core_builtins);
builder.addCapability(spv::CapabilityCoreBuiltinsARM);
return spv::BuiltInCoreCountARM;
case glslang::EbvCoreIDARM:
builder.addExtension(spv::E_SPV_ARM_core_builtins);
builder.addCapability(spv::CapabilityCoreBuiltinsARM);
return spv::BuiltInCoreIDARM;
case glslang::EbvCoreMaxIDARM:
builder.addExtension(spv::E_SPV_ARM_core_builtins);
builder.addCapability(spv::CapabilityCoreBuiltinsARM);
return spv::BuiltInCoreMaxIDARM;
case glslang::EbvWarpIDARM:
builder.addExtension(spv::E_SPV_ARM_core_builtins);
builder.addCapability(spv::CapabilityCoreBuiltinsARM);
return spv::BuiltInWarpIDARM;
case glslang::EbvWarpMaxIDARM:
builder.addExtension(spv::E_SPV_ARM_core_builtins);
builder.addCapability(spv::CapabilityCoreBuiltinsARM);
return spv::BuiltInWarpMaxIDARM;
#endif
default:
@ -1276,7 +1299,7 @@ spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(const glslang:
// Translate glslang type to SPIR-V storage class.
spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::TType& type)
{
if (type.getBasicType() == glslang::EbtRayQuery)
if (type.getBasicType() == glslang::EbtRayQuery || type.getBasicType() == glslang::EbtHitObjectNV)
return spv::StorageClassPrivate;
#ifndef GLSLANG_WEB
if (type.getQualifier().isSpirvByReference()) {
@ -1293,7 +1316,7 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
type.getQualifier().storage == glslang::EvqUniform) {
if (type.isAtomic())
return spv::StorageClassAtomicCounter;
if (type.containsOpaque())
if (type.containsOpaque() && !glslangIntermediate->getBindlessMode())
return spv::StorageClassUniformConstant;
}
@ -1333,6 +1356,7 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
case glslang::EvqCallableData: return spv::StorageClassCallableDataKHR;
case glslang::EvqCallableDataIn: return spv::StorageClassIncomingCallableDataKHR;
case glslang::EvqtaskPayloadSharedEXT : return spv::StorageClassTaskPayloadWorkgroupEXT;
case glslang::EvqHitObjectAttrNV: return spv::StorageClassHitObjectAttributeNV;
case glslang::EvqSpirvStorageClass: return static_cast<spv::StorageClass>(type.getQualifier().spirvStorageClass);
#endif
default:
@ -2559,6 +2583,35 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
spv::Builder::AccessChain::CoherentFlags lvalueCoherentFlags;
const auto hitObjectOpsWithLvalue = [](glslang::TOperator op) {
switch(op) {
case glslang::EOpReorderThreadNV:
case glslang::EOpHitObjectGetCurrentTimeNV:
case glslang::EOpHitObjectGetHitKindNV:
case glslang::EOpHitObjectGetPrimitiveIndexNV:
case glslang::EOpHitObjectGetGeometryIndexNV:
case glslang::EOpHitObjectGetInstanceIdNV:
case glslang::EOpHitObjectGetInstanceCustomIndexNV:
case glslang::EOpHitObjectGetObjectRayDirectionNV:
case glslang::EOpHitObjectGetObjectRayOriginNV:
case glslang::EOpHitObjectGetWorldRayDirectionNV:
case glslang::EOpHitObjectGetWorldRayOriginNV:
case glslang::EOpHitObjectGetWorldToObjectNV:
case glslang::EOpHitObjectGetObjectToWorldNV:
case glslang::EOpHitObjectGetRayTMaxNV:
case glslang::EOpHitObjectGetRayTMinNV:
case glslang::EOpHitObjectIsEmptyNV:
case glslang::EOpHitObjectIsHitNV:
case glslang::EOpHitObjectIsMissNV:
case glslang::EOpHitObjectRecordEmptyNV:
case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV:
case glslang::EOpHitObjectGetShaderRecordBufferHandleNV:
return true;
default:
return false;
}
};
#ifndef GLSLANG_WEB
if (node->getOp() == glslang::EOpAtomicCounterIncrement ||
node->getOp() == glslang::EOpAtomicCounterDecrement ||
@ -2573,7 +2626,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
node->getOp() == glslang::EOpRayQueryGetIntersectionCandidateAABBOpaque ||
node->getOp() == glslang::EOpRayQueryTerminate ||
node->getOp() == glslang::EOpRayQueryConfirmIntersection ||
(node->getOp() == glslang::EOpSpirvInst && operandNode->getAsTyped()->getQualifier().isSpirvByReference())) {
(node->getOp() == glslang::EOpSpirvInst && operandNode->getAsTyped()->getQualifier().isSpirvByReference()) ||
hitObjectOpsWithLvalue(node->getOp())) {
operand = builder.accessChainGetLValue(); // Special case l-value operands
lvalueCoherentFlags = builder.getAccessChain().coherentFlags;
lvalueCoherentFlags |= TranslateCoherent(operandNode->getAsTyped()->getType());
@ -2708,6 +2762,12 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
case glslang::EOpRayQueryConfirmIntersection:
builder.createNoResultOp(spv::OpRayQueryConfirmIntersectionKHR, operand);
return false;
case glslang::EOpReorderThreadNV:
builder.createNoResultOp(spv::OpReorderThreadWithHitObjectNV, operand);
return false;
case glslang::EOpHitObjectRecordEmptyNV:
builder.createNoResultOp(spv::OpHitObjectRecordEmptyNV, operand);
return false;
#endif
default:
@ -3199,6 +3259,43 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
builder.addExtension(spv::E_SPV_EXT_fragment_shader_interlock);
noReturnValue = true;
break;
case glslang::EOpHitObjectTraceRayNV:
case glslang::EOpHitObjectTraceRayMotionNV:
case glslang::EOpHitObjectGetAttributesNV:
case glslang::EOpHitObjectExecuteShaderNV:
case glslang::EOpHitObjectRecordEmptyNV:
case glslang::EOpHitObjectRecordMissNV:
case glslang::EOpHitObjectRecordMissMotionNV:
case glslang::EOpHitObjectRecordHitNV:
case glslang::EOpHitObjectRecordHitMotionNV:
case glslang::EOpHitObjectRecordHitWithIndexNV:
case glslang::EOpHitObjectRecordHitWithIndexMotionNV:
case glslang::EOpReorderThreadNV:
noReturnValue = true;
//Fallthrough
case glslang::EOpHitObjectIsEmptyNV:
case glslang::EOpHitObjectIsMissNV:
case glslang::EOpHitObjectIsHitNV:
case glslang::EOpHitObjectGetRayTMinNV:
case glslang::EOpHitObjectGetRayTMaxNV:
case glslang::EOpHitObjectGetObjectRayOriginNV:
case glslang::EOpHitObjectGetObjectRayDirectionNV:
case glslang::EOpHitObjectGetWorldRayOriginNV:
case glslang::EOpHitObjectGetWorldRayDirectionNV:
case glslang::EOpHitObjectGetObjectToWorldNV:
case glslang::EOpHitObjectGetWorldToObjectNV:
case glslang::EOpHitObjectGetInstanceCustomIndexNV:
case glslang::EOpHitObjectGetInstanceIdNV:
case glslang::EOpHitObjectGetGeometryIndexNV:
case glslang::EOpHitObjectGetPrimitiveIndexNV:
case glslang::EOpHitObjectGetHitKindNV:
case glslang::EOpHitObjectGetCurrentTimeNV:
case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV:
case glslang::EOpHitObjectGetShaderRecordBufferHandleNV:
builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder);
builder.addCapability(spv::CapabilityShaderInvocationReorderNV);
break;
#endif
case glslang::EOpDebugPrintf:
@ -3256,6 +3353,22 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
lvalue = true;
break;
case glslang::EOpHitObjectRecordHitNV:
case glslang::EOpHitObjectRecordHitMotionNV:
case glslang::EOpHitObjectRecordHitWithIndexNV:
case glslang::EOpHitObjectRecordHitWithIndexMotionNV:
case glslang::EOpHitObjectTraceRayNV:
case glslang::EOpHitObjectTraceRayMotionNV:
case glslang::EOpHitObjectExecuteShaderNV:
case glslang::EOpHitObjectRecordMissNV:
case glslang::EOpHitObjectRecordMissMotionNV:
case glslang::EOpHitObjectGetAttributesNV:
if (arg == 0)
lvalue = true;
break;
case glslang::EOpRayQueryInitialize:
case glslang::EOpRayQueryTerminate:
case glslang::EOpRayQueryConfirmIntersection:
@ -3356,6 +3469,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
if (glslangOperands[arg]->getAsTyped()->getQualifier().isSpirvByReference())
lvalue = true;
break;
case glslang::EOpReorderThreadNV:
//Three variants of reorderThreadNV, two of them use hitObjectNV
if (arg == 0 && glslangOperands.size() != 2)
lvalue = true;
break;
#endif
default:
break;
@ -3454,11 +3572,23 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
operands.push_back(builder.makeIntConstant(cond ? 1 : 0));
} else if ((arg == 10 && glslangOp == glslang::EOpTraceKHR) ||
(arg == 11 && glslangOp == glslang::EOpTraceRayMotionNV) ||
(arg == 1 && glslangOp == glslang::EOpExecuteCallableKHR)) {
const int opdNum = glslangOp == glslang::EOpTraceKHR ? 10 : (glslangOp == glslang::EOpTraceRayMotionNV ? 11 : 1);
(arg == 1 && glslangOp == glslang::EOpExecuteCallableKHR) ||
(arg == 1 && glslangOp == glslang::EOpHitObjectExecuteShaderNV) ||
(arg == 11 && glslangOp == glslang::EOpHitObjectTraceRayNV) ||
(arg == 12 && glslangOp == glslang::EOpHitObjectTraceRayMotionNV)) {
const int set = glslangOp == glslang::EOpExecuteCallableKHR ? 1 : 0;
const int location = glslangOperands[opdNum]->getAsConstantUnion()->getConstArray()[0].getUConst();
const int location = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getUConst();
auto itNode = locationToSymbol[set].find(location);
visitSymbol(itNode->second);
spv::Id symId = getSymbolId(itNode->second);
operands.push_back(symId);
} else if ((arg == 12 && glslangOp == glslang::EOpHitObjectRecordHitNV) ||
(arg == 13 && glslangOp == glslang::EOpHitObjectRecordHitMotionNV) ||
(arg == 11 && glslangOp == glslang::EOpHitObjectRecordHitWithIndexNV) ||
(arg == 12 && glslangOp == glslang::EOpHitObjectRecordHitWithIndexMotionNV) ||
(arg == 1 && glslangOp == glslang::EOpHitObjectGetAttributesNV)) {
const int location = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getUConst();
const int set = 2;
auto itNode = locationToSymbol[set].find(location);
visitSymbol(itNode->second);
spv::Id symId = getSymbolId(itNode->second);
@ -4284,6 +4414,13 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case glslang::EbtString:
// no type used for OpString
return 0;
case glslang::EbtHitObjectNV: {
builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder);
builder.addCapability(spv::CapabilityShaderInvocationReorderNV);
spvType = builder.makeHitObjectNVType();
}
break;
#ifndef GLSLANG_WEB
case glslang::EbtSpirvType: {
// GL_EXT_spirv_intrinsics
@ -4703,6 +4840,9 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
// Decorate the structure
builder.addDecoration(spvType, TranslateLayoutDecoration(type, qualifier.layoutMatrix));
builder.addDecoration(spvType, TranslateBlockDecoration(type, glslangIntermediate->usingStorageBuffer()));
if (qualifier.hasHitObjectShaderRecordNV())
builder.addDecoration(spvType, spv::DecorationHitObjectShaderRecordBufferNV);
}
// Turn the expression forming the array size into an id.
@ -5083,7 +5223,7 @@ bool TGlslangToSpvTraverser::originalParam(glslang::TStorageQualifier qualifier,
return true;
if (glslangIntermediate->getSource() == glslang::EShSourceHlsl)
return paramType.getBasicType() == glslang::EbtBlock;
return paramType.containsOpaque() || // sampler, etc.
return (paramType.containsOpaque() && !glslangIntermediate->getBindlessMode()) || // sampler, etc.
#ifndef GLSLANG_WEB
paramType.getQualifier().isSpirvByReference() || // spirv_by_reference
#endif
@ -5230,6 +5370,10 @@ void TGlslangToSpvTraverser::collectRayTracingLinkerObjects()
set = 1;
break;
case glslang::EvqHitObjectAttrNV:
set = 2;
break;
default:
set = -1;
}
@ -6874,6 +7018,83 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe
case glslang::EOpConvUvec2ToAccStruct:
unaryOp = spv::OpConvertUToAccelerationStructureKHR;
break;
case glslang::EOpHitObjectIsEmptyNV:
unaryOp = spv::OpHitObjectIsEmptyNV;
break;
case glslang::EOpHitObjectIsMissNV:
unaryOp = spv::OpHitObjectIsMissNV;
break;
case glslang::EOpHitObjectIsHitNV:
unaryOp = spv::OpHitObjectIsHitNV;
break;
case glslang::EOpHitObjectGetObjectRayOriginNV:
unaryOp = spv::OpHitObjectGetObjectRayOriginNV;
break;
case glslang::EOpHitObjectGetObjectRayDirectionNV:
unaryOp = spv::OpHitObjectGetObjectRayDirectionNV;
break;
case glslang::EOpHitObjectGetWorldRayOriginNV:
unaryOp = spv::OpHitObjectGetWorldRayOriginNV;
break;
case glslang::EOpHitObjectGetWorldRayDirectionNV:
unaryOp = spv::OpHitObjectGetWorldRayDirectionNV;
break;
case glslang::EOpHitObjectGetObjectToWorldNV:
unaryOp = spv::OpHitObjectGetObjectToWorldNV;
break;
case glslang::EOpHitObjectGetWorldToObjectNV:
unaryOp = spv::OpHitObjectGetWorldToObjectNV;
break;
case glslang::EOpHitObjectGetRayTMinNV:
unaryOp = spv::OpHitObjectGetRayTMinNV;
break;
case glslang::EOpHitObjectGetRayTMaxNV:
unaryOp = spv::OpHitObjectGetRayTMaxNV;
break;
case glslang::EOpHitObjectGetPrimitiveIndexNV:
unaryOp = spv::OpHitObjectGetPrimitiveIndexNV;
break;
case glslang::EOpHitObjectGetInstanceIdNV:
unaryOp = spv::OpHitObjectGetInstanceIdNV;
break;
case glslang::EOpHitObjectGetInstanceCustomIndexNV:
unaryOp = spv::OpHitObjectGetInstanceCustomIndexNV;
break;
case glslang::EOpHitObjectGetGeometryIndexNV:
unaryOp = spv::OpHitObjectGetGeometryIndexNV;
break;
case glslang::EOpHitObjectGetHitKindNV:
unaryOp = spv::OpHitObjectGetHitKindNV;
break;
case glslang::EOpHitObjectGetCurrentTimeNV:
unaryOp = spv::OpHitObjectGetCurrentTimeNV;
break;
case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV:
unaryOp = spv::OpHitObjectGetShaderBindingTableRecordIndexNV;
break;
case glslang::EOpHitObjectGetShaderRecordBufferHandleNV:
unaryOp = spv::OpHitObjectGetShaderRecordBufferHandleNV;
break;
#endif
case glslang::EOpCopyObject:
@ -8615,6 +8836,122 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
case glslang::EOpCooperativeMatrixMulAdd:
opCode = spv::OpCooperativeMatrixMulAddNV;
break;
case glslang::EOpHitObjectTraceRayNV:
builder.createNoResultOp(spv::OpHitObjectTraceRayNV, operands);
return 0;
case glslang::EOpHitObjectTraceRayMotionNV:
builder.createNoResultOp(spv::OpHitObjectTraceRayMotionNV, operands);
return 0;
case glslang::EOpHitObjectRecordHitNV:
builder.createNoResultOp(spv::OpHitObjectRecordHitNV, operands);
return 0;
case glslang::EOpHitObjectRecordHitMotionNV:
builder.createNoResultOp(spv::OpHitObjectRecordHitMotionNV, operands);
return 0;
case glslang::EOpHitObjectRecordHitWithIndexNV:
builder.createNoResultOp(spv::OpHitObjectRecordHitWithIndexNV, operands);
return 0;
case glslang::EOpHitObjectRecordHitWithIndexMotionNV:
builder.createNoResultOp(spv::OpHitObjectRecordHitWithIndexMotionNV, operands);
return 0;
case glslang::EOpHitObjectRecordMissNV:
builder.createNoResultOp(spv::OpHitObjectRecordMissNV, operands);
return 0;
case glslang::EOpHitObjectRecordMissMotionNV:
builder.createNoResultOp(spv::OpHitObjectRecordMissMotionNV, operands);
return 0;
case glslang::EOpHitObjectExecuteShaderNV:
builder.createNoResultOp(spv::OpHitObjectExecuteShaderNV, operands);
return 0;
case glslang::EOpHitObjectIsEmptyNV:
typeId = builder.makeBoolType();
opCode = spv::OpHitObjectIsEmptyNV;
break;
case glslang::EOpHitObjectIsMissNV:
typeId = builder.makeBoolType();
opCode = spv::OpHitObjectIsMissNV;
break;
case glslang::EOpHitObjectIsHitNV:
typeId = builder.makeBoolType();
opCode = spv::OpHitObjectIsHitNV;
break;
case glslang::EOpHitObjectGetRayTMinNV:
typeId = builder.makeFloatType(32);
opCode = spv::OpHitObjectGetRayTMinNV;
break;
case glslang::EOpHitObjectGetRayTMaxNV:
typeId = builder.makeFloatType(32);
opCode = spv::OpHitObjectGetRayTMaxNV;
break;
case glslang::EOpHitObjectGetObjectRayOriginNV:
typeId = builder.makeVectorType(builder.makeFloatType(32), 3);
opCode = spv::OpHitObjectGetObjectRayOriginNV;
break;
case glslang::EOpHitObjectGetObjectRayDirectionNV:
typeId = builder.makeVectorType(builder.makeFloatType(32), 3);
opCode = spv::OpHitObjectGetObjectRayDirectionNV;
break;
case glslang::EOpHitObjectGetWorldRayOriginNV:
typeId = builder.makeVectorType(builder.makeFloatType(32), 3);
opCode = spv::OpHitObjectGetWorldRayOriginNV;
break;
case glslang::EOpHitObjectGetWorldRayDirectionNV:
typeId = builder.makeVectorType(builder.makeFloatType(32), 3);
opCode = spv::OpHitObjectGetWorldRayDirectionNV;
break;
case glslang::EOpHitObjectGetWorldToObjectNV:
typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3);
opCode = spv::OpHitObjectGetWorldToObjectNV;
break;
case glslang::EOpHitObjectGetObjectToWorldNV:
typeId = builder.makeMatrixType(builder.makeFloatType(32), 4, 3);
opCode = spv::OpHitObjectGetObjectToWorldNV;
break;
case glslang::EOpHitObjectGetInstanceCustomIndexNV:
typeId = builder.makeIntegerType(32, 1);
opCode = spv::OpHitObjectGetInstanceCustomIndexNV;
break;
case glslang::EOpHitObjectGetInstanceIdNV:
typeId = builder.makeIntegerType(32, 1);
opCode = spv::OpHitObjectGetInstanceIdNV;
break;
case glslang::EOpHitObjectGetGeometryIndexNV:
typeId = builder.makeIntegerType(32, 1);
opCode = spv::OpHitObjectGetGeometryIndexNV;
break;
case glslang::EOpHitObjectGetPrimitiveIndexNV:
typeId = builder.makeIntegerType(32, 1);
opCode = spv::OpHitObjectGetPrimitiveIndexNV;
break;
case glslang::EOpHitObjectGetHitKindNV:
typeId = builder.makeIntegerType(32, 0);
opCode = spv::OpHitObjectGetHitKindNV;
break;
case glslang::EOpHitObjectGetCurrentTimeNV:
typeId = builder.makeFloatType(32);
opCode = spv::OpHitObjectGetCurrentTimeNV;
break;
case glslang::EOpHitObjectGetShaderBindingTableRecordIndexNV:
typeId = builder.makeIntegerType(32, 0);
opCode = spv::OpHitObjectGetShaderBindingTableRecordIndexNV;
return 0;
case glslang::EOpHitObjectGetAttributesNV:
builder.createNoResultOp(spv::OpHitObjectGetAttributesNV, operands);
return 0;
case glslang::EOpHitObjectGetShaderRecordBufferHandleNV:
typeId = builder.makeVectorType(builder.makeUintType(32), 2);
opCode = spv::OpHitObjectGetShaderRecordBufferHandleNV;
break;
case glslang::EOpReorderThreadNV: {
if (operands.size() == 2) {
builder.createNoResultOp(spv::OpReorderThreadWithHintNV, operands);
} else {
builder.createNoResultOp(spv::OpReorderThreadWithHitObjectNV, operands);
}
return 0;
}
break;
#endif // GLSLANG_WEB
default:
return 0;
@ -8924,13 +9261,17 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
}
if (symbol->getQualifier().hasLocation()) {
if (!(glslangIntermediate->isRayTracingStage() && glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_ray_tracing)
if (!(glslangIntermediate->isRayTracingStage() &&
(glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_ray_tracing) ||
glslangIntermediate->IsRequestedExtension(glslang::E_GL_NV_shader_invocation_reorder))
&& (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.getStorageClass(id) == spv::StorageClassIncomingCallableDataKHR ||
builder.getStorageClass(id) == spv::StorageClassHitObjectAttributeNV))) {
// Location values are used to link TraceRayKHR/ExecuteCallableKHR/HitObjectGetAttributesNV
// 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);
}
}
@ -9615,7 +9956,7 @@ void GlslangToSpv(const TIntermediate& intermediate, std::vector<unsigned int>&
{
TIntermNode* root = intermediate.getTreeRoot();
if (root == 0)
if (root == nullptr)
return;
SpvOptions defaultOptions;

View File

@ -71,9 +71,9 @@ Builder::Builder(unsigned int spvVersion, unsigned int magicNumber, SpvBuildLogg
addressModel(AddressingModelLogical),
memoryModel(MemoryModelGLSL450),
builderNumber(magicNumber),
buildPoint(0),
buildPoint(nullptr),
uniqueId(0),
entryPointFunction(0),
entryPointFunction(nullptr),
generatingOpCodeForSpecConst(false),
logger(buildLogger)
{
@ -650,8 +650,12 @@ Id Builder::makeDebugFunctionType(Id returnType, const std::vector<Id>& paramTyp
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic));
type->addIdOperand(debugId[returnType]);
for (auto const paramType : paramTypes) {
assert(isPointerType(paramType) || isArrayType(paramType));
type->addIdOperand(debugId[getContainedTypeId(paramType)]);
if (isPointerType(paramType) || isArrayType(paramType)) {
type->addIdOperand(debugId[getContainedTypeId(paramType)]);
}
else {
type->addIdOperand(debugId[paramType]);
}
}
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
@ -1176,6 +1180,21 @@ Id Builder::makeRayQueryType()
return type->getResultId();
}
Id Builder::makeHitObjectNVType()
{
Instruction *type;
if (groupedTypes[OpTypeHitObjectNV].size() == 0) {
type = new Instruction(getUniqueId(), NoType, OpTypeHitObjectNV);
groupedTypes[OpTypeHitObjectNV].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
} else {
type = groupedTypes[OpTypeHitObjectNV].back();
}
return type->getResultId();
}
#endif
Id Builder::getDerefTypeId(Id resultId) const
@ -1675,7 +1694,7 @@ Id Builder::importNonSemanticShaderDebugInfoInstructions()
Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps)
{
Instruction* constant = 0;
Instruction* constant = nullptr;
bool found = false;
for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) {
constant = groupedConstants[typeClass][i];
@ -1702,7 +1721,7 @@ Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>
Id Builder::findStructConstant(Id typeId, const std::vector<Id>& comps)
{
Instruction* constant = 0;
Instruction* constant = nullptr;
bool found = false;
for (int i = 0; i < (int)groupedStructConstants[typeId].size(); ++i) {
constant = groupedStructConstants[typeId][i];
@ -2047,11 +2066,16 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const
assert(paramTypes.size() == paramNames.size());
for(size_t p = 0; p < paramTypes.size(); ++p)
{
auto const& paramType = paramTypes[p];
assert(isPointerType(paramType) || isArrayType(paramType));
assert(debugId[getContainedTypeId(paramType)] != 0);
auto getParamTypeId = [this](Id const& typeId) {
if (isPointerType(typeId) || isArrayType(typeId)) {
return getContainedTypeId(typeId);
}
else {
return typeId;
}
};
auto const& paramName = paramNames[p];
auto const debugLocalVariableId = createDebugLocalVariable(debugId[getContainedTypeId(paramType)], paramName, p+1);
auto const debugLocalVariableId = createDebugLocalVariable(debugId[getParamTypeId(paramTypes[p])], paramName, p+1);
debugId[firstParamId + p] = debugLocalVariableId;
makeDebugDeclare(debugLocalVariableId, firstParamId + p);
@ -3332,7 +3356,7 @@ Builder::If::If(Id cond, unsigned int ctrl, Builder& gb) :
builder(gb),
condition(cond),
control(ctrl),
elseBlock(0)
elseBlock(nullptr)
{
function = &builder.getBuildPoint()->getParent();

View File

@ -240,6 +240,8 @@ public:
Id makeAccelerationStructureType();
// rayQueryEXT type
Id makeRayQueryType();
// hitObjectNV type
Id makeHitObjectNVType();
// For querying about types.
Id getTypeId(Id resultId) const { return module.getTypeId(resultId); }
@ -414,7 +416,7 @@ public:
// The returned pointer is only valid for the lifetime of this builder.
Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name,
const std::vector<Id>& paramTypes, const std::vector<char const*>& paramNames,
const std::vector<std::vector<Decoration>>& precisions, Block **entry = 0);
const std::vector<std::vector<Decoration>>& precisions, Block **entry = nullptr);
// Create a return. An 'implicit' return is one not appearing in the source
// code. In the case of an implicit return, no post-return block is inserted.

View File

@ -52,6 +52,7 @@ namespace spv {
#include "GLSL.ext.EXT.h"
#include "GLSL.ext.AMD.h"
#include "GLSL.ext.NV.h"
#include "GLSL.ext.ARM.h"
}
namespace spv {

View File

@ -212,8 +212,7 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector
optimizer.RegisterPass(spvtools::CreateInterpolateFixupPass());
if (options->optimizeSize) {
optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass());
if (intermediate.getStage() == EShLanguage::EShLangVertex)
optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsPass());
optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsSafePass());
}
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
optimizer.RegisterPass(spvtools::CreateCFGCleanupPass());
@ -224,6 +223,56 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector
optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
}
bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
std::unordered_set<uint32_t>* live_locs,
std::unordered_set<uint32_t>* live_builtins,
spv::SpvBuildLogger*)
{
spvtools::Optimizer optimizer(target_env);
optimizer.SetMessageConsumer(OptimizerMesssageConsumer);
optimizer.RegisterPass(spvtools::CreateAnalyzeLiveInputPass(live_locs, live_builtins));
spvtools::OptimizerOptions spvOptOptions;
optimizer.SetTargetEnv(target_env);
spvOptOptions.set_run_validator(false);
return optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
}
void SpirvToolsEliminateDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
std::unordered_set<uint32_t>* live_locs,
std::unordered_set<uint32_t>* live_builtins,
spv::SpvBuildLogger*)
{
spvtools::Optimizer optimizer(target_env);
optimizer.SetMessageConsumer(OptimizerMesssageConsumer);
optimizer.RegisterPass(spvtools::CreateEliminateDeadOutputStoresPass(live_locs, live_builtins));
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass(false, true));
optimizer.RegisterPass(spvtools::CreateEliminateDeadOutputComponentsPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass(false, true));
spvtools::OptimizerOptions spvOptOptions;
optimizer.SetTargetEnv(target_env);
spvOptOptions.set_run_validator(false);
optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
}
void SpirvToolsEliminateDeadInputComponents(spv_target_env target_env, std::vector<unsigned int>& spirv,
spv::SpvBuildLogger*)
{
spvtools::Optimizer optimizer(target_env);
optimizer.SetMessageConsumer(OptimizerMesssageConsumer);
optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
spvtools::OptimizerOptions spvOptOptions;
optimizer.SetTargetEnv(target_env);
spvOptOptions.set_run_validator(false);
optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
}
// Apply the SPIRV-Tools optimizer to strip debug info from SPIR-V. This is implicitly done by
// SpirvToolsTransform if spvOptions->stripDebugInfo is set, but can be called separately if
// optimization is disabled.

View File

@ -65,6 +65,9 @@ struct SpvOptions {
#if ENABLE_OPT
// Translate glslang's view of target versioning to what SPIRV-Tools uses.
spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger);
// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment.
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
@ -80,6 +83,22 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
spv::SpvBuildLogger*, const SpvOptions*);
// Apply the SPIRV-Tools EliminateDeadInputComponents pass to generated SPIR-V. Put result in |spirv|.
void SpirvToolsEliminateDeadInputComponents(spv_target_env target_env, std::vector<unsigned int>& spirv,
spv::SpvBuildLogger*);
// Apply the SPIRV-Tools AnalyzeDeadOutputStores pass to generated SPIR-V. Put result in |live_locs|.
// Return true if the result is valid.
bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
std::unordered_set<uint32_t>* live_locs,
std::unordered_set<uint32_t>* live_builtins, spv::SpvBuildLogger*);
// Apply the SPIRV-Tools EliminateDeadOutputStores and AggressiveDeadCodeElimination passes to generated SPIR-V using
// |live_locs|. Put result in |spirv|.
void SpirvToolsEliminateDeadOutputStores(spv_target_env target_env, std::vector<unsigned int>& spirv,
std::unordered_set<uint32_t>* live_locs,
std::unordered_set<uint32_t>* live_builtins, spv::SpvBuildLogger*);
// Apply the SPIRV-Tools optimizer to strip debug info from SPIR-V. This is implicitly done by
// SpirvToolsTransform if spvOptions->stripDebugInfo is set, but can be called separately if
// optimization is disabled.

View File

@ -54,6 +54,8 @@ namespace spv {
#include "GLSL.std.450.h"
#include "GLSL.ext.AMD.h"
#include "GLSL.ext.NV.h"
#include "GLSL.ext.ARM.h"
#include "NonSemanticShaderDebugInfo100.h"
}
}
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
@ -62,6 +64,7 @@ namespace spv {
static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
static const char* GLSLextNVGetDebugNames(const char*, unsigned);
static const char* NonSemanticShaderDebugInfo100GetDebugNames(unsigned);
static void Kill(std::ostream& out, const char* message)
{
@ -76,6 +79,7 @@ enum ExtInstSet {
GLSLextNVInst,
OpenCLExtInst,
NonSemanticDebugPrintfExtInst,
NonSemanticShaderDebugInfo100
};
// Container class for a single instance of a SPIR-V stream, with methods for disassembly.
@ -501,6 +505,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
extInstSet = OpenCLExtInst;
} else if (strcmp("NonSemantic.DebugPrintf", name) == 0) {
extInstSet = NonSemanticDebugPrintfExtInst;
} else if (strcmp("NonSemantic.Shader.DebugInfo.100", name) == 0) {
extInstSet = NonSemanticShaderDebugInfo100;
} else if (strcmp(spv::E_SPV_AMD_shader_ballot, name) == 0 ||
strcmp(spv::E_SPV_AMD_shader_trinary_minmax, name) == 0 ||
strcmp(spv::E_SPV_AMD_shader_explicit_vertex_parameter, name) == 0 ||
@ -526,6 +532,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")";
} else if (extInstSet == NonSemanticDebugPrintfExtInst) {
out << "(DebugPrintf)";
} else if (extInstSet == NonSemanticShaderDebugInfo100) {
out << "(" << NonSemanticShaderDebugInfo100GetDebugNames(entrypoint) << ")";
}
}
break;
@ -749,6 +757,59 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
return "Bad";
}
static const char* NonSemanticShaderDebugInfo100GetDebugNames(unsigned entrypoint)
{
switch (entrypoint) {
case NonSemanticShaderDebugInfo100DebugInfoNone: return "DebugInfoNone";
case NonSemanticShaderDebugInfo100DebugCompilationUnit: return "DebugCompilationUnit";
case NonSemanticShaderDebugInfo100DebugTypeBasic: return "DebugTypeBasic";
case NonSemanticShaderDebugInfo100DebugTypePointer: return "DebugTypePointer";
case NonSemanticShaderDebugInfo100DebugTypeQualifier: return "DebugTypeQualifier";
case NonSemanticShaderDebugInfo100DebugTypeArray: return "DebugTypeArray";
case NonSemanticShaderDebugInfo100DebugTypeVector: return "DebugTypeVector";
case NonSemanticShaderDebugInfo100DebugTypedef: return "DebugTypedef";
case NonSemanticShaderDebugInfo100DebugTypeFunction: return "DebugTypeFunction";
case NonSemanticShaderDebugInfo100DebugTypeEnum: return "DebugTypeEnum";
case NonSemanticShaderDebugInfo100DebugTypeComposite: return "DebugTypeComposite";
case NonSemanticShaderDebugInfo100DebugTypeMember: return "DebugTypeMember";
case NonSemanticShaderDebugInfo100DebugTypeInheritance: return "DebugTypeInheritance";
case NonSemanticShaderDebugInfo100DebugTypePtrToMember: return "DebugTypePtrToMember";
case NonSemanticShaderDebugInfo100DebugTypeTemplate: return "DebugTypeTemplate";
case NonSemanticShaderDebugInfo100DebugTypeTemplateParameter: return "DebugTypeTemplateParameter";
case NonSemanticShaderDebugInfo100DebugTypeTemplateTemplateParameter: return "DebugTypeTemplateTemplateParameter";
case NonSemanticShaderDebugInfo100DebugTypeTemplateParameterPack: return "DebugTypeTemplateParameterPack";
case NonSemanticShaderDebugInfo100DebugGlobalVariable: return "DebugGlobalVariable";
case NonSemanticShaderDebugInfo100DebugFunctionDeclaration: return "DebugFunctionDeclaration";
case NonSemanticShaderDebugInfo100DebugFunction: return "DebugFunction";
case NonSemanticShaderDebugInfo100DebugLexicalBlock: return "DebugLexicalBlock";
case NonSemanticShaderDebugInfo100DebugLexicalBlockDiscriminator: return "DebugLexicalBlockDiscriminator";
case NonSemanticShaderDebugInfo100DebugScope: return "DebugScope";
case NonSemanticShaderDebugInfo100DebugNoScope: return "DebugNoScope";
case NonSemanticShaderDebugInfo100DebugInlinedAt: return "DebugInlinedAt";
case NonSemanticShaderDebugInfo100DebugLocalVariable: return "DebugLocalVariable";
case NonSemanticShaderDebugInfo100DebugInlinedVariable: return "DebugInlinedVariable";
case NonSemanticShaderDebugInfo100DebugDeclare: return "DebugDeclare";
case NonSemanticShaderDebugInfo100DebugValue: return "DebugValue";
case NonSemanticShaderDebugInfo100DebugOperation: return "DebugOperation";
case NonSemanticShaderDebugInfo100DebugExpression: return "DebugExpression";
case NonSemanticShaderDebugInfo100DebugMacroDef: return "DebugMacroDef";
case NonSemanticShaderDebugInfo100DebugMacroUndef: return "DebugMacroUndef";
case NonSemanticShaderDebugInfo100DebugImportedEntity: return "DebugImportedEntity";
case NonSemanticShaderDebugInfo100DebugSource: return "DebugSource";
case NonSemanticShaderDebugInfo100DebugFunctionDefinition: return "DebugFunctionDefinition";
case NonSemanticShaderDebugInfo100DebugSourceContinued: return "DebugSourceContinued";
case NonSemanticShaderDebugInfo100DebugLine: return "DebugLine";
case NonSemanticShaderDebugInfo100DebugNoLine: return "DebugNoLine";
case NonSemanticShaderDebugInfo100DebugBuildIdentifier: return "DebugBuildIdentifier";
case NonSemanticShaderDebugInfo100DebugStoragePath: return "DebugStoragePath";
case NonSemanticShaderDebugInfo100DebugEntryPoint: return "DebugEntryPoint";
case NonSemanticShaderDebugInfo100DebugTypeMatrix: return "DebugTypeMatrix";
default: return "Bad";
}
return "Bad";
}
void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
{
SpirvStream SpirvStream(out, stream);

View File

@ -53,6 +53,7 @@ namespace spv {
#include "GLSL.ext.EXT.h"
#include "GLSL.ext.AMD.h"
#include "GLSL.ext.NV.h"
#include "GLSL.ext.ARM.h"
}
}
@ -245,6 +246,7 @@ const char* StorageClassString(int StorageClass)
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
case StorageClassTaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT";
case StorageClassHitObjectAttributeNV: return "HitObjectAttributeNV";
default: return "Bad";
}
}
@ -319,6 +321,8 @@ const char* DecorationString(int decoration)
case DecorationHlslSemanticGOOGLE: return "DecorationHlslSemanticGOOGLE";
case DecorationRestrictPointerEXT: return "DecorationRestrictPointerEXT";
case DecorationAliasedPointerEXT: return "DecorationAliasedPointerEXT";
case DecorationHitObjectShaderRecordBufferNV: return "DecorationHitObjectShaderRecordBufferNV";
}
}
@ -439,6 +443,11 @@ const char* BuiltInString(int builtIn)
case BuiltInPrimitiveLineIndicesEXT: return "PrimitiveLineIndicesEXT";
case BuiltInPrimitiveTriangleIndicesEXT: return "PrimitiveTriangleIndicesEXT";
case BuiltInCullPrimitiveEXT: return "CullPrimitiveEXT";
case BuiltInCoreCountARM: return "CoreCountARM";
case BuiltInCoreIDARM: return "CoreIDARM";
case BuiltInCoreMaxIDARM: return "CoreMaxIDARM";
case BuiltInWarpIDARM: return "WarpIDARM";
case BuiltInWarpMaxIDARM: return "BuiltInWarpMaxIDARM";
default: return "Bad";
}
@ -998,7 +1007,9 @@ const char* CapabilityString(int info)
case CapabilityWorkgroupMemoryExplicitLayoutKHR: return "CapabilityWorkgroupMemoryExplicitLayoutKHR";
case CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR";
case CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR";
case CapabilityCoreBuiltinsARM: return "CoreBuiltinsARM";
case CapabilityShaderInvocationReorderNV: return "ShaderInvocationReorderNV";
default: return "Bad";
}
}
@ -1453,6 +1464,40 @@ const char* OpcodeString(int op)
case OpBeginInvocationInterlockEXT: return "OpBeginInvocationInterlockEXT";
case OpEndInvocationInterlockEXT: return "OpEndInvocationInterlockEXT";
case OpTypeHitObjectNV: return "OpTypeHitObjectNV";
case OpHitObjectTraceRayNV: return "OpHitObjectTraceRayNV";
case OpHitObjectTraceRayMotionNV: return "OpHitObjectTraceRayMotionNV";
case OpHitObjectRecordHitNV: return "OpHitObjectRecordHitNV";
case OpHitObjectRecordHitMotionNV: return "OpHitObjectRecordHitMotionNV";
case OpHitObjectRecordHitWithIndexNV: return "OpHitObjectRecordHitWithIndexNV";
case OpHitObjectRecordHitWithIndexMotionNV: return "OpHitObjectRecordHitWithIndexMotionNV";
case OpHitObjectRecordMissNV: return "OpHitObjectRecordMissNV";
case OpHitObjectRecordMissMotionNV: return "OpHitObjectRecordMissMotionNV";
case OpHitObjectRecordEmptyNV: return "OpHitObjectRecordEmptyNV";
case OpHitObjectExecuteShaderNV: return "OpHitObjectExecuteShaderNV";
case OpReorderThreadWithHintNV: return "OpReorderThreadWithHintNV";
case OpReorderThreadWithHitObjectNV: return "OpReorderThreadWithHitObjectNV";
case OpHitObjectGetCurrentTimeNV: return "OpHitObjectGetCurrentTimeNV";
case OpHitObjectGetAttributesNV: return "OpHitObjectGetAttributesNV";
case OpHitObjectGetHitKindNV: return "OpHitObjectGetFrontFaceNV";
case OpHitObjectGetPrimitiveIndexNV: return "OpHitObjectGetPrimitiveIndexNV";
case OpHitObjectGetGeometryIndexNV: return "OpHitObjectGetGeometryIndexNV";
case OpHitObjectGetInstanceIdNV: return "OpHitObjectGetInstanceIdNV";
case OpHitObjectGetInstanceCustomIndexNV: return "OpHitObjectGetInstanceCustomIndexNV";
case OpHitObjectGetObjectRayDirectionNV: return "OpHitObjectGetObjectRayDirectionNV";
case OpHitObjectGetObjectRayOriginNV: return "OpHitObjectGetObjectRayOriginNV";
case OpHitObjectGetWorldRayDirectionNV: return "OpHitObjectGetWorldRayDirectionNV";
case OpHitObjectGetWorldRayOriginNV: return "OpHitObjectGetWorldRayOriginNV";
case OpHitObjectGetWorldToObjectNV: return "OpHitObjectGetWorldToObjectNV";
case OpHitObjectGetObjectToWorldNV: return "OpHitObjectGetObjectToWorldNV";
case OpHitObjectGetRayTMaxNV: return "OpHitObjectGetRayTMaxNV";
case OpHitObjectGetRayTMinNV: return "OpHitObjectGetRayTMinNV";
case OpHitObjectIsEmptyNV: return "OpHitObjectIsEmptyNV";
case OpHitObjectIsHitNV: return "OpHitObjectIsHitNV";
case OpHitObjectIsMissNV: return "OpHitObjectIsMissNV";
case OpHitObjectGetShaderBindingTableRecordIndexNV: return "OpHitObjectGetShaderBindingTableRecordIndexNV";
case OpHitObjectGetShaderRecordBufferHandleNV: return "OpHitObjectGetShaderRecordBufferHandleNV";
default:
return "Bad";
}
@ -1607,7 +1652,7 @@ void Parameterize()
DecorationOperands[DecorationInputAttachmentIndex].push(OperandLiteralNumber, "'Attachment Index'");
DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'");
OperandClassParams[OperandSource].set(0, SourceString, 0);
OperandClassParams[OperandSource].set(0, SourceString, nullptr);
OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, nullptr);
OperandClassParams[OperandAddressing].set(0, AddressingString, nullptr);
OperandClassParams[OperandMemory].set(0, MemoryString, nullptr);
@ -1639,7 +1684,7 @@ void Parameterize()
OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, nullptr);
OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true);
OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr);
OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, 0);
OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, nullptr);
// set name of operator, an initial set of <id> style operands, and the description
@ -3030,6 +3075,191 @@ void Parameterize()
InstructionDesc[OpDemoteToHelperInvocationEXT].setResultAndType(false, false);
InstructionDesc[OpReadClockKHR].operands.push(OperandScope, "'Scope'");
InstructionDesc[OpTypeHitObjectNV].setResultAndType(true, false);
InstructionDesc[OpHitObjectGetShaderRecordBufferHandleNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetShaderRecordBufferHandleNV].setResultAndType(true, true);
InstructionDesc[OpReorderThreadWithHintNV].operands.push(OperandId, "'Hint'");
InstructionDesc[OpReorderThreadWithHintNV].operands.push(OperandId, "'Bits'");
InstructionDesc[OpReorderThreadWithHintNV].setResultAndType(false, false);
InstructionDesc[OpReorderThreadWithHitObjectNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpReorderThreadWithHitObjectNV].operands.push(OperandId, "'Hint'");
InstructionDesc[OpReorderThreadWithHitObjectNV].operands.push(OperandId, "'Bits'");
InstructionDesc[OpReorderThreadWithHitObjectNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectGetCurrentTimeNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetCurrentTimeNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetHitKindNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetHitKindNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetPrimitiveIndexNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetPrimitiveIndexNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetGeometryIndexNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetGeometryIndexNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetInstanceIdNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetInstanceIdNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetInstanceCustomIndexNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetInstanceCustomIndexNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetObjectRayDirectionNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetObjectRayDirectionNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetObjectRayOriginNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetObjectRayOriginNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetWorldRayDirectionNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetWorldRayDirectionNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetWorldRayOriginNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetWorldRayOriginNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetWorldToObjectNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetWorldToObjectNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetObjectToWorldNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetObjectToWorldNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetRayTMaxNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetRayTMaxNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetRayTMinNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetRayTMinNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetShaderBindingTableRecordIndexNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetShaderBindingTableRecordIndexNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectIsEmptyNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectIsEmptyNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectIsHitNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectIsHitNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectIsMissNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectIsMissNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetAttributesNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetAttributesNV].operands.push(OperandId, "'HitObjectAttribute'");
InstructionDesc[OpHitObjectGetAttributesNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectExecuteShaderNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectExecuteShaderNV].operands.push(OperandId, "'Payload'");
InstructionDesc[OpHitObjectExecuteShaderNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'Acceleration Structure'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'InstanceId'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'PrimitiveId'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'GeometryIndex'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'HitKind'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'SBT Record Offset'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'SBT Record Stride'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'Origin'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'Direction'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpHitObjectRecordHitNV].operands.push(OperandId, "'HitObject Attribute'");
InstructionDesc[OpHitObjectRecordHitNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'Acceleration Structure'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'InstanceId'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'PrimitiveId'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'GeometryIndex'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'HitKind'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'SBT Record Offset'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'SBT Record Stride'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'Origin'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'Direction'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'Current Time'");
InstructionDesc[OpHitObjectRecordHitMotionNV].operands.push(OperandId, "'HitObject Attribute'");
InstructionDesc[OpHitObjectRecordHitMotionNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'Acceleration Structure'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'InstanceId'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'PrimitiveId'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'GeometryIndex'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'HitKind'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'SBT Record Index'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'Origin'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'Direction'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].operands.push(OperandId, "'HitObject Attribute'");
InstructionDesc[OpHitObjectRecordHitWithIndexNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'Acceleration Structure'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'InstanceId'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'PrimitiveId'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'GeometryIndex'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'HitKind'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'SBT Record Index'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'Origin'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'Direction'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'Current Time'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].operands.push(OperandId, "'HitObject Attribute'");
InstructionDesc[OpHitObjectRecordHitWithIndexMotionNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'SBT Index'");
InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'Origin'");
InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'Direction'");
InstructionDesc[OpHitObjectRecordMissNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpHitObjectRecordMissNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'SBT Index'");
InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'Origin'");
InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'Direction'");
InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpHitObjectRecordMissMotionNV].operands.push(OperandId, "'Current Time'");
InstructionDesc[OpHitObjectRecordMissMotionNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectRecordEmptyNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectRecordEmptyNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Acceleration Structure'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'RayFlags'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Cullmask'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'SBT Record Offset'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'SBT Record Stride'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Miss Index'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Origin'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Direction'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpHitObjectTraceRayNV].operands.push(OperandId, "'Payload'");
InstructionDesc[OpHitObjectTraceRayNV].setResultAndType(false, false);
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Acceleration Structure'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'RayFlags'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Cullmask'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'SBT Record Offset'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'SBT Record Stride'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Miss Index'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Origin'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Direction'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Time'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Payload'");
InstructionDesc[OpHitObjectTraceRayMotionNV].setResultAndType(false, false);
}
}; // end spv namespace

View File

@ -190,7 +190,7 @@ protected:
// Parameterize an enumerant
class EnumParameters {
public:
EnumParameters() : desc(0) { }
EnumParameters() : desc(nullptr) { }
const char* desc;
};
@ -198,7 +198,7 @@ public:
class EnumDefinition : public EnumParameters {
public:
EnumDefinition() :
ceiling(0), bitmask(false), getName(0), enumParams(0), operandParams(0) { }
ceiling(0), bitmask(false), getName(nullptr), enumParams(nullptr), operandParams(nullptr) { }
void set(int ceil, const char* (*name)(int), EnumParameters* ep, bool mask = false)
{
ceiling = ceil;

View File

@ -223,6 +223,7 @@ enum StorageClass {
StorageClassShaderRecordBufferNV = 5343,
StorageClassPhysicalStorageBuffer = 5349,
StorageClassPhysicalStorageBufferEXT = 5349,
StorageClassHitObjectAttributeNV = 5385,
StorageClassTaskPayloadWorkgroupEXT = 5402,
StorageClassCodeSectionINTEL = 5605,
StorageClassDeviceOnlyINTEL = 5936,
@ -518,6 +519,7 @@ enum Decoration {
DecorationRestrictPointerEXT = 5355,
DecorationAliasedPointer = 5356,
DecorationAliasedPointerEXT = 5356,
DecorationHitObjectShaderRecordBufferNV = 5386,
DecorationBindlessSamplerNV = 5398,
DecorationBindlessImageNV = 5399,
DecorationBoundSamplerNV = 5400,
@ -607,6 +609,11 @@ enum BuiltIn {
BuiltInSubgroupLocalInvocationId = 41,
BuiltInVertexIndex = 42,
BuiltInInstanceIndex = 43,
BuiltInCoreCountARM = 4161,
BuiltInCoreIDARM = 4160,
BuiltInCoreMaxIDARM = 4162,
BuiltInWarpIDARM = 4163,
BuiltInWarpMaxIDARM = 4164,
BuiltInSubgroupEqMask = 4416,
BuiltInSubgroupEqMaskKHR = 4416,
BuiltInSubgroupGeMask = 4417,
@ -946,6 +953,7 @@ enum Capability {
CapabilityShaderLayer = 69,
CapabilityShaderViewportIndex = 70,
CapabilityUniformDecoration = 71,
CapabilityCoreBuiltinsARM = 4165,
CapabilityFragmentShadingRateKHR = 4422,
CapabilitySubgroupBallotKHR = 4423,
CapabilityDrawParameters = 4427,
@ -1042,6 +1050,7 @@ enum Capability {
CapabilityFragmentShaderPixelInterlockEXT = 5378,
CapabilityDemoteToHelperInvocation = 5379,
CapabilityDemoteToHelperInvocationEXT = 5379,
CapabilityShaderInvocationReorderNV = 5383,
CapabilityBindlessTextureNV = 5390,
CapabilitySubgroupShuffleINTEL = 5568,
CapabilitySubgroupBufferBlockIOINTEL = 5569,
@ -1588,6 +1597,39 @@ enum Op {
OpFragmentMaskFetchAMD = 5011,
OpFragmentFetchAMD = 5012,
OpReadClockKHR = 5056,
OpHitObjectRecordHitMotionNV = 5249,
OpHitObjectRecordHitWithIndexMotionNV = 5250,
OpHitObjectRecordMissMotionNV = 5251,
OpHitObjectGetWorldToObjectNV = 5252,
OpHitObjectGetObjectToWorldNV = 5253,
OpHitObjectGetObjectRayDirectionNV = 5254,
OpHitObjectGetObjectRayOriginNV = 5255,
OpHitObjectTraceRayMotionNV = 5256,
OpHitObjectGetShaderRecordBufferHandleNV = 5257,
OpHitObjectGetShaderBindingTableRecordIndexNV = 5258,
OpHitObjectRecordEmptyNV = 5259,
OpHitObjectTraceRayNV = 5260,
OpHitObjectRecordHitNV = 5261,
OpHitObjectRecordHitWithIndexNV = 5262,
OpHitObjectRecordMissNV = 5263,
OpHitObjectExecuteShaderNV = 5264,
OpHitObjectGetCurrentTimeNV = 5265,
OpHitObjectGetAttributesNV = 5266,
OpHitObjectGetHitKindNV = 5267,
OpHitObjectGetPrimitiveIndexNV = 5268,
OpHitObjectGetGeometryIndexNV = 5269,
OpHitObjectGetInstanceIdNV = 5270,
OpHitObjectGetInstanceCustomIndexNV = 5271,
OpHitObjectGetWorldRayDirectionNV = 5272,
OpHitObjectGetWorldRayOriginNV = 5273,
OpHitObjectGetRayTMaxNV = 5274,
OpHitObjectGetRayTMinNV = 5275,
OpHitObjectIsEmptyNV = 5276,
OpHitObjectIsHitNV = 5277,
OpHitObjectIsMissNV = 5278,
OpReorderThreadWithHitObjectNV = 5279,
OpReorderThreadWithHintNV = 5280,
OpTypeHitObjectNV = 5281,
OpImageSampleFootprintNV = 5283,
OpEmitMeshTasksEXT = 5294,
OpSetMeshOutputsEXT = 5295,

View File

@ -505,6 +505,8 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
resources->maxTaskWorkGroupSizeZ_EXT = value;
else if (tokenStr == "MaxMeshViewCountEXT")
resources->maxMeshViewCountEXT = value;
else if (tokenStr == "MaxDualSourceDrawBuffersEXT")
resources->maxDualSourceDrawBuffersEXT = value;
else if (tokenStr == "nonInductiveForLoops")
resources->limits.nonInductiveForLoops = (value != 0);
else if (tokenStr == "whileLoops")

View File

@ -504,7 +504,7 @@ void ProcessGlobalBlockSettings(int& argc, char**& argv, std::string* name, unsi
if (set) {
errno = 0;
int setVal = ::strtol(argv[curArg], NULL, 10);
int setVal = ::strtol(argv[curArg], nullptr, 10);
if (errno || setVal < 0) {
printf("%s: invalid set\n", argv[curArg]);
usage();
@ -516,7 +516,7 @@ void ProcessGlobalBlockSettings(int& argc, char**& argv, std::string* name, unsi
if (binding) {
errno = 0;
int bindingVal = ::strtol(argv[curArg], NULL, 10);
int bindingVal = ::strtol(argv[curArg], nullptr, 10);
if (errno || bindingVal < 0) {
printf("%s: invalid binding\n", argv[curArg]);
usage();
@ -594,12 +594,12 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
const auto getUniformOverride = [getStringOperand]() {
const char *arg = getStringOperand("-u<name>:<location>");
const char *split = strchr(arg, ':');
if (split == NULL) {
if (split == nullptr) {
printf("%s: missing location\n", arg);
exit(EFailUsage);
}
errno = 0;
int location = ::strtol(split + 1, NULL, 10);
int location = ::strtol(split + 1, nullptr, 10);
if (errno) {
printf("%s: invalid location\n", arg);
exit(EFailUsage);
@ -626,7 +626,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
} else if (lowerword == "uniform-base") {
if (argc <= 1)
Error("no <base> provided", lowerword.c_str());
uniformBase = ::strtol(argv[1], NULL, 10);
uniformBase = ::strtol(argv[1], nullptr, 10);
bumpArg();
break;
} else if (lowerword == "client") {
@ -1161,7 +1161,7 @@ void CompileShaders(glslang::TWorklist& worklist)
} else {
while (worklist.remove(workItem)) {
ShHandle compiler = ShConstructCompiler(FindLanguage(workItem->name), Options);
if (compiler == 0)
if (compiler == nullptr)
return;
CompileFile(workItem->name.c_str(), compiler);
@ -1297,7 +1297,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
sources.push_back(compUnit.fileNameList[i]);
}
glslang::TShader* shader = new glslang::TShader(compUnit.stage);
shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count);
shader->setStringsWithLengthsAndNames(compUnit.text, nullptr, compUnit.fileNameList, compUnit.count);
if (entryPointName)
shader->setEntryPoint(entryPointName);
if (sourceEntryPointName) {

View File

@ -157,7 +157,7 @@ namespace {
}
// Print helpful usage message to stdout, and exit
void usage(const char* const name, const char* const msg = 0)
void usage(const char* const name, const char* const msg = nullptr)
{
if (msg)
std::cout << msg << std::endl << std::endl;
@ -245,7 +245,7 @@ namespace {
verbosity = 1;
if (a < argc) {
char* end_ptr = 0;
char* end_ptr = nullptr;
int verb = ::strtol(argv[a], &end_ptr, 10);
// If we have not read to the end of the string or
// the string contained no elements, then we do not want to

View File

@ -35,7 +35,7 @@
#define GLSLANG_BUILD_INFO
#define GLSLANG_VERSION_MAJOR 11
#define GLSLANG_VERSION_MINOR 12
#define GLSLANG_VERSION_MINOR 13
#define GLSLANG_VERSION_PATCH 0
#define GLSLANG_VERSION_FLAVOR ""

View File

@ -82,7 +82,7 @@ void DeleteUniformMap(TUniformMap* map)
TShHandleBase* ConstructBindings()
{
return 0;
return nullptr;
}
void DeleteBindingList(TShHandleBase* bindingList)

View File

@ -3794,7 +3794,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttri
parseContext.unnestLooping();
--parseContext.controlFlowNestingLevel;
loopNode = intermediate.addLoop(statement, condition, 0, false, loc);
loopNode = intermediate.addLoop(statement, condition, nullptr, false, loc);
statement = loopNode;
break;

View File

@ -1596,7 +1596,7 @@ void HlslParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunction
//
bool builtIn;
TSymbol* symbol = symbolTable.find(function.getMangledName(), &builtIn);
const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0;
const TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr;
if (prototype) {
// All built-in functions are defined, even though they don't have a body.
@ -2472,7 +2472,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT
void HlslParseContext::handleFunctionArgument(TFunction* function,
TIntermTyped*& arguments, TIntermTyped* newArg)
{
TParameter param = { 0, new TType, nullptr };
TParameter param = { nullptr, new TType, nullptr };
param.type->shallowCopy(newArg->getType());
function->addParameter(param);
@ -7790,18 +7790,18 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
// Handle aggregates: put all args into the new function call
for (int arg = 0; arg < int(args->getAsAggregate()->getSequence().size()); ++arg) {
// TODO: But for constness, we could avoid the new & shallowCopy, and use the pointer directly.
TParameter param = { 0, new TType, nullptr };
TParameter param = { nullptr, new TType, nullptr };
param.type->shallowCopy(args->getAsAggregate()->getSequence()[arg]->getAsTyped()->getType());
convertedCall.addParameter(param);
}
} else if (args->getAsUnaryNode()) {
// Handle unaries: put all args into the new function call
TParameter param = { 0, new TType, nullptr };
TParameter param = { nullptr, new TType, nullptr };
param.type->shallowCopy(args->getAsUnaryNode()->getOperand()->getAsTyped()->getType());
convertedCall.addParameter(param);
} else if (args->getAsTyped()) {
// Handle bare e.g, floats, not in an aggregate.
TParameter param = { 0, new TType, nullptr };
TParameter param = { nullptr, new TType, nullptr };
param.type->shallowCopy(args->getAsTyped()->getType());
convertedCall.addParameter(param);
} else {

View File

@ -147,14 +147,14 @@ public:
void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&);
void declareStruct(const TSourceLoc&, TString& structName, TType&);
TSymbol* lookupUserType(const TString&, TType&);
TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = 0);
TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = nullptr);
void lengthenList(const TSourceLoc&, TIntermSequence& list, int size, TIntermTyped* scalarInit);
TIntermTyped* handleConstructor(const TSourceLoc&, TIntermTyped*, const TType&);
TIntermTyped* addConstructor(const TSourceLoc&, TIntermTyped*, const TType&);
TIntermTyped* convertArray(TIntermTyped*, const TType&);
TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&);
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset);
void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = 0);
void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = nullptr);
void declareStructBufferCounter(const TSourceLoc& loc, const TType& bufferType, const TString& name);
void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation);
void fixXfbOffsets(TQualifier&, TTypeList&);
@ -171,10 +171,10 @@ public:
void unnestAnnotations() { --annotationNestingLevel; }
int getAnnotationNestingLevel() { return annotationNestingLevel; }
void pushScope() { symbolTable.push(); }
void popScope() { symbolTable.pop(0); }
void popScope() { symbolTable.pop(nullptr); }
void pushThisScope(const TType&, const TVector<TFunctionDeclarator>&);
void popThisScope() { symbolTable.pop(0); }
void popThisScope() { symbolTable.pop(nullptr); }
void pushImplicitThis(TVariable* thisParameter) { implicitThisStack.push_back(thisParameter); }
void popImplicitThis() { implicitThisStack.pop_back(); }

View File

@ -65,6 +65,7 @@ enum TBasicType {
EbtAccStruct,
EbtReference,
EbtRayQuery,
EbtHitObjectNV,
#ifndef GLSLANG_WEB
// SPIR-V type defined by spirv_type
EbtSpirvType,
@ -104,6 +105,7 @@ enum TStorageQualifier {
EvqHitAttr,
EvqCallableData,
EvqCallableDataIn,
EvqHitObjectAttrNV,
EvqtaskPayloadSharedEXT,
@ -316,6 +318,13 @@ enum TBuiltInVariable {
EbvByteAddressBuffer,
EbvRWByteAddressBuffer,
// ARM specific core builtins
EbvCoreCountARM,
EbvCoreIDARM,
EbvCoreMaxIDARM,
EbvWarpIDARM,
EbvWarpMaxIDARM,
EbvLast
};
@ -368,6 +377,7 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q)
case EvqCallableData: return "callableDataNV"; break;
case EvqCallableDataIn: return "callableDataInNV"; break;
case EvqtaskPayloadSharedEXT: return "taskPayloadSharedEXT"; break;
case EvqHitObjectAttrNV:return "hitObjectAttributeNV"; break;
default: return "unknown qualifier";
}
}

View File

@ -37,7 +37,7 @@
#ifndef _POOLALLOC_INCLUDED_
#define _POOLALLOC_INCLUDED_
#ifdef _DEBUG
#ifndef NDEBUG
# define GUARD_BLOCKS // define to enable guard block sanity checking
#endif
@ -74,7 +74,7 @@ namespace glslang {
class TAllocation {
public:
TAllocation(size_t size, unsigned char* mem, TAllocation* prev = 0) :
TAllocation(size_t size, unsigned char* mem, TAllocation* prev = nullptr) :
size(size), mem(mem), prevAlloc(prev) {
// Allocations are bracketed:
// [allocationHeader][initialGuardBlock][userData][finalGuardBlock]
@ -171,7 +171,7 @@ public:
void popAll();
//
// Call allocate() to actually acquire memory. Returns 0 if no memory
// Call allocate() to actually acquire memory. Returns nullptr if no memory
// available, otherwise a properly aligned pointer to 'numBytes' of memory.
//
void* allocate(size_t numBytes);
@ -189,7 +189,7 @@ protected:
struct tHeader {
tHeader(tHeader* nextPage, size_t pageCount) :
#ifdef GUARD_BLOCKS
lastAllocation(0),
lastAllocation(nullptr),
#endif
nextPage(nextPage), pageCount(pageCount) { }

View File

@ -58,9 +58,9 @@ class TShHandleBase {
public:
TShHandleBase() { pool = new glslang::TPoolAllocator; }
virtual ~TShHandleBase() { delete pool; }
virtual TCompiler* getAsCompiler() { return 0; }
virtual TLinker* getAsLinker() { return 0; }
virtual TUniformMap* getAsUniformMap() { return 0; }
virtual TCompiler* getAsCompiler() { return nullptr; }
virtual TLinker* getAsLinker() { return nullptr; }
virtual TUniformMap* getAsUniformMap() { return nullptr; }
virtual glslang::TPoolAllocator* getPool() const { return pool; }
private:
glslang::TPoolAllocator* pool;
@ -123,11 +123,11 @@ public:
infoSink(iSink),
executable(e),
haveReturnableObjectCode(false),
appAttributeBindings(0),
fixedAttributeBindings(0),
excludedAttributes(0),
appAttributeBindings(nullptr),
fixedAttributeBindings(nullptr),
excludedAttributes(nullptr),
excludedCount(0),
uniformBindings(0) { }
uniformBindings(nullptr) { }
virtual TLinker* getAsLinker() { return this; }
virtual ~TLinker() { }
virtual bool link(TCompilerList&, TUniformMap*) = 0;
@ -137,7 +137,7 @@ public:
virtual void getAttributeBindings(ShBindingTable const **t) const = 0;
virtual void setExcludedAttributes(const int* attributes, int count) { excludedAttributes = attributes; excludedCount = count; }
virtual ShBindingTable* getUniformBindings() const { return uniformBindings; }
virtual const void* getObjectCode() const { return 0; } // a real compiler would be returning object code here
virtual const void* getObjectCode() const { return nullptr; } // a real compiler would be returning object code here
virtual TInfoSink& getInfoSink() { return infoSink; }
TInfoSink& infoSink;
protected:

View File

@ -429,6 +429,12 @@ enum TLayoutFormat {
ElfR16ui,
ElfR8ui,
ElfR64ui,
ElfExtSizeGuard, // to help with comparisons
ElfSize1x8,
ElfSize1x16,
ElfSize1x32,
ElfSize2x32,
ElfSize4x32,
ElfCount
};
@ -863,6 +869,9 @@ public:
bool isAnyCallable() const {
return storage == EvqCallableData || storage == EvqCallableDataIn;
}
bool isHitObjectAttrNV() const {
return storage == EvqHitObjectAttrNV;
}
// True if this type of IO is supposed to be arrayed with extra level for per-vertex data
bool isArrayedIo(EShLanguage language) const
@ -898,6 +907,9 @@ public:
// -2048 as the default value indicating layoutSecondaryViewportRelative is not set
layoutSecondaryViewportRelativeOffset = -2048;
layoutShaderRecord = false;
layoutHitObjectShaderRecordNV = false;
layoutBindlessSampler = false;
layoutBindlessImage = false;
layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
layoutFormat = ElfNone;
#endif
@ -997,10 +1009,14 @@ public:
bool layoutViewportRelative;
int layoutSecondaryViewportRelativeOffset;
bool layoutShaderRecord;
bool layoutHitObjectShaderRecordNV;
// GL_EXT_spirv_intrinsics
int spirvStorageClass;
TSpirvDecorate* spirvDecorate;
bool layoutBindlessSampler;
bool layoutBindlessImage;
#endif
bool hasUniformLayout() const
@ -1123,6 +1139,7 @@ public:
TLayoutFormat getFormat() const { return layoutFormat; }
bool isPushConstant() const { return layoutPushConstant; }
bool isShaderRecord() const { return layoutShaderRecord; }
bool hasHitObjectShaderRecordNV() const { return layoutHitObjectShaderRecordNV; }
bool hasBufferReference() const { return layoutBufferReference; }
bool hasBufferReferenceAlign() const
{
@ -1132,6 +1149,14 @@ public:
{
return nonUniform;
}
bool isBindlessSampler() const
{
return layoutBindlessSampler;
}
bool isBindlessImage() const
{
return layoutBindlessImage;
}
// GL_EXT_spirv_intrinsics
bool hasSprivDecorate() const { return spirvDecorate != nullptr; }
@ -1241,6 +1266,11 @@ public:
case ElfR8ui: return "r8ui";
case ElfR64ui: return "r64ui";
case ElfR64i: return "r64i";
case ElfSize1x8: return "size1x8";
case ElfSize1x16: return "size1x16";
case ElfSize1x32: return "size1x32";
case ElfSize2x32: return "size2x32";
case ElfSize4x32: return "size4x32";
default: return "none";
}
}
@ -1864,9 +1894,11 @@ public:
virtual bool isArray() const { return arraySizes != nullptr; }
virtual bool isSizedArray() const { return isArray() && arraySizes->isSized(); }
virtual bool isUnsizedArray() const { return isArray() && !arraySizes->isSized(); }
virtual bool isImplicitlySizedArray() const { return isArray() && arraySizes->isImplicitlySized(); }
virtual bool isArrayVariablyIndexed() const { assert(isArray()); return arraySizes->isVariablyIndexed(); }
virtual void setArrayVariablyIndexed() { assert(isArray()); arraySizes->setVariablyIndexed(); }
virtual void updateImplicitArraySize(int size) { assert(isArray()); arraySizes->updateImplicitSize(size); }
virtual void setImplicitlySized(bool isImplicitSized) { arraySizes->setImplicitlySized(isImplicitSized); }
virtual bool isStruct() const { return basicType == EbtStruct || basicType == EbtBlock; }
virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16; }
virtual bool isIntegerDomain() const
@ -1890,6 +1922,7 @@ public:
virtual bool isOpaque() const { return basicType == EbtSampler
#ifndef GLSLANG_WEB
|| basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtRayQuery
|| basicType == EbtHitObjectNV
#endif
; }
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
@ -1898,6 +1931,8 @@ public:
virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); }
virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); }
virtual bool isBindlessImage() const { return isImage() && qualifier.layoutBindlessImage; }
virtual bool isBindlessTexture() const { return isTexture() && qualifier.layoutBindlessSampler; }
// Check the block-name convention of creating a block without populating it's members:
virtual bool isUnusableName() const { return isStruct() && structure == nullptr; }
virtual bool isParameterized() const { return typeParameters != nullptr; }
@ -1954,6 +1989,11 @@ public:
return contains([](const TType* t) { return t->isOpaque(); } );
}
virtual bool containsSampler() const
{
return contains([](const TType* t) { return t->isTexture() || t->isImage(); });
}
// Recursively checks if the type contains a built-in variable
virtual bool containsBuiltIn() const
{
@ -2087,8 +2127,12 @@ public:
// an explicit array.
void adoptImplicitArraySizes(bool skipNonvariablyIndexed)
{
if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed()))
if (isUnsizedArray() &&
(qualifier.builtIn == EbvSampleMask ||
!(skipNonvariablyIndexed || isArrayVariablyIndexed()))) {
changeOuterArraySize(getImplicitArraySize());
setImplicitlySized(true);
}
// For multi-dim per-view arrays, set unsized inner dimension size to 1
if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized())
arraySizes->clearInnerUnsized();
@ -2283,8 +2327,16 @@ public:
appendStr(" layoutSecondaryViewportRelativeOffset=");
appendInt(qualifier.layoutSecondaryViewportRelativeOffset);
}
if (qualifier.layoutShaderRecord)
appendStr(" shaderRecordNV");
if (qualifier.layoutHitObjectShaderRecordNV)
appendStr(" hitobjectshaderrecordnv");
if (qualifier.layoutBindlessSampler)
appendStr(" layoutBindlessSampler");
if (qualifier.layoutBindlessImage)
appendStr(" layoutBindlessImage");
appendStr(")");
}
@ -2544,6 +2596,7 @@ public:
void setStruct(TTypeList* s) { assert(isStruct()); structure = s; }
TTypeList* getWritableStruct() const { assert(isStruct()); return structure; } // This should only be used when known to not be sharing with other threads
void setBasicType(const TBasicType& t) { basicType = t; }
void setVectorSize(int s) { vectorSize = s; }
int computeNumComponents() const
{
@ -2711,7 +2764,10 @@ public:
bool sameArrayness(const TType& right) const
{
return ((arraySizes == nullptr && right.arraySizes == nullptr) ||
(arraySizes != nullptr && right.arraySizes != nullptr && *arraySizes == *right.arraySizes));
(arraySizes != nullptr && right.arraySizes != nullptr &&
(*arraySizes == *right.arraySizes ||
(arraySizes->isImplicitlySized() && right.arraySizes->isDefaultImplicitlySized()) ||
(right.arraySizes->isImplicitlySized() && arraySizes->isDefaultImplicitlySized()))));
}
// See if two type's arrayness match in everything except their outer dimension

View File

@ -222,7 +222,7 @@ protected:
struct TArraySizes {
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
TArraySizes() : implicitArraySize(1), variablyIndexed(false) { }
TArraySizes() : implicitArraySize(0), implicitlySized(true), variablyIndexed(false){ }
// For breaking into two non-shared copies, independently modifiable.
TArraySizes& operator=(const TArraySizes& from)
@ -230,6 +230,7 @@ struct TArraySizes {
implicitArraySize = from.implicitArraySize;
variablyIndexed = from.variablyIndexed;
sizes = from.sizes;
implicitlySized = from.implicitlySized;
return *this;
}
@ -256,11 +257,17 @@ struct TArraySizes {
void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); }
void addInnerSize(TArraySize pair) {
sizes.push_back(pair.size, pair.node);
implicitlySized = false;
}
void addInnerSizes(const TArraySizes& s) { sizes.push_back(s.sizes); }
void changeOuterSize(int s) { sizes.changeFront((unsigned)s); }
int getImplicitSize() const { return implicitArraySize; }
void updateImplicitSize(int s) { implicitArraySize = std::max(implicitArraySize, s); }
void changeOuterSize(int s) {
sizes.changeFront((unsigned)s);
implicitlySized = false;
}
int getImplicitSize() const { return implicitArraySize > 0 ? implicitArraySize : 1; }
void updateImplicitSize(int s) {
implicitArraySize = (std::max)(implicitArraySize, s);
}
bool isInnerUnsized() const
{
for (int d = 1; d < sizes.size(); ++d) {
@ -295,6 +302,9 @@ struct TArraySizes {
bool hasUnsized() const { return getOuterSize() == UnsizedArraySize || isInnerUnsized(); }
bool isSized() const { return getOuterSize() != UnsizedArraySize; }
bool isImplicitlySized() const { return implicitlySized; }
bool isDefaultImplicitlySized() const { return implicitlySized && implicitArraySize == 0; }
void setImplicitlySized(bool isImplicitSizing) { implicitlySized = isImplicitSizing; }
void dereference() { sizes.pop_front(); }
void copyDereferenced(const TArraySizes& rhs)
{
@ -333,6 +343,7 @@ protected:
// the implicit size of the array, if not variably indexed and
// otherwise legal.
int implicitArraySize;
bool implicitlySized;
bool variablyIndexed; // true if array is indexed with a non compile-time constant
};

View File

@ -157,7 +157,13 @@ typedef struct glslang_resource_s {
int max_task_work_group_size_y_ext;
int max_task_work_group_size_z_ext;
int max_mesh_view_count_ext;
int maxDualSourceDrawBuffersEXT;
union
{
int max_dual_source_draw_buffers_ext;
/* Incorrectly capitalized name retained for backward compatibility */
int maxDualSourceDrawBuffersEXT;
};
glslang_limits_t limits;
} glslang_resource_t;

View File

@ -969,6 +969,41 @@ enum TOperator {
EOpRayQueryGetIntersectionWorldToObject,
//
// GL_NV_shader_invocation_reorder
//
EOpHitObjectTraceRayNV,
EOpHitObjectTraceRayMotionNV,
EOpHitObjectRecordHitNV,
EOpHitObjectRecordHitMotionNV,
EOpHitObjectRecordHitWithIndexNV,
EOpHitObjectRecordHitWithIndexMotionNV,
EOpHitObjectRecordMissNV,
EOpHitObjectRecordMissMotionNV,
EOpHitObjectRecordEmptyNV,
EOpHitObjectExecuteShaderNV,
EOpHitObjectIsEmptyNV,
EOpHitObjectIsMissNV,
EOpHitObjectIsHitNV,
EOpHitObjectGetRayTMinNV,
EOpHitObjectGetRayTMaxNV,
EOpHitObjectGetObjectRayOriginNV,
EOpHitObjectGetObjectRayDirectionNV,
EOpHitObjectGetWorldRayOriginNV,
EOpHitObjectGetWorldRayDirectionNV,
EOpHitObjectGetWorldToObjectNV,
EOpHitObjectGetObjectToWorldNV,
EOpHitObjectGetInstanceCustomIndexNV,
EOpHitObjectGetInstanceIdNV,
EOpHitObjectGetGeometryIndexNV,
EOpHitObjectGetPrimitiveIndexNV,
EOpHitObjectGetHitKindNV,
EOpHitObjectGetShaderBindingTableRecordIndexNV,
EOpHitObjectGetShaderRecordBufferHandleNV,
EOpHitObjectGetAttributesNV,
EOpHitObjectGetCurrentTimeNV,
EOpReorderThreadNV,
// HLSL operations
//
@ -1086,31 +1121,31 @@ public:
virtual const glslang::TSourceLoc& getLoc() const { return loc; }
virtual void setLoc(const glslang::TSourceLoc& l) { loc = l; }
virtual void traverse(glslang::TIntermTraverser*) = 0;
virtual glslang::TIntermTyped* getAsTyped() { return 0; }
virtual glslang::TIntermOperator* getAsOperator() { return 0; }
virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return 0; }
virtual glslang::TIntermAggregate* getAsAggregate() { return 0; }
virtual glslang::TIntermUnary* getAsUnaryNode() { return 0; }
virtual glslang::TIntermBinary* getAsBinaryNode() { return 0; }
virtual glslang::TIntermSelection* getAsSelectionNode() { return 0; }
virtual glslang::TIntermSwitch* getAsSwitchNode() { return 0; }
virtual glslang::TIntermMethod* getAsMethodNode() { return 0; }
virtual glslang::TIntermSymbol* getAsSymbolNode() { return 0; }
virtual glslang::TIntermBranch* getAsBranchNode() { return 0; }
virtual glslang::TIntermLoop* getAsLoopNode() { return 0; }
virtual glslang::TIntermTyped* getAsTyped() { return nullptr; }
virtual glslang::TIntermOperator* getAsOperator() { return nullptr; }
virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return nullptr; }
virtual glslang::TIntermAggregate* getAsAggregate() { return nullptr; }
virtual glslang::TIntermUnary* getAsUnaryNode() { return nullptr; }
virtual glslang::TIntermBinary* getAsBinaryNode() { return nullptr; }
virtual glslang::TIntermSelection* getAsSelectionNode() { return nullptr; }
virtual glslang::TIntermSwitch* getAsSwitchNode() { return nullptr; }
virtual glslang::TIntermMethod* getAsMethodNode() { return nullptr; }
virtual glslang::TIntermSymbol* getAsSymbolNode() { return nullptr; }
virtual glslang::TIntermBranch* getAsBranchNode() { return nullptr; }
virtual glslang::TIntermLoop* getAsLoopNode() { return nullptr; }
virtual const glslang::TIntermTyped* getAsTyped() const { return 0; }
virtual const glslang::TIntermOperator* getAsOperator() const { return 0; }
virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return 0; }
virtual const glslang::TIntermAggregate* getAsAggregate() const { return 0; }
virtual const glslang::TIntermUnary* getAsUnaryNode() const { return 0; }
virtual const glslang::TIntermBinary* getAsBinaryNode() const { return 0; }
virtual const glslang::TIntermSelection* getAsSelectionNode() const { return 0; }
virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return 0; }
virtual const glslang::TIntermMethod* getAsMethodNode() const { return 0; }
virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; }
virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; }
virtual const glslang::TIntermLoop* getAsLoopNode() const { return 0; }
virtual const glslang::TIntermTyped* getAsTyped() const { return nullptr; }
virtual const glslang::TIntermOperator* getAsOperator() const { return nullptr; }
virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return nullptr; }
virtual const glslang::TIntermAggregate* getAsAggregate() const { return nullptr; }
virtual const glslang::TIntermUnary* getAsUnaryNode() const { return nullptr; }
virtual const glslang::TIntermBinary* getAsBinaryNode() const { return nullptr; }
virtual const glslang::TIntermSelection* getAsSelectionNode() const { return nullptr; }
virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return nullptr; }
virtual const glslang::TIntermMethod* getAsMethodNode() const { return nullptr; }
virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return nullptr; }
virtual const glslang::TIntermBranch* getAsBranchNode() const { return nullptr; }
virtual const glslang::TIntermLoop* getAsLoopNode() const { return nullptr; }
virtual ~TIntermNode() { }
protected:
@ -1616,8 +1651,8 @@ protected:
//
class TIntermUnary : public TIntermOperator {
public:
TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}
TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}
TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(nullptr) {}
TIntermUnary(TOperator o) : TIntermOperator(o), operand(nullptr) {}
virtual void traverse(TIntermTraverser*);
virtual void setOperand(TIntermTyped* o) { operand = o; }
virtual TIntermTyped* getOperand() { return operand; }
@ -1819,7 +1854,7 @@ public:
TIntermNode *getParentNode()
{
return path.size() == 0 ? NULL : path.back();
return path.size() == 0 ? nullptr : path.back();
}
const bool preVisit;

View File

@ -226,7 +226,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const());
break;
default:
return 0;
return nullptr;
#endif
}
}
@ -354,7 +354,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
break;
default:
return 0;
return nullptr;
}
TIntermConstantUnion *newNode = new TIntermConstantUnion(newConstArray, returnType);
@ -1345,7 +1345,7 @@ TIntermTyped* TIntermediate::foldDereference(TIntermTyped* node, int index, cons
{
TType dereferencedType(node->getType(), index);
dereferencedType.getQualifier().storage = EvqConst;
TIntermTyped* result = 0;
TIntermTyped* result = nullptr;
int size = dereferencedType.computeNumComponents();
// arrays, vectors, matrices, all use simple multiplicative math
@ -1365,7 +1365,7 @@ TIntermTyped* TIntermediate::foldDereference(TIntermTyped* node, int index, cons
result = addConstantUnion(TConstUnionArray(node->getAsConstantUnion()->getConstArray(), start, size), node->getType(), loc);
if (result == 0)
if (result == nullptr)
result = node;
else
result->setType(dereferencedType);
@ -1387,7 +1387,7 @@ TIntermTyped* TIntermediate::foldSwizzle(TIntermTyped* node, TSwizzleSelectors<T
TIntermTyped* result = addConstantUnion(constArray, node->getType(), loc);
if (result == 0)
if (result == nullptr)
result = node;
else
result->setType(TType(node->getBasicType(), EvqConst, selectors.size()));

View File

@ -4550,7 +4550,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
// Builtins for GL_NV_ray_tracing/GL_NV_ray_tracing_motion_blur/GL_EXT_ray_tracing/GL_EXT_ray_query
// Builtins for GL_NV_ray_tracing/GL_NV_ray_tracing_motion_blur/GL_EXT_ray_tracing/GL_EXT_ray_query/
// GL_NV_shader_invocation_reorder
if (profile != EEsProfile && version >= 460) {
commonBuiltins.append("void rayQueryInitializeEXT(rayQueryEXT, accelerationStructureEXT, uint, uint, vec3, float, vec3, float);"
"void rayQueryTerminateEXT(rayQueryEXT);"
@ -4583,6 +4584,39 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
"void executeCallableNV(uint, int);"
"void executeCallableEXT(uint, int);"
"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordHitWithIndexNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordMissNV(hitObjectNV,uint,vec3,float,vec3,float);"
"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"
"void hitObjectRecordEmptyNV(hitObjectNV);"
"void hitObjectExecuteShaderNV(hitObjectNV,int);"
"bool hitObjectIsEmptyNV(hitObjectNV);"
"bool hitObjectIsMissNV(hitObjectNV);"
"bool hitObjectIsHitNV(hitObjectNV);"
"float hitObjectGetRayTMinNV(hitObjectNV);"
"float hitObjectGetRayTMaxNV(hitObjectNV);"
"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"
"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"
"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"
"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"
"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"
"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"
"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"
"int hitObjectGetInstanceIdNV(hitObjectNV);"
"int hitObjectGetGeometryIndexNV(hitObjectNV);"
"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"
"uint hitObjectGetHitKindNV(hitObjectNV);"
"void hitObjectGetAttributesNV(hitObjectNV,int);"
"float hitObjectGetCurrentTimeNV(hitObjectNV);"
"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"
"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"
"void reorderThreadNV(uint, uint);"
"void reorderThreadNV(hitObjectNV);"
"void reorderThreadNV(hitObjectNV, uint, uint);"
"\n");
stageBuiltins[EShLangIntersect].append(
"bool reportIntersectionNV(float, uint);"
@ -4598,6 +4632,36 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
"void executeCallableNV(uint, int);"
"void executeCallableEXT(uint, int);"
"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordHitWithIndexNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordMissNV(hitObjectNV, uint, vec3, float, vec3, float);"
"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"
"void hitObjectRecordEmptyNV(hitObjectNV);"
"void hitObjectExecuteShaderNV(hitObjectNV, int);"
"bool hitObjectIsEmptyNV(hitObjectNV);"
"bool hitObjectIsMissNV(hitObjectNV);"
"bool hitObjectIsHitNV(hitObjectNV);"
"float hitObjectGetRayTMinNV(hitObjectNV);"
"float hitObjectGetRayTMaxNV(hitObjectNV);"
"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"
"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"
"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"
"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"
"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"
"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"
"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"
"int hitObjectGetInstanceIdNV(hitObjectNV);"
"int hitObjectGetGeometryIndexNV(hitObjectNV);"
"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"
"uint hitObjectGetHitKindNV(hitObjectNV);"
"void hitObjectGetAttributesNV(hitObjectNV,int);"
"float hitObjectGetCurrentTimeNV(hitObjectNV);"
"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"
"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"
"\n");
stageBuiltins[EShLangMiss].append(
"void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
@ -4605,6 +4669,36 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
"void executeCallableNV(uint, int);"
"void executeCallableEXT(uint, int);"
"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordHitWithIndexNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"
"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"
"void hitObjectRecordMissNV(hitObjectNV, uint, vec3, float, vec3, float);"
"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"
"void hitObjectRecordEmptyNV(hitObjectNV);"
"void hitObjectExecuteShaderNV(hitObjectNV, int);"
"bool hitObjectIsEmptyNV(hitObjectNV);"
"bool hitObjectIsMissNV(hitObjectNV);"
"bool hitObjectIsHitNV(hitObjectNV);"
"float hitObjectGetRayTMinNV(hitObjectNV);"
"float hitObjectGetRayTMaxNV(hitObjectNV);"
"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"
"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"
"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"
"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"
"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"
"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"
"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"
"int hitObjectGetInstanceIdNV(hitObjectNV);"
"int hitObjectGetGeometryIndexNV(hitObjectNV);"
"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"
"uint hitObjectGetHitKindNV(hitObjectNV);"
"void hitObjectGetAttributesNV(hitObjectNV,int);"
"float hitObjectGetCurrentTimeNV(hitObjectNV);"
"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"
"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"
"\n");
stageBuiltins[EShLangCallable].append(
"void executeCallableNV(uint, int);"
@ -5737,6 +5831,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in highp uint gl_SMCountNV;"
"in highp uint gl_WarpIDNV;"
"in highp uint gl_SMIDNV;"
// GL_ARM_shader_core_builtins
"in highp uint gl_CoreIDARM;"
"in highp uint gl_CoreCountARM;"
"in highp uint gl_CoreMaxIDARM;"
"in highp uint gl_WarpIDARM;"
"in highp uint gl_WarpMaxIDARM;"
"\n";
const char* fragmentSubgroupDecls =
"flat in mediump uint gl_SubgroupSize;"
@ -5751,6 +5851,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"flat in highp uint gl_SMCountNV;"
"flat in highp uint gl_WarpIDNV;"
"flat in highp uint gl_SMIDNV;"
// GL_ARM_shader_core_builtins
"flat in highp uint gl_CoreIDARM;"
"flat in highp uint gl_CoreCountARM;"
"flat in highp uint gl_CoreMaxIDARM;"
"flat in highp uint gl_WarpIDARM;"
"flat in highp uint gl_WarpMaxIDARM;"
"\n";
const char* computeSubgroupDecls =
"in highp uint gl_NumSubgroups;"
@ -5770,6 +5876,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in highp uint gl_SMCountNV;"
"in highp volatile uint gl_WarpIDNV;"
"in highp volatile uint gl_SMIDNV;"
// GL_ARM_shader_core_builtins
"in highp uint gl_CoreIDARM;"
"in highp uint gl_CoreCountARM;"
"in highp uint gl_CoreMaxIDARM;"
"in highp uint gl_WarpIDARM;"
"in highp uint gl_WarpMaxIDARM;"
"\n";
stageBuiltins[EShLangVertex] .append(subgroupDecls);
@ -8036,6 +8148,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
// GL_ARM_shader_core_builtins
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
}
if (language == EShLangGeometry || language == EShLangVertex) {
@ -8551,6 +8676,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
// GL_ARM_shader_core_builtins
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
}
if (profile == EEsProfile) {
@ -8694,6 +8832,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
// GL_ARM_shader_core_builtins
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
}
// GL_KHR_shader_subgroup
@ -8795,6 +8946,38 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("executeCallableNV", 1, &E_GL_NV_ray_tracing);
symbolTable.setFunctionExtensions("executeCallableEXT", 1, &E_GL_EXT_ray_tracing);
symbolTable.setFunctionExtensions("hitObjectTraceRayNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectTraceRayMotionNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectRecordHitNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectRecordHitMotionNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectRecordHitWithIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectRecordHitWithIndexMotionNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectRecordMissNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectRecordMissMotionNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectRecordEmptyNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectExecuteShaderNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectIsEmptyNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectIsMissNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectIsHitNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetRayTMinNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetRayTMaxNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetObjectRayOriginNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetObjectRayDirectionNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetWorldRayOriginNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetWorldRayDirectionNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetWorldToObjectNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetbjectToWorldNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetInstanceCustomIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetInstanceIdNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetGeometryIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetPrimitiveIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetHitKindNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetAttributesNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetCurrentTimeNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetShaderBindingTableRecordIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("hitObjectGetShaderRecordBufferHandleNV", 1, &E_GL_NV_shader_invocation_reorder);
symbolTable.setFunctionExtensions("reorderThreadNV", 1, &E_GL_NV_shader_invocation_reorder);
BuiltInVariable("gl_LaunchIDNV", EbvLaunchId, symbolTable);
BuiltInVariable("gl_LaunchIDEXT", EbvLaunchId, symbolTable);
@ -8888,6 +9071,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
// GL_ARM_shader_core_builtins
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
}
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 450)) {
@ -9094,6 +9290,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
// GL_ARM_shader_core_builtins
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
}
if ((profile == EEsProfile && version >= 310) ||
@ -9224,6 +9433,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
// GL_ARM_shader_core_builtins
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
}
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 450)) {
@ -9759,6 +9981,38 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("traceRayEXT", EOpTraceKHR);
symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV);
symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallableKHR);
symbolTable.relateToOperator("hitObjectTraceRayNV", EOpHitObjectTraceRayNV);
symbolTable.relateToOperator("hitObjectTraceRayMotionNV", EOpHitObjectTraceRayMotionNV);
symbolTable.relateToOperator("hitObjectRecordHitNV", EOpHitObjectRecordHitNV);
symbolTable.relateToOperator("hitObjectRecordHitMotionNV", EOpHitObjectRecordHitMotionNV);
symbolTable.relateToOperator("hitObjectRecordHitWithIndexNV", EOpHitObjectRecordHitWithIndexNV);
symbolTable.relateToOperator("hitObjectRecordHitWithIndexMotionNV", EOpHitObjectRecordHitWithIndexMotionNV);
symbolTable.relateToOperator("hitObjectRecordMissNV", EOpHitObjectRecordMissNV);
symbolTable.relateToOperator("hitObjectRecordMissMotionNV", EOpHitObjectRecordMissMotionNV);
symbolTable.relateToOperator("hitObjectRecordEmptyNV", EOpHitObjectRecordEmptyNV);
symbolTable.relateToOperator("hitObjectExecuteShaderNV", EOpHitObjectExecuteShaderNV);
symbolTable.relateToOperator("hitObjectIsEmptyNV", EOpHitObjectIsEmptyNV);
symbolTable.relateToOperator("hitObjectIsMissNV", EOpHitObjectIsMissNV);
symbolTable.relateToOperator("hitObjectIsHitNV", EOpHitObjectIsHitNV);
symbolTable.relateToOperator("hitObjectGetRayTMinNV", EOpHitObjectGetRayTMinNV);
symbolTable.relateToOperator("hitObjectGetRayTMaxNV", EOpHitObjectGetRayTMaxNV);
symbolTable.relateToOperator("hitObjectGetObjectRayOriginNV", EOpHitObjectGetObjectRayOriginNV);
symbolTable.relateToOperator("hitObjectGetObjectRayDirectionNV", EOpHitObjectGetObjectRayDirectionNV);
symbolTable.relateToOperator("hitObjectGetWorldRayOriginNV", EOpHitObjectGetWorldRayOriginNV);
symbolTable.relateToOperator("hitObjectGetWorldRayDirectionNV", EOpHitObjectGetWorldRayDirectionNV);
symbolTable.relateToOperator("hitObjectGetWorldToObjectNV", EOpHitObjectGetWorldToObjectNV);
symbolTable.relateToOperator("hitObjectGetObjectToWorldNV", EOpHitObjectGetObjectToWorldNV);
symbolTable.relateToOperator("hitObjectGetInstanceCustomIndexNV", EOpHitObjectGetInstanceCustomIndexNV);
symbolTable.relateToOperator("hitObjectGetInstanceIdNV", EOpHitObjectGetInstanceIdNV);
symbolTable.relateToOperator("hitObjectGetGeometryIndexNV", EOpHitObjectGetGeometryIndexNV);
symbolTable.relateToOperator("hitObjectGetPrimitiveIndexNV", EOpHitObjectGetPrimitiveIndexNV);
symbolTable.relateToOperator("hitObjectGetHitKindNV", EOpHitObjectGetHitKindNV);
symbolTable.relateToOperator("hitObjectGetAttributesNV", EOpHitObjectGetAttributesNV);
symbolTable.relateToOperator("hitObjectGetCurrentTimeNV", EOpHitObjectGetCurrentTimeNV);
symbolTable.relateToOperator("hitObjectGetShaderBindingTableRecordIndexNV", EOpHitObjectGetShaderBindingTableRecordIndexNV);
symbolTable.relateToOperator("hitObjectGetShaderRecordBufferHandleNV", EOpHitObjectGetShaderRecordBufferHandleNV);
symbolTable.relateToOperator("reorderThreadNV", EOpReorderThreadNV);
}
break;
case EShLangIntersect:

View File

@ -352,7 +352,7 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT
TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child,
const TSourceLoc& loc)
{
if (child == 0)
if (child == nullptr)
return nullptr;
if (child->getType().getBasicType() == EbtBlock)
@ -751,6 +751,11 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
case EbtInt64: newOp = EOpConvInt64ToUint; break;
case EbtUint64: newOp = EOpConvUint64ToUint; break;
#endif
// For bindless texture type conversion, add a dummy convert op, just
// to generate a new TIntermTyped
// uvec2(any sampler type)
// uvec2(any image type)
case EbtSampler: newOp = EOpConvIntToUint; break;
default:
return false;
}

View File

@ -159,7 +159,8 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
//
switch (node->getBasicType()) {
case EbtSampler:
message = "can't modify a sampler";
if (extensionTurnedOn(E_GL_ARB_bindless_texture) == false)
message = "can't modify a sampler";
break;
case EbtVoid:
message = "can't modify void";
@ -174,6 +175,9 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
case EbtRayQuery:
message = "can't modify rayQueryEXT";
break;
case EbtHitObjectNV:
message = "can't modify hitObjectNV";
break;
#endif
default:
break;

View File

@ -608,6 +608,15 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
#ifndef GLSLANG_WEB
if (base->getType().isUnsizedArray()) {
base->getWritableType().updateImplicitArraySize(indexValue + 1);
base->getWritableType().setImplicitlySized(true);
if (base->getQualifier().builtIn == EbvClipDistance &&
indexValue >= resources.maxClipDistances) {
error(loc, "gl_ClipDistance", "[", "array index out of range '%d'", indexValue);
}
else if (base->getQualifier().builtIn == EbvCullDistance &&
indexValue >= resources.maxCullDistances) {
error(loc, "gl_CullDistance", "[", "array index out of range '%d'", indexValue);
}
// For 2D per-view builtin arrays, update the inner dimension size in parent type
if (base->getQualifier().isPerView() && base->getQualifier().builtIn != EbvNone) {
TIntermBinary* binaryNode = base->getAsBinaryNode();
@ -1026,14 +1035,22 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier());
} else {
auto baseSymbol = base;
while (baseSymbol->getAsSymbolNode() == nullptr)
baseSymbol = baseSymbol->getAsBinaryNode()->getLeft();
TString structName;
structName.append("\'").append(baseSymbol->getAsSymbolNode()->getName().c_str()).append( "\'");
error(loc, "no such field in structure", field.c_str(), structName.c_str());
while (baseSymbol->getAsSymbolNode() == nullptr) {
auto binaryNode = baseSymbol->getAsBinaryNode();
if (binaryNode == nullptr) break;
baseSymbol = binaryNode->getLeft();
}
if (baseSymbol->getAsSymbolNode() != nullptr) {
TString structName;
structName.append("\'").append(baseSymbol->getAsSymbolNode()->getName().c_str()).append("\'");
error(loc, "no such field in structure", field.c_str(), structName.c_str());
} else {
error(loc, "no such field in structure", field.c_str(), "");
}
}
} else
error(loc, "does not apply to this type:", field.c_str(), base->getType().getCompleteString(intermediate.getEnhancedMsgs()).c_str());
error(loc, "does not apply to this type:", field.c_str(),
base->getType().getCompleteString(intermediate.getEnhancedMsgs()).c_str());
// Propagate noContraction up the dereference chain
if (base->getQualifier().isNoContraction())
@ -1165,7 +1182,7 @@ TFunction* TParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunct
if (symbol && builtIn && function.getBuiltInOp() == EOpSpirvInst)
symbol = nullptr;
#endif
const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0;
const TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr;
if (prevDec) {
if (prevDec->isPrototyped() && prototype)
profileRequires(loc, EEsProfile, 300, nullptr, "multiple prototypes for same function");
@ -1389,7 +1406,8 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
#endif
const TType& argType = arg->getAsTyped()->getType();
const TQualifier& argQualifier = argType.getQualifier();
if (argQualifier.isMemory() && (argType.containsOpaque() || argType.isReference())) {
bool containsBindlessSampler = intermediate.getBindlessMode() && argType.containsSampler();
if (argQualifier.isMemory() && !containsBindlessSampler && (argType.containsOpaque() || argType.isReference())) {
const char* message = "argument cannot drop memory qualifier when passed to formal parameter";
#ifndef GLSLANG_WEB
if (argQualifier.volatil && ! formalQualifier.volatil)
@ -1675,9 +1693,13 @@ TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermType
error(loc, "type does not match, or is not convertible to, the function's return type", "return", "");
branch = intermediate.addBranch(EOpReturn, value, loc);
}
} else
} else {
if (value->getType().isTexture() || value->getType().isImage()) {
if (!extensionTurnedOn(E_GL_ARB_bindless_texture))
error(loc, "sampler or image can be used as return type only when the extension GL_ARB_bindless_texture enabled", "return", "");
}
branch = intermediate.addBranch(EOpReturn, value, loc);
}
branch->updatePrecision(currentFunctionType->getQualifier().precision);
return branch;
}
@ -1928,6 +1950,9 @@ TIntermTyped* TParseContext::addAssign(const TSourceLoc& loc, TOperator op, TInt
if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference())
requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "+= and -= on a buffer reference");
if (op == EOpAssign && left->getBasicType() == EbtSampler && right->getBasicType() == EbtSampler)
requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "sampler assignment for bindless texture");
return intermediate.addAssign(op, left, right, loc);
}
@ -2360,6 +2385,79 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
}
break;
case EOpHitObjectTraceRayNV:
if (!(*argp)[11]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "payload number", "");
else {
unsigned int location = (*argp)[11]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0)
error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location);
}
break;
case EOpHitObjectTraceRayMotionNV:
if (!(*argp)[12]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "payload number", "");
else {
unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0)
error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location);
}
break;
case EOpHitObjectExecuteShaderNV:
if (!(*argp)[1]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "payload number", "");
else {
unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0)
error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location);
}
break;
case EOpHitObjectRecordHitNV:
if (!(*argp)[12]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "hitobjectattribute number", "");
else {
unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0)
error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location);
}
break;
case EOpHitObjectRecordHitMotionNV:
if (!(*argp)[13]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "hitobjectattribute number", "");
else {
unsigned int location = (*argp)[13]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0)
error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location);
}
break;
case EOpHitObjectRecordHitWithIndexNV:
if (!(*argp)[11]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "hitobjectattribute number", "");
else {
unsigned int location = (*argp)[11]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0)
error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location);
}
break;
case EOpHitObjectRecordHitWithIndexMotionNV:
if (!(*argp)[12]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "hitobjectattribute number", "");
else {
unsigned int location = (*argp)[12]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0)
error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location);
}
break;
case EOpHitObjectGetAttributesNV:
if (!(*argp)[1]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "hitobjectattribute number", "");
else {
unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(2, location) < 0)
error(loc, "with layout(location =", "no hitObjectAttributeNV declared", "%d)", location);
}
break;
case EOpRayQueryGetIntersectionType:
case EOpRayQueryGetIntersectionT:
case EOpRayQueryGetIntersectionInstanceCustomIndex:
@ -2811,6 +2909,14 @@ TFunction* TParseContext::handleConstructorCall(const TSourceLoc& loc, const TPu
profileRequires(loc, EEsProfile, 300, nullptr, "arrayed constructor");
}
// Reuse EOpConstructTextureSampler for bindless image constructor
// uvec2 imgHandle;
// imageLoad(image1D(imgHandle), 0);
if (type.isImage() && extensionTurnedOn(E_GL_ARB_bindless_texture))
{
intermediate.setBindlessImageMode(currentCaller, AstRefTypeFunc);
}
TOperator op = intermediate.mapTypeToConstructorOp(type);
if (op == EOpNull) {
@ -3140,7 +3246,7 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden
ppWarn(loc, "\"defined\" is (un)defined:", op, identifier);
else
ppError(loc, "\"defined\" can't be (un)defined:", op, identifier);
else if (strstr(identifier, "__") != 0 && !extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) {
else if (strstr(identifier, "__") != nullptr && !extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) {
// The extension GL_EXT_spirv_intrinsics allows us to declare macros prefixed with "__".
if (isEsProfile() && version >= 300 &&
(strcmp(identifier, "__LINE__") == 0 ||
@ -3544,8 +3650,13 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
return true;
}
if (op != EOpConstructStruct && op != EOpConstructNonuniform && typed->getBasicType() == EbtSampler) {
error(loc, "cannot convert a sampler", constructorString.c_str(), "");
return true;
if (op == EOpConstructUVec2 && extensionTurnedOn(E_GL_ARB_bindless_texture)) {
intermediate.setBindlessTextureMode(currentCaller, AstRefTypeFunc);
}
else {
error(loc, "cannot convert a sampler", constructorString.c_str(), "");
return true;
}
}
if (op != EOpConstructStruct && typed->isAtomic()) {
error(loc, "cannot convert an atomic_uint", constructorString.c_str(), "");
@ -3565,6 +3676,26 @@ bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const
{
TString constructorName = function.getType().getBasicTypeString(); // TODO: performance: should not be making copy; interface needs to change
const char* token = constructorName.c_str();
// verify the constructor for bindless texture, the input must be ivec2 or uvec2
if (function.getParamCount() == 1) {
TType* pType = function[0].type;
TBasicType basicType = pType->getBasicType();
bool isIntegerVec2 = ((basicType == EbtUint || basicType == EbtInt) && pType->getVectorSize() == 2);
bool bindlessMode = extensionTurnedOn(E_GL_ARB_bindless_texture);
if (isIntegerVec2 && bindlessMode) {
if (pType->getSampler().isImage())
intermediate.setBindlessImageMode(currentCaller, AstRefTypeFunc);
else
intermediate.setBindlessTextureMode(currentCaller, AstRefTypeFunc);
return false;
} else {
if (!bindlessMode)
error(loc, "sampler-constructor requires the extension GL_ARB_bindless_texture enabled", token, "");
else
error(loc, "sampler-constructor requires the input to be ivec2 or uvec2", token, "");
return true;
}
}
// exactly two arguments needed
if (function.getParamCount() != 2) {
@ -3660,13 +3791,32 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const
if (type.getQualifier().storage == EvqUniform)
return;
if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtSampler))
error(loc, "non-uniform struct contains a sampler or image:", type.getBasicTypeString().c_str(), identifier.c_str());
if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtSampler)) {
// For bindless texture, sampler can be declared as an struct member
if (extensionTurnedOn(E_GL_ARB_bindless_texture)) {
if (type.getSampler().isImage())
intermediate.setBindlessImageMode(currentCaller, AstRefTypeVar);
else
intermediate.setBindlessTextureMode(currentCaller, AstRefTypeVar);
}
else {
error(loc, "non-uniform struct contains a sampler or image:", type.getBasicTypeString().c_str(), identifier.c_str());
}
}
else if (type.getBasicType() == EbtSampler && type.getQualifier().storage != EvqUniform) {
// non-uniform sampler
// not yet: okay if it has an initializer
// if (! initializer)
error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str());
// For bindless texture, sampler can be declared as an input/output/block member
if (extensionTurnedOn(E_GL_ARB_bindless_texture)) {
if (type.getSampler().isImage())
intermediate.setBindlessImageMode(currentCaller, AstRefTypeVar);
else
intermediate.setBindlessTextureMode(currentCaller, AstRefTypeVar);
}
else {
// non-uniform sampler
// not yet: okay if it has an initializer
// if (! initializer)
error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str());
}
}
}
@ -3732,7 +3882,7 @@ void TParseContext::memberQualifierCheck(glslang::TPublicType& publicType)
//
// Check/fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
//
void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& qualifier, bool isMemberCheck)
void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& qualifier, bool isMemberCheck, const TPublicType* publicType)
{
bool nonuniformOkay = false;
@ -3768,6 +3918,11 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q
{
requireExtensions(loc, 1, &E_GL_EXT_scalar_block_layout, "default std430 layout for uniform");
}
if (publicType != nullptr && publicType->isImage() &&
(qualifier.layoutFormat > ElfExtSizeGuard && qualifier.layoutFormat < ElfCount))
qualifier.layoutFormat = mapLegacyLayoutFormat(qualifier.layoutFormat, publicType->sampler.getBasicType());
break;
default:
break;
@ -4172,7 +4327,7 @@ void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType ba
void TParseContext::parameterTypeCheck(const TSourceLoc& loc, TStorageQualifier qualifier, const TType& type)
{
if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque())
if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque() && !intermediate.getBindlessMode())
error(loc, "samplers and atomic_uints cannot be output parameters", type.getBasicTypeString().c_str(), "");
if (!parsingBuiltins && type.contains16BitFloat())
requireFloat16Arithmetic(loc, type.getBasicTypeString().c_str(), "float16 types can only be in uniform block or buffer storage");
@ -4516,7 +4671,7 @@ void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermType
// check for additional things allowed by GL_EXT_nonuniform_qualifier
if (base.getBasicType() == EbtSampler || base.getBasicType() == EbtAccStruct || base.getBasicType() == EbtRayQuery ||
(base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer()))
base.getBasicType() == EbtHitObjectNV || (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer()))
requireExtensions(loc, 1, &E_GL_EXT_nonuniform_qualifier, "variable index");
else
error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable");
@ -5105,7 +5260,7 @@ void TParseContext::arrayObjectCheck(const TSourceLoc& loc, const TType& type, c
void TParseContext::opaqueCheck(const TSourceLoc& loc, const TType& type, const char* op)
{
if (containsFieldWithBasicType(type, EbtSampler))
if (containsFieldWithBasicType(type, EbtSampler) && !extensionTurnedOn(E_GL_ARB_bindless_texture))
error(loc, "can't use with samplers or structs containing samplers", op, "");
}
@ -5206,7 +5361,7 @@ void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init,
bool badInit = false;
if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1)
badInit = true;
TIntermBinary* binaryInit = 0;
TIntermBinary* binaryInit = nullptr;
if (! badInit) {
// get the declaration assignment
binaryInit = init->getAsAggregate()->getSequence()[0]->getAsBinaryNode();
@ -5480,6 +5635,28 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
intermediate.setUsePhysicalStorageBuffer();
return;
}
if (id == "bindless_sampler") {
requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "bindless_sampler");
publicType.qualifier.layoutBindlessSampler = true;
intermediate.setBindlessTextureMode(currentCaller, AstRefTypeLayout);
return;
}
if (id == "bindless_image") {
requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "bindless_image");
publicType.qualifier.layoutBindlessImage = true;
intermediate.setBindlessImageMode(currentCaller, AstRefTypeLayout);
return;
}
if (id == "bound_sampler") {
requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "bound_sampler");
publicType.qualifier.layoutBindlessSampler = false;
return;
}
if (id == "bound_image") {
requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "bound_image");
publicType.qualifier.layoutBindlessImage = false;
return;
}
if (language == EShLangGeometry || language == EShLangTessEvaluation || language == EShLangMesh) {
if (id == TQualifier::getGeometryString(ElgTriangles)) {
publicType.shaderQualifiers.geometry = ElgTriangles;
@ -5674,6 +5851,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
}
publicType.qualifier.layoutShaderRecord = true;
return;
} else if (id == "hitobjectshaderrecordnv") {
requireExtensions(loc, 1, &E_GL_NV_shader_invocation_reorder, "hitobject shader record NV");
publicType.qualifier.layoutHitObjectShaderRecordNV = true;
return;
}
}
@ -6015,7 +6196,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
if (language == EShLangMesh || language == EShLangTask) {
requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "gl_WorkGroupSize");
} else {
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize");
profileRequires(loc, EEsProfile, 310, nullptr, "gl_WorkGroupSize");
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
}
#endif
@ -6137,10 +6318,16 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie
dst.layoutSecondaryViewportRelativeOffset = src.layoutSecondaryViewportRelativeOffset;
if (src.layoutShaderRecord)
dst.layoutShaderRecord = true;
if (src.layoutBindlessSampler)
dst.layoutBindlessSampler = true;
if (src.layoutBindlessImage)
dst.layoutBindlessImage = true;
if (src.pervertexNV)
dst.pervertexNV = true;
if (src.pervertexEXT)
dst.pervertexEXT = true;
if (src.layoutHitObjectShaderRecordNV)
dst.layoutHitObjectShaderRecordNV = true;
#endif
}
}
@ -6298,6 +6485,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
case EvqHitAttr:
case EvqCallableData:
case EvqCallableDataIn:
case EvqHitObjectAttrNV:
break;
#endif
default:
@ -6418,7 +6606,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
// Image format
if (qualifier.hasFormat()) {
if (! type.isImage())
if (! type.isImage() && !intermediate.getBindlessImageMode())
error(loc, "only apply to images", TQualifier::getLayoutFormatString(qualifier.getFormat()), "");
else {
if (type.getSampler().type == EbtFloat && qualifier.getFormat() > ElfFloatGuard)
@ -6437,7 +6625,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
}
}
}
} else if (type.isImage() && ! qualifier.isWriteOnly()) {
} else if (type.isImage() && ! qualifier.isWriteOnly() && !intermediate.getBindlessImageMode()) {
const char *explanation = "image variables not declared 'writeonly' and without a format layout qualifier";
requireProfile(loc, ECoreProfile | ECompatibilityProfile, explanation);
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shader_image_load_formatted, explanation);
@ -7082,7 +7270,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T
realFunc.addParameter(TParameter().copyParam((*function)[i]));
}
TParameter tmpP = { 0, &uintType };
TParameter tmpP = { nullptr, &uintType };
realFunc.addParameter(TParameter().copyParam(tmpP));
arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(1, loc, true));
@ -7099,7 +7287,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T
realFunc.addParameter(TParameter().copyParam((*function)[i]));
}
TParameter tmpP = { 0, &uintType };
TParameter tmpP = { nullptr, &uintType };
realFunc.addParameter(TParameter().copyParam(tmpP));
arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(-1, loc, true));
@ -7253,7 +7441,10 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
if (initializer) {
if (type.getBasicType() == EbtRayQuery) {
error(loc, "ray queries can only be initialized by using the rayQueryInitializeEXT intrinsic:", "=", identifier.c_str());
} else if (type.getBasicType() == EbtHitObjectNV) {
error(loc, "hit objects cannot be initialized using initializers", "=", identifier.c_str());
}
}
if (type.isCoopMat()) {
@ -7745,12 +7936,14 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
// Combined texture-sampler constructors are completely semantic checked
// in constructorTextureSamplerError()
if (op == EOpConstructTextureSampler) {
if (aggrNode->getSequence()[1]->getAsTyped()->getType().getSampler().shadow) {
// Transfer depth into the texture (SPIR-V image) type, as a hint
// for tools to know this texture/image is a depth image.
aggrNode->getSequence()[0]->getAsTyped()->getWritableType().getSampler().shadow = true;
if (aggrNode != nullptr) {
if (aggrNode->getSequence()[1]->getAsTyped()->getType().getSampler().shadow) {
// Transfer depth into the texture (SPIR-V image) type, as a hint
// for tools to know this texture/image is a depth image.
aggrNode->getSequence()[0]->getAsTyped()->getWritableType().getSampler().shadow = true;
}
return intermediate.setAggregateOperator(aggrNode, op, type, loc);
}
return intermediate.setAggregateOperator(aggrNode, op, type, loc);
}
TTypeList::const_iterator memberTypes;
@ -7885,6 +8078,16 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUvec2, true, node,
type);
return newNode;
} else if (node->getType().getBasicType() == EbtSampler) {
requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "sampler conversion to uvec2");
// force the basic type of the constructor param to uvec2, otherwise spv builder will
// report some errors
TIntermTyped* newSrcNode = intermediate.createConversion(EbtUint, node);
newSrcNode->getAsTyped()->getWritableType().setVectorSize(2);
TIntermTyped* newNode =
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructUVec2, false, newSrcNode, type);
return newNode;
}
case EOpConstructUVec3:
case EOpConstructUVec4:
@ -7898,7 +8101,15 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EOpConstructBool:
basicOp = EOpConstructBool;
break;
case EOpConstructTextureSampler:
if ((node->getType().getBasicType() == EbtUint || node->getType().getBasicType() == EbtInt) &&
node->getType().getVectorSize() == 2) {
requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "ivec2/uvec2 convert to texture handle");
// No matter ivec2 or uvec2, Set EOpPackUint2x32 just to generate an opBitcast op code
TIntermTyped* newNode =
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type);
return newNode;
}
#ifndef GLSLANG_WEB
case EOpConstructDVec2:
@ -8245,6 +8456,30 @@ void TParseContext::inheritMemoryQualifiers(const TQualifier& from, TQualifier&
#endif
}
//
// Update qualifier layoutBindlessImage & layoutBindlessSampler on block member
//
void TParseContext::updateBindlessQualifier(TType& memberType)
{
if (memberType.containsSampler()) {
if (memberType.isStruct()) {
TTypeList* typeList = memberType.getWritableStruct();
for (unsigned int member = 0; member < typeList->size(); ++member) {
TType* subMemberType = (*typeList)[member].type;
updateBindlessQualifier(*subMemberType);
}
}
else if (memberType.getSampler().isImage()) {
intermediate.setBindlessImageMode(currentCaller, AstRefTypeLayout);
memberType.getQualifier().layoutBindlessImage = true;
}
else {
intermediate.setBindlessTextureMode(currentCaller, AstRefTypeLayout);
memberType.getQualifier().layoutBindlessSampler = true;
}
}
}
//
// Do everything needed to add an interface block.
//
@ -8297,8 +8532,13 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
}
}
if (memberType.containsOpaque())
error(memberLoc, "member of block cannot be or contain a sampler, image, or atomic_uint type", typeList[member].type->getFieldName().c_str(), "");
// For bindless texture, sampler can be declared as uniform/storage block member,
if (memberType.containsOpaque()) {
if (memberType.containsSampler() && extensionTurnedOn(E_GL_ARB_bindless_texture))
updateBindlessQualifier(memberType);
else
error(memberLoc, "member of block cannot be or contain a sampler, image, or atomic_uint type", typeList[member].type->getFieldName().c_str(), "");
}
if (memberType.containsCoopMat())
error(memberLoc, "member of block cannot be or contain a cooperative matrix type", typeList[member].type->getFieldName().c_str(), "");
@ -8631,6 +8871,10 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q
profileRequires(loc, ~EEsProfile, 460, 2, extsrt, "callableDataInNV block");
requireStage(loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInNV block");
break;
case EvqHitObjectAttrNV:
profileRequires(loc, ~EEsProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV block");
requireStage(loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | EShLangMissMask), "hitObjectAttributeNV block");
break;
#endif
default:
error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), "");
@ -9472,4 +9716,38 @@ const TTypeList* TParseContext::recordStructCopy(TStructRecord& record, const TT
return originStruct;
}
TLayoutFormat TParseContext::mapLegacyLayoutFormat(TLayoutFormat legacyLayoutFormat, TBasicType imageType)
{
TLayoutFormat layoutFormat = ElfNone;
if (imageType == EbtFloat) {
switch (legacyLayoutFormat) {
case ElfSize1x16: layoutFormat = ElfR16f; break;
case ElfSize1x32: layoutFormat = ElfR32f; break;
case ElfSize2x32: layoutFormat = ElfRg32f; break;
case ElfSize4x32: layoutFormat = ElfRgba32f; break;
default: break;
}
} else if (imageType == EbtUint) {
switch (legacyLayoutFormat) {
case ElfSize1x8: layoutFormat = ElfR8ui; break;
case ElfSize1x16: layoutFormat = ElfR16ui; break;
case ElfSize1x32: layoutFormat = ElfR32ui; break;
case ElfSize2x32: layoutFormat = ElfRg32ui; break;
case ElfSize4x32: layoutFormat = ElfRgba32ui; break;
default: break;
}
} else if (imageType == EbtInt) {
switch (legacyLayoutFormat) {
case ElfSize1x8: layoutFormat = ElfR8i; break;
case ElfSize1x16: layoutFormat = ElfR16i; break;
case ElfSize1x32: layoutFormat = ElfR32i; break;
case ElfSize2x32: layoutFormat = ElfRg32i; break;
case ElfSize4x32: layoutFormat = ElfRgba32i; break;
default: break;
}
}
return layoutFormat;
}
} // end namespace glslang

View File

@ -393,7 +393,7 @@ public:
void accStructCheck(const TSourceLoc & loc, const TType & type, const TString & identifier);
void transparentOpaqueCheck(const TSourceLoc&, const TType&, const TString& identifier);
void memberQualifierCheck(glslang::TPublicType&);
void globalQualifierFixCheck(const TSourceLoc&, TQualifier&, bool isMemberCheck = false);
void globalQualifierFixCheck(const TSourceLoc&, TQualifier&, bool isMemberCheck = false, const TPublicType* publicType = nullptr);
void globalQualifierTypeCheck(const TSourceLoc&, const TQualifier&, const TPublicType&);
bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType);
void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force);
@ -438,12 +438,12 @@ public:
const TFunction* findFunction400(const TSourceLoc& loc, const TFunction& call, bool& builtIn);
const TFunction* findFunctionExplicitTypes(const TSourceLoc& loc, const TFunction& call, bool& builtIn);
void declareTypeDefaults(const TSourceLoc&, const TPublicType&);
TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0);
TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = nullptr, TIntermTyped* initializer = nullptr);
TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&);
TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&);
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset);
void inheritMemoryQualifiers(const TQualifier& from, TQualifier& to);
void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0);
void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = nullptr, TArraySizes* arraySizes = nullptr);
void blockStorageRemap(const TSourceLoc&, const TString*, TQualifier&);
void blockStageIoCheck(const TSourceLoc&, const TQualifier&);
void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName);
@ -456,9 +456,11 @@ public:
void addQualifierToExisting(const TSourceLoc&, TQualifier, TIdentifierList&);
void invariantCheck(const TSourceLoc&, const TQualifier&);
void updateStandaloneQualifierDefaults(const TSourceLoc&, const TPublicType&);
void updateBindlessQualifier(TType& memberType);
void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode);
TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body);
const TTypeList* recordStructCopy(TStructRecord&, const TType*, const TType*);
TLayoutFormat mapLegacyLayoutFormat(TLayoutFormat legacyLayoutFormat, TBasicType imageType);
#ifndef GLSLANG_WEB
TAttributeType attributeFromName(const TString& name) const;

View File

@ -267,8 +267,8 @@ void* TPoolAllocator::allocate(size_t numBytes)
//
size_t numBytesToAlloc = allocationSize + headerSkip;
tHeader* memory = reinterpret_cast<tHeader*>(::new char[numBytesToAlloc]);
if (memory == 0)
return 0;
if (memory == nullptr)
return nullptr;
// Use placement-new to initialize header
new(memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize);
@ -289,8 +289,8 @@ void* TPoolAllocator::allocate(size_t numBytes)
freeList = freeList->nextPage;
} else {
memory = reinterpret_cast<tHeader*>(::new char[pageSize]);
if (memory == 0)
return 0;
if (memory == nullptr)
return nullptr;
}
// Use placement-new to initialize header
@ -308,7 +308,7 @@ void* TPoolAllocator::allocate(size_t numBytes)
//
void TAllocation::checkAllocList() const
{
for (const TAllocation* alloc = this; alloc != 0; alloc = alloc->prevAlloc)
for (const TAllocation* alloc = this; alloc != nullptr; alloc = alloc->prevAlloc)
alloc->check();
}

View File

@ -765,6 +765,9 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["icoopmatNV"] = ICOOPMATNV;
(*KeywordMap)["ucoopmatNV"] = UCOOPMATNV;
(*KeywordMap)["hitObjectNV"] = HITOBJECTNV;
(*KeywordMap)["hitObjectAttributeNV"] = HITOBJECTATTRNV;
ReservedSet = new std::unordered_set<const char*, str_hash, str_eq>;
ReservedSet->insert("common");
@ -1789,6 +1792,20 @@ int TScanContext::tokenizeIdentifier()
parseContext.extensionTurnedOn(E_GL_EXT_spirv_intrinsics))
return keyword;
return identifierOrType();
case HITOBJECTNV:
if (parseContext.symbolTable.atBuiltInLevel() ||
(!parseContext.isEsProfile() && parseContext.version >= 460
&& parseContext.extensionTurnedOn(E_GL_NV_shader_invocation_reorder)))
return keyword;
return identifierOrType();
case HITOBJECTATTRNV:
if (parseContext.symbolTable.atBuiltInLevel() ||
(!parseContext.isEsProfile() && parseContext.version >= 460
&& parseContext.extensionTurnedOn(E_GL_NV_shader_invocation_reorder)))
return keyword;
return identifierOrType();
#endif
default:

View File

@ -1357,7 +1357,7 @@ int ShInitialize()
ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions)
{
if (!InitThread())
return 0;
return nullptr;
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(language, debugOptions));
@ -1367,7 +1367,7 @@ ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions)
ShHandle ShConstructLinker(const EShExecutable executable, int debugOptions)
{
if (!InitThread())
return 0;
return nullptr;
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructLinker(executable, debugOptions));
@ -1377,7 +1377,7 @@ ShHandle ShConstructLinker(const EShExecutable executable, int debugOptions)
ShHandle ShConstructUniformMap()
{
if (!InitThread())
return 0;
return nullptr;
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructUniformMap());
@ -1386,7 +1386,7 @@ ShHandle ShConstructUniformMap()
void ShDestruct(ShHandle handle)
{
if (handle == 0)
if (handle == nullptr)
return;
TShHandleBase* base = static_cast<TShHandleBase*>(handle);
@ -1419,7 +1419,7 @@ int ShFinalize()
for (int source = 0; source < SourceCount; ++source) {
for (int stage = 0; stage < EShLangCount; ++stage) {
delete SharedSymbolTables[version][spvVersion][p][source][stage];
SharedSymbolTables[version][spvVersion][p][source][stage] = 0;
SharedSymbolTables[version][spvVersion][p][source][stage] = nullptr;
}
}
}
@ -1432,7 +1432,7 @@ int ShFinalize()
for (int source = 0; source < SourceCount; ++source) {
for (int pc = 0; pc < EPcCount; ++pc) {
delete CommonSymbolTable[version][spvVersion][p][source][pc];
CommonSymbolTable[version][spvVersion][p][source][pc] = 0;
CommonSymbolTable[version][spvVersion][p][source][pc] = nullptr;
}
}
}
@ -1475,12 +1475,12 @@ int ShCompile(
)
{
// Map the generic handle to the C++ object
if (handle == 0)
if (handle == nullptr)
return 0;
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
TCompiler* compiler = base->getAsCompiler();
if (compiler == 0)
if (compiler == nullptr)
return 0;
SetThreadPoolAllocator(compiler->getPool());
@ -1520,13 +1520,13 @@ int ShLinkExt(
const ShHandle compHandles[],
const int numHandles)
{
if (linkHandle == 0 || numHandles == 0)
if (linkHandle == nullptr || numHandles == 0)
return 0;
THandleList cObjects;
for (int i = 0; i < numHandles; ++i) {
if (compHandles[i] == 0)
if (compHandles[i] == nullptr)
return 0;
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(compHandles[i]);
if (base->getAsLinker()) {
@ -1535,7 +1535,7 @@ int ShLinkExt(
if (base->getAsCompiler())
cObjects.push_back(base->getAsCompiler());
if (cObjects[i] == 0)
if (cObjects[i] == nullptr)
return 0;
}
@ -1544,7 +1544,7 @@ int ShLinkExt(
SetThreadPoolAllocator(linker->getPool());
if (linker == 0)
if (linker == nullptr)
return 0;
linker->infoSink.info.erase();
@ -1569,7 +1569,7 @@ int ShLinkExt(
//
void ShSetEncryptionMethod(ShHandle handle)
{
if (handle == 0)
if (handle == nullptr)
return;
}
@ -1578,8 +1578,8 @@ void ShSetEncryptionMethod(ShHandle handle)
//
const char* ShGetInfoLog(const ShHandle handle)
{
if (handle == 0)
return 0;
if (handle == nullptr)
return nullptr;
TShHandleBase* base = static_cast<TShHandleBase*>(handle);
TInfoSink* infoSink;
@ -1589,7 +1589,7 @@ const char* ShGetInfoLog(const ShHandle handle)
else if (base->getAsLinker())
infoSink = &(base->getAsLinker()->getInfoSink());
else
return 0;
return nullptr;
infoSink->info << infoSink->debug.c_str();
return infoSink->info.c_str();
@ -1601,14 +1601,14 @@ const char* ShGetInfoLog(const ShHandle handle)
//
const void* ShGetExecutable(const ShHandle handle)
{
if (handle == 0)
return 0;
if (handle == nullptr)
return nullptr;
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
if (linker == 0)
return 0;
if (linker == nullptr)
return nullptr;
return linker->getObjectCode();
}
@ -1623,13 +1623,13 @@ const void* ShGetExecutable(const ShHandle handle)
//
int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* table)
{
if (handle == 0)
if (handle == nullptr)
return 0;
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
if (linker == 0)
if (linker == nullptr)
return 0;
linker->setAppAttributeBindings(table);
@ -1642,13 +1642,13 @@ int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* t
//
int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* table)
{
if (handle == 0)
if (handle == nullptr)
return 0;
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
if (linker == 0)
if (linker == nullptr)
return 0;
linker->setFixedAttributeBindings(table);
@ -1660,12 +1660,12 @@ int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* tab
//
int ShExcludeAttributes(const ShHandle handle, int *attributes, int count)
{
if (handle == 0)
if (handle == nullptr)
return 0;
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
if (linker == 0)
if (linker == nullptr)
return 0;
linker->setExcludedAttributes(attributes, count);
@ -1681,12 +1681,12 @@ int ShExcludeAttributes(const ShHandle handle, int *attributes, int count)
//
int ShGetUniformLocation(const ShHandle handle, const char* name)
{
if (handle == 0)
if (handle == nullptr)
return -1;
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
TUniformMap* uniformMap= base->getAsUniformMap();
if (uniformMap == 0)
if (uniformMap == nullptr)
return -1;
return uniformMap->getLocation(name);
@ -1954,14 +1954,14 @@ const char* TShader::getInfoDebugLog()
TProgram::TProgram() :
#if !defined(GLSLANG_WEB)
reflection(0),
reflection(nullptr),
#endif
linked(false)
{
pool = new TPoolAllocator;
infoSink = new TInfoSink;
for (int s = 0; s < EShLangCount; ++s) {
intermediate[s] = 0;
intermediate[s] = nullptr;
newedIntermediate[s] = false;
}
}

View File

@ -78,6 +78,7 @@ void TType::buildMangledName(TString& mangledName) const
case EbtAccStruct: mangledName += "as"; break;
case EbtRayQuery: mangledName += "rq"; break;
case EbtSpirvType: mangledName += "spv-t"; break;
case EbtHitObjectNV: mangledName += "ho"; break;
#endif
case EbtSampler:
switch (sampler.type) {
@ -416,7 +417,7 @@ TAnonMember* TAnonMember::clone() const
// copy of the original container.
assert(0);
return 0;
return nullptr;
}
TSymbolTableLevel* TSymbolTableLevel::clone() const

View File

@ -84,7 +84,7 @@ typedef TVector<const char*> TExtensionList;
class TSymbol {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(0), writable(true) { }
explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(nullptr), writable(true) { }
virtual TSymbol* clone() const = 0;
virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool
@ -97,18 +97,18 @@ public:
changeName(NewPoolTString(newName.c_str()));
}
virtual const TString& getMangledName() const { return getName(); }
virtual TFunction* getAsFunction() { return 0; }
virtual const TFunction* getAsFunction() const { return 0; }
virtual TVariable* getAsVariable() { return 0; }
virtual const TVariable* getAsVariable() const { return 0; }
virtual const TAnonMember* getAsAnonMember() const { return 0; }
virtual TFunction* getAsFunction() { return nullptr; }
virtual const TFunction* getAsFunction() const { return nullptr; }
virtual TVariable* getAsVariable() { return nullptr; }
virtual const TVariable* getAsVariable() const { return nullptr; }
virtual const TAnonMember* getAsAnonMember() const { return nullptr; }
virtual const TType& getType() const = 0;
virtual TType& getWritableType() = 0;
virtual void setUniqueId(long long id) { uniqueId = id; }
virtual long long getUniqueId() const { return uniqueId; }
virtual void setExtensions(int numExts, const char* const exts[])
{
assert(extensions == 0);
assert(extensions == nullptr);
assert(numExts > 0);
extensions = NewPoolObject(extensions);
for (int e = 0; e < numExts; ++e)
@ -229,7 +229,7 @@ struct TParameter {
if (param.name)
name = NewPoolTString(param.name->c_str());
else
name = 0;
name = nullptr;
type = param.type->clone();
defaultValue = param.defaultValue;
return *this;
@ -243,7 +243,7 @@ struct TParameter {
class TFunction : public TSymbol {
public:
explicit TFunction(TOperator o) :
TSymbol(0),
TSymbol(nullptr),
op(o),
defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) { }
TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) :
@ -319,6 +319,7 @@ public:
virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; }
virtual const TParameter& operator[](int i) const { return parameters[i]; }
const TQualifier& getQualifier() const { return returnType.getQualifier(); }
#ifndef GLSLANG_WEB
virtual void setSpirvInstruction(const TSpirvInstruction& inst)
@ -411,7 +412,7 @@ protected:
class TSymbolTableLevel {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
TSymbolTableLevel() : defaultPrecision(0), anonId(0), thisLevel(false) { }
TSymbolTableLevel() : defaultPrecision(nullptr), anonId(0), thisLevel(false) { }
~TSymbolTableLevel();
bool insert(const TString& name, TSymbol* symbol) {
@ -493,7 +494,7 @@ public:
{
tLevel::const_iterator it = level.find(name);
if (it == level.end())
return 0;
return nullptr;
else
return (*it).second;
}
@ -561,7 +562,7 @@ public:
{
// can call multiple times at one scope, will only latch on first call,
// as we're tracking the previous scope's values, not the current values
if (defaultPrecision != 0)
if (defaultPrecision != nullptr)
return;
defaultPrecision = new TPrecisionQualifier[EbtNumTypes];
@ -573,7 +574,7 @@ public:
{
// can be called for table level pops that didn't set the
// defaults
if (defaultPrecision == 0 || p == 0)
if (defaultPrecision == nullptr || p == nullptr)
return;
for (int t = 0; t < EbtNumTypes; ++t)
@ -622,7 +623,7 @@ public:
// don't deallocate levels passed in from elsewhere
while (table.size() > adoptedLevels)
pop(0);
pop(nullptr);
}
void adoptLevels(TSymbolTable& symTable)
@ -783,7 +784,7 @@ public:
// Normal find of a symbol, that can optionally say whether the symbol was found
// at a built-in level or the current top-scope level.
TSymbol* find(const TString& name, bool* builtIn = 0, bool* currentScope = 0, int* thisDepthP = 0)
TSymbol* find(const TString& name, bool* builtIn = nullptr, bool* currentScope = nullptr, int* thisDepthP = nullptr)
{
int level = currentLevel();
TSymbol* symbol;
@ -827,7 +828,7 @@ public:
++thisDepth;
symbol = table[level]->find(name);
--level;
} while (symbol == 0 && level >= 0);
} while (symbol == nullptr && level >= 0);
if (! table[level + 1]->isThisLevel())
thisDepth = 0;

View File

@ -227,6 +227,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_texture_query_lod] = EBhDisable;
extensionBehavior[E_GL_ARB_vertex_attrib_64bit] = EBhDisable;
extensionBehavior[E_GL_ARB_draw_instanced] = EBhDisable;
extensionBehavior[E_GL_ARB_bindless_texture] = EBhDisable;
extensionBehavior[E_GL_ARB_fragment_coord_conventions] = EBhDisable;
@ -301,6 +302,11 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_NV_shader_sm_builtins] = EBhDisable;
extensionBehavior[E_GL_NV_integer_cooperative_matrix] = EBhDisable;
extensionBehavior[E_GL_NV_shader_invocation_reorder] = EBhDisable;
// ARM
extensionBehavior[E_GL_ARM_shader_core_builtins] = EBhDisable;
// AEP
extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable;
extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisable;
@ -370,6 +376,9 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_float16] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_atomic_float] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_atomic_float2] = EBhDisable;
// Record extensions not for spv.
spvUnsupportedExt.push_back(E_GL_ARB_bindless_texture);
}
#endif // GLSLANG_WEB
@ -437,7 +446,6 @@ void TParseVersions::getPreamble(std::string& preamble)
} else { // !isEsProfile()
preamble =
"#define GL_FRAGMENT_PRECISION_HIGH 1\n"
"#define GL_ARB_texture_rectangle 1\n"
"#define GL_ARB_shading_language_420pack 1\n"
"#define GL_ARB_texture_gather 1\n"
@ -477,6 +485,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_vertex_attrib_64bit 1\n"
"#define GL_ARB_draw_instanced 1\n"
"#define GL_ARB_fragment_coord_conventions 1\n"
"#define GL_ARB_bindless_texture 1\n"
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
"#define GL_EXT_shader_image_load_formatted 1\n"
"#define GL_EXT_post_depth_coverage 1\n"
@ -544,6 +553,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_NV_mesh_shader 1\n"
"#define GL_NV_cooperative_matrix 1\n"
"#define GL_NV_integer_cooperative_matrix 1\n"
"#define GL_NV_shader_execution_reorder 1\n"
"#define GL_EXT_shader_explicit_arithmetic_types 1\n"
"#define GL_EXT_shader_explicit_arithmetic_types_int8 1\n"
@ -576,6 +586,10 @@ void TParseVersions::getPreamble(std::string& preamble)
preamble += "#define GL_EXT_null_initializer 1\n";
preamble += "#define GL_EXT_subgroup_uniform_control_flow 1\n";
}
if (version >= 130) {
preamble +="#define GL_FRAGMENT_PRECISION_HIGH 1\n";
}
#endif // GLSLANG_WEB
}
@ -1066,8 +1080,8 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con
if (strcmp(extension, "GL_NV_mesh_shader") == 0) {
requireStage(loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask | EShLangFragmentMask),
"#extension GL_NV_mesh_shader");
profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader");
profileRequires(loc, EEsProfile, 320, 0, "#extension GL_NV_mesh_shader");
profileRequires(loc, ECoreProfile, 450, nullptr, "#extension GL_NV_mesh_shader");
profileRequires(loc, EEsProfile, 320, nullptr, "#extension GL_NV_mesh_shader");
if (extensionTurnedOn(E_GL_EXT_mesh_shader)) {
error(loc, "GL_EXT_mesh_shader is already turned on, and not allowed with", "#extension", extension);
}
@ -1075,8 +1089,8 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con
else if (strcmp(extension, "GL_EXT_mesh_shader") == 0) {
requireStage(loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask | EShLangFragmentMask),
"#extension GL_EXT_mesh_shader");
profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_EXT_mesh_shader");
profileRequires(loc, EEsProfile, 320, 0, "#extension GL_EXT_mesh_shader");
profileRequires(loc, ECoreProfile, 450, nullptr, "#extension GL_EXT_mesh_shader");
profileRequires(loc, EEsProfile, 320, nullptr, "#extension GL_EXT_mesh_shader");
if (extensionTurnedOn(E_GL_NV_mesh_shader)) {
error(loc, "GL_NV_mesh_shader is already turned on, and not allowed with", "#extension", extension);
}
@ -1099,6 +1113,13 @@ void TParseVersions::extensionRequires(const TSourceLoc &loc, const char * const
minSpvVersion = iter->second;
requireSpv(loc, extension, minSpvVersion);
}
if (spvVersion.spv != 0){
for (auto ext : spvUnsupportedExt){
if (strcmp(extension, ext.c_str()) == 0)
error(loc, "not allowed when using generating SPIR-V codes", extension, "");
}
}
}
// Call for any operation needing full GLSL integer data-type support.

View File

@ -163,6 +163,7 @@ const char* const E_GL_ARB_texture_query_lod = "GL_ARB_texture_query_
const char* const E_GL_ARB_vertex_attrib_64bit = "GL_ARB_vertex_attrib_64bit";
const char* const E_GL_ARB_draw_instanced = "GL_ARB_draw_instanced";
const char* const E_GL_ARB_fragment_coord_conventions = "GL_ARB_fragment_coord_conventions";
const char* const E_GL_ARB_bindless_texture = "GL_ARB_bindless_texture";
const char* const E_GL_KHR_shader_subgroup_basic = "GL_KHR_shader_subgroup_basic";
const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote";
@ -265,6 +266,9 @@ const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute
const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint";
const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_shader";
// ARM
const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins";
// Arrays of extensions for the above viewportEXTs duplications
const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 };
@ -273,6 +277,7 @@ const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]);
const char* const E_GL_NV_cooperative_matrix = "GL_NV_cooperative_matrix";
const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins";
const char* const E_GL_NV_integer_cooperative_matrix = "GL_NV_integer_cooperative_matrix";
const char* const E_GL_NV_shader_invocation_reorder = "GL_NV_shader_invocation_reorder";
// AEP
const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a";

View File

@ -211,6 +211,7 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> ACCSTRUCTEXT
%token <lex> RAYQUERYEXT
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
%token <lex> HITOBJECTNV HITOBJECTATTRNV
// combined image/sampler
%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
@ -1218,7 +1219,7 @@ fully_specified_type
parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
}
| type_qualifier type_specifier {
parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
parseContext.globalQualifierFixCheck($1.loc, $1.qualifier, false, &$2);
parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2);
if ($2.arraySizes) {
@ -1534,6 +1535,14 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc);
$$.qualifier.storage = EvqHitAttr;
}
| HITOBJECTATTRNV {
parseContext.globalCheck($1.loc, "hitAttributeNV");
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask
| EShLangMissMask), "hitObjectAttributeNV");
parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV");
$$.init($1.loc);
$$.qualifier.storage = EvqHitObjectAttrNV;
}
| HITATTREXT {
parseContext.globalCheck($1.loc, "hitAttributeEXT");
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask
@ -3509,6 +3518,10 @@ GLSLANG_WEB_EXCLUDE_ON
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier");
$$ = $1;
}
| HITOBJECTNV {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtHitObjectNV;
}
GLSLANG_WEB_EXCLUDE_OFF
| struct_specifier {
$$ = $1;

View File

@ -151,7 +151,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%parse-param {glslang::TParseContext* pParseContext}
%lex-param {parseContext}
%define api.pure // enable thread safety
%pure-parser // enable thread safety
%expect 1 // One shift reduce conflict because of if | else
%token <lex> CONST BOOL INT UINT FLOAT
@ -211,6 +211,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> ACCSTRUCTEXT
%token <lex> RAYQUERYEXT
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
%token <lex> HITOBJECTNV HITOBJECTATTRNV
// combined image/sampler
%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
@ -1218,7 +1219,7 @@ fully_specified_type
parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
}
| type_qualifier type_specifier {
parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
parseContext.globalQualifierFixCheck($1.loc, $1.qualifier, false, &$2);
parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2);
if ($2.arraySizes) {
@ -1534,6 +1535,14 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.storage = EvqHitAttr;
}
| HITOBJECTATTRNV {
parseContext.globalCheck($1.loc, "hitAttributeNV");
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask
| EShLangMissMask), "hitObjectAttributeNV");
parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV");
$$.init($1.loc);
$$.qualifier.storage = EvqHitObjectAttrNV;
}
| HITATTREXT {
parseContext.globalCheck($1.loc, "hitAttributeEXT");
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask
@ -3509,6 +3518,10 @@ type_specifier_nonarray
parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier");
$$ = $1;
}
| HITOBJECTNV {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtHitObjectNV;
}
| struct_specifier {
$$ = $1;

File diff suppressed because it is too large Load Diff

View File

@ -217,298 +217,300 @@ extern int yydebug;
FCOOPMATNV = 418, /* FCOOPMATNV */
ICOOPMATNV = 419, /* ICOOPMATNV */
UCOOPMATNV = 420, /* UCOOPMATNV */
SAMPLERCUBEARRAY = 421, /* SAMPLERCUBEARRAY */
SAMPLERCUBEARRAYSHADOW = 422, /* SAMPLERCUBEARRAYSHADOW */
ISAMPLERCUBEARRAY = 423, /* ISAMPLERCUBEARRAY */
USAMPLERCUBEARRAY = 424, /* USAMPLERCUBEARRAY */
SAMPLER1D = 425, /* SAMPLER1D */
SAMPLER1DARRAY = 426, /* SAMPLER1DARRAY */
SAMPLER1DARRAYSHADOW = 427, /* SAMPLER1DARRAYSHADOW */
ISAMPLER1D = 428, /* ISAMPLER1D */
SAMPLER1DSHADOW = 429, /* SAMPLER1DSHADOW */
SAMPLER2DRECT = 430, /* SAMPLER2DRECT */
SAMPLER2DRECTSHADOW = 431, /* SAMPLER2DRECTSHADOW */
ISAMPLER2DRECT = 432, /* ISAMPLER2DRECT */
USAMPLER2DRECT = 433, /* USAMPLER2DRECT */
SAMPLERBUFFER = 434, /* SAMPLERBUFFER */
ISAMPLERBUFFER = 435, /* ISAMPLERBUFFER */
USAMPLERBUFFER = 436, /* USAMPLERBUFFER */
SAMPLER2DMS = 437, /* SAMPLER2DMS */
ISAMPLER2DMS = 438, /* ISAMPLER2DMS */
USAMPLER2DMS = 439, /* USAMPLER2DMS */
SAMPLER2DMSARRAY = 440, /* SAMPLER2DMSARRAY */
ISAMPLER2DMSARRAY = 441, /* ISAMPLER2DMSARRAY */
USAMPLER2DMSARRAY = 442, /* USAMPLER2DMSARRAY */
SAMPLEREXTERNALOES = 443, /* SAMPLEREXTERNALOES */
SAMPLEREXTERNAL2DY2YEXT = 444, /* SAMPLEREXTERNAL2DY2YEXT */
ISAMPLER1DARRAY = 445, /* ISAMPLER1DARRAY */
USAMPLER1D = 446, /* USAMPLER1D */
USAMPLER1DARRAY = 447, /* USAMPLER1DARRAY */
F16SAMPLER1D = 448, /* F16SAMPLER1D */
F16SAMPLER2D = 449, /* F16SAMPLER2D */
F16SAMPLER3D = 450, /* F16SAMPLER3D */
F16SAMPLER2DRECT = 451, /* F16SAMPLER2DRECT */
F16SAMPLERCUBE = 452, /* F16SAMPLERCUBE */
F16SAMPLER1DARRAY = 453, /* F16SAMPLER1DARRAY */
F16SAMPLER2DARRAY = 454, /* F16SAMPLER2DARRAY */
F16SAMPLERCUBEARRAY = 455, /* F16SAMPLERCUBEARRAY */
F16SAMPLERBUFFER = 456, /* F16SAMPLERBUFFER */
F16SAMPLER2DMS = 457, /* F16SAMPLER2DMS */
F16SAMPLER2DMSARRAY = 458, /* F16SAMPLER2DMSARRAY */
F16SAMPLER1DSHADOW = 459, /* F16SAMPLER1DSHADOW */
F16SAMPLER2DSHADOW = 460, /* F16SAMPLER2DSHADOW */
F16SAMPLER1DARRAYSHADOW = 461, /* F16SAMPLER1DARRAYSHADOW */
F16SAMPLER2DARRAYSHADOW = 462, /* F16SAMPLER2DARRAYSHADOW */
F16SAMPLER2DRECTSHADOW = 463, /* F16SAMPLER2DRECTSHADOW */
F16SAMPLERCUBESHADOW = 464, /* F16SAMPLERCUBESHADOW */
F16SAMPLERCUBEARRAYSHADOW = 465, /* F16SAMPLERCUBEARRAYSHADOW */
IMAGE1D = 466, /* IMAGE1D */
IIMAGE1D = 467, /* IIMAGE1D */
UIMAGE1D = 468, /* UIMAGE1D */
IMAGE2D = 469, /* IMAGE2D */
IIMAGE2D = 470, /* IIMAGE2D */
UIMAGE2D = 471, /* UIMAGE2D */
IMAGE3D = 472, /* IMAGE3D */
IIMAGE3D = 473, /* IIMAGE3D */
UIMAGE3D = 474, /* UIMAGE3D */
IMAGE2DRECT = 475, /* IMAGE2DRECT */
IIMAGE2DRECT = 476, /* IIMAGE2DRECT */
UIMAGE2DRECT = 477, /* UIMAGE2DRECT */
IMAGECUBE = 478, /* IMAGECUBE */
IIMAGECUBE = 479, /* IIMAGECUBE */
UIMAGECUBE = 480, /* UIMAGECUBE */
IMAGEBUFFER = 481, /* IMAGEBUFFER */
IIMAGEBUFFER = 482, /* IIMAGEBUFFER */
UIMAGEBUFFER = 483, /* UIMAGEBUFFER */
IMAGE1DARRAY = 484, /* IMAGE1DARRAY */
IIMAGE1DARRAY = 485, /* IIMAGE1DARRAY */
UIMAGE1DARRAY = 486, /* UIMAGE1DARRAY */
IMAGE2DARRAY = 487, /* IMAGE2DARRAY */
IIMAGE2DARRAY = 488, /* IIMAGE2DARRAY */
UIMAGE2DARRAY = 489, /* UIMAGE2DARRAY */
IMAGECUBEARRAY = 490, /* IMAGECUBEARRAY */
IIMAGECUBEARRAY = 491, /* IIMAGECUBEARRAY */
UIMAGECUBEARRAY = 492, /* UIMAGECUBEARRAY */
IMAGE2DMS = 493, /* IMAGE2DMS */
IIMAGE2DMS = 494, /* IIMAGE2DMS */
UIMAGE2DMS = 495, /* UIMAGE2DMS */
IMAGE2DMSARRAY = 496, /* IMAGE2DMSARRAY */
IIMAGE2DMSARRAY = 497, /* IIMAGE2DMSARRAY */
UIMAGE2DMSARRAY = 498, /* UIMAGE2DMSARRAY */
F16IMAGE1D = 499, /* F16IMAGE1D */
F16IMAGE2D = 500, /* F16IMAGE2D */
F16IMAGE3D = 501, /* F16IMAGE3D */
F16IMAGE2DRECT = 502, /* F16IMAGE2DRECT */
F16IMAGECUBE = 503, /* F16IMAGECUBE */
F16IMAGE1DARRAY = 504, /* F16IMAGE1DARRAY */
F16IMAGE2DARRAY = 505, /* F16IMAGE2DARRAY */
F16IMAGECUBEARRAY = 506, /* F16IMAGECUBEARRAY */
F16IMAGEBUFFER = 507, /* F16IMAGEBUFFER */
F16IMAGE2DMS = 508, /* F16IMAGE2DMS */
F16IMAGE2DMSARRAY = 509, /* F16IMAGE2DMSARRAY */
I64IMAGE1D = 510, /* I64IMAGE1D */
U64IMAGE1D = 511, /* U64IMAGE1D */
I64IMAGE2D = 512, /* I64IMAGE2D */
U64IMAGE2D = 513, /* U64IMAGE2D */
I64IMAGE3D = 514, /* I64IMAGE3D */
U64IMAGE3D = 515, /* U64IMAGE3D */
I64IMAGE2DRECT = 516, /* I64IMAGE2DRECT */
U64IMAGE2DRECT = 517, /* U64IMAGE2DRECT */
I64IMAGECUBE = 518, /* I64IMAGECUBE */
U64IMAGECUBE = 519, /* U64IMAGECUBE */
I64IMAGEBUFFER = 520, /* I64IMAGEBUFFER */
U64IMAGEBUFFER = 521, /* U64IMAGEBUFFER */
I64IMAGE1DARRAY = 522, /* I64IMAGE1DARRAY */
U64IMAGE1DARRAY = 523, /* U64IMAGE1DARRAY */
I64IMAGE2DARRAY = 524, /* I64IMAGE2DARRAY */
U64IMAGE2DARRAY = 525, /* U64IMAGE2DARRAY */
I64IMAGECUBEARRAY = 526, /* I64IMAGECUBEARRAY */
U64IMAGECUBEARRAY = 527, /* U64IMAGECUBEARRAY */
I64IMAGE2DMS = 528, /* I64IMAGE2DMS */
U64IMAGE2DMS = 529, /* U64IMAGE2DMS */
I64IMAGE2DMSARRAY = 530, /* I64IMAGE2DMSARRAY */
U64IMAGE2DMSARRAY = 531, /* U64IMAGE2DMSARRAY */
TEXTURECUBEARRAY = 532, /* TEXTURECUBEARRAY */
ITEXTURECUBEARRAY = 533, /* ITEXTURECUBEARRAY */
UTEXTURECUBEARRAY = 534, /* UTEXTURECUBEARRAY */
TEXTURE1D = 535, /* TEXTURE1D */
ITEXTURE1D = 536, /* ITEXTURE1D */
UTEXTURE1D = 537, /* UTEXTURE1D */
TEXTURE1DARRAY = 538, /* TEXTURE1DARRAY */
ITEXTURE1DARRAY = 539, /* ITEXTURE1DARRAY */
UTEXTURE1DARRAY = 540, /* UTEXTURE1DARRAY */
TEXTURE2DRECT = 541, /* TEXTURE2DRECT */
ITEXTURE2DRECT = 542, /* ITEXTURE2DRECT */
UTEXTURE2DRECT = 543, /* UTEXTURE2DRECT */
TEXTUREBUFFER = 544, /* TEXTUREBUFFER */
ITEXTUREBUFFER = 545, /* ITEXTUREBUFFER */
UTEXTUREBUFFER = 546, /* UTEXTUREBUFFER */
TEXTURE2DMS = 547, /* TEXTURE2DMS */
ITEXTURE2DMS = 548, /* ITEXTURE2DMS */
UTEXTURE2DMS = 549, /* UTEXTURE2DMS */
TEXTURE2DMSARRAY = 550, /* TEXTURE2DMSARRAY */
ITEXTURE2DMSARRAY = 551, /* ITEXTURE2DMSARRAY */
UTEXTURE2DMSARRAY = 552, /* UTEXTURE2DMSARRAY */
F16TEXTURE1D = 553, /* F16TEXTURE1D */
F16TEXTURE2D = 554, /* F16TEXTURE2D */
F16TEXTURE3D = 555, /* F16TEXTURE3D */
F16TEXTURE2DRECT = 556, /* F16TEXTURE2DRECT */
F16TEXTURECUBE = 557, /* F16TEXTURECUBE */
F16TEXTURE1DARRAY = 558, /* F16TEXTURE1DARRAY */
F16TEXTURE2DARRAY = 559, /* F16TEXTURE2DARRAY */
F16TEXTURECUBEARRAY = 560, /* F16TEXTURECUBEARRAY */
F16TEXTUREBUFFER = 561, /* F16TEXTUREBUFFER */
F16TEXTURE2DMS = 562, /* F16TEXTURE2DMS */
F16TEXTURE2DMSARRAY = 563, /* F16TEXTURE2DMSARRAY */
SUBPASSINPUT = 564, /* SUBPASSINPUT */
SUBPASSINPUTMS = 565, /* SUBPASSINPUTMS */
ISUBPASSINPUT = 566, /* ISUBPASSINPUT */
ISUBPASSINPUTMS = 567, /* ISUBPASSINPUTMS */
USUBPASSINPUT = 568, /* USUBPASSINPUT */
USUBPASSINPUTMS = 569, /* USUBPASSINPUTMS */
F16SUBPASSINPUT = 570, /* F16SUBPASSINPUT */
F16SUBPASSINPUTMS = 571, /* F16SUBPASSINPUTMS */
SPIRV_INSTRUCTION = 572, /* SPIRV_INSTRUCTION */
SPIRV_EXECUTION_MODE = 573, /* SPIRV_EXECUTION_MODE */
SPIRV_EXECUTION_MODE_ID = 574, /* SPIRV_EXECUTION_MODE_ID */
SPIRV_DECORATE = 575, /* SPIRV_DECORATE */
SPIRV_DECORATE_ID = 576, /* SPIRV_DECORATE_ID */
SPIRV_DECORATE_STRING = 577, /* SPIRV_DECORATE_STRING */
SPIRV_TYPE = 578, /* SPIRV_TYPE */
SPIRV_STORAGE_CLASS = 579, /* SPIRV_STORAGE_CLASS */
SPIRV_BY_REFERENCE = 580, /* SPIRV_BY_REFERENCE */
SPIRV_LITERAL = 581, /* SPIRV_LITERAL */
LEFT_OP = 582, /* LEFT_OP */
RIGHT_OP = 583, /* RIGHT_OP */
INC_OP = 584, /* INC_OP */
DEC_OP = 585, /* DEC_OP */
LE_OP = 586, /* LE_OP */
GE_OP = 587, /* GE_OP */
EQ_OP = 588, /* EQ_OP */
NE_OP = 589, /* NE_OP */
AND_OP = 590, /* AND_OP */
OR_OP = 591, /* OR_OP */
XOR_OP = 592, /* XOR_OP */
MUL_ASSIGN = 593, /* MUL_ASSIGN */
DIV_ASSIGN = 594, /* DIV_ASSIGN */
ADD_ASSIGN = 595, /* ADD_ASSIGN */
MOD_ASSIGN = 596, /* MOD_ASSIGN */
LEFT_ASSIGN = 597, /* LEFT_ASSIGN */
RIGHT_ASSIGN = 598, /* RIGHT_ASSIGN */
AND_ASSIGN = 599, /* AND_ASSIGN */
XOR_ASSIGN = 600, /* XOR_ASSIGN */
OR_ASSIGN = 601, /* OR_ASSIGN */
SUB_ASSIGN = 602, /* SUB_ASSIGN */
STRING_LITERAL = 603, /* STRING_LITERAL */
LEFT_PAREN = 604, /* LEFT_PAREN */
RIGHT_PAREN = 605, /* RIGHT_PAREN */
LEFT_BRACKET = 606, /* LEFT_BRACKET */
RIGHT_BRACKET = 607, /* RIGHT_BRACKET */
LEFT_BRACE = 608, /* LEFT_BRACE */
RIGHT_BRACE = 609, /* RIGHT_BRACE */
DOT = 610, /* DOT */
COMMA = 611, /* COMMA */
COLON = 612, /* COLON */
EQUAL = 613, /* EQUAL */
SEMICOLON = 614, /* SEMICOLON */
BANG = 615, /* BANG */
DASH = 616, /* DASH */
TILDE = 617, /* TILDE */
PLUS = 618, /* PLUS */
STAR = 619, /* STAR */
SLASH = 620, /* SLASH */
PERCENT = 621, /* PERCENT */
LEFT_ANGLE = 622, /* LEFT_ANGLE */
RIGHT_ANGLE = 623, /* RIGHT_ANGLE */
VERTICAL_BAR = 624, /* VERTICAL_BAR */
CARET = 625, /* CARET */
AMPERSAND = 626, /* AMPERSAND */
QUESTION = 627, /* QUESTION */
INVARIANT = 628, /* INVARIANT */
HIGH_PRECISION = 629, /* HIGH_PRECISION */
MEDIUM_PRECISION = 630, /* MEDIUM_PRECISION */
LOW_PRECISION = 631, /* LOW_PRECISION */
PRECISION = 632, /* PRECISION */
PACKED = 633, /* PACKED */
RESOURCE = 634, /* RESOURCE */
SUPERP = 635, /* SUPERP */
FLOATCONSTANT = 636, /* FLOATCONSTANT */
INTCONSTANT = 637, /* INTCONSTANT */
UINTCONSTANT = 638, /* UINTCONSTANT */
BOOLCONSTANT = 639, /* BOOLCONSTANT */
IDENTIFIER = 640, /* IDENTIFIER */
TYPE_NAME = 641, /* TYPE_NAME */
CENTROID = 642, /* CENTROID */
IN = 643, /* IN */
OUT = 644, /* OUT */
INOUT = 645, /* INOUT */
STRUCT = 646, /* STRUCT */
VOID = 647, /* VOID */
WHILE = 648, /* WHILE */
BREAK = 649, /* BREAK */
CONTINUE = 650, /* CONTINUE */
DO = 651, /* DO */
ELSE = 652, /* ELSE */
FOR = 653, /* FOR */
IF = 654, /* IF */
DISCARD = 655, /* DISCARD */
RETURN = 656, /* RETURN */
SWITCH = 657, /* SWITCH */
CASE = 658, /* CASE */
DEFAULT = 659, /* DEFAULT */
TERMINATE_INVOCATION = 660, /* TERMINATE_INVOCATION */
TERMINATE_RAY = 661, /* TERMINATE_RAY */
IGNORE_INTERSECTION = 662, /* IGNORE_INTERSECTION */
UNIFORM = 663, /* UNIFORM */
SHARED = 664, /* SHARED */
BUFFER = 665, /* BUFFER */
FLAT = 666, /* FLAT */
SMOOTH = 667, /* SMOOTH */
LAYOUT = 668, /* LAYOUT */
DOUBLECONSTANT = 669, /* DOUBLECONSTANT */
INT16CONSTANT = 670, /* INT16CONSTANT */
UINT16CONSTANT = 671, /* UINT16CONSTANT */
FLOAT16CONSTANT = 672, /* FLOAT16CONSTANT */
INT32CONSTANT = 673, /* INT32CONSTANT */
UINT32CONSTANT = 674, /* UINT32CONSTANT */
INT64CONSTANT = 675, /* INT64CONSTANT */
UINT64CONSTANT = 676, /* UINT64CONSTANT */
SUBROUTINE = 677, /* SUBROUTINE */
DEMOTE = 678, /* DEMOTE */
PAYLOADNV = 679, /* PAYLOADNV */
PAYLOADINNV = 680, /* PAYLOADINNV */
HITATTRNV = 681, /* HITATTRNV */
CALLDATANV = 682, /* CALLDATANV */
CALLDATAINNV = 683, /* CALLDATAINNV */
PAYLOADEXT = 684, /* PAYLOADEXT */
PAYLOADINEXT = 685, /* PAYLOADINEXT */
HITATTREXT = 686, /* HITATTREXT */
CALLDATAEXT = 687, /* CALLDATAEXT */
CALLDATAINEXT = 688, /* CALLDATAINEXT */
PATCH = 689, /* PATCH */
SAMPLE = 690, /* SAMPLE */
NONUNIFORM = 691, /* NONUNIFORM */
COHERENT = 692, /* COHERENT */
VOLATILE = 693, /* VOLATILE */
RESTRICT = 694, /* RESTRICT */
READONLY = 695, /* READONLY */
WRITEONLY = 696, /* WRITEONLY */
DEVICECOHERENT = 697, /* DEVICECOHERENT */
QUEUEFAMILYCOHERENT = 698, /* QUEUEFAMILYCOHERENT */
WORKGROUPCOHERENT = 699, /* WORKGROUPCOHERENT */
SUBGROUPCOHERENT = 700, /* SUBGROUPCOHERENT */
NONPRIVATE = 701, /* NONPRIVATE */
SHADERCALLCOHERENT = 702, /* SHADERCALLCOHERENT */
NOPERSPECTIVE = 703, /* NOPERSPECTIVE */
EXPLICITINTERPAMD = 704, /* EXPLICITINTERPAMD */
PERVERTEXEXT = 705, /* PERVERTEXEXT */
PERVERTEXNV = 706, /* PERVERTEXNV */
PERPRIMITIVENV = 707, /* PERPRIMITIVENV */
PERVIEWNV = 708, /* PERVIEWNV */
PERTASKNV = 709, /* PERTASKNV */
PERPRIMITIVEEXT = 710, /* PERPRIMITIVEEXT */
TASKPAYLOADWORKGROUPEXT = 711, /* TASKPAYLOADWORKGROUPEXT */
PRECISE = 712 /* PRECISE */
HITOBJECTNV = 421, /* HITOBJECTNV */
HITOBJECTATTRNV = 422, /* HITOBJECTATTRNV */
SAMPLERCUBEARRAY = 423, /* SAMPLERCUBEARRAY */
SAMPLERCUBEARRAYSHADOW = 424, /* SAMPLERCUBEARRAYSHADOW */
ISAMPLERCUBEARRAY = 425, /* ISAMPLERCUBEARRAY */
USAMPLERCUBEARRAY = 426, /* USAMPLERCUBEARRAY */
SAMPLER1D = 427, /* SAMPLER1D */
SAMPLER1DARRAY = 428, /* SAMPLER1DARRAY */
SAMPLER1DARRAYSHADOW = 429, /* SAMPLER1DARRAYSHADOW */
ISAMPLER1D = 430, /* ISAMPLER1D */
SAMPLER1DSHADOW = 431, /* SAMPLER1DSHADOW */
SAMPLER2DRECT = 432, /* SAMPLER2DRECT */
SAMPLER2DRECTSHADOW = 433, /* SAMPLER2DRECTSHADOW */
ISAMPLER2DRECT = 434, /* ISAMPLER2DRECT */
USAMPLER2DRECT = 435, /* USAMPLER2DRECT */
SAMPLERBUFFER = 436, /* SAMPLERBUFFER */
ISAMPLERBUFFER = 437, /* ISAMPLERBUFFER */
USAMPLERBUFFER = 438, /* USAMPLERBUFFER */
SAMPLER2DMS = 439, /* SAMPLER2DMS */
ISAMPLER2DMS = 440, /* ISAMPLER2DMS */
USAMPLER2DMS = 441, /* USAMPLER2DMS */
SAMPLER2DMSARRAY = 442, /* SAMPLER2DMSARRAY */
ISAMPLER2DMSARRAY = 443, /* ISAMPLER2DMSARRAY */
USAMPLER2DMSARRAY = 444, /* USAMPLER2DMSARRAY */
SAMPLEREXTERNALOES = 445, /* SAMPLEREXTERNALOES */
SAMPLEREXTERNAL2DY2YEXT = 446, /* SAMPLEREXTERNAL2DY2YEXT */
ISAMPLER1DARRAY = 447, /* ISAMPLER1DARRAY */
USAMPLER1D = 448, /* USAMPLER1D */
USAMPLER1DARRAY = 449, /* USAMPLER1DARRAY */
F16SAMPLER1D = 450, /* F16SAMPLER1D */
F16SAMPLER2D = 451, /* F16SAMPLER2D */
F16SAMPLER3D = 452, /* F16SAMPLER3D */
F16SAMPLER2DRECT = 453, /* F16SAMPLER2DRECT */
F16SAMPLERCUBE = 454, /* F16SAMPLERCUBE */
F16SAMPLER1DARRAY = 455, /* F16SAMPLER1DARRAY */
F16SAMPLER2DARRAY = 456, /* F16SAMPLER2DARRAY */
F16SAMPLERCUBEARRAY = 457, /* F16SAMPLERCUBEARRAY */
F16SAMPLERBUFFER = 458, /* F16SAMPLERBUFFER */
F16SAMPLER2DMS = 459, /* F16SAMPLER2DMS */
F16SAMPLER2DMSARRAY = 460, /* F16SAMPLER2DMSARRAY */
F16SAMPLER1DSHADOW = 461, /* F16SAMPLER1DSHADOW */
F16SAMPLER2DSHADOW = 462, /* F16SAMPLER2DSHADOW */
F16SAMPLER1DARRAYSHADOW = 463, /* F16SAMPLER1DARRAYSHADOW */
F16SAMPLER2DARRAYSHADOW = 464, /* F16SAMPLER2DARRAYSHADOW */
F16SAMPLER2DRECTSHADOW = 465, /* F16SAMPLER2DRECTSHADOW */
F16SAMPLERCUBESHADOW = 466, /* F16SAMPLERCUBESHADOW */
F16SAMPLERCUBEARRAYSHADOW = 467, /* F16SAMPLERCUBEARRAYSHADOW */
IMAGE1D = 468, /* IMAGE1D */
IIMAGE1D = 469, /* IIMAGE1D */
UIMAGE1D = 470, /* UIMAGE1D */
IMAGE2D = 471, /* IMAGE2D */
IIMAGE2D = 472, /* IIMAGE2D */
UIMAGE2D = 473, /* UIMAGE2D */
IMAGE3D = 474, /* IMAGE3D */
IIMAGE3D = 475, /* IIMAGE3D */
UIMAGE3D = 476, /* UIMAGE3D */
IMAGE2DRECT = 477, /* IMAGE2DRECT */
IIMAGE2DRECT = 478, /* IIMAGE2DRECT */
UIMAGE2DRECT = 479, /* UIMAGE2DRECT */
IMAGECUBE = 480, /* IMAGECUBE */
IIMAGECUBE = 481, /* IIMAGECUBE */
UIMAGECUBE = 482, /* UIMAGECUBE */
IMAGEBUFFER = 483, /* IMAGEBUFFER */
IIMAGEBUFFER = 484, /* IIMAGEBUFFER */
UIMAGEBUFFER = 485, /* UIMAGEBUFFER */
IMAGE1DARRAY = 486, /* IMAGE1DARRAY */
IIMAGE1DARRAY = 487, /* IIMAGE1DARRAY */
UIMAGE1DARRAY = 488, /* UIMAGE1DARRAY */
IMAGE2DARRAY = 489, /* IMAGE2DARRAY */
IIMAGE2DARRAY = 490, /* IIMAGE2DARRAY */
UIMAGE2DARRAY = 491, /* UIMAGE2DARRAY */
IMAGECUBEARRAY = 492, /* IMAGECUBEARRAY */
IIMAGECUBEARRAY = 493, /* IIMAGECUBEARRAY */
UIMAGECUBEARRAY = 494, /* UIMAGECUBEARRAY */
IMAGE2DMS = 495, /* IMAGE2DMS */
IIMAGE2DMS = 496, /* IIMAGE2DMS */
UIMAGE2DMS = 497, /* UIMAGE2DMS */
IMAGE2DMSARRAY = 498, /* IMAGE2DMSARRAY */
IIMAGE2DMSARRAY = 499, /* IIMAGE2DMSARRAY */
UIMAGE2DMSARRAY = 500, /* UIMAGE2DMSARRAY */
F16IMAGE1D = 501, /* F16IMAGE1D */
F16IMAGE2D = 502, /* F16IMAGE2D */
F16IMAGE3D = 503, /* F16IMAGE3D */
F16IMAGE2DRECT = 504, /* F16IMAGE2DRECT */
F16IMAGECUBE = 505, /* F16IMAGECUBE */
F16IMAGE1DARRAY = 506, /* F16IMAGE1DARRAY */
F16IMAGE2DARRAY = 507, /* F16IMAGE2DARRAY */
F16IMAGECUBEARRAY = 508, /* F16IMAGECUBEARRAY */
F16IMAGEBUFFER = 509, /* F16IMAGEBUFFER */
F16IMAGE2DMS = 510, /* F16IMAGE2DMS */
F16IMAGE2DMSARRAY = 511, /* F16IMAGE2DMSARRAY */
I64IMAGE1D = 512, /* I64IMAGE1D */
U64IMAGE1D = 513, /* U64IMAGE1D */
I64IMAGE2D = 514, /* I64IMAGE2D */
U64IMAGE2D = 515, /* U64IMAGE2D */
I64IMAGE3D = 516, /* I64IMAGE3D */
U64IMAGE3D = 517, /* U64IMAGE3D */
I64IMAGE2DRECT = 518, /* I64IMAGE2DRECT */
U64IMAGE2DRECT = 519, /* U64IMAGE2DRECT */
I64IMAGECUBE = 520, /* I64IMAGECUBE */
U64IMAGECUBE = 521, /* U64IMAGECUBE */
I64IMAGEBUFFER = 522, /* I64IMAGEBUFFER */
U64IMAGEBUFFER = 523, /* U64IMAGEBUFFER */
I64IMAGE1DARRAY = 524, /* I64IMAGE1DARRAY */
U64IMAGE1DARRAY = 525, /* U64IMAGE1DARRAY */
I64IMAGE2DARRAY = 526, /* I64IMAGE2DARRAY */
U64IMAGE2DARRAY = 527, /* U64IMAGE2DARRAY */
I64IMAGECUBEARRAY = 528, /* I64IMAGECUBEARRAY */
U64IMAGECUBEARRAY = 529, /* U64IMAGECUBEARRAY */
I64IMAGE2DMS = 530, /* I64IMAGE2DMS */
U64IMAGE2DMS = 531, /* U64IMAGE2DMS */
I64IMAGE2DMSARRAY = 532, /* I64IMAGE2DMSARRAY */
U64IMAGE2DMSARRAY = 533, /* U64IMAGE2DMSARRAY */
TEXTURECUBEARRAY = 534, /* TEXTURECUBEARRAY */
ITEXTURECUBEARRAY = 535, /* ITEXTURECUBEARRAY */
UTEXTURECUBEARRAY = 536, /* UTEXTURECUBEARRAY */
TEXTURE1D = 537, /* TEXTURE1D */
ITEXTURE1D = 538, /* ITEXTURE1D */
UTEXTURE1D = 539, /* UTEXTURE1D */
TEXTURE1DARRAY = 540, /* TEXTURE1DARRAY */
ITEXTURE1DARRAY = 541, /* ITEXTURE1DARRAY */
UTEXTURE1DARRAY = 542, /* UTEXTURE1DARRAY */
TEXTURE2DRECT = 543, /* TEXTURE2DRECT */
ITEXTURE2DRECT = 544, /* ITEXTURE2DRECT */
UTEXTURE2DRECT = 545, /* UTEXTURE2DRECT */
TEXTUREBUFFER = 546, /* TEXTUREBUFFER */
ITEXTUREBUFFER = 547, /* ITEXTUREBUFFER */
UTEXTUREBUFFER = 548, /* UTEXTUREBUFFER */
TEXTURE2DMS = 549, /* TEXTURE2DMS */
ITEXTURE2DMS = 550, /* ITEXTURE2DMS */
UTEXTURE2DMS = 551, /* UTEXTURE2DMS */
TEXTURE2DMSARRAY = 552, /* TEXTURE2DMSARRAY */
ITEXTURE2DMSARRAY = 553, /* ITEXTURE2DMSARRAY */
UTEXTURE2DMSARRAY = 554, /* UTEXTURE2DMSARRAY */
F16TEXTURE1D = 555, /* F16TEXTURE1D */
F16TEXTURE2D = 556, /* F16TEXTURE2D */
F16TEXTURE3D = 557, /* F16TEXTURE3D */
F16TEXTURE2DRECT = 558, /* F16TEXTURE2DRECT */
F16TEXTURECUBE = 559, /* F16TEXTURECUBE */
F16TEXTURE1DARRAY = 560, /* F16TEXTURE1DARRAY */
F16TEXTURE2DARRAY = 561, /* F16TEXTURE2DARRAY */
F16TEXTURECUBEARRAY = 562, /* F16TEXTURECUBEARRAY */
F16TEXTUREBUFFER = 563, /* F16TEXTUREBUFFER */
F16TEXTURE2DMS = 564, /* F16TEXTURE2DMS */
F16TEXTURE2DMSARRAY = 565, /* F16TEXTURE2DMSARRAY */
SUBPASSINPUT = 566, /* SUBPASSINPUT */
SUBPASSINPUTMS = 567, /* SUBPASSINPUTMS */
ISUBPASSINPUT = 568, /* ISUBPASSINPUT */
ISUBPASSINPUTMS = 569, /* ISUBPASSINPUTMS */
USUBPASSINPUT = 570, /* USUBPASSINPUT */
USUBPASSINPUTMS = 571, /* USUBPASSINPUTMS */
F16SUBPASSINPUT = 572, /* F16SUBPASSINPUT */
F16SUBPASSINPUTMS = 573, /* F16SUBPASSINPUTMS */
SPIRV_INSTRUCTION = 574, /* SPIRV_INSTRUCTION */
SPIRV_EXECUTION_MODE = 575, /* SPIRV_EXECUTION_MODE */
SPIRV_EXECUTION_MODE_ID = 576, /* SPIRV_EXECUTION_MODE_ID */
SPIRV_DECORATE = 577, /* SPIRV_DECORATE */
SPIRV_DECORATE_ID = 578, /* SPIRV_DECORATE_ID */
SPIRV_DECORATE_STRING = 579, /* SPIRV_DECORATE_STRING */
SPIRV_TYPE = 580, /* SPIRV_TYPE */
SPIRV_STORAGE_CLASS = 581, /* SPIRV_STORAGE_CLASS */
SPIRV_BY_REFERENCE = 582, /* SPIRV_BY_REFERENCE */
SPIRV_LITERAL = 583, /* SPIRV_LITERAL */
LEFT_OP = 584, /* LEFT_OP */
RIGHT_OP = 585, /* RIGHT_OP */
INC_OP = 586, /* INC_OP */
DEC_OP = 587, /* DEC_OP */
LE_OP = 588, /* LE_OP */
GE_OP = 589, /* GE_OP */
EQ_OP = 590, /* EQ_OP */
NE_OP = 591, /* NE_OP */
AND_OP = 592, /* AND_OP */
OR_OP = 593, /* OR_OP */
XOR_OP = 594, /* XOR_OP */
MUL_ASSIGN = 595, /* MUL_ASSIGN */
DIV_ASSIGN = 596, /* DIV_ASSIGN */
ADD_ASSIGN = 597, /* ADD_ASSIGN */
MOD_ASSIGN = 598, /* MOD_ASSIGN */
LEFT_ASSIGN = 599, /* LEFT_ASSIGN */
RIGHT_ASSIGN = 600, /* RIGHT_ASSIGN */
AND_ASSIGN = 601, /* AND_ASSIGN */
XOR_ASSIGN = 602, /* XOR_ASSIGN */
OR_ASSIGN = 603, /* OR_ASSIGN */
SUB_ASSIGN = 604, /* SUB_ASSIGN */
STRING_LITERAL = 605, /* STRING_LITERAL */
LEFT_PAREN = 606, /* LEFT_PAREN */
RIGHT_PAREN = 607, /* RIGHT_PAREN */
LEFT_BRACKET = 608, /* LEFT_BRACKET */
RIGHT_BRACKET = 609, /* RIGHT_BRACKET */
LEFT_BRACE = 610, /* LEFT_BRACE */
RIGHT_BRACE = 611, /* RIGHT_BRACE */
DOT = 612, /* DOT */
COMMA = 613, /* COMMA */
COLON = 614, /* COLON */
EQUAL = 615, /* EQUAL */
SEMICOLON = 616, /* SEMICOLON */
BANG = 617, /* BANG */
DASH = 618, /* DASH */
TILDE = 619, /* TILDE */
PLUS = 620, /* PLUS */
STAR = 621, /* STAR */
SLASH = 622, /* SLASH */
PERCENT = 623, /* PERCENT */
LEFT_ANGLE = 624, /* LEFT_ANGLE */
RIGHT_ANGLE = 625, /* RIGHT_ANGLE */
VERTICAL_BAR = 626, /* VERTICAL_BAR */
CARET = 627, /* CARET */
AMPERSAND = 628, /* AMPERSAND */
QUESTION = 629, /* QUESTION */
INVARIANT = 630, /* INVARIANT */
HIGH_PRECISION = 631, /* HIGH_PRECISION */
MEDIUM_PRECISION = 632, /* MEDIUM_PRECISION */
LOW_PRECISION = 633, /* LOW_PRECISION */
PRECISION = 634, /* PRECISION */
PACKED = 635, /* PACKED */
RESOURCE = 636, /* RESOURCE */
SUPERP = 637, /* SUPERP */
FLOATCONSTANT = 638, /* FLOATCONSTANT */
INTCONSTANT = 639, /* INTCONSTANT */
UINTCONSTANT = 640, /* UINTCONSTANT */
BOOLCONSTANT = 641, /* BOOLCONSTANT */
IDENTIFIER = 642, /* IDENTIFIER */
TYPE_NAME = 643, /* TYPE_NAME */
CENTROID = 644, /* CENTROID */
IN = 645, /* IN */
OUT = 646, /* OUT */
INOUT = 647, /* INOUT */
STRUCT = 648, /* STRUCT */
VOID = 649, /* VOID */
WHILE = 650, /* WHILE */
BREAK = 651, /* BREAK */
CONTINUE = 652, /* CONTINUE */
DO = 653, /* DO */
ELSE = 654, /* ELSE */
FOR = 655, /* FOR */
IF = 656, /* IF */
DISCARD = 657, /* DISCARD */
RETURN = 658, /* RETURN */
SWITCH = 659, /* SWITCH */
CASE = 660, /* CASE */
DEFAULT = 661, /* DEFAULT */
TERMINATE_INVOCATION = 662, /* TERMINATE_INVOCATION */
TERMINATE_RAY = 663, /* TERMINATE_RAY */
IGNORE_INTERSECTION = 664, /* IGNORE_INTERSECTION */
UNIFORM = 665, /* UNIFORM */
SHARED = 666, /* SHARED */
BUFFER = 667, /* BUFFER */
FLAT = 668, /* FLAT */
SMOOTH = 669, /* SMOOTH */
LAYOUT = 670, /* LAYOUT */
DOUBLECONSTANT = 671, /* DOUBLECONSTANT */
INT16CONSTANT = 672, /* INT16CONSTANT */
UINT16CONSTANT = 673, /* UINT16CONSTANT */
FLOAT16CONSTANT = 674, /* FLOAT16CONSTANT */
INT32CONSTANT = 675, /* INT32CONSTANT */
UINT32CONSTANT = 676, /* UINT32CONSTANT */
INT64CONSTANT = 677, /* INT64CONSTANT */
UINT64CONSTANT = 678, /* UINT64CONSTANT */
SUBROUTINE = 679, /* SUBROUTINE */
DEMOTE = 680, /* DEMOTE */
PAYLOADNV = 681, /* PAYLOADNV */
PAYLOADINNV = 682, /* PAYLOADINNV */
HITATTRNV = 683, /* HITATTRNV */
CALLDATANV = 684, /* CALLDATANV */
CALLDATAINNV = 685, /* CALLDATAINNV */
PAYLOADEXT = 686, /* PAYLOADEXT */
PAYLOADINEXT = 687, /* PAYLOADINEXT */
HITATTREXT = 688, /* HITATTREXT */
CALLDATAEXT = 689, /* CALLDATAEXT */
CALLDATAINEXT = 690, /* CALLDATAINEXT */
PATCH = 691, /* PATCH */
SAMPLE = 692, /* SAMPLE */
NONUNIFORM = 693, /* NONUNIFORM */
COHERENT = 694, /* COHERENT */
VOLATILE = 695, /* VOLATILE */
RESTRICT = 696, /* RESTRICT */
READONLY = 697, /* READONLY */
WRITEONLY = 698, /* WRITEONLY */
DEVICECOHERENT = 699, /* DEVICECOHERENT */
QUEUEFAMILYCOHERENT = 700, /* QUEUEFAMILYCOHERENT */
WORKGROUPCOHERENT = 701, /* WORKGROUPCOHERENT */
SUBGROUPCOHERENT = 702, /* SUBGROUPCOHERENT */
NONPRIVATE = 703, /* NONPRIVATE */
SHADERCALLCOHERENT = 704, /* SHADERCALLCOHERENT */
NOPERSPECTIVE = 705, /* NOPERSPECTIVE */
EXPLICITINTERPAMD = 706, /* EXPLICITINTERPAMD */
PERVERTEXEXT = 707, /* PERVERTEXEXT */
PERVERTEXNV = 708, /* PERVERTEXNV */
PERPRIMITIVENV = 709, /* PERPRIMITIVENV */
PERVIEWNV = 710, /* PERVIEWNV */
PERTASKNV = 711, /* PERTASKNV */
PERPRIMITIVEEXT = 712, /* PERPRIMITIVEEXT */
TASKPAYLOADWORKGROUPEXT = 713, /* TASKPAYLOADWORKGROUPEXT */
PRECISE = 714 /* PRECISE */
};
typedef enum yytokentype yytoken_kind_t;
#endif
@ -556,7 +558,7 @@ union YYSTYPE
glslang::TArraySizes* typeParameters;
} interm;
#line 560 "MachineIndependent/glslang_tab.cpp.h"
#line 562 "MachineIndependent/glslang_tab.cpp.h"
};
typedef union YYSTYPE YYSTYPE;

View File

@ -1105,6 +1105,38 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpIsHelperInvocation: out.debug << "IsHelperInvocation"; break;
case EOpDebugPrintf: out.debug << "Debug printf"; break;
case EOpHitObjectTraceRayNV: out.debug << "HitObjectTraceRayNV"; break;
case EOpHitObjectTraceRayMotionNV: out.debug << "HitObjectTraceRayMotionNV"; break;
case EOpHitObjectRecordHitNV: out.debug << "HitObjectRecordHitNV"; break;
case EOpHitObjectRecordHitMotionNV: out.debug << "HitObjectRecordHitMotionNV"; break;
case EOpHitObjectRecordHitWithIndexNV: out.debug << "HitObjectRecordHitWithIndexNV"; break;
case EOpHitObjectRecordHitWithIndexMotionNV: out.debug << "HitObjectRecordHitWithIndexMotionNV"; break;
case EOpHitObjectRecordMissNV: out.debug << "HitObjectRecordMissNV"; break;
case EOpHitObjectRecordMissMotionNV: out.debug << "HitObjectRecordMissMotionNV"; break;
case EOpHitObjectRecordEmptyNV: out.debug << "HitObjectRecordEmptyNV"; break;
case EOpHitObjectExecuteShaderNV: out.debug << "HitObjectExecuteShaderNV"; break;
case EOpHitObjectIsEmptyNV: out.debug << "HitObjectIsEmptyNV"; break;
case EOpHitObjectIsMissNV: out.debug << "HitObjectIsMissNV"; break;
case EOpHitObjectIsHitNV: out.debug << "HitObjectIsHitNV"; break;
case EOpHitObjectGetRayTMinNV: out.debug << "HitObjectGetRayTMinNV"; break;
case EOpHitObjectGetRayTMaxNV: out.debug << "HitObjectGetRayTMaxNV"; break;
case EOpHitObjectGetObjectRayOriginNV: out.debug << "HitObjectGetObjectRayOriginNV"; break;
case EOpHitObjectGetObjectRayDirectionNV: out.debug << "HitObjectGetObjectRayDirectionNV"; break;
case EOpHitObjectGetWorldRayOriginNV: out.debug << "HitObjectGetWorldRayOriginNV"; break;
case EOpHitObjectGetWorldRayDirectionNV: out.debug << "HitObjectGetWorldRayDirectionNV"; break;
case EOpHitObjectGetObjectToWorldNV: out.debug << "HitObjectGetObjectToWorldNV"; break;
case EOpHitObjectGetWorldToObjectNV: out.debug << "HitObjectGetWorldToObjectNV"; break;
case EOpHitObjectGetInstanceCustomIndexNV: out.debug<< "HitObjectGetInstanceCustomIndexNV"; break;
case EOpHitObjectGetInstanceIdNV: out.debug << "HitObjectGetInstaneIdNV"; break;
case EOpHitObjectGetGeometryIndexNV: out.debug << "HitObjectGetGeometryIndexNV"; break;
case EOpHitObjectGetPrimitiveIndexNV: out.debug << "HitObjectGetPrimitiveIndexNV"; break;
case EOpHitObjectGetHitKindNV: out.debug << "HitObjectGetHitKindNV"; break;
case EOpHitObjectGetAttributesNV: out.debug << "HitObjectGetAttributesNV"; break;
case EOpHitObjectGetCurrentTimeNV: out.debug << "HitObjectGetCurrentTimeNV"; break;
case EOpHitObjectGetShaderBindingTableRecordIndexNV: out.debug << "HitObjectGetShaderBindingTableRecordIndexNV"; break;
case EOpHitObjectGetShaderRecordBufferHandleNV: out.debug << "HitObjectReadShaderRecordBufferHandleNV"; break;
case EOpReorderThreadNV: out.debug << "ReorderThreadNV"; break;
#ifndef GLSLANG_WEB
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
#endif
@ -1552,7 +1584,7 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
break;
}
if (treeRoot == 0 || ! tree)
if (treeRoot == nullptr || ! tree)
return;
TOutputTraverser it(infoSink);

View File

@ -749,6 +749,21 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
symbol->getQualifier().layoutLocation = unitSymbol->getQualifier().layoutLocation;
}
// Update implicit array sizes
if (symbol->getWritableType().isImplicitlySizedArray() && unitSymbol->getType().isImplicitlySizedArray()) {
if (unitSymbol->getType().getImplicitArraySize() > symbol->getType().getImplicitArraySize()){
symbol->getWritableType().updateImplicitArraySize(unitSymbol->getType().getImplicitArraySize());
}
}
else if (symbol->getWritableType().isImplicitlySizedArray() && unitSymbol->getType().isSizedArray()) {
if (symbol->getWritableType().getImplicitArraySize() > unitSymbol->getType().getOuterArraySize())
error(infoSink, "Implicit size of unsized array doesn't match same symbol among multiple shaders.");
}
else if (unitSymbol->getType().isImplicitlySizedArray() && symbol->getWritableType().isSizedArray()) {
if (unitSymbol->getType().getImplicitArraySize() > symbol->getWritableType().getOuterArraySize())
error(infoSink, "Implicit size of unsized array doesn't match same symbol among multiple shaders.");
}
// Update implicit array sizes
mergeImplicitArraySizes(symbol->getWritableType(), unitSymbol->getType());
@ -759,6 +774,19 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
else if (symbol->getQualifier().isPushConstant() && unitSymbol->getQualifier().isPushConstant() && getStage() == unitStage)
error(infoSink, "Only one push_constant block is allowed per stage");
}
// Check conflicts between preset primitives and sizes of I/O variables among multiple geometry shaders
if (language == EShLangGeometry && unitStage == EShLangGeometry)
{
TIntermSymbol* unitSymbol = unitLinkerObjects[unitLinkObj]->getAsSymbolNode();
if (unitSymbol->isArray() && unitSymbol->getQualifier().storage == EvqVaryingIn && unitSymbol->getQualifier().builtIn == EbvNone)
if ((unitSymbol->getArraySizes()->isImplicitlySized() &&
unitSymbol->getArraySizes()->getImplicitSize() != TQualifier::mapGeometryToSize(getInputPrimitive())) ||
(! unitSymbol->getArraySizes()->isImplicitlySized() &&
unitSymbol->getArraySizes()->getDimSize(0) != TQualifier::mapGeometryToSize(getInputPrimitive())))
error(infoSink, "Not all array sizes match across all geometry shaders in the program");
}
if (merge) {
linkerObjects.push_back(unitLinkerObjects[unitLinkObj]);
@ -863,7 +891,8 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
else {
arraysMatch = symbol.getType().sameArrayness(unitSymbol.getType()) ||
(symbol.getType().isArray() && unitSymbol.getType().isArray() &&
(symbol.getType().isUnsizedArray() || unitSymbol.getType().isUnsizedArray()));
(symbol.getType().isImplicitlySizedArray() || unitSymbol.getType().isImplicitlySizedArray() ||
symbol.getType().isUnsizedArray() || unitSymbol.getType().isUnsizedArray()));
}
int lpidx = -1;
@ -1383,7 +1412,7 @@ void TIntermediate::checkCallGraphCycles(TInfoSink& infoSink)
TCall* newRoot;
do {
// See if we have unvisited parts of the graph.
newRoot = 0;
newRoot = nullptr;
for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) {
if (! call->visited) {
newRoot = &(*call);
@ -1517,7 +1546,10 @@ void TIntermediate::checkCallGraphBodies(TInfoSink& infoSink, bool keepUncalled)
if (! keepUncalled) {
for (int f = 0; f < (int)functionSequence.size(); ++f) {
if (! reachable[f])
{
resetTopLevelUncalledStatus(functionSequence[f]->getAsAggregate()->getName());
functionSequence[f] = nullptr;
}
}
functionSequence.erase(std::remove(functionSequence.begin(), functionSequence.end(), nullptr), functionSequence.end());
}
@ -1611,6 +1643,8 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
setRT = 0;
else if (qualifier.isAnyCallable())
setRT = 1;
else if (qualifier.isHitObjectAttrNV())
setRT = 2;
else
return -1;
@ -1650,7 +1684,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
// slot irrespective of type.
int collision = -1; // no collision
#ifndef GLSLANG_WEB
if (qualifier.isAnyPayload() || qualifier.isAnyCallable()) {
if (qualifier.isAnyPayload() || qualifier.isAnyCallable() || qualifier.isHitObjectAttrNV()) {
TRange range(qualifier.layoutLocation, qualifier.layoutLocation);
collision = checkLocationRT(setRT, qualifier.layoutLocation);
if (collision < 0)
@ -2012,6 +2046,15 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
case EbtInt16:
case EbtUint16: size = 2; return 2;
case EbtReference: size = 8; return 8;
case EbtSampler:
{
if (type.isBindlessImage() || type.isBindlessTexture()) {
size = 8; return 8;
}
else {
size = 4; return 4;
}
}
default: size = 4; return 4;
}
}

View File

@ -225,6 +225,16 @@ enum ComputeDerivativeMode {
LayoutDerivativeGroupLinear, // derivative_group_linearNV
};
//
// Status type on AST level. Some uncalled status or functions would be reset in call graph.
// Currently we will keep status set by explicitly declared layout or variable decl.
//
enum AstRefType {
AstRefTypeVar, // Status set by variable decl
AstRefTypeFunc, // Status set by function decl
AstRefTypeLayout, // Status set by layout decl
};
class TIdMaps {
public:
TMap<TString, long long>& operator[](long long i) { return maps[i]; }
@ -284,7 +294,7 @@ public:
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) :
language(l),
profile(p), version(v),
treeRoot(0),
treeRoot(nullptr),
resources(TBuiltInResource{}),
numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false),
invertY(false),
@ -744,6 +754,65 @@ public:
useVariablePointers = true;
processes.addProcess("use-variable-pointers");
}
// Set the global flag for bindless texture
void setBindlessTextureMode(const TString& currentCaller, AstRefType type)
{
// When type is not func, currentCaller should be "" (empty string)
bindlessTextureModeCaller[currentCaller] = type;
}
// Get the global flag for bindless texture
bool getBindlessTextureMode() const
{
return (bindlessTextureModeCaller.size() > 0);
}
// Set the global flag for bindless image
void setBindlessImageMode(const TString& currentCaller, AstRefType type)
{
// When type is not func, currentCaller should be "" (empty string)
bindlessImageModeCaller[currentCaller] = type;
}
// Get the global flag for bindless image
bool getBindlessImageMode() const
{
return (bindlessImageModeCaller.size() > 0);
}
// Get the global flag for bindless texture
bool resetTopLevelUncalledStatus(const TString& deadCaller)
{
// For reflection collection purpose, currently uniform layout setting and some
// flags introduced by variables (IO, global, etc,.) won't be reset here.
// Remove each global status (AST top level) introduced by uncalled functions.
// If a status is set by several functions, keep those which in call graph.
bool result = false;
// For two types of bindless mode flag, we would only reset which is set by an uncalled function.
// If one status flag's key in caller vec is empty, it should be come from a non-function setting.
if (!bindlessTextureModeCaller.empty()) {
auto caller = bindlessTextureModeCaller.find(deadCaller);
if (caller != bindlessTextureModeCaller.end() && bindlessTextureModeCaller[deadCaller] == AstRefTypeFunc) {
bindlessTextureModeCaller.erase(caller);
result = true;
}
}
if (!bindlessImageModeCaller.empty()) {
auto caller = bindlessImageModeCaller.find(deadCaller);
if (caller != bindlessImageModeCaller.end() && bindlessImageModeCaller[deadCaller] == AstRefTypeFunc) {
bindlessImageModeCaller.erase(caller);
result = true;
}
}
return result;
}
bool getBindlessMode() const
{
return getBindlessTextureMode() || getBindlessImageMode();
}
bool usingVariablePointers() const { return useVariablePointers; }
#ifdef ENABLE_HLSL
@ -1188,7 +1257,8 @@ protected:
TSpirvRequirement* spirvRequirement;
TSpirvExecutionMode* spirvExecutionMode;
std::map<TString, AstRefType> bindlessTextureModeCaller;
std::map<TString, AstRefType> bindlessImageModeCaller;
std::unordered_map<std::string, int> uniformLocationOverrides;
int uniformLocationBase;
TNumericFeatures numericFeatures;
@ -1198,8 +1268,9 @@ protected:
std::unordered_set<int> usedConstantId; // specialization constant ids used
std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters
std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers
std::vector<TRange> usedIoRT[2]; // sets of used location, one for rayPayload/rayPayloadIN and other
// for callableData/callableDataIn
std::vector<TRange> usedIoRT[4]; // sets of used location, one for rayPayload/rayPayloadIN,
// one for callableData/callableDataIn, one for hitObjectAttributeNV and
// one for shaderrecordhitobjectNV
// set of names of statically read/written I/O that might need extra checking
std::set<TString> ioAccessed;

View File

@ -198,7 +198,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
bool TIntermediate::parseConstTree(TIntermNode* root, TConstUnionArray unionArray, TOperator constructorType, const TType& t, bool singleConstantParam)
{
if (root == 0)
if (root == nullptr)
return false;
TConstTraverser it(unionArray, singleConstantParam, constructorType, t);

View File

@ -65,7 +65,7 @@ public:
infoSink(infoSink), version(version),
language(language),
spvVersion(spvVersion),
intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { }
intermediate(interm), messages(messages), numErrors(0), currentScanner(nullptr) { }
virtual ~TParseVersions() { }
void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc);
void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc);
@ -226,6 +226,7 @@ public:
protected:
TMap<TString, TExtensionBehavior> extensionBehavior; // for each extension string, what its current behavior is
TMap<TString, unsigned int> extensionMinSpv; // for each extension string, store minimum spirv required
TVector<TString> spvUnsupportedExt; // for extensions reserved for spv usage.
EShMessages messages; // errors/warnings/rule-sets
int numErrors; // number of compile-time errors encountered
TInputScanner* currentScanner;

View File

@ -85,7 +85,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace glslang {
TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, TShader::Includer& inclr) :
preamble(0), strings(0), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false),
preamble(nullptr), strings(nullptr), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false),
rootFileName(rootFileName),
currentSourceFile(rootFileName),
disableEscapeSequences(false)

View File

@ -121,7 +121,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
if (atom == '#') {
if (peekToken('#')) {
parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, nullptr, "token pasting (##)");
currentPos++;
atom = PpAtomPaste;
}

View File

@ -423,7 +423,7 @@ getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& in
ReturnBranchNodeSet());
TIntermNode* root = intermediate.getTreeRoot();
if (root == 0)
if (root == nullptr)
return result_tuple;
NodeMapping& symbol_definition_mapping = std::get<0>(result_tuple);

View File

@ -682,7 +682,7 @@ public:
}
// For a binary operation indexing into an aggregate, chase down the base of the aggregate.
// Return 0 if the topology does not fit this situation.
// Return nullptr if the topology does not fit this situation.
TIntermSymbol* findBase(const TIntermBinary* node)
{
TIntermSymbol *base = node->getLeft()->getAsSymbolNode();

View File

@ -76,7 +76,7 @@ OS_TLSIndex OS_AllocTLSIndex()
//
// Create global pool key.
//
if ((pthread_key_create(&pPoolIndex, NULL)) != 0) {
if ((pthread_key_create(&pPoolIndex, nullptr)) != 0) {
assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
return OS_INVALID_TLS_INDEX;
}

View File

@ -113,7 +113,7 @@ HANDLE GlobalLock;
void InitGlobalLock()
{
GlobalLock = CreateMutex(0, false, 0);
GlobalLock = CreateMutex(nullptr, false, nullptr);
}
void GetGlobalLock()
@ -128,7 +128,7 @@ void ReleaseGlobalLock()
unsigned int __stdcall EnterGenericThread (void* entry)
{
return ((TThreadEntrypoint)entry)(0);
return ((TThreadEntrypoint)entry)(nullptr);
}
//#define DUMP_COUNTERS

View File

@ -41,7 +41,7 @@ namespace glslang {
// Thread Local Storage Operations
//
typedef void* OS_TLSIndex;
#define OS_INVALID_TLS_INDEX ((void*)0)
#define OS_INVALID_TLS_INDEX nullptr
OS_TLSIndex OS_AllocTLSIndex();
bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);