mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-10 20:30:06 +00:00
Merge pull request #398 from amdrexu/feature
AMD: Implement 4 AMD-specific extensions.
This commit is contained in:
commit
df018fa994
@ -1,12 +1,18 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" OFF)
|
||||
|
||||
enable_testing()
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix")
|
||||
|
||||
project(glslang)
|
||||
|
||||
if(ENABLE_AMD_EXTENSIONS)
|
||||
add_definitions(-DAMD_EXTENSIONS)
|
||||
endif(ENABLE_AMD_EXTENSIONS)
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
include(ChooseMSVCCRT.cmake)
|
||||
|
@ -18,6 +18,11 @@ set(HEADERS
|
||||
doc.h
|
||||
disassemble.h)
|
||||
|
||||
if(ENABLE_AMD_EXTENSIONS)
|
||||
set(HEADERS
|
||||
GLSL.ext.AMD.h)
|
||||
endif(ENABLE_AMD_EXTENSIONS)
|
||||
|
||||
add_library(SPIRV STATIC ${SOURCES} ${HEADERS})
|
||||
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
|
||||
|
||||
|
113
SPIRV/GLSL.ext.AMD.h
Normal file
113
SPIRV/GLSL.ext.AMD.h
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
** Copyright (c) 2014-2016 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 GLSLextAMD_H
|
||||
#define GLSLextAMD_H
|
||||
|
||||
enum BuiltIn;
|
||||
enum Decoration;
|
||||
enum Op;
|
||||
|
||||
static const int GLSLextAMDVersion = 100;
|
||||
static const int GLSLextAMDRevision = 1;
|
||||
|
||||
// SPV_AMD_shader_ballot
|
||||
static const char* const E_SPV_AMD_shader_ballot = "SPV_AMD_shader_ballot";
|
||||
|
||||
static const Op OpGroupIAddNonUniformAMD = static_cast<Op>(5000);
|
||||
static const Op OpGroupFAddNonUniformAMD = static_cast<Op>(5001);
|
||||
static const Op OpGroupFMinNonUniformAMD = static_cast<Op>(5002);
|
||||
static const Op OpGroupUMinNonUniformAMD = static_cast<Op>(5003);
|
||||
static const Op OpGroupSMinNonUniformAMD = static_cast<Op>(5004);
|
||||
static const Op OpGroupFMaxNonUniformAMD = static_cast<Op>(5005);
|
||||
static const Op OpGroupUMaxNonUniformAMD = static_cast<Op>(5006);
|
||||
static const Op OpGroupSMaxNonUniformAMD = static_cast<Op>(5007);
|
||||
|
||||
enum ShaderBallotAMD {
|
||||
ShaderBallotBadAMD = 0, // Don't use
|
||||
|
||||
SwizzleInvocationsAMD = 1,
|
||||
SwizzleInvocationsMaskedAMD = 2,
|
||||
WriteInvocationAMD = 3,
|
||||
MbcntAMD = 4,
|
||||
|
||||
ShaderBallotCountAMD
|
||||
};
|
||||
|
||||
// SPV_AMD_shader_trinary_minmax
|
||||
static const char* const E_SPV_AMD_shader_trinary_minmax = "SPV_AMD_shader_trinary_minmax";
|
||||
|
||||
enum ShaderTrinaryMinMaxAMD {
|
||||
ShaderTrinaryMinMaxBadAMD = 0, // Don't use
|
||||
|
||||
FMin3AMD = 1,
|
||||
UMin3AMD = 2,
|
||||
SMin3AMD = 3,
|
||||
FMax3AMD = 4,
|
||||
UMax3AMD = 5,
|
||||
SMax3AMD = 6,
|
||||
FMid3AMD = 7,
|
||||
UMid3AMD = 8,
|
||||
SMid3AMD = 9,
|
||||
|
||||
ShaderTrinaryMinMaxCountAMD
|
||||
};
|
||||
|
||||
// SPV_AMD_shader_explicit_vertex_parameter
|
||||
static const char* const E_SPV_AMD_shader_explicit_vertex_parameter = "SPV_AMD_shader_explicit_vertex_parameter";
|
||||
|
||||
static const BuiltIn BuiltInBaryCoordNoPerspAMD = static_cast<BuiltIn>(4992);
|
||||
static const BuiltIn BuiltInBaryCoordNoPerspCentroidAMD = static_cast<BuiltIn>(4993);
|
||||
static const BuiltIn BuiltInBaryCoordNoPerspSampleAMD = static_cast<BuiltIn>(4994);
|
||||
static const BuiltIn BuiltInBaryCoordSmoothAMD = static_cast<BuiltIn>(4995);
|
||||
static const BuiltIn BuiltInBaryCoordSmoothCentroidAMD = static_cast<BuiltIn>(4996);
|
||||
static const BuiltIn BuiltInBaryCoordSmoothSampleAMD = static_cast<BuiltIn>(4997);
|
||||
static const BuiltIn BuiltInBaryCoordPullModelAMD = static_cast<BuiltIn>(4998);
|
||||
|
||||
static const Decoration DecorationExplicitInterpAMD = static_cast<Decoration>(4999);
|
||||
|
||||
enum ShaderExplicitVertexParameterAMD {
|
||||
ShaderExplicitVertexParameterBadAMD = 0, // Don't use
|
||||
|
||||
InterpolateAtVertexAMD = 1,
|
||||
|
||||
ShaderExplicitVertexParameterCountAMD
|
||||
};
|
||||
|
||||
// SPV_AMD_gcn_shader
|
||||
static const char* const E_SPV_AMD_gcn_shader = "SPV_AMD_gcn_shader";
|
||||
|
||||
enum GcnShaderAMD {
|
||||
GcnShaderBadAMD = 0, // Don't use
|
||||
|
||||
CubeFaceIndexAMD = 1,
|
||||
CubeFaceCoordAMD = 2,
|
||||
TimeAMD = 3,
|
||||
|
||||
GcnShaderCountAMD
|
||||
};
|
||||
|
||||
#endif // #ifndef GLSLextAMD_H
|
@ -43,6 +43,9 @@
|
||||
#include "SpvBuilder.h"
|
||||
namespace spv {
|
||||
#include "GLSL.std.450.h"
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
// Glslang includes
|
||||
@ -147,9 +150,9 @@ protected:
|
||||
spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id destTypeId, spv::Id operand, glslang::TBasicType typeProxy);
|
||||
spv::Id makeSmearedConstant(spv::Id constant, int vectorSize);
|
||||
spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy);
|
||||
spv::Id createInvocationsOperation(glslang::TOperator, spv::Id typeId, spv::Id operand);
|
||||
spv::Id createInvocationsOperation(glslang::TOperator, spv::Id typeId, spv::Id operand, glslang::TBasicType typeProxy);
|
||||
spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy);
|
||||
spv::Id createNoArgOperation(glslang::TOperator op);
|
||||
spv::Id createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId);
|
||||
spv::Id getSymbolId(const glslang::TIntermSymbol* node);
|
||||
void addDecoration(spv::Id id, spv::Decoration dec);
|
||||
void addDecoration(spv::Id id, spv::Decoration dec, unsigned value);
|
||||
@ -160,6 +163,7 @@ protected:
|
||||
bool isTrivialLeaf(const glslang::TIntermTyped* node);
|
||||
bool isTrivial(const glslang::TIntermTyped* node);
|
||||
spv::Id createShortCircuit(glslang::TOperator, glslang::TIntermTyped& left, glslang::TIntermTyped& right);
|
||||
spv::Id getExtBuiltins(const char* name);
|
||||
|
||||
spv::Function* shaderEntry;
|
||||
spv::Instruction* entryPoint;
|
||||
@ -175,6 +179,7 @@ protected:
|
||||
std::set<spv::Id> iOSet; // all input/output variables from either static use or declaration of interface
|
||||
const glslang::TIntermediate* glslangIntermediate;
|
||||
spv::Id stdBuiltins;
|
||||
std::unordered_map<const char*, spv::Id> extBuiltinMap;
|
||||
|
||||
std::unordered_map<int, spv::Id> symbolValues;
|
||||
std::unordered_set<int> constReadOnlyParameters; // set of formal function parameters that have glslang qualifier constReadOnly, so we know they are not local function "const" that are write-once
|
||||
@ -371,6 +376,10 @@ spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qual
|
||||
return spv::DecorationNoPerspective;
|
||||
else if (qualifier.flat)
|
||||
return spv::DecorationFlat;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (qualifier.explicitInterp)
|
||||
return spv::DecorationExplicitInterpAMD;
|
||||
#endif
|
||||
else
|
||||
return spv::DecorationMax;
|
||||
}
|
||||
@ -508,6 +517,15 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
||||
// TODO: Add SPIR-V builtin ID.
|
||||
logger->missingFunctionality("shader ballot");
|
||||
return spv::BuiltInMax;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EbvBaryCoordNoPersp: return spv::BuiltInBaryCoordNoPerspAMD;
|
||||
case glslang::EbvBaryCoordNoPerspCentroid: return spv::BuiltInBaryCoordNoPerspCentroidAMD;
|
||||
case glslang::EbvBaryCoordNoPerspSample: return spv::BuiltInBaryCoordNoPerspSampleAMD;
|
||||
case glslang::EbvBaryCoordSmooth: return spv::BuiltInBaryCoordSmoothAMD;
|
||||
case glslang::EbvBaryCoordSmoothCentroid: return spv::BuiltInBaryCoordSmoothCentroidAMD;
|
||||
case glslang::EbvBaryCoordSmoothSample: return spv::BuiltInBaryCoordSmoothSampleAMD;
|
||||
case glslang::EbvBaryCoordPullModel: return spv::BuiltInBaryCoordPullModelAMD;
|
||||
#endif
|
||||
default: return spv::BuiltInMax;
|
||||
}
|
||||
}
|
||||
@ -628,6 +646,10 @@ void InheritQualifiers(glslang::TQualifier& child, const glslang::TQualifier& pa
|
||||
child.invariant = true;
|
||||
if (parent.nopersp)
|
||||
child.nopersp = true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (parent.explicitInterp)
|
||||
child.explicitInterp = true;
|
||||
#endif
|
||||
if (parent.flat)
|
||||
child.flat = true;
|
||||
if (parent.centroid)
|
||||
@ -1484,6 +1506,9 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
break;
|
||||
case glslang::EOpInterpolateAtSample:
|
||||
case glslang::EOpInterpolateAtOffset:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpInterpolateAtVertex:
|
||||
#endif
|
||||
if (arg == 0)
|
||||
lvalue = true;
|
||||
break;
|
||||
@ -1524,7 +1549,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
// Pass through to generic operations.
|
||||
switch (glslangOperands.size()) {
|
||||
case 0:
|
||||
result = createNoArgOperation(node->getOp());
|
||||
result = createNoArgOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()));
|
||||
break;
|
||||
case 1:
|
||||
result = createUnaryOperation(
|
||||
@ -3169,6 +3194,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec
|
||||
spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand, glslang::TBasicType typeProxy)
|
||||
{
|
||||
spv::Op unaryOp = spv::OpNop;
|
||||
int extBuiltins = -1;
|
||||
int libCall = -1;
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||
@ -3448,7 +3474,32 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
|
||||
case glslang::EOpAnyInvocation:
|
||||
case glslang::EOpAllInvocations:
|
||||
case glslang::EOpAllInvocationsEqual:
|
||||
return createInvocationsOperation(op, typeId, operand);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpMinInvocations:
|
||||
case glslang::EOpMaxInvocations:
|
||||
case glslang::EOpAddInvocations:
|
||||
case glslang::EOpMinInvocationsNonUniform:
|
||||
case glslang::EOpMaxInvocationsNonUniform:
|
||||
case glslang::EOpAddInvocationsNonUniform:
|
||||
#endif
|
||||
return createInvocationsOperation(op, typeId, operand, typeProxy);
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpMbcnt:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_ballot);
|
||||
libCall = spv::MbcntAMD;
|
||||
break;
|
||||
|
||||
case glslang::EOpCubeFaceIndex:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_gcn_shader);
|
||||
libCall = spv::CubeFaceIndexAMD;
|
||||
break;
|
||||
|
||||
case glslang::EOpCubeFaceCoord:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_gcn_shader);
|
||||
libCall = spv::CubeFaceCoordAMD;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return 0;
|
||||
@ -3458,7 +3509,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
|
||||
if (libCall >= 0) {
|
||||
std::vector<spv::Id> args;
|
||||
args.push_back(operand);
|
||||
id = builder.createBuiltinCall(typeId, stdBuiltins, libCall, args);
|
||||
id = builder.createBuiltinCall(typeId, extBuiltins >= 0 ? extBuiltins : stdBuiltins, libCall, args);
|
||||
} else {
|
||||
id = builder.createUnaryOp(unaryOp, typeId, operand);
|
||||
}
|
||||
@ -3765,12 +3816,20 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
||||
}
|
||||
|
||||
// Create group invocation operations.
|
||||
spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, spv::Id operand)
|
||||
spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, spv::Id operand, glslang::TBasicType typeProxy)
|
||||
{
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||
|
||||
builder.addCapability(spv::CapabilityGroups);
|
||||
|
||||
std::vector<spv::Id> operands;
|
||||
operands.push_back(builder.makeUintConstant(spv::ScopeSubgroup));
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (op == glslang::EOpMinInvocations || op == glslang::EOpMaxInvocations || op == glslang::EOpAddInvocations ||
|
||||
op == glslang::EOpMinInvocationsNonUniform || op == glslang::EOpMaxInvocationsNonUniform || op == glslang::EOpAddInvocationsNonUniform)
|
||||
operands.push_back(spv::GroupOperationReduce);
|
||||
#endif
|
||||
operands.push_back(operand);
|
||||
|
||||
switch (op) {
|
||||
@ -3786,6 +3845,74 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
|
||||
return builder.createBinOp(spv::OpLogicalOr, typeId, groupAll,
|
||||
builder.createUnaryOp(spv::OpLogicalNot, typeId, groupAny));
|
||||
}
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpMinInvocations:
|
||||
case glslang::EOpMaxInvocations:
|
||||
case glslang::EOpAddInvocations:
|
||||
{
|
||||
spv::Op spvOp = spv::OpNop;
|
||||
if (op == glslang::EOpMinInvocations) {
|
||||
if (isFloat)
|
||||
spvOp = spv::OpGroupFMin;
|
||||
else {
|
||||
if (isUnsigned)
|
||||
spvOp = spv::OpGroupUMin;
|
||||
else
|
||||
spvOp = spv::OpGroupSMin;
|
||||
}
|
||||
} else if (op == glslang::EOpMaxInvocations) {
|
||||
if (isFloat)
|
||||
spvOp = spv::OpGroupFMax;
|
||||
else {
|
||||
if (isUnsigned)
|
||||
spvOp = spv::OpGroupUMax;
|
||||
else
|
||||
spvOp = spv::OpGroupSMax;
|
||||
}
|
||||
} else {
|
||||
if (isFloat)
|
||||
spvOp = spv::OpGroupFAdd;
|
||||
else
|
||||
spvOp = spv::OpGroupIAdd;
|
||||
}
|
||||
|
||||
return builder.createOp(spvOp, typeId, operands);
|
||||
}
|
||||
case glslang::EOpMinInvocationsNonUniform:
|
||||
case glslang::EOpMaxInvocationsNonUniform:
|
||||
case glslang::EOpAddInvocationsNonUniform:
|
||||
{
|
||||
spv::Op spvOp = spv::OpNop;
|
||||
if (op == glslang::EOpMinInvocationsNonUniform) {
|
||||
if (isFloat)
|
||||
spvOp = spv::OpGroupFMinNonUniformAMD;
|
||||
else {
|
||||
if (isUnsigned)
|
||||
spvOp = spv::OpGroupUMinNonUniformAMD;
|
||||
else
|
||||
spvOp = spv::OpGroupSMinNonUniformAMD;
|
||||
}
|
||||
}
|
||||
else if (op == glslang::EOpMaxInvocationsNonUniform) {
|
||||
if (isFloat)
|
||||
spvOp = spv::OpGroupFMaxNonUniformAMD;
|
||||
else {
|
||||
if (isUnsigned)
|
||||
spvOp = spv::OpGroupUMaxNonUniformAMD;
|
||||
else
|
||||
spvOp = spv::OpGroupSMaxNonUniformAMD;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isFloat)
|
||||
spvOp = spv::OpGroupFAddNonUniformAMD;
|
||||
else
|
||||
spvOp = spv::OpGroupIAddNonUniformAMD;
|
||||
}
|
||||
|
||||
return builder.createOp(spvOp, typeId, operands);
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
logger->missingFunctionality("invocation operation");
|
||||
return spv::NoResult;
|
||||
@ -3798,6 +3925,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||
|
||||
spv::Op opCode = spv::OpNop;
|
||||
int extBuiltins = -1;
|
||||
int libCall = -1;
|
||||
size_t consumedOperands = operands.size();
|
||||
spv::Id typeId0 = 0;
|
||||
@ -3941,6 +4069,60 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
libCall = spv::GLSLstd450Bad;
|
||||
break;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpSwizzleInvocations:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_ballot);
|
||||
libCall = spv::SwizzleInvocationsAMD;
|
||||
break;
|
||||
case glslang::EOpSwizzleInvocationsMasked:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_ballot);
|
||||
libCall = spv::SwizzleInvocationsMaskedAMD;
|
||||
break;
|
||||
case glslang::EOpWriteInvocation:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_ballot);
|
||||
libCall = spv::WriteInvocationAMD;
|
||||
break;
|
||||
|
||||
case glslang::EOpMin3:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_trinary_minmax);
|
||||
if (isFloat)
|
||||
libCall = spv::FMin3AMD;
|
||||
else {
|
||||
if (isUnsigned)
|
||||
libCall = spv::UMin3AMD;
|
||||
else
|
||||
libCall = spv::SMin3AMD;
|
||||
}
|
||||
break;
|
||||
case glslang::EOpMax3:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_trinary_minmax);
|
||||
if (isFloat)
|
||||
libCall = spv::FMax3AMD;
|
||||
else {
|
||||
if (isUnsigned)
|
||||
libCall = spv::UMax3AMD;
|
||||
else
|
||||
libCall = spv::SMax3AMD;
|
||||
}
|
||||
break;
|
||||
case glslang::EOpMid3:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_trinary_minmax);
|
||||
if (isFloat)
|
||||
libCall = spv::FMid3AMD;
|
||||
else {
|
||||
if (isUnsigned)
|
||||
libCall = spv::UMid3AMD;
|
||||
else
|
||||
libCall = spv::SMid3AMD;
|
||||
}
|
||||
break;
|
||||
|
||||
case glslang::EOpInterpolateAtVertex:
|
||||
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_explicit_vertex_parameter);
|
||||
libCall = spv::InterpolateAtVertexAMD;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -3951,7 +4133,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
// Construct the call arguments, without modifying the original operands vector.
|
||||
// We might need the remaining arguments, e.g. in the EOpFrexp case.
|
||||
std::vector<spv::Id> callArguments(operands.begin(), operands.begin() + consumedOperands);
|
||||
id = builder.createBuiltinCall(typeId, stdBuiltins, libCall, callArguments);
|
||||
id = builder.createBuiltinCall(typeId, extBuiltins >= 0 ? extBuiltins : stdBuiltins, libCall, callArguments);
|
||||
} else {
|
||||
switch (consumedOperands) {
|
||||
case 0:
|
||||
@ -3997,8 +4179,8 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
return builder.setPrecision(id, precision);
|
||||
}
|
||||
|
||||
// Intrinsics with no arguments, no return value, and no precision.
|
||||
spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op)
|
||||
// Intrinsics with no arguments (or no return value, and no precision).
|
||||
spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId)
|
||||
{
|
||||
// TODO: get the barrier operands correct
|
||||
|
||||
@ -4045,6 +4227,14 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op)
|
||||
// Control barrier with non-"None" semantic is also a memory barrier.
|
||||
builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeWorkgroup, spv::MemorySemanticsWorkgroupMemoryMask);
|
||||
return 0;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpTime:
|
||||
{
|
||||
std::vector<spv::Id> args; // Dummy arguments
|
||||
spv::Id id = builder.createBuiltinCall(typeId, getExtBuiltins(spv::E_SPV_AMD_gcn_shader), spv::TimeAMD, args);
|
||||
return builder.setPrecision(id, precision);
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
logger->missingFunctionality("unknown operation with no arguments");
|
||||
return 0;
|
||||
@ -4437,6 +4627,20 @@ spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslan
|
||||
return builder.createOp(spv::OpPhi, boolTypeId, phiOperands);
|
||||
}
|
||||
|
||||
// Return type Id of the imported set of extended instructions corresponds to the name.
|
||||
// Import this set if it has not been imported yet.
|
||||
spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name)
|
||||
{
|
||||
if (extBuiltinMap.find(name) != extBuiltinMap.end())
|
||||
return extBuiltinMap[name];
|
||||
else {
|
||||
builder.addExtensions(name);
|
||||
spv::Id extBuiltins = builder.import(name);
|
||||
extBuiltinMap[name] = extBuiltins;
|
||||
return extBuiltins;
|
||||
}
|
||||
}
|
||||
|
||||
}; // end anonymous namespace
|
||||
|
||||
namespace glslang {
|
||||
|
@ -2312,7 +2312,11 @@ void Builder::dump(std::vector<unsigned int>& out) const
|
||||
capInst.dump(out);
|
||||
}
|
||||
|
||||
// TBD: OpExtension ...
|
||||
for (int e = 0; e < (int)extensions.size(); ++e) {
|
||||
Instruction extInst(0, 0, OpExtension);
|
||||
extInst.addStringOperand(extensions[e]);
|
||||
extInst.dump(out);
|
||||
}
|
||||
|
||||
dumpInstructions(out, imports);
|
||||
Instruction memInst(0, 0, OpMemoryModel);
|
||||
@ -2331,10 +2335,10 @@ void Builder::dump(std::vector<unsigned int>& out) const
|
||||
sourceInst.addImmediateOperand(sourceVersion);
|
||||
sourceInst.dump(out);
|
||||
}
|
||||
for (int e = 0; e < (int)extensions.size(); ++e) {
|
||||
Instruction extInst(0, 0, OpSourceExtension);
|
||||
extInst.addStringOperand(extensions[e]);
|
||||
extInst.dump(out);
|
||||
for (int e = 0; e < (int)sourceExtensions.size(); ++e) {
|
||||
Instruction sourceExtInst(0, 0, OpSourceExtension);
|
||||
sourceExtInst.addStringOperand(sourceExtensions[e]);
|
||||
sourceExtInst.dump(out);
|
||||
}
|
||||
dumpInstructions(out, names);
|
||||
dumpInstructions(out, lines);
|
||||
|
@ -70,7 +70,8 @@ public:
|
||||
source = lang;
|
||||
sourceVersion = version;
|
||||
}
|
||||
void addSourceExtension(const char* ext) { extensions.push_back(ext); }
|
||||
void addSourceExtension(const char* ext) { sourceExtensions.push_back(ext); }
|
||||
void addExtensions(const char* ext) { extensions.push_back(ext); }
|
||||
Id import(const char*);
|
||||
void setMemoryModel(spv::AddressingModel addr, spv::MemoryModel mem)
|
||||
{
|
||||
@ -552,6 +553,7 @@ public:
|
||||
SourceLanguage source;
|
||||
int sourceVersion;
|
||||
std::vector<const char*> extensions;
|
||||
std::vector<const char*> sourceExtensions;
|
||||
AddressingModel addressModel;
|
||||
MemoryModel memoryModel;
|
||||
std::set<spv::Capability> capabilities;
|
||||
|
@ -44,16 +44,25 @@
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
|
||||
namespace spv {
|
||||
// Include C-based headers that don't have a namespace
|
||||
#include "GLSL.std.450.h"
|
||||
}
|
||||
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
|
||||
|
||||
#include "disassemble.h"
|
||||
#include "doc.h"
|
||||
|
||||
namespace spv {
|
||||
extern "C" {
|
||||
// Include C-based headers that don't have a namespace
|
||||
#include "GLSL.std.450.h"
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
|
||||
|
||||
namespace spv {
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
|
||||
#endif
|
||||
|
||||
static void Kill(std::ostream& out, const char* message)
|
||||
{
|
||||
@ -64,6 +73,9 @@ static void Kill(std::ostream& out, const char* message)
|
||||
// used to identify the extended instruction library imported when printing
|
||||
enum ExtInstSet {
|
||||
GLSL450Inst,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
GLSLextAMDInst,
|
||||
#endif
|
||||
OpenCLExtInst,
|
||||
};
|
||||
|
||||
@ -446,14 +458,26 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
||||
--numOperands;
|
||||
if (opCode == OpExtInst) {
|
||||
ExtInstSet extInstSet = GLSL450Inst;
|
||||
if (0 == memcmp("OpenCL", (const char*)(idDescriptor[stream[word-2]].c_str()), 6)) {
|
||||
const char* name = idDescriptor[stream[word - 2]].c_str();
|
||||
if (0 == memcmp("OpenCL", name, 6)) {
|
||||
extInstSet = OpenCLExtInst;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} 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 ||
|
||||
strcmp(spv::E_SPV_AMD_gcn_shader, name) == 0) {
|
||||
extInstSet = GLSLextAMDInst;
|
||||
#endif
|
||||
}
|
||||
unsigned entrypoint = stream[word - 1];
|
||||
if (extInstSet == GLSL450Inst) {
|
||||
if (entrypoint < GLSLstd450Count) {
|
||||
out << "(" << GlslStd450DebugNames[entrypoint] << ")";
|
||||
}
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (extInstSet == GLSLextAMDInst) {
|
||||
out << "(" << GLSLextAMDGetDebugNames(name, entrypoint) << ")";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -561,6 +585,50 @@ static void GLSLstd450GetDebugNames(const char** names)
|
||||
names[GLSLstd450InterpolateAtOffset] = "InterpolateAtOffset";
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint)
|
||||
{
|
||||
if (strcmp(name, spv::E_SPV_AMD_shader_ballot) == 0) {
|
||||
switch (entrypoint) {
|
||||
case SwizzleInvocationsAMD: return "SwizzleInvocationsAMD";
|
||||
case SwizzleInvocationsMaskedAMD: return "SwizzleInvocationsMaskedAMD";
|
||||
case WriteInvocationAMD: return "WriteInvocationAMD";
|
||||
case MbcntAMD: return "MbcntAMD";
|
||||
default: return "Bad";
|
||||
}
|
||||
} else if (strcmp(name, spv::E_SPV_AMD_shader_trinary_minmax) == 0) {
|
||||
switch (entrypoint) {
|
||||
case FMin3AMD: return "FMin3AMD";
|
||||
case UMin3AMD: return "UMin3AMD";
|
||||
case SMin3AMD: return "SMin3AMD";
|
||||
case FMax3AMD: return "FMax3AMD";
|
||||
case UMax3AMD: return "UMax3AMD";
|
||||
case SMax3AMD: return "SMax3AMD";
|
||||
case FMid3AMD: return "FMid3AMD";
|
||||
case UMid3AMD: return "UMid3AMD";
|
||||
case SMid3AMD: return "SMid3AMD";
|
||||
default: return "Bad";
|
||||
}
|
||||
} else if (strcmp(name, spv::E_SPV_AMD_shader_explicit_vertex_parameter) == 0) {
|
||||
switch (entrypoint) {
|
||||
case InterpolateAtVertexAMD: return "InterpolateAtVertexAMD";
|
||||
default: return "Bad";
|
||||
}
|
||||
}
|
||||
else if (strcmp(name, spv::E_SPV_AMD_gcn_shader) == 0) {
|
||||
switch (entrypoint) {
|
||||
case CubeFaceIndexAMD: return "CubeFaceIndexAMD";
|
||||
case CubeFaceCoordAMD: return "CubeFaceCoordAMD";
|
||||
case TimeAMD: return "TimeAMD";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return "Bad";
|
||||
}
|
||||
#endif
|
||||
|
||||
void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
|
||||
{
|
||||
SpirvStream SpirvStream(out, stream);
|
||||
|
@ -45,6 +45,15 @@
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
namespace spv {
|
||||
extern "C" {
|
||||
// Include C-based headers that don't have a namespace
|
||||
#include "GLSL.ext.AMD.h"
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace spv {
|
||||
|
||||
//
|
||||
@ -243,6 +252,10 @@ const char* DecorationString(int decoration)
|
||||
|
||||
case DecorationCeiling:
|
||||
default: return "Bad";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case 4999: return "ExplicitInterpAMD";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,6 +311,16 @@ const char* BuiltInString(int builtIn)
|
||||
|
||||
case BuiltInCeiling:
|
||||
default: return "Bad";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case 4992: return "BaryCoordNoPerspAMD";
|
||||
case 4993: return "BaryCoordNoPerspCentroidAMD";
|
||||
case 4994: return "BaryCoordNoPerspSampleAMD";
|
||||
case 4995: return "BaryCoordSmoothAMD";
|
||||
case 4996: return "BaryCoordSmoothCentroidAMD";
|
||||
case 4997: return "BaryCoordSmoothSampleAMD";
|
||||
case 4998: return "BaryCoordPullModelAMD";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1107,12 +1130,27 @@ const char* OpcodeString(int op)
|
||||
case OpcodeCeiling:
|
||||
default:
|
||||
return "Bad";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case 5000: return "OpGroupIAddNonUniformAMD";
|
||||
case 5001: return "OpGroupFAddNonUniformAMD";
|
||||
case 5002: return "OpGroupFMinNonUniformAMD";
|
||||
case 5003: return "OpGroupUMinNonUniformAMD";
|
||||
case 5004: return "OpGroupSMinNonUniformAMD";
|
||||
case 5005: return "OpGroupFMaxNonUniformAMD";
|
||||
case 5006: return "OpGroupUMaxNonUniformAMD";
|
||||
case 5007: return "OpGroupSMaxNonUniformAMD";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// The set of objects that hold all the instruction/operand
|
||||
// parameterization information.
|
||||
#ifdef AMD_EXTENSIONS
|
||||
InstructionParameters InstructionDesc[OpCodeMask + 1];
|
||||
#else
|
||||
InstructionParameters InstructionDesc[OpcodeCeiling];
|
||||
#endif
|
||||
OperandParameters ExecutionModeOperands[ExecutionModeCeiling];
|
||||
OperandParameters DecorationOperands[DecorationCeiling];
|
||||
|
||||
@ -2703,6 +2741,48 @@ void Parameterize()
|
||||
InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Num Events'");
|
||||
InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Wait Events'");
|
||||
InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Ret Event'");
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].capabilities.push_back(CapabilityGroups);
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'");
|
||||
|
||||
InstructionDesc[OpGroupFAddNonUniformAMD].capabilities.push_back(CapabilityGroups);
|
||||
InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandId, "'X'");
|
||||
|
||||
InstructionDesc[OpGroupUMinNonUniformAMD].capabilities.push_back(CapabilityGroups);
|
||||
InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandId, "'X'");
|
||||
|
||||
InstructionDesc[OpGroupSMinNonUniformAMD].capabilities.push_back(CapabilityGroups);
|
||||
InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandId, "X");
|
||||
|
||||
InstructionDesc[OpGroupFMinNonUniformAMD].capabilities.push_back(CapabilityGroups);
|
||||
InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandId, "X");
|
||||
|
||||
InstructionDesc[OpGroupUMaxNonUniformAMD].capabilities.push_back(CapabilityGroups);
|
||||
InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandId, "X");
|
||||
|
||||
InstructionDesc[OpGroupSMaxNonUniformAMD].capabilities.push_back(CapabilityGroups);
|
||||
InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandId, "X");
|
||||
|
||||
InstructionDesc[OpGroupFMaxNonUniformAMD].capabilities.push_back(CapabilityGroups);
|
||||
InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandId, "X");
|
||||
#endif
|
||||
}
|
||||
|
||||
}; // end spv namespace
|
||||
|
@ -186,6 +186,15 @@ enum TBuiltInVariable {
|
||||
EbvSamplePosition,
|
||||
EbvSampleMask,
|
||||
EbvHelperInvocation,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EbvBaryCoordNoPersp,
|
||||
EbvBaryCoordNoPerspCentroid,
|
||||
EbvBaryCoordNoPerspSample,
|
||||
EbvBaryCoordSmooth,
|
||||
EbvBaryCoordSmoothCentroid,
|
||||
EbvBaryCoordSmoothSample,
|
||||
EbvBaryCoordPullModel,
|
||||
#endif
|
||||
|
||||
EbvLast
|
||||
};
|
||||
@ -286,6 +295,15 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
||||
case EbvSamplePosition: return "SamplePosition";
|
||||
case EbvSampleMask: return "SampleMaskIn";
|
||||
case EbvHelperInvocation: return "HelperInvocation";
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbvBaryCoordNoPersp: return "BaryCoordNoPersp";
|
||||
case EbvBaryCoordNoPerspCentroid: return "BaryCoordNoPerspCentroid";
|
||||
case EbvBaryCoordNoPerspSample: return "BaryCoordNoPerspSample";
|
||||
case EbvBaryCoordSmooth: return "BaryCoordSmooth";
|
||||
case EbvBaryCoordSmoothCentroid: return "BaryCoordSmoothCentroid";
|
||||
case EbvBaryCoordSmoothSample: return "BaryCoordSmoothSample";
|
||||
case EbvBaryCoordPullModel: return "BaryCoordPullModel";
|
||||
#endif
|
||||
default: return "unknown built-in variable";
|
||||
}
|
||||
}
|
||||
|
@ -405,6 +405,9 @@ public:
|
||||
smooth = false;
|
||||
flat = false;
|
||||
nopersp = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
explicitInterp = false;
|
||||
#endif
|
||||
patch = false;
|
||||
sample = false;
|
||||
coherent = false;
|
||||
@ -438,6 +441,9 @@ public:
|
||||
bool smooth : 1;
|
||||
bool flat : 1;
|
||||
bool nopersp : 1;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool explicitInterp : 1;
|
||||
#endif
|
||||
bool patch : 1;
|
||||
bool sample : 1;
|
||||
bool coherent : 1;
|
||||
@ -453,7 +459,11 @@ public:
|
||||
}
|
||||
bool isInterpolation() const
|
||||
{
|
||||
#ifdef AMD_EXTENSIONS
|
||||
return flat || smooth || nopersp || explicitInterp;
|
||||
#else
|
||||
return flat || smooth || nopersp;
|
||||
#endif
|
||||
}
|
||||
bool isAuxiliary() const
|
||||
{
|
||||
@ -1518,6 +1528,10 @@ public:
|
||||
p += snprintf(p, end - p, "flat ");
|
||||
if (qualifier.nopersp)
|
||||
p += snprintf(p, end - p, "noperspective ");
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (qualifier.explicitInterp)
|
||||
p += snprintf(p, end - p, "__explicitInterpAMD ");
|
||||
#endif
|
||||
if (qualifier.patch)
|
||||
p += snprintf(p, end - p, "patch ");
|
||||
if (qualifier.sample)
|
||||
|
@ -246,6 +246,12 @@ enum TOperator {
|
||||
EOpReflect,
|
||||
EOpRefract,
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpMin3,
|
||||
EOpMax3,
|
||||
EOpMid3,
|
||||
#endif
|
||||
|
||||
EOpDPdx, // Fragment only
|
||||
EOpDPdy, // Fragment only
|
||||
EOpFwidth, // Fragment only
|
||||
@ -260,6 +266,10 @@ enum TOperator {
|
||||
EOpInterpolateAtSample, // Fragment only
|
||||
EOpInterpolateAtOffset, // Fragment only
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpInterpolateAtVertex,
|
||||
#endif
|
||||
|
||||
EOpMatrixTimesMatrix,
|
||||
EOpOuterProduct,
|
||||
EOpDeterminant,
|
||||
@ -291,6 +301,23 @@ enum TOperator {
|
||||
EOpAllInvocations,
|
||||
EOpAllInvocationsEqual,
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpMinInvocations,
|
||||
EOpMaxInvocations,
|
||||
EOpAddInvocations,
|
||||
EOpMinInvocationsNonUniform,
|
||||
EOpMaxInvocationsNonUniform,
|
||||
EOpAddInvocationsNonUniform,
|
||||
EOpSwizzleInvocations,
|
||||
EOpSwizzleInvocationsMasked,
|
||||
EOpWriteInvocation,
|
||||
EOpMbcnt,
|
||||
|
||||
EOpCubeFaceIndex,
|
||||
EOpCubeFaceCoord,
|
||||
EOpTime,
|
||||
#endif
|
||||
|
||||
EOpAtomicAdd,
|
||||
EOpAtomicMin,
|
||||
EOpAtomicMax,
|
||||
|
@ -801,10 +801,85 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"bvec3 notEqual(u64vec3, u64vec3);"
|
||||
"bvec4 notEqual(u64vec4, u64vec4);"
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
"int findLSB(int64_t);"
|
||||
"ivec2 findLSB(i64vec2);"
|
||||
"ivec3 findLSB(i64vec3);"
|
||||
"ivec4 findLSB(i64vec4);"
|
||||
|
||||
"int findLSB(uint64_t);"
|
||||
"ivec2 findLSB(u64vec2);"
|
||||
"ivec3 findLSB(u64vec3);"
|
||||
"ivec4 findLSB(u64vec4);"
|
||||
|
||||
"int findMSB(int64_t);"
|
||||
"ivec2 findMSB(i64vec2);"
|
||||
"ivec3 findMSB(i64vec3);"
|
||||
"ivec4 findMSB(i64vec4);"
|
||||
|
||||
"int findMSB(uint64_t);"
|
||||
"ivec2 findMSB(u64vec2);"
|
||||
"ivec3 findMSB(u64vec3);"
|
||||
"ivec4 findMSB(u64vec4);"
|
||||
#endif
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// GL_AMD_shader_trinary_minmax
|
||||
if (profile != EEsProfile && version >= 430) {
|
||||
commonBuiltins.append(
|
||||
"float min3(float, float, float);"
|
||||
"vec2 min3(vec2, vec2, vec2);"
|
||||
"vec3 min3(vec3, vec3, vec3);"
|
||||
"vec4 min3(vec4, vec4, vec4);"
|
||||
|
||||
"int min3(int, int, int);"
|
||||
"ivec2 min3(ivec2, ivec2, ivec2);"
|
||||
"ivec3 min3(ivec3, ivec3, ivec3);"
|
||||
"ivec4 min3(ivec4, ivec4, ivec4);"
|
||||
|
||||
"uint min3(uint, uint, uint);"
|
||||
"uvec2 min3(uvec2, uvec2, uvec2);"
|
||||
"uvec3 min3(uvec3, uvec3, uvec3);"
|
||||
"uvec4 min3(uvec4, uvec4, uvec4);"
|
||||
|
||||
"float max3(float, float, float);"
|
||||
"vec2 max3(vec2, vec2, vec2);"
|
||||
"vec3 max3(vec3, vec3, vec3);"
|
||||
"vec4 max3(vec4, vec4, vec4);"
|
||||
|
||||
"int max3(int, int, int);"
|
||||
"ivec2 max3(ivec2, ivec2, ivec2);"
|
||||
"ivec3 max3(ivec3, ivec3, ivec3);"
|
||||
"ivec4 max3(ivec4, ivec4, ivec4);"
|
||||
|
||||
"uint max3(uint, uint, uint);"
|
||||
"uvec2 max3(uvec2, uvec2, uvec2);"
|
||||
"uvec3 max3(uvec3, uvec3, uvec3);"
|
||||
"uvec4 max3(uvec4, uvec4, uvec4);"
|
||||
|
||||
"float mid3(float, float, float);"
|
||||
"vec2 mid3(vec2, vec2, vec2);"
|
||||
"vec3 mid3(vec3, vec3, vec3);"
|
||||
"vec4 mid3(vec4, vec4, vec4);"
|
||||
|
||||
"int mid3(int, int, int);"
|
||||
"ivec2 mid3(ivec2, ivec2, ivec2);"
|
||||
"ivec3 mid3(ivec3, ivec3, ivec3);"
|
||||
"ivec4 mid3(ivec4, ivec4, ivec4);"
|
||||
|
||||
"uint mid3(uint, uint, uint);"
|
||||
"uvec2 mid3(uvec2, uvec2, uvec2);"
|
||||
"uvec3 mid3(uvec3, uvec3, uvec3);"
|
||||
"uvec4 mid3(uvec4, uvec4, uvec4);"
|
||||
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((profile == EEsProfile && version >= 310) ||
|
||||
(profile != EEsProfile && version >= 430)) {
|
||||
commonBuiltins.append(
|
||||
@ -1468,6 +1543,161 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"\n");
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// GL_AMD_shader_ballot
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
commonBuiltins.append(
|
||||
"float minInvocationsAMD(float);"
|
||||
"vec2 minInvocationsAMD(vec2);"
|
||||
"vec3 minInvocationsAMD(vec3);"
|
||||
"vec4 minInvocationsAMD(vec4);"
|
||||
|
||||
"int minInvocationsAMD(int);"
|
||||
"ivec2 minInvocationsAMD(ivec2);"
|
||||
"ivec3 minInvocationsAMD(ivec3);"
|
||||
"ivec4 minInvocationsAMD(ivec4);"
|
||||
|
||||
"uint minInvocationsAMD(uint);"
|
||||
"uvec2 minInvocationsAMD(uvec2);"
|
||||
"uvec3 minInvocationsAMD(uvec3);"
|
||||
"uvec4 minInvocationsAMD(uvec4);"
|
||||
|
||||
"float maxInvocationsAMD(float);"
|
||||
"vec2 maxInvocationsAMD(vec2);"
|
||||
"vec3 maxInvocationsAMD(vec3);"
|
||||
"vec4 maxInvocationsAMD(vec4);"
|
||||
|
||||
"int maxInvocationsAMD(int);"
|
||||
"ivec2 maxInvocationsAMD(ivec2);"
|
||||
"ivec3 maxInvocationsAMD(ivec3);"
|
||||
"ivec4 maxInvocationsAMD(ivec4);"
|
||||
|
||||
"uint maxInvocationsAMD(uint);"
|
||||
"uvec2 maxInvocationsAMD(uvec2);"
|
||||
"uvec3 maxInvocationsAMD(uvec3);"
|
||||
"uvec4 maxInvocationsAMD(uvec4);"
|
||||
|
||||
"float addInvocationsAMD(float);"
|
||||
"vec2 addInvocationsAMD(vec2);"
|
||||
"vec3 addInvocationsAMD(vec3);"
|
||||
"vec4 addInvocationsAMD(vec4);"
|
||||
|
||||
"int addInvocationsAMD(int);"
|
||||
"ivec2 addInvocationsAMD(ivec2);"
|
||||
"ivec3 addInvocationsAMD(ivec3);"
|
||||
"ivec4 addInvocationsAMD(ivec4);"
|
||||
|
||||
"uint addInvocationsAMD(uint);"
|
||||
"uvec2 addInvocationsAMD(uvec2);"
|
||||
"uvec3 addInvocationsAMD(uvec3);"
|
||||
"uvec4 addInvocationsAMD(uvec4);"
|
||||
|
||||
"float minInvocationsNonUniformAMD(float);"
|
||||
"vec2 minInvocationsNonUniformAMD(vec2);"
|
||||
"vec3 minInvocationsNonUniformAMD(vec3);"
|
||||
"vec4 minInvocationsNonUniformAMD(vec4);"
|
||||
|
||||
"int minInvocationsNonUniformAMD(int);"
|
||||
"ivec2 minInvocationsNonUniformAMD(ivec2);"
|
||||
"ivec3 minInvocationsNonUniformAMD(ivec3);"
|
||||
"ivec4 minInvocationsNonUniformAMD(ivec4);"
|
||||
|
||||
"uint minInvocationsNonUniformAMD(uint);"
|
||||
"uvec2 minInvocationsNonUniformAMD(uvec2);"
|
||||
"uvec3 minInvocationsNonUniformAMD(uvec3);"
|
||||
"uvec4 minInvocationsNonUniformAMD(uvec4);"
|
||||
|
||||
"float maxInvocationsNonUniformAMD(float);"
|
||||
"vec2 maxInvocationsNonUniformAMD(vec2);"
|
||||
"vec3 maxInvocationsNonUniformAMD(vec3);"
|
||||
"vec4 maxInvocationsNonUniformAMD(vec4);"
|
||||
|
||||
"int maxInvocationsNonUniformAMD(int);"
|
||||
"ivec2 maxInvocationsNonUniformAMD(ivec2);"
|
||||
"ivec3 maxInvocationsNonUniformAMD(ivec3);"
|
||||
"ivec4 maxInvocationsNonUniformAMD(ivec4);"
|
||||
|
||||
"uint maxInvocationsNonUniformAMD(uint);"
|
||||
"uvec2 maxInvocationsNonUniformAMD(uvec2);"
|
||||
"uvec3 maxInvocationsNonUniformAMD(uvec3);"
|
||||
"uvec4 maxInvocationsNonUniformAMD(uvec4);"
|
||||
|
||||
"float addInvocationsNonUniformAMD(float);"
|
||||
"vec2 addInvocationsNonUniformAMD(vec2);"
|
||||
"vec3 addInvocationsNonUniformAMD(vec3);"
|
||||
"vec4 addInvocationsNonUniformAMD(vec4);"
|
||||
|
||||
"int addInvocationsNonUniformAMD(int);"
|
||||
"ivec2 addInvocationsNonUniformAMD(ivec2);"
|
||||
"ivec3 addInvocationsNonUniformAMD(ivec3);"
|
||||
"ivec4 addInvocationsNonUniformAMD(ivec4);"
|
||||
|
||||
"uint addInvocationsNonUniformAMD(uint);"
|
||||
"uvec2 addInvocationsNonUniformAMD(uvec2);"
|
||||
"uvec3 addInvocationsNonUniformAMD(uvec3);"
|
||||
"uvec4 addInvocationsNonUniformAMD(uvec4);"
|
||||
|
||||
"float swizzleInvocationsAMD(float, uvec4);"
|
||||
"vec2 swizzleInvocationsAMD(vec2, uvec4);"
|
||||
"vec3 swizzleInvocationsAMD(vec3, uvec4);"
|
||||
"vec4 swizzleInvocationsAMD(vec4, uvec4);"
|
||||
|
||||
"int swizzleInvocationsAMD(int, uvec4);"
|
||||
"ivec2 swizzleInvocationsAMD(ivec2, uvec4);"
|
||||
"ivec3 swizzleInvocationsAMD(ivec3, uvec4);"
|
||||
"ivec4 swizzleInvocationsAMD(ivec4, uvec4);"
|
||||
|
||||
"uint swizzleInvocationsAMD(uint, uvec4);"
|
||||
"uvec2 swizzleInvocationsAMD(uvec2, uvec4);"
|
||||
"uvec3 swizzleInvocationsAMD(uvec3, uvec4);"
|
||||
"uvec4 swizzleInvocationsAMD(uvec4, uvec4);"
|
||||
|
||||
"float swizzleInvocationsMaskedAMD(float, uvec3);"
|
||||
"vec2 swizzleInvocationsMaskedAMD(vec2, uvec3);"
|
||||
"vec3 swizzleInvocationsMaskedAMD(vec3, uvec3);"
|
||||
"vec4 swizzleInvocationsMaskedAMD(vec4, uvec3);"
|
||||
|
||||
"int swizzleInvocationsMaskedAMD(int, uvec3);"
|
||||
"ivec2 swizzleInvocationsMaskedAMD(ivec2, uvec3);"
|
||||
"ivec3 swizzleInvocationsMaskedAMD(ivec3, uvec3);"
|
||||
"ivec4 swizzleInvocationsMaskedAMD(ivec4, uvec3);"
|
||||
|
||||
"uint swizzleInvocationsMaskedAMD(uint, uvec3);"
|
||||
"uvec2 swizzleInvocationsMaskedAMD(uvec2, uvec3);"
|
||||
"uvec3 swizzleInvocationsMaskedAMD(uvec3, uvec3);"
|
||||
"uvec4 swizzleInvocationsMaskedAMD(uvec4, uvec3);"
|
||||
|
||||
"float writeInvocationAMD(float, float, uint);"
|
||||
"vec2 writeInvocationAMD(vec2, vec2, uint);"
|
||||
"vec3 writeInvocationAMD(vec3, vec3, uint);"
|
||||
"vec4 writeInvocationAMD(vec4, vec4, uint);"
|
||||
|
||||
"int writeInvocationAMD(int, int, uint);"
|
||||
"ivec2 writeInvocationAMD(ivec2, ivec2, uint);"
|
||||
"ivec3 writeInvocationAMD(ivec3, ivec3, uint);"
|
||||
"ivec4 writeInvocationAMD(ivec4, ivec4, uint);"
|
||||
|
||||
"uint writeInvocationAMD(uint, uint, uint);"
|
||||
"uvec2 writeInvocationAMD(uvec2, uvec2, uint);"
|
||||
"uvec3 writeInvocationAMD(uvec3, uvec3, uint);"
|
||||
"uvec4 writeInvocationAMD(uvec4, uvec4, uint);"
|
||||
|
||||
"uint mbcntAMD(uint64_t);"
|
||||
|
||||
"\n");
|
||||
}
|
||||
|
||||
// GL_AMD_gcn_shader
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
commonBuiltins.append(
|
||||
"float cubeFaceIndexAMD(vec3);"
|
||||
"vec2 cubeFaceCoordAMD(vec3);"
|
||||
"uint64_t timeAMD();"
|
||||
|
||||
"\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// Prototypes for built-in functions seen by vertex shaders only.
|
||||
@ -1713,6 +1943,29 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"\n");
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// GL_AMD_shader_explicit_vertex_parameter
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"float interpolateAtVertexAMD(float, uint);"
|
||||
"vec2 interpolateAtVertexAMD(vec2, uint);"
|
||||
"vec3 interpolateAtVertexAMD(vec3, uint);"
|
||||
"vec4 interpolateAtVertexAMD(vec4, uint);"
|
||||
|
||||
"int interpolateAtVertexAMD(int, uint);"
|
||||
"ivec2 interpolateAtVertexAMD(ivec2, uint);"
|
||||
"ivec3 interpolateAtVertexAMD(ivec3, uint);"
|
||||
"ivec4 interpolateAtVertexAMD(ivec4, uint);"
|
||||
|
||||
"uint interpolateAtVertexAMD(uint, uint);"
|
||||
"uvec2 interpolateAtVertexAMD(uvec2, uint);"
|
||||
"uvec3 interpolateAtVertexAMD(uvec3, uint);"
|
||||
"uvec4 interpolateAtVertexAMD(uvec4, uint);"
|
||||
|
||||
"\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// Standard Uniforms
|
||||
@ -2332,6 +2585,19 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"in float gl_CullDistance[];"
|
||||
"bool gl_HelperInvocation;" // needs qualifier fixed later
|
||||
);
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (version >= 450)
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"in vec2 gl_BaryCoordNoPerspAMD;"
|
||||
"in vec2 gl_BaryCoordNoPerspCentroidAMD;"
|
||||
"in vec2 gl_BaryCoordNoPerspSampleAMD;"
|
||||
"in vec2 gl_BaryCoordSmoothAMD;"
|
||||
"in vec2 gl_BaryCoordSmoothCentroidAMD;"
|
||||
"in vec2 gl_BaryCoordSmoothSampleAMD;"
|
||||
"in vec3 gl_BaryCoordPullModelAMD;"
|
||||
);
|
||||
#endif
|
||||
} else {
|
||||
// ES profile
|
||||
|
||||
@ -3460,6 +3726,14 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
||||
s.append(builtInConstant);
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// GL_AMD_gcn_shader
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
snprintf(builtInConstant, maxSize, "const int gl_SIMDGroupSizeAMD = 64;");
|
||||
s.append(builtInConstant);
|
||||
}
|
||||
#endif
|
||||
|
||||
s.append("\n");
|
||||
}
|
||||
|
||||
@ -3588,6 +3862,33 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setFunctionExtensions("allInvocationsEqualARB", 1, &E_GL_ARB_shader_group_vote);
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (profile != EEsProfile) {
|
||||
symbolTable.setFunctionExtensions("minInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("maxInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("addInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("minInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("maxInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("addInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("swizzleInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("swizzleInvocationsWithPatternAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("writeInvocationAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
symbolTable.setFunctionExtensions("mbcntAMD", 1, &E_GL_AMD_shader_ballot);
|
||||
}
|
||||
|
||||
if (profile != EEsProfile) {
|
||||
symbolTable.setFunctionExtensions("min3", 1, &E_GL_AMD_shader_trinary_minmax);
|
||||
symbolTable.setFunctionExtensions("max3", 1, &E_GL_AMD_shader_trinary_minmax);
|
||||
symbolTable.setFunctionExtensions("mid3", 1, &E_GL_AMD_shader_trinary_minmax);
|
||||
}
|
||||
|
||||
if (profile != EEsProfile) {
|
||||
symbolTable.setFunctionExtensions("cubeFaceIndexAMD", 1, &E_GL_AMD_gcn_shader);
|
||||
symbolTable.setFunctionExtensions("cubeFaceCoordAMD", 1, &E_GL_AMD_gcn_shader);
|
||||
symbolTable.setFunctionExtensions("timeAMD", 1, &E_GL_AMD_gcn_shader);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Compatibility variables, vertex only
|
||||
if (spvVersion.spv == 0) {
|
||||
BuiltInVariable("gl_Color", EbvColor, symbolTable);
|
||||
@ -3872,6 +4173,29 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setFunctionExtensions("textureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// E_GL_AMD_shader_explicit_vertex_parameter
|
||||
if (profile != EEsProfile) {
|
||||
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
|
||||
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspCentroidAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
|
||||
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspSampleAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
|
||||
symbolTable.setVariableExtensions("gl_BaryCoordSmoothAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
|
||||
symbolTable.setVariableExtensions("gl_BaryCoordSmoothCentroidAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
|
||||
symbolTable.setVariableExtensions("gl_BaryCoordSmoothSampleAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
|
||||
symbolTable.setVariableExtensions("gl_BaryCoordPullModelAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
|
||||
|
||||
symbolTable.setFunctionExtensions("interpolateAtVertexAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
|
||||
|
||||
BuiltInVariable("gl_BaryCoordNoPerspAMD", EbvBaryCoordNoPersp, symbolTable);
|
||||
BuiltInVariable("gl_BaryCoordNoPerspCentroidAMD", EbvBaryCoordNoPerspCentroid, symbolTable);
|
||||
BuiltInVariable("gl_BaryCoordNoPerspSampleAMD", EbvBaryCoordNoPerspSample, symbolTable);
|
||||
BuiltInVariable("gl_BaryCoordSmoothAMD", EbvBaryCoordSmooth, symbolTable);
|
||||
BuiltInVariable("gl_BaryCoordSmoothCentroidAMD", EbvBaryCoordSmoothCentroid, symbolTable);
|
||||
BuiltInVariable("gl_BaryCoordSmoothSampleAMD", EbvBaryCoordSmoothSample, symbolTable);
|
||||
BuiltInVariable("gl_BaryCoordPullModelAMD", EbvBaryCoordPullModel, symbolTable);
|
||||
}
|
||||
#endif
|
||||
|
||||
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);
|
||||
|
||||
if (profile == EEsProfile) {
|
||||
@ -4205,6 +4529,27 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.relateToOperator("anyInvocationARB", EOpAnyInvocation);
|
||||
symbolTable.relateToOperator("allInvocationsARB", EOpAllInvocations);
|
||||
symbolTable.relateToOperator("allInvocationsEqualARB", EOpAllInvocationsEqual);
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
symbolTable.relateToOperator("minInvocationsAMD", EOpMinInvocations);
|
||||
symbolTable.relateToOperator("maxInvocationsAMD", EOpMaxInvocations);
|
||||
symbolTable.relateToOperator("addInvocationsAMD", EOpAddInvocations);
|
||||
symbolTable.relateToOperator("minInvocationsNonUniformAMD", EOpMinInvocationsNonUniform);
|
||||
symbolTable.relateToOperator("maxInvocationsNonUniformAMD", EOpMaxInvocationsNonUniform);
|
||||
symbolTable.relateToOperator("addInvocationsNonUniformAMD", EOpAddInvocationsNonUniform);
|
||||
symbolTable.relateToOperator("swizzleInvocationsAMD", EOpSwizzleInvocations);
|
||||
symbolTable.relateToOperator("swizzleInvocationsMaskedAMD", EOpSwizzleInvocationsMasked);
|
||||
symbolTable.relateToOperator("writeInvocationAMD", EOpWriteInvocation);
|
||||
symbolTable.relateToOperator("mbcntAMD", EOpMbcnt);
|
||||
|
||||
symbolTable.relateToOperator("min3", EOpMin3);
|
||||
symbolTable.relateToOperator("max3", EOpMax3);
|
||||
symbolTable.relateToOperator("mid3", EOpMid3);
|
||||
|
||||
symbolTable.relateToOperator("cubeFaceIndexAMD", EOpCubeFaceIndex);
|
||||
symbolTable.relateToOperator("cubeFaceCoordAMD", EOpCubeFaceCoord);
|
||||
symbolTable.relateToOperator("timeAMD", EOpTime);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -4238,7 +4583,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid);
|
||||
symbolTable.relateToOperator("interpolateAtSample", EOpInterpolateAtSample);
|
||||
symbolTable.relateToOperator("interpolateAtOffset", EOpInterpolateAtOffset);
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (profile != EEsProfile)
|
||||
symbolTable.relateToOperator("interpolateAtVertexAMD", EOpInterpolateAtVertex);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EShLangCompute:
|
||||
symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
|
||||
|
@ -2119,6 +2119,10 @@ void TParseContext::rValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
|
||||
TIntermSymbol* symNode = node->getAsSymbolNode();
|
||||
if (symNode && symNode->getQualifier().writeonly)
|
||||
error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (symNode && symNode->getQualifier().explicitInterp)
|
||||
error(loc, "can't read from explicitly-interpolated object: ", op, symNode->getName().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@ -2665,7 +2669,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
|
||||
publicType.basicType == EbtDouble)
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output");
|
||||
|
||||
if (! qualifier.flat) {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (! qualifier.flat && ! qualifier.explicitInterp) {
|
||||
#else
|
||||
if (!qualifier.flat) {
|
||||
#endif
|
||||
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint ||
|
||||
publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 ||
|
||||
publicType.basicType == EbtDouble ||
|
||||
@ -2802,7 +2810,11 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
|
||||
|
||||
// Multiple interpolation qualifiers (mostly done later by 'individual qualifiers')
|
||||
if (src.isInterpolation() && dst.isInterpolation())
|
||||
#ifdef AMD_EXTENSIONS
|
||||
error(loc, "can only have one interpolation qualifier (flat, smooth, noperspective, __explicitInterpAMD)", "", "");
|
||||
#else
|
||||
error(loc, "can only have one interpolation qualifier (flat, smooth, noperspective)", "", "");
|
||||
#endif
|
||||
|
||||
// Ordering
|
||||
if (! force && ((profile != EEsProfile && version < 420) ||
|
||||
@ -2858,6 +2870,9 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
|
||||
MERGE_SINGLETON(smooth);
|
||||
MERGE_SINGLETON(flat);
|
||||
MERGE_SINGLETON(nopersp);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
MERGE_SINGLETON(explicitInterp);
|
||||
#endif
|
||||
MERGE_SINGLETON(patch);
|
||||
MERGE_SINGLETON(sample);
|
||||
MERGE_SINGLETON(coherent);
|
||||
|
@ -553,6 +553,9 @@ void TScanContext::fillInKeywordMap()
|
||||
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
|
||||
(*KeywordMap)["smooth"] = SMOOTH;
|
||||
(*KeywordMap)["flat"] = FLAT;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
(*KeywordMap)["__explicitInterpAMD"] = __EXPLICITINTERPAMD;
|
||||
#endif
|
||||
(*KeywordMap)["centroid"] = CENTROID;
|
||||
(*KeywordMap)["precise"] = PRECISE;
|
||||
(*KeywordMap)["invariant"] = INVARIANT;
|
||||
@ -1117,6 +1120,14 @@ int TScanContext::tokenizeIdentifier()
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case __EXPLICITINTERPAMD:
|
||||
if (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
||||
parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
case FLAT:
|
||||
if (parseContext.profile == EEsProfile && parseContext.version < 300)
|
||||
reservedWord();
|
||||
|
@ -187,6 +187,13 @@ void TParseVersions::initializeExtensionBehavior()
|
||||
extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable;
|
||||
extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
extensionBehavior[E_GL_AMD_shader_ballot] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_shader_trinary_minmax] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_shader_explicit_vertex_parameter] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_gcn_shader] = EBhDisable;
|
||||
#endif
|
||||
|
||||
// AEP
|
||||
extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable;
|
||||
extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisable;
|
||||
@ -286,6 +293,13 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||
"#define GL_ARB_sparse_texture_clamp 1\n"
|
||||
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
|
||||
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
"#define GL_AMD_shader_ballot 1\n"
|
||||
"#define GL_AMD_shader_trinary_minmax 1\n"
|
||||
"#define GL_AMD_shader_explicit_vertex_parameter 1\n"
|
||||
"#define GL_AMD_gcn_shader 1\n"
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,13 @@ const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_sha
|
||||
const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive";
|
||||
const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
const char* const E_GL_AMD_shader_ballot = "GL_AMD_shader_ballot";
|
||||
const char* const E_GL_AMD_shader_trinary_minmax = "GL_AMD_shader_trinary_minmax";
|
||||
const char* const E_GL_AMD_shader_explicit_vertex_parameter = "GL_AMD_shader_explicit_vertex_parameter";
|
||||
const char* const E_GL_AMD_gcn_shader = "GL_AMD_gcn_shader";
|
||||
#endif
|
||||
|
||||
// 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";
|
||||
|
@ -126,7 +126,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
||||
%token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED
|
||||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY
|
||||
%token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
|
||||
%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT
|
||||
%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT __EXPLICITINTERPAMD
|
||||
|
||||
%token <lex> MAT2X2 MAT2X3 MAT2X4
|
||||
%token <lex> MAT3X2 MAT3X3 MAT3X4
|
||||
@ -1050,6 +1050,15 @@ interpolation_qualifier
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.nopersp = true;
|
||||
}
|
||||
| __EXPLICITINTERPAMD {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.globalCheck($1.loc, "__explicitInterpAMD");
|
||||
parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
|
||||
parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.explicitInterp = true;
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
||||
layout_qualifier
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,19 +1,19 @@
|
||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
/* A Bison parser, made by GNU Bison 2.7. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
@ -26,13 +26,13 @@
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
#endif
|
||||
@ -40,287 +40,289 @@
|
||||
extern int yydebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
ATTRIBUTE = 258,
|
||||
VARYING = 259,
|
||||
CONST = 260,
|
||||
BOOL = 261,
|
||||
FLOAT = 262,
|
||||
DOUBLE = 263,
|
||||
INT = 264,
|
||||
UINT = 265,
|
||||
INT64_T = 266,
|
||||
UINT64_T = 267,
|
||||
BREAK = 268,
|
||||
CONTINUE = 269,
|
||||
DO = 270,
|
||||
ELSE = 271,
|
||||
FOR = 272,
|
||||
IF = 273,
|
||||
DISCARD = 274,
|
||||
RETURN = 275,
|
||||
SWITCH = 276,
|
||||
CASE = 277,
|
||||
DEFAULT = 278,
|
||||
SUBROUTINE = 279,
|
||||
BVEC2 = 280,
|
||||
BVEC3 = 281,
|
||||
BVEC4 = 282,
|
||||
IVEC2 = 283,
|
||||
IVEC3 = 284,
|
||||
IVEC4 = 285,
|
||||
I64VEC2 = 286,
|
||||
I64VEC3 = 287,
|
||||
I64VEC4 = 288,
|
||||
UVEC2 = 289,
|
||||
UVEC3 = 290,
|
||||
UVEC4 = 291,
|
||||
U64VEC2 = 292,
|
||||
U64VEC3 = 293,
|
||||
U64VEC4 = 294,
|
||||
VEC2 = 295,
|
||||
VEC3 = 296,
|
||||
VEC4 = 297,
|
||||
MAT2 = 298,
|
||||
MAT3 = 299,
|
||||
MAT4 = 300,
|
||||
CENTROID = 301,
|
||||
IN = 302,
|
||||
OUT = 303,
|
||||
INOUT = 304,
|
||||
UNIFORM = 305,
|
||||
PATCH = 306,
|
||||
SAMPLE = 307,
|
||||
BUFFER = 308,
|
||||
SHARED = 309,
|
||||
COHERENT = 310,
|
||||
VOLATILE = 311,
|
||||
RESTRICT = 312,
|
||||
READONLY = 313,
|
||||
WRITEONLY = 314,
|
||||
DVEC2 = 315,
|
||||
DVEC3 = 316,
|
||||
DVEC4 = 317,
|
||||
DMAT2 = 318,
|
||||
DMAT3 = 319,
|
||||
DMAT4 = 320,
|
||||
NOPERSPECTIVE = 321,
|
||||
FLAT = 322,
|
||||
SMOOTH = 323,
|
||||
LAYOUT = 324,
|
||||
MAT2X2 = 325,
|
||||
MAT2X3 = 326,
|
||||
MAT2X4 = 327,
|
||||
MAT3X2 = 328,
|
||||
MAT3X3 = 329,
|
||||
MAT3X4 = 330,
|
||||
MAT4X2 = 331,
|
||||
MAT4X3 = 332,
|
||||
MAT4X4 = 333,
|
||||
DMAT2X2 = 334,
|
||||
DMAT2X3 = 335,
|
||||
DMAT2X4 = 336,
|
||||
DMAT3X2 = 337,
|
||||
DMAT3X3 = 338,
|
||||
DMAT3X4 = 339,
|
||||
DMAT4X2 = 340,
|
||||
DMAT4X3 = 341,
|
||||
DMAT4X4 = 342,
|
||||
ATOMIC_UINT = 343,
|
||||
SAMPLER1D = 344,
|
||||
SAMPLER2D = 345,
|
||||
SAMPLER3D = 346,
|
||||
SAMPLERCUBE = 347,
|
||||
SAMPLER1DSHADOW = 348,
|
||||
SAMPLER2DSHADOW = 349,
|
||||
SAMPLERCUBESHADOW = 350,
|
||||
SAMPLER1DARRAY = 351,
|
||||
SAMPLER2DARRAY = 352,
|
||||
SAMPLER1DARRAYSHADOW = 353,
|
||||
SAMPLER2DARRAYSHADOW = 354,
|
||||
ISAMPLER1D = 355,
|
||||
ISAMPLER2D = 356,
|
||||
ISAMPLER3D = 357,
|
||||
ISAMPLERCUBE = 358,
|
||||
ISAMPLER1DARRAY = 359,
|
||||
ISAMPLER2DARRAY = 360,
|
||||
USAMPLER1D = 361,
|
||||
USAMPLER2D = 362,
|
||||
USAMPLER3D = 363,
|
||||
USAMPLERCUBE = 364,
|
||||
USAMPLER1DARRAY = 365,
|
||||
USAMPLER2DARRAY = 366,
|
||||
SAMPLER2DRECT = 367,
|
||||
SAMPLER2DRECTSHADOW = 368,
|
||||
ISAMPLER2DRECT = 369,
|
||||
USAMPLER2DRECT = 370,
|
||||
SAMPLERBUFFER = 371,
|
||||
ISAMPLERBUFFER = 372,
|
||||
USAMPLERBUFFER = 373,
|
||||
SAMPLERCUBEARRAY = 374,
|
||||
SAMPLERCUBEARRAYSHADOW = 375,
|
||||
ISAMPLERCUBEARRAY = 376,
|
||||
USAMPLERCUBEARRAY = 377,
|
||||
SAMPLER2DMS = 378,
|
||||
ISAMPLER2DMS = 379,
|
||||
USAMPLER2DMS = 380,
|
||||
SAMPLER2DMSARRAY = 381,
|
||||
ISAMPLER2DMSARRAY = 382,
|
||||
USAMPLER2DMSARRAY = 383,
|
||||
SAMPLEREXTERNALOES = 384,
|
||||
SAMPLER = 385,
|
||||
SAMPLERSHADOW = 386,
|
||||
TEXTURE1D = 387,
|
||||
TEXTURE2D = 388,
|
||||
TEXTURE3D = 389,
|
||||
TEXTURECUBE = 390,
|
||||
TEXTURE1DARRAY = 391,
|
||||
TEXTURE2DARRAY = 392,
|
||||
ITEXTURE1D = 393,
|
||||
ITEXTURE2D = 394,
|
||||
ITEXTURE3D = 395,
|
||||
ITEXTURECUBE = 396,
|
||||
ITEXTURE1DARRAY = 397,
|
||||
ITEXTURE2DARRAY = 398,
|
||||
UTEXTURE1D = 399,
|
||||
UTEXTURE2D = 400,
|
||||
UTEXTURE3D = 401,
|
||||
UTEXTURECUBE = 402,
|
||||
UTEXTURE1DARRAY = 403,
|
||||
UTEXTURE2DARRAY = 404,
|
||||
TEXTURE2DRECT = 405,
|
||||
ITEXTURE2DRECT = 406,
|
||||
UTEXTURE2DRECT = 407,
|
||||
TEXTUREBUFFER = 408,
|
||||
ITEXTUREBUFFER = 409,
|
||||
UTEXTUREBUFFER = 410,
|
||||
TEXTURECUBEARRAY = 411,
|
||||
ITEXTURECUBEARRAY = 412,
|
||||
UTEXTURECUBEARRAY = 413,
|
||||
TEXTURE2DMS = 414,
|
||||
ITEXTURE2DMS = 415,
|
||||
UTEXTURE2DMS = 416,
|
||||
TEXTURE2DMSARRAY = 417,
|
||||
ITEXTURE2DMSARRAY = 418,
|
||||
UTEXTURE2DMSARRAY = 419,
|
||||
SUBPASSINPUT = 420,
|
||||
SUBPASSINPUTMS = 421,
|
||||
ISUBPASSINPUT = 422,
|
||||
ISUBPASSINPUTMS = 423,
|
||||
USUBPASSINPUT = 424,
|
||||
USUBPASSINPUTMS = 425,
|
||||
IMAGE1D = 426,
|
||||
IIMAGE1D = 427,
|
||||
UIMAGE1D = 428,
|
||||
IMAGE2D = 429,
|
||||
IIMAGE2D = 430,
|
||||
UIMAGE2D = 431,
|
||||
IMAGE3D = 432,
|
||||
IIMAGE3D = 433,
|
||||
UIMAGE3D = 434,
|
||||
IMAGE2DRECT = 435,
|
||||
IIMAGE2DRECT = 436,
|
||||
UIMAGE2DRECT = 437,
|
||||
IMAGECUBE = 438,
|
||||
IIMAGECUBE = 439,
|
||||
UIMAGECUBE = 440,
|
||||
IMAGEBUFFER = 441,
|
||||
IIMAGEBUFFER = 442,
|
||||
UIMAGEBUFFER = 443,
|
||||
IMAGE1DARRAY = 444,
|
||||
IIMAGE1DARRAY = 445,
|
||||
UIMAGE1DARRAY = 446,
|
||||
IMAGE2DARRAY = 447,
|
||||
IIMAGE2DARRAY = 448,
|
||||
UIMAGE2DARRAY = 449,
|
||||
IMAGECUBEARRAY = 450,
|
||||
IIMAGECUBEARRAY = 451,
|
||||
UIMAGECUBEARRAY = 452,
|
||||
IMAGE2DMS = 453,
|
||||
IIMAGE2DMS = 454,
|
||||
UIMAGE2DMS = 455,
|
||||
IMAGE2DMSARRAY = 456,
|
||||
IIMAGE2DMSARRAY = 457,
|
||||
UIMAGE2DMSARRAY = 458,
|
||||
STRUCT = 459,
|
||||
VOID = 460,
|
||||
WHILE = 461,
|
||||
IDENTIFIER = 462,
|
||||
TYPE_NAME = 463,
|
||||
FLOATCONSTANT = 464,
|
||||
DOUBLECONSTANT = 465,
|
||||
INTCONSTANT = 466,
|
||||
UINTCONSTANT = 467,
|
||||
INT64CONSTANT = 468,
|
||||
UINT64CONSTANT = 469,
|
||||
BOOLCONSTANT = 470,
|
||||
LEFT_OP = 471,
|
||||
RIGHT_OP = 472,
|
||||
INC_OP = 473,
|
||||
DEC_OP = 474,
|
||||
LE_OP = 475,
|
||||
GE_OP = 476,
|
||||
EQ_OP = 477,
|
||||
NE_OP = 478,
|
||||
AND_OP = 479,
|
||||
OR_OP = 480,
|
||||
XOR_OP = 481,
|
||||
MUL_ASSIGN = 482,
|
||||
DIV_ASSIGN = 483,
|
||||
ADD_ASSIGN = 484,
|
||||
MOD_ASSIGN = 485,
|
||||
LEFT_ASSIGN = 486,
|
||||
RIGHT_ASSIGN = 487,
|
||||
AND_ASSIGN = 488,
|
||||
XOR_ASSIGN = 489,
|
||||
OR_ASSIGN = 490,
|
||||
SUB_ASSIGN = 491,
|
||||
LEFT_PAREN = 492,
|
||||
RIGHT_PAREN = 493,
|
||||
LEFT_BRACKET = 494,
|
||||
RIGHT_BRACKET = 495,
|
||||
LEFT_BRACE = 496,
|
||||
RIGHT_BRACE = 497,
|
||||
DOT = 498,
|
||||
COMMA = 499,
|
||||
COLON = 500,
|
||||
EQUAL = 501,
|
||||
SEMICOLON = 502,
|
||||
BANG = 503,
|
||||
DASH = 504,
|
||||
TILDE = 505,
|
||||
PLUS = 506,
|
||||
STAR = 507,
|
||||
SLASH = 508,
|
||||
PERCENT = 509,
|
||||
LEFT_ANGLE = 510,
|
||||
RIGHT_ANGLE = 511,
|
||||
VERTICAL_BAR = 512,
|
||||
CARET = 513,
|
||||
AMPERSAND = 514,
|
||||
QUESTION = 515,
|
||||
INVARIANT = 516,
|
||||
PRECISE = 517,
|
||||
HIGH_PRECISION = 518,
|
||||
MEDIUM_PRECISION = 519,
|
||||
LOW_PRECISION = 520,
|
||||
PRECISION = 521,
|
||||
PACKED = 522,
|
||||
RESOURCE = 523,
|
||||
SUPERP = 524
|
||||
};
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
ATTRIBUTE = 258,
|
||||
VARYING = 259,
|
||||
CONST = 260,
|
||||
BOOL = 261,
|
||||
FLOAT = 262,
|
||||
DOUBLE = 263,
|
||||
INT = 264,
|
||||
UINT = 265,
|
||||
INT64_T = 266,
|
||||
UINT64_T = 267,
|
||||
BREAK = 268,
|
||||
CONTINUE = 269,
|
||||
DO = 270,
|
||||
ELSE = 271,
|
||||
FOR = 272,
|
||||
IF = 273,
|
||||
DISCARD = 274,
|
||||
RETURN = 275,
|
||||
SWITCH = 276,
|
||||
CASE = 277,
|
||||
DEFAULT = 278,
|
||||
SUBROUTINE = 279,
|
||||
BVEC2 = 280,
|
||||
BVEC3 = 281,
|
||||
BVEC4 = 282,
|
||||
IVEC2 = 283,
|
||||
IVEC3 = 284,
|
||||
IVEC4 = 285,
|
||||
I64VEC2 = 286,
|
||||
I64VEC3 = 287,
|
||||
I64VEC4 = 288,
|
||||
UVEC2 = 289,
|
||||
UVEC3 = 290,
|
||||
UVEC4 = 291,
|
||||
U64VEC2 = 292,
|
||||
U64VEC3 = 293,
|
||||
U64VEC4 = 294,
|
||||
VEC2 = 295,
|
||||
VEC3 = 296,
|
||||
VEC4 = 297,
|
||||
MAT2 = 298,
|
||||
MAT3 = 299,
|
||||
MAT4 = 300,
|
||||
CENTROID = 301,
|
||||
IN = 302,
|
||||
OUT = 303,
|
||||
INOUT = 304,
|
||||
UNIFORM = 305,
|
||||
PATCH = 306,
|
||||
SAMPLE = 307,
|
||||
BUFFER = 308,
|
||||
SHARED = 309,
|
||||
COHERENT = 310,
|
||||
VOLATILE = 311,
|
||||
RESTRICT = 312,
|
||||
READONLY = 313,
|
||||
WRITEONLY = 314,
|
||||
DVEC2 = 315,
|
||||
DVEC3 = 316,
|
||||
DVEC4 = 317,
|
||||
DMAT2 = 318,
|
||||
DMAT3 = 319,
|
||||
DMAT4 = 320,
|
||||
NOPERSPECTIVE = 321,
|
||||
FLAT = 322,
|
||||
SMOOTH = 323,
|
||||
LAYOUT = 324,
|
||||
__EXPLICITINTERPAMD = 325,
|
||||
MAT2X2 = 326,
|
||||
MAT2X3 = 327,
|
||||
MAT2X4 = 328,
|
||||
MAT3X2 = 329,
|
||||
MAT3X3 = 330,
|
||||
MAT3X4 = 331,
|
||||
MAT4X2 = 332,
|
||||
MAT4X3 = 333,
|
||||
MAT4X4 = 334,
|
||||
DMAT2X2 = 335,
|
||||
DMAT2X3 = 336,
|
||||
DMAT2X4 = 337,
|
||||
DMAT3X2 = 338,
|
||||
DMAT3X3 = 339,
|
||||
DMAT3X4 = 340,
|
||||
DMAT4X2 = 341,
|
||||
DMAT4X3 = 342,
|
||||
DMAT4X4 = 343,
|
||||
ATOMIC_UINT = 344,
|
||||
SAMPLER1D = 345,
|
||||
SAMPLER2D = 346,
|
||||
SAMPLER3D = 347,
|
||||
SAMPLERCUBE = 348,
|
||||
SAMPLER1DSHADOW = 349,
|
||||
SAMPLER2DSHADOW = 350,
|
||||
SAMPLERCUBESHADOW = 351,
|
||||
SAMPLER1DARRAY = 352,
|
||||
SAMPLER2DARRAY = 353,
|
||||
SAMPLER1DARRAYSHADOW = 354,
|
||||
SAMPLER2DARRAYSHADOW = 355,
|
||||
ISAMPLER1D = 356,
|
||||
ISAMPLER2D = 357,
|
||||
ISAMPLER3D = 358,
|
||||
ISAMPLERCUBE = 359,
|
||||
ISAMPLER1DARRAY = 360,
|
||||
ISAMPLER2DARRAY = 361,
|
||||
USAMPLER1D = 362,
|
||||
USAMPLER2D = 363,
|
||||
USAMPLER3D = 364,
|
||||
USAMPLERCUBE = 365,
|
||||
USAMPLER1DARRAY = 366,
|
||||
USAMPLER2DARRAY = 367,
|
||||
SAMPLER2DRECT = 368,
|
||||
SAMPLER2DRECTSHADOW = 369,
|
||||
ISAMPLER2DRECT = 370,
|
||||
USAMPLER2DRECT = 371,
|
||||
SAMPLERBUFFER = 372,
|
||||
ISAMPLERBUFFER = 373,
|
||||
USAMPLERBUFFER = 374,
|
||||
SAMPLERCUBEARRAY = 375,
|
||||
SAMPLERCUBEARRAYSHADOW = 376,
|
||||
ISAMPLERCUBEARRAY = 377,
|
||||
USAMPLERCUBEARRAY = 378,
|
||||
SAMPLER2DMS = 379,
|
||||
ISAMPLER2DMS = 380,
|
||||
USAMPLER2DMS = 381,
|
||||
SAMPLER2DMSARRAY = 382,
|
||||
ISAMPLER2DMSARRAY = 383,
|
||||
USAMPLER2DMSARRAY = 384,
|
||||
SAMPLEREXTERNALOES = 385,
|
||||
SAMPLER = 386,
|
||||
SAMPLERSHADOW = 387,
|
||||
TEXTURE1D = 388,
|
||||
TEXTURE2D = 389,
|
||||
TEXTURE3D = 390,
|
||||
TEXTURECUBE = 391,
|
||||
TEXTURE1DARRAY = 392,
|
||||
TEXTURE2DARRAY = 393,
|
||||
ITEXTURE1D = 394,
|
||||
ITEXTURE2D = 395,
|
||||
ITEXTURE3D = 396,
|
||||
ITEXTURECUBE = 397,
|
||||
ITEXTURE1DARRAY = 398,
|
||||
ITEXTURE2DARRAY = 399,
|
||||
UTEXTURE1D = 400,
|
||||
UTEXTURE2D = 401,
|
||||
UTEXTURE3D = 402,
|
||||
UTEXTURECUBE = 403,
|
||||
UTEXTURE1DARRAY = 404,
|
||||
UTEXTURE2DARRAY = 405,
|
||||
TEXTURE2DRECT = 406,
|
||||
ITEXTURE2DRECT = 407,
|
||||
UTEXTURE2DRECT = 408,
|
||||
TEXTUREBUFFER = 409,
|
||||
ITEXTUREBUFFER = 410,
|
||||
UTEXTUREBUFFER = 411,
|
||||
TEXTURECUBEARRAY = 412,
|
||||
ITEXTURECUBEARRAY = 413,
|
||||
UTEXTURECUBEARRAY = 414,
|
||||
TEXTURE2DMS = 415,
|
||||
ITEXTURE2DMS = 416,
|
||||
UTEXTURE2DMS = 417,
|
||||
TEXTURE2DMSARRAY = 418,
|
||||
ITEXTURE2DMSARRAY = 419,
|
||||
UTEXTURE2DMSARRAY = 420,
|
||||
SUBPASSINPUT = 421,
|
||||
SUBPASSINPUTMS = 422,
|
||||
ISUBPASSINPUT = 423,
|
||||
ISUBPASSINPUTMS = 424,
|
||||
USUBPASSINPUT = 425,
|
||||
USUBPASSINPUTMS = 426,
|
||||
IMAGE1D = 427,
|
||||
IIMAGE1D = 428,
|
||||
UIMAGE1D = 429,
|
||||
IMAGE2D = 430,
|
||||
IIMAGE2D = 431,
|
||||
UIMAGE2D = 432,
|
||||
IMAGE3D = 433,
|
||||
IIMAGE3D = 434,
|
||||
UIMAGE3D = 435,
|
||||
IMAGE2DRECT = 436,
|
||||
IIMAGE2DRECT = 437,
|
||||
UIMAGE2DRECT = 438,
|
||||
IMAGECUBE = 439,
|
||||
IIMAGECUBE = 440,
|
||||
UIMAGECUBE = 441,
|
||||
IMAGEBUFFER = 442,
|
||||
IIMAGEBUFFER = 443,
|
||||
UIMAGEBUFFER = 444,
|
||||
IMAGE1DARRAY = 445,
|
||||
IIMAGE1DARRAY = 446,
|
||||
UIMAGE1DARRAY = 447,
|
||||
IMAGE2DARRAY = 448,
|
||||
IIMAGE2DARRAY = 449,
|
||||
UIMAGE2DARRAY = 450,
|
||||
IMAGECUBEARRAY = 451,
|
||||
IIMAGECUBEARRAY = 452,
|
||||
UIMAGECUBEARRAY = 453,
|
||||
IMAGE2DMS = 454,
|
||||
IIMAGE2DMS = 455,
|
||||
UIMAGE2DMS = 456,
|
||||
IMAGE2DMSARRAY = 457,
|
||||
IIMAGE2DMSARRAY = 458,
|
||||
UIMAGE2DMSARRAY = 459,
|
||||
STRUCT = 460,
|
||||
VOID = 461,
|
||||
WHILE = 462,
|
||||
IDENTIFIER = 463,
|
||||
TYPE_NAME = 464,
|
||||
FLOATCONSTANT = 465,
|
||||
DOUBLECONSTANT = 466,
|
||||
INTCONSTANT = 467,
|
||||
UINTCONSTANT = 468,
|
||||
INT64CONSTANT = 469,
|
||||
UINT64CONSTANT = 470,
|
||||
BOOLCONSTANT = 471,
|
||||
LEFT_OP = 472,
|
||||
RIGHT_OP = 473,
|
||||
INC_OP = 474,
|
||||
DEC_OP = 475,
|
||||
LE_OP = 476,
|
||||
GE_OP = 477,
|
||||
EQ_OP = 478,
|
||||
NE_OP = 479,
|
||||
AND_OP = 480,
|
||||
OR_OP = 481,
|
||||
XOR_OP = 482,
|
||||
MUL_ASSIGN = 483,
|
||||
DIV_ASSIGN = 484,
|
||||
ADD_ASSIGN = 485,
|
||||
MOD_ASSIGN = 486,
|
||||
LEFT_ASSIGN = 487,
|
||||
RIGHT_ASSIGN = 488,
|
||||
AND_ASSIGN = 489,
|
||||
XOR_ASSIGN = 490,
|
||||
OR_ASSIGN = 491,
|
||||
SUB_ASSIGN = 492,
|
||||
LEFT_PAREN = 493,
|
||||
RIGHT_PAREN = 494,
|
||||
LEFT_BRACKET = 495,
|
||||
RIGHT_BRACKET = 496,
|
||||
LEFT_BRACE = 497,
|
||||
RIGHT_BRACE = 498,
|
||||
DOT = 499,
|
||||
COMMA = 500,
|
||||
COLON = 501,
|
||||
EQUAL = 502,
|
||||
SEMICOLON = 503,
|
||||
BANG = 504,
|
||||
DASH = 505,
|
||||
TILDE = 506,
|
||||
PLUS = 507,
|
||||
STAR = 508,
|
||||
SLASH = 509,
|
||||
PERCENT = 510,
|
||||
LEFT_ANGLE = 511,
|
||||
RIGHT_ANGLE = 512,
|
||||
VERTICAL_BAR = 513,
|
||||
CARET = 514,
|
||||
AMPERSAND = 515,
|
||||
QUESTION = 516,
|
||||
INVARIANT = 517,
|
||||
PRECISE = 518,
|
||||
HIGH_PRECISION = 519,
|
||||
MEDIUM_PRECISION = 520,
|
||||
LOW_PRECISION = 521,
|
||||
PRECISION = 522,
|
||||
PACKED = 523,
|
||||
RESOURCE = 524,
|
||||
SUPERP = 525
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
||||
union YYSTYPE
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
{
|
||||
#line 66 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
||||
/* Line 2058 of yacc.c */
|
||||
#line 66 "glslang.y"
|
||||
|
||||
struct {
|
||||
glslang::TSourceLoc loc;
|
||||
@ -354,16 +356,28 @@ union YYSTYPE
|
||||
};
|
||||
} interm;
|
||||
|
||||
#line 358 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
/* Line 2058 of yacc.c */
|
||||
#line 362 "glslang_tab.cpp.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef YYPARSE_PARAM
|
||||
#if defined __STDC__ || defined __cplusplus
|
||||
int yyparse (void *YYPARSE_PARAM);
|
||||
#else
|
||||
int yyparse ();
|
||||
#endif
|
||||
#else /* ! YYPARSE_PARAM */
|
||||
#if defined __STDC__ || defined __cplusplus
|
||||
int yyparse (glslang::TParseContext* pParseContext);
|
||||
#else
|
||||
int yyparse ();
|
||||
#endif
|
||||
#endif /* ! YYPARSE_PARAM */
|
||||
|
||||
#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||
#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||
|
@ -355,6 +355,7 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
||||
|
||||
case EOpBallot: out.debug << "ballot"; break;
|
||||
case EOpReadFirstInvocation: out.debug << "readFirstInvocation"; break;
|
||||
|
||||
case EOpAnyInvocation: out.debug << "anyInvocation"; break;
|
||||
case EOpAllInvocations: out.debug << "allInvocations"; break;
|
||||
case EOpAllInvocationsEqual: out.debug << "allInvocationsEqual"; break;
|
||||
@ -365,6 +366,19 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
||||
case EOpRcp: out.debug << "rcp"; break;
|
||||
case EOpSaturate: out.debug << "saturate"; break;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpMinInvocations: out.debug << "minInvocations"; break;
|
||||
case EOpMaxInvocations: out.debug << "maxInvocations"; break;
|
||||
case EOpAddInvocations: out.debug << "addInvocations"; break;
|
||||
case EOpMinInvocationsNonUniform: out.debug << "minInvocationsNonUniform"; break;
|
||||
case EOpMaxInvocationsNonUniform: out.debug << "maxInvocationsNonUniform"; break;
|
||||
case EOpAddInvocationsNonUniform: out.debug << "addInvocationsNonUniform"; break;
|
||||
case EOpMbcnt: out.debug << "mbcnt"; break;
|
||||
|
||||
case EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break;
|
||||
case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break;
|
||||
#endif
|
||||
|
||||
default: out.debug.message(EPrefixError, "Bad unary op");
|
||||
}
|
||||
|
||||
@ -482,6 +496,18 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
||||
|
||||
case EOpReadInvocation: out.debug << "readInvocation"; break;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpSwizzleInvocations: out.debug << "swizzleInvocations"; break;
|
||||
case EOpSwizzleInvocationsMasked: out.debug << "swizzleInvocationsMasked"; break;
|
||||
case EOpWriteInvocation: out.debug << "writeInvocation"; break;
|
||||
|
||||
case EOpMin3: out.debug << "min3"; break;
|
||||
case EOpMax3: out.debug << "max3"; break;
|
||||
case EOpMid3: out.debug << "mid3"; break;
|
||||
|
||||
case EOpTime: out.debug << "time"; break;
|
||||
#endif
|
||||
|
||||
case EOpAtomicAdd: out.debug << "AtomicAdd"; break;
|
||||
case EOpAtomicMin: out.debug << "AtomicMin"; break;
|
||||
case EOpAtomicMax: out.debug << "AtomicMax"; break;
|
||||
@ -539,6 +565,9 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
||||
|
||||
case EOpInterpolateAtSample: out.debug << "interpolateAtSample"; break;
|
||||
case EOpInterpolateAtOffset: out.debug << "interpolateAtOffset"; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpInterpolateAtVertex: out.debug << "interpolateAtVertex"; break;
|
||||
#endif
|
||||
|
||||
case EOpSinCos: out.debug << "sincos"; break;
|
||||
case EOpGenMul: out.debug << "mul"; break;
|
||||
|
Loading…
Reference in New Issue
Block a user