Updated glslang.
This commit is contained in:
parent
635381293b
commit
cc33a884ff
41
3rdparty/glslang/SPIRV/GLSL.ext.QCOM.h
vendored
Normal file
41
3rdparty/glslang/SPIRV/GLSL.ext.QCOM.h
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
** Copyright (c) 2021 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and/or associated documentation files (the "Materials"),
|
||||
** 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 GLSLextQCOM_H
|
||||
#define GLSLextQCOM_H
|
||||
|
||||
enum BuiltIn;
|
||||
enum Decoration;
|
||||
enum Op;
|
||||
enum Capability;
|
||||
|
||||
static const int GLSLextQCOMVersion = 100;
|
||||
static const int GLSLextQCOMRevision = 1;
|
||||
|
||||
//SPV_QCOM_image_processing
|
||||
const char* const E_SPV_QCOM_image_processing = "SPV_QCOM_image_processing";
|
||||
|
||||
#endif // #ifndef GLSLextQCOM_H
|
59
3rdparty/glslang/SPIRV/GlslangToSpv.cpp
vendored
59
3rdparty/glslang/SPIRV/GlslangToSpv.cpp
vendored
@ -50,6 +50,7 @@ namespace spv {
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#include "GLSL.ext.NV.h"
|
||||
#include "GLSL.ext.ARM.h"
|
||||
#include "GLSL.ext.QCOM.h"
|
||||
#include "NonSemanticDebugPrintf.h"
|
||||
}
|
||||
|
||||
@ -220,6 +221,7 @@ protected:
|
||||
spv::Id createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId);
|
||||
spv::Id getSymbolId(const glslang::TIntermSymbol* node);
|
||||
void addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier & qualifier);
|
||||
void addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor);
|
||||
spv::Id createSpvConstant(const glslang::TIntermTyped&);
|
||||
spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&,
|
||||
int& nextConst, bool specConstant);
|
||||
@ -2012,7 +2014,7 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
|
||||
spv::StorageClass sc = builder.getStorageClass(id);
|
||||
// Before SPIR-V 1.4, we only want to include Input and Output.
|
||||
// Starting with SPIR-V 1.4, we want all globals.
|
||||
if ((glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4 && builder.isGlobalStorage(id)) ||
|
||||
if ((glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4 && builder.isGlobalVariable(id)) ||
|
||||
(sc == spv::StorageClassInput || sc == spv::StorageClassOutput)) {
|
||||
iOSet.insert(id);
|
||||
}
|
||||
@ -3276,6 +3278,20 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
noReturnValue = true;
|
||||
break;
|
||||
|
||||
case glslang::EOpImageSampleWeightedQCOM:
|
||||
builder.addCapability(spv::CapabilityTextureSampleWeightedQCOM);
|
||||
builder.addExtension(spv::E_SPV_QCOM_image_processing);
|
||||
break;
|
||||
case glslang::EOpImageBoxFilterQCOM:
|
||||
builder.addCapability(spv::CapabilityTextureBoxFilterQCOM);
|
||||
builder.addExtension(spv::E_SPV_QCOM_image_processing);
|
||||
break;
|
||||
case glslang::EOpImageBlockMatchSADQCOM:
|
||||
case glslang::EOpImageBlockMatchSSDQCOM:
|
||||
builder.addCapability(spv::CapabilityTextureBlockMatchQCOM);
|
||||
builder.addExtension(spv::E_SPV_QCOM_image_processing);
|
||||
break;
|
||||
|
||||
case glslang::EOpDebugPrintf:
|
||||
noReturnValue = true;
|
||||
break;
|
||||
@ -4648,6 +4664,12 @@ bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member)
|
||||
extensions.find("GL_NV_stereo_view_rendering") == extensions.end())
|
||||
return true;
|
||||
|
||||
if (glslangIntermediate->getStage() == EShLangMesh) {
|
||||
if (member.getFieldName() == "gl_PrimitiveShadingRateEXT" &&
|
||||
extensions.find("GL_EXT_fragment_shading_rate") == extensions.end())
|
||||
return true;
|
||||
}
|
||||
|
||||
if (glslangIntermediate->getStage() != EShLangMesh) {
|
||||
if (member.getFieldName() == "gl_ViewportMask" &&
|
||||
extensions.find("GL_NV_viewport_array2") == extensions.end())
|
||||
@ -9017,6 +9039,27 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
case glslang::EOpImageSampleWeightedQCOM:
|
||||
typeId = builder.makeVectorType(builder.makeFloatType(32), 4);
|
||||
opCode = spv::OpImageSampleWeightedQCOM;
|
||||
addImageProcessingQCOMDecoration(operands[2], spv::DecorationWeightTextureQCOM);
|
||||
break;
|
||||
case glslang::EOpImageBoxFilterQCOM:
|
||||
typeId = builder.makeVectorType(builder.makeFloatType(32), 4);
|
||||
opCode = spv::OpImageBoxFilterQCOM;
|
||||
break;
|
||||
case glslang::EOpImageBlockMatchSADQCOM:
|
||||
typeId = builder.makeVectorType(builder.makeFloatType(32), 4);
|
||||
opCode = spv::OpImageBlockMatchSADQCOM;
|
||||
addImageProcessingQCOMDecoration(operands[0], spv::DecorationBlockMatchTextureQCOM);
|
||||
addImageProcessingQCOMDecoration(operands[2], spv::DecorationBlockMatchTextureQCOM);
|
||||
break;
|
||||
case glslang::EOpImageBlockMatchSSDQCOM:
|
||||
typeId = builder.makeVectorType(builder.makeFloatType(32), 4);
|
||||
opCode = spv::OpImageBlockMatchSSDQCOM;
|
||||
addImageProcessingQCOMDecoration(operands[0], spv::DecorationBlockMatchTextureQCOM);
|
||||
addImageProcessingQCOMDecoration(operands[2], spv::DecorationBlockMatchTextureQCOM);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
@ -9562,6 +9605,20 @@ void TGlslangToSpvTraverser::addMeshNVDecoration(spv::Id id, int member, const g
|
||||
}
|
||||
}
|
||||
|
||||
void TGlslangToSpvTraverser::addImageProcessingQCOMDecoration(spv::Id id, spv::Decoration decor)
|
||||
{
|
||||
spv::Op opc = builder.getOpCode(id);
|
||||
if (opc == spv::OpSampledImage) {
|
||||
id = builder.getIdOperand(id, 0);
|
||||
opc = builder.getOpCode(id);
|
||||
}
|
||||
|
||||
if (opc == spv::OpLoad) {
|
||||
spv::Id texid = builder.getIdOperand(id, 0);
|
||||
builder.addDecoration(texid, decor);
|
||||
}
|
||||
}
|
||||
|
||||
// Make a full tree of instructions to build a SPIR-V specialization constant,
|
||||
// or regular constant if possible.
|
||||
//
|
||||
|
1
3rdparty/glslang/SPIRV/SpvBuilder.h
vendored
1
3rdparty/glslang/SPIRV/SpvBuilder.h
vendored
@ -261,6 +261,7 @@ public:
|
||||
ImageFormat getImageTypeFormat(Id typeId) const
|
||||
{ return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
|
||||
Id getResultingAccessChainType() const;
|
||||
Id getIdOperand(Id resultId, int idx) { return module.getInstruction(resultId)->getIdOperand(idx); }
|
||||
|
||||
bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
|
||||
bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
|
||||
|
1
3rdparty/glslang/SPIRV/SpvPostProcess.cpp
vendored
1
3rdparty/glslang/SPIRV/SpvPostProcess.cpp
vendored
@ -53,6 +53,7 @@ namespace spv {
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#include "GLSL.ext.NV.h"
|
||||
#include "GLSL.ext.ARM.h"
|
||||
#include "GLSL.ext.QCOM.h"
|
||||
}
|
||||
|
||||
namespace spv {
|
||||
|
1
3rdparty/glslang/SPIRV/disassemble.cpp
vendored
1
3rdparty/glslang/SPIRV/disassemble.cpp
vendored
@ -56,6 +56,7 @@ namespace spv {
|
||||
#include "GLSL.ext.NV.h"
|
||||
#include "GLSL.ext.ARM.h"
|
||||
#include "NonSemanticShaderDebugInfo100.h"
|
||||
#include "GLSL.ext.QCOM.h"
|
||||
}
|
||||
}
|
||||
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
|
||||
|
43
3rdparty/glslang/SPIRV/doc.cpp
vendored
43
3rdparty/glslang/SPIRV/doc.cpp
vendored
@ -55,6 +55,7 @@ namespace spv {
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#include "GLSL.ext.NV.h"
|
||||
#include "GLSL.ext.ARM.h"
|
||||
#include "GLSL.ext.QCOM.h"
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,7 +312,9 @@ const char* DecorationString(int decoration)
|
||||
case DecorationCeiling:
|
||||
default: return "Bad";
|
||||
|
||||
case DecorationExplicitInterpAMD: return "ExplicitInterpAMD";
|
||||
case DecorationWeightTextureQCOM: return "DecorationWeightTextureQCOM";
|
||||
case DecorationBlockMatchTextureQCOM: return "DecorationBlockMatchTextureQCOM";
|
||||
case DecorationExplicitInterpAMD: return "ExplicitInterpAMD";
|
||||
case DecorationOverrideCoverageNV: return "OverrideCoverageNV";
|
||||
case DecorationPassthroughNV: return "PassthroughNV";
|
||||
case DecorationViewportRelativeNV: return "ViewportRelativeNV";
|
||||
@ -1040,6 +1043,11 @@ const char* CapabilityString(int info)
|
||||
case CapabilityCoreBuiltinsARM: return "CoreBuiltinsARM";
|
||||
|
||||
case CapabilityShaderInvocationReorderNV: return "ShaderInvocationReorderNV";
|
||||
|
||||
case CapabilityTextureSampleWeightedQCOM: return "TextureSampleWeightedQCOM";
|
||||
case CapabilityTextureBoxFilterQCOM: return "TextureBoxFilterQCOM";
|
||||
case CapabilityTextureBlockMatchQCOM: return "TextureBlockMatchQCOM";
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
}
|
||||
@ -1538,6 +1546,11 @@ const char* OpcodeString(int op)
|
||||
case OpDepthAttachmentReadEXT: return "OpDepthAttachmentReadEXT";
|
||||
case OpStencilAttachmentReadEXT: return "OpStencilAttachmentReadEXT";
|
||||
|
||||
case OpImageSampleWeightedQCOM: return "OpImageSampleWeightedQCOM";
|
||||
case OpImageBoxFilterQCOM: return "OpImageBoxFilterQCOM";
|
||||
case OpImageBlockMatchSADQCOM: return "OpImageBlockMatchSADQCOM";
|
||||
case OpImageBlockMatchSSDQCOM: return "OpImageBlockMatchSSDQCOM";
|
||||
|
||||
default:
|
||||
return "Bad";
|
||||
}
|
||||
@ -3339,6 +3352,34 @@ void Parameterize()
|
||||
InstructionDesc[OpColorAttachmentReadEXT].operands.push(OperandId, "'Sample'", true);
|
||||
InstructionDesc[OpStencilAttachmentReadEXT].operands.push(OperandId, "'Sample'", true);
|
||||
InstructionDesc[OpDepthAttachmentReadEXT].operands.push(OperandId, "'Sample'", true);
|
||||
|
||||
InstructionDesc[OpImageSampleWeightedQCOM].operands.push(OperandId, "'source texture'");
|
||||
InstructionDesc[OpImageSampleWeightedQCOM].operands.push(OperandId, "'texture coordinates'");
|
||||
InstructionDesc[OpImageSampleWeightedQCOM].operands.push(OperandId, "'weights texture'");
|
||||
InstructionDesc[OpImageSampleWeightedQCOM].operands.push(OperandImageOperands, "", true);
|
||||
InstructionDesc[OpImageSampleWeightedQCOM].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpImageBoxFilterQCOM].operands.push(OperandId, "'source texture'");
|
||||
InstructionDesc[OpImageBoxFilterQCOM].operands.push(OperandId, "'texture coordinates'");
|
||||
InstructionDesc[OpImageBoxFilterQCOM].operands.push(OperandId, "'box size'");
|
||||
InstructionDesc[OpImageBoxFilterQCOM].operands.push(OperandImageOperands, "", true);
|
||||
InstructionDesc[OpImageBoxFilterQCOM].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'target texture'");
|
||||
InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'target coordinates'");
|
||||
InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'reference texture'");
|
||||
InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'reference coordinates'");
|
||||
InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandId, "'block size'");
|
||||
InstructionDesc[OpImageBlockMatchSADQCOM].operands.push(OperandImageOperands, "", true);
|
||||
InstructionDesc[OpImageBlockMatchSADQCOM].setResultAndType(true, true);
|
||||
|
||||
InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'target texture'");
|
||||
InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'target coordinates'");
|
||||
InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'reference texture'");
|
||||
InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'reference coordinates'");
|
||||
InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandId, "'block size'");
|
||||
InstructionDesc[OpImageBlockMatchSSDQCOM].operands.push(OperandImageOperands, "", true);
|
||||
InstructionDesc[OpImageBlockMatchSSDQCOM].setResultAndType(true, true);
|
||||
});
|
||||
}
|
||||
|
||||
|
13
3rdparty/glslang/SPIRV/spirv.hpp
vendored
13
3rdparty/glslang/SPIRV/spirv.hpp
vendored
@ -513,6 +513,8 @@ enum Decoration {
|
||||
DecorationMaxByteOffsetId = 47,
|
||||
DecorationNoSignedWrap = 4469,
|
||||
DecorationNoUnsignedWrap = 4470,
|
||||
DecorationWeightTextureQCOM = 4487,
|
||||
DecorationBlockMatchTextureQCOM = 4488,
|
||||
DecorationExplicitInterpAMD = 4999,
|
||||
DecorationOverrideCoverageNV = 5248,
|
||||
DecorationPassthroughNV = 5250,
|
||||
@ -1023,6 +1025,9 @@ enum Capability {
|
||||
CapabilityRayQueryKHR = 4472,
|
||||
CapabilityRayTraversalPrimitiveCullingKHR = 4478,
|
||||
CapabilityRayTracingKHR = 4479,
|
||||
CapabilityTextureSampleWeightedQCOM = 4484,
|
||||
CapabilityTextureBoxFilterQCOM = 4485,
|
||||
CapabilityTextureBlockMatchQCOM = 4486,
|
||||
CapabilityFloat16ImageAMD = 5008,
|
||||
CapabilityImageGatherBiasLodAMD = 5009,
|
||||
CapabilityFragmentMaskAMD = 5010,
|
||||
@ -1678,6 +1683,10 @@ enum Op {
|
||||
OpRayQueryConfirmIntersectionKHR = 4476,
|
||||
OpRayQueryProceedKHR = 4477,
|
||||
OpRayQueryGetIntersectionTypeKHR = 4479,
|
||||
OpImageSampleWeightedQCOM = 4480,
|
||||
OpImageBoxFilterQCOM = 4481,
|
||||
OpImageBlockMatchSSDQCOM = 4482,
|
||||
OpImageBlockMatchSADQCOM = 4483,
|
||||
OpGroupIAddNonUniformAMD = 5000,
|
||||
OpGroupFAddNonUniformAMD = 5001,
|
||||
OpGroupFMinNonUniformAMD = 5002,
|
||||
@ -2395,6 +2404,10 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
||||
case OpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpImageSampleWeightedQCOM: *hasResult = true; *hasResultType = true; break;
|
||||
case OpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break;
|
||||
case OpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break;
|
||||
case OpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break;
|
||||
case OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
case OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
case OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break;
|
||||
|
6
3rdparty/glslang/build_info.h
vendored
6
3rdparty/glslang/build_info.h
vendored
@ -34,9 +34,9 @@
|
||||
#ifndef GLSLANG_BUILD_INFO
|
||||
#define GLSLANG_BUILD_INFO
|
||||
|
||||
#define GLSLANG_VERSION_MAJOR 12
|
||||
#define GLSLANG_VERSION_MINOR 3
|
||||
#define GLSLANG_VERSION_PATCH 1
|
||||
#define GLSLANG_VERSION_MAJOR 13
|
||||
#define GLSLANG_VERSION_MINOR 0
|
||||
#define GLSLANG_VERSION_PATCH 0
|
||||
#define GLSLANG_VERSION_FLAVOR ""
|
||||
|
||||
#define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \
|
||||
|
13
3rdparty/glslang/glslang/Include/PoolAlloc.h
vendored
13
3rdparty/glslang/glslang/Include/PoolAlloc.h
vendored
@ -118,11 +118,16 @@ private:
|
||||
unsigned char* mem; // beginning of our allocation (pts to header)
|
||||
TAllocation* prevAlloc; // prior allocation in the chain
|
||||
|
||||
const static unsigned char guardBlockBeginVal;
|
||||
const static unsigned char guardBlockEndVal;
|
||||
const static unsigned char userDataFill;
|
||||
static inline constexpr unsigned char guardBlockBeginVal = 0xfb;
|
||||
static inline constexpr unsigned char guardBlockEndVal = 0xfe;
|
||||
static inline constexpr unsigned char userDataFill = 0xcd;
|
||||
|
||||
# ifdef GUARD_BLOCKS
|
||||
static inline constexpr size_t guardBlockSize = 16;
|
||||
# else
|
||||
static inline constexpr size_t guardBlockSize = 0;
|
||||
# endif
|
||||
|
||||
const static size_t guardBlockSize;
|
||||
# ifdef GUARD_BLOCKS
|
||||
inline static size_t headerSize() { return sizeof(TAllocation); }
|
||||
# else
|
||||
|
@ -1100,6 +1100,12 @@ enum TOperator {
|
||||
// Shader tile image ops
|
||||
EOpStencilAttachmentReadEXT, // Fragment only
|
||||
EOpDepthAttachmentReadEXT, // Fragment only
|
||||
|
||||
// Image processing
|
||||
EOpImageSampleWeightedQCOM,
|
||||
EOpImageBoxFilterQCOM,
|
||||
EOpImageBlockMatchSADQCOM,
|
||||
EOpImageBlockMatchSSDQCOM,
|
||||
};
|
||||
|
||||
class TIntermTraverser;
|
||||
|
@ -61,10 +61,6 @@ const bool ARBCompatibility = true;
|
||||
|
||||
const bool ForwardCompatibility = false;
|
||||
|
||||
// change this back to false if depending on textual spellings of texturing calls when consuming the AST
|
||||
// Using PureOperatorBuiltins=false is deprecated.
|
||||
bool PureOperatorBuiltins = true;
|
||||
|
||||
namespace {
|
||||
|
||||
//
|
||||
@ -4135,6 +4131,18 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
|
||||
}
|
||||
|
||||
// QCOM_image_processing
|
||||
if ((profile == EEsProfile && version >= 310) ||
|
||||
(profile != EEsProfile && version >= 140)) {
|
||||
commonBuiltins.append(
|
||||
"vec4 textureWeightedQCOM(sampler2D, vec2, sampler2DArray);"
|
||||
"vec4 textureWeightedQCOM(sampler2D, vec2, sampler1DArray);"
|
||||
"vec4 textureBoxFilterQCOM(sampler2D, vec2, vec2);"
|
||||
"vec4 textureBlockMatchSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"
|
||||
"vec4 textureBlockMatchSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"
|
||||
"\n");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// Prototypes for built-in functions seen by vertex shaders only.
|
||||
@ -4624,7 +4632,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"uvec4 fragmentFetchAMD(usubpassInputMS, uint);"
|
||||
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
|
||||
// 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/GL_KHR_ray_tracing_position_Fetch
|
||||
@ -8095,7 +8103,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
|
||||
}
|
||||
|
||||
if (profile != EEsProfile) {
|
||||
if (profile != EEsProfile) {
|
||||
BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);
|
||||
BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);
|
||||
BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);
|
||||
@ -8725,6 +8733,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setFunctionExtensions("stencilAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
|
||||
symbolTable.setFunctionExtensions("depthAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
|
||||
symbolTable.setFunctionExtensions("colorAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
|
||||
|
||||
if ((profile == EEsProfile && version >= 310) ||
|
||||
(profile != EEsProfile && version >= 140)) {
|
||||
symbolTable.setFunctionExtensions("textureWeightedQCOM", 1, &E_GL_QCOM_image_processing);
|
||||
symbolTable.setFunctionExtensions("textureBoxFilterQCOM", 1, &E_GL_QCOM_image_processing);
|
||||
symbolTable.setFunctionExtensions("textureBlockMatchSADQCOM", 1, &E_GL_QCOM_image_processing);
|
||||
symbolTable.setFunctionExtensions("textureBlockMatchSSDQCOM", 1, &E_GL_QCOM_image_processing);
|
||||
}
|
||||
break;
|
||||
|
||||
case EShLangCompute:
|
||||
@ -9206,7 +9222,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_Layer", 1, &E_GL_EXT_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_ViewportIndex", 1, &E_GL_EXT_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_CullPrimitiveEXT", 1, &E_GL_EXT_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_PrimitiveShadingRateEXT", 1, &E_GL_EXT_mesh_shader);
|
||||
|
||||
// note: technically this member requires both GL_EXT_mesh_shader and GL_EXT_fragment_shading_rate
|
||||
// since setVariableExtensions only needs *one of* the extensions to validate, it's more useful to specify EXT_fragment_shading_rate
|
||||
// GL_EXT_mesh_shader will be required in practice by use of other fields of gl_MeshPrimitivesEXT
|
||||
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_PrimitiveShadingRateEXT", 1, &E_GL_EXT_fragment_shading_rate);
|
||||
|
||||
BuiltInVariable("gl_MeshPrimitivesEXT", "gl_PrimitiveID", EbvPrimitiveId, symbolTable);
|
||||
BuiltInVariable("gl_MeshPrimitivesEXT", "gl_Layer", EbvLayer, symbolTable);
|
||||
@ -9886,6 +9906,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.relateToOperator("shadow2DEXT", EOpTexture);
|
||||
symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj);
|
||||
}
|
||||
|
||||
if ((profile == EEsProfile && version >= 310) ||
|
||||
(profile != EEsProfile && version >= 140)) {
|
||||
symbolTable.relateToOperator("textureWeightedQCOM", EOpImageSampleWeightedQCOM);
|
||||
symbolTable.relateToOperator("textureBoxFilterQCOM", EOpImageBoxFilterQCOM);
|
||||
symbolTable.relateToOperator("textureBlockMatchSADQCOM", EOpImageBlockMatchSADQCOM);
|
||||
symbolTable.relateToOperator("textureBlockMatchSSDQCOM", EOpImageBlockMatchSSDQCOM);
|
||||
}
|
||||
}
|
||||
|
||||
switch(language) {
|
||||
@ -10026,7 +10054,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
if (profile != EEsProfile && version >= 460) {
|
||||
symbolTable.relateToOperator("reportIntersectionNV", EOpReportIntersection);
|
||||
symbolTable.relateToOperator("reportIntersectionEXT", EOpReportIntersection);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EShLangAnyHit:
|
||||
if (profile != EEsProfile && version >= 460) {
|
||||
|
@ -107,6 +107,9 @@ protected:
|
||||
int dimMap[EsdNumDims];
|
||||
};
|
||||
|
||||
// change this back to false if depending on textual spellings of texturing calls when consuming the AST
|
||||
// Using PureOperatorBuiltins=false is deprecated.
|
||||
constexpr bool PureOperatorBuiltins = true;
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _INITIALIZE_INCLUDED_
|
||||
|
@ -38,6 +38,7 @@
|
||||
//
|
||||
|
||||
#include "ParseHelper.h"
|
||||
#include "Initialize.h"
|
||||
#include "Scan.h"
|
||||
|
||||
#include "../OSDependent/osinclude.h"
|
||||
@ -2685,7 +2686,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
|
||||
}
|
||||
}
|
||||
|
||||
extern bool PureOperatorBuiltins;
|
||||
|
||||
// Deprecated! Use PureOperatorBuiltins == true instead, in which case this
|
||||
// functionality is handled in builtInOpCheck() instead of here.
|
||||
@ -6324,9 +6324,6 @@ void TParseContext::layoutMemberLocationArrayCheck(const TSourceLoc& loc, bool m
|
||||
// Do layout error checking with respect to a type.
|
||||
void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
||||
{
|
||||
if (extensionTurnedOn(E_GL_EXT_spirv_intrinsics))
|
||||
return; // Skip any check if GL_EXT_spirv_intrinsics is turned on
|
||||
|
||||
const TQualifier& qualifier = type.getQualifier();
|
||||
|
||||
// first, intra-layout qualifier-only error checking
|
||||
@ -6380,6 +6377,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
||||
case EvqCallableData:
|
||||
case EvqCallableDataIn:
|
||||
case EvqHitObjectAttrNV:
|
||||
case EvqSpirvStorageClass:
|
||||
break;
|
||||
case EvqTileImageEXT:
|
||||
break;
|
||||
@ -6436,7 +6434,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
||||
// an array of size N, all elements of the array from binding through binding + N - 1 must be within this
|
||||
// range."
|
||||
//
|
||||
if (! type.isOpaque() && type.getBasicType() != EbtBlock)
|
||||
if (!type.isOpaque() && type.getBasicType() != EbtBlock && type.getBasicType() != EbtSpirvType)
|
||||
error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", "");
|
||||
if (type.getBasicType() == EbtSampler) {
|
||||
int lastBinding = qualifier.layoutBinding;
|
||||
|
@ -131,16 +131,6 @@ TPoolAllocator::~TPoolAllocator()
|
||||
}
|
||||
}
|
||||
|
||||
const unsigned char TAllocation::guardBlockBeginVal = 0xfb;
|
||||
const unsigned char TAllocation::guardBlockEndVal = 0xfe;
|
||||
const unsigned char TAllocation::userDataFill = 0xcd;
|
||||
|
||||
# ifdef GUARD_BLOCKS
|
||||
const size_t TAllocation::guardBlockSize = 16;
|
||||
# else
|
||||
const size_t TAllocation::guardBlockSize = 0;
|
||||
# endif
|
||||
|
||||
//
|
||||
// Check a single guard block for damage
|
||||
//
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include "SymbolTable.h"
|
||||
#include "ParseHelper.h"
|
||||
#include "Scan.h"
|
||||
@ -81,6 +82,9 @@ namespace { // anonymous namespace for file-local functions and symbols
|
||||
// Shared global; access should be protected by a global mutex/critical section.
|
||||
int NumberOfClients = 0;
|
||||
|
||||
// global initialization lock
|
||||
std::mutex init_lock;
|
||||
|
||||
using namespace glslang;
|
||||
|
||||
// Create a language specific version of parseables.
|
||||
@ -417,18 +421,15 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
||||
TInfoSink infoSink;
|
||||
|
||||
// Make sure only one thread tries to do this at a time
|
||||
glslang::GetGlobalLock();
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
|
||||
// See if it's already been done for this version/profile combination
|
||||
int versionIndex = MapVersionToIndex(version);
|
||||
int spvVersionIndex = MapSpvVersionToIndex(spvVersion);
|
||||
int profileIndex = MapProfileToIndex(profile);
|
||||
int sourceIndex = MapSourceToIndex(source);
|
||||
if (CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][EPcGeneral]) {
|
||||
glslang::ReleaseGlobalLock();
|
||||
|
||||
if (CommonSymbolTable[versionIndex][spvVersionIndex][profileIndex][sourceIndex][EPcGeneral])
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch to a new pool
|
||||
TPoolAllocator& previousAllocator = GetThreadPoolAllocator();
|
||||
@ -475,8 +476,6 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
||||
|
||||
delete builtInPoolAllocator;
|
||||
SetThreadPoolAllocator(&previousAllocator);
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
}
|
||||
|
||||
// Function to Print all builtins
|
||||
@ -1297,12 +1296,10 @@ bool CompileDeferred(
|
||||
//
|
||||
int ShInitialize()
|
||||
{
|
||||
glslang::InitGlobalLock();
|
||||
|
||||
if (! InitProcess())
|
||||
return 0;
|
||||
|
||||
glslang::GetGlobalLock();
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
++NumberOfClients;
|
||||
|
||||
if (PerProcessGPA == nullptr)
|
||||
@ -1313,7 +1310,6 @@ int ShInitialize()
|
||||
glslang::HlslScanContext::fillInKeywordMap();
|
||||
#endif
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1372,14 +1368,11 @@ void ShDestruct(ShHandle handle)
|
||||
//
|
||||
int ShFinalize()
|
||||
{
|
||||
glslang::GetGlobalLock();
|
||||
const std::lock_guard<std::mutex> lock(init_lock);
|
||||
--NumberOfClients;
|
||||
assert(NumberOfClients >= 0);
|
||||
bool finalize = NumberOfClients == 0;
|
||||
if (! finalize) {
|
||||
glslang::ReleaseGlobalLock();
|
||||
if (NumberOfClients > 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int version = 0; version < VersionCount; ++version) {
|
||||
for (int spvVersion = 0; spvVersion < SpvVersionCount; ++spvVersion) {
|
||||
@ -1417,7 +1410,6 @@ int ShFinalize()
|
||||
glslang::HlslScanContext::deleteKeywordMap();
|
||||
#endif
|
||||
|
||||
glslang::ReleaseGlobalLock();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -307,6 +307,9 @@ void TParseVersions::initializeExtensionBehavior()
|
||||
// ARM
|
||||
extensionBehavior[E_GL_ARM_shader_core_builtins] = EBhDisable;
|
||||
|
||||
// QCOM
|
||||
extensionBehavior[E_GL_QCOM_image_processing] = EBhDisable;
|
||||
|
||||
// AEP
|
||||
extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable;
|
||||
extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisable;
|
||||
@ -431,6 +434,8 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||
"#define GL_OES_texture_buffer 1\n"
|
||||
"#define GL_OES_texture_cube_map_array 1\n"
|
||||
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
|
||||
|
||||
"#define GL_QCOM_image_processing 1\n"
|
||||
;
|
||||
|
||||
if (version >= 300) {
|
||||
@ -555,6 +560,8 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||
"#define GL_NV_integer_cooperative_matrix 1\n"
|
||||
"#define GL_NV_shader_invocation_reorder 1\n"
|
||||
|
||||
"#define GL_QCOM_image_processing 1\n"
|
||||
|
||||
"#define GL_EXT_shader_explicit_arithmetic_types 1\n"
|
||||
"#define GL_EXT_shader_explicit_arithmetic_types_int8 1\n"
|
||||
"#define GL_EXT_shader_explicit_arithmetic_types_int16 1\n"
|
||||
|
@ -281,6 +281,8 @@ const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_
|
||||
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";
|
||||
|
||||
const char* const E_GL_QCOM_image_processing = "GL_QCOM_image_processing";
|
||||
|
||||
// AEP
|
||||
const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a";
|
||||
const char* const E_GL_KHR_blend_equation_advanced = "GL_KHR_blend_equation_advanced";
|
||||
|
@ -378,8 +378,6 @@ namespace {
|
||||
int op_cmpl(int a) { return ~a; }
|
||||
int op_not(int a) { return !a; }
|
||||
|
||||
};
|
||||
|
||||
struct TBinop {
|
||||
int token, precedence, (*op)(int, int);
|
||||
} binop[] = {
|
||||
@ -412,6 +410,8 @@ struct TUnop {
|
||||
{ '!', op_not },
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
#define NUM_ELEMENTS(A) (sizeof(A) / sizeof(A[0]))
|
||||
|
||||
int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken* ppToken)
|
||||
|
@ -36,15 +36,8 @@
|
||||
// This file contains the Linux-specific functions
|
||||
//
|
||||
#include "../osinclude.h"
|
||||
#include "../../../OGLCompilersDLL/InitializeDll.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <cstdio>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if !defined(__Fuchsia__)
|
||||
#include <sys/resource.h>
|
||||
@ -52,34 +45,6 @@
|
||||
|
||||
namespace glslang {
|
||||
|
||||
namespace {
|
||||
pthread_mutex_t gMutex;
|
||||
}
|
||||
|
||||
static void InitMutex(void)
|
||||
{
|
||||
pthread_mutexattr_t mutexattr;
|
||||
pthread_mutexattr_init(&mutexattr);
|
||||
pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&gMutex, &mutexattr);
|
||||
}
|
||||
|
||||
void InitGlobalLock()
|
||||
{
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
pthread_once(&once, InitMutex);
|
||||
}
|
||||
|
||||
void GetGlobalLock()
|
||||
{
|
||||
pthread_mutex_lock(&gMutex);
|
||||
}
|
||||
|
||||
void ReleaseGlobalLock()
|
||||
{
|
||||
pthread_mutex_unlock(&gMutex);
|
||||
}
|
||||
|
||||
// #define DUMP_COUNTERS
|
||||
|
||||
void OS_DumpMemoryCounters()
|
||||
|
@ -37,11 +37,9 @@
|
||||
#define STRICT
|
||||
#define VC_EXTRALEAN 1
|
||||
#include <windows.h>
|
||||
#include <cassert>
|
||||
#include <process.h>
|
||||
#include <psapi.h>
|
||||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
|
||||
//
|
||||
// This file contains the Window-OS-specific functions
|
||||
@ -53,28 +51,6 @@
|
||||
|
||||
namespace glslang {
|
||||
|
||||
HANDLE GlobalLock;
|
||||
|
||||
void InitGlobalLock()
|
||||
{
|
||||
GlobalLock = CreateMutex(nullptr, false, nullptr);
|
||||
}
|
||||
|
||||
void GetGlobalLock()
|
||||
{
|
||||
WaitForSingleObject(GlobalLock, INFINITE);
|
||||
}
|
||||
|
||||
void ReleaseGlobalLock()
|
||||
{
|
||||
ReleaseMutex(GlobalLock);
|
||||
}
|
||||
|
||||
unsigned int __stdcall EnterGenericThread (void* entry)
|
||||
{
|
||||
return ((TThreadEntrypoint)entry)(nullptr);
|
||||
}
|
||||
|
||||
//#define DUMP_COUNTERS
|
||||
|
||||
void OS_DumpMemoryCounters()
|
||||
|
@ -37,12 +37,6 @@
|
||||
|
||||
namespace glslang {
|
||||
|
||||
void InitGlobalLock();
|
||||
void GetGlobalLock();
|
||||
void ReleaseGlobalLock();
|
||||
|
||||
typedef unsigned int (*TThreadEntrypoint)(void*);
|
||||
|
||||
void OS_DumpMemoryCounters();
|
||||
|
||||
} // end namespace glslang
|
||||
|
Loading…
Reference in New Issue
Block a user