Merge pull request #1855 from KhronosGroup/web
Web: Create a very small-footprint glslang for web use.
This commit is contained in:
commit
ea69a29829
89 changed files with 14036 additions and 8696 deletions
|
|
@ -26,11 +26,8 @@ if(NOT ${SKIP_GLSLANG_INSTALL})
|
|||
endif()
|
||||
option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON)
|
||||
|
||||
option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON)
|
||||
option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON)
|
||||
|
||||
option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
|
||||
|
||||
option(ENABLE_GLSLANG_WEB "Reduces glslang to minumum needed for web use" OFF)
|
||||
option(ENABLE_EMSCRIPTEN_SINGLE_FILE "If using emscripten, enables SINGLE_FILE build" OFF)
|
||||
option(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE "If using emscripten, builds to run on Node instead of Web" OFF)
|
||||
|
|
@ -67,18 +64,14 @@ project(glslang)
|
|||
# make testing optional
|
||||
include(CTest)
|
||||
|
||||
if(ENABLE_AMD_EXTENSIONS)
|
||||
add_definitions(-DAMD_EXTENSIONS)
|
||||
endif(ENABLE_AMD_EXTENSIONS)
|
||||
|
||||
if(ENABLE_NV_EXTENSIONS)
|
||||
add_definitions(-DNV_EXTENSIONS)
|
||||
endif(ENABLE_NV_EXTENSIONS)
|
||||
|
||||
if(ENABLE_HLSL)
|
||||
add_definitions(-DENABLE_HLSL)
|
||||
endif(ENABLE_HLSL)
|
||||
|
||||
if(ENABLE_GLSLANG_WEB)
|
||||
add_definitions(-DGLSLANG_WEB)
|
||||
endif(ENABLE_GLSLANG_WEB)
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
if(MSVC)
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -155,17 +155,24 @@ changes are quite infrequent. For windows you can get binaries from
|
|||
The command to rebuild is:
|
||||
|
||||
```bash
|
||||
m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
|
||||
bison --defines=MachineIndependent/glslang_tab.cpp.h
|
||||
-t MachineIndependent/glslang.y
|
||||
-o MachineIndependent/glslang_tab.cpp
|
||||
```
|
||||
|
||||
The above command is also available in the bash script at
|
||||
`glslang/updateGrammar`.
|
||||
The above commands are also available in the bash script in `updateGrammar`,
|
||||
when executed from the glslang subdirectory of the glslang repository.
|
||||
With no arguments it builds the full grammar, and with a "web" argument,
|
||||
the web grammar subset (see more about the web subset in the next section).
|
||||
|
||||
### WASM for the the Web
|
||||
|
||||
Use the steps in [Build Steps](#build-steps), which following notes/exceptions:
|
||||
* For building the web subset of core glslang:
|
||||
+ `m4` also needs a `-DGLSLANG_WEB` argument, or simply execute `updateGrammar web` from the glslang subdirectory
|
||||
+ turn off the CMAKE options for `BUILD_TESTING`, `ENABLE_OPT`, and `INSTALL_GTEST`,
|
||||
while turning on `ENABLE_GLSLANG_WEB`
|
||||
* `emsdk` needs to be present in your executable search path, *PATH* for
|
||||
Bash-like enivironments
|
||||
+ Instructions located
|
||||
|
|
|
|||
|
|
@ -25,24 +25,14 @@ set(HEADERS
|
|||
spvIR.h
|
||||
doc.h
|
||||
SpvTools.h
|
||||
disassemble.h)
|
||||
disassemble.h
|
||||
GLSL.ext.AMD.h
|
||||
GLSL.ext.NV.h)
|
||||
|
||||
set(SPVREMAP_HEADERS
|
||||
SPVRemapper.h
|
||||
doc.h)
|
||||
|
||||
if(ENABLE_AMD_EXTENSIONS)
|
||||
list(APPEND
|
||||
HEADERS
|
||||
GLSL.ext.AMD.h)
|
||||
endif(ENABLE_AMD_EXTENSIONS)
|
||||
|
||||
if(ENABLE_NV_EXTENSIONS)
|
||||
list(APPEND
|
||||
HEADERS
|
||||
GLSL.ext.NV.h)
|
||||
endif(ENABLE_NV_EXTENSIONS)
|
||||
|
||||
add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
|
||||
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
|
||||
set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -32,6 +32,8 @@
|
|||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -66,3 +68,5 @@ std::string SpvBuildLogger::getAllMessages() const {
|
|||
}
|
||||
|
||||
} // end spv namespace
|
||||
|
||||
#endif
|
||||
|
|
@ -46,6 +46,14 @@ class SpvBuildLogger {
|
|||
public:
|
||||
SpvBuildLogger() {}
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
void tbdFunctionality(const std::string& f) { }
|
||||
void missingFunctionality(const std::string& f) { }
|
||||
void warning(const std::string& w) { }
|
||||
void error(const std::string& e) { errors.push_back(e); }
|
||||
std::string getAllMessages() { return ""; }
|
||||
#else
|
||||
|
||||
// Registers a TBD functionality.
|
||||
void tbdFunctionality(const std::string& f);
|
||||
// Registers a missing functionality.
|
||||
|
|
@ -59,6 +67,7 @@ public:
|
|||
// Returns all messages accumulated in the order of:
|
||||
// TBD functionalities, missing functionalities, warnings, errors.
|
||||
std::string getAllMessages() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
SpvBuildLogger(const SpvBuildLogger&);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@
|
|||
|
||||
#include "SpvBuilder.h"
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
#include "hex_float.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <cstdio>
|
||||
|
|
@ -230,6 +232,11 @@ Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardP
|
|||
|
||||
Id Builder::makeIntegerType(int width, bool hasSign)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(width == 32);
|
||||
width = 32;
|
||||
#endif
|
||||
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) {
|
||||
|
|
@ -265,6 +272,11 @@ Id Builder::makeIntegerType(int width, bool hasSign)
|
|||
|
||||
Id Builder::makeFloatType(int width)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(width == 32);
|
||||
width = 32;
|
||||
#endif
|
||||
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) {
|
||||
|
|
@ -516,6 +528,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
|||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// deal with capabilities
|
||||
switch (dim) {
|
||||
case DimBuffer:
|
||||
|
|
@ -561,6 +574,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
|||
addCapability(CapabilityImageMSArray);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
|
@ -586,7 +600,7 @@ Id Builder::makeSampledImageType(Id imageType)
|
|||
return type->getResultId();
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
Id Builder::makeAccelerationStructureNVType()
|
||||
{
|
||||
Instruction *type;
|
||||
|
|
@ -602,6 +616,7 @@ Id Builder::makeAccelerationStructureNVType()
|
|||
return type->getResultId();
|
||||
}
|
||||
#endif
|
||||
|
||||
Id Builder::getDerefTypeId(Id resultId) const
|
||||
{
|
||||
Id typeId = getTypeId(resultId);
|
||||
|
|
@ -939,6 +954,10 @@ Id Builder::makeFloatConstant(float f, bool specConstant)
|
|||
|
||||
Id Builder::makeDoubleConstant(double d, bool specConstant)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(0);
|
||||
return NoResult;
|
||||
#else
|
||||
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
||||
Id typeId = makeFloatType(64);
|
||||
union { double db; unsigned long long ull; } u;
|
||||
|
|
@ -963,10 +982,15 @@ Id Builder::makeDoubleConstant(double d, bool specConstant)
|
|||
module.mapInstruction(c);
|
||||
|
||||
return c->getResultId();
|
||||
#endif
|
||||
}
|
||||
|
||||
Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(0);
|
||||
return NoResult;
|
||||
#else
|
||||
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
||||
Id typeId = makeFloatType(16);
|
||||
|
||||
|
|
@ -991,13 +1015,21 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
|||
module.mapInstruction(c);
|
||||
|
||||
return c->getResultId();
|
||||
#endif
|
||||
}
|
||||
|
||||
Id Builder::makeFpConstant(Id type, double d, bool specConstant)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
const int width = 32;
|
||||
assert(width == getScalarTypeWidth(type));
|
||||
#else
|
||||
const int width = getScalarTypeWidth(type);
|
||||
#endif
|
||||
|
||||
assert(isFloatType(type));
|
||||
|
||||
switch (getScalarTypeWidth(type)) {
|
||||
switch (width) {
|
||||
case 16:
|
||||
return makeFloat16Constant((float)d, specConstant);
|
||||
case 32:
|
||||
|
|
@ -1825,7 +1857,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
|||
if (parameters.component != NoResult)
|
||||
texArgs[numArgs++] = parameters.component;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
if (parameters.granularity != NoResult)
|
||||
texArgs[numArgs++] = parameters.granularity;
|
||||
if (parameters.coarse != NoResult)
|
||||
|
|
@ -1872,6 +1904,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
|||
mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask);
|
||||
texArgs[numArgs++] = parameters.offsets;
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
if (parameters.sample) {
|
||||
mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask);
|
||||
texArgs[numArgs++] = parameters.sample;
|
||||
|
|
@ -1889,6 +1922,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
|||
if (parameters.volatil) {
|
||||
mask = mask | ImageOperandsVolatileTexelKHRMask;
|
||||
}
|
||||
#endif
|
||||
mask = mask | signExtensionMask;
|
||||
if (mask == ImageOperandsMaskNone)
|
||||
--numArgs; // undo speculative reservation for the mask argument
|
||||
|
|
@ -1904,10 +1938,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
|||
opCode = OpImageSparseFetch;
|
||||
else
|
||||
opCode = OpImageFetch;
|
||||
#ifdef NV_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
} else if (parameters.granularity && parameters.coarse) {
|
||||
opCode = OpImageSampleFootprintNV;
|
||||
#endif
|
||||
} else if (gather) {
|
||||
if (parameters.Dref)
|
||||
if (sparse)
|
||||
|
|
@ -1919,6 +1952,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
|||
opCode = OpImageSparseGather;
|
||||
else
|
||||
opCode = OpImageGather;
|
||||
#endif
|
||||
} else if (explicitLod) {
|
||||
if (parameters.Dref) {
|
||||
if (proj)
|
||||
|
|
@ -2067,11 +2101,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
|
|||
break;
|
||||
}
|
||||
case OpImageQueryLod:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
resultType = makeVectorType(getScalarTypeId(getTypeId(parameters.coords)), 2);
|
||||
#else
|
||||
resultType = makeVectorType(makeFloatType(32), 2);
|
||||
#endif
|
||||
break;
|
||||
case OpImageQueryLevels:
|
||||
case OpImageQuerySamples:
|
||||
|
|
@ -2089,6 +2119,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
|
|||
if (parameters.lod)
|
||||
query->addIdOperand(parameters.lod);
|
||||
buildPoint->addInstruction(std::unique_ptr<Instruction>(query));
|
||||
addCapability(CapabilityImageQuery);
|
||||
|
||||
return query->getResultId();
|
||||
}
|
||||
|
|
@ -2282,7 +2313,12 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
|
|||
int numRows = getTypeNumRows(resultTypeId);
|
||||
|
||||
Instruction* instr = module.getInstruction(componentTypeId);
|
||||
unsigned bitCount = instr->getImmediateOperand(0);
|
||||
#ifdef GLSLANG_WEB
|
||||
const unsigned bitCount = 32;
|
||||
assert(bitCount == instr->getImmediateOperand(0));
|
||||
#else
|
||||
const unsigned bitCount = instr->getImmediateOperand(0);
|
||||
#endif
|
||||
|
||||
// Optimize matrix constructed from a bigger matrix
|
||||
if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) {
|
||||
|
|
|
|||
|
|
@ -201,7 +201,11 @@ public:
|
|||
bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; }
|
||||
bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; }
|
||||
bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; }
|
||||
#ifdef GLSLANG_WEB
|
||||
bool isCooperativeMatrixType(Id typeId)const { return false; }
|
||||
#else
|
||||
bool isCooperativeMatrixType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeMatrixNV; }
|
||||
#endif
|
||||
bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
|
||||
bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
|
||||
bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; }
|
||||
|
|
@ -557,6 +561,14 @@ public:
|
|||
|
||||
// Accumulate whether anything in the chain of structures has coherent decorations.
|
||||
struct CoherentFlags {
|
||||
CoherentFlags() { clear(); }
|
||||
#ifdef GLSLANG_WEB
|
||||
void clear() { }
|
||||
bool isVolatile() const { return false; }
|
||||
CoherentFlags operator |=(const CoherentFlags &other) { return *this; }
|
||||
#else
|
||||
bool isVolatile() const { return volatil; }
|
||||
|
||||
unsigned coherent : 1;
|
||||
unsigned devicecoherent : 1;
|
||||
unsigned queuefamilycoherent : 1;
|
||||
|
|
@ -577,7 +589,6 @@ public:
|
|||
isImage = 0;
|
||||
}
|
||||
|
||||
CoherentFlags() { clear(); }
|
||||
CoherentFlags operator |=(const CoherentFlags &other) {
|
||||
coherent |= other.coherent;
|
||||
devicecoherent |= other.devicecoherent;
|
||||
|
|
@ -589,6 +600,7 @@ public:
|
|||
isImage |= other.isImage;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
CoherentFlags coherentFlags;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -51,12 +51,8 @@ namespace spv {
|
|||
#include "GLSL.std.450.h"
|
||||
#include "GLSL.ext.KHR.h"
|
||||
#include "GLSL.ext.EXT.h"
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
#include "GLSL.ext.NV.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace spv {
|
||||
|
|
@ -160,7 +156,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
|||
}
|
||||
break;
|
||||
case OpExtInst:
|
||||
#if AMD_EXTENSIONS
|
||||
switch (inst.getImmediateOperand(1)) {
|
||||
case GLSLstd450Frexp:
|
||||
case GLSLstd450FrexpStruct:
|
||||
|
|
@ -176,7 +171,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
if (basicTypeOp == OpTypeFloat && width == 16)
|
||||
|
|
@ -222,12 +216,10 @@ void Builder::postProcess(Instruction& inst)
|
|||
addCapability(CapabilityImageQuery);
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case OpGroupNonUniformPartitionNV:
|
||||
addExtension(E_SPV_NV_shader_subgroup_partitioned);
|
||||
addCapability(CapabilityGroupNonUniformPartitionedNV);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case OpLoad:
|
||||
case OpStore:
|
||||
|
|
|
|||
|
|
@ -41,8 +41,10 @@
|
|||
#ifndef GLSLANG_SPV_TOOLS_H
|
||||
#define GLSLANG_SPV_TOOLS_H
|
||||
|
||||
#ifdef ENABLE_OPT
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#endif
|
||||
|
||||
#include "../glslang/MachineIndependent/localintermediate.h"
|
||||
#include "Logger.h"
|
||||
|
|
@ -59,7 +61,7 @@ struct SpvOptions {
|
|||
bool validate;
|
||||
};
|
||||
|
||||
#if ENABLE_OPT
|
||||
#ifdef ENABLE_OPT
|
||||
|
||||
// Use the SPIRV-Tools disassembler to print SPIR-V.
|
||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
|
||||
|
|
|
|||
|
|
@ -52,26 +52,16 @@ 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
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
#include "GLSL.ext.NV.h"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
|
||||
|
||||
namespace spv {
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
static const char* GLSLextNVGetDebugNames(const char*, unsigned);
|
||||
#endif
|
||||
|
||||
static void Kill(std::ostream& out, const char* message)
|
||||
{
|
||||
|
|
@ -82,15 +72,8 @@ 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
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
GLSLextNVInst,
|
||||
#endif
|
||||
|
||||
OpenCLExtInst,
|
||||
};
|
||||
|
||||
|
|
@ -499,37 +482,29 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
|||
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
|
||||
#ifdef NV_EXTENSIONS
|
||||
}else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 ||
|
||||
} else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_geometry_shader_passthrough, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_viewport_array2, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 ||
|
||||
strcmp(spv::E_SPV_NV_mesh_shader, name) == 0) {
|
||||
extInstSet = GLSLextNVInst;
|
||||
#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
|
||||
#ifdef NV_EXTENSIONS
|
||||
}
|
||||
else if (extInstSet == GLSLextNVInst) {
|
||||
out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -653,7 +628,6 @@ static void GLSLstd450GetDebugNames(const char** names)
|
|||
names[GLSLstd450NClamp] = "NClamp";
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint)
|
||||
{
|
||||
if (strcmp(name, spv::E_SPV_AMD_shader_ballot) == 0) {
|
||||
|
|
@ -695,9 +669,7 @@ static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint
|
|||
|
||||
return "Bad";
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
|
||||
{
|
||||
if (strcmp(name, spv::E_SPV_NV_sample_mask_override_coverage) == 0 ||
|
||||
|
|
@ -751,7 +723,6 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
|
|||
}
|
||||
return "Bad";
|
||||
}
|
||||
#endif
|
||||
|
||||
void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,12 +50,8 @@ namespace spv {
|
|||
// Include C-based headers that don't have a namespace
|
||||
#include "GLSL.ext.KHR.h"
|
||||
#include "GLSL.ext.EXT.h"
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
#include "GLSL.ext.NV.h"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -98,22 +94,17 @@ const char* ExecutionModelString(int model)
|
|||
case 4: return "Fragment";
|
||||
case 5: return "GLCompute";
|
||||
case 6: return "Kernel";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case ExecutionModelTaskNV: return "TaskNV";
|
||||
case ExecutionModelMeshNV: return "MeshNV";
|
||||
#endif
|
||||
|
||||
default: return "Bad";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case ExecutionModelRayGenerationNV: return "RayGenerationNV";
|
||||
case ExecutionModelIntersectionNV: return "IntersectionNV";
|
||||
case ExecutionModelAnyHitNV: return "AnyHitNV";
|
||||
case ExecutionModelClosestHitNV: return "ClosestHitNV";
|
||||
case ExecutionModelMissNV: return "MissNV";
|
||||
case ExecutionModelCallableNV: return "CallableNV";
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -183,13 +174,11 @@ const char* ExecutionModeString(int mode)
|
|||
|
||||
case 4446: return "PostDepthCoverage";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case ExecutionModeOutputLinesNV: return "OutputLinesNV";
|
||||
case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV";
|
||||
case ExecutionModeOutputTrianglesNV: return "OutputTrianglesNV";
|
||||
case ExecutionModeDerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV";
|
||||
case ExecutionModeDerivativeGroupLinearNV: return "DerivativeGroupLinearNV";
|
||||
#endif
|
||||
|
||||
case ExecutionModePixelInterlockOrderedEXT: return "PixelInterlockOrderedEXT";
|
||||
case ExecutionModePixelInterlockUnorderedEXT: return "PixelInterlockUnorderedEXT";
|
||||
|
|
@ -220,14 +209,12 @@ const char* StorageClassString(int StorageClass)
|
|||
case 11: return "Image";
|
||||
case 12: return "StorageBuffer";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case StorageClassRayPayloadNV: return "RayPayloadNV";
|
||||
case StorageClassHitAttributeNV: return "HitAttributeNV";
|
||||
case StorageClassIncomingRayPayloadNV: return "IncomingRayPayloadNV";
|
||||
case StorageClassShaderRecordBufferNV: return "ShaderRecordBufferNV";
|
||||
case StorageClassCallableDataNV: return "CallableDataNV";
|
||||
case StorageClassIncomingCallableDataNV: return "IncomingCallableDataNV";
|
||||
#endif
|
||||
|
||||
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
|
||||
|
||||
|
|
@ -289,10 +276,7 @@ const char* DecorationString(int decoration)
|
|||
case DecorationCeiling:
|
||||
default: return "Bad";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case DecorationExplicitInterpAMD: return "ExplicitInterpAMD";
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
case DecorationOverrideCoverageNV: return "OverrideCoverageNV";
|
||||
case DecorationPassthroughNV: return "PassthroughNV";
|
||||
case DecorationViewportRelativeNV: return "ViewportRelativeNV";
|
||||
|
|
@ -301,7 +285,6 @@ const char* DecorationString(int decoration)
|
|||
case DecorationPerViewNV: return "PerViewNV";
|
||||
case DecorationPerTaskNV: return "PerTaskNV";
|
||||
case DecorationPerVertexNV: return "PerVertexNV";
|
||||
#endif
|
||||
|
||||
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
|
||||
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
|
||||
|
|
@ -371,7 +354,6 @@ const char* BuiltInString(int builtIn)
|
|||
case 4426: return "DrawIndex";
|
||||
case 5014: return "FragStencilRefEXT";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case 4992: return "BaryCoordNoPerspAMD";
|
||||
case 4993: return "BaryCoordNoPerspCentroidAMD";
|
||||
case 4994: return "BaryCoordNoPerspSampleAMD";
|
||||
|
|
@ -379,9 +361,6 @@ const char* BuiltInString(int builtIn)
|
|||
case 4996: return "BaryCoordSmoothCentroidAMD";
|
||||
case 4997: return "BaryCoordSmoothSampleAMD";
|
||||
case 4998: return "BaryCoordPullModelAMD";
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case BuiltInLaunchIdNV: return "LaunchIdNV";
|
||||
case BuiltInLaunchSizeNV: return "LaunchSizeNV";
|
||||
case BuiltInWorldRayOriginNV: return "WorldRayOriginNV";
|
||||
|
|
@ -405,14 +384,12 @@ const char* BuiltInString(int builtIn)
|
|||
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
|
||||
case BuiltInBaryCoordNV: return "BaryCoordNV";
|
||||
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
|
||||
#endif
|
||||
|
||||
case BuiltInFragSizeEXT: return "FragSizeEXT";
|
||||
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||
|
||||
case 5264: return "FullyCoveredEXT";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case BuiltInTaskCountNV: return "TaskCountNV";
|
||||
case BuiltInPrimitiveCountNV: return "PrimitiveCountNV";
|
||||
case BuiltInPrimitiveIndicesNV: return "PrimitiveIndicesNV";
|
||||
|
|
@ -421,7 +398,6 @@ const char* BuiltInString(int builtIn)
|
|||
case BuiltInLayerPerViewNV: return "LayerPerViewNV";
|
||||
case BuiltInMeshViewCountNV: return "MeshViewCountNV";
|
||||
case BuiltInMeshViewIndicesNV: return "MeshViewIndicesNV";
|
||||
#endif
|
||||
case BuiltInWarpsPerSMNV: return "WarpsPerSMNV";
|
||||
case BuiltInSMCountNV: return "SMCountNV";
|
||||
case BuiltInWarpIDNV: return "WarpIDNV";
|
||||
|
|
@ -780,11 +756,9 @@ const char* GroupOperationString(int gop)
|
|||
case GroupOperationInclusiveScan: return "InclusiveScan";
|
||||
case GroupOperationExclusiveScan: return "ExclusiveScan";
|
||||
case GroupOperationClusteredReduce: return "ClusteredReduce";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case GroupOperationPartitionedReduceNV: return "PartitionedReduceNV";
|
||||
case GroupOperationPartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV";
|
||||
case GroupOperationPartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV";
|
||||
#endif
|
||||
|
||||
default: return "Bad";
|
||||
}
|
||||
|
|
@ -901,17 +875,14 @@ const char* CapabilityString(int info)
|
|||
|
||||
case CapabilityStencilExportEXT: return "StencilExportEXT";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case CapabilityFloat16ImageAMD: return "Float16ImageAMD";
|
||||
case CapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD";
|
||||
case CapabilityFragmentMaskAMD: return "FragmentMaskAMD";
|
||||
case CapabilityImageReadWriteLodAMD: return "ImageReadWriteLodAMD";
|
||||
#endif
|
||||
|
||||
case CapabilityAtomicStorageOps: return "AtomicStorageOps";
|
||||
|
||||
case CapabilitySampleMaskPostDepthCoverage: return "SampleMaskPostDepthCoverage";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV";
|
||||
case CapabilityShaderViewportIndexLayerNV: return "ShaderViewportIndexLayerNV";
|
||||
case CapabilityShaderViewportMaskNV: return "ShaderViewportMaskNV";
|
||||
|
|
@ -926,7 +897,6 @@ const char* CapabilityString(int info)
|
|||
case CapabilityImageFootprintNV: return "ImageFootprintNV";
|
||||
// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT
|
||||
case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV";
|
||||
#endif
|
||||
case CapabilityFragmentDensityEXT: return "FragmentDensityEXT";
|
||||
|
||||
case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT";
|
||||
|
|
@ -1336,7 +1306,6 @@ const char* OpcodeString(int op)
|
|||
case 4430: return "OpSubgroupAllEqualKHR";
|
||||
case 4432: return "OpSubgroupReadInvocationKHR";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case 5000: return "OpGroupIAddNonUniformAMD";
|
||||
case 5001: return "OpGroupFAddNonUniformAMD";
|
||||
case 5002: return "OpGroupFMinNonUniformAMD";
|
||||
|
|
@ -1348,14 +1317,12 @@ const char* OpcodeString(int op)
|
|||
|
||||
case 5011: return "OpFragmentMaskFetchAMD";
|
||||
case 5012: return "OpFragmentFetchAMD";
|
||||
#endif
|
||||
|
||||
case OpReadClockKHR: return "OpReadClockKHR";
|
||||
|
||||
case OpDecorateStringGOOGLE: return "OpDecorateStringGOOGLE";
|
||||
case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV";
|
||||
case OpReportIntersectionNV: return "OpReportIntersectionNV";
|
||||
case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV";
|
||||
|
|
@ -1365,7 +1332,6 @@ const char* OpcodeString(int op)
|
|||
case OpExecuteCallableNV: return "OpExecuteCallableNV";
|
||||
case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV";
|
||||
case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV";
|
||||
#endif
|
||||
|
||||
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
|
||||
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
|
||||
|
|
@ -2685,7 +2651,6 @@ void Parameterize()
|
|||
|
||||
InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'");
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'");
|
||||
|
|
@ -2724,9 +2689,7 @@ void Parameterize()
|
|||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'");
|
||||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'");
|
||||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'");
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X");
|
||||
|
||||
InstructionDesc[OpTypeAccelerationStructureNV].setResultAndType(true, false);
|
||||
|
|
@ -2764,7 +2727,6 @@ void Parameterize()
|
|||
|
||||
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'");
|
||||
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'");
|
||||
#endif
|
||||
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'");
|
||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'");
|
||||
|
|
|
|||
|
|
@ -234,7 +234,6 @@ std::string GetDefaultTBuiltInResourceString()
|
|||
<< "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n"
|
||||
<< "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
|
||||
<< "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n"
|
||||
#ifdef NV_EXTENSIONS
|
||||
<< "MaxMeshOutputVerticesNV " << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n"
|
||||
<< "MaxMeshOutputPrimitivesNV " << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n"
|
||||
<< "MaxMeshWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n"
|
||||
|
|
@ -244,7 +243,6 @@ std::string GetDefaultTBuiltInResourceString()
|
|||
<< "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n"
|
||||
<< "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n"
|
||||
<< "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n"
|
||||
#endif
|
||||
<< "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
|
||||
<< "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
|
||||
<< "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
|
||||
|
|
@ -451,7 +449,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
|
|||
resources->maxCombinedClipAndCullDistances = value;
|
||||
else if (tokenStr == "MaxSamples")
|
||||
resources->maxSamples = value;
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (tokenStr == "MaxMeshOutputVerticesNV")
|
||||
resources->maxMeshOutputVerticesNV = value;
|
||||
else if (tokenStr == "MaxMeshOutputPrimitivesNV")
|
||||
|
|
@ -470,7 +467,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
|
|||
resources->maxTaskWorkGroupSizeZ_NV = value;
|
||||
else if (tokenStr == "MaxMeshViewCountNV")
|
||||
resources->maxMeshViewCountNV = value;
|
||||
#endif
|
||||
else if (tokenStr == "nonInductiveForLoops")
|
||||
resources->limits.nonInductiveForLoops = (value != 0);
|
||||
else if (tokenStr == "whileLoops")
|
||||
|
|
|
|||
|
|
@ -146,11 +146,13 @@ void ProcessConfigFile()
|
|||
{
|
||||
if (ConfigFile.size() == 0)
|
||||
Resources = glslang::DefaultTBuiltInResource;
|
||||
#ifndef GLSLANG_WEB
|
||||
else {
|
||||
char* configString = ReadFileData(ConfigFile.c_str());
|
||||
glslang::DecodeResourceLimits(&Resources, configString);
|
||||
FreeFileData(configString);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int ReflectOptions = EShReflectionDefault;
|
||||
|
|
@ -255,7 +257,6 @@ const char* GetBinaryName(EShLanguage stage)
|
|||
case EShLangGeometry: name = "geom.spv"; break;
|
||||
case EShLangFragment: name = "frag.spv"; break;
|
||||
case EShLangCompute: name = "comp.spv"; break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangRayGenNV: name = "rgen.spv"; break;
|
||||
case EShLangIntersectNV: name = "rint.spv"; break;
|
||||
case EShLangAnyHitNV: name = "rahit.spv"; break;
|
||||
|
|
@ -264,7 +265,6 @@ const char* GetBinaryName(EShLanguage stage)
|
|||
case EShLangCallableNV: name = "rcall.spv"; break;
|
||||
case EShLangMeshNV: name = "mesh.spv"; break;
|
||||
case EShLangTaskNV: name = "task.spv"; break;
|
||||
#endif
|
||||
default: name = "unknown"; break;
|
||||
}
|
||||
} else
|
||||
|
|
@ -977,6 +977,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
shader->setPreamble(UserPreamble.get());
|
||||
shader->addProcesses(Processes);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Set IO mapper binding shift values
|
||||
for (int r = 0; r < glslang::EResCount; ++r) {
|
||||
const glslang::TResourceType res = glslang::TResourceType(r);
|
||||
|
|
@ -990,30 +991,33 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
i != baseBindingForSet[res][compUnit.stage].end(); ++i)
|
||||
shader->setShiftBindingForSet(res, i->second, i->first);
|
||||
}
|
||||
|
||||
shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
|
||||
shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
|
||||
shader->setNanMinMaxClamp(NaNClamp);
|
||||
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
||||
|
||||
if (Options & EOptionHlslIoMapping)
|
||||
shader->setHlslIoMapping(true);
|
||||
|
||||
if (Options & EOptionAutoMapBindings)
|
||||
shader->setAutoMapBindings(true);
|
||||
|
||||
if (Options & EOptionAutoMapLocations)
|
||||
shader->setAutoMapLocations(true);
|
||||
|
||||
if (Options & EOptionInvertY)
|
||||
shader->setInvertY(true);
|
||||
|
||||
for (auto& uniOverride : uniformLocationOverrides) {
|
||||
shader->addUniformLocationOverride(uniOverride.first.c_str(),
|
||||
uniOverride.second);
|
||||
}
|
||||
|
||||
shader->setUniformLocationBase(uniformBase);
|
||||
#endif
|
||||
|
||||
shader->setNanMinMaxClamp(NaNClamp);
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
|
||||
if (Options & EOptionHlslIoMapping)
|
||||
shader->setHlslIoMapping(true);
|
||||
#endif
|
||||
|
||||
if (Options & EOptionInvertY)
|
||||
shader->setInvertY(true);
|
||||
|
||||
// Set up the environment, some subsettings take precedence over earlier
|
||||
// ways of setting things.
|
||||
|
|
@ -1023,8 +1027,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
compUnit.stage, Client, ClientInputSemanticsVersion);
|
||||
shader->setEnvClient(Client, ClientVersion);
|
||||
shader->setEnvTarget(TargetLanguage, TargetVersion);
|
||||
#ifdef ENABLE_HLSL
|
||||
if (targetHlslFunctionality1)
|
||||
shader->setEnvTargetHlslFunctionality1();
|
||||
#endif
|
||||
}
|
||||
|
||||
shaders.push_back(shader);
|
||||
|
|
@ -1034,6 +1040,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
DirStackFileIncluder includer;
|
||||
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
|
||||
includer.pushExternalLocalDirectory(dir); });
|
||||
#ifndef GLSLANG_WEB
|
||||
if (Options & EOptionOutputPreprocessed) {
|
||||
std::string str;
|
||||
if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, messages, &str, includer)) {
|
||||
|
|
@ -1045,6 +1052,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
StderrIfNonEmpty(shader->getInfoDebugLog());
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! shader->parse(&Resources, defaultVersion, false, messages, includer))
|
||||
CompileFailed = true;
|
||||
|
|
@ -1067,11 +1075,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages))
|
||||
LinkFailed = true;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Map IO
|
||||
if (Options & EOptionSpv) {
|
||||
if (!program.mapIO())
|
||||
LinkFailed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Report
|
||||
if (! (Options & EOptionSuppressInfolog) &&
|
||||
|
|
@ -1080,11 +1090,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
PutsIfNonEmpty(program.getInfoDebugLog());
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Reflect
|
||||
if (Options & EOptionDumpReflection) {
|
||||
program.buildReflection(ReflectOptions);
|
||||
program.dumpReflection();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Dump SPIR-V
|
||||
if (Options & EOptionSpv) {
|
||||
|
|
@ -1114,8 +1126,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
|||
} else {
|
||||
glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage));
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv))
|
||||
spv::Disassemble(std::cout, spirv);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1203,11 +1217,13 @@ int singleMain()
|
|||
workList.add(item.get());
|
||||
});
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
if (Options & EOptionDumpConfig) {
|
||||
printf("%s", glslang::GetDefaultTBuiltInResourceString().c_str());
|
||||
if (workList.empty())
|
||||
return ESuccess;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Options & EOptionDumpBareVersion) {
|
||||
printf("%d.%d.%d\n",
|
||||
|
|
@ -1379,7 +1395,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
|
|||
return EShLangFragment;
|
||||
else if (stageName == "comp")
|
||||
return EShLangCompute;
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (stageName == "rgen")
|
||||
return EShLangRayGenNV;
|
||||
else if (stageName == "rint")
|
||||
|
|
@ -1396,7 +1411,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
|
|||
return EShLangMeshNV;
|
||||
else if (stageName == "task")
|
||||
return EShLangTaskNV;
|
||||
#endif
|
||||
|
||||
usage();
|
||||
return EShLangVertex;
|
||||
|
|
@ -1466,7 +1480,6 @@ void usage()
|
|||
" .geom for a geometry shader\n"
|
||||
" .frag for a fragment shader\n"
|
||||
" .comp for a compute shader\n"
|
||||
#ifdef NV_EXTENSIONS
|
||||
" .mesh for a mesh shader\n"
|
||||
" .task for a task shader\n"
|
||||
" .rgen for a ray generation shader\n"
|
||||
|
|
@ -1475,7 +1488,6 @@ void usage()
|
|||
" .rchit for a ray closest hit shader\n"
|
||||
" .rmiss for a ray miss shader\n"
|
||||
" .rcall for a ray callable shader\n"
|
||||
#endif
|
||||
" .glsl for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n"
|
||||
" .hlsl for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ glspv.vert
|
|||
ERROR: 0:3: 'push_constant' : only allowed when using GLSL for Vulkan
|
||||
ERROR: 0:6: 'descriptor set' : only allowed when using GLSL for Vulkan
|
||||
ERROR: 0:8: 'shared' : not allowed when generating SPIR-V
|
||||
ERROR: 0:8: 'binding' : uniform/buffer blocks require layout(binding=X)
|
||||
ERROR: 0:9: 'packed' : not allowed when generating SPIR-V
|
||||
ERROR: 0:9: 'binding' : uniform/buffer blocks require layout(binding=X)
|
||||
ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier
|
||||
ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier
|
||||
ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier
|
||||
ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
|
||||
ERROR: 8 compilation errors. No code generated.
|
||||
ERROR: 10 compilation errors. No code generated.
|
||||
|
||||
|
||||
SPIR-V is not generated for failed compile or link
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ using depth_greater
|
|||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 18
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
ExecutionMode 4 DepthGreater
|
||||
ExecutionMode 4 DepthReplacing
|
||||
ExecutionMode 4 DepthGreater
|
||||
Source HLSL 500
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 10 "@PixelShaderFunction(f1;"
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ using depth_less
|
|||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 14
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
ExecutionMode 4 DepthLess
|
||||
ExecutionMode 4 DepthReplacing
|
||||
ExecutionMode 4 DepthLess
|
||||
Source HLSL 500
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 8 "@PixelShaderFunction("
|
||||
|
|
|
|||
|
|
@ -170,8 +170,8 @@ using depth_greater
|
|||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 22 27 31 36 45 48 51 55
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
ExecutionMode 4 DepthGreater
|
||||
ExecutionMode 4 DepthReplacing
|
||||
ExecutionMode 4 DepthGreater
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 8 "T"
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ gl_FragCoord origin is upper left
|
|||
0:? 'b' ( global 5-element array of highp int)
|
||||
0:? 'c' ( global unsized 4-element array of highp int)
|
||||
0:? 'i' ( global highp int)
|
||||
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
|
||||
0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m})
|
||||
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
|
||||
0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m})
|
||||
|
||||
link2.vk.frag
|
||||
Shader version: 450
|
||||
|
|
@ -99,8 +99,8 @@ gl_FragCoord origin is upper left
|
|||
0:? 'b' ( global unsized 3-element array of highp int)
|
||||
0:? 'c' ( global 7-element array of highp int)
|
||||
0:? 'i' ( global highp int)
|
||||
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
|
||||
0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
|
||||
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
|
||||
0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
|
@ -192,8 +192,8 @@ gl_FragCoord origin is upper left
|
|||
0:? 'b' ( global 5-element array of highp int)
|
||||
0:? 'c' ( global 7-element array of highp int)
|
||||
0:? 'i' ( global highp int)
|
||||
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
|
||||
0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
|
||||
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
|
||||
0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
|
||||
0:? 's2D' (layout( binding=1) uniform highp sampler2D)
|
||||
|
||||
// Module Version 10000
|
||||
|
|
@ -233,7 +233,7 @@ gl_FragCoord origin is upper left
|
|||
MemberDecorate 67(bnameImplicit) 0 Offset 0
|
||||
Decorate 67(bnameImplicit) BufferBlock
|
||||
Decorate 69 DescriptorSet 0
|
||||
Decorate 69 Binding 0
|
||||
Decorate 69 Binding 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
|
|
|
|||
1
Test/baseResults/size
Normal file
1
Test/baseResults/size
Normal file
|
|
@ -0,0 +1 @@
|
|||
388096 ../build/install/bin/glslangValidator.exe
|
||||
|
|
@ -81,6 +81,7 @@ void main()
|
|||
Name 97 "i"
|
||||
ModuleProcessed "no-storage-format"
|
||||
ModuleProcessed "resource-set-binding 3"
|
||||
ModuleProcessed "auto-map-bindings"
|
||||
ModuleProcessed "auto-map-locations"
|
||||
ModuleProcessed "client opengl100"
|
||||
ModuleProcessed "target-env spirv1.3"
|
||||
|
|
@ -99,7 +100,7 @@ void main()
|
|||
Decorate 56 Binding 0
|
||||
Decorate 67(s2d) Location 0
|
||||
Decorate 67(s2d) DescriptorSet 3
|
||||
Decorate 67(s2d) Binding 0
|
||||
Decorate 67(s2d) Binding 1
|
||||
3: TypeVoid
|
||||
4: TypeFunction 3
|
||||
7: TypeInt 32 1
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ spv.depthOut.frag
|
|||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 8 10 14
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
ExecutionMode 4 DepthGreater
|
||||
ExecutionMode 4 DepthReplacing
|
||||
ExecutionMode 4 DepthGreater
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 8 "gl_FragDepth"
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ spv.hlslDebugInfo.vert
|
|||
// OpModuleProcessed shift-UBO-binding 6
|
||||
// OpModuleProcessed shift-ssbo-binding 3
|
||||
// OpModuleProcessed shift-uav-binding 5
|
||||
// OpModuleProcessed flatten-uniform-arrays
|
||||
// OpModuleProcessed no-storage-format
|
||||
// OpModuleProcessed resource-set-binding t0 0 0
|
||||
// OpModuleProcessed hlsl-iomap
|
||||
// OpModuleProcessed auto-map-bindings
|
||||
// OpModuleProcessed auto-map-locations
|
||||
// OpModuleProcessed flatten-uniform-arrays
|
||||
// OpModuleProcessed hlsl-iomap
|
||||
// OpModuleProcessed client vulkan100
|
||||
// OpModuleProcessed target-env vulkan1.0
|
||||
// OpModuleProcessed source-entrypoint origMain
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Shader version: 450
|
|||
0:27 Function Definition: main( ( global void)
|
||||
0:27 Function Parameters:
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
|
||||
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
|
@ -15,7 +15,7 @@ Shader version: 450
|
|||
0:27 Function Definition: main( ( global void)
|
||||
0:27 Function Parameters:
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
|
||||
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80007
|
||||
|
|
|
|||
102
Test/baseResults/web.array.frag.out
Normal file
102
Test/baseResults/web.array.frag.out
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 74
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %colorOut
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %foo_f1_5__ "foo(f1[5];"
|
||||
OpName %a "a"
|
||||
OpName %g4 "g4"
|
||||
OpName %g5 "g5"
|
||||
OpName %param "param"
|
||||
OpName %u "u"
|
||||
OpName %param_0 "param"
|
||||
OpName %colorOut "colorOut"
|
||||
OpDecorate %colorOut Location 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_arr_float_uint_5 = OpTypeArray %float %uint_5
|
||||
%_ptr_Function__arr_float_uint_5 = OpTypePointer Function %_arr_float_uint_5
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%13 = OpTypeFunction %_arr_float_uint_4 %_ptr_Function__arr_float_uint_5
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Private__arr_float_uint_4 = OpTypePointer Private %_arr_float_uint_4
|
||||
%g4 = OpVariable %_ptr_Private__arr_float_uint_4 Private
|
||||
%_ptr_Private__arr_float_uint_5 = OpTypePointer Private %_arr_float_uint_5
|
||||
%g5 = OpVariable %_ptr_Private__arr_float_uint_5 Private
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%float_3 = OpConstant %float 3
|
||||
%float_4 = OpConstant %float 4
|
||||
%45 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_2 %float_3 %float_4
|
||||
%bool = OpTypeBool
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%colorOut = OpVariable %_ptr_Output_v2float Output
|
||||
%float_5 = OpConstant %float 5
|
||||
%73 = OpConstantComposite %v2float %float_4 %float_5
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%param = OpVariable %_ptr_Function__arr_float_uint_5 Function
|
||||
%u = OpVariable %_ptr_Function__arr_float_uint_5 Function
|
||||
%param_0 = OpVariable %_ptr_Function__arr_float_uint_5 Function
|
||||
%39 = OpLoad %_arr_float_uint_5 %g5
|
||||
OpStore %param %39
|
||||
%40 = OpFunctionCall %_arr_float_uint_4 %foo_f1_5__ %param
|
||||
OpStore %g4 %40
|
||||
%46 = OpLoad %_arr_float_uint_4 %g4
|
||||
%48 = OpCompositeExtract %float %45 0
|
||||
%49 = OpCompositeExtract %float %46 0
|
||||
%50 = OpFOrdEqual %bool %48 %49
|
||||
%51 = OpCompositeExtract %float %45 1
|
||||
%52 = OpCompositeExtract %float %46 1
|
||||
%53 = OpFOrdEqual %bool %51 %52
|
||||
%54 = OpLogicalAnd %bool %50 %53
|
||||
%55 = OpCompositeExtract %float %45 2
|
||||
%56 = OpCompositeExtract %float %46 2
|
||||
%57 = OpFOrdEqual %bool %55 %56
|
||||
%58 = OpLogicalAnd %bool %54 %57
|
||||
%59 = OpCompositeExtract %float %45 3
|
||||
%60 = OpCompositeExtract %float %46 3
|
||||
%61 = OpFOrdEqual %bool %59 %60
|
||||
%62 = OpLogicalAnd %bool %58 %61
|
||||
OpSelectionMerge %64 None
|
||||
OpBranchConditional %62 %63 %64
|
||||
%63 = OpLabel
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
%67 = OpLoad %_arr_float_uint_5 %u
|
||||
OpStore %param_0 %67
|
||||
%68 = OpFunctionCall %_arr_float_uint_4 %foo_f1_5__ %param_0
|
||||
OpStore %colorOut %73
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%foo_f1_5__ = OpFunction %_arr_float_uint_4 None %13
|
||||
%a = OpFunctionParameter %_ptr_Function__arr_float_uint_5
|
||||
%16 = OpLabel
|
||||
%20 = OpAccessChain %_ptr_Function_float %a %int_0
|
||||
%21 = OpLoad %float %20
|
||||
%23 = OpAccessChain %_ptr_Function_float %a %int_1
|
||||
%24 = OpLoad %float %23
|
||||
%26 = OpAccessChain %_ptr_Function_float %a %int_2
|
||||
%27 = OpLoad %float %26
|
||||
%29 = OpAccessChain %_ptr_Function_float %a %int_3
|
||||
%30 = OpLoad %float %29
|
||||
%31 = OpCompositeConstruct %_arr_float_uint_4 %21 %24 %27 %30
|
||||
OpReturnValue %31
|
||||
OpFunctionEnd
|
||||
65
Test/baseResults/web.basic.vert.out
Normal file
65
Test/baseResults/web.basic.vert.out
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 38
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %outv4 %inv4
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %outv4 "outv4"
|
||||
OpName %inv4 "inv4"
|
||||
OpName %uBlock "uBlock"
|
||||
OpMemberName %uBlock 0 "a"
|
||||
OpMemberName %uBlock 1 "b"
|
||||
OpMemberName %uBlock 2 "c"
|
||||
OpName %uInst "uInst"
|
||||
OpDecorate %outv4 Location 1
|
||||
OpDecorate %inv4 Location 2
|
||||
OpMemberDecorate %uBlock 0 Offset 0
|
||||
OpMemberDecorate %uBlock 1 Offset 16
|
||||
OpMemberDecorate %uBlock 2 Offset 32
|
||||
OpDecorate %uBlock Block
|
||||
OpDecorate %uInst DescriptorSet 0
|
||||
OpDecorate %uInst Binding 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%outv4 = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%inv4 = OpVariable %_ptr_Input_v4float Input
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%uBlock = OpTypeStruct %v4float %v4int %v4uint
|
||||
%_ptr_Uniform_uBlock = OpTypePointer Uniform %uBlock
|
||||
%uInst = OpVariable %_ptr_Uniform_uBlock Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %v4float %inv4
|
||||
%13 = OpExtInst %v4float %1 Normalize %12
|
||||
%23 = OpAccessChain %_ptr_Uniform_v4float %uInst %int_0
|
||||
%24 = OpLoad %v4float %23
|
||||
%25 = OpFMul %v4float %13 %24
|
||||
%28 = OpAccessChain %_ptr_Uniform_v4int %uInst %int_1
|
||||
%29 = OpLoad %v4int %28
|
||||
%30 = OpConvertSToF %v4float %29
|
||||
%31 = OpFMul %v4float %25 %30
|
||||
%34 = OpAccessChain %_ptr_Uniform_v4uint %uInst %int_2
|
||||
%35 = OpLoad %v4uint %34
|
||||
%36 = OpConvertUToF %v4float %35
|
||||
%37 = OpFMul %v4float %31 %36
|
||||
OpStore %outv4 %37
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
149
Test/baseResults/web.builtins.frag.out
Normal file
149
Test/baseResults/web.builtins.frag.out
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 69
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %gl_FragCoord %gl_FragDepth %sc %s2 %sf %c1D %c2D %c4D %c3D %ic1D %ic3D %ic4D
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpExecutionMode %main DepthReplacing
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %f "f"
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %gl_FragDepth "gl_FragDepth"
|
||||
OpName %sc "sc"
|
||||
OpName %S2 "S2"
|
||||
OpMemberName %S2 0 "c"
|
||||
OpMemberName %S2 1 "f"
|
||||
OpName %s2 "s2"
|
||||
OpName %sf "sf"
|
||||
OpName %c1D "c1D"
|
||||
OpName %c2D "c2D"
|
||||
OpName %c4D "c4D"
|
||||
OpName %c3D "c3D"
|
||||
OpName %ic1D "ic1D"
|
||||
OpName %ic3D "ic3D"
|
||||
OpName %ic4D "ic4D"
|
||||
OpDecorate %f RelaxedPrecision
|
||||
OpDecorate %gl_FragCoord BuiltIn FragCoord
|
||||
OpDecorate %gl_FragDepth BuiltIn FragDepth
|
||||
OpDecorate %19 RelaxedPrecision
|
||||
OpDecorate %sc RelaxedPrecision
|
||||
OpDecorate %sc Location 0
|
||||
OpMemberDecorate %S2 0 RelaxedPrecision
|
||||
OpMemberDecorate %S2 1 RelaxedPrecision
|
||||
OpDecorate %s2 Location 8
|
||||
OpDecorate %30 RelaxedPrecision
|
||||
OpDecorate %sf RelaxedPrecision
|
||||
OpDecorate %sf Location 1
|
||||
OpDecorate %34 RelaxedPrecision
|
||||
OpDecorate %c1D RelaxedPrecision
|
||||
OpDecorate %c1D Location 4
|
||||
OpDecorate %36 RelaxedPrecision
|
||||
OpDecorate %37 RelaxedPrecision
|
||||
OpDecorate %38 RelaxedPrecision
|
||||
OpDecorate %39 RelaxedPrecision
|
||||
OpDecorate %c2D RelaxedPrecision
|
||||
OpDecorate %c2D Location 5
|
||||
OpDecorate %43 RelaxedPrecision
|
||||
OpDecorate %44 RelaxedPrecision
|
||||
OpDecorate %45 RelaxedPrecision
|
||||
OpDecorate %46 RelaxedPrecision
|
||||
OpDecorate %47 RelaxedPrecision
|
||||
OpDecorate %c4D RelaxedPrecision
|
||||
OpDecorate %c4D Location 7
|
||||
OpDecorate %49 RelaxedPrecision
|
||||
OpDecorate %50 RelaxedPrecision
|
||||
OpDecorate %51 RelaxedPrecision
|
||||
OpDecorate %52 RelaxedPrecision
|
||||
OpDecorate %53 RelaxedPrecision
|
||||
OpDecorate %c3D RelaxedPrecision
|
||||
OpDecorate %c3D Location 6
|
||||
OpDecorate %55 RelaxedPrecision
|
||||
OpDecorate %56 RelaxedPrecision
|
||||
OpDecorate %ic1D RelaxedPrecision
|
||||
OpDecorate %ic1D Flat
|
||||
OpDecorate %ic1D Location 1
|
||||
OpDecorate %ic3D RelaxedPrecision
|
||||
OpDecorate %ic3D Flat
|
||||
OpDecorate %ic3D Location 2
|
||||
OpDecorate %ic4D RelaxedPrecision
|
||||
OpDecorate %ic4D Flat
|
||||
OpDecorate %ic4D Location 3
|
||||
OpDecorate %68 RelaxedPrecision
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_FragDepth = OpVariable %_ptr_Output_float Output
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%sc = OpVariable %_ptr_Output_v3float Output
|
||||
%S2 = OpTypeStruct %v3float %float
|
||||
%_ptr_Input_S2 = OpTypePointer Input %S2
|
||||
%s2 = OpVariable %_ptr_Input_S2 Input
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%sf = OpVariable %_ptr_Output_float Output
|
||||
%int_1 = OpConstant %int 1
|
||||
%c1D = OpVariable %_ptr_Input_float Input
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%c2D = OpVariable %_ptr_Input_v2float Input
|
||||
%c4D = OpVariable %_ptr_Input_v4float Input
|
||||
%c3D = OpVariable %_ptr_Input_v3float Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%ic1D = OpVariable %_ptr_Input_int Input
|
||||
%v3int = OpTypeVector %int 3
|
||||
%_ptr_Input_v3int = OpTypePointer Input %v3int
|
||||
%ic3D = OpVariable %_ptr_Input_v3int Input
|
||||
%v4int = OpTypeVector %int 4
|
||||
%_ptr_Input_v4int = OpTypePointer Input %v4int
|
||||
%ic4D = OpVariable %_ptr_Input_v4int Input
|
||||
%v2int = OpTypeVector %int 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%68 = OpConstantComposite %v2int %int_2 %int_3
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%f = OpVariable %_ptr_Function_float Function
|
||||
%15 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
|
||||
%16 = OpLoad %float %15
|
||||
OpStore %f %16
|
||||
%19 = OpLoad %float %f
|
||||
OpStore %gl_FragDepth %19
|
||||
%29 = OpAccessChain %_ptr_Input_v3float %s2 %int_0
|
||||
%30 = OpLoad %v3float %29
|
||||
OpStore %sc %30
|
||||
%33 = OpAccessChain %_ptr_Input_float %s2 %int_1
|
||||
%34 = OpLoad %float %33
|
||||
OpStore %sf %34
|
||||
%36 = OpLoad %float %c1D
|
||||
%37 = OpExtInst %float %1 Sinh %36
|
||||
%38 = OpLoad %float %c1D
|
||||
%39 = OpExtInst %float %1 Cosh %38
|
||||
%43 = OpLoad %v2float %c2D
|
||||
%44 = OpExtInst %v2float %1 Tanh %43
|
||||
%45 = OpVectorTimesScalar %v2float %44 %39
|
||||
%46 = OpCompositeConstruct %v2float %37 %37
|
||||
%47 = OpFAdd %v2float %46 %45
|
||||
%49 = OpLoad %v4float %c4D
|
||||
%50 = OpExtInst %v4float %1 Asinh %49
|
||||
%51 = OpLoad %v4float %c4D
|
||||
%52 = OpExtInst %v4float %1 Acosh %51
|
||||
%53 = OpFAdd %v4float %50 %52
|
||||
%55 = OpLoad %v3float %c3D
|
||||
%56 = OpExtInst %v3float %1 Atanh %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
62
Test/baseResults/web.builtins.vert.out
Normal file
62
Test/baseResults/web.builtins.vert.out
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 33
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %gl_Position %ps %gl_VertexIndex %gl_PointSize %gl_InstanceIndex
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %gl_Position "gl_Position"
|
||||
OpName %ps "ps"
|
||||
OpName %gl_VertexIndex "gl_VertexIndex"
|
||||
OpName %gl_PointSize "gl_PointSize"
|
||||
OpName %gl_InstanceIndex "gl_InstanceIndex"
|
||||
OpDecorate %gl_Position Invariant
|
||||
OpDecorate %gl_Position BuiltIn Position
|
||||
OpDecorate %ps RelaxedPrecision
|
||||
OpDecorate %ps Location 0
|
||||
OpDecorate %12 RelaxedPrecision
|
||||
OpDecorate %gl_VertexIndex BuiltIn VertexIndex
|
||||
OpDecorate %gl_PointSize BuiltIn PointSize
|
||||
OpDecorate %25 RelaxedPrecision
|
||||
OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%gl_Position = OpVariable %_ptr_Output_v4float Output
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%ps = OpVariable %_ptr_Input_float Input
|
||||
%int = OpTypeInt 32 1
|
||||
%int_4 = OpConstant %int 4
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%gl_VertexIndex = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%gl_PointSize = OpVariable %_ptr_Output_float Output
|
||||
%int_5 = OpConstant %int 5
|
||||
%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%12 = OpLoad %float %ps
|
||||
%13 = OpCompositeConstruct %v4float %12 %12 %12 %12
|
||||
OpStore %gl_Position %13
|
||||
%18 = OpLoad %int %gl_VertexIndex
|
||||
%19 = OpISub %int %int_4 %18
|
||||
%20 = OpConvertSToF %float %19
|
||||
%21 = OpLoad %v4float %gl_Position
|
||||
%22 = OpVectorTimesScalar %v4float %21 %20
|
||||
OpStore %gl_Position %22
|
||||
%25 = OpLoad %float %ps
|
||||
OpStore %gl_PointSize %25
|
||||
%28 = OpLoad %int %gl_InstanceIndex
|
||||
%29 = OpISub %int %int_5 %28
|
||||
%30 = OpConvertSToF %float %29
|
||||
%31 = OpLoad %float %gl_PointSize
|
||||
%32 = OpFMul %float %31 %30
|
||||
OpStore %gl_PointSize %32
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
347
Test/baseResults/web.controlFlow.frag.out
Normal file
347
Test/baseResults/web.controlFlow.frag.out
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 193
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x %BaseColor %Count %bigColor %outColor %v4 %f_0
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %c "c"
|
||||
OpName %f "f"
|
||||
OpName %x "x"
|
||||
OpName %d "d"
|
||||
OpName %color "color"
|
||||
OpName %BaseColor "BaseColor"
|
||||
OpName %i "i"
|
||||
OpName %Count "Count"
|
||||
OpName %bigColor "bigColor"
|
||||
OpName %outColor "outColor"
|
||||
OpName %sum "sum"
|
||||
OpName %i_0 "i"
|
||||
OpName %v4 "v4"
|
||||
OpName %i_1 "i"
|
||||
OpName %tv4 "tv4"
|
||||
OpName %r "r"
|
||||
OpName %i_2 "i"
|
||||
OpName %i_3 "i"
|
||||
OpName %i_4 "i"
|
||||
OpName %A "A"
|
||||
OpName %B "B"
|
||||
OpName %C "C"
|
||||
OpName %D "D"
|
||||
OpName %f_0 "f"
|
||||
OpDecorate %f RelaxedPrecision
|
||||
OpDecorate %x Location 0
|
||||
OpDecorate %color RelaxedPrecision
|
||||
OpDecorate %BaseColor RelaxedPrecision
|
||||
OpDecorate %BaseColor Location 2
|
||||
OpDecorate %47 RelaxedPrecision
|
||||
OpDecorate %Count Flat
|
||||
OpDecorate %Count Location 4
|
||||
OpDecorate %bigColor RelaxedPrecision
|
||||
OpDecorate %bigColor Location 1
|
||||
OpDecorate %63 RelaxedPrecision
|
||||
OpDecorate %64 RelaxedPrecision
|
||||
OpDecorate %65 RelaxedPrecision
|
||||
OpDecorate %outColor RelaxedPrecision
|
||||
OpDecorate %outColor Location 0
|
||||
OpDecorate %71 RelaxedPrecision
|
||||
OpDecorate %sum RelaxedPrecision
|
||||
OpDecorate %v4 Flat
|
||||
OpDecorate %v4 Location 5
|
||||
OpDecorate %91 RelaxedPrecision
|
||||
OpDecorate %92 RelaxedPrecision
|
||||
OpDecorate %93 RelaxedPrecision
|
||||
OpDecorate %tv4 RelaxedPrecision
|
||||
OpDecorate %111 RelaxedPrecision
|
||||
OpDecorate %115 RelaxedPrecision
|
||||
OpDecorate %116 RelaxedPrecision
|
||||
OpDecorate %117 RelaxedPrecision
|
||||
OpDecorate %118 RelaxedPrecision
|
||||
OpDecorate %119 RelaxedPrecision
|
||||
OpDecorate %120 RelaxedPrecision
|
||||
OpDecorate %r RelaxedPrecision
|
||||
OpDecorate %123 RelaxedPrecision
|
||||
OpDecorate %124 RelaxedPrecision
|
||||
OpDecorate %136 RelaxedPrecision
|
||||
OpDecorate %141 RelaxedPrecision
|
||||
OpDecorate %142 RelaxedPrecision
|
||||
OpDecorate %143 RelaxedPrecision
|
||||
OpDecorate %144 RelaxedPrecision
|
||||
OpDecorate %145 RelaxedPrecision
|
||||
OpDecorate %157 RelaxedPrecision
|
||||
OpDecorate %158 RelaxedPrecision
|
||||
OpDecorate %159 RelaxedPrecision
|
||||
OpDecorate %f_0 RelaxedPrecision
|
||||
OpDecorate %f_0 Location 3
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%c = OpVariable %_ptr_Private_int Private
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x = OpVariable %_ptr_Input_float Input
|
||||
%d = OpVariable %_ptr_Private_int Private
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%BaseColor = OpVariable %_ptr_Input_v4float Input
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%Count = OpVariable %_ptr_Input_int Input
|
||||
%bool = OpTypeBool
|
||||
%bigColor = OpVariable %_ptr_Input_v4float Input
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%outColor = OpVariable %_ptr_Output_v4float Output
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_4 = OpConstant %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Input_v4uint = OpTypePointer Input %v4uint
|
||||
%v4 = OpVariable %_ptr_Input_v4uint Input
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%v3float = OpTypeVector %float 3
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%int_16 = OpConstant %int 16
|
||||
%int_10 = OpConstant %int 10
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_5 = OpConstant %int 5
|
||||
%int_3 = OpConstant %int 3
|
||||
%f_0 = OpVariable %_ptr_Input_float Input
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%f = OpVariable %_ptr_Function_float Function
|
||||
%color = OpVariable %_ptr_Function_v4float Function
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
%sum = OpVariable %_ptr_Function_float Function
|
||||
%i_0 = OpVariable %_ptr_Function_int Function
|
||||
%i_1 = OpVariable %_ptr_Function_int Function
|
||||
%tv4 = OpVariable %_ptr_Function_v4float Function
|
||||
%r = OpVariable %_ptr_Function_v4float Function
|
||||
%i_2 = OpVariable %_ptr_Function_int Function
|
||||
%i_3 = OpVariable %_ptr_Function_int Function
|
||||
%i_4 = OpVariable %_ptr_Function_int Function
|
||||
%A = OpVariable %_ptr_Function_int Function
|
||||
%B = OpVariable %_ptr_Function_int Function
|
||||
%C = OpVariable %_ptr_Function_int Function
|
||||
%D = OpVariable %_ptr_Function_int Function
|
||||
%9 = OpLoad %int %c
|
||||
OpSelectionMerge %13 None
|
||||
OpSwitch %9 %12 1 %10 2 %11
|
||||
%12 = OpLabel
|
||||
%39 = OpLoad %float %x
|
||||
%40 = OpExtInst %float %1 Tan %39
|
||||
OpStore %f %40
|
||||
OpBranch %13
|
||||
%10 = OpLabel
|
||||
%19 = OpLoad %float %x
|
||||
%20 = OpExtInst %float %1 Sin %19
|
||||
OpStore %f %20
|
||||
OpBranch %13
|
||||
%11 = OpLabel
|
||||
%23 = OpLoad %int %d
|
||||
OpSelectionMerge %26 None
|
||||
OpSwitch %23 %26 1 %24 2 %25
|
||||
%24 = OpLabel
|
||||
%27 = OpLoad %float %x
|
||||
%28 = OpLoad %float %x
|
||||
%29 = OpFMul %float %27 %28
|
||||
%30 = OpLoad %float %x
|
||||
%31 = OpFMul %float %29 %30
|
||||
OpStore %f %31
|
||||
OpBranch %26
|
||||
%25 = OpLabel
|
||||
%33 = OpLoad %float %x
|
||||
%34 = OpLoad %float %x
|
||||
%35 = OpFMul %float %33 %34
|
||||
OpStore %f %35
|
||||
OpBranch %26
|
||||
%26 = OpLabel
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
%47 = OpLoad %v4float %BaseColor
|
||||
OpStore %color %47
|
||||
OpStore %i %int_0
|
||||
OpBranch %51
|
||||
%51 = OpLabel
|
||||
OpLoopMerge %53 %54 None
|
||||
OpBranch %55
|
||||
%55 = OpLabel
|
||||
%56 = OpLoad %int %i
|
||||
%59 = OpLoad %int %Count
|
||||
%61 = OpSLessThan %bool %56 %59
|
||||
OpBranchConditional %61 %52 %53
|
||||
%52 = OpLabel
|
||||
%63 = OpLoad %v4float %bigColor
|
||||
%64 = OpLoad %v4float %color
|
||||
%65 = OpFAdd %v4float %64 %63
|
||||
OpStore %color %65
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
%66 = OpLoad %int %i
|
||||
%68 = OpIAdd %int %66 %int_1
|
||||
OpStore %i %68
|
||||
OpBranch %51
|
||||
%53 = OpLabel
|
||||
%71 = OpLoad %v4float %color
|
||||
OpStore %outColor %71
|
||||
OpStore %sum %float_0
|
||||
OpStore %i_0 %int_0
|
||||
OpBranch %75
|
||||
%75 = OpLabel
|
||||
OpLoopMerge %77 %78 None
|
||||
OpBranch %79
|
||||
%79 = OpLabel
|
||||
%80 = OpLoad %int %i_0
|
||||
%82 = OpSLessThan %bool %80 %int_4
|
||||
OpBranchConditional %82 %76 %77
|
||||
%76 = OpLabel
|
||||
%87 = OpLoad %int %i_0
|
||||
%89 = OpAccessChain %_ptr_Input_uint %v4 %87
|
||||
%90 = OpLoad %uint %89
|
||||
%91 = OpConvertUToF %float %90
|
||||
%92 = OpLoad %float %sum
|
||||
%93 = OpFAdd %float %92 %91
|
||||
OpStore %sum %93
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
%94 = OpLoad %int %i_0
|
||||
%95 = OpIAdd %int %94 %int_1
|
||||
OpStore %i_0 %95
|
||||
OpBranch %75
|
||||
%77 = OpLabel
|
||||
OpStore %i_1 %int_0
|
||||
OpBranch %97
|
||||
%97 = OpLabel
|
||||
OpLoopMerge %99 %100 None
|
||||
OpBranch %101
|
||||
%101 = OpLabel
|
||||
%102 = OpLoad %int %i_1
|
||||
%103 = OpSLessThan %bool %102 %int_4
|
||||
OpBranchConditional %103 %98 %99
|
||||
%98 = OpLabel
|
||||
%105 = OpLoad %int %i_1
|
||||
%106 = OpLoad %int %i_1
|
||||
%107 = OpAccessChain %_ptr_Input_uint %v4 %106
|
||||
%108 = OpLoad %uint %107
|
||||
%110 = OpIMul %uint %108 %uint_4
|
||||
%111 = OpConvertUToF %float %110
|
||||
%112 = OpAccessChain %_ptr_Function_float %tv4 %105
|
||||
OpStore %112 %111
|
||||
OpBranch %100
|
||||
%100 = OpLabel
|
||||
%113 = OpLoad %int %i_1
|
||||
%114 = OpIAdd %int %113 %int_1
|
||||
OpStore %i_1 %114
|
||||
OpBranch %97
|
||||
%99 = OpLabel
|
||||
%115 = OpLoad %float %sum
|
||||
%116 = OpCompositeConstruct %v4float %115 %115 %115 %115
|
||||
%117 = OpLoad %v4float %tv4
|
||||
%118 = OpFAdd %v4float %116 %117
|
||||
%119 = OpLoad %v4float %outColor
|
||||
%120 = OpFAdd %v4float %119 %118
|
||||
OpStore %outColor %120
|
||||
%123 = OpLoad %v4float %BaseColor
|
||||
%124 = OpVectorShuffle %v3float %123 %123 0 1 2
|
||||
%125 = OpLoad %v4float %r
|
||||
%126 = OpVectorShuffle %v4float %125 %124 4 5 6 3
|
||||
OpStore %r %126
|
||||
OpStore %i_2 %int_0
|
||||
OpBranch %128
|
||||
%128 = OpLabel
|
||||
OpLoopMerge %130 %131 None
|
||||
OpBranch %132
|
||||
%132 = OpLabel
|
||||
%133 = OpLoad %int %i_2
|
||||
%134 = OpLoad %int %Count
|
||||
%135 = OpSLessThan %bool %133 %134
|
||||
OpBranchConditional %135 %129 %130
|
||||
%129 = OpLabel
|
||||
%136 = OpLoad %float %f
|
||||
%138 = OpAccessChain %_ptr_Function_float %r %uint_3
|
||||
OpStore %138 %136
|
||||
OpBranch %131
|
||||
%131 = OpLabel
|
||||
%139 = OpLoad %int %i_2
|
||||
%140 = OpIAdd %int %139 %int_1
|
||||
OpStore %i_2 %140
|
||||
OpBranch %128
|
||||
%130 = OpLabel
|
||||
%141 = OpLoad %v4float %r
|
||||
%142 = OpVectorShuffle %v3float %141 %141 0 1 2
|
||||
%143 = OpLoad %v4float %outColor
|
||||
%144 = OpVectorShuffle %v3float %143 %143 0 1 2
|
||||
%145 = OpFAdd %v3float %144 %142
|
||||
%146 = OpLoad %v4float %outColor
|
||||
%147 = OpVectorShuffle %v4float %146 %145 4 5 6 3
|
||||
OpStore %outColor %147
|
||||
OpStore %i_3 %int_0
|
||||
OpBranch %149
|
||||
%149 = OpLabel
|
||||
OpLoopMerge %151 %152 None
|
||||
OpBranch %153
|
||||
%153 = OpLabel
|
||||
%154 = OpLoad %int %i_3
|
||||
%156 = OpSLessThan %bool %154 %int_16
|
||||
OpBranchConditional %156 %150 %151
|
||||
%150 = OpLabel
|
||||
%157 = OpLoad %float %f
|
||||
%158 = OpLoad %v4float %outColor
|
||||
%159 = OpVectorTimesScalar %v4float %158 %157
|
||||
OpStore %outColor %159
|
||||
OpBranch %152
|
||||
%152 = OpLabel
|
||||
%160 = OpLoad %int %i_3
|
||||
%161 = OpIAdd %int %160 %int_4
|
||||
OpStore %i_3 %161
|
||||
OpBranch %149
|
||||
%151 = OpLabel
|
||||
OpStore %i_4 %int_0
|
||||
OpBranch %163
|
||||
%163 = OpLabel
|
||||
OpLoopMerge %165 %166 None
|
||||
OpBranch %167
|
||||
%167 = OpLabel
|
||||
%168 = OpLoad %int %i_4
|
||||
%170 = OpSLessThan %bool %168 %int_10
|
||||
OpBranchConditional %170 %164 %165
|
||||
%164 = OpLabel
|
||||
OpStore %A %int_1
|
||||
%172 = OpLoad %int %i_4
|
||||
%174 = OpSMod %int %172 %int_2
|
||||
%175 = OpIEqual %bool %174 %int_0
|
||||
OpSelectionMerge %177 None
|
||||
OpBranchConditional %175 %176 %177
|
||||
%176 = OpLabel
|
||||
OpStore %B %int_2
|
||||
OpBranch %166
|
||||
%177 = OpLabel
|
||||
%181 = OpLoad %int %i_4
|
||||
%183 = OpSMod %int %181 %int_5
|
||||
%184 = OpIEqual %bool %183 %int_0
|
||||
OpSelectionMerge %186 None
|
||||
OpBranchConditional %184 %185 %186
|
||||
%185 = OpLabel
|
||||
OpStore %B %int_2
|
||||
OpBranch %165
|
||||
%186 = OpLabel
|
||||
%188 = OpLoad %int %i_4
|
||||
%189 = OpIAdd %int %188 %int_1
|
||||
OpStore %i_4 %189
|
||||
OpBranch %166
|
||||
%166 = OpLabel
|
||||
OpBranch %163
|
||||
%165 = OpLabel
|
||||
OpStore %D %int_3
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
321
Test/baseResults/web.operations.frag.out
Normal file
321
Test/baseResults/web.operations.frag.out
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 207
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main"
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %f "f"
|
||||
OpName %v4 "v4"
|
||||
OpName %u "u"
|
||||
OpName %uv4 "uv4"
|
||||
OpName %iv3 "iv3"
|
||||
OpName %i "i"
|
||||
OpName %uv3 "uv3"
|
||||
OpName %m2 "m2"
|
||||
OpName %iv4 "iv4"
|
||||
OpName %m4 "m4"
|
||||
OpName %a "a"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "i"
|
||||
OpName %s "s"
|
||||
OpName %b "b"
|
||||
OpName %arr "arr"
|
||||
OpName %arr2 "arr2"
|
||||
OpName %block "block"
|
||||
OpMemberName %block 0 "f"
|
||||
OpName %instanceName "instanceName"
|
||||
OpDecorate %u RelaxedPrecision
|
||||
OpDecorate %18 RelaxedPrecision
|
||||
OpDecorate %19 RelaxedPrecision
|
||||
OpDecorate %20 RelaxedPrecision
|
||||
OpDecorate %uv4 RelaxedPrecision
|
||||
OpDecorate %24 RelaxedPrecision
|
||||
OpDecorate %25 RelaxedPrecision
|
||||
OpDecorate %26 RelaxedPrecision
|
||||
OpDecorate %27 RelaxedPrecision
|
||||
OpDecorate %iv3 RelaxedPrecision
|
||||
OpDecorate %32 RelaxedPrecision
|
||||
OpDecorate %33 RelaxedPrecision
|
||||
OpDecorate %34 RelaxedPrecision
|
||||
OpDecorate %i RelaxedPrecision
|
||||
OpDecorate %38 RelaxedPrecision
|
||||
OpDecorate %39 RelaxedPrecision
|
||||
OpDecorate %uv3 RelaxedPrecision
|
||||
OpDecorate %43 RelaxedPrecision
|
||||
OpDecorate %45 RelaxedPrecision
|
||||
OpDecorate %46 RelaxedPrecision
|
||||
OpDecorate %iv4 RelaxedPrecision
|
||||
OpDecorate %62 RelaxedPrecision
|
||||
OpDecorate %64 RelaxedPrecision
|
||||
OpDecorate %65 RelaxedPrecision
|
||||
OpDecorate %104 RelaxedPrecision
|
||||
OpDecorate %105 RelaxedPrecision
|
||||
OpMemberDecorate %S 0 RelaxedPrecision
|
||||
OpDecorate %153 RelaxedPrecision
|
||||
OpDecorate %154 RelaxedPrecision
|
||||
OpDecorate %155 RelaxedPrecision
|
||||
OpDecorate %156 RelaxedPrecision
|
||||
OpDecorate %157 RelaxedPrecision
|
||||
OpDecorate %158 RelaxedPrecision
|
||||
OpDecorate %159 RelaxedPrecision
|
||||
OpDecorate %160 RelaxedPrecision
|
||||
OpDecorate %161 RelaxedPrecision
|
||||
OpDecorate %162 RelaxedPrecision
|
||||
OpDecorate %163 RelaxedPrecision
|
||||
OpDecorate %164 RelaxedPrecision
|
||||
OpDecorate %165 RelaxedPrecision
|
||||
OpDecorate %166 RelaxedPrecision
|
||||
OpDecorate %167 RelaxedPrecision
|
||||
OpDecorate %168 RelaxedPrecision
|
||||
OpDecorate %169 RelaxedPrecision
|
||||
OpDecorate %170 RelaxedPrecision
|
||||
OpDecorate %171 RelaxedPrecision
|
||||
OpDecorate %172 RelaxedPrecision
|
||||
OpDecorate %173 RelaxedPrecision
|
||||
OpDecorate %174 RelaxedPrecision
|
||||
OpDecorate %175 RelaxedPrecision
|
||||
OpDecorate %176 RelaxedPrecision
|
||||
OpDecorate %177 RelaxedPrecision
|
||||
OpDecorate %178 RelaxedPrecision
|
||||
OpDecorate %179 RelaxedPrecision
|
||||
OpDecorate %180 RelaxedPrecision
|
||||
OpDecorate %181 RelaxedPrecision
|
||||
OpDecorate %182 RelaxedPrecision
|
||||
OpDecorate %183 RelaxedPrecision
|
||||
OpDecorate %184 RelaxedPrecision
|
||||
OpDecorate %185 RelaxedPrecision
|
||||
OpDecorate %186 RelaxedPrecision
|
||||
OpDecorate %187 RelaxedPrecision
|
||||
OpDecorate %188 RelaxedPrecision
|
||||
OpDecorate %189 RelaxedPrecision
|
||||
OpDecorate %190 RelaxedPrecision
|
||||
OpDecorate %191 RelaxedPrecision
|
||||
OpDecorate %192 RelaxedPrecision
|
||||
OpDecorate %193 RelaxedPrecision
|
||||
OpDecorate %194 RelaxedPrecision
|
||||
OpDecorate %arr RelaxedPrecision
|
||||
OpDecorate %arr2 RelaxedPrecision
|
||||
OpMemberDecorate %block 0 RelaxedPrecision
|
||||
OpMemberDecorate %block 0 Offset 0
|
||||
OpDecorate %block Block
|
||||
OpDecorate %instanceName DescriptorSet 0
|
||||
OpDecorate %instanceName Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%_ptr_Function_v3int = OpTypePointer Function %v3int
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_3 = OpConstant %int 3
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
|
||||
%float_1 = OpConstant %float 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%int_1 = OpConstant %int 1
|
||||
%mat4v4float = OpTypeMatrix %v4float 4
|
||||
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
|
||||
%bool = OpTypeBool
|
||||
%v4bool = OpTypeVector %bool 4
|
||||
%v2bool = OpTypeVector %bool 2
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_arr_float_uint_5 = OpTypeArray %float %uint_5
|
||||
%_ptr_Private__arr_float_uint_5 = OpTypePointer Private %_arr_float_uint_5
|
||||
%a = OpVariable %_ptr_Private__arr_float_uint_5 Private
|
||||
%S = OpTypeStruct %int
|
||||
%_ptr_Private_S = OpTypePointer Private %S
|
||||
%s = OpVariable %_ptr_Private_S Private
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_int_uint_3 = OpTypeArray %int %uint_3
|
||||
%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3
|
||||
%int_2 = OpConstant %int 2
|
||||
%block = OpTypeStruct %float
|
||||
%_ptr_Uniform_block = OpTypePointer Uniform %block
|
||||
%instanceName = OpVariable %_ptr_Uniform_block Uniform
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%f = OpVariable %_ptr_Function_float Function
|
||||
%v4 = OpVariable %_ptr_Function_v4float Function
|
||||
%u = OpVariable %_ptr_Function_uint Function
|
||||
%uv4 = OpVariable %_ptr_Function_v4uint Function
|
||||
%iv3 = OpVariable %_ptr_Function_v3int Function
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
%uv3 = OpVariable %_ptr_Function_v3uint Function
|
||||
%m2 = OpVariable %_ptr_Function_mat2v2float Function
|
||||
%iv4 = OpVariable %_ptr_Function_v4int Function
|
||||
%m4 = OpVariable %_ptr_Function_mat4v4float Function
|
||||
%b = OpVariable %_ptr_Function_bool Function
|
||||
%arr = OpVariable %_ptr_Function__arr_int_uint_2 Function
|
||||
%arr2 = OpVariable %_ptr_Function__arr_int_uint_3 Function
|
||||
%9 = OpLoad %float %f
|
||||
%13 = OpLoad %v4float %v4
|
||||
%14 = OpVectorTimesScalar %v4float %13 %9
|
||||
%18 = OpLoad %uint %u
|
||||
%19 = OpLoad %uint %u
|
||||
%20 = OpIAdd %uint %18 %19
|
||||
%24 = OpLoad %v4uint %uv4
|
||||
%25 = OpLoad %uint %u
|
||||
%26 = OpCompositeConstruct %v4uint %25 %25 %25 %25
|
||||
%27 = OpUDiv %v4uint %24 %26
|
||||
%32 = OpLoad %v3int %iv3
|
||||
%33 = OpLoad %v3int %iv3
|
||||
%34 = OpISub %v3int %33 %32
|
||||
OpStore %iv3 %34
|
||||
%38 = OpLoad %int %i
|
||||
%39 = OpSMod %int %38 %int_3
|
||||
OpStore %i %39
|
||||
%43 = OpLoad %v3uint %uv3
|
||||
%45 = OpCompositeConstruct %v3uint %uint_4 %uint_4 %uint_4
|
||||
%46 = OpUMod %v3uint %43 %45
|
||||
%51 = OpLoad %mat2v2float %m2
|
||||
%53 = OpCompositeConstruct %v2float %float_1 %float_1
|
||||
%54 = OpCompositeExtract %v2float %51 0
|
||||
%55 = OpFSub %v2float %54 %53
|
||||
%56 = OpCompositeExtract %v2float %51 1
|
||||
%57 = OpFSub %v2float %56 %53
|
||||
%58 = OpCompositeConstruct %mat2v2float %55 %57
|
||||
OpStore %m2 %58
|
||||
%62 = OpLoad %v4int %iv4
|
||||
%64 = OpCompositeConstruct %v4int %int_1 %int_1 %int_1 %int_1
|
||||
%65 = OpIAdd %v4int %62 %64
|
||||
OpStore %iv4 %65
|
||||
%69 = OpLoad %mat4v4float %m4
|
||||
%70 = OpLoad %mat4v4float %m4
|
||||
%72 = OpCompositeExtract %v4float %69 0
|
||||
%73 = OpCompositeExtract %v4float %70 0
|
||||
%75 = OpFOrdNotEqual %v4bool %72 %73
|
||||
%76 = OpAny %bool %75
|
||||
%77 = OpCompositeExtract %v4float %69 1
|
||||
%78 = OpCompositeExtract %v4float %70 1
|
||||
%79 = OpFOrdNotEqual %v4bool %77 %78
|
||||
%80 = OpAny %bool %79
|
||||
%81 = OpLogicalOr %bool %76 %80
|
||||
%82 = OpCompositeExtract %v4float %69 2
|
||||
%83 = OpCompositeExtract %v4float %70 2
|
||||
%84 = OpFOrdNotEqual %v4bool %82 %83
|
||||
%85 = OpAny %bool %84
|
||||
%86 = OpLogicalOr %bool %81 %85
|
||||
%87 = OpCompositeExtract %v4float %69 3
|
||||
%88 = OpCompositeExtract %v4float %70 3
|
||||
%89 = OpFOrdNotEqual %v4bool %87 %88
|
||||
%90 = OpAny %bool %89
|
||||
%91 = OpLogicalOr %bool %86 %90
|
||||
%92 = OpLoad %mat2v2float %m2
|
||||
%93 = OpLoad %mat2v2float %m2
|
||||
%94 = OpCompositeExtract %v2float %92 0
|
||||
%95 = OpCompositeExtract %v2float %93 0
|
||||
%97 = OpFOrdEqual %v2bool %94 %95
|
||||
%98 = OpAll %bool %97
|
||||
%99 = OpCompositeExtract %v2float %92 1
|
||||
%100 = OpCompositeExtract %v2float %93 1
|
||||
%101 = OpFOrdEqual %v2bool %99 %100
|
||||
%102 = OpAll %bool %101
|
||||
%103 = OpLogicalAnd %bool %98 %102
|
||||
%104 = OpLoad %int %i
|
||||
%105 = OpLoad %int %i
|
||||
%106 = OpSLessThanEqual %bool %104 %105
|
||||
%111 = OpLoad %_arr_float_uint_5 %a
|
||||
%112 = OpLoad %_arr_float_uint_5 %a
|
||||
%113 = OpCompositeExtract %float %111 0
|
||||
%114 = OpCompositeExtract %float %112 0
|
||||
%115 = OpFOrdEqual %bool %113 %114
|
||||
%116 = OpCompositeExtract %float %111 1
|
||||
%117 = OpCompositeExtract %float %112 1
|
||||
%118 = OpFOrdEqual %bool %116 %117
|
||||
%119 = OpLogicalAnd %bool %115 %118
|
||||
%120 = OpCompositeExtract %float %111 2
|
||||
%121 = OpCompositeExtract %float %112 2
|
||||
%122 = OpFOrdEqual %bool %120 %121
|
||||
%123 = OpLogicalAnd %bool %119 %122
|
||||
%124 = OpCompositeExtract %float %111 3
|
||||
%125 = OpCompositeExtract %float %112 3
|
||||
%126 = OpFOrdEqual %bool %124 %125
|
||||
%127 = OpLogicalAnd %bool %123 %126
|
||||
%128 = OpCompositeExtract %float %111 4
|
||||
%129 = OpCompositeExtract %float %112 4
|
||||
%130 = OpFOrdEqual %bool %128 %129
|
||||
%131 = OpLogicalAnd %bool %127 %130
|
||||
%135 = OpLoad %S %s
|
||||
%136 = OpLoad %S %s
|
||||
%137 = OpCompositeExtract %int %135 0
|
||||
%138 = OpCompositeExtract %int %136 0
|
||||
%139 = OpINotEqual %bool %137 %138
|
||||
%142 = OpLoad %bool %b
|
||||
%143 = OpLoad %bool %b
|
||||
%144 = OpLogicalAnd %bool %142 %143
|
||||
%145 = OpLoad %bool %b
|
||||
%146 = OpLoad %bool %b
|
||||
%147 = OpLogicalOr %bool %145 %146
|
||||
%148 = OpLoad %bool %b
|
||||
%149 = OpLoad %bool %b
|
||||
%150 = OpLogicalNotEqual %bool %148 %149
|
||||
%151 = OpLoad %bool %b
|
||||
%152 = OpLogicalNot %bool %151
|
||||
%153 = OpLoad %int %i
|
||||
%154 = OpNot %int %153
|
||||
%155 = OpLoad %uint %u
|
||||
%156 = OpNot %uint %155
|
||||
%157 = OpLoad %v3uint %uv3
|
||||
%158 = OpNot %v3uint %157
|
||||
%159 = OpLoad %v3int %iv3
|
||||
%160 = OpNot %v3int %159
|
||||
%161 = OpLoad %int %i
|
||||
%162 = OpLoad %v3uint %uv3
|
||||
%163 = OpCompositeConstruct %v3int %161 %161 %161
|
||||
%164 = OpShiftLeftLogical %v3uint %162 %163
|
||||
OpStore %uv3 %164
|
||||
%165 = OpLoad %int %i
|
||||
%166 = OpLoad %int %i
|
||||
%167 = OpShiftRightArithmetic %int %165 %166
|
||||
%168 = OpLoad %uint %u
|
||||
%169 = OpLoad %uint %u
|
||||
%170 = OpShiftLeftLogical %uint %168 %169
|
||||
%171 = OpLoad %v3int %iv3
|
||||
%172 = OpLoad %v3int %iv3
|
||||
%173 = OpShiftRightArithmetic %v3int %171 %172
|
||||
%174 = OpLoad %int %i
|
||||
%175 = OpLoad %int %i
|
||||
%176 = OpBitwiseAnd %int %174 %175
|
||||
%177 = OpLoad %uint %u
|
||||
%178 = OpLoad %uint %u
|
||||
%179 = OpBitwiseOr %uint %177 %178
|
||||
%180 = OpLoad %v3int %iv3
|
||||
%181 = OpLoad %v3int %iv3
|
||||
%182 = OpBitwiseXor %v3int %180 %181
|
||||
%183 = OpLoad %uint %u
|
||||
%184 = OpLoad %v3uint %uv3
|
||||
%185 = OpCompositeConstruct %v3uint %183 %183 %183
|
||||
%186 = OpBitwiseAnd %v3uint %185 %184
|
||||
%187 = OpLoad %v3uint %uv3
|
||||
%188 = OpLoad %uint %u
|
||||
%189 = OpCompositeConstruct %v3uint %188 %188 %188
|
||||
%190 = OpBitwiseOr %v3uint %187 %189
|
||||
%191 = OpLoad %uint %u
|
||||
%192 = OpLoad %v3uint %uv3
|
||||
%193 = OpCompositeConstruct %v3uint %191 %191 %191
|
||||
%194 = OpBitwiseAnd %v3uint %192 %193
|
||||
OpStore %uv3 %194
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
396
Test/baseResults/web.texture.frag.out
Normal file
396
Test/baseResults/web.texture.frag.out
Normal file
|
|
@ -0,0 +1,396 @@
|
|||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 189
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ImageQuery
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %c2D %c4D %c3D %ic3D %ic1D %c1D %ic4D %s2 %sc %sf
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %v "v"
|
||||
OpName %s2D "s2D"
|
||||
OpName %c2D "c2D"
|
||||
OpName %s3D "s3D"
|
||||
OpName %c4D "c4D"
|
||||
OpName %s2DArray "s2DArray"
|
||||
OpName %c3D "c3D"
|
||||
OpName %ic3D "ic3D"
|
||||
OpName %ic1D "ic1D"
|
||||
OpName %f "f"
|
||||
OpName %s2DShadow "s2DShadow"
|
||||
OpName %c1D "c1D"
|
||||
OpName %sCube "sCube"
|
||||
OpName %s2DArrayShadow "s2DArrayShadow"
|
||||
OpName %iv "iv"
|
||||
OpName %is2D "is2D"
|
||||
OpName %is3D "is3D"
|
||||
OpName %isCube "isCube"
|
||||
OpName %is2DArray "is2DArray"
|
||||
OpName %sCubeShadow "sCubeShadow"
|
||||
OpName %us2D "us2D"
|
||||
OpName %us3D "us3D"
|
||||
OpName %usCube "usCube"
|
||||
OpName %us2DArray "us2DArray"
|
||||
OpName %ic4D "ic4D"
|
||||
OpName %S2 "S2"
|
||||
OpMemberName %S2 0 "c"
|
||||
OpMemberName %S2 1 "f"
|
||||
OpName %s2 "s2"
|
||||
OpName %sc "sc"
|
||||
OpName %sf "sf"
|
||||
OpName %arrayedSampler "arrayedSampler"
|
||||
OpDecorate %v RelaxedPrecision
|
||||
OpDecorate %s2D RelaxedPrecision
|
||||
OpDecorate %s2D DescriptorSet 0
|
||||
OpDecorate %s2D Binding 1
|
||||
OpDecorate %14 RelaxedPrecision
|
||||
OpDecorate %c2D RelaxedPrecision
|
||||
OpDecorate %c2D Location 5
|
||||
OpDecorate %18 RelaxedPrecision
|
||||
OpDecorate %19 RelaxedPrecision
|
||||
OpDecorate %s3D RelaxedPrecision
|
||||
OpDecorate %s3D DescriptorSet 0
|
||||
OpDecorate %s3D Binding 2
|
||||
OpDecorate %24 RelaxedPrecision
|
||||
OpDecorate %c4D RelaxedPrecision
|
||||
OpDecorate %c4D Location 7
|
||||
OpDecorate %27 RelaxedPrecision
|
||||
OpDecorate %28 RelaxedPrecision
|
||||
OpDecorate %s2DArray RelaxedPrecision
|
||||
OpDecorate %s2DArray DescriptorSet 0
|
||||
OpDecorate %s2DArray Binding 6
|
||||
OpDecorate %33 RelaxedPrecision
|
||||
OpDecorate %c3D RelaxedPrecision
|
||||
OpDecorate %c3D Location 6
|
||||
OpDecorate %37 RelaxedPrecision
|
||||
OpDecorate %39 RelaxedPrecision
|
||||
OpDecorate %40 RelaxedPrecision
|
||||
OpDecorate %ic3D RelaxedPrecision
|
||||
OpDecorate %ic3D Flat
|
||||
OpDecorate %ic3D Location 2
|
||||
OpDecorate %45 RelaxedPrecision
|
||||
OpDecorate %ic1D RelaxedPrecision
|
||||
OpDecorate %ic1D Flat
|
||||
OpDecorate %ic1D Location 1
|
||||
OpDecorate %48 RelaxedPrecision
|
||||
OpDecorate %50 RelaxedPrecision
|
||||
OpDecorate %f RelaxedPrecision
|
||||
OpDecorate %s2DShadow RelaxedPrecision
|
||||
OpDecorate %s2DShadow DescriptorSet 0
|
||||
OpDecorate %s2DShadow Binding 5
|
||||
OpDecorate %57 RelaxedPrecision
|
||||
OpDecorate %58 RelaxedPrecision
|
||||
OpDecorate %c1D RelaxedPrecision
|
||||
OpDecorate %c1D Location 4
|
||||
OpDecorate %61 RelaxedPrecision
|
||||
OpDecorate %67 RelaxedPrecision
|
||||
OpDecorate %68 RelaxedPrecision
|
||||
OpDecorate %69 RelaxedPrecision
|
||||
OpDecorate %70 RelaxedPrecision
|
||||
OpDecorate %71 RelaxedPrecision
|
||||
OpDecorate %sCube RelaxedPrecision
|
||||
OpDecorate %sCube DescriptorSet 0
|
||||
OpDecorate %sCube Binding 3
|
||||
OpDecorate %76 RelaxedPrecision
|
||||
OpDecorate %77 RelaxedPrecision
|
||||
OpDecorate %78 RelaxedPrecision
|
||||
OpDecorate %79 RelaxedPrecision
|
||||
OpDecorate %80 RelaxedPrecision
|
||||
OpDecorate %s2DArrayShadow RelaxedPrecision
|
||||
OpDecorate %s2DArrayShadow DescriptorSet 0
|
||||
OpDecorate %s2DArrayShadow Binding 7
|
||||
OpDecorate %85 RelaxedPrecision
|
||||
OpDecorate %86 RelaxedPrecision
|
||||
OpDecorate %87 RelaxedPrecision
|
||||
OpDecorate %88 RelaxedPrecision
|
||||
OpDecorate %90 RelaxedPrecision
|
||||
OpDecorate %91 RelaxedPrecision
|
||||
OpDecorate %92 RelaxedPrecision
|
||||
OpDecorate %93 RelaxedPrecision
|
||||
OpDecorate %94 RelaxedPrecision
|
||||
OpDecorate %95 RelaxedPrecision
|
||||
OpDecorate %96 RelaxedPrecision
|
||||
OpDecorate %97 RelaxedPrecision
|
||||
OpDecorate %98 RelaxedPrecision
|
||||
OpDecorate %99 RelaxedPrecision
|
||||
OpDecorate %100 RelaxedPrecision
|
||||
OpDecorate %iv RelaxedPrecision
|
||||
OpDecorate %is2D RelaxedPrecision
|
||||
OpDecorate %is2D DescriptorSet 0
|
||||
OpDecorate %is2D Binding 8
|
||||
OpDecorate %108 RelaxedPrecision
|
||||
OpDecorate %109 RelaxedPrecision
|
||||
OpDecorate %110 RelaxedPrecision
|
||||
OpDecorate %111 RelaxedPrecision
|
||||
OpDecorate %112 RelaxedPrecision
|
||||
OpDecorate %115 RelaxedPrecision
|
||||
OpDecorate %116 RelaxedPrecision
|
||||
OpDecorate %117 RelaxedPrecision
|
||||
OpDecorate %118 RelaxedPrecision
|
||||
OpDecorate %119 RelaxedPrecision
|
||||
OpDecorate %120 RelaxedPrecision
|
||||
OpDecorate %121 RelaxedPrecision
|
||||
OpDecorate %122 RelaxedPrecision
|
||||
OpDecorate %123 RelaxedPrecision
|
||||
OpDecorate %124 RelaxedPrecision
|
||||
OpDecorate %is3D RelaxedPrecision
|
||||
OpDecorate %is3D DescriptorSet 0
|
||||
OpDecorate %is3D Binding 9
|
||||
OpDecorate %129 RelaxedPrecision
|
||||
OpDecorate %130 RelaxedPrecision
|
||||
OpDecorate %132 RelaxedPrecision
|
||||
OpDecorate %isCube RelaxedPrecision
|
||||
OpDecorate %isCube DescriptorSet 0
|
||||
OpDecorate %isCube Binding 10
|
||||
OpDecorate %137 RelaxedPrecision
|
||||
OpDecorate %138 RelaxedPrecision
|
||||
OpDecorate %139 RelaxedPrecision
|
||||
OpDecorate %140 RelaxedPrecision
|
||||
OpDecorate %is2DArray RelaxedPrecision
|
||||
OpDecorate %is2DArray DescriptorSet 0
|
||||
OpDecorate %is2DArray Binding 11
|
||||
OpDecorate %145 RelaxedPrecision
|
||||
OpDecorate %146 RelaxedPrecision
|
||||
OpDecorate %147 RelaxedPrecision
|
||||
OpDecorate %149 RelaxedPrecision
|
||||
OpDecorate %sCubeShadow RelaxedPrecision
|
||||
OpDecorate %sCubeShadow DescriptorSet 0
|
||||
OpDecorate %sCubeShadow Binding 4
|
||||
OpDecorate %154 RelaxedPrecision
|
||||
OpDecorate %us2D RelaxedPrecision
|
||||
OpDecorate %us2D DescriptorSet 0
|
||||
OpDecorate %us2D Binding 12
|
||||
OpDecorate %us3D RelaxedPrecision
|
||||
OpDecorate %us3D DescriptorSet 0
|
||||
OpDecorate %us3D Binding 13
|
||||
OpDecorate %usCube RelaxedPrecision
|
||||
OpDecorate %usCube DescriptorSet 0
|
||||
OpDecorate %usCube Binding 14
|
||||
OpDecorate %us2DArray RelaxedPrecision
|
||||
OpDecorate %us2DArray DescriptorSet 0
|
||||
OpDecorate %us2DArray Binding 15
|
||||
OpDecorate %ic4D RelaxedPrecision
|
||||
OpDecorate %ic4D Flat
|
||||
OpDecorate %ic4D Location 3
|
||||
OpDecorate %65 RelaxedPrecision
|
||||
OpMemberDecorate %S2 0 RelaxedPrecision
|
||||
OpMemberDecorate %S2 1 RelaxedPrecision
|
||||
OpDecorate %s2 Location 8
|
||||
OpDecorate %sc RelaxedPrecision
|
||||
OpDecorate %sc Location 0
|
||||
OpDecorate %sf RelaxedPrecision
|
||||
OpDecorate %sf Location 1
|
||||
OpDecorate %arrayedSampler RelaxedPrecision
|
||||
OpDecorate %arrayedSampler DescriptorSet 0
|
||||
OpDecorate %arrayedSampler Binding 0
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%10 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%11 = OpTypeSampledImage %10
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%s2D = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%c2D = OpVariable %_ptr_Input_v2float Input
|
||||
%20 = OpTypeImage %float 3D 0 0 0 1 Unknown
|
||||
%21 = OpTypeSampledImage %20
|
||||
%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21
|
||||
%s3D = OpVariable %_ptr_UniformConstant_21 UniformConstant
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%c4D = OpVariable %_ptr_Input_v4float Input
|
||||
%29 = OpTypeImage %float 2D 0 1 0 1 Unknown
|
||||
%30 = OpTypeSampledImage %29
|
||||
%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30
|
||||
%s2DArray = OpVariable %_ptr_UniformConstant_30 UniformConstant
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Input_v3float = OpTypePointer Input %v3float
|
||||
%c3D = OpVariable %_ptr_Input_v3float Input
|
||||
%float_1_20000005 = OpConstant %float 1.20000005
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%_ptr_Input_v3int = OpTypePointer Input %v3int
|
||||
%ic3D = OpVariable %_ptr_Input_v3int Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%ic1D = OpVariable %_ptr_Input_int Input
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%53 = OpTypeImage %float 2D 1 0 0 1 Unknown
|
||||
%54 = OpTypeSampledImage %53
|
||||
%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
|
||||
%s2DShadow = OpVariable %_ptr_UniformConstant_54 UniformConstant
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%c1D = OpVariable %_ptr_Input_float Input
|
||||
%v2int = OpTypeVector %int 2
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%65 = OpConstantComposite %v2int %int_2 %int_3
|
||||
%72 = OpTypeImage %float Cube 0 0 0 1 Unknown
|
||||
%73 = OpTypeSampledImage %72
|
||||
%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
|
||||
%sCube = OpVariable %_ptr_UniformConstant_73 UniformConstant
|
||||
%81 = OpTypeImage %float 2D 1 1 0 1 Unknown
|
||||
%82 = OpTypeSampledImage %81
|
||||
%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
|
||||
%s2DArrayShadow = OpVariable %_ptr_UniformConstant_82 UniformConstant
|
||||
%v4int = OpTypeVector %int 4
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%104 = OpTypeImage %int 2D 0 0 0 1 Unknown
|
||||
%105 = OpTypeSampledImage %104
|
||||
%_ptr_UniformConstant_105 = OpTypePointer UniformConstant %105
|
||||
%is2D = OpVariable %_ptr_UniformConstant_105 UniformConstant
|
||||
%125 = OpTypeImage %int 3D 0 0 0 1 Unknown
|
||||
%126 = OpTypeSampledImage %125
|
||||
%_ptr_UniformConstant_126 = OpTypePointer UniformConstant %126
|
||||
%is3D = OpVariable %_ptr_UniformConstant_126 UniformConstant
|
||||
%float_4_19999981 = OpConstant %float 4.19999981
|
||||
%133 = OpTypeImage %int Cube 0 0 0 1 Unknown
|
||||
%134 = OpTypeSampledImage %133
|
||||
%_ptr_UniformConstant_134 = OpTypePointer UniformConstant %134
|
||||
%isCube = OpVariable %_ptr_UniformConstant_134 UniformConstant
|
||||
%141 = OpTypeImage %int 2D 0 1 0 1 Unknown
|
||||
%142 = OpTypeSampledImage %141
|
||||
%_ptr_UniformConstant_142 = OpTypePointer UniformConstant %142
|
||||
%is2DArray = OpVariable %_ptr_UniformConstant_142 UniformConstant
|
||||
%150 = OpTypeImage %float Cube 1 0 0 1 Unknown
|
||||
%151 = OpTypeSampledImage %150
|
||||
%_ptr_UniformConstant_151 = OpTypePointer UniformConstant %151
|
||||
%sCubeShadow = OpVariable %_ptr_UniformConstant_151 UniformConstant
|
||||
%uint = OpTypeInt 32 0
|
||||
%160 = OpTypeImage %uint 2D 0 0 0 1 Unknown
|
||||
%161 = OpTypeSampledImage %160
|
||||
%_ptr_UniformConstant_161 = OpTypePointer UniformConstant %161
|
||||
%us2D = OpVariable %_ptr_UniformConstant_161 UniformConstant
|
||||
%164 = OpTypeImage %uint 3D 0 0 0 1 Unknown
|
||||
%165 = OpTypeSampledImage %164
|
||||
%_ptr_UniformConstant_165 = OpTypePointer UniformConstant %165
|
||||
%us3D = OpVariable %_ptr_UniformConstant_165 UniformConstant
|
||||
%168 = OpTypeImage %uint Cube 0 0 0 1 Unknown
|
||||
%169 = OpTypeSampledImage %168
|
||||
%_ptr_UniformConstant_169 = OpTypePointer UniformConstant %169
|
||||
%usCube = OpVariable %_ptr_UniformConstant_169 UniformConstant
|
||||
%172 = OpTypeImage %uint 2D 0 1 0 1 Unknown
|
||||
%173 = OpTypeSampledImage %172
|
||||
%_ptr_UniformConstant_173 = OpTypePointer UniformConstant %173
|
||||
%us2DArray = OpVariable %_ptr_UniformConstant_173 UniformConstant
|
||||
%_ptr_Input_v4int = OpTypePointer Input %v4int
|
||||
%ic4D = OpVariable %_ptr_Input_v4int Input
|
||||
%S2 = OpTypeStruct %v3float %float
|
||||
%_ptr_Input_S2 = OpTypePointer Input %S2
|
||||
%s2 = OpVariable %_ptr_Input_S2 Input
|
||||
%_ptr_Output_v3float = OpTypePointer Output %v3float
|
||||
%sc = OpVariable %_ptr_Output_v3float Output
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%sf = OpVariable %_ptr_Output_float Output
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_arr_11_uint_5 = OpTypeArray %11 %uint_5
|
||||
%_ptr_UniformConstant__arr_11_uint_5 = OpTypePointer UniformConstant %_arr_11_uint_5
|
||||
%arrayedSampler = OpVariable %_ptr_UniformConstant__arr_11_uint_5 UniformConstant
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v4float Function
|
||||
%f = OpVariable %_ptr_Function_float Function
|
||||
%iv = OpVariable %_ptr_Function_v4int Function
|
||||
%14 = OpLoad %11 %s2D
|
||||
%18 = OpLoad %v2float %c2D
|
||||
%19 = OpImageSampleImplicitLod %v4float %14 %18
|
||||
OpStore %v %19
|
||||
%24 = OpLoad %21 %s3D
|
||||
%27 = OpLoad %v4float %c4D
|
||||
%28 = OpImageSampleProjImplicitLod %v4float %24 %27
|
||||
OpStore %v %28
|
||||
%33 = OpLoad %30 %s2DArray
|
||||
%37 = OpLoad %v3float %c3D
|
||||
%39 = OpImageSampleExplicitLod %v4float %33 %37 Lod %float_1_20000005
|
||||
OpStore %v %39
|
||||
%40 = OpLoad %21 %s3D
|
||||
%45 = OpLoad %v3int %ic3D
|
||||
%48 = OpLoad %int %ic1D
|
||||
%49 = OpImage %20 %40
|
||||
%50 = OpImageFetch %v4float %49 %45 Lod %48
|
||||
OpStore %v %50
|
||||
%57 = OpLoad %54 %s2DShadow
|
||||
%58 = OpLoad %v3float %c3D
|
||||
%61 = OpLoad %float %c1D
|
||||
%66 = OpCompositeExtract %float %58 2
|
||||
%67 = OpImageSampleDrefExplicitLod %float %57 %58 %66 Lod|ConstOffset %61 %65
|
||||
OpStore %f %67
|
||||
%68 = OpLoad %11 %s2D
|
||||
%69 = OpLoad %v3float %c3D
|
||||
%70 = OpLoad %float %c1D
|
||||
%71 = OpImageSampleProjExplicitLod %v4float %68 %69 Lod|ConstOffset %70 %65
|
||||
OpStore %v %71
|
||||
%76 = OpLoad %73 %sCube
|
||||
%77 = OpLoad %v3float %c3D
|
||||
%78 = OpLoad %v3float %c3D
|
||||
%79 = OpLoad %v3float %c3D
|
||||
%80 = OpImageSampleExplicitLod %v4float %76 %77 Grad %78 %79
|
||||
OpStore %v %80
|
||||
%85 = OpLoad %82 %s2DArrayShadow
|
||||
%86 = OpLoad %v4float %c4D
|
||||
%87 = OpLoad %v2float %c2D
|
||||
%88 = OpLoad %v2float %c2D
|
||||
%89 = OpCompositeExtract %float %86 3
|
||||
%90 = OpImageSampleDrefExplicitLod %float %85 %86 %89 Grad|ConstOffset %87 %88 %65
|
||||
OpStore %f %90
|
||||
%91 = OpLoad %21 %s3D
|
||||
%92 = OpLoad %v4float %c4D
|
||||
%93 = OpLoad %v3float %c3D
|
||||
%94 = OpLoad %v3float %c3D
|
||||
%95 = OpImageSampleProjExplicitLod %v4float %91 %92 Grad %93 %94
|
||||
OpStore %v %95
|
||||
%96 = OpLoad %11 %s2D
|
||||
%97 = OpLoad %v3float %c3D
|
||||
%98 = OpLoad %v2float %c2D
|
||||
%99 = OpLoad %v2float %c2D
|
||||
%100 = OpImageSampleProjExplicitLod %v4float %96 %97 Grad|ConstOffset %98 %99 %65
|
||||
OpStore %v %100
|
||||
%108 = OpLoad %105 %is2D
|
||||
%109 = OpLoad %v2float %c2D
|
||||
%110 = OpImageSampleImplicitLod %v4int %108 %109
|
||||
OpStore %iv %110
|
||||
%111 = OpLoad %105 %is2D
|
||||
%112 = OpLoad %v4float %c4D
|
||||
%113 = OpCompositeExtract %float %112 3
|
||||
%114 = OpCompositeInsert %v4float %113 %112 2
|
||||
%115 = OpImageSampleProjImplicitLod %v4int %111 %114 ConstOffset %65
|
||||
OpStore %iv %115
|
||||
%116 = OpLoad %105 %is2D
|
||||
%117 = OpLoad %v3float %c3D
|
||||
%118 = OpLoad %float %c1D
|
||||
%119 = OpImageSampleProjExplicitLod %v4int %116 %117 Lod %118
|
||||
OpStore %iv %119
|
||||
%120 = OpLoad %105 %is2D
|
||||
%121 = OpLoad %v3float %c3D
|
||||
%122 = OpLoad %v2float %c2D
|
||||
%123 = OpLoad %v2float %c2D
|
||||
%124 = OpImageSampleProjExplicitLod %v4int %120 %121 Grad %122 %123
|
||||
OpStore %iv %124
|
||||
%129 = OpLoad %126 %is3D
|
||||
%130 = OpLoad %v3float %c3D
|
||||
%132 = OpImageSampleImplicitLod %v4int %129 %130 Bias %float_4_19999981
|
||||
OpStore %iv %132
|
||||
%137 = OpLoad %134 %isCube
|
||||
%138 = OpLoad %v3float %c3D
|
||||
%139 = OpLoad %float %c1D
|
||||
%140 = OpImageSampleExplicitLod %v4int %137 %138 Lod %139
|
||||
OpStore %iv %140
|
||||
%145 = OpLoad %142 %is2DArray
|
||||
%146 = OpLoad %v3int %ic3D
|
||||
%147 = OpLoad %int %ic1D
|
||||
%148 = OpImage %141 %145
|
||||
%149 = OpImageFetch %v4int %148 %146 Lod %147
|
||||
OpStore %iv %149
|
||||
%154 = OpLoad %151 %sCubeShadow
|
||||
%155 = OpImage %150 %154
|
||||
%156 = OpImageQuerySizeLod %v2int %155 %int_2
|
||||
%157 = OpLoad %v4int %iv
|
||||
%158 = OpVectorShuffle %v4int %157 %156 4 5 2 3
|
||||
OpStore %iv %158
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
@ -10,8 +10,8 @@ int b[5];
|
|||
int c[];
|
||||
int i;
|
||||
|
||||
buffer bnameRuntime { float r[]; };
|
||||
buffer bnameImplicit { float m[]; };
|
||||
layout (binding = 0) buffer bnameRuntime { float r[]; };
|
||||
layout (binding = 1) buffer bnameImplicit { float m[]; };
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ int b[];
|
|||
int c[7];
|
||||
int i;
|
||||
|
||||
buffer bnameRuntime { float r[]; };
|
||||
buffer bnameImplicit { float m[4]; };
|
||||
layout (binding = 0) buffer bnameRuntime { float r[]; };
|
||||
layout (binding = 1) buffer bnameImplicit { float m[4]; };
|
||||
|
||||
vec4 getColor()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASER
|
|||
# multi-threaded test
|
||||
#
|
||||
echo Comparing single thread to multithread for all tests in current directory...
|
||||
$EXE -i -C *.vert *.geom *.frag *.tes* *.comp > singleThread.out
|
||||
$EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
|
||||
$EXE -i -C *.vert *.geom *.frag *.tesc *.tese *.comp > singleThread.out
|
||||
$EXE -i -C *.vert *.geom *.frag *.tesc *.tese *.comp -t > multiThread.out
|
||||
diff singleThread.out multiThread.out || HASERROR=1
|
||||
if [ $HASERROR -eq 0 ]
|
||||
then
|
||||
|
|
@ -145,7 +145,7 @@ echo Testing SPV Debug Information
|
|||
$EXE -g --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
|
||||
-G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out
|
||||
diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1
|
||||
$EXE -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf --spirv-val \
|
||||
$EXE -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
|
||||
-G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.1.1.frag.out
|
||||
diff -b $BASEDIR/spv.debugInfo.1.1.frag.out $TARGETDIR/spv.debugInfo.1.1.frag.out || HASERROR=1
|
||||
$EXE -g -D -Od -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --spirv-val --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
buffer block {
|
||||
layout(binding = 0) buffer block {
|
||||
float m0;
|
||||
vec3 m4;
|
||||
//////
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ void main()
|
|||
}
|
||||
|
||||
layout(binding = 0) uniform atomic_uint aui; // ERROR, no atomics in Vulkan
|
||||
layout(shared) uniform ub1n { int a; } ub1i; // ERROR, no shared
|
||||
layout(packed) uniform ub2n { int a; } ub2i; // ERROR, no packed
|
||||
layout(shared, binding = 1) uniform ub1n { int a; } ub1i; // ERROR, no shared
|
||||
layout(packed, binding = 2) uniform ub2n { int a; } ub2i; // ERROR, no packed
|
||||
|
||||
layout(constant_id=222) const int arraySize = 4;
|
||||
|
||||
|
|
|
|||
26
Test/web.array.frag
Normal file
26
Test/web.array.frag
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#version 310 es
|
||||
|
||||
precision highp float;
|
||||
|
||||
float g4[4];
|
||||
float g5[5];
|
||||
|
||||
layout(location = 0) out vec2 colorOut;
|
||||
|
||||
float[4] foo(float a[5])
|
||||
{
|
||||
return float[](a[0], a[1], a[2], a[3]);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
g4 = foo(g5);
|
||||
|
||||
if (float[4](1.0, 2.0, 3.0, 4.0) == g4)
|
||||
;
|
||||
|
||||
float u[5];
|
||||
foo(u);
|
||||
|
||||
colorOut = vec2(g4.length(), g5.length());
|
||||
}
|
||||
15
Test/web.basic.vert
Normal file
15
Test/web.basic.vert
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#version 310 es
|
||||
|
||||
layout(location = 2) in vec4 inv4;
|
||||
layout(location = 1) out vec4 outv4;
|
||||
|
||||
layout(binding = 3) uniform uBlock {
|
||||
vec4 a;
|
||||
ivec4 b;
|
||||
uvec4 c;
|
||||
} uInst;
|
||||
|
||||
void main()
|
||||
{
|
||||
outv4 = normalize(inv4) * uInst.a * vec4(uInst.b) * vec4(uInst.c);
|
||||
}
|
||||
58
Test/web.builtins.frag
Normal file
58
Test/web.builtins.frag
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#version 310 es
|
||||
|
||||
precision lowp float;
|
||||
layout(location = 4) in float c1D;
|
||||
layout(location = 5) in vec2 c2D;
|
||||
layout(location = 6) in vec3 c3D;
|
||||
layout(location = 7) in smooth vec4 c4D;
|
||||
|
||||
layout(location = 1) flat in int ic1D;
|
||||
layout(location = 2) flat in ivec3 ic3D;
|
||||
layout(location = 3) flat in ivec4 ic4D;
|
||||
|
||||
const ivec2 ic2D = ivec2(2, 3);
|
||||
|
||||
struct s {
|
||||
int i;
|
||||
sampler2D s;
|
||||
};
|
||||
|
||||
struct S2 {
|
||||
vec3 c;
|
||||
float f;
|
||||
};
|
||||
|
||||
layout(location = 8) in S2 s2;
|
||||
|
||||
layout(location = 0) out vec3 sc;
|
||||
layout(location = 1) out float sf;
|
||||
|
||||
void main()
|
||||
{
|
||||
float f = gl_FragCoord.y;
|
||||
gl_FragDepth = f;
|
||||
|
||||
sc = s2.c;
|
||||
sf = s2.f;
|
||||
|
||||
sinh(c1D) +
|
||||
cosh(c1D) * tanh(c2D);
|
||||
asinh(c4D) + acosh(c4D);
|
||||
atanh(c3D);
|
||||
}
|
||||
|
||||
void foo324(void)
|
||||
{
|
||||
float p = pow(3.2, 4.6);
|
||||
p += sin(0.4);
|
||||
p += distance(vec2(10.0, 11.0), vec2(13.0, 15.0)); // 5
|
||||
p += dot(vec3(2,3,5), vec3(-2,-1,4)); // 13
|
||||
vec3 c3 = cross(vec3(3,-3,1), vec3(4,9,2)); // (-15, -2, 39)
|
||||
c3 += faceforward(vec3(1,2,3), vec3(2,3,5), vec3(-2,-1,4)); // (-1,-2,-3)
|
||||
c3 += faceforward(vec3(1,2,3), vec3(-2,-3,-5), vec3(-2,-1,4)); // (1,2,3)
|
||||
vec2 c2 = reflect(vec2(1,3), vec2(0,1)); // (1,-3)
|
||||
c2 += refract(vec2(1,3), vec2(0,1), 1.0); // (1,-3)
|
||||
c2 += refract(vec2(1,3), vec2(0,1), 3.0);
|
||||
c2 += refract(vec2(1,0.1), vec2(0,1), 5.0); // (0,0)
|
||||
mat3x2 m32 = outerProduct(vec2(2,3), vec3(5,7,11));// rows: (10, 14, 22), (15, 21, 33)
|
||||
}
|
||||
14
Test/web.builtins.vert
Normal file
14
Test/web.builtins.vert
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#version 310 es
|
||||
|
||||
layout(location = 0) in mediump float ps;
|
||||
|
||||
invariant gl_Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(ps);
|
||||
gl_Position *= float(4 - gl_VertexIndex);
|
||||
|
||||
gl_PointSize = ps;
|
||||
gl_PointSize *= float(5 - gl_InstanceIndex);
|
||||
}
|
||||
91
Test/web.controlFlow.frag
Normal file
91
Test/web.controlFlow.frag
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#version 310 es
|
||||
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
int c, d;
|
||||
layout(location = 0) in highp float x;
|
||||
layout(location = 1) in vec4 bigColor;
|
||||
layout(location = 2) in vec4 BaseColor;
|
||||
layout(location = 3) in float f;
|
||||
|
||||
layout(location = 4) flat in int Count;
|
||||
layout(location = 5) flat in uvec4 v4;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float f;
|
||||
int a[2];
|
||||
|
||||
switch(c)
|
||||
{
|
||||
}
|
||||
|
||||
switch (c) { // a no-error normal switch
|
||||
case 1:
|
||||
f = sin(x);
|
||||
break;
|
||||
case 2:
|
||||
switch (d) {
|
||||
case 1:
|
||||
f = x * x * x;
|
||||
break;
|
||||
case 2:
|
||||
f = x * x;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
f = tan(x);
|
||||
}
|
||||
|
||||
vec4 color = BaseColor;
|
||||
|
||||
for (int i = 0; i < Count; ++i) {
|
||||
color += bigColor;
|
||||
}
|
||||
|
||||
outColor = color;
|
||||
|
||||
float sum = 0.0;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
sum += float(v4[i]);
|
||||
|
||||
vec4 tv4;
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
tv4[i] = float(v4[i] * 4u);
|
||||
|
||||
outColor += vec4(sum) + tv4;
|
||||
|
||||
vec4 r;
|
||||
r.xyz = BaseColor.xyz;
|
||||
|
||||
for (int i = 0; i < Count; ++i)
|
||||
r.w = f;
|
||||
|
||||
outColor.xyz += r.xyz;
|
||||
|
||||
for (int i = 0; i < 16; i += 4)
|
||||
outColor *= f;
|
||||
|
||||
int i = 0;
|
||||
int A, B, C, D;
|
||||
while (i<10) {
|
||||
A = 1;
|
||||
if (i%2 == 0) {
|
||||
B = 2;
|
||||
continue;
|
||||
C = 2;
|
||||
}
|
||||
if (i%5 == 0) {
|
||||
B = 2;
|
||||
break;
|
||||
C = 2;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
D = 3;
|
||||
}
|
||||
73
Test/web.operations.frag
Normal file
73
Test/web.operations.frag
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#version 310 es
|
||||
|
||||
precision highp float;
|
||||
|
||||
layout(binding = 0) uniform block {
|
||||
mediump float f;
|
||||
} instanceName;
|
||||
|
||||
struct S {
|
||||
int i;
|
||||
} s;
|
||||
|
||||
float a[5];
|
||||
|
||||
void main()
|
||||
{
|
||||
bool b;
|
||||
float f;
|
||||
int i;
|
||||
uint u;
|
||||
bvec3 b3;
|
||||
vec3 v3;
|
||||
ivec3 iv3;
|
||||
uvec3 uv3;
|
||||
vec4 v4;
|
||||
ivec4 iv4;
|
||||
uvec4 uv4;
|
||||
mat2 m2;
|
||||
mat4 m4;
|
||||
|
||||
f * v4;
|
||||
u + u;
|
||||
uv4 / u;
|
||||
iv3 -= iv3;
|
||||
|
||||
i %= 3;
|
||||
uv3 % 4u;
|
||||
--m2;
|
||||
iv4++;
|
||||
|
||||
m4 != m4;
|
||||
m2 == m2;
|
||||
i <= i;
|
||||
a == a;
|
||||
s != s;
|
||||
|
||||
b && b;
|
||||
b || b;
|
||||
b ^^ b;
|
||||
|
||||
!b, uv3;
|
||||
|
||||
~i;
|
||||
~u;
|
||||
~uv3;
|
||||
~iv3;
|
||||
|
||||
uv3 <<= i;
|
||||
i >> i;
|
||||
u << u;
|
||||
iv3 >> iv3;
|
||||
|
||||
i & i;
|
||||
u | u;
|
||||
iv3 ^ iv3;
|
||||
u & uv3;
|
||||
uv3 | u;
|
||||
uv3 &= u;
|
||||
int arr[0x222 & 0xf];
|
||||
arr[1]; // size 2
|
||||
int arr2[(uvec2(0, 0x2) | 0x1u).y];
|
||||
arr2[2]; // size 3
|
||||
}
|
||||
38
Test/web.runtests
Executable file
38
Test/web.runtests
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
TESTLIST=web.testlist
|
||||
TARGETDIR=localResults
|
||||
BASEDIR=baseResults
|
||||
EXE=../build/install/bin/glslangValidator.exe
|
||||
HASERROR=0
|
||||
mkdir -p $TARGETDIR
|
||||
|
||||
if [ -a $TESTLIST ]
|
||||
then
|
||||
while read t; do
|
||||
echo Running $t...
|
||||
b=`basename $t`
|
||||
$EXE -V -o webtest.spv $t
|
||||
spirv-dis webtest.spv > $TARGETDIR/$b.out
|
||||
rm -f webtest.spv
|
||||
diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
|
||||
done < $TESTLIST
|
||||
else
|
||||
echo $TESTLIST is missing
|
||||
fi
|
||||
|
||||
wc --bytes $EXE > $TARGETDIR/size
|
||||
echo "base size was" `cat $BASEDIR/size`
|
||||
echo "new size is" `cat $TARGETDIR/size`
|
||||
|
||||
#
|
||||
# Final checking
|
||||
#
|
||||
if [ $HASERROR -eq 0 ]
|
||||
then
|
||||
echo Tests Succeeded.
|
||||
else
|
||||
echo Tests Failed.
|
||||
fi
|
||||
|
||||
exit $HASERROR
|
||||
7
Test/web.testlist
Normal file
7
Test/web.testlist
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
web.builtins.vert
|
||||
web.builtins.frag
|
||||
web.basic.vert
|
||||
web.controlFlow.frag
|
||||
web.operations.frag
|
||||
web.texture.frag
|
||||
web.array.frag
|
||||
77
Test/web.texture.frag
Normal file
77
Test/web.texture.frag
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#version 310 es
|
||||
layout(binding = 1) uniform sampler2D s2D;
|
||||
layout(binding = 2) uniform lowp sampler3D s3D;
|
||||
layout(binding = 3) uniform samplerCube sCube;
|
||||
layout(binding = 4) uniform lowp samplerCubeShadow sCubeShadow;
|
||||
layout(binding = 5) uniform lowp sampler2DShadow s2DShadow;
|
||||
layout(binding = 6) uniform lowp sampler2DArray s2DArray;
|
||||
layout(binding = 7) uniform lowp sampler2DArrayShadow s2DArrayShadow;
|
||||
layout(binding = 8) uniform lowp isampler2D is2D;
|
||||
layout(binding = 9) uniform lowp isampler3D is3D;
|
||||
layout(binding = 10) uniform lowp isamplerCube isCube;
|
||||
layout(binding = 11) uniform lowp isampler2DArray is2DArray;
|
||||
layout(binding = 12) uniform lowp usampler2D us2D;
|
||||
layout(binding = 13) uniform lowp usampler3D us3D;
|
||||
layout(binding = 14) uniform lowp usamplerCube usCube;
|
||||
layout(binding = 15) uniform lowp usampler2DArray us2DArray;
|
||||
|
||||
precision lowp float;
|
||||
layout(location = 4) in float c1D;
|
||||
layout(location = 5) in vec2 c2D;
|
||||
layout(location = 6) in vec3 c3D;
|
||||
layout(location = 7) in smooth vec4 c4D;
|
||||
|
||||
layout(location = 1) flat in int ic1D;
|
||||
layout(location = 2) flat in ivec3 ic3D;
|
||||
layout(location = 3) flat in ivec4 ic4D;
|
||||
|
||||
const ivec2 ic2D = ivec2(2, 3);
|
||||
|
||||
struct s {
|
||||
int i;
|
||||
sampler2D s;
|
||||
};
|
||||
|
||||
struct S2 {
|
||||
vec3 c;
|
||||
float f;
|
||||
};
|
||||
|
||||
layout(location = 8) in S2 s2;
|
||||
|
||||
layout(location = 0) out vec3 sc;
|
||||
layout(location = 1) out float sf;
|
||||
|
||||
layout(binding = 0) uniform sampler2D arrayedSampler[5];
|
||||
|
||||
void main()
|
||||
{
|
||||
float f;
|
||||
vec4 v;
|
||||
v = texture(s2D, c2D);
|
||||
v = textureProj(s3D, c4D);
|
||||
v = textureLod(s2DArray, c3D, 1.2);
|
||||
v = texelFetch(s3D, ic3D, ic1D);
|
||||
f = textureLodOffset(s2DShadow, c3D, c1D, ic2D);
|
||||
v = textureProjLodOffset(s2D, c3D, c1D, ic2D);
|
||||
v = textureGrad(sCube, c3D, c3D, c3D);
|
||||
f = textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D);
|
||||
v = textureProjGrad(s3D, c4D, c3D, c3D);
|
||||
v = textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D);
|
||||
|
||||
ivec4 iv;
|
||||
iv = texture(is2D, c2D);
|
||||
iv = textureProjOffset(is2D, c4D, ic2D);
|
||||
iv = textureProjLod(is2D, c3D, c1D);
|
||||
iv = textureProjGrad(is2D, c3D, c2D, c2D);
|
||||
iv = texture(is3D, c3D, 4.2);
|
||||
iv = textureLod(isCube, c3D, c1D);
|
||||
iv = texelFetch(is2DArray, ic3D, ic1D);
|
||||
|
||||
iv.xy = textureSize(sCubeShadow, 2);
|
||||
}
|
||||
|
||||
void foo23()
|
||||
{
|
||||
textureOffset(s2DShadow, c3D, ivec2(-8, 7), c1D);
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ else(WIN32)
|
|||
endif(WIN32)
|
||||
|
||||
set(SOURCES
|
||||
MachineIndependent/glslang.m4
|
||||
MachineIndependent/glslang.y
|
||||
MachineIndependent/glslang_tab.cpp
|
||||
MachineIndependent/attribute.cpp
|
||||
|
|
@ -71,15 +72,6 @@ set(HEADERS
|
|||
MachineIndependent/preprocessor/PpContext.h
|
||||
MachineIndependent/preprocessor/PpTokens.h)
|
||||
|
||||
# This might be useful for making grammar changes:
|
||||
#
|
||||
# find_package(BISON)
|
||||
# add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp.h
|
||||
# COMMAND ${BISON_EXECUTABLE} --defines=${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp.h -t ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang.y -o ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp
|
||||
# MAIN_DEPENDENCY MachineIndependent/glslang.y
|
||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
# set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp)
|
||||
|
||||
glslang_pch(SOURCES MachineIndependent/pch.cpp)
|
||||
|
||||
add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
|
||||
|
|
|
|||
|
|
@ -61,11 +61,7 @@ enum TBasicType {
|
|||
EbtSampler,
|
||||
EbtStruct,
|
||||
EbtBlock,
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
EbtAccStructNV,
|
||||
#endif
|
||||
|
||||
EbtReference,
|
||||
|
||||
// HLSL types that live only temporarily.
|
||||
|
|
@ -94,13 +90,11 @@ enum TStorageQualifier {
|
|||
EvqBuffer, // read/write, shared with app
|
||||
EvqShared, // compute shader's read/write 'shared' qualifier
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
EvqPayloadNV,
|
||||
EvqPayloadInNV,
|
||||
EvqHitAttrNV,
|
||||
EvqCallableDataNV,
|
||||
EvqCallableDataInNV,
|
||||
#endif
|
||||
|
||||
// parameters
|
||||
EvqIn, // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter
|
||||
|
|
@ -221,7 +215,6 @@ enum TBuiltInVariable {
|
|||
EbvSampleMask,
|
||||
EbvHelperInvocation,
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EbvBaryCoordNoPersp,
|
||||
EbvBaryCoordNoPerspCentroid,
|
||||
EbvBaryCoordNoPerspSample,
|
||||
|
|
@ -229,7 +222,6 @@ enum TBuiltInVariable {
|
|||
EbvBaryCoordSmoothCentroid,
|
||||
EbvBaryCoordSmoothSample,
|
||||
EbvBaryCoordPullModel,
|
||||
#endif
|
||||
|
||||
EbvViewIndex,
|
||||
EbvDeviceIndex,
|
||||
|
|
@ -237,7 +229,6 @@ enum TBuiltInVariable {
|
|||
EbvFragSizeEXT,
|
||||
EbvFragInvocationCountEXT,
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
EbvViewportMaskNV,
|
||||
EbvSecondaryPositionNV,
|
||||
EbvSecondaryViewportMaskNV,
|
||||
|
|
@ -273,7 +264,6 @@ enum TBuiltInVariable {
|
|||
EbvLayerPerViewNV,
|
||||
EbvMeshViewCountNV,
|
||||
EbvMeshViewIndicesNV,
|
||||
#endif
|
||||
|
||||
// sm builtins
|
||||
EbvWarpsPerSM,
|
||||
|
|
@ -299,6 +289,19 @@ enum TBuiltInVariable {
|
|||
EbvLast
|
||||
};
|
||||
|
||||
// In this enum, order matters; users can assume higher precision is a bigger value
|
||||
// and EpqNone is 0.
|
||||
enum TPrecisionQualifier {
|
||||
EpqNone = 0,
|
||||
EpqLow,
|
||||
EpqMedium,
|
||||
EpqHigh
|
||||
};
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
__inline const char* GetStorageQualifierString(TStorageQualifier q) { return ""; }
|
||||
__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) { return ""; }
|
||||
#else
|
||||
// These will show up in error messages
|
||||
__inline const char* GetStorageQualifierString(TStorageQualifier q)
|
||||
{
|
||||
|
|
@ -325,13 +328,11 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q)
|
|||
case EvqPointCoord: return "gl_PointCoord"; break;
|
||||
case EvqFragColor: return "fragColor"; break;
|
||||
case EvqFragDepth: return "gl_FragDepth"; break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EvqPayloadNV: return "rayPayloadNV"; break;
|
||||
case EvqPayloadInNV: return "rayPayloadInNV"; break;
|
||||
case EvqHitAttrNV: return "hitAttributeNV"; break;
|
||||
case EvqCallableDataNV: return "callableDataNV"; break;
|
||||
case EvqCallableDataInNV: return "callableDataInNV"; break;
|
||||
#endif
|
||||
default: return "unknown qualifier";
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +414,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
case EbvSampleMask: return "SampleMaskIn";
|
||||
case EbvHelperInvocation: return "HelperInvocation";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbvBaryCoordNoPersp: return "BaryCoordNoPersp";
|
||||
case EbvBaryCoordNoPerspCentroid: return "BaryCoordNoPerspCentroid";
|
||||
case EbvBaryCoordNoPerspSample: return "BaryCoordNoPerspSample";
|
||||
|
|
@ -421,7 +421,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
case EbvBaryCoordSmoothCentroid: return "BaryCoordSmoothCentroid";
|
||||
case EbvBaryCoordSmoothSample: return "BaryCoordSmoothSample";
|
||||
case EbvBaryCoordPullModel: return "BaryCoordPullModel";
|
||||
#endif
|
||||
|
||||
case EbvViewIndex: return "ViewIndex";
|
||||
case EbvDeviceIndex: return "DeviceIndex";
|
||||
|
|
@ -429,7 +428,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
case EbvFragSizeEXT: return "FragSizeEXT";
|
||||
case EbvFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EbvViewportMaskNV: return "ViewportMaskNV";
|
||||
case EbvSecondaryPositionNV: return "SecondaryPositionNV";
|
||||
case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
|
||||
|
|
@ -464,7 +462,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
case EbvLayerPerViewNV: return "LayerPerViewNV";
|
||||
case EbvMeshViewCountNV: return "MeshViewCountNV";
|
||||
case EbvMeshViewIndicesNV: return "MeshViewIndicesNV";
|
||||
#endif
|
||||
|
||||
case EbvWarpsPerSM: return "WarpsPerSMNV";
|
||||
case EbvSMCount: return "SMCountNV";
|
||||
|
|
@ -475,15 +472,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
|||
}
|
||||
}
|
||||
|
||||
// In this enum, order matters; users can assume higher precision is a bigger value
|
||||
// and EpqNone is 0.
|
||||
enum TPrecisionQualifier {
|
||||
EpqNone = 0,
|
||||
EpqLow,
|
||||
EpqMedium,
|
||||
EpqHigh
|
||||
};
|
||||
|
||||
__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p)
|
||||
{
|
||||
switch (p) {
|
||||
|
|
@ -494,6 +482,7 @@ __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p)
|
|||
default: return "unknown precision qualifier";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
__inline bool isTypeSignedInt(TBasicType type)
|
||||
{
|
||||
|
|
@ -538,7 +527,8 @@ __inline bool isTypeFloat(TBasicType type)
|
|||
}
|
||||
}
|
||||
|
||||
__inline int getTypeRank(TBasicType type) {
|
||||
__inline int getTypeRank(TBasicType type)
|
||||
{
|
||||
int res = -1;
|
||||
switch(type) {
|
||||
case EbtInt8:
|
||||
|
|
|
|||
|
|
@ -213,6 +213,28 @@ public:
|
|||
return false;
|
||||
|
||||
switch (type) {
|
||||
case EbtInt:
|
||||
if (constant.iConst == iConst)
|
||||
return true;
|
||||
|
||||
break;
|
||||
case EbtUint:
|
||||
if (constant.uConst == uConst)
|
||||
return true;
|
||||
|
||||
break;
|
||||
case EbtBool:
|
||||
if (constant.bConst == bConst)
|
||||
return true;
|
||||
|
||||
break;
|
||||
case EbtDouble:
|
||||
if (constant.dConst == dConst)
|
||||
return true;
|
||||
|
||||
break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt16:
|
||||
if (constant.i16Const == i16Const)
|
||||
return true;
|
||||
|
|
@ -232,16 +254,6 @@ public:
|
|||
if (constant.u8Const == u8Const)
|
||||
return true;
|
||||
|
||||
break;
|
||||
case EbtInt:
|
||||
if (constant.iConst == iConst)
|
||||
return true;
|
||||
|
||||
break;
|
||||
case EbtUint:
|
||||
if (constant.uConst == uConst)
|
||||
return true;
|
||||
|
||||
break;
|
||||
case EbtInt64:
|
||||
if (constant.i64Const == i64Const)
|
||||
|
|
@ -253,16 +265,7 @@ public:
|
|||
return true;
|
||||
|
||||
break;
|
||||
case EbtDouble:
|
||||
if (constant.dConst == dConst)
|
||||
return true;
|
||||
|
||||
break;
|
||||
case EbtBool:
|
||||
if (constant.bConst == bConst)
|
||||
return true;
|
||||
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
assert(false && "Default missing");
|
||||
}
|
||||
|
|
@ -329,6 +332,22 @@ public:
|
|||
{
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt:
|
||||
if (iConst > constant.iConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtUint:
|
||||
if (uConst > constant.uConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtDouble:
|
||||
if (dConst > constant.dConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
if (i8Const > constant.i8Const)
|
||||
return true;
|
||||
|
|
@ -348,16 +367,6 @@ public:
|
|||
if (u16Const > constant.u16Const)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtInt:
|
||||
if (iConst > constant.iConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtUint:
|
||||
if (uConst > constant.uConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtInt64:
|
||||
if (i64Const > constant.i64Const)
|
||||
|
|
@ -369,11 +378,7 @@ public:
|
|||
return true;
|
||||
|
||||
return false;
|
||||
case EbtDouble:
|
||||
if (dConst > constant.dConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
#endif
|
||||
default:
|
||||
assert(false && "Default missing");
|
||||
return false;
|
||||
|
|
@ -384,6 +389,7 @@ public:
|
|||
{
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
if (i8Const < constant.i8Const)
|
||||
return true;
|
||||
|
|
@ -402,17 +408,6 @@ public:
|
|||
case EbtUint16:
|
||||
if (u16Const < constant.u16Const)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtInt:
|
||||
if (iConst < constant.iConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtUint:
|
||||
if (uConst < constant.uConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtInt64:
|
||||
if (i64Const < constant.i64Const)
|
||||
|
|
@ -424,10 +419,21 @@ public:
|
|||
return true;
|
||||
|
||||
return false;
|
||||
#endif
|
||||
case EbtDouble:
|
||||
if (dConst < constant.dConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtInt:
|
||||
if (iConst < constant.iConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
case EbtUint:
|
||||
if (uConst < constant.uConst)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
default:
|
||||
assert(false && "Default missing");
|
||||
|
|
@ -440,15 +446,17 @@ public:
|
|||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst + constant.uConst); break;
|
||||
case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setI8Const(i8Const + constant.i8Const); break;
|
||||
case EbtInt16: returnValue.setI16Const(i16Const + constant.i16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
|
||||
case EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); break;
|
||||
case EbtUint8: returnValue.setU8Const(u8Const + constant.u8Const); break;
|
||||
case EbtUint16: returnValue.setU16Const(u16Const + constant.u16Const); break;
|
||||
case EbtUint: returnValue.setUConst(uConst + constant.uConst); break;
|
||||
case EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break;
|
||||
case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -460,15 +468,17 @@ public:
|
|||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst - constant.uConst); break;
|
||||
case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setI8Const(i8Const - constant.i8Const); break;
|
||||
case EbtInt16: returnValue.setI16Const(i16Const - constant.i16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
|
||||
case EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); break;
|
||||
case EbtUint8: returnValue.setU8Const(u8Const - constant.u8Const); break;
|
||||
case EbtUint16: returnValue.setU16Const(u16Const - constant.u16Const); break;
|
||||
case EbtUint: returnValue.setUConst(uConst - constant.uConst); break;
|
||||
case EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break;
|
||||
case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -480,15 +490,17 @@ public:
|
|||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst * constant.uConst); break;
|
||||
case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setI8Const(i8Const * constant.i8Const); break;
|
||||
case EbtInt16: returnValue.setI16Const(i16Const * constant.i16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
|
||||
case EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); break;
|
||||
case EbtUint8: returnValue.setU8Const(u8Const * constant.u8Const); break;
|
||||
case EbtUint16: returnValue.setU16Const(u16Const * constant.u16Const); break;
|
||||
case EbtUint: returnValue.setUConst(uConst * constant.uConst); break;
|
||||
case EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break;
|
||||
case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -500,14 +512,16 @@ public:
|
|||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst % constant.uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setI8Const(i8Const % constant.i8Const); break;
|
||||
case EbtInt16: returnValue.setI8Const(i8Const % constant.i16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
|
||||
case EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break;
|
||||
case EbtUint8: returnValue.setU8Const(u8Const % constant.u8Const); break;
|
||||
case EbtUint16: returnValue.setU16Const(u16Const % constant.u16Const); break;
|
||||
case EbtUint: returnValue.setUConst(uConst % constant.uConst); break;
|
||||
case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -518,6 +532,7 @@ public:
|
|||
{
|
||||
TConstUnion returnValue;
|
||||
switch (type) {
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
switch (constant.type) {
|
||||
case EbtInt8: returnValue.setI8Const(i8Const >> constant.i8Const); break;
|
||||
|
|
@ -570,32 +585,38 @@ public:
|
|||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case EbtInt:
|
||||
switch (constant.type) {
|
||||
case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
|
||||
case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setIConst(iConst >> constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setIConst(iConst >> constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setIConst(iConst >> constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setIConst(iConst >> constant.u16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
|
||||
case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break;
|
||||
case EbtInt64: returnValue.setIConst(iConst >> constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch (constant.type) {
|
||||
case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setUConst(uConst >> constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setUConst(uConst >> constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setUConst(uConst >> constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setUConst(uConst >> constant.u16Const); break;
|
||||
case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break;
|
||||
case EbtInt64: returnValue.setUConst(uConst >> constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt64:
|
||||
switch (constant.type) {
|
||||
case EbtInt8: returnValue.setI64Const(i64Const >> constant.i8Const); break;
|
||||
|
|
@ -622,6 +643,7 @@ public:
|
|||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -632,6 +654,7 @@ public:
|
|||
{
|
||||
TConstUnion returnValue;
|
||||
switch (type) {
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
switch (constant.type) {
|
||||
case EbtInt8: returnValue.setI8Const(i8Const << constant.i8Const); break;
|
||||
|
|
@ -684,32 +707,6 @@ public:
|
|||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
case EbtInt:
|
||||
switch (constant.type) {
|
||||
case EbtInt8: returnValue.setIConst(iConst << constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setIConst(iConst << constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setIConst(iConst << constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
|
||||
case EbtUint: returnValue.setIConst(iConst << constant.uConst); break;
|
||||
case EbtInt64: returnValue.setIConst(iConst << constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch (constant.type) {
|
||||
case EbtInt8: returnValue.setUConst(uConst << constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setUConst(uConst << constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setUConst(uConst << constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break;
|
||||
case EbtInt: returnValue.setUConst(uConst << constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst << constant.uConst); break;
|
||||
case EbtInt64: returnValue.setUConst(uConst << constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
switch (constant.type) {
|
||||
case EbtInt8: returnValue.setI64Const(i64Const << constant.i8Const); break;
|
||||
|
|
@ -736,6 +733,37 @@ public:
|
|||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case EbtInt:
|
||||
switch (constant.type) {
|
||||
case EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
|
||||
case EbtUint: returnValue.setIConst(iConst << constant.uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setIConst(iConst << constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setIConst(iConst << constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setIConst(iConst << constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break;
|
||||
case EbtInt64: returnValue.setIConst(iConst << constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch (constant.type) {
|
||||
case EbtInt: returnValue.setUConst(uConst << constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst << constant.uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setUConst(uConst << constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setUConst(uConst << constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setUConst(uConst << constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break;
|
||||
case EbtInt64: returnValue.setUConst(uConst << constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -747,14 +775,16 @@ public:
|
|||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst & constant.uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setI8Const(i8Const & constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setU8Const(u8Const & constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setI16Const(i16Const & constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setU16Const(u16Const & constant.u16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst & constant.uConst); break;
|
||||
case EbtInt64: returnValue.setI64Const(i64Const & constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -766,14 +796,16 @@ public:
|
|||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst | constant.uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setI8Const(i8Const | constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setU8Const(u8Const | constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setI16Const(i16Const | constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setU16Const(u16Const | constant.u16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst | constant.uConst); break;
|
||||
case EbtInt64: returnValue.setI64Const(i64Const | constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -785,14 +817,16 @@ public:
|
|||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setI8Const(i8Const ^ constant.i8Const); break;
|
||||
case EbtUint8: returnValue.setU8Const(u8Const ^ constant.u8Const); break;
|
||||
case EbtInt16: returnValue.setI16Const(i16Const ^ constant.i16Const); break;
|
||||
case EbtUint16: returnValue.setU16Const(u16Const ^ constant.u16Const); break;
|
||||
case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break;
|
||||
case EbtInt64: returnValue.setI64Const(i64Const ^ constant.i64Const); break;
|
||||
case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
@ -803,14 +837,16 @@ public:
|
|||
{
|
||||
TConstUnion returnValue;
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(~iConst); break;
|
||||
case EbtUint: returnValue.setUConst(~uConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: returnValue.setI8Const(~i8Const); break;
|
||||
case EbtUint8: returnValue.setU8Const(~u8Const); break;
|
||||
case EbtInt16: returnValue.setI16Const(~i16Const); break;
|
||||
case EbtUint16: returnValue.setU16Const(~u16Const); break;
|
||||
case EbtInt: returnValue.setIConst(~iConst); break;
|
||||
case EbtUint: returnValue.setUConst(~uConst); break;
|
||||
case EbtInt64: returnValue.setI64Const(~i64Const); break;
|
||||
case EbtUint64: returnValue.setU64Const(~u64Const); break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,32 +79,64 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||
bool ms : 1;
|
||||
bool image : 1; // image, combined should be false
|
||||
bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler
|
||||
bool sampler : 1; // true means a pure sampler, other fields should be clear()
|
||||
bool external : 1; // GL_OES_EGL_image_external
|
||||
bool yuv : 1; // GL_EXT_YUV_target
|
||||
#ifdef ENABLE_HLSL
|
||||
unsigned int vectorSize : 3; // vector return type size.
|
||||
unsigned int getVectorSize() const { return vectorSize; }
|
||||
void clearReturnStruct() { structReturnIndex = noReturnStruct; }
|
||||
bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
|
||||
unsigned getStructReturnIndex() const { return structReturnIndex; }
|
||||
|
||||
// Some languages support structures as sample results. Storing the whole structure in the
|
||||
// TSampler is too large, so there is an index to a separate table.
|
||||
static const unsigned structReturnIndexBits = 4; // number of index bits to use.
|
||||
static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values
|
||||
static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type.
|
||||
|
||||
// Index into a language specific table of texture return structures.
|
||||
unsigned int structReturnIndex : structReturnIndexBits;
|
||||
#else
|
||||
unsigned int getVectorSize() const { return 4; }
|
||||
void clearReturnStruct() const { }
|
||||
bool hasReturnStruct() const { return false; }
|
||||
unsigned getStructReturnIndex() const { return 0; }
|
||||
#endif
|
||||
|
||||
// Encapsulate getting members' vector sizes packed into the vectorSize bitfield.
|
||||
unsigned int getVectorSize() const { return vectorSize; }
|
||||
#ifdef GLSLANG_WEB
|
||||
bool is1D() const { return false; }
|
||||
bool isBuffer() const { return false; }
|
||||
bool isRect() const { return false; }
|
||||
bool isSubpass() const { return false; }
|
||||
bool isCombined() const { return true; }
|
||||
bool isPureSampler() const { return false; }
|
||||
bool isTexture() const { return false; }
|
||||
bool isImage() const { return false; }
|
||||
bool isImageClass() const { return false; }
|
||||
bool isMultiSample() const { return false; }
|
||||
bool isExternal() const { return false; }
|
||||
void setExternal(bool e) { }
|
||||
bool isYuv() const { return false; }
|
||||
#else
|
||||
bool sampler : 1; // true means a pure sampler, other fields should be clear()
|
||||
bool external : 1; // GL_OES_EGL_image_external
|
||||
bool yuv : 1; // GL_EXT_YUV_target
|
||||
// Some languages support structures as sample results. Storing the whole structure in the
|
||||
// TSampler is too large, so there is an index to a separate table.
|
||||
|
||||
bool isImage() const { return image && dim != EsdSubpass; }
|
||||
bool is1D() const { return dim == Esd1D; }
|
||||
bool isBuffer() const { return dim == EsdBuffer; }
|
||||
bool isRect() const { return dim == EsdRect; }
|
||||
bool isSubpass() const { return dim == EsdSubpass; }
|
||||
bool isCombined() const { return combined; }
|
||||
bool isPureSampler() const { return sampler; }
|
||||
bool isTexture() const { return !sampler && !image; }
|
||||
bool isImage() const { return image && !isSubpass(); }
|
||||
bool isImageClass() const { return image; }
|
||||
bool isMultiSample() const { return ms; }
|
||||
bool isExternal() const { return external; }
|
||||
void setExternal(bool e) { external = e; }
|
||||
bool isYuv() const { return yuv; }
|
||||
#endif
|
||||
void setCombined(bool c) { combined = c; }
|
||||
bool isShadow() const { return shadow; }
|
||||
bool isArrayed() const { return arrayed; }
|
||||
bool isMultiSample() const { return ms; }
|
||||
bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
|
||||
|
||||
void clear()
|
||||
{
|
||||
|
|
@ -115,13 +147,17 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||
ms = false;
|
||||
image = false;
|
||||
combined = false;
|
||||
#ifndef GLSLANG_WEB
|
||||
sampler = false;
|
||||
external = false;
|
||||
yuv = false;
|
||||
structReturnIndex = noReturnStruct;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
clearReturnStruct();
|
||||
// by default, returns a single vec4;
|
||||
vectorSize = 4;
|
||||
#endif
|
||||
}
|
||||
|
||||
// make a combined sampler and texture
|
||||
|
|
@ -159,6 +195,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||
ms = m;
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// make a subpass input attachment
|
||||
void setSubpass(TBasicType t, bool m = false)
|
||||
{
|
||||
|
|
@ -176,6 +213,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||
sampler = true;
|
||||
shadow = s;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool operator==(const TSampler& right) const
|
||||
{
|
||||
|
|
@ -183,14 +221,14 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||
dim == right.dim &&
|
||||
arrayed == right.arrayed &&
|
||||
shadow == right.shadow &&
|
||||
ms == right.ms &&
|
||||
image == right.image &&
|
||||
combined == right.combined &&
|
||||
sampler == right.sampler &&
|
||||
external == right.external &&
|
||||
yuv == right.yuv &&
|
||||
vectorSize == right.vectorSize &&
|
||||
structReturnIndex == right.structReturnIndex;
|
||||
isMultiSample() == right.isMultiSample() &&
|
||||
isImageClass() == right.isImageClass() &&
|
||||
isCombined() == right.isCombined() &&
|
||||
isPureSampler() == right.isPureSampler() &&
|
||||
isExternal() == right.isExternal() &&
|
||||
isYuv() == right.isYuv() &&
|
||||
getVectorSize() == right.getVectorSize() &&
|
||||
getStructReturnIndex() == right.getStructReturnIndex();
|
||||
}
|
||||
|
||||
bool operator!=(const TSampler& right) const
|
||||
|
|
@ -202,54 +240,55 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||
{
|
||||
TString s;
|
||||
|
||||
if (sampler) {
|
||||
if (isPureSampler()) {
|
||||
s.append("sampler");
|
||||
return s;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case EbtFloat: break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt: s.append("i"); break;
|
||||
case EbtUint: s.append("u"); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtFloat16: s.append("f16"); break;
|
||||
#endif
|
||||
case EbtInt8: s.append("i8"); break;
|
||||
case EbtUint16: s.append("u8"); break;
|
||||
case EbtInt16: s.append("i16"); break;
|
||||
case EbtUint8: s.append("u16"); break;
|
||||
case EbtInt: s.append("i"); break;
|
||||
case EbtUint: s.append("u"); break;
|
||||
case EbtInt64: s.append("i64"); break;
|
||||
case EbtUint64: s.append("u64"); break;
|
||||
default: break; // some compilers want this
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
if (image) {
|
||||
if (dim == EsdSubpass)
|
||||
if (isImageClass()) {
|
||||
if (isSubpass())
|
||||
s.append("subpass");
|
||||
else
|
||||
s.append("image");
|
||||
} else if (combined) {
|
||||
} else if (isCombined()) {
|
||||
s.append("sampler");
|
||||
} else {
|
||||
s.append("texture");
|
||||
}
|
||||
if (external) {
|
||||
if (isExternal()) {
|
||||
s.append("ExternalOES");
|
||||
return s;
|
||||
}
|
||||
if (yuv) {
|
||||
if (isYuv()) {
|
||||
return "__" + s + "External2DY2YEXT";
|
||||
}
|
||||
switch (dim) {
|
||||
case Esd1D: s.append("1D"); break;
|
||||
case Esd2D: s.append("2D"); break;
|
||||
case Esd3D: s.append("3D"); break;
|
||||
case EsdCube: s.append("Cube"); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case Esd1D: s.append("1D"); break;
|
||||
case EsdRect: s.append("2DRect"); break;
|
||||
case EsdBuffer: s.append("Buffer"); break;
|
||||
case EsdSubpass: s.append("Input"); break;
|
||||
#endif
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
if (ms)
|
||||
if (isMultiSample())
|
||||
s.append("MS");
|
||||
if (arrayed)
|
||||
s.append("Array");
|
||||
|
|
@ -442,9 +481,11 @@ public:
|
|||
{
|
||||
precision = EpqNone;
|
||||
invariant = false;
|
||||
noContraction = false;
|
||||
makeTemporary();
|
||||
declaredBuiltIn = EbvNone;
|
||||
#ifndef GLSLANG_WEB
|
||||
noContraction = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// drop qualifiers that don't belong in a temporary variable
|
||||
|
|
@ -463,8 +504,10 @@ public:
|
|||
void clearInterstage()
|
||||
{
|
||||
clearInterpolation();
|
||||
#ifndef GLSLANG_WEB
|
||||
patch = false;
|
||||
sample = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void clearInterpolation()
|
||||
|
|
@ -472,11 +515,9 @@ public:
|
|||
centroid = false;
|
||||
smooth = false;
|
||||
flat = false;
|
||||
#ifndef GLSLANG_WEB
|
||||
nopersp = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
explicitInterp = false;
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
pervertexNV = false;
|
||||
perPrimitiveNV = false;
|
||||
perViewNV = false;
|
||||
|
|
@ -519,22 +560,9 @@ public:
|
|||
static_assert(EbvLast < 256, "need to increase size of TBuiltInVariable bitfields!");
|
||||
TPrecisionQualifier precision : 3;
|
||||
bool invariant : 1; // require canonical treatment for cross-shader invariance
|
||||
bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects
|
||||
bool centroid : 1;
|
||||
bool smooth : 1;
|
||||
bool flat : 1;
|
||||
bool nopersp : 1;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool explicitInterp : 1;
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
bool pervertexNV : 1;
|
||||
bool perPrimitiveNV : 1;
|
||||
bool perViewNV : 1;
|
||||
bool perTaskNV : 1;
|
||||
#endif
|
||||
bool patch : 1;
|
||||
bool sample : 1;
|
||||
bool coherent : 1;
|
||||
bool devicecoherent : 1;
|
||||
bool queuefamilycoherent : 1;
|
||||
|
|
@ -545,9 +573,37 @@ public:
|
|||
bool restrict : 1;
|
||||
bool readonly : 1;
|
||||
bool writeonly : 1;
|
||||
bool specConstant : 1; // having a constant_id is not sufficient: expressions have no id, but are still specConstant
|
||||
// having a constant_id is not sufficient: expressions have no id, but are still specConstant
|
||||
bool specConstant : 1;
|
||||
bool nonUniform : 1;
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
bool isWriteOnly() const { return false; }
|
||||
bool isReadOnly() const { return false; }
|
||||
bool isSample() const { return false; }
|
||||
bool isMemory() const { return false; }
|
||||
bool isMemoryQualifierImageAndSSBOOnly() const { return false; }
|
||||
bool bufferReferenceNeedsVulkanMemoryModel() const { return false; }
|
||||
bool isInterpolation() const { return flat || smooth; }
|
||||
bool isExplicitInterpolation() const { return false; }
|
||||
bool isAuxiliary() const { return centroid; }
|
||||
bool isPatch() const { return false; }
|
||||
bool isNoContraction() const { return false; }
|
||||
void setNoContraction() { }
|
||||
bool isPervertexNV() const { return false; }
|
||||
#else
|
||||
bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects
|
||||
bool nopersp : 1;
|
||||
bool explicitInterp : 1;
|
||||
bool pervertexNV : 1;
|
||||
bool perPrimitiveNV : 1;
|
||||
bool perViewNV : 1;
|
||||
bool perTaskNV : 1;
|
||||
bool patch : 1;
|
||||
bool sample : 1;
|
||||
bool isWriteOnly() const { return writeonly; }
|
||||
bool isReadOnly() const { return readonly; }
|
||||
bool isSample() const { return sample; }
|
||||
bool isMemory() const
|
||||
{
|
||||
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate;
|
||||
|
|
@ -561,31 +617,23 @@ public:
|
|||
// include qualifiers that map to load/store availability/visibility/nonprivate memory access operands
|
||||
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || nonprivate;
|
||||
}
|
||||
|
||||
bool isInterpolation() const
|
||||
{
|
||||
#ifdef AMD_EXTENSIONS
|
||||
return flat || smooth || nopersp || explicitInterp;
|
||||
#else
|
||||
return flat || smooth || nopersp;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool isExplicitInterpolation() const
|
||||
{
|
||||
return explicitInterp;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isAuxiliary() const
|
||||
{
|
||||
#ifdef NV_EXTENSIONS
|
||||
return centroid || patch || sample || pervertexNV;
|
||||
#else
|
||||
return centroid || patch || sample;
|
||||
#endif
|
||||
}
|
||||
bool isPatch() const { return patch; }
|
||||
bool isNoContraction() const { return noContraction; }
|
||||
void setNoContraction() { noContraction = true; }
|
||||
bool isPervertexNV() const { return pervertexNV; }
|
||||
#endif
|
||||
|
||||
bool isPipeInput() const
|
||||
{
|
||||
|
|
@ -651,33 +699,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool isPerPrimitive() const
|
||||
{
|
||||
#ifdef NV_EXTENSIONS
|
||||
return perPrimitiveNV;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isPerView() const
|
||||
{
|
||||
#ifdef NV_EXTENSIONS
|
||||
return perViewNV;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isTaskMemory() const
|
||||
{
|
||||
#ifdef NV_EXTENSIONS
|
||||
return perTaskNV;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isIo() const
|
||||
{
|
||||
switch (storage) {
|
||||
|
|
@ -717,6 +738,15 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
bool isPerView() const { return false; }
|
||||
bool isTaskMemory() const { return false; }
|
||||
bool isArrayedIo(EShLanguage language) const { return false; }
|
||||
#else
|
||||
bool isPerPrimitive() const { return perPrimitiveNV; }
|
||||
bool isPerView() const { return perViewNV; }
|
||||
bool isTaskMemory() const { return perTaskNV; }
|
||||
|
||||
// True if this type of IO is supposed to be arrayed with extra level for per-vertex data
|
||||
bool isArrayedIo(EShLanguage language) const
|
||||
{
|
||||
|
|
@ -727,49 +757,50 @@ public:
|
|||
return ! patch && (isPipeInput() || isPipeOutput());
|
||||
case EShLangTessEvaluation:
|
||||
return ! patch && isPipeInput();
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangFragment:
|
||||
return pervertexNV && isPipeInput();
|
||||
case EShLangMeshNV:
|
||||
return ! perTaskNV && isPipeOutput();
|
||||
#endif
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield
|
||||
void clearLayout() // all layout
|
||||
{
|
||||
clearUniformLayout();
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
layoutPushConstant = false;
|
||||
layoutBufferReference = false;
|
||||
#ifdef NV_EXTENSIONS
|
||||
layoutPassthrough = false;
|
||||
layoutViewportRelative = false;
|
||||
// -2048 as the default value indicating layoutSecondaryViewportRelative is not set
|
||||
layoutSecondaryViewportRelativeOffset = -2048;
|
||||
layoutShaderRecordNV = false;
|
||||
#endif
|
||||
|
||||
layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
|
||||
layoutFormat = ElfNone;
|
||||
#endif
|
||||
|
||||
clearInterstageLayout();
|
||||
|
||||
layoutSpecConstantId = layoutSpecConstantIdEnd;
|
||||
|
||||
layoutFormat = ElfNone;
|
||||
}
|
||||
void clearInterstageLayout()
|
||||
{
|
||||
layoutLocation = layoutLocationEnd;
|
||||
layoutComponent = layoutComponentEnd;
|
||||
layoutIndex = layoutIndexEnd;
|
||||
#ifndef GLSLANG_WEB
|
||||
clearStreamLayout();
|
||||
clearXfbLayout();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
void clearStreamLayout()
|
||||
{
|
||||
layoutStream = layoutStreamEnd;
|
||||
|
|
@ -780,6 +811,7 @@ public:
|
|||
layoutXfbStride = layoutXfbStrideEnd;
|
||||
layoutXfbOffset = layoutXfbOffsetEnd;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool hasNonXfbLayout() const
|
||||
{
|
||||
|
|
@ -787,11 +819,9 @@ public:
|
|||
hasAnyLocation() ||
|
||||
hasStream() ||
|
||||
hasFormat() ||
|
||||
#ifdef NV_EXTENSIONS
|
||||
layoutShaderRecordNV ||
|
||||
#endif
|
||||
layoutPushConstant ||
|
||||
layoutBufferReference;
|
||||
isShaderRecordNV() ||
|
||||
isPushConstant() ||
|
||||
hasBufferReference();
|
||||
}
|
||||
bool hasLayout() const
|
||||
{
|
||||
|
|
@ -836,6 +866,7 @@ public:
|
|||
unsigned int layoutSpecConstantId : 11;
|
||||
static const unsigned int layoutSpecConstantIdEnd = 0x7FF;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// stored as log2 of the actual alignment value
|
||||
unsigned int layoutBufferReferenceAlign : 6;
|
||||
static const unsigned int layoutBufferReferenceAlignEnd = 0x3F;
|
||||
|
|
@ -844,8 +875,6 @@ public:
|
|||
|
||||
bool layoutPushConstant;
|
||||
bool layoutBufferReference;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
bool layoutPassthrough;
|
||||
bool layoutViewportRelative;
|
||||
int layoutSecondaryViewportRelativeOffset;
|
||||
|
|
@ -881,10 +910,6 @@ public:
|
|||
{
|
||||
return layoutPacking != ElpNone;
|
||||
}
|
||||
bool hasOffset() const
|
||||
{
|
||||
return layoutOffset != layoutNotSet;
|
||||
}
|
||||
bool hasAlign() const
|
||||
{
|
||||
return layoutAlign != layoutNotSet;
|
||||
|
|
@ -899,14 +924,6 @@ public:
|
|||
{
|
||||
return layoutLocation != layoutLocationEnd;
|
||||
}
|
||||
bool hasComponent() const
|
||||
{
|
||||
return layoutComponent != layoutComponentEnd;
|
||||
}
|
||||
bool hasIndex() const
|
||||
{
|
||||
return layoutIndex != layoutIndexEnd;
|
||||
}
|
||||
bool hasSet() const
|
||||
{
|
||||
return layoutSet != layoutSetEnd;
|
||||
|
|
@ -915,6 +932,38 @@ public:
|
|||
{
|
||||
return layoutBinding != layoutBindingEnd;
|
||||
}
|
||||
#ifdef GLSLANG_WEB
|
||||
bool hasOffset() const { return false; }
|
||||
bool isNonPerspective() const { return false; }
|
||||
bool hasIndex() const { return false; }
|
||||
bool hasComponent() const { return false; }
|
||||
bool hasStream() const { return false; }
|
||||
bool hasFormat() const { return false; }
|
||||
bool hasXfb() const { return false; }
|
||||
bool hasXfbBuffer() const { return false; }
|
||||
bool hasXfbStride() const { return false; }
|
||||
bool hasXfbOffset() const { return false; }
|
||||
bool hasAttachment() const { return false; }
|
||||
TLayoutFormat getFormat() const { return ElfNone; }
|
||||
bool isPushConstant() const { return false; }
|
||||
bool isShaderRecordNV() const { return false; }
|
||||
bool hasBufferReference() const { return false; }
|
||||
bool hasBufferReferenceAlign() const { return false; }
|
||||
bool isNonUniform() const { return false; }
|
||||
#else
|
||||
bool hasOffset() const
|
||||
{
|
||||
return layoutOffset != layoutNotSet;
|
||||
}
|
||||
bool isNonPerspective() const { return nopersp; }
|
||||
bool hasIndex() const
|
||||
{
|
||||
return layoutIndex != layoutIndexEnd;
|
||||
}
|
||||
bool hasComponent() const
|
||||
{
|
||||
return layoutComponent != layoutComponentEnd;
|
||||
}
|
||||
bool hasStream() const
|
||||
{
|
||||
return layoutStream != layoutStreamEnd;
|
||||
|
|
@ -945,16 +994,25 @@ public:
|
|||
{
|
||||
return layoutAttachment != layoutAttachmentEnd;
|
||||
}
|
||||
TLayoutFormat getFormat() const { return layoutFormat; }
|
||||
bool isPushConstant() const { return layoutPushConstant; }
|
||||
bool isShaderRecordNV() const { return layoutShaderRecordNV; }
|
||||
bool hasBufferReference() const { return layoutBufferReference; }
|
||||
bool hasBufferReferenceAlign() const
|
||||
{
|
||||
return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd;
|
||||
}
|
||||
bool isNonUniform() const
|
||||
{
|
||||
return nonUniform;
|
||||
}
|
||||
#endif
|
||||
bool hasSpecConstantId() const
|
||||
{
|
||||
// Not the same thing as being a specialization constant, this
|
||||
// is just whether or not it was declared with an ID.
|
||||
return layoutSpecConstantId != layoutSpecConstantIdEnd;
|
||||
}
|
||||
bool hasBufferReferenceAlign() const
|
||||
{
|
||||
return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd;
|
||||
}
|
||||
bool isSpecConstant() const
|
||||
{
|
||||
// True if type is a specialization constant, whether or not it
|
||||
|
|
@ -962,10 +1020,6 @@ public:
|
|||
// true front-end constant.
|
||||
return specConstant;
|
||||
}
|
||||
bool isNonUniform() const
|
||||
{
|
||||
return nonUniform;
|
||||
}
|
||||
bool isFrontEndConstant() const
|
||||
{
|
||||
// True if the front-end knows the final constant value.
|
||||
|
|
@ -985,11 +1039,13 @@ public:
|
|||
static const char* getLayoutPackingString(TLayoutPacking packing)
|
||||
{
|
||||
switch (packing) {
|
||||
case ElpStd140: return "std140";
|
||||
#ifndef GLSLANG_WEB
|
||||
case ElpPacked: return "packed";
|
||||
case ElpShared: return "shared";
|
||||
case ElpStd140: return "std140";
|
||||
case ElpStd430: return "std430";
|
||||
case ElpScalar: return "scalar";
|
||||
#endif
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
|
@ -1001,6 +1057,9 @@ public:
|
|||
default: return "none";
|
||||
}
|
||||
}
|
||||
#ifdef GLSLANG_WEB
|
||||
static const char* getLayoutFormatString(TLayoutFormat f) { return "none"; }
|
||||
#else
|
||||
static const char* getLayoutFormatString(TLayoutFormat f)
|
||||
{
|
||||
switch (f) {
|
||||
|
|
@ -1135,6 +1194,7 @@ public:
|
|||
default: return "none";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// Qualifiers that don't need to be keep per object. They have shader scope, not object scope.
|
||||
|
|
@ -1150,18 +1210,20 @@ struct TShaderQualifiers {
|
|||
bool pointMode;
|
||||
int localSize[3]; // compute shader
|
||||
int localSizeSpecId[3]; // compute shader specialization id for gl_WorkGroupSize
|
||||
#ifndef GLSLANG_WEB
|
||||
bool earlyFragmentTests; // fragment input
|
||||
bool postDepthCoverage; // fragment input
|
||||
TLayoutDepth layoutDepth;
|
||||
bool blendEquation; // true if any blend equation was specified
|
||||
int numViews; // multiview extenstions
|
||||
TInterlockOrdering interlockOrdering;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
bool layoutOverrideCoverage; // true if layout override_coverage set
|
||||
bool layoutDerivativeGroupQuads; // true if layout derivative_group_quadsNV set
|
||||
bool layoutDerivativeGroupLinear; // true if layout derivative_group_linearNV set
|
||||
int primitives; // mesh shader "max_primitives"DerivativeGroupLinear; // true if layout derivative_group_linearNV set
|
||||
TLayoutDepth getDepth() const { return layoutDepth; }
|
||||
#else
|
||||
TLayoutDepth getDepth() const { return EldNone; }
|
||||
#endif
|
||||
|
||||
void init()
|
||||
|
|
@ -1180,20 +1242,26 @@ struct TShaderQualifiers {
|
|||
localSizeSpecId[0] = TQualifier::layoutNotSet;
|
||||
localSizeSpecId[1] = TQualifier::layoutNotSet;
|
||||
localSizeSpecId[2] = TQualifier::layoutNotSet;
|
||||
#ifndef GLSLANG_WEB
|
||||
earlyFragmentTests = false;
|
||||
postDepthCoverage = false;
|
||||
layoutDepth = EldNone;
|
||||
blendEquation = false;
|
||||
numViews = TQualifier::layoutNotSet;
|
||||
#ifdef NV_EXTENSIONS
|
||||
layoutOverrideCoverage = false;
|
||||
layoutDerivativeGroupQuads = false;
|
||||
layoutDerivativeGroupLinear = false;
|
||||
primitives = TQualifier::layoutNotSet;
|
||||
#endif
|
||||
interlockOrdering = EioNone;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
bool hasBlendEquation() const { return false; }
|
||||
#else
|
||||
bool hasBlendEquation() const { return blendEquation; }
|
||||
#endif
|
||||
|
||||
// Merge in characteristics from the 'src' qualifier. They can override when
|
||||
// set, but never erase when not set.
|
||||
void merge(const TShaderQualifiers& src)
|
||||
|
|
@ -1222,6 +1290,7 @@ struct TShaderQualifiers {
|
|||
if (src.localSizeSpecId[i] != TQualifier::layoutNotSet)
|
||||
localSizeSpecId[i] = src.localSizeSpecId[i];
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
if (src.earlyFragmentTests)
|
||||
earlyFragmentTests = true;
|
||||
if (src.postDepthCoverage)
|
||||
|
|
@ -1232,7 +1301,6 @@ struct TShaderQualifiers {
|
|||
blendEquation = src.blendEquation;
|
||||
if (src.numViews != TQualifier::layoutNotSet)
|
||||
numViews = src.numViews;
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (src.layoutOverrideCoverage)
|
||||
layoutOverrideCoverage = src.layoutOverrideCoverage;
|
||||
if (src.layoutDerivativeGroupQuads)
|
||||
|
|
@ -1241,10 +1309,9 @@ struct TShaderQualifiers {
|
|||
layoutDerivativeGroupLinear = src.layoutDerivativeGroupLinear;
|
||||
if (src.primitives != TQualifier::layoutNotSet)
|
||||
primitives = src.primitives;
|
||||
#endif
|
||||
|
||||
if (src.interlockOrdering != EioNone)
|
||||
interlockOrdering = src.interlockOrdering;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1271,6 +1338,12 @@ public:
|
|||
TSourceLoc loc;
|
||||
TArraySizes* typeParameters;
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
bool isCoopmat() const { return false; }
|
||||
#else
|
||||
bool isCoopmat() const { return coopmat; }
|
||||
#endif
|
||||
|
||||
void initType(const TSourceLoc& l)
|
||||
{
|
||||
basicType = EbtVoid;
|
||||
|
|
@ -1374,7 +1447,7 @@ public:
|
|||
}
|
||||
typeName = NewPoolTString(p.userDef->getTypeName().c_str());
|
||||
}
|
||||
if (p.coopmat && p.basicType == EbtFloat &&
|
||||
if (p.isCoopmat() && p.basicType == EbtFloat &&
|
||||
p.typeParameters && p.typeParameters->getNumDims() > 0 &&
|
||||
p.typeParameters->getDimSize(0) == 16) {
|
||||
basicType = EbtFloat16;
|
||||
|
|
@ -1483,7 +1556,7 @@ public:
|
|||
referentType = copyOf.referentType;
|
||||
}
|
||||
typeParameters = copyOf.typeParameters;
|
||||
coopmat = copyOf.coopmat;
|
||||
coopmat = copyOf.isCoopMat();
|
||||
}
|
||||
|
||||
// Make complete copy of the whole type graph rooted at 'copyOf'.
|
||||
|
|
@ -1542,7 +1615,11 @@ public:
|
|||
virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); }
|
||||
virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); }
|
||||
virtual int getCumulativeArraySize() const { return arraySizes->getCumulativeSize(); }
|
||||
virtual bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; }
|
||||
#ifdef GLSLANG_WEB
|
||||
bool isArrayOfArrays() const { return false; }
|
||||
#else
|
||||
bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; }
|
||||
#endif
|
||||
virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); }
|
||||
virtual const TArraySizes* getArraySizes() const { return arraySizes; }
|
||||
virtual TArraySizes* getArraySizes() { return arraySizes; }
|
||||
|
|
@ -1580,9 +1657,9 @@ public:
|
|||
}
|
||||
return false;
|
||||
}
|
||||
virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint
|
||||
#ifdef NV_EXTENSIONS
|
||||
|| basicType == EbtAccStructNV
|
||||
virtual bool isOpaque() const { return basicType == EbtSampler
|
||||
#ifndef GLSLANG_WEB
|
||||
|| basicType == EbtAtomicUint || basicType == EbtAccStructNV
|
||||
#endif
|
||||
; }
|
||||
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
|
||||
|
|
@ -1592,7 +1669,15 @@ public:
|
|||
virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
|
||||
virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); }
|
||||
virtual bool isParameterized() const { return typeParameters != nullptr; }
|
||||
virtual bool isCoopMat() const { return coopmat; }
|
||||
#ifdef GLSLANG_WEB
|
||||
bool isAtomic() const { return false; }
|
||||
bool isCoopMat() const { return false; }
|
||||
bool isReference() const { return false; }
|
||||
#else
|
||||
bool isAtomic() const { return basicType == EbtAtomicUint; }
|
||||
bool isCoopMat() const { return coopmat; }
|
||||
bool isReference() const { return getBasicType() == EbtReference; }
|
||||
#endif
|
||||
|
||||
// return true if this type contains any subtype which satisfies the given predicate.
|
||||
template <typename P>
|
||||
|
|
@ -1673,20 +1758,44 @@ public:
|
|||
return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } );
|
||||
}
|
||||
|
||||
virtual bool contains16BitInt() const
|
||||
#ifdef GLSLANG_WEB
|
||||
bool containsDouble() const { return false; }
|
||||
bool contains16BitFloat() const { return false; }
|
||||
bool contains64BitInt() const { return false; }
|
||||
bool contains16BitInt() const { return false; }
|
||||
bool contains8BitInt() const { return false; }
|
||||
bool containsCoopMat() const { return false; }
|
||||
bool containsReference() const { return false; }
|
||||
#else
|
||||
bool containsDouble() const
|
||||
{
|
||||
return containsBasicType(EbtDouble);
|
||||
}
|
||||
bool contains16BitFloat() const
|
||||
{
|
||||
return containsBasicType(EbtFloat16);
|
||||
}
|
||||
bool contains64BitInt() const
|
||||
{
|
||||
return containsBasicType(EbtInt64) || containsBasicType(EbtUint64);
|
||||
}
|
||||
bool contains16BitInt() const
|
||||
{
|
||||
return containsBasicType(EbtInt16) || containsBasicType(EbtUint16);
|
||||
}
|
||||
|
||||
virtual bool contains8BitInt() const
|
||||
bool contains8BitInt() const
|
||||
{
|
||||
return containsBasicType(EbtInt8) || containsBasicType(EbtUint8);
|
||||
}
|
||||
|
||||
virtual bool containsCoopMat() const
|
||||
bool containsCoopMat() const
|
||||
{
|
||||
return contains([](const TType* t) { return t->coopmat; } );
|
||||
}
|
||||
bool containsReference() const
|
||||
{
|
||||
return containsBasicType(EbtReference);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Array editing methods. Array descriptors can be shared across
|
||||
// type instances. This allows all uses of the same array
|
||||
|
|
@ -1746,11 +1855,9 @@ public:
|
|||
{
|
||||
if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed()))
|
||||
changeOuterArraySize(getImplicitArraySize());
|
||||
#ifdef NV_EXTENSIONS
|
||||
// For multi-dim per-view arrays, set unsized inner dimension size to 1
|
||||
if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized())
|
||||
arraySizes->clearInnerUnsized();
|
||||
#endif
|
||||
if (isStruct() && structure->size() > 0) {
|
||||
int lastMember = (int)structure->size() - 1;
|
||||
for (int i = 0; i < lastMember; ++i)
|
||||
|
|
@ -1808,16 +1915,17 @@ public:
|
|||
static const char* getBasicString(TBasicType t)
|
||||
{
|
||||
switch (t) {
|
||||
case EbtVoid: return "void";
|
||||
case EbtFloat: return "float";
|
||||
case EbtInt: return "int";
|
||||
case EbtUint: return "uint";
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtVoid: return "void";
|
||||
case EbtDouble: return "double";
|
||||
case EbtFloat16: return "float16_t";
|
||||
case EbtInt8: return "int8_t";
|
||||
case EbtUint8: return "uint8_t";
|
||||
case EbtInt16: return "int16_t";
|
||||
case EbtUint16: return "uint16_t";
|
||||
case EbtInt: return "int";
|
||||
case EbtUint: return "uint";
|
||||
case EbtInt64: return "int64_t";
|
||||
case EbtUint64: return "uint64_t";
|
||||
case EbtBool: return "bool";
|
||||
|
|
@ -1825,14 +1933,20 @@ public:
|
|||
case EbtSampler: return "sampler/image";
|
||||
case EbtStruct: return "structure";
|
||||
case EbtBlock: return "block";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EbtAccStructNV: return "accelerationStructureNV";
|
||||
#endif
|
||||
case EbtReference: return "reference";
|
||||
#endif
|
||||
default: return "unknown type";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
TString getCompleteString() const { return ""; }
|
||||
const char* getStorageQualifierString() const { return ""; }
|
||||
const char* getBuiltInVariableString() const { return ""; }
|
||||
const char* getPrecisionQualifierString() const { return ""; }
|
||||
TString getBasicTypeString() const { return ""; }
|
||||
#else
|
||||
TString getCompleteString() const
|
||||
{
|
||||
TString typeString;
|
||||
|
|
@ -1921,7 +2035,6 @@ public:
|
|||
appendUint(1u << qualifier.layoutBufferReferenceAlign);
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (qualifier.layoutPassthrough)
|
||||
appendStr(" passthrough");
|
||||
if (qualifier.layoutViewportRelative)
|
||||
|
|
@ -1932,7 +2045,6 @@ public:
|
|||
}
|
||||
if (qualifier.layoutShaderRecordNV)
|
||||
appendStr(" shaderRecordNV");
|
||||
#endif
|
||||
|
||||
appendStr(")");
|
||||
}
|
||||
|
|
@ -1950,11 +2062,8 @@ public:
|
|||
appendStr(" flat");
|
||||
if (qualifier.nopersp)
|
||||
appendStr(" noperspective");
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (qualifier.explicitInterp)
|
||||
appendStr(" __explicitInterpAMD");
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (qualifier.pervertexNV)
|
||||
appendStr(" pervertexNV");
|
||||
if (qualifier.perPrimitiveNV)
|
||||
|
|
@ -1963,7 +2072,6 @@ public:
|
|||
appendStr(" perviewNV");
|
||||
if (qualifier.perTaskNV)
|
||||
appendStr(" taskNV");
|
||||
#endif
|
||||
if (qualifier.patch)
|
||||
appendStr(" patch");
|
||||
if (qualifier.sample)
|
||||
|
|
@ -2078,6 +2186,8 @@ public:
|
|||
const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); }
|
||||
const char* getBuiltInVariableString() const { return GetBuiltInVariableString(qualifier.builtIn); }
|
||||
const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); }
|
||||
#endif
|
||||
|
||||
const TTypeList* getStruct() const { assert(isStruct()); return structure; }
|
||||
void setStruct(TTypeList* s) { assert(isStruct()); structure = s; }
|
||||
TTypeList* getWritableStruct() const { assert(isStruct()); return structure; } // This should only be used when known to not be sharing with other threads
|
||||
|
|
@ -2146,10 +2256,10 @@ public:
|
|||
|
||||
bool sameReferenceType(const TType& right) const
|
||||
{
|
||||
if ((basicType == EbtReference) != (right.basicType == EbtReference))
|
||||
if (isReference() != right.isReference())
|
||||
return false;
|
||||
|
||||
if ((basicType != EbtReference) && (right.basicType != EbtReference))
|
||||
if (!isReference() && !right.isReference())
|
||||
return true;
|
||||
|
||||
assert(referentType != nullptr);
|
||||
|
|
@ -2196,7 +2306,7 @@ public:
|
|||
matrixCols == right.matrixCols &&
|
||||
matrixRows == right.matrixRows &&
|
||||
vector1 == right.vector1 &&
|
||||
coopmat == right.coopmat &&
|
||||
isCoopMat() == right.isCoopMat() &&
|
||||
sameStructType(right) &&
|
||||
sameReferenceType(right);
|
||||
}
|
||||
|
|
@ -2205,7 +2315,7 @@ public:
|
|||
// an OK function parameter
|
||||
bool coopMatParameterOK(const TType& right) const
|
||||
{
|
||||
return coopmat && right.coopmat &&
|
||||
return isCoopMat() && right.isCoopMat() &&
|
||||
typeParameters == nullptr && right.typeParameters != nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -2222,12 +2332,13 @@ public:
|
|||
|
||||
unsigned int getBufferReferenceAlignment() const
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
if (getBasicType() == glslang::EbtReference) {
|
||||
return getReferentType()->getQualifier().hasBufferReferenceAlign() ?
|
||||
(1u << getReferentType()->getQualifier().layoutBufferReferenceAlign) : 16u;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -422,11 +422,9 @@ enum TOperator {
|
|||
EOpReflect,
|
||||
EOpRefract,
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpMin3,
|
||||
EOpMax3,
|
||||
EOpMid3,
|
||||
#endif
|
||||
|
||||
EOpDPdx, // Fragment only
|
||||
EOpDPdy, // Fragment only
|
||||
|
|
@ -441,10 +439,7 @@ enum TOperator {
|
|||
EOpInterpolateAtCentroid, // Fragment only
|
||||
EOpInterpolateAtSample, // Fragment only
|
||||
EOpInterpolateAtOffset, // Fragment only
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpInterpolateAtVertex,
|
||||
#endif
|
||||
|
||||
EOpMatrixTimesMatrix,
|
||||
EOpOuterProduct,
|
||||
|
|
@ -534,7 +529,6 @@ enum TOperator {
|
|||
EOpSubgroupQuadSwapVertical,
|
||||
EOpSubgroupQuadSwapDiagonal,
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
EOpSubgroupPartition,
|
||||
EOpSubgroupPartitionedAdd,
|
||||
EOpSubgroupPartitionedMul,
|
||||
|
|
@ -557,11 +551,9 @@ enum TOperator {
|
|||
EOpSubgroupPartitionedExclusiveAnd,
|
||||
EOpSubgroupPartitionedExclusiveOr,
|
||||
EOpSubgroupPartitionedExclusiveXor,
|
||||
#endif
|
||||
|
||||
EOpSubgroupGuardStop,
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpMinInvocations,
|
||||
EOpMaxInvocations,
|
||||
EOpAddInvocations,
|
||||
|
|
@ -588,7 +580,6 @@ enum TOperator {
|
|||
EOpCubeFaceIndex,
|
||||
EOpCubeFaceCoord,
|
||||
EOpTime,
|
||||
#endif
|
||||
|
||||
EOpAtomicAdd,
|
||||
EOpAtomicMin,
|
||||
|
|
@ -795,10 +786,8 @@ enum TOperator {
|
|||
EOpImageQuerySamples,
|
||||
EOpImageLoad,
|
||||
EOpImageStore,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpImageLoadLod,
|
||||
EOpImageStoreLod,
|
||||
#endif
|
||||
EOpImageAtomicAdd,
|
||||
EOpImageAtomicMin,
|
||||
EOpImageAtomicMax,
|
||||
|
|
@ -813,9 +802,7 @@ enum TOperator {
|
|||
EOpSubpassLoad,
|
||||
EOpSubpassLoadMS,
|
||||
EOpSparseImageLoad,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpSparseImageLoadLod,
|
||||
#endif
|
||||
|
||||
EOpImageGuardEnd,
|
||||
|
||||
|
|
@ -853,13 +840,11 @@ enum TOperator {
|
|||
EOpTextureOffsetClamp,
|
||||
EOpTextureGradClamp,
|
||||
EOpTextureGradOffsetClamp,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpTextureGatherLod,
|
||||
EOpTextureGatherLodOffset,
|
||||
EOpTextureGatherLodOffsets,
|
||||
EOpFragmentMaskFetch,
|
||||
EOpFragmentFetch,
|
||||
#endif
|
||||
|
||||
EOpSparseTextureGuardBegin,
|
||||
|
||||
|
|
@ -879,15 +864,12 @@ enum TOperator {
|
|||
EOpSparseTextureOffsetClamp,
|
||||
EOpSparseTextureGradClamp,
|
||||
EOpSparseTextureGradOffsetClamp,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpSparseTextureGatherLod,
|
||||
EOpSparseTextureGatherLodOffset,
|
||||
EOpSparseTextureGatherLodOffsets,
|
||||
#endif
|
||||
|
||||
EOpSparseTextureGuardEnd,
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
EOpImageFootprintGuardBegin,
|
||||
EOpImageSampleFootprintNV,
|
||||
EOpImageSampleFootprintClampNV,
|
||||
|
|
@ -895,7 +877,6 @@ enum TOperator {
|
|||
EOpImageSampleFootprintGradNV,
|
||||
EOpImageSampleFootprintGradClampNV,
|
||||
EOpImageFootprintGuardEnd,
|
||||
#endif
|
||||
EOpSamplingGuardEnd,
|
||||
EOpTextureGuardEnd,
|
||||
|
||||
|
|
@ -914,14 +895,12 @@ enum TOperator {
|
|||
EOpFindLSB,
|
||||
EOpFindMSB,
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
EOpTraceNV,
|
||||
EOpReportIntersectionNV,
|
||||
EOpIgnoreIntersectionNV,
|
||||
EOpTerminateRayNV,
|
||||
EOpExecuteCallableNV,
|
||||
EOpWritePackedPrimitiveIndices4x8NV,
|
||||
#endif
|
||||
//
|
||||
// HLSL operations
|
||||
//
|
||||
|
|
@ -1110,6 +1089,8 @@ public:
|
|||
virtual bool isStruct() const { return type.isStruct(); }
|
||||
virtual bool isFloatingDomain() const { return type.isFloatingDomain(); }
|
||||
virtual bool isIntegerDomain() const { return type.isIntegerDomain(); }
|
||||
bool isAtomic() const { return type.isAtomic(); }
|
||||
bool isReference() const { return type.isReference(); }
|
||||
TString getCompleteString() const { return type.getCompleteString(); }
|
||||
|
||||
protected:
|
||||
|
|
@ -1303,9 +1284,7 @@ struct TCrackedTextureOp {
|
|||
bool grad;
|
||||
bool subpass;
|
||||
bool lodClamp;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool fragMask;
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
|
|
@ -1321,12 +1300,17 @@ public:
|
|||
bool isConstructor() const;
|
||||
bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; }
|
||||
bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; }
|
||||
#ifdef GLSLANG_WEB
|
||||
bool isImage() const { return false; }
|
||||
bool isSparseTexture() const { return false; }
|
||||
bool isImageFootprint() const { return false; }
|
||||
bool isSparseImage() const { return false; }
|
||||
#else
|
||||
bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; }
|
||||
bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; }
|
||||
#ifdef NV_EXTENSIONS
|
||||
bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; }
|
||||
#endif
|
||||
bool isSparseImage() const { return op == EOpSparseImageLoad; }
|
||||
#endif
|
||||
|
||||
void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; }
|
||||
TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ?
|
||||
|
|
@ -1356,9 +1340,7 @@ public:
|
|||
cracked.grad = false;
|
||||
cracked.subpass = false;
|
||||
cracked.lodClamp = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
cracked.fragMask = false;
|
||||
#endif
|
||||
|
||||
switch (op) {
|
||||
case EOpImageQuerySize:
|
||||
|
|
@ -1373,10 +1355,6 @@ public:
|
|||
case EOpTexture:
|
||||
case EOpSparseTexture:
|
||||
break;
|
||||
case EOpTextureClamp:
|
||||
case EOpSparseTextureClamp:
|
||||
cracked.lodClamp = true;
|
||||
break;
|
||||
case EOpTextureProj:
|
||||
cracked.proj = true;
|
||||
break;
|
||||
|
|
@ -1388,22 +1366,17 @@ public:
|
|||
case EOpSparseTextureOffset:
|
||||
cracked.offset = true;
|
||||
break;
|
||||
case EOpTextureOffsetClamp:
|
||||
case EOpSparseTextureOffsetClamp:
|
||||
cracked.offset = true;
|
||||
cracked.lodClamp = true;
|
||||
break;
|
||||
case EOpTextureFetch:
|
||||
case EOpSparseTextureFetch:
|
||||
cracked.fetch = true;
|
||||
if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D)
|
||||
if (sampler.is1D() || (sampler.dim == Esd2D && ! sampler.isMultiSample()) || sampler.dim == Esd3D)
|
||||
cracked.lod = true;
|
||||
break;
|
||||
case EOpTextureFetchOffset:
|
||||
case EOpSparseTextureFetchOffset:
|
||||
cracked.fetch = true;
|
||||
cracked.offset = true;
|
||||
if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D)
|
||||
if (sampler.is1D() || (sampler.dim == Esd2D && ! sampler.isMultiSample()) || sampler.dim == Esd3D)
|
||||
cracked.lod = true;
|
||||
break;
|
||||
case EOpTextureProjOffset:
|
||||
|
|
@ -1428,11 +1401,6 @@ public:
|
|||
case EOpSparseTextureGrad:
|
||||
cracked.grad = true;
|
||||
break;
|
||||
case EOpTextureGradClamp:
|
||||
case EOpSparseTextureGradClamp:
|
||||
cracked.grad = true;
|
||||
cracked.lodClamp = true;
|
||||
break;
|
||||
case EOpTextureGradOffset:
|
||||
case EOpSparseTextureGradOffset:
|
||||
cracked.grad = true;
|
||||
|
|
@ -1447,6 +1415,21 @@ public:
|
|||
cracked.offset = true;
|
||||
cracked.proj = true;
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EOpTextureClamp:
|
||||
case EOpSparseTextureClamp:
|
||||
cracked.lodClamp = true;
|
||||
break;
|
||||
case EOpTextureOffsetClamp:
|
||||
case EOpSparseTextureOffsetClamp:
|
||||
cracked.offset = true;
|
||||
cracked.lodClamp = true;
|
||||
break;
|
||||
case EOpTextureGradClamp:
|
||||
case EOpSparseTextureGradClamp:
|
||||
cracked.grad = true;
|
||||
cracked.lodClamp = true;
|
||||
break;
|
||||
case EOpTextureGradOffsetClamp:
|
||||
case EOpSparseTextureGradOffsetClamp:
|
||||
cracked.grad = true;
|
||||
|
|
@ -1467,7 +1450,6 @@ public:
|
|||
cracked.gather = true;
|
||||
cracked.offsets = true;
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpTextureGatherLod:
|
||||
case EOpSparseTextureGatherLod:
|
||||
cracked.gather = true;
|
||||
|
|
@ -1498,8 +1480,6 @@ public:
|
|||
cracked.subpass = sampler.dim == EsdSubpass;
|
||||
cracked.fragMask = true;
|
||||
break;
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpImageSampleFootprintNV:
|
||||
break;
|
||||
case EOpImageSampleFootprintClampNV:
|
||||
|
|
@ -1515,11 +1495,11 @@ public:
|
|||
cracked.lodClamp = true;
|
||||
cracked.grad = true;
|
||||
break;
|
||||
#endif
|
||||
case EOpSubpassLoad:
|
||||
case EOpSubpassLoadMS:
|
||||
cracked.subpass = true;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,24 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
|||
else
|
||||
newConstArray[i].setDConst((double)NAN);
|
||||
break;
|
||||
|
||||
case EbtInt:
|
||||
if (rightUnionArray[i] == 0)
|
||||
newConstArray[i].setIConst(0x7FFFFFFF);
|
||||
else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll)
|
||||
newConstArray[i].setIConst((int)-0x80000000ll);
|
||||
else
|
||||
newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst());
|
||||
break;
|
||||
|
||||
case EbtUint:
|
||||
if (rightUnionArray[i] == 0u)
|
||||
newConstArray[i].setUConst(0xFFFFFFFFu);
|
||||
else
|
||||
newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
|
||||
break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
if (rightUnionArray[i] == (signed char)0)
|
||||
newConstArray[i].setI8Const((signed char)0x7F);
|
||||
|
|
@ -221,22 +239,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
|||
newConstArray[i].setU16Const(leftUnionArray[i].getU16Const() / rightUnionArray[i].getU16Const());
|
||||
break;
|
||||
|
||||
case EbtInt:
|
||||
if (rightUnionArray[i] == 0)
|
||||
newConstArray[i].setIConst(0x7FFFFFFF);
|
||||
else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll)
|
||||
newConstArray[i].setIConst((int)-0x80000000ll);
|
||||
else
|
||||
newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst());
|
||||
break;
|
||||
|
||||
case EbtUint:
|
||||
if (rightUnionArray[i] == 0u)
|
||||
newConstArray[i].setUConst(0xFFFFFFFFu);
|
||||
else
|
||||
newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
|
||||
break;
|
||||
|
||||
case EbtInt64:
|
||||
if (rightUnionArray[i] == 0ll)
|
||||
newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll);
|
||||
|
|
@ -254,6 +256,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
|||
break;
|
||||
default:
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -292,13 +295,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
|||
newConstArray[i].setIConst(0);
|
||||
break;
|
||||
} else goto modulo_default;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt64:
|
||||
if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == LLONG_MIN) {
|
||||
newConstArray[i].setI64Const(0);
|
||||
break;
|
||||
} else goto modulo_default;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == SHRT_MIN) {
|
||||
newConstArray[i].setIConst(0);
|
||||
|
|
@ -527,14 +529,16 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
case EbtDouble:
|
||||
case EbtFloat16:
|
||||
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
||||
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
||||
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: newConstArray[i].setI8Const(-unionArray[i].getI8Const()); break;
|
||||
case EbtUint8: newConstArray[i].setU8Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU8Const()))); break;
|
||||
case EbtInt16: newConstArray[i].setI16Const(-unionArray[i].getI16Const()); break;
|
||||
case EbtUint16:newConstArray[i].setU16Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU16Const()))); break;
|
||||
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
||||
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
|
||||
case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break;
|
||||
case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(-static_cast<long long>(unionArray[i].getU64Const()))); break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -669,6 +673,48 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
break;
|
||||
}
|
||||
|
||||
case EOpConvIntToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break;
|
||||
case EOpConvUintToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break;
|
||||
case EOpConvBoolToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getBConst()); break;
|
||||
case EOpConvIntToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getIConst()); break;
|
||||
case EOpConvUintToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getUConst()); break;
|
||||
|
||||
case EOpConvFloatToBool:
|
||||
case EOpConvDoubleToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
|
||||
|
||||
case EOpConvBoolToFloat:
|
||||
case EOpConvBoolToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
|
||||
|
||||
case EOpConvIntToFloat:
|
||||
case EOpConvIntToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
|
||||
|
||||
case EOpConvUintToFloat:
|
||||
case EOpConvUintToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
|
||||
|
||||
case EOpConvDoubleToFloat:
|
||||
case EOpConvFloatToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
|
||||
case EOpConvFloatToUint:
|
||||
case EOpConvDoubleToUint:
|
||||
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
|
||||
|
||||
case EOpConvFloatToInt:
|
||||
case EOpConvDoubleToInt:
|
||||
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EOpConvInt8ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break;
|
||||
case EOpConvUint8ToBool:
|
||||
|
|
@ -677,20 +723,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break;
|
||||
case EOpConvUint16ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getU16Const() != 0); break;
|
||||
case EOpConvIntToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break;
|
||||
case EOpConvUintToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break;
|
||||
case EOpConvInt64ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
|
||||
case EOpConvUint64ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
|
||||
case EOpConvFloat16ToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
|
||||
case EOpConvFloatToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
|
||||
case EOpConvDoubleToBool:
|
||||
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
|
||||
|
||||
case EOpConvBoolToInt8:
|
||||
newConstArray[i].setI8Const(unionArray[i].getBConst()); break;
|
||||
|
|
@ -700,20 +738,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
newConstArray[i].setI16Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToUint16:
|
||||
newConstArray[i].setU16Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
|
||||
case EOpConvBoolToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
|
||||
|
||||
case EOpConvInt8ToInt16:
|
||||
newConstArray[i].setI16Const(unionArray[i].getI8Const()); break;
|
||||
|
|
@ -808,8 +838,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
newConstArray[i].setU8Const((unsigned char)unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToUint16:
|
||||
newConstArray[i].setU16Const((unsigned char)unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToUint:
|
||||
newConstArray[i].setUConst(unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToUint64:
|
||||
newConstArray[i].setU64Const(unionArray[i].getIConst()); break;
|
||||
|
||||
|
|
@ -817,8 +845,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
newConstArray[i].setI8Const((signed char)unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToInt16:
|
||||
newConstArray[i].setI16Const((signed short)unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToInt:
|
||||
newConstArray[i].setIConst(unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToInt64:
|
||||
newConstArray[i].setI64Const(unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToUint8:
|
||||
|
|
@ -829,16 +855,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
newConstArray[i].setU64Const(unionArray[i].getUConst()); break;
|
||||
case EOpConvIntToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
|
||||
case EOpConvIntToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
|
||||
case EOpConvUintToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
|
||||
case EOpConvUintToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
|
||||
case EOpConvInt64ToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI64Const())); break;
|
||||
case EOpConvInt64ToInt16:
|
||||
|
|
@ -903,48 +921,35 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToInt16:
|
||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToInt:
|
||||
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToInt64:
|
||||
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToUint16:
|
||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToUint:
|
||||
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToUint64:
|
||||
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvFloatToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
case EOpConvFloatToDouble:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
case EOpConvDoubleToInt8:
|
||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToInt16:
|
||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToInt:
|
||||
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToInt64:
|
||||
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToUint8:
|
||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToUint16:
|
||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToUint:
|
||||
newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToUint64:
|
||||
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
||||
case EOpConvDoubleToFloat16:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
case EOpConvDoubleToFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||
case EOpConvPtrToUint64:
|
||||
case EOpConvUint64ToPtr:
|
||||
case EOpConstructReference:
|
||||
newConstArray[i].setU64Const(unionArray[i].getU64Const()); break;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out
|
||||
|
||||
|
|
@ -1076,6 +1081,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
case EbtDouble:
|
||||
newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
|
||||
break;
|
||||
case EbtInt:
|
||||
newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
|
||||
break;
|
||||
case EbtUint:
|
||||
newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
newConstArray[comp].setI8Const(std::min(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()));
|
||||
break;
|
||||
|
|
@ -1088,18 +1100,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
case EbtUint16:
|
||||
newConstArray[comp].setU16Const(std::min(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()));
|
||||
break;
|
||||
case EbtInt:
|
||||
newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
|
||||
break;
|
||||
case EbtUint:
|
||||
newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
|
||||
break;
|
||||
case EbtInt64:
|
||||
newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
|
||||
break;
|
||||
case EbtUint64:
|
||||
newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
|
||||
break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
|
|
@ -1110,6 +1117,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
case EbtDouble:
|
||||
newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
|
||||
break;
|
||||
case EbtInt:
|
||||
newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
|
||||
break;
|
||||
case EbtUint:
|
||||
newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
newConstArray[comp].setI8Const(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()));
|
||||
break;
|
||||
|
|
@ -1122,18 +1136,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
case EbtUint16:
|
||||
newConstArray[comp].setU16Const(std::max(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()));
|
||||
break;
|
||||
case EbtInt:
|
||||
newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
|
||||
break;
|
||||
case EbtUint:
|
||||
newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
|
||||
break;
|
||||
case EbtInt64:
|
||||
newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
|
||||
break;
|
||||
case EbtUint64:
|
||||
newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
|
||||
break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
|
|
@ -1145,6 +1154,11 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()),
|
||||
childConstUnions[2][arg2comp].getDConst()));
|
||||
break;
|
||||
case EbtUint:
|
||||
newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()),
|
||||
childConstUnions[2][arg2comp].getUConst()));
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
newConstArray[comp].setI8Const(std::min(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()),
|
||||
childConstUnions[2][arg2comp].getI8Const()));
|
||||
|
|
@ -1165,10 +1179,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()),
|
||||
childConstUnions[2][arg2comp].getIConst()));
|
||||
break;
|
||||
case EbtUint:
|
||||
newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()),
|
||||
childConstUnions[2][arg2comp].getUConst()));
|
||||
break;
|
||||
case EbtInt64:
|
||||
newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()),
|
||||
childConstUnions[2][arg2comp].getI64Const()));
|
||||
|
|
@ -1177,6 +1187,7 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()),
|
||||
childConstUnions[2][arg2comp].getU64Const()));
|
||||
break;
|
||||
#endif
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -91,6 +91,8 @@ public:
|
|||
void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources);
|
||||
|
||||
protected:
|
||||
void addTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion);
|
||||
void relateTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage, TSymbolTable&);
|
||||
void add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion);
|
||||
void addSubpassSampling(TSampler, const TString& typeName, int version, EProfile profile);
|
||||
void addQueryFunctions(TSampler, const TString& typeName, int version, EProfile profile);
|
||||
|
|
|
|||
|
|
@ -123,12 +123,12 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
|||
if ((op == EOpAdd || op == EOpSub) && extensionRequested(E_GL_EXT_buffer_reference2)) {
|
||||
|
||||
// No addressing math on struct with unsized array.
|
||||
if ((left->getBasicType() == EbtReference && left->getType().getReferentType()->containsUnsizedArray()) ||
|
||||
(right->getBasicType() == EbtReference && right->getType().getReferentType()->containsUnsizedArray())) {
|
||||
if ((left->isReference() && left->getType().getReferentType()->containsUnsizedArray()) ||
|
||||
(right->isReference() && right->getType().getReferentType()->containsUnsizedArray())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (left->getBasicType() == EbtReference && isTypeInt(right->getBasicType())) {
|
||||
if (left->isReference() && isTypeInt(right->getBasicType())) {
|
||||
const TType& referenceType = left->getType();
|
||||
TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(left->getType()), loc, true);
|
||||
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
|
||||
|
|
@ -141,7 +141,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
|||
return node;
|
||||
}
|
||||
|
||||
if (op == EOpAdd && right->getBasicType() == EbtReference && isTypeInt(left->getBasicType())) {
|
||||
if (op == EOpAdd && right->isReference() && isTypeInt(left->getBasicType())) {
|
||||
const TType& referenceType = right->getType();
|
||||
TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(right->getType()), loc, true);
|
||||
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
|
||||
|
|
@ -154,7 +154,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
|||
return node;
|
||||
}
|
||||
|
||||
if (op == EOpSub && left->getBasicType() == EbtReference && right->getBasicType() == EbtReference) {
|
||||
if (op == EOpSub && left->isReference() && right->isReference()) {
|
||||
TIntermConstantUnion* size = addConstantUnion((long long)computeBufferReferenceTypeSize(left->getType()), loc, true);
|
||||
|
||||
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
|
||||
|
|
@ -170,7 +170,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
|||
}
|
||||
|
||||
// No other math operators supported on references
|
||||
if (left->getBasicType() == EbtReference || right->getBasicType() == EbtReference) {
|
||||
if (left->isReference() || right->isReference()) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
|||
node->getWritableType().getQualifier().makeSpecConstant();
|
||||
|
||||
// If must propagate nonuniform, make a nonuniform.
|
||||
if ((node->getLeft()->getQualifier().nonUniform || node->getRight()->getQualifier().nonUniform) &&
|
||||
if ((node->getLeft()->getQualifier().isNonUniform() || node->getRight()->getQualifier().isNonUniform()) &&
|
||||
isNonuniformPropagating(node->getOp()))
|
||||
node->getWritableType().getQualifier().nonUniform = true;
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
|
|||
// Convert "reference += int" to "reference = reference + int". We need this because the
|
||||
// "reference + int" calculation involves a cast back to the original type, which makes it
|
||||
// not an lvalue.
|
||||
if ((op == EOpAddAssign || op == EOpSubAssign) && left->getBasicType() == EbtReference &&
|
||||
if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference() &&
|
||||
extensionRequested(E_GL_EXT_buffer_reference2)) {
|
||||
|
||||
if (!(right->getType().isScalar() && right->getType().isIntegerDomain()))
|
||||
|
|
@ -359,7 +359,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
|||
|
||||
switch (op) {
|
||||
case EOpLogicalNot:
|
||||
if (source == EShSourceHlsl) {
|
||||
if (getSource() == EShSourceHlsl) {
|
||||
break; // HLSL can promote logical not
|
||||
}
|
||||
|
||||
|
|
@ -383,18 +383,20 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
|||
//
|
||||
TBasicType newType = EbtVoid;
|
||||
switch (op) {
|
||||
case EOpConstructBool: newType = EbtBool; break;
|
||||
case EOpConstructFloat: newType = EbtFloat; break;
|
||||
case EOpConstructInt: newType = EbtInt; break;
|
||||
case EOpConstructUint: newType = EbtUint; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EOpConstructInt8: newType = EbtInt8; break;
|
||||
case EOpConstructUint8: newType = EbtUint8; break;
|
||||
case EOpConstructInt16: newType = EbtInt16; break;
|
||||
case EOpConstructUint16: newType = EbtUint16; break;
|
||||
case EOpConstructInt: newType = EbtInt; break;
|
||||
case EOpConstructUint: newType = EbtUint; break;
|
||||
case EOpConstructInt64: newType = EbtInt64; break;
|
||||
case EOpConstructUint64: newType = EbtUint64; break;
|
||||
case EOpConstructBool: newType = EbtBool; break;
|
||||
case EOpConstructFloat: newType = EbtFloat; break;
|
||||
case EOpConstructDouble: newType = EbtDouble; break;
|
||||
case EOpConstructFloat16: newType = EbtFloat16; break;
|
||||
#endif
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
|
||||
|
|
@ -449,7 +451,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
|||
node->getWritableType().getQualifier().makeSpecConstant();
|
||||
|
||||
// If must propagate nonuniform, make a nonuniform.
|
||||
if (node->getOperand()->getQualifier().nonUniform && isNonuniformPropagating(node->getOp()))
|
||||
if (node->getOperand()->getQualifier().isNonUniform() && isNonuniformPropagating(node->getOp()))
|
||||
node->getWritableType().getQualifier().nonUniform = true;
|
||||
|
||||
return node;
|
||||
|
|
@ -536,15 +538,13 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const
|
|||
return false;
|
||||
case EbtAtomicUint:
|
||||
case EbtSampler:
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EbtAccStructNV:
|
||||
#endif
|
||||
// opaque types can be passed to functions
|
||||
if (op == EOpFunction)
|
||||
break;
|
||||
|
||||
// HLSL can assign samplers directly (no constructor)
|
||||
if (source == EShSourceHlsl && node->getBasicType() == EbtSampler)
|
||||
if (getSource() == EShSourceHlsl && node->getBasicType() == EbtSampler)
|
||||
break;
|
||||
|
||||
// samplers can get assigned via a sampler constructor
|
||||
|
|
@ -609,16 +609,17 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
|||
}
|
||||
|
||||
switch (convertTo) {
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtDouble:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtUint: newOp = EOpConvUintToDouble; break;
|
||||
case EbtBool: newOp = EOpConvBoolToDouble; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToDouble; break;
|
||||
case EbtInt: newOp = EOpConvIntToDouble; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToDouble; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToDouble; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToDouble; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToDouble; break;
|
||||
case EbtInt: newOp = EOpConvIntToDouble; break;
|
||||
case EbtUint: newOp = EOpConvUintToDouble; break;
|
||||
case EbtBool: newOp = EOpConvBoolToDouble; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToDouble; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToDouble; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
|
||||
|
|
@ -626,23 +627,27 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
|||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case EbtFloat:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt: newOp = EOpConvIntToFloat; break;
|
||||
case EbtUint: newOp = EOpConvUintToFloat; break;
|
||||
case EbtBool: newOp = EOpConvBoolToFloat; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtDouble: newOp = EOpConvDoubleToFloat; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToFloat; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToFloat; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToFloat; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToFloat; break;
|
||||
case EbtInt: newOp = EOpConvIntToFloat; break;
|
||||
case EbtUint: newOp = EOpConvUintToFloat; break;
|
||||
case EbtBool: newOp = EOpConvBoolToFloat; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToFloat; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToFloat; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtFloat16:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt8: newOp = EOpConvInt8ToFloat16; break;
|
||||
|
|
@ -660,23 +665,27 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
|||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case EbtBool:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt: newOp = EOpConvIntToBool; break;
|
||||
case EbtUint: newOp = EOpConvUintToBool; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToBool; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtDouble: newOp = EOpConvDoubleToBool; break;
|
||||
case EbtInt8: newOp = EOpConvInt8ToBool; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToBool; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToBool; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToBool; break;
|
||||
case EbtInt: newOp = EOpConvIntToBool; break;
|
||||
case EbtUint: newOp = EOpConvUintToBool; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToBool; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToBool; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToBool; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToBool; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToBool; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtUint8: newOp = EOpConvUint8ToInt8; break;
|
||||
|
|
@ -746,41 +755,47 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
|||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EbtInt:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtUint: newOp = EOpConvUintToInt; break;
|
||||
case EbtBool: newOp = EOpConvBoolToInt; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: newOp = EOpConvInt8ToInt; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToInt; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToInt; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToInt; break;
|
||||
case EbtUint: newOp = EOpConvUintToInt; break;
|
||||
case EbtBool: newOp = EOpConvBoolToInt; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToInt; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToInt; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToInt; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt: newOp = EOpConvIntToUint; break;
|
||||
case EbtBool: newOp = EOpConvBoolToUint; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8: newOp = EOpConvInt8ToUint; break;
|
||||
case EbtUint8: newOp = EOpConvUint8ToUint; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToUint; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToUint; break;
|
||||
case EbtInt: newOp = EOpConvIntToUint; break;
|
||||
case EbtBool: newOp = EOpConvBoolToUint; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToUint; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToUint; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToUint; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt64:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt8: newOp = EOpConvInt8ToInt64; break;
|
||||
|
|
@ -815,6 +830,7 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
|||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -921,7 +937,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no
|
|||
case EOpLogicalAnd:
|
||||
case EOpLogicalOr:
|
||||
case EOpLogicalXor:
|
||||
if (source == EShSourceHlsl)
|
||||
if (getSource() == EShSourceHlsl)
|
||||
promoteTo = std::make_tuple(EbtBool, EbtBool);
|
||||
else
|
||||
return std::make_tuple(node0, node1);
|
||||
|
|
@ -932,7 +948,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no
|
|||
// HLSL can promote bools to ints to make this work.
|
||||
case EOpLeftShift:
|
||||
case EOpRightShift:
|
||||
if (source == EShSourceHlsl) {
|
||||
if (getSource() == EShSourceHlsl) {
|
||||
TBasicType node0BasicType = node0->getBasicType();
|
||||
if (node0BasicType == EbtBool)
|
||||
node0BasicType = EbtInt;
|
||||
|
|
@ -1027,6 +1043,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EOpConstructFloat:
|
||||
promoteTo = EbtFloat;
|
||||
break;
|
||||
case EOpConstructInt:
|
||||
promoteTo = EbtInt;
|
||||
break;
|
||||
case EOpConstructUint:
|
||||
promoteTo = EbtUint;
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EOpConstructDouble:
|
||||
promoteTo = EbtDouble;
|
||||
break;
|
||||
|
|
@ -1055,18 +1078,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
||||
break;
|
||||
case EOpConstructInt:
|
||||
promoteTo = EbtInt;
|
||||
break;
|
||||
case EOpConstructUint:
|
||||
promoteTo = EbtUint;
|
||||
break;
|
||||
case EOpConstructInt64:
|
||||
promoteTo = EbtInt64;
|
||||
break;
|
||||
case EOpConstructUint64:
|
||||
promoteTo = EbtUint64;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EOpLogicalNot:
|
||||
|
||||
|
|
@ -1110,7 +1128,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EOpConstructStruct:
|
||||
case EOpConstructCooperativeMatrix:
|
||||
|
||||
if (type.getBasicType() == EbtReference || node->getType().getBasicType() == EbtReference) {
|
||||
if (type.isReference() || node->getType().isReference()) {
|
||||
// types must match to assign a reference
|
||||
if (type == node->getType())
|
||||
return node;
|
||||
|
|
@ -1133,7 +1151,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EOpLeftShiftAssign:
|
||||
case EOpRightShiftAssign:
|
||||
{
|
||||
if (source == EShSourceHlsl && node->getType().getBasicType() == EbtBool)
|
||||
if (getSource() == EShSourceHlsl && node->getType().getBasicType() == EbtBool)
|
||||
promoteTo = type.getBasicType();
|
||||
else {
|
||||
if (isTypeInt(type.getBasicType()) && isTypeInt(node->getBasicType()))
|
||||
|
|
@ -1179,7 +1197,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
TIntermTyped* TIntermediate::addUniShapeConversion(TOperator op, const TType& type, TIntermTyped* node)
|
||||
{
|
||||
// some source languages don't do this
|
||||
switch (source) {
|
||||
switch (getSource()) {
|
||||
case EShSourceHlsl:
|
||||
break;
|
||||
case EShSourceGlsl:
|
||||
|
|
@ -1232,7 +1250,7 @@ TIntermTyped* TIntermediate::addUniShapeConversion(TOperator op, const TType& ty
|
|||
void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode)
|
||||
{
|
||||
// some source languages don't do this
|
||||
switch (source) {
|
||||
switch (getSource()) {
|
||||
case EShSourceHlsl:
|
||||
break;
|
||||
case EShSourceGlsl:
|
||||
|
|
@ -1335,7 +1353,7 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped*
|
|||
// The new node that handles the conversion
|
||||
TOperator constructorOp = mapTypeToConstructorOp(type);
|
||||
|
||||
if (source == EShSourceHlsl) {
|
||||
if (getSource() == EShSourceHlsl) {
|
||||
// HLSL rules for scalar, vector and matrix conversions:
|
||||
// 1) scalar can become anything, initializing every component with its value
|
||||
// 2) vector and matrix can become scalar, first element is used (warning: truncation)
|
||||
|
|
@ -1448,7 +1466,31 @@ bool TIntermediate::isFPPromotion(TBasicType from, TBasicType to) const
|
|||
|
||||
bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
return false;
|
||||
#endif
|
||||
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
switch(to) {
|
||||
case EbtUint:
|
||||
return version >= 400 || getSource() == EShSourceHlsl;
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch(to) {
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EbtInt8:
|
||||
switch (to) {
|
||||
case EbtUint8:
|
||||
|
|
@ -1495,26 +1537,6 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case EbtInt:
|
||||
switch(to) {
|
||||
case EbtUint:
|
||||
return version >= 400 || (source == EShSourceHlsl);
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch(to) {
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
if (to == EbtUint64) {
|
||||
return true;
|
||||
|
|
@ -1528,6 +1550,10 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const
|
|||
|
||||
bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (to == EbtFloat && from == EbtFloat16) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -1538,6 +1564,17 @@ bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const
|
|||
bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
|
||||
{
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
case EbtUint:
|
||||
switch(to) {
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtInt8:
|
||||
case EbtUint8:
|
||||
case EbtInt16:
|
||||
|
|
@ -1551,23 +1588,13 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case EbtInt:
|
||||
case EbtUint:
|
||||
switch(to) {
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
if (to == EbtDouble) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1580,7 +1607,7 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
|
|||
//
|
||||
bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op) const
|
||||
{
|
||||
if (profile == EEsProfile || version == 110)
|
||||
if (isEsProfile() || version == 110)
|
||||
return false;
|
||||
|
||||
if (from == to)
|
||||
|
|
@ -1588,7 +1615,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
|
||||
// TODO: Move more policies into language-specific handlers.
|
||||
// Some languages allow more general (or potentially, more specific) conversions under some conditions.
|
||||
if (source == EShSourceHlsl) {
|
||||
if (getSource() == EShSourceHlsl) {
|
||||
const bool fromConvertable = (from == EbtFloat || from == EbtDouble || from == EbtInt || from == EbtUint || from == EbtBool);
|
||||
const bool toConvertable = (to == EbtFloat || to == EbtDouble || to == EbtInt || to == EbtUint || to == EbtBool);
|
||||
|
||||
|
|
@ -1655,7 +1682,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
}
|
||||
|
||||
// hlsl supported conversions
|
||||
if (source == EShSourceHlsl) {
|
||||
if (getSource() == EShSourceHlsl) {
|
||||
if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1670,13 +1697,11 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
return true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||
case EbtFloat16:
|
||||
return extensionRequested(E_GL_AMD_gpu_shader_half_float);
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1687,34 +1712,28 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
case EbtFloat:
|
||||
return true;
|
||||
case EbtBool:
|
||||
return (source == EShSourceHlsl);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
return getSource() == EShSourceHlsl;
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||
#endif
|
||||
case EbtFloat16:
|
||||
return
|
||||
#ifdef AMD_EXTENSIONS
|
||||
extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
|
||||
#endif
|
||||
(source == EShSourceHlsl);
|
||||
getSource() == EShSourceHlsl;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case EbtUint:
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
return version >= 400 || (source == EShSourceHlsl);
|
||||
return version >= 400 || getSource() == EShSourceHlsl;
|
||||
case EbtUint:
|
||||
return true;
|
||||
case EbtBool:
|
||||
return (source == EShSourceHlsl);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
return getSource() == EShSourceHlsl;
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1723,11 +1742,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
case EbtInt:
|
||||
return true;
|
||||
case EbtBool:
|
||||
return (source == EShSourceHlsl);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
return getSource() == EShSourceHlsl;
|
||||
case EbtInt16:
|
||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1738,11 +1755,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
return true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1751,15 +1766,12 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
case EbtInt:
|
||||
case EbtInt64:
|
||||
return true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case EbtFloat16:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
switch (from) {
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
|
|
@ -1769,10 +1781,8 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case EbtUint16:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
switch (from) {
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
|
|
@ -1780,7 +1790,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -1790,7 +1799,12 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType) {
|
||||
static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
return false;
|
||||
#endif
|
||||
|
||||
switch(sintType) {
|
||||
case EbtInt8:
|
||||
switch(uintType) {
|
||||
|
|
@ -1849,7 +1863,13 @@ static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBas
|
|||
}
|
||||
|
||||
|
||||
static TBasicType getCorrespondingUnsignedType(TBasicType type) {
|
||||
static TBasicType getCorrespondingUnsignedType(TBasicType type)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
assert(type == EbtInt);
|
||||
return EbtUint;
|
||||
#endif
|
||||
|
||||
switch(type) {
|
||||
case EbtInt8:
|
||||
return EbtUint8;
|
||||
|
|
@ -1898,10 +1918,10 @@ std::tuple<TBasicType, TBasicType> TIntermediate::getConversionDestinatonType(TB
|
|||
TBasicType res0 = EbtNumTypes;
|
||||
TBasicType res1 = EbtNumTypes;
|
||||
|
||||
if (profile == EEsProfile || version == 110)
|
||||
return std::make_tuple(res0, res1);;
|
||||
if (isEsProfile() || version == 110)
|
||||
return std::make_tuple(res0, res1);
|
||||
|
||||
if (source == EShSourceHlsl) {
|
||||
if (getSource() == EShSourceHlsl) {
|
||||
if (canImplicitlyPromote(type1, type0, op)) {
|
||||
res0 = type0;
|
||||
res1 = type0;
|
||||
|
|
@ -1970,7 +1990,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||
{
|
||||
TOperator op = EOpNull;
|
||||
|
||||
if (type.getQualifier().nonUniform)
|
||||
if (type.getQualifier().isNonUniform())
|
||||
return EOpConstructNonuniform;
|
||||
|
||||
if (type.isCoopMat())
|
||||
|
|
@ -1981,7 +2001,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||
op = EOpConstructStruct;
|
||||
break;
|
||||
case EbtSampler:
|
||||
if (type.getSampler().combined)
|
||||
if (type.getSampler().isCombined())
|
||||
op = EOpConstructTextureSampler;
|
||||
break;
|
||||
case EbtFloat:
|
||||
|
|
@ -2023,6 +2043,121 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||
}
|
||||
}
|
||||
break;
|
||||
case EbtInt:
|
||||
if (type.getMatrixCols()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
case 2:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructIMat2x2; break;
|
||||
case 3: op = EOpConstructIMat2x3; break;
|
||||
case 4: op = EOpConstructIMat2x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructIMat3x2; break;
|
||||
case 3: op = EOpConstructIMat3x3; break;
|
||||
case 4: op = EOpConstructIMat3x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructIMat4x2; break;
|
||||
case 3: op = EOpConstructIMat4x3; break;
|
||||
case 4: op = EOpConstructIMat4x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructInt; break;
|
||||
case 2: op = EOpConstructIVec2; break;
|
||||
case 3: op = EOpConstructIVec3; break;
|
||||
case 4: op = EOpConstructIVec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
if (type.getMatrixCols()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
case 2:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructUMat2x2; break;
|
||||
case 3: op = EOpConstructUMat2x3; break;
|
||||
case 4: op = EOpConstructUMat2x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructUMat3x2; break;
|
||||
case 3: op = EOpConstructUMat3x3; break;
|
||||
case 4: op = EOpConstructUMat3x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructUMat4x2; break;
|
||||
case 3: op = EOpConstructUMat4x3; break;
|
||||
case 4: op = EOpConstructUMat4x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructUint; break;
|
||||
case 2: op = EOpConstructUVec2; break;
|
||||
case 3: op = EOpConstructUVec3; break;
|
||||
case 4: op = EOpConstructUVec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EbtBool:
|
||||
if (type.getMatrixCols()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
case 2:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructBMat2x2; break;
|
||||
case 3: op = EOpConstructBMat2x3; break;
|
||||
case 4: op = EOpConstructBMat2x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructBMat3x2; break;
|
||||
case 3: op = EOpConstructBMat3x3; break;
|
||||
case 4: op = EOpConstructBMat3x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructBMat4x2; break;
|
||||
case 3: op = EOpConstructBMat4x3; break;
|
||||
case 4: op = EOpConstructBMat4x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructBool; break;
|
||||
case 2: op = EOpConstructBVec2; break;
|
||||
case 3: op = EOpConstructBVec3; break;
|
||||
case 4: op = EOpConstructBVec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtDouble:
|
||||
if (type.getMatrixCols()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
|
|
@ -2136,82 +2271,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case EbtInt:
|
||||
if (type.getMatrixCols()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
case 2:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructIMat2x2; break;
|
||||
case 3: op = EOpConstructIMat2x3; break;
|
||||
case 4: op = EOpConstructIMat2x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructIMat3x2; break;
|
||||
case 3: op = EOpConstructIMat3x3; break;
|
||||
case 4: op = EOpConstructIMat3x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructIMat4x2; break;
|
||||
case 3: op = EOpConstructIMat4x3; break;
|
||||
case 4: op = EOpConstructIMat4x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructInt; break;
|
||||
case 2: op = EOpConstructIVec2; break;
|
||||
case 3: op = EOpConstructIVec3; break;
|
||||
case 4: op = EOpConstructIVec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
if (type.getMatrixCols()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
case 2:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructUMat2x2; break;
|
||||
case 3: op = EOpConstructUMat2x3; break;
|
||||
case 4: op = EOpConstructUMat2x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructUMat3x2; break;
|
||||
case 3: op = EOpConstructUMat3x3; break;
|
||||
case 4: op = EOpConstructUMat3x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructUMat4x2; break;
|
||||
case 3: op = EOpConstructUMat4x3; break;
|
||||
case 4: op = EOpConstructUMat4x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructUint; break;
|
||||
case 2: op = EOpConstructUVec2; break;
|
||||
case 3: op = EOpConstructUVec3; break;
|
||||
case 4: op = EOpConstructUVec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructInt64; break;
|
||||
|
|
@ -2230,47 +2289,10 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case EbtBool:
|
||||
if (type.getMatrixCols()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
case 2:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructBMat2x2; break;
|
||||
case 3: op = EOpConstructBMat2x3; break;
|
||||
case 4: op = EOpConstructBMat2x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructBMat3x2; break;
|
||||
case 3: op = EOpConstructBMat3x3; break;
|
||||
case 4: op = EOpConstructBMat3x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (type.getMatrixRows()) {
|
||||
case 2: op = EOpConstructBMat4x2; break;
|
||||
case 3: op = EOpConstructBMat4x3; break;
|
||||
case 4: op = EOpConstructBMat4x4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructBool; break;
|
||||
case 2: op = EOpConstructBVec2; break;
|
||||
case 3: op = EOpConstructBVec3; break;
|
||||
case 4: op = EOpConstructBVec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EbtReference:
|
||||
op = EOpConstructReference;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -2729,6 +2751,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
|
|||
if (aggRoot && aggRoot->getOp() == EOpNull)
|
||||
aggRoot->setOperator(EOpSequence);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Propagate 'noContraction' label in backward from 'precise' variables.
|
||||
glslang::PropagateNoContraction(*this);
|
||||
|
||||
|
|
@ -2739,6 +2762,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
|
|||
performTextureUpgradeAndSamplerRemovalTransformation(root);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3780,6 +3804,16 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
#define PROMOTE(Set, CType, Get) leftUnionArray[i].Set(static_cast<CType>(rightUnionArray[i].Get()))
|
||||
#define PROMOTE_TO_BOOL(Get) leftUnionArray[i].setBConst(rightUnionArray[i].Get() != 0)
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
#define TO_ALL(Get) \
|
||||
switch (promoteTo) { \
|
||||
case EbtFloat: PROMOTE(setDConst, double, Get); break; \
|
||||
case EbtInt: PROMOTE(setIConst, int, Get); break; \
|
||||
case EbtUint: PROMOTE(setUConst, unsigned int, Get); break; \
|
||||
case EbtBool: PROMOTE_TO_BOOL(Get); break; \
|
||||
default: return node; \
|
||||
}
|
||||
#else
|
||||
#define TO_ALL(Get) \
|
||||
switch (promoteTo) { \
|
||||
case EbtFloat16: PROMOTE(setDConst, double, Get); break; \
|
||||
|
|
@ -3796,20 +3830,23 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
case EbtBool: PROMOTE_TO_BOOL(Get); break; \
|
||||
default: return node; \
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtFloat16: TO_ALL(getDConst); break;
|
||||
case EbtFloat: TO_ALL(getDConst); break;
|
||||
case EbtInt: TO_ALL(getIConst); break;
|
||||
case EbtUint: TO_ALL(getUConst); break;
|
||||
case EbtBool: TO_ALL(getBConst); break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtFloat16: TO_ALL(getDConst); break;
|
||||
case EbtDouble: TO_ALL(getDConst); break;
|
||||
case EbtInt8: TO_ALL(getI8Const); break;
|
||||
case EbtInt16: TO_ALL(getI16Const); break;
|
||||
case EbtInt: TO_ALL(getIConst); break;
|
||||
case EbtInt64: TO_ALL(getI64Const); break;
|
||||
case EbtUint8: TO_ALL(getU8Const); break;
|
||||
case EbtUint16: TO_ALL(getU16Const); break;
|
||||
case EbtUint: TO_ALL(getUConst); break;
|
||||
case EbtUint64: TO_ALL(getU64Const); break;
|
||||
case EbtBool: TO_ALL(getBConst); break;
|
||||
#endif
|
||||
default: return node;
|
||||
}
|
||||
}
|
||||
|
|
@ -3839,7 +3876,7 @@ bool TIntermediate::specConstantPropagates(const TIntermTyped& node1, const TInt
|
|||
struct TextureUpgradeAndSamplerRemovalTransform : public TIntermTraverser {
|
||||
void visitSymbol(TIntermSymbol* symbol) override {
|
||||
if (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isTexture()) {
|
||||
symbol->getWritableType().getSampler().combined = true;
|
||||
symbol->getWritableType().getSampler().setCombined(true);
|
||||
}
|
||||
}
|
||||
bool visitAggregate(TVisit, TIntermAggregate* ag) override {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ void TParseContextBase::outputMessage(const TSourceLoc& loc, const char* szReaso
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL)
|
||||
|
||||
void C_DECL TParseContextBase::error(const TSourceLoc& loc, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...)
|
||||
{
|
||||
|
|
@ -113,6 +115,8 @@ void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReaso
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Both test and if necessary, spit out an error, to see if the node is really
|
||||
// an l-value that can be operated on this way.
|
||||
|
|
@ -149,15 +153,13 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
|
|||
case EvqConst: message = "can't modify a const"; break;
|
||||
case EvqConstReadOnly: message = "can't modify a const"; break;
|
||||
case EvqUniform: message = "can't modify a uniform"; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EvqBuffer:
|
||||
if (node->getQualifier().readonly)
|
||||
if (node->getQualifier().isReadOnly())
|
||||
message = "can't modify a readonly buffer";
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (node->getQualifier().layoutShaderRecordNV)
|
||||
if (node->getQualifier().isShaderRecordNV())
|
||||
message = "can't modify a shaderrecordnv qualified buffer";
|
||||
#endif
|
||||
break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EvqHitAttrNV:
|
||||
if (language != EShLangIntersectNV)
|
||||
message = "cannot modify hitAttributeNV in this stage";
|
||||
|
|
@ -172,13 +174,13 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
|
|||
case EbtSampler:
|
||||
message = "can't modify a sampler";
|
||||
break;
|
||||
case EbtAtomicUint:
|
||||
message = "can't modify an atomic_uint";
|
||||
break;
|
||||
case EbtVoid:
|
||||
message = "can't modify void";
|
||||
break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtAtomicUint:
|
||||
message = "can't modify an atomic_uint";
|
||||
break;
|
||||
case EbtAccStructNV:
|
||||
message = "can't modify accelerationStructureNV";
|
||||
break;
|
||||
|
|
@ -234,7 +236,7 @@ void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op,
|
|||
}
|
||||
|
||||
TIntermSymbol* symNode = node->getAsSymbolNode();
|
||||
if (symNode && symNode->getQualifier().writeonly)
|
||||
if (symNode && symNode->getQualifier().isWriteOnly())
|
||||
error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
|
||||
}
|
||||
|
||||
|
|
@ -574,6 +576,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin
|
|||
selector.push_back(0);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
//
|
||||
// Make the passed-in variable information become a member of the
|
||||
// global uniform block. If this doesn't exist yet, make it.
|
||||
|
|
@ -618,6 +621,7 @@ void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& mem
|
|||
|
||||
++firstNewMember;
|
||||
}
|
||||
#endif
|
||||
|
||||
void TParseContextBase::finish()
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -97,6 +97,7 @@ public:
|
|||
}
|
||||
virtual ~TParseContextBase() { }
|
||||
|
||||
#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL)
|
||||
virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...);
|
||||
virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
|
|
@ -105,6 +106,7 @@ public:
|
|||
const char* szExtraInfoFormat, ...);
|
||||
virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...);
|
||||
#endif
|
||||
|
||||
virtual void setLimits(const TBuiltInResource&) = 0;
|
||||
|
||||
|
|
@ -150,8 +152,10 @@ public:
|
|||
extensionCallback(line, extension, behavior);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
// Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
|
||||
virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr);
|
||||
#endif
|
||||
|
||||
// Potentially rename shader entry point function
|
||||
void renameShaderFunction(TString*& name) const
|
||||
|
|
@ -297,10 +301,12 @@ public:
|
|||
TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
|
||||
void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
void makeEditable(TSymbol*&) override;
|
||||
void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier);
|
||||
#endif
|
||||
bool isIoResizeArray(const TType&) const;
|
||||
void fixIoArraySize(const TSourceLoc&, TType&);
|
||||
void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier);
|
||||
void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base);
|
||||
void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false);
|
||||
int getIoArrayImplicitSize(const TQualifier&, TString* featureString = nullptr) const;
|
||||
|
|
@ -417,6 +423,7 @@ public:
|
|||
void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode);
|
||||
TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
TAttributeType attributeFromName(const TString& name) const;
|
||||
TAttributes* makeAttributes(const TString& identifier) const;
|
||||
TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const;
|
||||
|
|
@ -425,9 +432,9 @@ public:
|
|||
// Determine selection control from attributes
|
||||
void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*);
|
||||
void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*);
|
||||
|
||||
// Determine loop control from attributes
|
||||
void handleLoopAttributes(const TAttributes& attributes, TIntermNode*);
|
||||
#endif
|
||||
|
||||
void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember);
|
||||
|
||||
|
|
@ -441,7 +448,9 @@ protected:
|
|||
bool isRuntimeLength(const TIntermTyped&) const;
|
||||
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
|
||||
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
|
||||
#ifndef GLSLANG_WEB
|
||||
void finish() override;
|
||||
#endif
|
||||
|
||||
public:
|
||||
//
|
||||
|
|
@ -467,10 +476,11 @@ protected:
|
|||
TQualifier globalUniformDefaults;
|
||||
TQualifier globalInputDefaults;
|
||||
TQualifier globalOutputDefaults;
|
||||
int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point
|
||||
TString currentCaller; // name of last function body entered (not valid when at global scope)
|
||||
TIdSetType inductiveLoopIds;
|
||||
#ifndef GLSLANG_WEB
|
||||
int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point
|
||||
bool anyIndexLimits;
|
||||
TIdSetType inductiveLoopIds;
|
||||
TVector<TIntermTyped*> needsIndexLimitationChecking;
|
||||
|
||||
//
|
||||
|
|
@ -506,6 +516,7 @@ protected:
|
|||
// array-sizing declarations
|
||||
//
|
||||
TVector<TSymbol*> ioArraySymbolResizeList;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -324,7 +324,9 @@ struct str_hash
|
|||
// A single global usable by all threads, by all versions, by all languages.
|
||||
// After a single process-level initialization, this is read only and thread safe
|
||||
std::unordered_map<const char*, int, str_hash, str_eq>* KeywordMap = nullptr;
|
||||
#ifndef GLSLANG_WEB
|
||||
std::unordered_set<const char*, str_hash, str_eq>* ReservedSet = nullptr;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -341,9 +343,14 @@ void TScanContext::fillInKeywordMap()
|
|||
|
||||
(*KeywordMap)["const"] = CONST;
|
||||
(*KeywordMap)["uniform"] = UNIFORM;
|
||||
(*KeywordMap)["nonuniformEXT"] = NONUNIFORM;
|
||||
(*KeywordMap)["in"] = IN;
|
||||
(*KeywordMap)["out"] = OUT;
|
||||
(*KeywordMap)["smooth"] = SMOOTH;
|
||||
(*KeywordMap)["flat"] = FLAT;
|
||||
(*KeywordMap)["centroid"] = CENTROID;
|
||||
(*KeywordMap)["invariant"] = INVARIANT;
|
||||
(*KeywordMap)["packed"] = PACKED;
|
||||
(*KeywordMap)["resource"] = RESOURCE;
|
||||
(*KeywordMap)["inout"] = INOUT;
|
||||
(*KeywordMap)["struct"] = STRUCT;
|
||||
(*KeywordMap)["break"] = BREAK;
|
||||
|
|
@ -356,7 +363,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["default"] = DEFAULT;
|
||||
(*KeywordMap)["if"] = IF;
|
||||
(*KeywordMap)["else"] = ELSE;
|
||||
(*KeywordMap)["demote"] = DEMOTE;
|
||||
(*KeywordMap)["discard"] = DISCARD;
|
||||
(*KeywordMap)["return"] = RETURN;
|
||||
(*KeywordMap)["void"] = VOID;
|
||||
|
|
@ -377,8 +383,33 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["mat4"] = MAT4;
|
||||
(*KeywordMap)["true"] = BOOLCONSTANT;
|
||||
(*KeywordMap)["false"] = BOOLCONSTANT;
|
||||
(*KeywordMap)["layout"] = LAYOUT;
|
||||
(*KeywordMap)["shared"] = SHARED;
|
||||
(*KeywordMap)["highp"] = HIGH_PRECISION;
|
||||
(*KeywordMap)["mediump"] = MEDIUM_PRECISION;
|
||||
(*KeywordMap)["lowp"] = LOW_PRECISION;
|
||||
(*KeywordMap)["superp"] = SUPERP;
|
||||
(*KeywordMap)["precision"] = PRECISION;
|
||||
(*KeywordMap)["mat2x2"] = MAT2X2;
|
||||
(*KeywordMap)["mat2x3"] = MAT2X3;
|
||||
(*KeywordMap)["mat2x4"] = MAT2X4;
|
||||
(*KeywordMap)["mat3x2"] = MAT3X2;
|
||||
(*KeywordMap)["mat3x3"] = MAT3X3;
|
||||
(*KeywordMap)["mat3x4"] = MAT3X4;
|
||||
(*KeywordMap)["mat4x2"] = MAT4X2;
|
||||
(*KeywordMap)["mat4x3"] = MAT4X3;
|
||||
(*KeywordMap)["mat4x4"] = MAT4X4;
|
||||
(*KeywordMap)["uint"] = UINT;
|
||||
(*KeywordMap)["uvec2"] = UVEC2;
|
||||
(*KeywordMap)["uvec3"] = UVEC3;
|
||||
(*KeywordMap)["uvec4"] = UVEC4;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
(*KeywordMap)["nonuniformEXT"] = NONUNIFORM;
|
||||
(*KeywordMap)["demote"] = DEMOTE;
|
||||
(*KeywordMap)["attribute"] = ATTRIBUTE;
|
||||
(*KeywordMap)["varying"] = VARYING;
|
||||
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
|
||||
(*KeywordMap)["buffer"] = BUFFER;
|
||||
(*KeywordMap)["coherent"] = COHERENT;
|
||||
(*KeywordMap)["devicecoherent"] = DEVICECOHERENT;
|
||||
|
|
@ -391,24 +422,9 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["writeonly"] = WRITEONLY;
|
||||
(*KeywordMap)["atomic_uint"] = ATOMIC_UINT;
|
||||
(*KeywordMap)["volatile"] = VOLATILE;
|
||||
(*KeywordMap)["layout"] = LAYOUT;
|
||||
(*KeywordMap)["shared"] = SHARED;
|
||||
(*KeywordMap)["patch"] = PATCH;
|
||||
(*KeywordMap)["sample"] = SAMPLE;
|
||||
(*KeywordMap)["subroutine"] = SUBROUTINE;
|
||||
(*KeywordMap)["highp"] = HIGH_PRECISION;
|
||||
(*KeywordMap)["mediump"] = MEDIUM_PRECISION;
|
||||
(*KeywordMap)["lowp"] = LOW_PRECISION;
|
||||
(*KeywordMap)["precision"] = PRECISION;
|
||||
(*KeywordMap)["mat2x2"] = MAT2X2;
|
||||
(*KeywordMap)["mat2x3"] = MAT2X3;
|
||||
(*KeywordMap)["mat2x4"] = MAT2X4;
|
||||
(*KeywordMap)["mat3x2"] = MAT3X2;
|
||||
(*KeywordMap)["mat3x3"] = MAT3X3;
|
||||
(*KeywordMap)["mat3x4"] = MAT3X4;
|
||||
(*KeywordMap)["mat4x2"] = MAT4X2;
|
||||
(*KeywordMap)["mat4x3"] = MAT4X3;
|
||||
(*KeywordMap)["mat4x4"] = MAT4X4;
|
||||
(*KeywordMap)["dmat2"] = DMAT2;
|
||||
(*KeywordMap)["dmat3"] = DMAT3;
|
||||
(*KeywordMap)["dmat4"] = DMAT4;
|
||||
|
|
@ -458,11 +474,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["dvec2"] = DVEC2;
|
||||
(*KeywordMap)["dvec3"] = DVEC3;
|
||||
(*KeywordMap)["dvec4"] = DVEC4;
|
||||
(*KeywordMap)["uint"] = UINT;
|
||||
(*KeywordMap)["uvec2"] = UVEC2;
|
||||
(*KeywordMap)["uvec3"] = UVEC3;
|
||||
(*KeywordMap)["uvec4"] = UVEC4;
|
||||
|
||||
(*KeywordMap)["int64_t"] = INT64_T;
|
||||
(*KeywordMap)["uint64_t"] = UINT64_T;
|
||||
(*KeywordMap)["i64vec2"] = I64VEC2;
|
||||
|
|
@ -549,6 +560,7 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["f64mat4x2"] = F64MAT4X2;
|
||||
(*KeywordMap)["f64mat4x3"] = F64MAT4X3;
|
||||
(*KeywordMap)["f64mat4x4"] = F64MAT4X4;
|
||||
#endif
|
||||
|
||||
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
||||
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
|
||||
|
|
@ -556,12 +568,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW;
|
||||
(*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY;
|
||||
(*KeywordMap)["usamplerCubeArray"] = USAMPLERCUBEARRAY;
|
||||
(*KeywordMap)["sampler1DArrayShadow"] = SAMPLER1DARRAYSHADOW;
|
||||
(*KeywordMap)["isampler1DArray"] = ISAMPLER1DARRAY;
|
||||
(*KeywordMap)["usampler1D"] = USAMPLER1D;
|
||||
(*KeywordMap)["isampler1D"] = ISAMPLER1D;
|
||||
(*KeywordMap)["usampler1DArray"] = USAMPLER1DARRAY;
|
||||
(*KeywordMap)["samplerBuffer"] = SAMPLERBUFFER;
|
||||
(*KeywordMap)["samplerCubeShadow"] = SAMPLERCUBESHADOW;
|
||||
(*KeywordMap)["sampler2DArray"] = SAMPLER2DARRAY;
|
||||
(*KeywordMap)["sampler2DArrayShadow"] = SAMPLER2DARRAYSHADOW;
|
||||
|
|
@ -573,6 +579,16 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["usampler3D"] = USAMPLER3D;
|
||||
(*KeywordMap)["usamplerCube"] = USAMPLERCUBE;
|
||||
(*KeywordMap)["usampler2DArray"] = USAMPLER2DARRAY;
|
||||
(*KeywordMap)["sampler3D"] = SAMPLER3D;
|
||||
(*KeywordMap)["sampler2DShadow"] = SAMPLER2DSHADOW;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
(*KeywordMap)["sampler1DArrayShadow"] = SAMPLER1DARRAYSHADOW;
|
||||
(*KeywordMap)["isampler1DArray"] = ISAMPLER1DARRAY;
|
||||
(*KeywordMap)["usampler1D"] = USAMPLER1D;
|
||||
(*KeywordMap)["isampler1D"] = ISAMPLER1D;
|
||||
(*KeywordMap)["usampler1DArray"] = USAMPLER1DARRAY;
|
||||
(*KeywordMap)["samplerBuffer"] = SAMPLERBUFFER;
|
||||
(*KeywordMap)["isampler2DRect"] = ISAMPLER2DRECT;
|
||||
(*KeywordMap)["usampler2DRect"] = USAMPLER2DRECT;
|
||||
(*KeywordMap)["isamplerBuffer"] = ISAMPLERBUFFER;
|
||||
|
|
@ -585,8 +601,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["usampler2DMSArray"] = USAMPLER2DMSARRAY;
|
||||
(*KeywordMap)["sampler1D"] = SAMPLER1D;
|
||||
(*KeywordMap)["sampler1DShadow"] = SAMPLER1DSHADOW;
|
||||
(*KeywordMap)["sampler3D"] = SAMPLER3D;
|
||||
(*KeywordMap)["sampler2DShadow"] = SAMPLER2DSHADOW;
|
||||
(*KeywordMap)["sampler2DRect"] = SAMPLER2DRECT;
|
||||
(*KeywordMap)["sampler2DRectShadow"] = SAMPLER2DRECTSHADOW;
|
||||
(*KeywordMap)["sampler1DArray"] = SAMPLER1DARRAY;
|
||||
|
|
@ -639,7 +653,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["usubpassInput"] = USUBPASSINPUT;
|
||||
(*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
(*KeywordMap)["f16sampler1D"] = F16SAMPLER1D;
|
||||
(*KeywordMap)["f16sampler2D"] = F16SAMPLER2D;
|
||||
(*KeywordMap)["f16sampler3D"] = F16SAMPLER3D;
|
||||
|
|
@ -685,25 +698,10 @@ void TScanContext::fillInKeywordMap()
|
|||
|
||||
(*KeywordMap)["f16subpassInput"] = F16SUBPASSINPUT;
|
||||
(*KeywordMap)["f16subpassInputMS"] = F16SUBPASSINPUTMS;
|
||||
#endif
|
||||
|
||||
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
|
||||
(*KeywordMap)["smooth"] = SMOOTH;
|
||||
(*KeywordMap)["flat"] = FLAT;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
(*KeywordMap)["__explicitInterpAMD"] = EXPLICITINTERPAMD;
|
||||
#endif
|
||||
(*KeywordMap)["centroid"] = CENTROID;
|
||||
#ifdef NV_EXTENSIONS
|
||||
(*KeywordMap)["pervertexNV"] = PERVERTEXNV;
|
||||
#endif
|
||||
(*KeywordMap)["precise"] = PRECISE;
|
||||
(*KeywordMap)["invariant"] = INVARIANT;
|
||||
(*KeywordMap)["packed"] = PACKED;
|
||||
(*KeywordMap)["resource"] = RESOURCE;
|
||||
(*KeywordMap)["superp"] = SUPERP;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
(*KeywordMap)["rayPayloadNV"] = PAYLOADNV;
|
||||
(*KeywordMap)["rayPayloadInNV"] = PAYLOADINNV;
|
||||
(*KeywordMap)["hitAttributeNV"] = HITATTRNV;
|
||||
|
|
@ -713,7 +711,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["perprimitiveNV"] = PERPRIMITIVENV;
|
||||
(*KeywordMap)["perviewNV"] = PERVIEWNV;
|
||||
(*KeywordMap)["taskNV"] = PERTASKNV;
|
||||
#endif
|
||||
|
||||
(*KeywordMap)["fcoopmatNV"] = FCOOPMATNV;
|
||||
|
||||
|
|
@ -756,14 +753,17 @@ void TScanContext::fillInKeywordMap()
|
|||
ReservedSet->insert("cast");
|
||||
ReservedSet->insert("namespace");
|
||||
ReservedSet->insert("using");
|
||||
#endif
|
||||
}
|
||||
|
||||
void TScanContext::deleteKeywordMap()
|
||||
{
|
||||
delete KeywordMap;
|
||||
KeywordMap = nullptr;
|
||||
#ifndef GLSLANG_WEB
|
||||
delete ReservedSet;
|
||||
ReservedSet = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Called by yylex to get the next token.
|
||||
|
|
@ -842,13 +842,15 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
|
|||
|
||||
case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT;
|
||||
case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT;
|
||||
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT;
|
||||
#ifndef GLSLANG_WEB
|
||||
case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT;
|
||||
case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT;
|
||||
case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT;
|
||||
case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT;
|
||||
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT;
|
||||
case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT;
|
||||
case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT;
|
||||
#endif
|
||||
case PpAtomIdentifier:
|
||||
{
|
||||
int token = tokenizeIdentifier();
|
||||
|
|
@ -870,8 +872,10 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
|
|||
|
||||
int TScanContext::tokenizeIdentifier()
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
if (ReservedSet->find(tokenText) != ReservedSet->end())
|
||||
return reservedWord();
|
||||
#endif
|
||||
|
||||
auto it = KeywordMap->find(tokenText);
|
||||
if (it == KeywordMap->end()) {
|
||||
|
|
@ -902,16 +906,10 @@ int TScanContext::tokenizeIdentifier()
|
|||
afterStruct = true;
|
||||
return keyword;
|
||||
|
||||
case NONUNIFORM:
|
||||
if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier))
|
||||
return keyword;
|
||||
else
|
||||
return identifierOrType();
|
||||
|
||||
case SWITCH:
|
||||
case DEFAULT:
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < 130))
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 130))
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
|
|
@ -943,20 +941,66 @@ int TScanContext::tokenizeIdentifier()
|
|||
parserToken->sType.lex.b = false;
|
||||
return keyword;
|
||||
|
||||
case ATTRIBUTE:
|
||||
case VARYING:
|
||||
if (parseContext.profile == EEsProfile && parseContext.version >= 300)
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
case BUFFER:
|
||||
afterBuffer = true;
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version < 310) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < 430))
|
||||
case SMOOTH:
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 130))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
case FLAT:
|
||||
if (parseContext.isEsProfile() && parseContext.version < 300)
|
||||
reservedWord();
|
||||
else if (!parseContext.isEsProfile() && parseContext.version < 130)
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
case CENTROID:
|
||||
if (parseContext.version < 120)
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
case INVARIANT:
|
||||
if (!parseContext.isEsProfile() && parseContext.version < 120)
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
case PACKED:
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 330))
|
||||
return reservedWord();
|
||||
return identifierOrType();
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case RESOURCE:
|
||||
{
|
||||
bool reserved = (parseContext.isEsProfile() && parseContext.version >= 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version >= 420);
|
||||
return identifierOrReserved(reserved);
|
||||
}
|
||||
case SUPERP:
|
||||
{
|
||||
bool reserved = parseContext.isEsProfile() || parseContext.version >= 130;
|
||||
return identifierOrReserved(reserved);
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case NOPERSPECTIVE:
|
||||
if (parseContext.isEsProfile() && parseContext.version >= 300 &&
|
||||
parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(130);
|
||||
|
||||
case NONUNIFORM:
|
||||
if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier))
|
||||
return keyword;
|
||||
else
|
||||
return identifierOrType();
|
||||
case ATTRIBUTE:
|
||||
case VARYING:
|
||||
if (parseContext.isEsProfile() && parseContext.version >= 300)
|
||||
reservedWord();
|
||||
return keyword;
|
||||
case BUFFER:
|
||||
afterBuffer = true;
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 430))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
case PAYLOADNV:
|
||||
case PAYLOADINNV:
|
||||
case HITATTRNV:
|
||||
|
|
@ -964,14 +1008,12 @@ int TScanContext::tokenizeIdentifier()
|
|||
case CALLDATAINNV:
|
||||
case ACCSTRUCTNV:
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version >= 460
|
||||
(!parseContext.isEsProfile() && parseContext.version >= 460
|
||||
&& parseContext.extensionTurnedOn(E_GL_NV_ray_tracing)))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
case ATOMIC_UINT:
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 310) ||
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 310) ||
|
||||
parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(420);
|
||||
|
|
@ -985,53 +1027,52 @@ int TScanContext::tokenizeIdentifier()
|
|||
case RESTRICT:
|
||||
case READONLY:
|
||||
case WRITEONLY:
|
||||
if (parseContext.profile == EEsProfile && parseContext.version >= 310)
|
||||
if (parseContext.isEsProfile() && parseContext.version >= 310)
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420);
|
||||
|
||||
case VOLATILE:
|
||||
if (parseContext.profile == EEsProfile && parseContext.version >= 310)
|
||||
if (parseContext.isEsProfile() && parseContext.version >= 310)
|
||||
return keyword;
|
||||
if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile ||
|
||||
if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.isEsProfile() ||
|
||||
(parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
case LAYOUT:
|
||||
{
|
||||
const int numLayoutExts = 2;
|
||||
const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack,
|
||||
E_GL_ARB_explicit_attrib_location };
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < 140 &&
|
||||
! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts)))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
}
|
||||
case SHARED:
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < 140))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case PATCH:
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.profile == EEsProfile &&
|
||||
(parseContext.isEsProfile() &&
|
||||
(parseContext.version >= 320 ||
|
||||
parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader)))
|
||||
(!parseContext.isEsProfile() && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader)))
|
||||
return keyword;
|
||||
|
||||
return es30ReservedFromGLSL(400);
|
||||
|
||||
case SAMPLE:
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(400);
|
||||
|
||||
case SUBROUTINE:
|
||||
return es30ReservedFromGLSL(400);
|
||||
case SHARED:
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 140))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
#endif
|
||||
|
||||
case LAYOUT:
|
||||
{
|
||||
const int numLayoutExts = 2;
|
||||
const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack,
|
||||
E_GL_ARB_explicit_attrib_location };
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 140 &&
|
||||
! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts)))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
}
|
||||
|
||||
case HIGH_PRECISION:
|
||||
case MEDIUM_PRECISION:
|
||||
|
|
@ -1050,6 +1091,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
case MAT4X4:
|
||||
return matNxM();
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case DMAT2:
|
||||
case DMAT3:
|
||||
case DMAT4:
|
||||
|
|
@ -1080,7 +1122,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
case IIMAGEBUFFER:
|
||||
case UIMAGEBUFFER:
|
||||
afterType = true;
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
return keyword;
|
||||
return firstGenerationImage(false);
|
||||
|
|
@ -1104,7 +1146,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
case IIMAGECUBEARRAY:
|
||||
case UIMAGECUBEARRAY:
|
||||
afterType = true;
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
|
||||
return keyword;
|
||||
return secondGenerationImage();
|
||||
|
|
@ -1123,7 +1165,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
case DVEC3:
|
||||
case DVEC4:
|
||||
afterType = true;
|
||||
if (parseContext.profile == EEsProfile || parseContext.version < 400)
|
||||
if (parseContext.isEsProfile() || parseContext.version < 400)
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
|
|
@ -1137,7 +1179,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
case U64VEC4:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
||||
(!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||
(parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int64))))
|
||||
|
|
@ -1157,7 +1199,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_8bit_storage) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8)) &&
|
||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
||||
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
|
|
@ -1171,11 +1213,8 @@ int TScanContext::tokenizeIdentifier()
|
|||
case U16VEC4:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
||||
(
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) ||
|
||||
#endif
|
||||
(!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16))))
|
||||
|
|
@ -1193,7 +1232,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32)) &&
|
||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
||||
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
case FLOAT32_T:
|
||||
|
|
@ -1216,7 +1255,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) &&
|
||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
||||
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
|
|
@ -1240,7 +1279,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) &&
|
||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
||||
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
|
|
@ -1250,11 +1289,8 @@ int TScanContext::tokenizeIdentifier()
|
|||
case F16VEC4:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
||||
(
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
|
||||
#endif
|
||||
(!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16))))
|
||||
|
|
@ -1276,37 +1312,27 @@ int TScanContext::tokenizeIdentifier()
|
|||
case F16MAT4X4:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
||||
(
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
|
||||
#endif
|
||||
(!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16))))
|
||||
return keyword;
|
||||
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
case SAMPLERCUBEARRAY:
|
||||
case SAMPLERCUBEARRAYSHADOW:
|
||||
case ISAMPLERCUBEARRAY:
|
||||
case USAMPLERCUBEARRAY:
|
||||
afterType = true;
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
|
||||
return keyword;
|
||||
if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array)))
|
||||
if (parseContext.isEsProfile() || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array)))
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
case ISAMPLER1D:
|
||||
case ISAMPLER1DARRAY:
|
||||
case SAMPLER1DARRAYSHADOW:
|
||||
case USAMPLER1D:
|
||||
case USAMPLER1DARRAY:
|
||||
afterType = true;
|
||||
return es30ReservedFromGLSL(130);
|
||||
|
||||
case UINT:
|
||||
case UVEC2:
|
||||
case UVEC3:
|
||||
|
|
@ -1325,6 +1351,30 @@ int TScanContext::tokenizeIdentifier()
|
|||
afterType = true;
|
||||
return nonreservedKeyword(300, 130);
|
||||
|
||||
case SAMPLER3D:
|
||||
afterType = true;
|
||||
if (parseContext.isEsProfile() && parseContext.version < 300) {
|
||||
if (!parseContext.extensionTurnedOn(E_GL_OES_texture_3D))
|
||||
reservedWord();
|
||||
}
|
||||
return keyword;
|
||||
|
||||
case SAMPLER2DSHADOW:
|
||||
afterType = true;
|
||||
if (parseContext.isEsProfile() && parseContext.version < 300) {
|
||||
if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers))
|
||||
reservedWord();
|
||||
}
|
||||
return keyword;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case ISAMPLER1D:
|
||||
case ISAMPLER1DARRAY:
|
||||
case SAMPLER1DARRAYSHADOW:
|
||||
case USAMPLER1D:
|
||||
case USAMPLER1DARRAY:
|
||||
afterType = true;
|
||||
return es30ReservedFromGLSL(130);
|
||||
case ISAMPLER2DRECT:
|
||||
case USAMPLER2DRECT:
|
||||
afterType = true;
|
||||
|
|
@ -1332,7 +1382,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
|
||||
case SAMPLERBUFFER:
|
||||
afterType = true;
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(130);
|
||||
|
|
@ -1340,7 +1390,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
case ISAMPLERBUFFER:
|
||||
case USAMPLERBUFFER:
|
||||
afterType = true;
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(140);
|
||||
|
|
@ -1349,7 +1399,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
case ISAMPLER2DMS:
|
||||
case USAMPLER2DMS:
|
||||
afterType = true;
|
||||
if (parseContext.profile == EEsProfile && parseContext.version >= 310)
|
||||
if (parseContext.isEsProfile() && parseContext.version >= 310)
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(150);
|
||||
|
||||
|
|
@ -1357,7 +1407,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
case ISAMPLER2DMSARRAY:
|
||||
case USAMPLER2DMSARRAY:
|
||||
afterType = true;
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(150);
|
||||
|
|
@ -1365,30 +1415,14 @@ int TScanContext::tokenizeIdentifier()
|
|||
case SAMPLER1D:
|
||||
case SAMPLER1DSHADOW:
|
||||
afterType = true;
|
||||
if (parseContext.profile == EEsProfile)
|
||||
if (parseContext.isEsProfile())
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
case SAMPLER3D:
|
||||
afterType = true;
|
||||
if (parseContext.profile == EEsProfile && parseContext.version < 300) {
|
||||
if (!parseContext.extensionTurnedOn(E_GL_OES_texture_3D))
|
||||
reservedWord();
|
||||
}
|
||||
return keyword;
|
||||
|
||||
case SAMPLER2DSHADOW:
|
||||
afterType = true;
|
||||
if (parseContext.profile == EEsProfile && parseContext.version < 300) {
|
||||
if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers))
|
||||
reservedWord();
|
||||
}
|
||||
return keyword;
|
||||
|
||||
case SAMPLER2DRECT:
|
||||
case SAMPLER2DRECTSHADOW:
|
||||
afterType = true;
|
||||
if (parseContext.profile == EEsProfile)
|
||||
if (parseContext.isEsProfile())
|
||||
reservedWord();
|
||||
else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) {
|
||||
if (parseContext.relaxedErrors())
|
||||
|
|
@ -1400,10 +1434,10 @@ int TScanContext::tokenizeIdentifier()
|
|||
|
||||
case SAMPLER1DARRAY:
|
||||
afterType = true;
|
||||
if (parseContext.profile == EEsProfile && parseContext.version == 300)
|
||||
if (parseContext.isEsProfile() && parseContext.version == 300)
|
||||
reservedWord();
|
||||
else if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < 130))
|
||||
else if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 130))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
|
|
@ -1473,7 +1507,6 @@ int TScanContext::tokenizeIdentifier()
|
|||
else
|
||||
return identifierOrType();
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case F16SAMPLER1D:
|
||||
case F16SAMPLER2D:
|
||||
case F16SAMPLER3D:
|
||||
|
|
@ -1522,98 +1555,42 @@ int TScanContext::tokenizeIdentifier()
|
|||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) &&
|
||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
||||
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
case NOPERSPECTIVE:
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (parseContext.profile == EEsProfile && parseContext.version >= 300 &&
|
||||
parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation))
|
||||
return keyword;
|
||||
#endif
|
||||
return es30ReservedFromGLSL(130);
|
||||
|
||||
case SMOOTH:
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < 130))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EXPLICITINTERPAMD:
|
||||
if (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
||||
if (!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||
parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case PERVERTEXNV:
|
||||
if (((parseContext.profile != EEsProfile && parseContext.version >= 450) ||
|
||||
(parseContext.profile == EEsProfile && parseContext.version >= 320)) &&
|
||||
if (((!parseContext.isEsProfile() && parseContext.version >= 450) ||
|
||||
(parseContext.isEsProfile() && parseContext.version >= 320)) &&
|
||||
parseContext.extensionTurnedOn(E_GL_NV_fragment_shader_barycentric))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
case FLAT:
|
||||
if (parseContext.profile == EEsProfile && parseContext.version < 300)
|
||||
reservedWord();
|
||||
else if (parseContext.profile != EEsProfile && parseContext.version < 130)
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case CENTROID:
|
||||
if (parseContext.version < 120)
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case PRECISE:
|
||||
if ((parseContext.profile == EEsProfile &&
|
||||
if ((parseContext.isEsProfile() &&
|
||||
(parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version >= 400))
|
||||
(!parseContext.isEsProfile() && parseContext.version >= 400))
|
||||
return keyword;
|
||||
if (parseContext.profile == EEsProfile && parseContext.version == 310) {
|
||||
if (parseContext.isEsProfile() && parseContext.version == 310) {
|
||||
reservedWord();
|
||||
return keyword;
|
||||
}
|
||||
return identifierOrType();
|
||||
|
||||
case INVARIANT:
|
||||
if (parseContext.profile != EEsProfile && parseContext.version < 120)
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case PACKED:
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < 330))
|
||||
return reservedWord();
|
||||
return identifierOrType();
|
||||
|
||||
case RESOURCE:
|
||||
{
|
||||
bool reserved = (parseContext.profile == EEsProfile && parseContext.version >= 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version >= 420);
|
||||
return identifierOrReserved(reserved);
|
||||
}
|
||||
case SUPERP:
|
||||
{
|
||||
bool reserved = parseContext.profile == EEsProfile || parseContext.version >= 130;
|
||||
return identifierOrReserved(reserved);
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case PERPRIMITIVENV:
|
||||
case PERVIEWNV:
|
||||
case PERTASKNV:
|
||||
if ((parseContext.profile != EEsProfile && parseContext.version >= 450) ||
|
||||
(parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
||||
if ((!parseContext.isEsProfile() && parseContext.version >= 450) ||
|
||||
(parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||
parseContext.extensionTurnedOn(E_GL_NV_mesh_shader))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
case FCOOPMATNV:
|
||||
afterType = true;
|
||||
|
|
@ -1627,6 +1604,7 @@ int TScanContext::tokenizeIdentifier()
|
|||
return keyword;
|
||||
else
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
default:
|
||||
parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc);
|
||||
|
|
@ -1645,7 +1623,7 @@ int TScanContext::identifierOrType()
|
|||
if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) {
|
||||
if (variable->isUserType() &&
|
||||
// treat redeclaration of forward-declared buffer/uniform reference as an identifier
|
||||
!(variable->getType().getBasicType() == EbtReference && afterBuffer)) {
|
||||
!(variable->getType().isReference() && afterBuffer)) {
|
||||
afterType = true;
|
||||
|
||||
return TYPE_NAME;
|
||||
|
|
@ -1675,7 +1653,7 @@ int TScanContext::identifierOrReserved(bool reserved)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (parseContext.forwardCompatible)
|
||||
if (parseContext.isForwardCompatible())
|
||||
parseContext.warn(loc, "using future reserved keyword", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
|
|
@ -1688,13 +1666,13 @@ int TScanContext::es30ReservedFromGLSL(int version)
|
|||
if (parseContext.symbolTable.atBuiltInLevel())
|
||||
return keyword;
|
||||
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < version)) {
|
||||
if (parseContext.forwardCompatible)
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < version)) {
|
||||
if (parseContext.isForwardCompatible())
|
||||
parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
} else if (parseContext.profile == EEsProfile && parseContext.version >= 300)
|
||||
} else if (parseContext.isEsProfile() && parseContext.version >= 300)
|
||||
reservedWord();
|
||||
|
||||
return keyword;
|
||||
|
|
@ -1704,9 +1682,9 @@ int TScanContext::es30ReservedFromGLSL(int version)
|
|||
// showed up, both in an es version and a non-ES version.
|
||||
int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion)
|
||||
{
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version < esVersion) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version < nonEsVersion)) {
|
||||
if (parseContext.forwardCompatible)
|
||||
if ((parseContext.isEsProfile() && parseContext.version < esVersion) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < nonEsVersion)) {
|
||||
if (parseContext.isForwardCompatible())
|
||||
parseContext.warn(loc, "using future keyword", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
|
|
@ -1717,10 +1695,10 @@ int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion)
|
|||
|
||||
int TScanContext::precisionKeyword()
|
||||
{
|
||||
if (parseContext.profile == EEsProfile || parseContext.version >= 130)
|
||||
if (parseContext.isEsProfile() || parseContext.version >= 130)
|
||||
return keyword;
|
||||
|
||||
if (parseContext.forwardCompatible)
|
||||
if (parseContext.isForwardCompatible())
|
||||
parseContext.warn(loc, "using ES precision qualifier keyword", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
|
|
@ -1733,7 +1711,7 @@ int TScanContext::matNxM()
|
|||
if (parseContext.version > 110)
|
||||
return keyword;
|
||||
|
||||
if (parseContext.forwardCompatible)
|
||||
if (parseContext.isForwardCompatible())
|
||||
parseContext.warn(loc, "using future non-square matrix type keyword", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
|
|
@ -1743,16 +1721,16 @@ int TScanContext::dMat()
|
|||
{
|
||||
afterType = true;
|
||||
|
||||
if (parseContext.profile == EEsProfile && parseContext.version >= 300) {
|
||||
if (parseContext.isEsProfile() && parseContext.version >= 300) {
|
||||
reservedWord();
|
||||
|
||||
return keyword;
|
||||
}
|
||||
|
||||
if (parseContext.profile != EEsProfile && parseContext.version >= 400)
|
||||
if (!parseContext.isEsProfile() && parseContext.version >= 400)
|
||||
return keyword;
|
||||
|
||||
if (parseContext.forwardCompatible)
|
||||
if (parseContext.isForwardCompatible())
|
||||
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
|
|
@ -1761,19 +1739,19 @@ int TScanContext::dMat()
|
|||
int TScanContext::firstGenerationImage(bool inEs310)
|
||||
{
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.profile != EEsProfile && (parseContext.version >= 420 ||
|
||||
(!parseContext.isEsProfile() && (parseContext.version >= 420 ||
|
||||
parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) ||
|
||||
(inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310))
|
||||
(inEs310 && parseContext.isEsProfile() && parseContext.version >= 310))
|
||||
return keyword;
|
||||
|
||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 300) ||
|
||||
(parseContext.profile != EEsProfile && parseContext.version >= 130)) {
|
||||
if ((parseContext.isEsProfile() && parseContext.version >= 300) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version >= 130)) {
|
||||
reservedWord();
|
||||
|
||||
return keyword;
|
||||
}
|
||||
|
||||
if (parseContext.forwardCompatible)
|
||||
if (parseContext.isForwardCompatible())
|
||||
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
|
|
@ -1781,17 +1759,17 @@ int TScanContext::firstGenerationImage(bool inEs310)
|
|||
|
||||
int TScanContext::secondGenerationImage()
|
||||
{
|
||||
if (parseContext.profile == EEsProfile && parseContext.version >= 310) {
|
||||
if (parseContext.isEsProfile() && parseContext.version >= 310) {
|
||||
reservedWord();
|
||||
return keyword;
|
||||
}
|
||||
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.profile != EEsProfile &&
|
||||
(!parseContext.isEsProfile() &&
|
||||
(parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
|
||||
return keyword;
|
||||
|
||||
if (parseContext.forwardCompatible)
|
||||
if (parseContext.isForwardCompatible())
|
||||
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
|
|
|
|||
|
|
@ -326,6 +326,7 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
|||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// check for tessellation
|
||||
if ((profile != EEsProfile && version >= 150) ||
|
||||
(profile == EEsProfile && version >= 310)) {
|
||||
|
|
@ -347,7 +348,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
|||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
// check for ray tracing stages
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGenNV, source,
|
||||
|
|
@ -377,8 +377,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
|||
infoSink, commonTable, symbolTables);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -479,11 +477,13 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
|||
// Function to Print all builtins
|
||||
void DumpBuiltinSymbolTable(TInfoSink& infoSink, const TSymbolTable& symbolTable)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
infoSink.debug << "BuiltinSymbolTable {\n";
|
||||
|
||||
symbolTable.dump(infoSink, true);
|
||||
|
||||
infoSink.debug << "}\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
// Return true if the shader was correctly specified for version/profile/stage.
|
||||
|
|
@ -581,6 +581,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
|||
break;
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Correct for stage type...
|
||||
switch (stage) {
|
||||
case EShLangGeometry:
|
||||
|
|
@ -612,7 +613,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
|||
version = profile == EEsProfile ? 310 : 420;
|
||||
}
|
||||
break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangRayGenNV:
|
||||
case EShLangIntersectNV:
|
||||
case EShLangAnyHitNV:
|
||||
|
|
@ -633,7 +633,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
|||
infoSink.info.message(EPrefixError, "#version: mesh/task shaders require es profile with version 320 or above, or non-es profile with version 450 or above");
|
||||
version = profile == EEsProfile ? 320 : 450;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -675,6 +674,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return correct;
|
||||
}
|
||||
|
|
@ -833,13 +833,17 @@ bool ProcessDeferred(
|
|||
|
||||
// Get all the stages, languages, clients, and other environment
|
||||
// stuff sorted out.
|
||||
EShSource source = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl;
|
||||
EShSource sourceGuess = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl;
|
||||
SpvVersion spvVersion;
|
||||
EShLanguage stage = compiler->getLanguage();
|
||||
TranslateEnvironment(environment, messages, source, stage, spvVersion);
|
||||
TranslateEnvironment(environment, messages, sourceGuess, stage, spvVersion);
|
||||
#ifdef ENABLE_HLSL
|
||||
EShSource source = sourceGuess;
|
||||
if (environment != nullptr && environment->target.hlslFunctionality1)
|
||||
intermediate.setHlslFunctionality1();
|
||||
|
||||
#else
|
||||
const EShSource source = EShSourceGlsl;
|
||||
#endif
|
||||
// First, without using the preprocessor or parser, find the #version, so we know what
|
||||
// symbol tables, processing rules, etc. to set up. This does not need the extra strings
|
||||
// outlined above, just the user shader, after the system and user preambles.
|
||||
|
|
@ -852,6 +856,7 @@ bool ProcessDeferred(
|
|||
: userInput.scanVersion(version, profile, versionNotFirstToken);
|
||||
bool versionNotFound = version == 0;
|
||||
if (forceDefaultVersionAndProfile && source == EShSourceGlsl) {
|
||||
#ifndef GLSLANG_WEB
|
||||
if (! (messages & EShMsgSuppressWarnings) && ! versionNotFound &&
|
||||
(version != defaultVersion || profile != defaultProfile)) {
|
||||
compiler->infoSink.info << "Warning, (version, profile) forced to be ("
|
||||
|
|
@ -859,7 +864,7 @@ bool ProcessDeferred(
|
|||
<< "), while in source code it is ("
|
||||
<< version << ", " << ProfileName(profile) << ")\n";
|
||||
}
|
||||
|
||||
#endif
|
||||
if (versionNotFound) {
|
||||
versionNotFirstToken = false;
|
||||
versionNotFirst = false;
|
||||
|
|
@ -872,6 +877,7 @@ bool ProcessDeferred(
|
|||
bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage,
|
||||
versionNotFirst, defaultVersion, source, version, profile, spvVersion);
|
||||
bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst));
|
||||
#ifndef GLSLANG_WEB
|
||||
bool warnVersionNotFirst = false;
|
||||
if (! versionWillBeError && versionNotFirstToken) {
|
||||
if (messages & EShMsgRelaxedErrors)
|
||||
|
|
@ -879,6 +885,7 @@ bool ProcessDeferred(
|
|||
else
|
||||
versionWillBeError = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
intermediate.setSource(source);
|
||||
intermediate.setVersion(version);
|
||||
|
|
@ -887,8 +894,10 @@ bool ProcessDeferred(
|
|||
RecordProcesses(intermediate, messages, sourceEntryPointName);
|
||||
if (spvVersion.vulkan > 0)
|
||||
intermediate.setOriginUpperLeft();
|
||||
#ifdef ENABLE_HLSL
|
||||
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
|
||||
intermediate.setHlslOffsets();
|
||||
#endif
|
||||
if (messages & EShMsgDebugInfo) {
|
||||
intermediate.setSourceFile(names[numPre]);
|
||||
for (int s = 0; s < numStrings; ++s) {
|
||||
|
|
@ -938,11 +947,13 @@ bool ProcessDeferred(
|
|||
parseContext->setLimits(*resources);
|
||||
if (! goodVersion)
|
||||
parseContext->addError();
|
||||
#ifndef GLSLANG_WEB
|
||||
if (warnVersionNotFirst) {
|
||||
TSourceLoc loc;
|
||||
loc.init();
|
||||
parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", "");
|
||||
}
|
||||
#endif
|
||||
|
||||
parseContext->initializeExtensionBehavior();
|
||||
|
||||
|
|
@ -973,6 +984,8 @@ bool ProcessDeferred(
|
|||
return success;
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
// Responsible for keeping track of the most recent source string and line in
|
||||
// the preprocessor and outputting newlines appropriately if the source string
|
||||
// or line changes.
|
||||
|
|
@ -1169,6 +1182,8 @@ struct DoPreprocessing {
|
|||
std::string* outputString;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// DoFullParse is a valid ProcessingConext template argument for fully
|
||||
// parsing the shader. It populates the "intermediate" with the AST.
|
||||
struct DoFullParse{
|
||||
|
|
@ -1199,6 +1214,7 @@ struct DoFullParse{
|
|||
}
|
||||
};
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Take a single compilation unit, and run the preprocessor on it.
|
||||
// Return: True if there were no issues found in preprocessing,
|
||||
// False if during preprocessing any unknown version, pragmas or
|
||||
|
|
@ -1231,6 +1247,7 @@ bool PreprocessDeferred(
|
|||
forwardCompatible, messages, intermediate, parser,
|
||||
false, includer);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// do a partial compile on the given strings for a single compilation unit
|
||||
|
|
@ -1749,6 +1766,11 @@ void TShader::addProcesses(const std::vector<std::string>& p)
|
|||
intermediate->addProcesses(p);
|
||||
}
|
||||
|
||||
void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); }
|
||||
void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); }
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
// Set binding base for given resource type
|
||||
void TShader::setShiftBinding(TResourceType res, unsigned int base) {
|
||||
intermediate->setShiftBinding(res, base);
|
||||
|
|
@ -1776,7 +1798,7 @@ void TShader::setShiftSsboBinding(unsigned int base) { setShiftBinding(EResSs
|
|||
// Enables binding automapping using TIoMapper
|
||||
void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); }
|
||||
// Enables position.Y output negation in vertex shader
|
||||
void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); }
|
||||
|
||||
// Fragile: currently within one stage: simple auto-assignment of location
|
||||
void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); }
|
||||
void TShader::addUniformLocationOverride(const char* name, int loc)
|
||||
|
|
@ -1787,13 +1809,16 @@ void TShader::setUniformLocationBase(int base)
|
|||
{
|
||||
intermediate->setUniformLocationBase(base);
|
||||
}
|
||||
void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
|
||||
void TShader::setResourceSetBinding(const std::vector<std::string>& base) { intermediate->setResourceSetBinding(base); }
|
||||
void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); }
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
|
||||
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
|
||||
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }
|
||||
void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
|
||||
void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); }
|
||||
void TShader::setResourceSetBinding(const std::vector<std::string>& base) { intermediate->setResourceSetBinding(base); }
|
||||
void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); }
|
||||
#endif
|
||||
|
||||
//
|
||||
// Turn the shader strings into a parse tree in the TIntermediate.
|
||||
|
|
@ -1817,6 +1842,7 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
|
|||
&environment);
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Fill in a string with the result of preprocessing ShaderStrings
|
||||
// Returns true if all extensions, pragmas and version strings were valid.
|
||||
//
|
||||
|
|
@ -1841,6 +1867,7 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources,
|
|||
defaultProfile, forceDefaultVersionAndProfile,
|
||||
forwardCompatible, message, includer, *intermediate, output_string);
|
||||
}
|
||||
#endif
|
||||
|
||||
const char* TShader::getInfoLog()
|
||||
{
|
||||
|
|
@ -1852,7 +1879,11 @@ const char* TShader::getInfoDebugLog()
|
|||
return infoSink->debug.c_str();
|
||||
}
|
||||
|
||||
TProgram::TProgram() : reflection(0), linked(false)
|
||||
TProgram::TProgram() :
|
||||
#ifndef GLSLANG_WEB
|
||||
reflection(0),
|
||||
#endif
|
||||
linked(false)
|
||||
{
|
||||
pool = new TPoolAllocator;
|
||||
infoSink = new TInfoSink;
|
||||
|
|
@ -1865,7 +1896,9 @@ TProgram::TProgram() : reflection(0), linked(false)
|
|||
TProgram::~TProgram()
|
||||
{
|
||||
delete infoSink;
|
||||
#ifndef GLSLANG_WEB
|
||||
delete reflection;
|
||||
#endif
|
||||
|
||||
for (int s = 0; s < EShLangCount; ++s)
|
||||
if (newedIntermediate[s])
|
||||
|
|
@ -1910,6 +1943,7 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
|
|||
if (stages[stage].size() == 0)
|
||||
return true;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
int numEsShaders = 0, numNonEsShaders = 0;
|
||||
for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) {
|
||||
if ((*it)->intermediate->getProfile() == EEsProfile) {
|
||||
|
|
@ -1958,7 +1992,9 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
|
|||
for (it = stages[stage].begin(); it != stages[stage].end(); ++it)
|
||||
intermediate[stage]->merge(*infoSink, *(*it)->intermediate);
|
||||
}
|
||||
|
||||
#else
|
||||
intermediate[stage] = stages[stage].front()->intermediate;
|
||||
#endif
|
||||
intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0);
|
||||
|
||||
if (messages & EShMsgAST)
|
||||
|
|
@ -1977,6 +2013,8 @@ const char* TProgram::getInfoDebugLog()
|
|||
return infoSink->debug.c_str();
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
//
|
||||
// Reflection implementation.
|
||||
//
|
||||
|
|
@ -2054,4 +2092,6 @@ bool TProgram::mapIO(TIoMapResolver* pResolver, TIoMapper* pIoMapper)
|
|||
return ioMapper->doMap(pResolver, *infoSink);
|
||||
}
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -61,54 +61,56 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
|
||||
switch (basicType) {
|
||||
case EbtFloat: mangledName += 'f'; break;
|
||||
case EbtDouble: mangledName += 'd'; break;
|
||||
case EbtFloat16: mangledName += "f16"; break;
|
||||
case EbtInt: mangledName += 'i'; break;
|
||||
case EbtUint: mangledName += 'u'; break;
|
||||
case EbtBool: mangledName += 'b'; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtDouble: mangledName += 'd'; break;
|
||||
case EbtFloat16: mangledName += "f16"; break;
|
||||
case EbtInt8: mangledName += "i8"; break;
|
||||
case EbtUint8: mangledName += "u8"; break;
|
||||
case EbtInt16: mangledName += "i16"; break;
|
||||
case EbtUint16: mangledName += "u16"; break;
|
||||
case EbtInt64: mangledName += "i64"; break;
|
||||
case EbtUint64: mangledName += "u64"; break;
|
||||
case EbtBool: mangledName += 'b'; break;
|
||||
case EbtAtomicUint: mangledName += "au"; break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EbtAccStructNV: mangledName += "asnv"; break;
|
||||
#endif
|
||||
case EbtSampler:
|
||||
switch (sampler.type) {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
case EbtFloat16: mangledName += "f16"; break;
|
||||
#endif
|
||||
case EbtInt: mangledName += "i"; break;
|
||||
case EbtUint: mangledName += "u"; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
if (sampler.image)
|
||||
mangledName += "I"; // a normal image
|
||||
else if (sampler.sampler)
|
||||
if (sampler.isImageClass())
|
||||
mangledName += "I"; // a normal image or subpass
|
||||
else if (sampler.isPureSampler())
|
||||
mangledName += "p"; // a "pure" sampler
|
||||
else if (!sampler.combined)
|
||||
else if (!sampler.isCombined())
|
||||
mangledName += "t"; // a "pure" texture
|
||||
else
|
||||
mangledName += "s"; // traditional combined sampler
|
||||
if (sampler.arrayed)
|
||||
if (sampler.isArrayed())
|
||||
mangledName += "A";
|
||||
if (sampler.shadow)
|
||||
if (sampler.isShadow())
|
||||
mangledName += "S";
|
||||
if (sampler.external)
|
||||
if (sampler.isExternal())
|
||||
mangledName += "E";
|
||||
if (sampler.yuv)
|
||||
if (sampler.isYuv())
|
||||
mangledName += "Y";
|
||||
switch (sampler.dim) {
|
||||
case Esd1D: mangledName += "1"; break;
|
||||
case Esd2D: mangledName += "2"; break;
|
||||
case Esd3D: mangledName += "3"; break;
|
||||
case EsdCube: mangledName += "C"; break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case Esd1D: mangledName += "1"; break;
|
||||
case EsdRect: mangledName += "R2"; break;
|
||||
case EsdBuffer: mangledName += "B"; break;
|
||||
case EsdSubpass: mangledName += "P"; break;
|
||||
#endif
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +119,7 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
mangledName += "-tx-struct";
|
||||
|
||||
char text[16]; // plenty enough space for the small integers.
|
||||
snprintf(text, sizeof(text), "%d-", sampler.structReturnIndex);
|
||||
snprintf(text, sizeof(text), "%d-", sampler.getStructReturnIndex());
|
||||
mangledName += text;
|
||||
} else {
|
||||
switch (sampler.getVectorSize()) {
|
||||
|
|
@ -128,7 +130,7 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
}
|
||||
}
|
||||
|
||||
if (sampler.ms)
|
||||
if (sampler.isMultiSample())
|
||||
mangledName += "M";
|
||||
break;
|
||||
case EbtStruct:
|
||||
|
|
@ -172,6 +174,8 @@ void TType::buildMangledName(TString& mangledName) const
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
//
|
||||
// Dump functions.
|
||||
//
|
||||
|
|
@ -250,6 +254,8 @@ void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Functions have buried pointers to delete.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -116,8 +116,11 @@ public:
|
|||
}
|
||||
virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); }
|
||||
virtual const char** getExtensions() const { return extensions->data(); }
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0;
|
||||
void dumpExtensions(TInfoSink& infoSink) const;
|
||||
#endif
|
||||
|
||||
virtual bool isReadOnly() const { return ! writable; }
|
||||
virtual void makeReadOnly() { writable = false; }
|
||||
|
|
@ -193,7 +196,9 @@ public:
|
|||
}
|
||||
virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); }
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
virtual void dump(TInfoSink& infoSink, bool complete = false) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
explicit TVariable(const TVariable&);
|
||||
|
|
@ -314,7 +319,9 @@ public:
|
|||
virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; }
|
||||
virtual const TParameter& operator[](int i) const { return parameters[i]; }
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
explicit TFunction(const TFunction&);
|
||||
|
|
@ -374,7 +381,9 @@ public:
|
|||
virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); }
|
||||
|
||||
virtual int getAnonId() const { return anonId; }
|
||||
#ifndef GLSLANG_WEB
|
||||
virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
explicit TAnonMember(const TAnonMember&);
|
||||
|
|
@ -542,7 +551,9 @@ public:
|
|||
|
||||
void relateToOperator(const char* name, TOperator op);
|
||||
void setFunctionExtensions(const char* name, int num, const char* const extensions[]);
|
||||
#ifndef GLSLANG_WEB
|
||||
void dump(TInfoSink& infoSink, bool complete = false) const;
|
||||
#endif
|
||||
TSymbolTableLevel* clone() const;
|
||||
void readOnly();
|
||||
|
||||
|
|
@ -843,7 +854,9 @@ public:
|
|||
}
|
||||
|
||||
int getMaxSymbolId() { return uniqueId; }
|
||||
#ifndef GLSLANG_WEB
|
||||
void dump(TInfoSink& infoSink, bool complete = false) const;
|
||||
#endif
|
||||
void copyTable(const TSymbolTable& copyOf);
|
||||
|
||||
void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); }
|
||||
|
|
|
|||
|
|
@ -145,6 +145,8 @@
|
|||
|
||||
namespace glslang {
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
//
|
||||
// Initialize all extensions, almost always to 'disable', as once their features
|
||||
// are incorporated into a core version, their features are supported through allowing that
|
||||
|
|
@ -221,7 +223,6 @@ 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;
|
||||
|
|
@ -232,9 +233,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_AMD_shader_image_load_store_lod] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_gpu_shader_half_float_fetch] = EBhDisable;
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
extensionBehavior[E_GL_NV_sample_mask_override_coverage] = EBhDisable;
|
||||
extensionBehavior[E_SPV_NV_geometry_shader_passthrough] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_viewport_array2] = EBhDisable;
|
||||
|
|
@ -250,7 +249,6 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_mesh_shader] = EBhDisable;
|
||||
#endif
|
||||
|
||||
extensionBehavior[E_GL_NV_cooperative_matrix] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_shader_sm_builtins] = EBhDisable;
|
||||
|
|
@ -302,15 +300,19 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float32] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float64] = EBhDisable;
|
||||
}
|
||||
#endif // GLSLANG_WEB
|
||||
|
||||
// Get code that is not part of a shared symbol table, is specific to this shader,
|
||||
// or needed by the preprocessor (which does not use a shared symbol table).
|
||||
void TParseVersions::getPreamble(std::string& preamble)
|
||||
{
|
||||
if (profile == EEsProfile) {
|
||||
if (isEsProfile()) {
|
||||
preamble =
|
||||
"#define GL_ES 1\n"
|
||||
"#define GL_FRAGMENT_PRECISION_HIGH 1\n"
|
||||
#ifdef GLSLANG_WEB
|
||||
;
|
||||
#else
|
||||
"#define GL_OES_texture_3D 1\n"
|
||||
"#define GL_OES_standard_derivatives 1\n"
|
||||
"#define GL_EXT_frag_depth 1\n"
|
||||
|
|
@ -350,11 +352,9 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
|
||||
;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (profile == EEsProfile && version >= 300) {
|
||||
if (isEsProfile() && version >= 300) {
|
||||
preamble += "#define GL_NV_shader_noperspective_interpolation 1\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
preamble =
|
||||
|
|
@ -412,7 +412,6 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define E_GL_EXT_shader_atomic_int64 1\n"
|
||||
"#define E_GL_EXT_shader_realtime_clock 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"
|
||||
|
|
@ -423,9 +422,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_AMD_shader_image_load_store_lod 1\n"
|
||||
"#define GL_AMD_shader_fragment_mask 1\n"
|
||||
"#define GL_AMD_gpu_shader_half_float_fetch 1\n"
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
"#define GL_NV_sample_mask_override_coverage 1\n"
|
||||
"#define GL_NV_geometry_shader_passthrough 1\n"
|
||||
"#define GL_NV_viewport_array2 1\n"
|
||||
|
|
@ -438,7 +435,6 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_NV_compute_shader_derivatives 1\n"
|
||||
"#define GL_NV_shader_texture_footprint 1\n"
|
||||
"#define GL_NV_mesh_shader 1\n"
|
||||
#endif
|
||||
"#define GL_NV_cooperative_matrix 1\n"
|
||||
|
||||
"#define GL_EXT_shader_explicit_arithmetic_types 1\n"
|
||||
|
|
@ -458,10 +454,12 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
if (profile == ECompatibilityProfile)
|
||||
preamble += "#define GL_compatibility_profile 1\n";
|
||||
}
|
||||
#endif // GLSLANG_WEB
|
||||
}
|
||||
|
||||
if ((profile != EEsProfile && version >= 140) ||
|
||||
(profile == EEsProfile && version >= 310)) {
|
||||
#ifndef GLSLANG_WEB
|
||||
if ((!isEsProfile() && version >= 140) ||
|
||||
(isEsProfile() && version >= 310)) {
|
||||
preamble +=
|
||||
"#define GL_EXT_device_group 1\n"
|
||||
"#define GL_EXT_multiview 1\n"
|
||||
|
|
@ -481,6 +479,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_GOOGLE_cpp_style_line_directive 1\n"
|
||||
"#define GL_GOOGLE_include_directive 1\n"
|
||||
;
|
||||
#endif
|
||||
|
||||
// #define VULKAN XXXX
|
||||
const int numberBufSize = 12;
|
||||
|
|
@ -491,6 +490,8 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
preamble += numberBuf;
|
||||
preamble += "\n";
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// #define GL_SPIRV XXXX
|
||||
if (spvVersion.openGl > 0) {
|
||||
preamble += "#define GL_SPIRV ";
|
||||
|
|
@ -498,22 +499,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
preamble += numberBuf;
|
||||
preamble += "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// When to use requireProfile():
|
||||
//
|
||||
// Use if only some profiles support a feature. However, if within a profile the feature
|
||||
// is version or extension specific, follow this call with calls to profileRequires().
|
||||
//
|
||||
// Operation: If the current profile is not one of the profileMask,
|
||||
// give an error message.
|
||||
//
|
||||
void TParseVersions::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc)
|
||||
{
|
||||
if (! (profile & profileMask))
|
||||
error(loc, "not supported with this profile:", featureDesc, ProfileName(profile));
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -523,12 +509,12 @@ const char* StageName(EShLanguage stage)
|
|||
{
|
||||
switch(stage) {
|
||||
case EShLangVertex: return "vertex";
|
||||
case EShLangFragment: return "fragment";
|
||||
#ifndef GLSLANG_WEB
|
||||
case EShLangTessControl: return "tessellation control";
|
||||
case EShLangTessEvaluation: return "tessellation evaluation";
|
||||
case EShLangGeometry: return "geometry";
|
||||
case EShLangFragment: return "fragment";
|
||||
case EShLangCompute: return "compute";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangRayGenNV: return "ray-generation";
|
||||
case EShLangIntersectNV: return "intersection";
|
||||
case EShLangAnyHitNV: return "any-hit";
|
||||
|
|
@ -542,53 +528,6 @@ const char* StageName(EShLanguage stage)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// When to use profileRequires():
|
||||
//
|
||||
// If a set of profiles have the same requirements for what version or extensions
|
||||
// are needed to support a feature.
|
||||
//
|
||||
// It must be called for each profile that needs protection. Use requireProfile() first
|
||||
// to reduce that set of profiles.
|
||||
//
|
||||
// Operation: Will issue warnings/errors based on the current profile, version, and extension
|
||||
// behaviors. It only checks extensions when the current profile is one of the profileMask.
|
||||
//
|
||||
// A minVersion of 0 means no version of the profileMask support this in core,
|
||||
// the extension must be present.
|
||||
//
|
||||
|
||||
// entry point that takes multiple extensions
|
||||
void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc)
|
||||
{
|
||||
if (profile & profileMask) {
|
||||
bool okay = false;
|
||||
if (minVersion > 0 && version >= minVersion)
|
||||
okay = true;
|
||||
for (int i = 0; i < numExtensions; ++i) {
|
||||
switch (getExtensionBehavior(extensions[i])) {
|
||||
case EBhWarn:
|
||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
|
||||
// fall through
|
||||
case EBhRequire:
|
||||
case EBhEnable:
|
||||
okay = true;
|
||||
break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
}
|
||||
|
||||
if (! okay)
|
||||
error(loc, "not supported for this version or the enabled extensions", featureDesc, "");
|
||||
}
|
||||
}
|
||||
|
||||
// entry point for the above that takes a single extension
|
||||
void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, const char* featureDesc)
|
||||
{
|
||||
profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc);
|
||||
}
|
||||
|
||||
//
|
||||
// When to use requireStage()
|
||||
//
|
||||
|
|
@ -609,6 +548,75 @@ void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, cons
|
|||
requireStage(loc, static_cast<EShLanguageMask>(1 << stage), featureDesc);
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
//
|
||||
// When to use requireProfile():
|
||||
//
|
||||
// Use if only some profiles support a feature. However, if within a profile the feature
|
||||
// is version or extension specific, follow this call with calls to profileRequires().
|
||||
//
|
||||
// Operation: If the current profile is not one of the profileMask,
|
||||
// give an error message.
|
||||
//
|
||||
void TParseVersions::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc)
|
||||
{
|
||||
if (! (profile & profileMask))
|
||||
error(loc, "not supported with this profile:", featureDesc, ProfileName(profile));
|
||||
}
|
||||
|
||||
//
|
||||
// When to use profileRequires():
|
||||
//
|
||||
// If a set of profiles have the same requirements for what version or extensions
|
||||
// are needed to support a feature.
|
||||
//
|
||||
// It must be called for each profile that needs protection. Use requireProfile() first
|
||||
// to reduce that set of profiles.
|
||||
//
|
||||
// Operation: Will issue warnings/errors based on the current profile, version, and extension
|
||||
// behaviors. It only checks extensions when the current profile is one of the profileMask.
|
||||
//
|
||||
// A minVersion of 0 means no version of the profileMask support this in core,
|
||||
// the extension must be present.
|
||||
//
|
||||
|
||||
// entry point that takes multiple extensions
|
||||
void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions,
|
||||
const char* const extensions[], const char* featureDesc)
|
||||
{
|
||||
if (profile & profileMask) {
|
||||
bool okay = minVersion > 0 && version >= minVersion;
|
||||
#ifndef GLSLANG_WEB
|
||||
for (int i = 0; i < numExtensions; ++i) {
|
||||
switch (getExtensionBehavior(extensions[i])) {
|
||||
case EBhWarn:
|
||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
|
||||
// fall through
|
||||
case EBhRequire:
|
||||
case EBhEnable:
|
||||
okay = true;
|
||||
break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (! okay)
|
||||
error(loc, "not supported for this version or the enabled extensions", featureDesc, "");
|
||||
}
|
||||
}
|
||||
|
||||
// entry point for the above that takes a single extension
|
||||
void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension,
|
||||
const char* featureDesc)
|
||||
{
|
||||
profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc);
|
||||
}
|
||||
|
||||
void TParseVersions::unimplemented(const TSourceLoc& loc, const char* featureDesc)
|
||||
{
|
||||
error(loc, "feature not yet implemented", featureDesc, "");
|
||||
}
|
||||
|
||||
//
|
||||
// Within a set of profiles, see if a feature is deprecated and give an error or warning based on whether
|
||||
// a future compatibility context is being use.
|
||||
|
|
@ -642,11 +650,6 @@ void TParseVersions::requireNotRemoved(const TSourceLoc& loc, int profileMask, i
|
|||
}
|
||||
}
|
||||
|
||||
void TParseVersions::unimplemented(const TSourceLoc& loc, const char* featureDesc)
|
||||
{
|
||||
error(loc, "feature not yet implemented", featureDesc, "");
|
||||
}
|
||||
|
||||
// Returns true if at least one of the extensions in the extensions parameter is requested. Otherwise, returns false.
|
||||
// Warns appropriately if the requested behavior of an extension is "warn".
|
||||
bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc)
|
||||
|
|
@ -815,10 +818,8 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
|
|||
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
|
||||
else if (strcmp(extension, "GL_KHR_shader_subgroup_quad") == 0)
|
||||
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (strcmp(extension, "GL_NV_shader_subgroup_partitioned") == 0)
|
||||
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
|
||||
#endif
|
||||
else if (strcmp(extension, "GL_EXT_buffer_reference2") == 0)
|
||||
updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString);
|
||||
}
|
||||
|
|
@ -866,7 +867,6 @@ void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBe
|
|||
// Check if extension is used with correct shader stage.
|
||||
void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * const extension)
|
||||
{
|
||||
#ifdef NV_EXTENSIONS
|
||||
// GL_NV_mesh_shader extension is only allowed in task/mesh shaders
|
||||
if (strcmp(extension, "GL_NV_mesh_shader") == 0) {
|
||||
requireStage(loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask | EShLangFragmentMask),
|
||||
|
|
@ -874,7 +874,6 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con
|
|||
profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader");
|
||||
profileRequires(loc, EEsProfile, 320, 0, "#extension GL_NV_mesh_shader");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Call for any operation needing full GLSL integer data-type support.
|
||||
|
|
@ -896,9 +895,7 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu
|
|||
{
|
||||
if (!builtIn) {
|
||||
const char* const extensions[] = {
|
||||
#if AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_half_float,
|
||||
#endif
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
||||
|
|
@ -908,9 +905,7 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu
|
|||
bool TParseVersions::float16Arithmetic()
|
||||
{
|
||||
const char* const extensions[] = {
|
||||
#if AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_half_float,
|
||||
#endif
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
||||
return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions);
|
||||
|
|
@ -919,9 +914,7 @@ bool TParseVersions::float16Arithmetic()
|
|||
bool TParseVersions::int16Arithmetic()
|
||||
{
|
||||
const char* const extensions[] = {
|
||||
#if AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_int16,
|
||||
#endif
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
||||
return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions);
|
||||
|
|
@ -943,9 +936,7 @@ void TParseVersions::requireFloat16Arithmetic(const TSourceLoc& loc, const char*
|
|||
combined += featureDesc;
|
||||
|
||||
const char* const extensions[] = {
|
||||
#if AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_half_float,
|
||||
#endif
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str());
|
||||
|
|
@ -959,9 +950,7 @@ void TParseVersions::requireInt16Arithmetic(const TSourceLoc& loc, const char* o
|
|||
combined += featureDesc;
|
||||
|
||||
const char* const extensions[] = {
|
||||
#if AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_int16,
|
||||
#endif
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str());
|
||||
|
|
@ -984,9 +973,7 @@ void TParseVersions::float16ScalarVectorCheck(const TSourceLoc& loc, const char*
|
|||
{
|
||||
if (!builtIn) {
|
||||
const char* const extensions[] = {
|
||||
#if AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_half_float,
|
||||
#endif
|
||||
E_GL_EXT_shader_16bit_storage,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
||||
|
|
@ -1026,7 +1013,6 @@ void TParseVersions::explicitInt8Check(const TSourceLoc& loc, const char* op, bo
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// Call for any operation needing GLSL float16 opaque-type support
|
||||
void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||
{
|
||||
|
|
@ -1036,16 +1022,13 @@ void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, b
|
|||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Call for any operation needing GLSL explicit int16 data-type support.
|
||||
void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||
{
|
||||
if (! builtIn) {
|
||||
const char* const extensions[] = {
|
||||
#if AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_int16,
|
||||
#endif
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
||||
|
|
@ -1056,9 +1039,7 @@ void TParseVersions::int16ScalarVectorCheck(const TSourceLoc& loc, const char* o
|
|||
{
|
||||
if (! builtIn) {
|
||||
const char* const extensions[] = {
|
||||
#if AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_int16,
|
||||
#endif
|
||||
E_GL_EXT_shader_16bit_storage,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
||||
|
|
@ -1107,6 +1088,7 @@ void TParseVersions::fcoopmatCheck(const TSourceLoc& loc, const char* op, bool b
|
|||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
||||
}
|
||||
}
|
||||
#endif // GLSLANG_WEB
|
||||
|
||||
// Call for any operation removed because SPIR-V is in use.
|
||||
void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
|
||||
|
|
@ -1125,15 +1107,19 @@ void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op)
|
|||
// Call for any operation that requires Vulkan.
|
||||
void TParseVersions::requireVulkan(const TSourceLoc& loc, const char* op)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
if (spvVersion.vulkan == 0)
|
||||
error(loc, "only allowed when using GLSL for Vulkan", op, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Call for any operation that requires SPIR-V.
|
||||
void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
if (spvVersion.spv == 0)
|
||||
error(loc, "only allowed when generating SPIR-V", op, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -193,7 +193,6 @@ const int Num_OVR_multiview_EXTs = sizeof(OVR_multiview_EXTs) / sizeof(OVR_multi
|
|||
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";
|
||||
|
|
@ -204,9 +203,6 @@ const char* const E_GL_AMD_gpu_shader_int16 = "GL_AMD_gpu_sh
|
|||
const char* const E_GL_AMD_shader_image_load_store_lod = "GL_AMD_shader_image_load_store_lod";
|
||||
const char* const E_GL_AMD_shader_fragment_mask = "GL_AMD_shader_fragment_mask";
|
||||
const char* const E_GL_AMD_gpu_shader_half_float_fetch = "GL_AMD_gpu_shader_half_float_fetch";
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
|
||||
const char* const E_GL_NV_sample_mask_override_coverage = "GL_NV_sample_mask_override_coverage";
|
||||
const char* const E_SPV_NV_geometry_shader_passthrough = "GL_NV_geometry_shader_passthrough";
|
||||
|
|
@ -228,7 +224,6 @@ const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_sh
|
|||
|
||||
const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 };
|
||||
const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]);
|
||||
#endif
|
||||
|
||||
const char* const E_GL_NV_cooperative_matrix = "GL_NV_cooperative_matrix";
|
||||
const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins";
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#include "attribute.h"
|
||||
#include "../Include/intermediate.h"
|
||||
#include "ParseHelper.h"
|
||||
|
|
@ -339,5 +341,6 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@
|
|||
#define GL_DOUBLE_MAT4x2 0x8F4D
|
||||
#define GL_DOUBLE_MAT4x3 0x8F4E
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// Those constants are borrowed from extension NV_gpu_shader5
|
||||
#define GL_FLOAT16_NV 0x8FF8
|
||||
#define GL_FLOAT16_VEC2_NV 0x8FF9
|
||||
|
|
@ -94,7 +93,6 @@
|
|||
#define GL_FLOAT16_MAT3x4_AMD 0x91CB
|
||||
#define GL_FLOAT16_MAT4x2_AMD 0x91CC
|
||||
#define GL_FLOAT16_MAT4x3_AMD 0x91CD
|
||||
#endif
|
||||
|
||||
#define GL_SAMPLER_1D 0x8B5D
|
||||
#define GL_SAMPLER_2D 0x8B5E
|
||||
|
|
@ -117,7 +115,6 @@
|
|||
#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
|
||||
#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#define GL_FLOAT16_SAMPLER_1D_AMD 0x91CE
|
||||
#define GL_FLOAT16_SAMPLER_2D_AMD 0x91CF
|
||||
#define GL_FLOAT16_SAMPLER_3D_AMD 0x91D0
|
||||
|
|
@ -149,7 +146,6 @@
|
|||
#define GL_FLOAT16_IMAGE_BUFFER_AMD 0x91E8
|
||||
#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD 0x91E9
|
||||
#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD 0x91EA
|
||||
#endif
|
||||
|
||||
#define GL_INT_SAMPLER_1D 0x8DC9
|
||||
#define GL_INT_SAMPLER_2D 0x8DCA
|
||||
|
|
|
|||
3787
glslang/MachineIndependent/glslang.m4
Normal file
3787
glslang/MachineIndependent/glslang.m4
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -45,412 +45,412 @@ extern int yydebug;
|
|||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
ATTRIBUTE = 258,
|
||||
VARYING = 259,
|
||||
FLOAT16_T = 260,
|
||||
FLOAT = 261,
|
||||
FLOAT32_T = 262,
|
||||
DOUBLE = 263,
|
||||
FLOAT64_T = 264,
|
||||
CONST = 265,
|
||||
BOOL = 266,
|
||||
INT = 267,
|
||||
UINT = 268,
|
||||
INT64_T = 269,
|
||||
UINT64_T = 270,
|
||||
INT32_T = 271,
|
||||
UINT32_T = 272,
|
||||
INT16_T = 273,
|
||||
UINT16_T = 274,
|
||||
INT8_T = 275,
|
||||
UINT8_T = 276,
|
||||
BREAK = 277,
|
||||
CONTINUE = 278,
|
||||
DO = 279,
|
||||
ELSE = 280,
|
||||
FOR = 281,
|
||||
IF = 282,
|
||||
DISCARD = 283,
|
||||
RETURN = 284,
|
||||
SWITCH = 285,
|
||||
CASE = 286,
|
||||
DEFAULT = 287,
|
||||
SUBROUTINE = 288,
|
||||
DEMOTE = 289,
|
||||
BVEC2 = 290,
|
||||
BVEC3 = 291,
|
||||
BVEC4 = 292,
|
||||
IVEC2 = 293,
|
||||
IVEC3 = 294,
|
||||
IVEC4 = 295,
|
||||
UVEC2 = 296,
|
||||
UVEC3 = 297,
|
||||
UVEC4 = 298,
|
||||
I64VEC2 = 299,
|
||||
I64VEC3 = 300,
|
||||
I64VEC4 = 301,
|
||||
U64VEC2 = 302,
|
||||
U64VEC3 = 303,
|
||||
U64VEC4 = 304,
|
||||
I32VEC2 = 305,
|
||||
I32VEC3 = 306,
|
||||
I32VEC4 = 307,
|
||||
U32VEC2 = 308,
|
||||
U32VEC3 = 309,
|
||||
U32VEC4 = 310,
|
||||
I16VEC2 = 311,
|
||||
I16VEC3 = 312,
|
||||
I16VEC4 = 313,
|
||||
U16VEC2 = 314,
|
||||
U16VEC3 = 315,
|
||||
U16VEC4 = 316,
|
||||
I8VEC2 = 317,
|
||||
I8VEC3 = 318,
|
||||
I8VEC4 = 319,
|
||||
U8VEC2 = 320,
|
||||
U8VEC3 = 321,
|
||||
U8VEC4 = 322,
|
||||
VEC2 = 323,
|
||||
VEC3 = 324,
|
||||
VEC4 = 325,
|
||||
MAT2 = 326,
|
||||
MAT3 = 327,
|
||||
MAT4 = 328,
|
||||
CENTROID = 329,
|
||||
IN = 330,
|
||||
OUT = 331,
|
||||
INOUT = 332,
|
||||
UNIFORM = 333,
|
||||
PATCH = 334,
|
||||
SAMPLE = 335,
|
||||
BUFFER = 336,
|
||||
SHARED = 337,
|
||||
NONUNIFORM = 338,
|
||||
PAYLOADNV = 339,
|
||||
PAYLOADINNV = 340,
|
||||
HITATTRNV = 341,
|
||||
CALLDATANV = 342,
|
||||
CALLDATAINNV = 343,
|
||||
COHERENT = 344,
|
||||
VOLATILE = 345,
|
||||
RESTRICT = 346,
|
||||
READONLY = 347,
|
||||
WRITEONLY = 348,
|
||||
DEVICECOHERENT = 349,
|
||||
QUEUEFAMILYCOHERENT = 350,
|
||||
WORKGROUPCOHERENT = 351,
|
||||
SUBGROUPCOHERENT = 352,
|
||||
NONPRIVATE = 353,
|
||||
DVEC2 = 354,
|
||||
DVEC3 = 355,
|
||||
DVEC4 = 356,
|
||||
DMAT2 = 357,
|
||||
DMAT3 = 358,
|
||||
DMAT4 = 359,
|
||||
F16VEC2 = 360,
|
||||
F16VEC3 = 361,
|
||||
F16VEC4 = 362,
|
||||
F16MAT2 = 363,
|
||||
F16MAT3 = 364,
|
||||
F16MAT4 = 365,
|
||||
F32VEC2 = 366,
|
||||
F32VEC3 = 367,
|
||||
F32VEC4 = 368,
|
||||
F32MAT2 = 369,
|
||||
F32MAT3 = 370,
|
||||
F32MAT4 = 371,
|
||||
F64VEC2 = 372,
|
||||
F64VEC3 = 373,
|
||||
F64VEC4 = 374,
|
||||
F64MAT2 = 375,
|
||||
F64MAT3 = 376,
|
||||
F64MAT4 = 377,
|
||||
NOPERSPECTIVE = 378,
|
||||
FLAT = 379,
|
||||
SMOOTH = 380,
|
||||
LAYOUT = 381,
|
||||
EXPLICITINTERPAMD = 382,
|
||||
PERVERTEXNV = 383,
|
||||
PERPRIMITIVENV = 384,
|
||||
PERVIEWNV = 385,
|
||||
PERTASKNV = 386,
|
||||
MAT2X2 = 387,
|
||||
MAT2X3 = 388,
|
||||
MAT2X4 = 389,
|
||||
MAT3X2 = 390,
|
||||
MAT3X3 = 391,
|
||||
MAT3X4 = 392,
|
||||
MAT4X2 = 393,
|
||||
MAT4X3 = 394,
|
||||
MAT4X4 = 395,
|
||||
DMAT2X2 = 396,
|
||||
DMAT2X3 = 397,
|
||||
DMAT2X4 = 398,
|
||||
DMAT3X2 = 399,
|
||||
DMAT3X3 = 400,
|
||||
DMAT3X4 = 401,
|
||||
DMAT4X2 = 402,
|
||||
DMAT4X3 = 403,
|
||||
DMAT4X4 = 404,
|
||||
F16MAT2X2 = 405,
|
||||
F16MAT2X3 = 406,
|
||||
F16MAT2X4 = 407,
|
||||
F16MAT3X2 = 408,
|
||||
F16MAT3X3 = 409,
|
||||
F16MAT3X4 = 410,
|
||||
F16MAT4X2 = 411,
|
||||
F16MAT4X3 = 412,
|
||||
F16MAT4X4 = 413,
|
||||
F32MAT2X2 = 414,
|
||||
F32MAT2X3 = 415,
|
||||
F32MAT2X4 = 416,
|
||||
F32MAT3X2 = 417,
|
||||
F32MAT3X3 = 418,
|
||||
F32MAT3X4 = 419,
|
||||
F32MAT4X2 = 420,
|
||||
F32MAT4X3 = 421,
|
||||
F32MAT4X4 = 422,
|
||||
F64MAT2X2 = 423,
|
||||
F64MAT2X3 = 424,
|
||||
F64MAT2X4 = 425,
|
||||
F64MAT3X2 = 426,
|
||||
F64MAT3X3 = 427,
|
||||
F64MAT3X4 = 428,
|
||||
F64MAT4X2 = 429,
|
||||
F64MAT4X3 = 430,
|
||||
F64MAT4X4 = 431,
|
||||
ATOMIC_UINT = 432,
|
||||
ACCSTRUCTNV = 433,
|
||||
FCOOPMATNV = 434,
|
||||
SAMPLER1D = 435,
|
||||
SAMPLER2D = 436,
|
||||
SAMPLER3D = 437,
|
||||
SAMPLERCUBE = 438,
|
||||
SAMPLER1DSHADOW = 439,
|
||||
SAMPLER2DSHADOW = 440,
|
||||
SAMPLERCUBESHADOW = 441,
|
||||
SAMPLER1DARRAY = 442,
|
||||
SAMPLER2DARRAY = 443,
|
||||
SAMPLER1DARRAYSHADOW = 444,
|
||||
SAMPLER2DARRAYSHADOW = 445,
|
||||
ISAMPLER1D = 446,
|
||||
ISAMPLER2D = 447,
|
||||
ISAMPLER3D = 448,
|
||||
ISAMPLERCUBE = 449,
|
||||
ISAMPLER1DARRAY = 450,
|
||||
ISAMPLER2DARRAY = 451,
|
||||
USAMPLER1D = 452,
|
||||
USAMPLER2D = 453,
|
||||
USAMPLER3D = 454,
|
||||
USAMPLERCUBE = 455,
|
||||
USAMPLER1DARRAY = 456,
|
||||
USAMPLER2DARRAY = 457,
|
||||
SAMPLER2DRECT = 458,
|
||||
SAMPLER2DRECTSHADOW = 459,
|
||||
ISAMPLER2DRECT = 460,
|
||||
USAMPLER2DRECT = 461,
|
||||
SAMPLERBUFFER = 462,
|
||||
ISAMPLERBUFFER = 463,
|
||||
USAMPLERBUFFER = 464,
|
||||
SAMPLERCUBEARRAY = 465,
|
||||
SAMPLERCUBEARRAYSHADOW = 466,
|
||||
ISAMPLERCUBEARRAY = 467,
|
||||
USAMPLERCUBEARRAY = 468,
|
||||
SAMPLER2DMS = 469,
|
||||
ISAMPLER2DMS = 470,
|
||||
USAMPLER2DMS = 471,
|
||||
SAMPLER2DMSARRAY = 472,
|
||||
ISAMPLER2DMSARRAY = 473,
|
||||
USAMPLER2DMSARRAY = 474,
|
||||
SAMPLEREXTERNALOES = 475,
|
||||
SAMPLEREXTERNAL2DY2YEXT = 476,
|
||||
F16SAMPLER1D = 477,
|
||||
F16SAMPLER2D = 478,
|
||||
F16SAMPLER3D = 479,
|
||||
F16SAMPLER2DRECT = 480,
|
||||
F16SAMPLERCUBE = 481,
|
||||
F16SAMPLER1DARRAY = 482,
|
||||
F16SAMPLER2DARRAY = 483,
|
||||
F16SAMPLERCUBEARRAY = 484,
|
||||
F16SAMPLERBUFFER = 485,
|
||||
F16SAMPLER2DMS = 486,
|
||||
F16SAMPLER2DMSARRAY = 487,
|
||||
F16SAMPLER1DSHADOW = 488,
|
||||
F16SAMPLER2DSHADOW = 489,
|
||||
F16SAMPLER1DARRAYSHADOW = 490,
|
||||
F16SAMPLER2DARRAYSHADOW = 491,
|
||||
F16SAMPLER2DRECTSHADOW = 492,
|
||||
F16SAMPLERCUBESHADOW = 493,
|
||||
F16SAMPLERCUBEARRAYSHADOW = 494,
|
||||
SAMPLER = 495,
|
||||
SAMPLERSHADOW = 496,
|
||||
TEXTURE1D = 497,
|
||||
TEXTURE2D = 498,
|
||||
TEXTURE3D = 499,
|
||||
TEXTURECUBE = 500,
|
||||
TEXTURE1DARRAY = 501,
|
||||
TEXTURE2DARRAY = 502,
|
||||
ITEXTURE1D = 503,
|
||||
ITEXTURE2D = 504,
|
||||
ITEXTURE3D = 505,
|
||||
ITEXTURECUBE = 506,
|
||||
ITEXTURE1DARRAY = 507,
|
||||
ITEXTURE2DARRAY = 508,
|
||||
UTEXTURE1D = 509,
|
||||
UTEXTURE2D = 510,
|
||||
UTEXTURE3D = 511,
|
||||
UTEXTURECUBE = 512,
|
||||
UTEXTURE1DARRAY = 513,
|
||||
UTEXTURE2DARRAY = 514,
|
||||
TEXTURE2DRECT = 515,
|
||||
ITEXTURE2DRECT = 516,
|
||||
UTEXTURE2DRECT = 517,
|
||||
TEXTUREBUFFER = 518,
|
||||
ITEXTUREBUFFER = 519,
|
||||
UTEXTUREBUFFER = 520,
|
||||
TEXTURECUBEARRAY = 521,
|
||||
ITEXTURECUBEARRAY = 522,
|
||||
UTEXTURECUBEARRAY = 523,
|
||||
TEXTURE2DMS = 524,
|
||||
ITEXTURE2DMS = 525,
|
||||
UTEXTURE2DMS = 526,
|
||||
TEXTURE2DMSARRAY = 527,
|
||||
ITEXTURE2DMSARRAY = 528,
|
||||
UTEXTURE2DMSARRAY = 529,
|
||||
F16TEXTURE1D = 530,
|
||||
F16TEXTURE2D = 531,
|
||||
F16TEXTURE3D = 532,
|
||||
F16TEXTURE2DRECT = 533,
|
||||
F16TEXTURECUBE = 534,
|
||||
F16TEXTURE1DARRAY = 535,
|
||||
F16TEXTURE2DARRAY = 536,
|
||||
F16TEXTURECUBEARRAY = 537,
|
||||
F16TEXTUREBUFFER = 538,
|
||||
F16TEXTURE2DMS = 539,
|
||||
F16TEXTURE2DMSARRAY = 540,
|
||||
SUBPASSINPUT = 541,
|
||||
SUBPASSINPUTMS = 542,
|
||||
ISUBPASSINPUT = 543,
|
||||
ISUBPASSINPUTMS = 544,
|
||||
USUBPASSINPUT = 545,
|
||||
USUBPASSINPUTMS = 546,
|
||||
F16SUBPASSINPUT = 547,
|
||||
F16SUBPASSINPUTMS = 548,
|
||||
IMAGE1D = 549,
|
||||
IIMAGE1D = 550,
|
||||
UIMAGE1D = 551,
|
||||
IMAGE2D = 552,
|
||||
IIMAGE2D = 553,
|
||||
UIMAGE2D = 554,
|
||||
IMAGE3D = 555,
|
||||
IIMAGE3D = 556,
|
||||
UIMAGE3D = 557,
|
||||
IMAGE2DRECT = 558,
|
||||
IIMAGE2DRECT = 559,
|
||||
UIMAGE2DRECT = 560,
|
||||
IMAGECUBE = 561,
|
||||
IIMAGECUBE = 562,
|
||||
UIMAGECUBE = 563,
|
||||
IMAGEBUFFER = 564,
|
||||
IIMAGEBUFFER = 565,
|
||||
UIMAGEBUFFER = 566,
|
||||
IMAGE1DARRAY = 567,
|
||||
IIMAGE1DARRAY = 568,
|
||||
UIMAGE1DARRAY = 569,
|
||||
IMAGE2DARRAY = 570,
|
||||
IIMAGE2DARRAY = 571,
|
||||
UIMAGE2DARRAY = 572,
|
||||
IMAGECUBEARRAY = 573,
|
||||
IIMAGECUBEARRAY = 574,
|
||||
UIMAGECUBEARRAY = 575,
|
||||
IMAGE2DMS = 576,
|
||||
IIMAGE2DMS = 577,
|
||||
UIMAGE2DMS = 578,
|
||||
IMAGE2DMSARRAY = 579,
|
||||
IIMAGE2DMSARRAY = 580,
|
||||
UIMAGE2DMSARRAY = 581,
|
||||
F16IMAGE1D = 582,
|
||||
F16IMAGE2D = 583,
|
||||
F16IMAGE3D = 584,
|
||||
F16IMAGE2DRECT = 585,
|
||||
F16IMAGECUBE = 586,
|
||||
F16IMAGE1DARRAY = 587,
|
||||
F16IMAGE2DARRAY = 588,
|
||||
F16IMAGECUBEARRAY = 589,
|
||||
F16IMAGEBUFFER = 590,
|
||||
F16IMAGE2DMS = 591,
|
||||
F16IMAGE2DMSARRAY = 592,
|
||||
STRUCT = 593,
|
||||
VOID = 594,
|
||||
WHILE = 595,
|
||||
IDENTIFIER = 596,
|
||||
TYPE_NAME = 597,
|
||||
FLOATCONSTANT = 598,
|
||||
DOUBLECONSTANT = 599,
|
||||
INT16CONSTANT = 600,
|
||||
UINT16CONSTANT = 601,
|
||||
INT32CONSTANT = 602,
|
||||
UINT32CONSTANT = 603,
|
||||
INTCONSTANT = 604,
|
||||
UINTCONSTANT = 605,
|
||||
INT64CONSTANT = 606,
|
||||
UINT64CONSTANT = 607,
|
||||
BOOLCONSTANT = 608,
|
||||
FLOAT16CONSTANT = 609,
|
||||
LEFT_OP = 610,
|
||||
RIGHT_OP = 611,
|
||||
INC_OP = 612,
|
||||
DEC_OP = 613,
|
||||
LE_OP = 614,
|
||||
GE_OP = 615,
|
||||
EQ_OP = 616,
|
||||
NE_OP = 617,
|
||||
AND_OP = 618,
|
||||
OR_OP = 619,
|
||||
XOR_OP = 620,
|
||||
MUL_ASSIGN = 621,
|
||||
DIV_ASSIGN = 622,
|
||||
ADD_ASSIGN = 623,
|
||||
MOD_ASSIGN = 624,
|
||||
LEFT_ASSIGN = 625,
|
||||
RIGHT_ASSIGN = 626,
|
||||
AND_ASSIGN = 627,
|
||||
XOR_ASSIGN = 628,
|
||||
OR_ASSIGN = 629,
|
||||
SUB_ASSIGN = 630,
|
||||
LEFT_PAREN = 631,
|
||||
RIGHT_PAREN = 632,
|
||||
LEFT_BRACKET = 633,
|
||||
RIGHT_BRACKET = 634,
|
||||
LEFT_BRACE = 635,
|
||||
RIGHT_BRACE = 636,
|
||||
DOT = 637,
|
||||
COMMA = 638,
|
||||
COLON = 639,
|
||||
EQUAL = 640,
|
||||
SEMICOLON = 641,
|
||||
BANG = 642,
|
||||
DASH = 643,
|
||||
TILDE = 644,
|
||||
PLUS = 645,
|
||||
STAR = 646,
|
||||
SLASH = 647,
|
||||
PERCENT = 648,
|
||||
LEFT_ANGLE = 649,
|
||||
RIGHT_ANGLE = 650,
|
||||
VERTICAL_BAR = 651,
|
||||
CARET = 652,
|
||||
AMPERSAND = 653,
|
||||
QUESTION = 654,
|
||||
INVARIANT = 655,
|
||||
PRECISE = 656,
|
||||
HIGH_PRECISION = 657,
|
||||
MEDIUM_PRECISION = 658,
|
||||
LOW_PRECISION = 659,
|
||||
PRECISION = 660,
|
||||
PACKED = 661,
|
||||
RESOURCE = 662,
|
||||
SUPERP = 663
|
||||
CONST = 258,
|
||||
BOOL = 259,
|
||||
INT = 260,
|
||||
UINT = 261,
|
||||
FLOAT = 262,
|
||||
BVEC2 = 263,
|
||||
BVEC3 = 264,
|
||||
BVEC4 = 265,
|
||||
IVEC2 = 266,
|
||||
IVEC3 = 267,
|
||||
IVEC4 = 268,
|
||||
UVEC2 = 269,
|
||||
UVEC3 = 270,
|
||||
UVEC4 = 271,
|
||||
VEC2 = 272,
|
||||
VEC3 = 273,
|
||||
VEC4 = 274,
|
||||
MAT2 = 275,
|
||||
MAT3 = 276,
|
||||
MAT4 = 277,
|
||||
MAT2X2 = 278,
|
||||
MAT2X3 = 279,
|
||||
MAT2X4 = 280,
|
||||
MAT3X2 = 281,
|
||||
MAT3X3 = 282,
|
||||
MAT3X4 = 283,
|
||||
MAT4X2 = 284,
|
||||
MAT4X3 = 285,
|
||||
MAT4X4 = 286,
|
||||
SAMPLER2D = 287,
|
||||
SAMPLER3D = 288,
|
||||
SAMPLERCUBE = 289,
|
||||
SAMPLER2DSHADOW = 290,
|
||||
SAMPLERCUBESHADOW = 291,
|
||||
SAMPLER2DARRAY = 292,
|
||||
SAMPLER2DARRAYSHADOW = 293,
|
||||
ISAMPLER2D = 294,
|
||||
ISAMPLER3D = 295,
|
||||
ISAMPLERCUBE = 296,
|
||||
ISAMPLER2DARRAY = 297,
|
||||
USAMPLER2D = 298,
|
||||
USAMPLER3D = 299,
|
||||
USAMPLERCUBE = 300,
|
||||
USAMPLER2DARRAY = 301,
|
||||
SAMPLERCUBEARRAY = 302,
|
||||
SAMPLERCUBEARRAYSHADOW = 303,
|
||||
ISAMPLERCUBEARRAY = 304,
|
||||
USAMPLERCUBEARRAY = 305,
|
||||
ATTRIBUTE = 306,
|
||||
VARYING = 307,
|
||||
FLOAT16_T = 308,
|
||||
FLOAT32_T = 309,
|
||||
DOUBLE = 310,
|
||||
FLOAT64_T = 311,
|
||||
INT64_T = 312,
|
||||
UINT64_T = 313,
|
||||
INT32_T = 314,
|
||||
UINT32_T = 315,
|
||||
INT16_T = 316,
|
||||
UINT16_T = 317,
|
||||
INT8_T = 318,
|
||||
UINT8_T = 319,
|
||||
I64VEC2 = 320,
|
||||
I64VEC3 = 321,
|
||||
I64VEC4 = 322,
|
||||
U64VEC2 = 323,
|
||||
U64VEC3 = 324,
|
||||
U64VEC4 = 325,
|
||||
I32VEC2 = 326,
|
||||
I32VEC3 = 327,
|
||||
I32VEC4 = 328,
|
||||
U32VEC2 = 329,
|
||||
U32VEC3 = 330,
|
||||
U32VEC4 = 331,
|
||||
I16VEC2 = 332,
|
||||
I16VEC3 = 333,
|
||||
I16VEC4 = 334,
|
||||
U16VEC2 = 335,
|
||||
U16VEC3 = 336,
|
||||
U16VEC4 = 337,
|
||||
I8VEC2 = 338,
|
||||
I8VEC3 = 339,
|
||||
I8VEC4 = 340,
|
||||
U8VEC2 = 341,
|
||||
U8VEC3 = 342,
|
||||
U8VEC4 = 343,
|
||||
DVEC2 = 344,
|
||||
DVEC3 = 345,
|
||||
DVEC4 = 346,
|
||||
DMAT2 = 347,
|
||||
DMAT3 = 348,
|
||||
DMAT4 = 349,
|
||||
F16VEC2 = 350,
|
||||
F16VEC3 = 351,
|
||||
F16VEC4 = 352,
|
||||
F16MAT2 = 353,
|
||||
F16MAT3 = 354,
|
||||
F16MAT4 = 355,
|
||||
F32VEC2 = 356,
|
||||
F32VEC3 = 357,
|
||||
F32VEC4 = 358,
|
||||
F32MAT2 = 359,
|
||||
F32MAT3 = 360,
|
||||
F32MAT4 = 361,
|
||||
F64VEC2 = 362,
|
||||
F64VEC3 = 363,
|
||||
F64VEC4 = 364,
|
||||
F64MAT2 = 365,
|
||||
F64MAT3 = 366,
|
||||
F64MAT4 = 367,
|
||||
DMAT2X2 = 368,
|
||||
DMAT2X3 = 369,
|
||||
DMAT2X4 = 370,
|
||||
DMAT3X2 = 371,
|
||||
DMAT3X3 = 372,
|
||||
DMAT3X4 = 373,
|
||||
DMAT4X2 = 374,
|
||||
DMAT4X3 = 375,
|
||||
DMAT4X4 = 376,
|
||||
F16MAT2X2 = 377,
|
||||
F16MAT2X3 = 378,
|
||||
F16MAT2X4 = 379,
|
||||
F16MAT3X2 = 380,
|
||||
F16MAT3X3 = 381,
|
||||
F16MAT3X4 = 382,
|
||||
F16MAT4X2 = 383,
|
||||
F16MAT4X3 = 384,
|
||||
F16MAT4X4 = 385,
|
||||
F32MAT2X2 = 386,
|
||||
F32MAT2X3 = 387,
|
||||
F32MAT2X4 = 388,
|
||||
F32MAT3X2 = 389,
|
||||
F32MAT3X3 = 390,
|
||||
F32MAT3X4 = 391,
|
||||
F32MAT4X2 = 392,
|
||||
F32MAT4X3 = 393,
|
||||
F32MAT4X4 = 394,
|
||||
F64MAT2X2 = 395,
|
||||
F64MAT2X3 = 396,
|
||||
F64MAT2X4 = 397,
|
||||
F64MAT3X2 = 398,
|
||||
F64MAT3X3 = 399,
|
||||
F64MAT3X4 = 400,
|
||||
F64MAT4X2 = 401,
|
||||
F64MAT4X3 = 402,
|
||||
F64MAT4X4 = 403,
|
||||
ATOMIC_UINT = 404,
|
||||
ACCSTRUCTNV = 405,
|
||||
FCOOPMATNV = 406,
|
||||
SAMPLER1D = 407,
|
||||
SAMPLER1DARRAY = 408,
|
||||
SAMPLER1DARRAYSHADOW = 409,
|
||||
ISAMPLER1D = 410,
|
||||
SAMPLER1DSHADOW = 411,
|
||||
SAMPLER2DRECT = 412,
|
||||
SAMPLER2DRECTSHADOW = 413,
|
||||
ISAMPLER2DRECT = 414,
|
||||
USAMPLER2DRECT = 415,
|
||||
SAMPLERBUFFER = 416,
|
||||
ISAMPLERBUFFER = 417,
|
||||
USAMPLERBUFFER = 418,
|
||||
SAMPLER2DMS = 419,
|
||||
ISAMPLER2DMS = 420,
|
||||
USAMPLER2DMS = 421,
|
||||
SAMPLER2DMSARRAY = 422,
|
||||
ISAMPLER2DMSARRAY = 423,
|
||||
USAMPLER2DMSARRAY = 424,
|
||||
SAMPLEREXTERNALOES = 425,
|
||||
SAMPLEREXTERNAL2DY2YEXT = 426,
|
||||
ISAMPLER1DARRAY = 427,
|
||||
USAMPLER1D = 428,
|
||||
USAMPLER1DARRAY = 429,
|
||||
F16SAMPLER1D = 430,
|
||||
F16SAMPLER2D = 431,
|
||||
F16SAMPLER3D = 432,
|
||||
F16SAMPLER2DRECT = 433,
|
||||
F16SAMPLERCUBE = 434,
|
||||
F16SAMPLER1DARRAY = 435,
|
||||
F16SAMPLER2DARRAY = 436,
|
||||
F16SAMPLERCUBEARRAY = 437,
|
||||
F16SAMPLERBUFFER = 438,
|
||||
F16SAMPLER2DMS = 439,
|
||||
F16SAMPLER2DMSARRAY = 440,
|
||||
F16SAMPLER1DSHADOW = 441,
|
||||
F16SAMPLER2DSHADOW = 442,
|
||||
F16SAMPLER1DARRAYSHADOW = 443,
|
||||
F16SAMPLER2DARRAYSHADOW = 444,
|
||||
F16SAMPLER2DRECTSHADOW = 445,
|
||||
F16SAMPLERCUBESHADOW = 446,
|
||||
F16SAMPLERCUBEARRAYSHADOW = 447,
|
||||
IMAGE1D = 448,
|
||||
IIMAGE1D = 449,
|
||||
UIMAGE1D = 450,
|
||||
IMAGE2D = 451,
|
||||
IIMAGE2D = 452,
|
||||
UIMAGE2D = 453,
|
||||
IMAGE3D = 454,
|
||||
IIMAGE3D = 455,
|
||||
UIMAGE3D = 456,
|
||||
IMAGE2DRECT = 457,
|
||||
IIMAGE2DRECT = 458,
|
||||
UIMAGE2DRECT = 459,
|
||||
IMAGECUBE = 460,
|
||||
IIMAGECUBE = 461,
|
||||
UIMAGECUBE = 462,
|
||||
IMAGEBUFFER = 463,
|
||||
IIMAGEBUFFER = 464,
|
||||
UIMAGEBUFFER = 465,
|
||||
IMAGE1DARRAY = 466,
|
||||
IIMAGE1DARRAY = 467,
|
||||
UIMAGE1DARRAY = 468,
|
||||
IMAGE2DARRAY = 469,
|
||||
IIMAGE2DARRAY = 470,
|
||||
UIMAGE2DARRAY = 471,
|
||||
IMAGECUBEARRAY = 472,
|
||||
IIMAGECUBEARRAY = 473,
|
||||
UIMAGECUBEARRAY = 474,
|
||||
IMAGE2DMS = 475,
|
||||
IIMAGE2DMS = 476,
|
||||
UIMAGE2DMS = 477,
|
||||
IMAGE2DMSARRAY = 478,
|
||||
IIMAGE2DMSARRAY = 479,
|
||||
UIMAGE2DMSARRAY = 480,
|
||||
F16IMAGE1D = 481,
|
||||
F16IMAGE2D = 482,
|
||||
F16IMAGE3D = 483,
|
||||
F16IMAGE2DRECT = 484,
|
||||
F16IMAGECUBE = 485,
|
||||
F16IMAGE1DARRAY = 486,
|
||||
F16IMAGE2DARRAY = 487,
|
||||
F16IMAGECUBEARRAY = 488,
|
||||
F16IMAGEBUFFER = 489,
|
||||
F16IMAGE2DMS = 490,
|
||||
F16IMAGE2DMSARRAY = 491,
|
||||
SAMPLER = 492,
|
||||
SAMPLERSHADOW = 493,
|
||||
TEXTURE1D = 494,
|
||||
TEXTURE2D = 495,
|
||||
TEXTURE3D = 496,
|
||||
TEXTURECUBE = 497,
|
||||
TEXTURE1DARRAY = 498,
|
||||
TEXTURE2DARRAY = 499,
|
||||
ITEXTURE1D = 500,
|
||||
ITEXTURE2D = 501,
|
||||
ITEXTURE3D = 502,
|
||||
ITEXTURECUBE = 503,
|
||||
ITEXTURE1DARRAY = 504,
|
||||
ITEXTURE2DARRAY = 505,
|
||||
UTEXTURE1D = 506,
|
||||
UTEXTURE2D = 507,
|
||||
UTEXTURE3D = 508,
|
||||
UTEXTURECUBE = 509,
|
||||
UTEXTURE1DARRAY = 510,
|
||||
UTEXTURE2DARRAY = 511,
|
||||
TEXTURE2DRECT = 512,
|
||||
ITEXTURE2DRECT = 513,
|
||||
UTEXTURE2DRECT = 514,
|
||||
TEXTUREBUFFER = 515,
|
||||
ITEXTUREBUFFER = 516,
|
||||
UTEXTUREBUFFER = 517,
|
||||
TEXTURECUBEARRAY = 518,
|
||||
ITEXTURECUBEARRAY = 519,
|
||||
UTEXTURECUBEARRAY = 520,
|
||||
TEXTURE2DMS = 521,
|
||||
ITEXTURE2DMS = 522,
|
||||
UTEXTURE2DMS = 523,
|
||||
TEXTURE2DMSARRAY = 524,
|
||||
ITEXTURE2DMSARRAY = 525,
|
||||
UTEXTURE2DMSARRAY = 526,
|
||||
F16TEXTURE1D = 527,
|
||||
F16TEXTURE2D = 528,
|
||||
F16TEXTURE3D = 529,
|
||||
F16TEXTURE2DRECT = 530,
|
||||
F16TEXTURECUBE = 531,
|
||||
F16TEXTURE1DARRAY = 532,
|
||||
F16TEXTURE2DARRAY = 533,
|
||||
F16TEXTURECUBEARRAY = 534,
|
||||
F16TEXTUREBUFFER = 535,
|
||||
F16TEXTURE2DMS = 536,
|
||||
F16TEXTURE2DMSARRAY = 537,
|
||||
SUBPASSINPUT = 538,
|
||||
SUBPASSINPUTMS = 539,
|
||||
ISUBPASSINPUT = 540,
|
||||
ISUBPASSINPUTMS = 541,
|
||||
USUBPASSINPUT = 542,
|
||||
USUBPASSINPUTMS = 543,
|
||||
F16SUBPASSINPUT = 544,
|
||||
F16SUBPASSINPUTMS = 545,
|
||||
LEFT_OP = 546,
|
||||
RIGHT_OP = 547,
|
||||
INC_OP = 548,
|
||||
DEC_OP = 549,
|
||||
LE_OP = 550,
|
||||
GE_OP = 551,
|
||||
EQ_OP = 552,
|
||||
NE_OP = 553,
|
||||
AND_OP = 554,
|
||||
OR_OP = 555,
|
||||
XOR_OP = 556,
|
||||
MUL_ASSIGN = 557,
|
||||
DIV_ASSIGN = 558,
|
||||
ADD_ASSIGN = 559,
|
||||
MOD_ASSIGN = 560,
|
||||
LEFT_ASSIGN = 561,
|
||||
RIGHT_ASSIGN = 562,
|
||||
AND_ASSIGN = 563,
|
||||
XOR_ASSIGN = 564,
|
||||
OR_ASSIGN = 565,
|
||||
SUB_ASSIGN = 566,
|
||||
LEFT_PAREN = 567,
|
||||
RIGHT_PAREN = 568,
|
||||
LEFT_BRACKET = 569,
|
||||
RIGHT_BRACKET = 570,
|
||||
LEFT_BRACE = 571,
|
||||
RIGHT_BRACE = 572,
|
||||
DOT = 573,
|
||||
COMMA = 574,
|
||||
COLON = 575,
|
||||
EQUAL = 576,
|
||||
SEMICOLON = 577,
|
||||
BANG = 578,
|
||||
DASH = 579,
|
||||
TILDE = 580,
|
||||
PLUS = 581,
|
||||
STAR = 582,
|
||||
SLASH = 583,
|
||||
PERCENT = 584,
|
||||
LEFT_ANGLE = 585,
|
||||
RIGHT_ANGLE = 586,
|
||||
VERTICAL_BAR = 587,
|
||||
CARET = 588,
|
||||
AMPERSAND = 589,
|
||||
QUESTION = 590,
|
||||
INVARIANT = 591,
|
||||
HIGH_PRECISION = 592,
|
||||
MEDIUM_PRECISION = 593,
|
||||
LOW_PRECISION = 594,
|
||||
PRECISION = 595,
|
||||
PACKED = 596,
|
||||
RESOURCE = 597,
|
||||
SUPERP = 598,
|
||||
FLOATCONSTANT = 599,
|
||||
INTCONSTANT = 600,
|
||||
UINTCONSTANT = 601,
|
||||
BOOLCONSTANT = 602,
|
||||
IDENTIFIER = 603,
|
||||
TYPE_NAME = 604,
|
||||
CENTROID = 605,
|
||||
IN = 606,
|
||||
OUT = 607,
|
||||
INOUT = 608,
|
||||
STRUCT = 609,
|
||||
VOID = 610,
|
||||
WHILE = 611,
|
||||
BREAK = 612,
|
||||
CONTINUE = 613,
|
||||
DO = 614,
|
||||
ELSE = 615,
|
||||
FOR = 616,
|
||||
IF = 617,
|
||||
DISCARD = 618,
|
||||
RETURN = 619,
|
||||
SWITCH = 620,
|
||||
CASE = 621,
|
||||
DEFAULT = 622,
|
||||
UNIFORM = 623,
|
||||
SHARED = 624,
|
||||
FLAT = 625,
|
||||
SMOOTH = 626,
|
||||
LAYOUT = 627,
|
||||
DOUBLECONSTANT = 628,
|
||||
INT16CONSTANT = 629,
|
||||
UINT16CONSTANT = 630,
|
||||
FLOAT16CONSTANT = 631,
|
||||
INT32CONSTANT = 632,
|
||||
UINT32CONSTANT = 633,
|
||||
INT64CONSTANT = 634,
|
||||
UINT64CONSTANT = 635,
|
||||
SUBROUTINE = 636,
|
||||
DEMOTE = 637,
|
||||
PAYLOADNV = 638,
|
||||
PAYLOADINNV = 639,
|
||||
HITATTRNV = 640,
|
||||
CALLDATANV = 641,
|
||||
CALLDATAINNV = 642,
|
||||
PATCH = 643,
|
||||
SAMPLE = 644,
|
||||
BUFFER = 645,
|
||||
NONUNIFORM = 646,
|
||||
COHERENT = 647,
|
||||
VOLATILE = 648,
|
||||
RESTRICT = 649,
|
||||
READONLY = 650,
|
||||
WRITEONLY = 651,
|
||||
DEVICECOHERENT = 652,
|
||||
QUEUEFAMILYCOHERENT = 653,
|
||||
WORKGROUPCOHERENT = 654,
|
||||
SUBGROUPCOHERENT = 655,
|
||||
NONPRIVATE = 656,
|
||||
NOPERSPECTIVE = 657,
|
||||
EXPLICITINTERPAMD = 658,
|
||||
PERVERTEXNV = 659,
|
||||
PERPRIMITIVENV = 660,
|
||||
PERVIEWNV = 661,
|
||||
PERTASKNV = 662,
|
||||
PRECISE = 663
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -459,7 +459,7 @@ extern int yydebug;
|
|||
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 71 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
||||
#line 96 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
||||
|
||||
struct {
|
||||
glslang::TSourceLoc loc;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@
|
|||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#include "localintermediate.h"
|
||||
#include "../Include/InfoSink.h"
|
||||
|
||||
|
|
@ -174,7 +176,7 @@ bool TOutputTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node)
|
|||
case EOpIndexIndirect: out.debug << "indirect index"; break;
|
||||
case EOpIndexDirectStruct:
|
||||
{
|
||||
bool reference = node->getLeft()->getType().getBasicType() == EbtReference;
|
||||
bool reference = node->getLeft()->getType().isReference();
|
||||
const TTypeList *members = reference ? node->getLeft()->getType().getReferentType()->getStruct() : node->getLeft()->getType().getStruct();
|
||||
out.debug << (*members)[node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst()].type->getFieldName();
|
||||
out.debug << ": direct index for structure"; break;
|
||||
|
|
@ -615,7 +617,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break;
|
||||
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
||||
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
||||
case EOpSubgroupPartitionedMul: out.debug << "subgroupPartitionedMulNV"; break;
|
||||
|
|
@ -638,7 +639,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break;
|
||||
#endif
|
||||
|
||||
case EOpClip: out.debug << "clip"; break;
|
||||
case EOpIsFinite: out.debug << "isfinite"; break;
|
||||
|
|
@ -648,7 +648,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
|
||||
case EOpSparseTexelsResident: out.debug << "sparseTexelsResident"; break;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpMinInvocations: out.debug << "minInvocations"; break;
|
||||
case EOpMaxInvocations: out.debug << "maxInvocations"; break;
|
||||
case EOpAddInvocations: out.debug << "addInvocations"; break;
|
||||
|
|
@ -677,7 +676,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
|
||||
case EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break;
|
||||
case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break;
|
||||
#endif
|
||||
|
||||
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
||||
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
||||
|
|
@ -863,7 +861,6 @@ 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;
|
||||
|
|
@ -871,9 +868,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
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;
|
||||
|
|
@ -910,10 +905,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpImageAtomicCompSwap: out.debug << "imageAtomicCompSwap"; break;
|
||||
case EOpImageAtomicLoad: out.debug << "imageAtomicLoad"; break;
|
||||
case EOpImageAtomicStore: out.debug << "imageAtomicStore"; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpImageLoadLod: out.debug << "imageLoadLod"; break;
|
||||
case EOpImageStoreLod: out.debug << "imageStoreLod"; break;
|
||||
#endif
|
||||
|
||||
case EOpTextureQuerySize: out.debug << "textureSize"; break;
|
||||
case EOpTextureQueryLod: out.debug << "textureQueryLod"; break;
|
||||
|
|
@ -940,11 +933,9 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpTextureOffsetClamp: out.debug << "textureOffsetClamp"; break;
|
||||
case EOpTextureGradClamp: out.debug << "textureGradClamp"; break;
|
||||
case EOpTextureGradOffsetClamp: out.debug << "textureGradOffsetClamp"; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpTextureGatherLod: out.debug << "textureGatherLod"; break;
|
||||
case EOpTextureGatherLodOffset: out.debug << "textureGatherLodOffset"; break;
|
||||
case EOpTextureGatherLodOffsets: out.debug << "textureGatherLodOffsets"; break;
|
||||
#endif
|
||||
|
||||
case EOpSparseTexture: out.debug << "sparseTexture"; break;
|
||||
case EOpSparseTextureOffset: out.debug << "sparseTextureOffset"; break;
|
||||
|
|
@ -962,19 +953,15 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSparseTextureOffsetClamp: out.debug << "sparseTextureOffsetClamp"; break;
|
||||
case EOpSparseTextureGradClamp: out.debug << "sparseTextureGradClamp"; break;
|
||||
case EOpSparseTextureGradOffsetClamp: out.debug << "sparseTextureGradOffsetClam"; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpSparseTextureGatherLod: out.debug << "sparseTextureGatherLod"; break;
|
||||
case EOpSparseTextureGatherLodOffset: out.debug << "sparseTextureGatherLodOffset"; break;
|
||||
case EOpSparseTextureGatherLodOffsets: out.debug << "sparseTextureGatherLodOffsets"; break;
|
||||
case EOpSparseImageLoadLod: out.debug << "sparseImageLoadLod"; break;
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpImageSampleFootprintNV: out.debug << "imageSampleFootprintNV"; break;
|
||||
case EOpImageSampleFootprintClampNV: out.debug << "imageSampleFootprintClampNV"; break;
|
||||
case EOpImageSampleFootprintLodNV: out.debug << "imageSampleFootprintLodNV"; break;
|
||||
case EOpImageSampleFootprintGradNV: out.debug << "imageSampleFootprintGradNV"; break;
|
||||
case EOpImageSampleFootprintGradClampNV: out.debug << "mageSampleFootprintGradClampNV"; break;
|
||||
#endif
|
||||
case EOpAddCarry: out.debug << "addCarry"; break;
|
||||
case EOpSubBorrow: out.debug << "subBorrow"; break;
|
||||
case EOpUMulExtended: out.debug << "uMulExtended"; break;
|
||||
|
|
@ -988,9 +975,7 @@ 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;
|
||||
|
|
@ -1057,7 +1042,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break;
|
||||
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
||||
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
||||
case EOpSubgroupPartitionedMul: out.debug << "subgroupPartitionedMulNV"; break;
|
||||
|
|
@ -1080,19 +1064,16 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break;
|
||||
#endif
|
||||
|
||||
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
||||
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpTraceNV: out.debug << "traceNV"; break;
|
||||
case EOpReportIntersectionNV: out.debug << "reportIntersectionNV"; break;
|
||||
case EOpIgnoreIntersectionNV: out.debug << "ignoreIntersectionNV"; break;
|
||||
case EOpTerminateRayNV: out.debug << "terminateRayNV"; break;
|
||||
case EOpExecuteCallableNV: out.debug << "executeCallableNV"; break;
|
||||
case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break;
|
||||
#endif
|
||||
|
||||
case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break;
|
||||
case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix"; break;
|
||||
|
|
@ -1509,16 +1490,13 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
|||
infoSink.debug << "interlock ordering = " << TQualifier::getInterlockOrderingString(interlockOrdering) << "\n";
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangMeshNV:
|
||||
infoSink.debug << "max_vertices = " << vertices << "\n";
|
||||
infoSink.debug << "max_primitives = " << primitives << "\n";
|
||||
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
|
||||
// Fall through
|
||||
|
||||
case EShLangTaskNV:
|
||||
// Fall through
|
||||
#endif
|
||||
case EShLangCompute:
|
||||
infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n";
|
||||
{
|
||||
|
|
@ -1547,3 +1525,5 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
|||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // not GLSLANG_WEB
|
||||
|
|
@ -33,6 +33,8 @@
|
|||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#include "../Include/Common.h"
|
||||
#include "../Include/InfoSink.h"
|
||||
|
||||
|
|
@ -75,7 +77,7 @@ public:
|
|||
target = &inputList;
|
||||
else if (base->getQualifier().storage == EvqVaryingOut)
|
||||
target = &outputList;
|
||||
else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().layoutPushConstant)
|
||||
else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().isPushConstant())
|
||||
target = &uniformList;
|
||||
if (target) {
|
||||
TVarEntryInfo ent = {base->getId(), base, ! traverseAll};
|
||||
|
|
@ -355,7 +357,7 @@ struct TSymbolValidater
|
|||
}
|
||||
return;
|
||||
}
|
||||
} else if (base->getQualifier().isUniformOrBuffer() && ! base->getQualifier().layoutPushConstant) {
|
||||
} else if (base->getQualifier().isUniformOrBuffer() && ! base->getQualifier().isPushConstant()) {
|
||||
// validate uniform type;
|
||||
for (int i = 0; i < EShLangCount; i++) {
|
||||
if (i != currentStage && outVarMaps[i] != nullptr) {
|
||||
|
|
@ -475,7 +477,7 @@ int TDefaultIoResolverBase::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
|
|||
}
|
||||
// no locations added if already present, a built-in variable, a block, or an opaque
|
||||
if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock ||
|
||||
type.getBasicType() == EbtAtomicUint || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) {
|
||||
type.isAtomic() || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) {
|
||||
return ent.newLocation = -1;
|
||||
}
|
||||
// no locations on blocks of built-in variables
|
||||
|
|
@ -672,7 +674,7 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
|
|||
} else {
|
||||
// no locations added if already present, a built-in variable, a block, or an opaque
|
||||
if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock ||
|
||||
type.getBasicType() == EbtAtomicUint || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) {
|
||||
type.isAtomic() || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) {
|
||||
return ent.newLocation = -1;
|
||||
}
|
||||
// no locations on blocks of built-in variables
|
||||
|
|
@ -943,6 +945,7 @@ struct TDefaultIoResolver : public TDefaultIoResolverBase {
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
/********************************************************************************
|
||||
The following IO resolver maps types in HLSL register space, as follows:
|
||||
|
||||
|
|
@ -1023,6 +1026,7 @@ struct TDefaultHlslIoResolver : public TDefaultIoResolverBase {
|
|||
return ent.newBinding = -1;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// Map I/O variables to provided offsets, and make bindings for
|
||||
// unbound but live variables.
|
||||
|
|
@ -1044,6 +1048,7 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
|
|||
return false;
|
||||
// if no resolver is provided, use the default resolver with the given shifts and auto map settings
|
||||
TDefaultIoResolver defaultResolver(intermediate);
|
||||
#ifdef ENABLE_HLSL
|
||||
TDefaultHlslIoResolver defaultHlslResolver(intermediate);
|
||||
if (resolver == nullptr) {
|
||||
// TODO: use a passed in IO mapper for this
|
||||
|
|
@ -1053,6 +1058,10 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
|
|||
resolver = &defaultResolver;
|
||||
}
|
||||
resolver->addStage(stage);
|
||||
#else
|
||||
resolver = &defaultResolver;
|
||||
#endif
|
||||
|
||||
TVarLiveMap inVarMap, outVarMap, uniformVarMap;
|
||||
TVarLiveVector inVector, outVector, uniformVector;
|
||||
TVarGatherTraverser iter_binding_all(intermediate, true, inVarMap, outVarMap, uniformVarMap);
|
||||
|
|
@ -1232,3 +1241,5 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
|
|||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#ifndef _IOMAPPER_INCLUDED
|
||||
#define _IOMAPPER_INCLUDED
|
||||
|
||||
|
|
@ -176,7 +178,7 @@ protected:
|
|||
|
||||
// Return true if this is a UAV (unordered access view) type:
|
||||
static bool isUavType(const glslang::TType& type) {
|
||||
if (type.getQualifier().readonly)
|
||||
if (type.getQualifier().isReadOnly())
|
||||
return false;
|
||||
return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) ||
|
||||
(type.getQualifier().storage == EvqBuffer);
|
||||
|
|
@ -293,3 +295,5 @@ public:
|
|||
} // end namespace glslang
|
||||
|
||||
#endif // _IOMAPPER_INCLUDED
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
|
|
|||
|
|
@ -187,12 +187,14 @@ bool TIndexTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node)
|
|||
//
|
||||
void TParseContext::constantIndexExpressionCheck(TIntermNode* index)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
TIndexTraverser it(inductiveLoopIds);
|
||||
|
||||
index->traverse(&it);
|
||||
|
||||
if (it.bad)
|
||||
error(it.badLoc, "Non-constant-index-expression", "limitations", "");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -56,8 +56,10 @@ namespace glslang {
|
|||
//
|
||||
void TIntermediate::error(TInfoSink& infoSink, const char* message)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
|
||||
#endif
|
||||
|
||||
++numErrors;
|
||||
}
|
||||
|
|
@ -65,8 +67,10 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message)
|
|||
// Link-time warning.
|
||||
void TIntermediate::warn(TInfoSink& infoSink, const char* message)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
infoSink.info.prefix(EPrefixWarning);
|
||||
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
// TODO: 4.4 offset/align: "Two blocks linked together in the same program with the same block
|
||||
|
|
@ -78,9 +82,11 @@ void TIntermediate::warn(TInfoSink& infoSink, const char* message)
|
|||
//
|
||||
void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
mergeCallGraphs(infoSink, unit);
|
||||
mergeModes(infoSink, unit);
|
||||
mergeTrees(infoSink, unit);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit)
|
||||
|
|
@ -98,6 +104,8 @@ void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit)
|
|||
callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end());
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#define MERGE_MAX(member) member = std::max(member, unit.member)
|
||||
#define MERGE_TRUE(member) if (unit.member) member = unit.member;
|
||||
|
||||
|
|
@ -106,9 +114,9 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
|||
if (language != unit.language)
|
||||
error(infoSink, "stages must match when linking into a single stage");
|
||||
|
||||
if (source == EShSourceNone)
|
||||
source = unit.source;
|
||||
if (source != unit.source)
|
||||
if (getSource() == EShSourceNone)
|
||||
setSource(unit.getSource());
|
||||
if (getSource() != unit.getSource())
|
||||
error(infoSink, "can't link compilation units from different source languages");
|
||||
|
||||
if (treeRoot == nullptr) {
|
||||
|
|
@ -116,7 +124,7 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
|||
version = unit.version;
|
||||
requestedExtensions = unit.requestedExtensions;
|
||||
} else {
|
||||
if ((profile == EEsProfile) != (unit.profile == EEsProfile))
|
||||
if ((isEsProfile()) != (unit.isEsProfile()))
|
||||
error(infoSink, "Cannot cross link ES and desktop profiles");
|
||||
else if (unit.profile == ECompatibilityProfile)
|
||||
profile = ECompatibilityProfile;
|
||||
|
|
@ -142,18 +150,13 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
|||
if (vertices == TQualifier::layoutNotSet)
|
||||
vertices = unit.vertices;
|
||||
else if (vertices != unit.vertices) {
|
||||
if (language == EShLangGeometry
|
||||
#ifdef NV_EXTENSIONS
|
||||
|| language == EShLangMeshNV
|
||||
#endif
|
||||
)
|
||||
if (language == EShLangGeometry || language == EShLangMeshNV)
|
||||
error(infoSink, "Contradictory layout max_vertices values");
|
||||
else if (language == EShLangTessControl)
|
||||
error(infoSink, "Contradictory layout vertices values");
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (primitives == TQualifier::layoutNotSet)
|
||||
primitives = unit.primitives;
|
||||
else if (primitives != unit.primitives) {
|
||||
|
|
@ -162,7 +165,6 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
|||
else
|
||||
assert(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (inputPrimitive == ElgNone)
|
||||
inputPrimitive = unit.inputPrimitive;
|
||||
|
|
@ -224,21 +226,16 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
|||
xfbBuffers[b].implicitStride = std::max(xfbBuffers[b].implicitStride, unit.xfbBuffers[b].implicitStride);
|
||||
if (unit.xfbBuffers[b].contains64BitType)
|
||||
xfbBuffers[b].contains64BitType = true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (unit.xfbBuffers[b].contains32BitType)
|
||||
xfbBuffers[b].contains32BitType = true;
|
||||
if (unit.xfbBuffers[b].contains16BitType)
|
||||
xfbBuffers[b].contains16BitType = true;
|
||||
#endif
|
||||
// TODO: 4.4 link: enhanced layouts: compare ranges
|
||||
}
|
||||
|
||||
MERGE_TRUE(multiStream);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
MERGE_TRUE(layoutOverrideCoverage);
|
||||
MERGE_TRUE(geoPassthroughEXT);
|
||||
#endif
|
||||
|
||||
for (unsigned int i = 0; i < unit.shiftBinding.size(); ++i) {
|
||||
if (unit.shiftBinding[i] > 0)
|
||||
|
|
@ -287,13 +284,8 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit)
|
|||
}
|
||||
|
||||
// Getting this far means we have two existing trees to merge...
|
||||
#ifdef NV_EXTENSIONS
|
||||
numShaderRecordNVBlocks += unit.numShaderRecordNVBlocks;
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
numTaskNVBlocks += unit.numTaskNVBlocks;
|
||||
#endif
|
||||
|
||||
// Get the top-level globals of each unit
|
||||
TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence();
|
||||
|
|
@ -315,6 +307,8 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit)
|
|||
ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Traverser that seeds an ID map with all built-ins, and tracks the
|
||||
// maximum ID used.
|
||||
// (It would be nice to put this in a function, but that causes warnings
|
||||
|
|
@ -536,7 +530,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
}
|
||||
|
||||
// Precise...
|
||||
if (! crossStage && symbol.getQualifier().noContraction != unitSymbol.getQualifier().noContraction) {
|
||||
if (! crossStage && symbol.getQualifier().isNoContraction() != unitSymbol.getQualifier().isNoContraction()) {
|
||||
error(infoSink, "Presence of precise qualifier must match:");
|
||||
writeTypeComparison = true;
|
||||
}
|
||||
|
|
@ -545,13 +539,14 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
if (symbol.getQualifier().centroid != unitSymbol.getQualifier().centroid ||
|
||||
symbol.getQualifier().smooth != unitSymbol.getQualifier().smooth ||
|
||||
symbol.getQualifier().flat != unitSymbol.getQualifier().flat ||
|
||||
symbol.getQualifier().sample != unitSymbol.getQualifier().sample ||
|
||||
symbol.getQualifier().patch != unitSymbol.getQualifier().patch ||
|
||||
symbol.getQualifier().nopersp != unitSymbol.getQualifier().nopersp) {
|
||||
symbol.getQualifier().isSample()!= unitSymbol.getQualifier().isSample() ||
|
||||
symbol.getQualifier().isPatch() != unitSymbol.getQualifier().isPatch() ||
|
||||
symbol.getQualifier().isNonPerspective() != unitSymbol.getQualifier().isNonPerspective()) {
|
||||
error(infoSink, "Interpolation and auxiliary storage qualifiers must match:");
|
||||
writeTypeComparison = true;
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Memory...
|
||||
if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent ||
|
||||
symbol.getQualifier().devicecoherent != unitSymbol.getQualifier().devicecoherent ||
|
||||
|
|
@ -566,6 +561,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
error(infoSink, "Memory qualifiers must match:");
|
||||
writeTypeComparison = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Layouts...
|
||||
// TODO: 4.4 enhanced layouts: Generalize to include offset/align: current spec
|
||||
|
|
@ -609,15 +605,12 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
return;
|
||||
|
||||
if (numEntryPoints < 1) {
|
||||
if (source == EShSourceGlsl)
|
||||
if (getSource() == EShSourceGlsl)
|
||||
error(infoSink, "Missing entry point: Each stage requires one entry point");
|
||||
else
|
||||
warn(infoSink, "Entry point not found");
|
||||
}
|
||||
|
||||
if (numPushConstants > 1)
|
||||
error(infoSink, "Only one push_constant block is allowed per stage");
|
||||
|
||||
// recursion and missing body checking
|
||||
checkCallGraphCycles(infoSink);
|
||||
checkCallGraphBodies(infoSink, keepUncalled);
|
||||
|
|
@ -625,6 +618,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
// overlap/alias/missing I/O, etc.
|
||||
inOutLocationCheck(infoSink);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
if (getNumPushConstants() > 1)
|
||||
error(infoSink, "Only one push_constant block is allowed per stage");
|
||||
|
||||
// invocations
|
||||
if (invocations == TQualifier::layoutNotSet)
|
||||
invocations = 1;
|
||||
|
|
@ -642,12 +639,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
for (size_t b = 0; b < xfbBuffers.size(); ++b) {
|
||||
if (xfbBuffers[b].contains64BitType)
|
||||
RoundToPow2(xfbBuffers[b].implicitStride, 8);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (xfbBuffers[b].contains32BitType)
|
||||
RoundToPow2(xfbBuffers[b].implicitStride, 4);
|
||||
else if (xfbBuffers[b].contains16BitType)
|
||||
RoundToPow2(xfbBuffers[b].implicitStride, 2);
|
||||
#endif
|
||||
|
||||
// "It is a compile-time or link-time error to have
|
||||
// any xfb_offset that overflows xfb_stride, whether stated on declarations before or after the xfb_stride, or
|
||||
|
|
@ -668,16 +663,11 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
error(infoSink, "xfb_stride must be multiple of 8 for buffer holding a double or 64-bit integer:");
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (xfbBuffers[b].contains32BitType && ! IsMultipleOfPow2(xfbBuffers[b].stride, 4)) {
|
||||
#else
|
||||
} else if (! IsMultipleOfPow2(xfbBuffers[b].stride, 4)) {
|
||||
#endif
|
||||
error(infoSink, "xfb_stride must be multiple of 4:");
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
|
||||
}
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// "If the buffer is capturing any
|
||||
// outputs with half-precision or 16-bit integer components, the stride must be a multiple of 2"
|
||||
else if (xfbBuffers[b].contains16BitType && ! IsMultipleOfPow2(xfbBuffers[b].stride, 2)) {
|
||||
|
|
@ -686,7 +676,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
|
||||
}
|
||||
|
||||
#endif
|
||||
// "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the
|
||||
// implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents."
|
||||
if (xfbBuffers[b].stride > (unsigned int)(4 * resources.maxTransformFeedbackInterleavedComponents)) {
|
||||
|
|
@ -704,7 +693,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
error(infoSink, "At least one shader must specify an output layout(vertices=...)");
|
||||
break;
|
||||
case EShLangTessEvaluation:
|
||||
if (source == EShSourceGlsl) {
|
||||
if (getSource() == EShSourceGlsl) {
|
||||
if (inputPrimitive == ElgNone)
|
||||
error(infoSink, "At least one shader must specify an input layout primitive");
|
||||
if (vertexSpacing == EvsNone)
|
||||
|
|
@ -730,8 +719,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
break;
|
||||
case EShLangCompute:
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangRayGenNV:
|
||||
case EShLangIntersectNV:
|
||||
case EShLangAnyHitNV:
|
||||
|
|
@ -764,8 +751,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
if (numTaskNVBlocks > 1)
|
||||
error(infoSink, "Only one taskNV interface block is allowed per shader");
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
error(infoSink, "Unknown Stage.");
|
||||
break;
|
||||
|
|
@ -787,6 +772,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
} finalLinkTraverser;
|
||||
|
||||
treeRoot->traverse(&finalLinkTraverser);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -973,7 +959,7 @@ void TIntermediate::inOutLocationCheck(TInfoSink& infoSink)
|
|||
}
|
||||
}
|
||||
|
||||
if (profile == EEsProfile) {
|
||||
if (isEsProfile()) {
|
||||
if (numFragOut > 1 && fragOutWithNoLocation)
|
||||
error(infoSink, "when more than one fragment shader output, all must have location qualifiers");
|
||||
}
|
||||
|
|
@ -1066,6 +1052,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
// So, for the case of dvec3, we need two independent ioRanges.
|
||||
|
||||
int collision = -1; // no collision
|
||||
#ifndef GLSLANG_WEB
|
||||
if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
|
||||
(qualifier.isPipeInput() || qualifier.isPipeOutput())) {
|
||||
// Dealing with dvec3 in/out split across two locations.
|
||||
|
|
@ -1092,7 +1079,9 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
if (collision < 0)
|
||||
usedIo[set].push_back(range2);
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// Not a dvec3 in/out split across two locations, generic path.
|
||||
// Need a single IO-range block.
|
||||
|
||||
|
|
@ -1109,7 +1098,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0);
|
||||
|
||||
// check for collisions, except for vertex inputs on desktop targeting OpenGL
|
||||
if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
|
||||
if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
|
||||
collision = checkLocationRange(set, range, type, typeCollision);
|
||||
|
||||
if (collision < 0)
|
||||
|
|
@ -1187,14 +1176,10 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage)
|
|||
// TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
|
||||
// TODO: are there valid cases of having an unsized array with a location? If so, running this code too early.
|
||||
TType elementType(type, 0);
|
||||
if (type.isSizedArray()
|
||||
#ifdef NV_EXTENSIONS
|
||||
&& !type.getQualifier().isPerView()
|
||||
#endif
|
||||
)
|
||||
if (type.isSizedArray() && !type.getQualifier().isPerView())
|
||||
return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage);
|
||||
else {
|
||||
#ifdef NV_EXTENSIONS
|
||||
#ifndef GLSLANG_WEB
|
||||
// unset perViewNV attributes for arrayed per-view outputs: "perviewNV vec4 v[MAX_VIEWS][3];"
|
||||
elementType.getQualifier().perViewNV = false;
|
||||
#endif
|
||||
|
|
@ -1273,6 +1258,8 @@ int TIntermediate::computeTypeUniformLocationSize(const TType& type)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
// Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
|
||||
//
|
||||
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
|
||||
|
|
@ -1285,11 +1272,7 @@ int TIntermediate::addXfbBufferOffset(const TType& type)
|
|||
TXfbBuffer& buffer = xfbBuffers[qualifier.layoutXfbBuffer];
|
||||
|
||||
// compute the range
|
||||
#ifdef AMD_EXTENSIONS
|
||||
unsigned int size = computeTypeXfbSize(type, buffer.contains64BitType, buffer.contains32BitType, buffer.contains16BitType);
|
||||
#else
|
||||
unsigned int size = computeTypeXfbSize(type, buffer.contains64BitType);
|
||||
#endif
|
||||
buffer.implicitStride = std::max(buffer.implicitStride, qualifier.layoutXfbOffset + size);
|
||||
TRange range(qualifier.layoutXfbOffset, qualifier.layoutXfbOffset + size - 1);
|
||||
|
||||
|
|
@ -1309,15 +1292,10 @@ int TIntermediate::addXfbBufferOffset(const TType& type)
|
|||
// Recursively figure out how many bytes of xfb buffer are used by the given type.
|
||||
// Return the size of type, in bytes.
|
||||
// Sets contains64BitType to true if the type contains a 64-bit data type.
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// Sets contains32BitType to true if the type contains a 32-bit data type.
|
||||
// Sets contains16BitType to true if the type contains a 16-bit data type.
|
||||
// N.B. Caller must set contains64BitType, contains32BitType, and contains16BitType to false before calling.
|
||||
unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const
|
||||
#else
|
||||
// N.B. Caller must set contains64BitType to false before calling.
|
||||
unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains64BitType) const
|
||||
#endif
|
||||
{
|
||||
// "...if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8,
|
||||
// and the space taken in the buffer will be a multiple of 8.
|
||||
|
|
@ -1330,44 +1308,32 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
|||
// TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
|
||||
assert(type.isSizedArray());
|
||||
TType elementType(type, 0);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType, contains16BitType, contains16BitType);
|
||||
#else
|
||||
return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (type.isStruct()) {
|
||||
unsigned int size = 0;
|
||||
bool structContains64BitType = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool structContains32BitType = false;
|
||||
bool structContains16BitType = false;
|
||||
#endif
|
||||
for (int member = 0; member < (int)type.getStruct()->size(); ++member) {
|
||||
TType memberType(type, member);
|
||||
// "... if applied to
|
||||
// an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8,
|
||||
// and the space taken in the buffer will be a multiple of 8."
|
||||
bool memberContains64BitType = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool memberContains32BitType = false;
|
||||
bool memberContains16BitType = false;
|
||||
int memberSize = computeTypeXfbSize(memberType, memberContains64BitType, memberContains32BitType, memberContains16BitType);
|
||||
#else
|
||||
int memberSize = computeTypeXfbSize(memberType, memberContains64BitType);
|
||||
#endif
|
||||
if (memberContains64BitType) {
|
||||
structContains64BitType = true;
|
||||
RoundToPow2(size, 8);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (memberContains32BitType) {
|
||||
structContains32BitType = true;
|
||||
RoundToPow2(size, 4);
|
||||
} else if (memberContains16BitType) {
|
||||
structContains16BitType = true;
|
||||
RoundToPow2(size, 2);
|
||||
#endif
|
||||
}
|
||||
size += memberSize;
|
||||
}
|
||||
|
|
@ -1375,14 +1341,12 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
|||
if (structContains64BitType) {
|
||||
contains64BitType = true;
|
||||
RoundToPow2(size, 8);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (structContains32BitType) {
|
||||
contains32BitType = true;
|
||||
RoundToPow2(size, 4);
|
||||
} else if (structContains16BitType) {
|
||||
contains16BitType = true;
|
||||
RoundToPow2(size, 2);
|
||||
#endif
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
|
@ -1402,7 +1366,6 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
|||
if (type.getBasicType() == EbtDouble || type.getBasicType() == EbtInt64 || type.getBasicType() == EbtUint64) {
|
||||
contains64BitType = true;
|
||||
return 8 * numComponents;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (type.getBasicType() == EbtFloat16 || type.getBasicType() == EbtInt16 || type.getBasicType() == EbtUint16) {
|
||||
contains16BitType = true;
|
||||
return 2 * numComponents;
|
||||
|
|
@ -1412,12 +1375,10 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
|||
contains32BitType = true;
|
||||
return 4 * numComponents;
|
||||
}
|
||||
#else
|
||||
} else
|
||||
return 4 * numComponents;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
const int baseAlignmentVec4Std140 = 16;
|
||||
|
||||
// Return the size and alignment of a component of the given type.
|
||||
|
|
@ -1425,6 +1386,10 @@ const int baseAlignmentVec4Std140 = 16;
|
|||
// Return value is the alignment..
|
||||
int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
|
||||
{
|
||||
#ifdef GLSLANG_WEB
|
||||
size = 4; return 4;
|
||||
#endif
|
||||
|
||||
switch (type.getBasicType()) {
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
|
|
@ -1741,7 +1706,7 @@ int TIntermediate::getBlockSize(const TType& blockType)
|
|||
|
||||
int TIntermediate::computeBufferReferenceTypeSize(const TType& type)
|
||||
{
|
||||
assert(type.getBasicType() == EbtReference);
|
||||
assert(type.isReference());
|
||||
int size = getBlockSize(*type.getReferentType());
|
||||
|
||||
int align = type.getBufferReferenceAlignment();
|
||||
|
|
|
|||
|
|
@ -149,20 +149,14 @@ struct TOffsetRange {
|
|||
|
||||
// Things that need to be tracked per xfb buffer.
|
||||
struct TXfbBuffer {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false),
|
||||
contains32BitType(false), contains16BitType(false) { }
|
||||
#else
|
||||
TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false) { }
|
||||
#endif
|
||||
std::vector<TRange> ranges; // byte offsets that have already been assigned
|
||||
unsigned int stride;
|
||||
unsigned int implicitStride;
|
||||
bool contains64BitType;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool contains32BitType;
|
||||
bool contains16BitType;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Track a set of strings describing how the module was processed.
|
||||
|
|
@ -217,7 +211,6 @@ class TSymbolTable;
|
|||
class TSymbol;
|
||||
class TVariable;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
//
|
||||
// Texture and Sampler transformation mode.
|
||||
//
|
||||
|
|
@ -226,7 +219,6 @@ enum ComputeDerivativeMode {
|
|||
LayoutDerivativeGroupQuads, // derivative_group_quadsNV
|
||||
LayoutDerivativeGroupLinear, // derivative_group_linearNV
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set of helper functions to help parse and build the tree.
|
||||
|
|
@ -234,41 +226,48 @@ enum ComputeDerivativeMode {
|
|||
class TIntermediate {
|
||||
public:
|
||||
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) :
|
||||
language(l),
|
||||
#ifdef ENABLE_HLSL
|
||||
implicitThisName("@this"), implicitCounterName("@count"),
|
||||
language(l), source(EShSourceNone), profile(p), version(v), treeRoot(0),
|
||||
source(EShSourceNone),
|
||||
#endif
|
||||
profile(p), version(v), treeRoot(0),
|
||||
numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false),
|
||||
invertY(false),
|
||||
useStorageBuffer(false),
|
||||
nanMinMaxClamp(false),
|
||||
depthReplacing(false)
|
||||
#ifndef GLSLANG_WEB
|
||||
,
|
||||
useVulkanMemoryModel(false),
|
||||
invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet),
|
||||
inputPrimitive(ElgNone), outputPrimitive(ElgNone),
|
||||
pixelCenterInteger(false), originUpperLeft(false),
|
||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false),
|
||||
postDepthCoverage(false), depthLayout(EldNone), depthReplacing(false),
|
||||
postDepthCoverage(false), depthLayout(EldNone),
|
||||
hlslFunctionality1(false),
|
||||
blendEquations(0), xfbMode(false), multiStream(false),
|
||||
#ifdef NV_EXTENSIONS
|
||||
layoutOverrideCoverage(false),
|
||||
geoPassthroughEXT(false),
|
||||
numShaderRecordNVBlocks(0),
|
||||
computeDerivativeMode(LayoutDerivativeNone),
|
||||
primitives(TQualifier::layoutNotSet),
|
||||
numTaskNVBlocks(0),
|
||||
#endif
|
||||
autoMapBindings(false),
|
||||
autoMapLocations(false),
|
||||
invertY(false),
|
||||
flattenUniformArrays(false),
|
||||
useUnknownFormat(false),
|
||||
hlslOffsets(false),
|
||||
useStorageBuffer(false),
|
||||
useVulkanMemoryModel(false),
|
||||
hlslIoMapping(false),
|
||||
useVariablePointers(false),
|
||||
textureSamplerTransformMode(EShTexSampTransKeep),
|
||||
needToLegalize(false),
|
||||
binaryDoubleOutput(false),
|
||||
usePhysicalStorageBuffer(false),
|
||||
uniformLocationBase(0),
|
||||
nanMinMaxClamp(false)
|
||||
uniformLocationBase(0)
|
||||
#endif
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
localSize[0] = 1;
|
||||
localSize[1] = 1;
|
||||
localSize[2] = 1;
|
||||
|
|
@ -276,152 +275,9 @@ public:
|
|||
localSizeSpecId[1] = TQualifier::layoutNotSet;
|
||||
localSizeSpecId[2] = TQualifier::layoutNotSet;
|
||||
xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
|
||||
|
||||
shiftBinding.fill(0);
|
||||
#endif
|
||||
}
|
||||
void setLimits(const TBuiltInResource& r) { resources = r; }
|
||||
|
||||
bool postProcess(TIntermNode*, EShLanguage);
|
||||
void output(TInfoSink&, bool tree);
|
||||
void removeTree();
|
||||
|
||||
void setSource(EShSource s) { source = s; }
|
||||
EShSource getSource() const { return source; }
|
||||
void setEntryPointName(const char* ep)
|
||||
{
|
||||
entryPointName = ep;
|
||||
processes.addProcess("entry-point");
|
||||
processes.addArgument(entryPointName);
|
||||
}
|
||||
void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; }
|
||||
const std::string& getEntryPointName() const { return entryPointName; }
|
||||
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
|
||||
|
||||
void setShiftBinding(TResourceType res, unsigned int shift)
|
||||
{
|
||||
shiftBinding[res] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name != nullptr)
|
||||
processes.addIfNonZero(name, shift);
|
||||
}
|
||||
|
||||
unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; }
|
||||
|
||||
void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set)
|
||||
{
|
||||
if (shift == 0) // ignore if there's no shift: it's a no-op.
|
||||
return;
|
||||
|
||||
shiftBindingForSet[res][set] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name != nullptr) {
|
||||
processes.addProcess(name);
|
||||
processes.addArgument(shift);
|
||||
processes.addArgument(set);
|
||||
}
|
||||
}
|
||||
|
||||
int getShiftBindingForSet(TResourceType res, unsigned int set) const
|
||||
{
|
||||
const auto shift = shiftBindingForSet[res].find(set);
|
||||
return shift == shiftBindingForSet[res].end() ? -1 : shift->second;
|
||||
}
|
||||
bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); }
|
||||
|
||||
void setResourceSetBinding(const std::vector<std::string>& shift)
|
||||
{
|
||||
resourceSetBinding = shift;
|
||||
if (shift.size() > 0) {
|
||||
processes.addProcess("resource-set-binding");
|
||||
for (int s = 0; s < (int)shift.size(); ++s)
|
||||
processes.addArgument(shift[s]);
|
||||
}
|
||||
}
|
||||
const std::vector<std::string>& getResourceSetBinding() const { return resourceSetBinding; }
|
||||
void setAutoMapBindings(bool map)
|
||||
{
|
||||
autoMapBindings = map;
|
||||
if (autoMapBindings)
|
||||
processes.addProcess("auto-map-bindings");
|
||||
}
|
||||
bool getAutoMapBindings() const { return autoMapBindings; }
|
||||
void setAutoMapLocations(bool map)
|
||||
{
|
||||
autoMapLocations = map;
|
||||
if (autoMapLocations)
|
||||
processes.addProcess("auto-map-locations");
|
||||
}
|
||||
bool getAutoMapLocations() const { return autoMapLocations; }
|
||||
void setInvertY(bool invert)
|
||||
{
|
||||
invertY = invert;
|
||||
if (invertY)
|
||||
processes.addProcess("invert-y");
|
||||
}
|
||||
bool getInvertY() const { return invertY; }
|
||||
|
||||
void setFlattenUniformArrays(bool flatten)
|
||||
{
|
||||
flattenUniformArrays = flatten;
|
||||
if (flattenUniformArrays)
|
||||
processes.addProcess("flatten-uniform-arrays");
|
||||
}
|
||||
bool getFlattenUniformArrays() const { return flattenUniformArrays; }
|
||||
void setNoStorageFormat(bool b)
|
||||
{
|
||||
useUnknownFormat = b;
|
||||
if (useUnknownFormat)
|
||||
processes.addProcess("no-storage-format");
|
||||
}
|
||||
bool getNoStorageFormat() const { return useUnknownFormat; }
|
||||
void setHlslOffsets()
|
||||
{
|
||||
hlslOffsets = true;
|
||||
if (hlslOffsets)
|
||||
processes.addProcess("hlsl-offsets");
|
||||
}
|
||||
bool usingHlslOffsets() const { return hlslOffsets; }
|
||||
void setUseStorageBuffer()
|
||||
{
|
||||
useStorageBuffer = true;
|
||||
processes.addProcess("use-storage-buffer");
|
||||
}
|
||||
bool usingStorageBuffer() const { return useStorageBuffer; }
|
||||
void setHlslIoMapping(bool b)
|
||||
{
|
||||
hlslIoMapping = b;
|
||||
if (hlslIoMapping)
|
||||
processes.addProcess("hlsl-iomap");
|
||||
}
|
||||
bool usingHlslIoMapping() { return hlslIoMapping; }
|
||||
void setUseVulkanMemoryModel()
|
||||
{
|
||||
useVulkanMemoryModel = true;
|
||||
processes.addProcess("use-vulkan-memory-model");
|
||||
}
|
||||
bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; }
|
||||
void setUsePhysicalStorageBuffer()
|
||||
{
|
||||
usePhysicalStorageBuffer = true;
|
||||
}
|
||||
bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; }
|
||||
void setUseVariablePointers()
|
||||
{
|
||||
useVariablePointers = true;
|
||||
processes.addProcess("use-variable-pointers");
|
||||
}
|
||||
bool usingVariablePointers() const { return useVariablePointers; }
|
||||
|
||||
template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
|
||||
bool hasCounterBufferName(const TString& name) const {
|
||||
size_t len = strlen(implicitCounterName);
|
||||
return name.size() > len &&
|
||||
name.compare(name.size() - len, len, implicitCounterName) == 0;
|
||||
}
|
||||
|
||||
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; }
|
||||
|
||||
void setVersion(int v) { version = v; }
|
||||
int getVersion() const { return version; }
|
||||
|
|
@ -485,9 +341,35 @@ public:
|
|||
int getNumEntryPoints() const { return numEntryPoints; }
|
||||
int getNumErrors() const { return numErrors; }
|
||||
void addPushConstantCount() { ++numPushConstants; }
|
||||
#ifdef NV_EXTENSIONS
|
||||
void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; }
|
||||
void addTaskNVCount() { ++numTaskNVBlocks; }
|
||||
void setLimits(const TBuiltInResource& r) { resources = r; }
|
||||
|
||||
bool postProcess(TIntermNode*, EShLanguage);
|
||||
void removeTree();
|
||||
|
||||
void setEntryPointName(const char* ep)
|
||||
{
|
||||
entryPointName = ep;
|
||||
processes.addProcess("entry-point");
|
||||
processes.addArgument(entryPointName);
|
||||
}
|
||||
void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; }
|
||||
const std::string& getEntryPointName() const { return entryPointName; }
|
||||
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
|
||||
|
||||
void setInvertY(bool invert)
|
||||
{
|
||||
invertY = invert;
|
||||
if (invertY)
|
||||
processes.addProcess("invert-y");
|
||||
}
|
||||
bool getInvertY() const { return invertY; }
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
void setSource(EShSource s) { source = s; }
|
||||
EShSource getSource() const { return source; }
|
||||
#else
|
||||
void setSource(EShSource s) { assert(s == EShSourceGlsl); }
|
||||
EShSource getSource() const { return EShSourceGlsl; }
|
||||
#endif
|
||||
|
||||
bool isRecursive() const { return recursive; }
|
||||
|
|
@ -566,6 +448,152 @@ public:
|
|||
void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
|
||||
void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&);
|
||||
|
||||
void setUseStorageBuffer()
|
||||
{
|
||||
useStorageBuffer = true;
|
||||
processes.addProcess("use-storage-buffer");
|
||||
}
|
||||
bool usingStorageBuffer() const { return useStorageBuffer; }
|
||||
void setDepthReplacing() { depthReplacing = true; }
|
||||
bool isDepthReplacing() const { return depthReplacing; }
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
void output(TInfoSink&, bool tree) { }
|
||||
|
||||
bool isEsProfile() const { return false; }
|
||||
bool getXfbMode() const { return false; }
|
||||
bool isMultiStream() const { return false; }
|
||||
TLayoutGeometry getOutputPrimitive() const { return ElgNone; }
|
||||
bool getPostDepthCoverage() const { return false; }
|
||||
bool getEarlyFragmentTests() const { return false; }
|
||||
TLayoutDepth getDepth() const { return EldNone; }
|
||||
bool getPixelCenterInteger() const { return false; }
|
||||
void setOriginUpperLeft() { }
|
||||
bool getOriginUpperLeft() const { return true; }
|
||||
TInterlockOrdering getInterlockOrdering() const { return EioNone; }
|
||||
|
||||
bool getAutoMapBindings() const { return false; }
|
||||
bool getAutoMapLocations() const { return false; }
|
||||
int getNumPushConstants() const { return 0; }
|
||||
void addShaderRecordNVCount() { }
|
||||
void addTaskNVCount() { }
|
||||
void setUseVulkanMemoryModel() { }
|
||||
bool usingVulkanMemoryModel() const { return false; }
|
||||
bool usingPhysicalStorageBuffer() const { return false; }
|
||||
bool usingVariablePointers() const { return false; }
|
||||
unsigned getXfbStride(int buffer) const { return 0; }
|
||||
bool hasLayoutDerivativeModeNone() const { return false; }
|
||||
#else
|
||||
void output(TInfoSink&, bool tree);
|
||||
|
||||
bool isEsProfile() const { return profile == EEsProfile; }
|
||||
|
||||
void setShiftBinding(TResourceType res, unsigned int shift)
|
||||
{
|
||||
shiftBinding[res] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name != nullptr)
|
||||
processes.addIfNonZero(name, shift);
|
||||
}
|
||||
|
||||
unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; }
|
||||
|
||||
void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set)
|
||||
{
|
||||
if (shift == 0) // ignore if there's no shift: it's a no-op.
|
||||
return;
|
||||
|
||||
shiftBindingForSet[res][set] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name != nullptr) {
|
||||
processes.addProcess(name);
|
||||
processes.addArgument(shift);
|
||||
processes.addArgument(set);
|
||||
}
|
||||
}
|
||||
|
||||
int getShiftBindingForSet(TResourceType res, unsigned int set) const
|
||||
{
|
||||
const auto shift = shiftBindingForSet[res].find(set);
|
||||
return shift == shiftBindingForSet[res].end() ? -1 : shift->second;
|
||||
}
|
||||
bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); }
|
||||
|
||||
void setResourceSetBinding(const std::vector<std::string>& shift)
|
||||
{
|
||||
resourceSetBinding = shift;
|
||||
if (shift.size() > 0) {
|
||||
processes.addProcess("resource-set-binding");
|
||||
for (int s = 0; s < (int)shift.size(); ++s)
|
||||
processes.addArgument(shift[s]);
|
||||
}
|
||||
}
|
||||
const std::vector<std::string>& getResourceSetBinding() const { return resourceSetBinding; }
|
||||
void setAutoMapBindings(bool map)
|
||||
{
|
||||
autoMapBindings = map;
|
||||
if (autoMapBindings)
|
||||
processes.addProcess("auto-map-bindings");
|
||||
}
|
||||
bool getAutoMapBindings() const { return autoMapBindings; }
|
||||
void setAutoMapLocations(bool map)
|
||||
{
|
||||
autoMapLocations = map;
|
||||
if (autoMapLocations)
|
||||
processes.addProcess("auto-map-locations");
|
||||
}
|
||||
bool getAutoMapLocations() const { return autoMapLocations; }
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
void setFlattenUniformArrays(bool flatten)
|
||||
{
|
||||
flattenUniformArrays = flatten;
|
||||
if (flattenUniformArrays)
|
||||
processes.addProcess("flatten-uniform-arrays");
|
||||
}
|
||||
bool getFlattenUniformArrays() const { return flattenUniformArrays; }
|
||||
#endif
|
||||
void setNoStorageFormat(bool b)
|
||||
{
|
||||
useUnknownFormat = b;
|
||||
if (useUnknownFormat)
|
||||
processes.addProcess("no-storage-format");
|
||||
}
|
||||
bool getNoStorageFormat() const { return useUnknownFormat; }
|
||||
void setUseVulkanMemoryModel()
|
||||
{
|
||||
useVulkanMemoryModel = true;
|
||||
processes.addProcess("use-vulkan-memory-model");
|
||||
}
|
||||
bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; }
|
||||
void setUsePhysicalStorageBuffer()
|
||||
{
|
||||
usePhysicalStorageBuffer = true;
|
||||
}
|
||||
bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; }
|
||||
void setUseVariablePointers()
|
||||
{
|
||||
useVariablePointers = true;
|
||||
processes.addProcess("use-variable-pointers");
|
||||
}
|
||||
bool usingVariablePointers() const { return useVariablePointers; }
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
|
||||
bool hasCounterBufferName(const TString& name) const {
|
||||
size_t len = strlen(implicitCounterName);
|
||||
return name.size() > len &&
|
||||
name.compare(name.size() - len, len, implicitCounterName) == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; }
|
||||
int getNumPushConstants() const { return numPushConstants; }
|
||||
void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; }
|
||||
void addTaskNVCount() { ++numTaskNVBlocks; }
|
||||
|
||||
bool setInvocations(int i)
|
||||
{
|
||||
if (invocations != TQualifier::layoutNotSet)
|
||||
|
|
@ -635,7 +663,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
|
||||
|
||||
void setXfbMode() { xfbMode = true; }
|
||||
bool getXfbMode() const { return xfbMode; }
|
||||
void setMultiStream() { multiStream = true; }
|
||||
|
|
@ -648,14 +675,10 @@ public:
|
|||
return true;
|
||||
}
|
||||
TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; }
|
||||
void setOriginUpperLeft() { originUpperLeft = true; }
|
||||
bool getOriginUpperLeft() const { return originUpperLeft; }
|
||||
void setPixelCenterInteger() { pixelCenterInteger = true; }
|
||||
bool getPixelCenterInteger() const { return pixelCenterInteger; }
|
||||
void setEarlyFragmentTests() { earlyFragmentTests = true; }
|
||||
bool getEarlyFragmentTests() const { return earlyFragmentTests; }
|
||||
void setPostDepthCoverage() { postDepthCoverage = true; }
|
||||
bool getPostDepthCoverage() const { return postDepthCoverage; }
|
||||
void setEarlyFragmentTests() { earlyFragmentTests = true; }
|
||||
bool getEarlyFragmentTests() const { return earlyFragmentTests; }
|
||||
bool setDepth(TLayoutDepth d)
|
||||
{
|
||||
if (depthLayout != EldNone)
|
||||
|
|
@ -664,29 +687,12 @@ public:
|
|||
return true;
|
||||
}
|
||||
TLayoutDepth getDepth() const { return depthLayout; }
|
||||
void setDepthReplacing() { depthReplacing = true; }
|
||||
bool isDepthReplacing() const { return depthReplacing; }
|
||||
|
||||
void setHlslFunctionality1() { hlslFunctionality1 = true; }
|
||||
bool getHlslFunctionality1() const { return hlslFunctionality1; }
|
||||
|
||||
void setOriginUpperLeft() { originUpperLeft = true; }
|
||||
bool getOriginUpperLeft() const { return originUpperLeft; }
|
||||
void setPixelCenterInteger() { pixelCenterInteger = true; }
|
||||
bool getPixelCenterInteger() const { return pixelCenterInteger; }
|
||||
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
|
||||
unsigned int getBlendEquations() const { return blendEquations; }
|
||||
|
||||
void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
|
||||
void merge(TInfoSink&, TIntermediate&);
|
||||
void finalCheck(TInfoSink&, bool keepUncalled);
|
||||
|
||||
void addIoAccessed(const TString& name) { ioAccessed.insert(name); }
|
||||
bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); }
|
||||
|
||||
int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision);
|
||||
int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision);
|
||||
int addUsedOffsets(int binding, int offset, int numOffsets);
|
||||
bool addUsedConstantId(int id);
|
||||
static int computeTypeLocationSize(const TType&, EShLanguage);
|
||||
static int computeTypeUniformLocationSize(const TType&);
|
||||
|
||||
bool setXfbBufferStride(int buffer, unsigned stride)
|
||||
{
|
||||
if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd)
|
||||
|
|
@ -696,28 +702,14 @@ public:
|
|||
}
|
||||
unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; }
|
||||
int addXfbBufferOffset(const TType&);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const;
|
||||
#else
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType) const;
|
||||
#endif
|
||||
static int getBaseAlignmentScalar(const TType&, int& size);
|
||||
static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
|
||||
static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor);
|
||||
static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
|
||||
static bool improperStraddle(const TType& type, int size, int offset);
|
||||
static void updateOffset(const TType& parentType, const TType& memberType, int& offset, int& memberSize);
|
||||
static int getOffset(const TType& type, int index);
|
||||
static int getBlockSize(const TType& blockType);
|
||||
static int computeBufferReferenceTypeSize(const TType&);
|
||||
bool promote(TIntermOperator*);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
void setLayoutOverrideCoverage() { layoutOverrideCoverage = true; }
|
||||
bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; }
|
||||
void setGeoPassthroughEXT() { geoPassthroughEXT = true; }
|
||||
bool getGeoPassthroughEXT() const { return geoPassthroughEXT; }
|
||||
void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; }
|
||||
bool hasLayoutDerivativeModeNone() const { return computeDerivativeMode != LayoutDerivativeNone; }
|
||||
ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; }
|
||||
bool setPrimitives(int m)
|
||||
{
|
||||
|
|
@ -727,28 +719,10 @@ public:
|
|||
return true;
|
||||
}
|
||||
int getPrimitives() const { return primitives; }
|
||||
#endif
|
||||
|
||||
const char* addSemanticName(const TString& name)
|
||||
{
|
||||
return semanticNameSet.insert(name).first->c_str();
|
||||
}
|
||||
|
||||
void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; }
|
||||
const std::string& getSourceFile() const { return sourceFile; }
|
||||
void addSourceText(const char* text, size_t len) { sourceText.append(text, len); }
|
||||
const std::string& getSourceText() const { return sourceText; }
|
||||
const std::map<std::string, std::string>& getIncludeText() const { return includeText; }
|
||||
void addIncludeText(const char* name, const char* text, size_t len) { includeText[name].assign(text,len); }
|
||||
void addProcesses(const std::vector<std::string>& p)
|
||||
{
|
||||
for (int i = 0; i < (int)p.size(); ++i)
|
||||
processes.addProcess(p[i]);
|
||||
}
|
||||
void addProcess(const std::string& process) { processes.addProcess(process); }
|
||||
void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
|
||||
const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
|
||||
|
||||
void addUniformLocationOverride(const char* nameStr, int location)
|
||||
{
|
||||
std::string name = nameStr;
|
||||
|
|
@ -768,38 +742,100 @@ public:
|
|||
void setUniformLocationBase(int base) { uniformLocationBase = base; }
|
||||
int getUniformLocationBase() const { return uniformLocationBase; }
|
||||
|
||||
void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
|
||||
bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
|
||||
|
||||
void setNeedsLegalization() { needToLegalize = true; }
|
||||
bool needsLegalization() const { return needToLegalize; }
|
||||
|
||||
void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
|
||||
bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
|
||||
#endif
|
||||
|
||||
const char* const implicitThisName;
|
||||
const char* const implicitCounterName;
|
||||
#ifdef ENABLE_HLSL
|
||||
void setHlslFunctionality1() { hlslFunctionality1 = true; }
|
||||
bool getHlslFunctionality1() const { return hlslFunctionality1; }
|
||||
void setHlslOffsets()
|
||||
{
|
||||
hlslOffsets = true;
|
||||
if (hlslOffsets)
|
||||
processes.addProcess("hlsl-offsets");
|
||||
}
|
||||
bool usingHlslOffsets() const { return hlslOffsets; }
|
||||
void setHlslIoMapping(bool b)
|
||||
{
|
||||
hlslIoMapping = b;
|
||||
if (hlslIoMapping)
|
||||
processes.addProcess("hlsl-iomap");
|
||||
}
|
||||
bool usingHlslIoMapping() { return hlslIoMapping; }
|
||||
#else
|
||||
bool getHlslFunctionality1() const { return false; }
|
||||
bool usingHlslOffsets() const { return false; }
|
||||
bool usingHlslIoMapping() { return false; }
|
||||
#endif
|
||||
|
||||
void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
|
||||
void merge(TInfoSink&, TIntermediate&);
|
||||
void finalCheck(TInfoSink&, bool keepUncalled);
|
||||
|
||||
void addIoAccessed(const TString& name) { ioAccessed.insert(name); }
|
||||
bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); }
|
||||
|
||||
int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision);
|
||||
int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision);
|
||||
int addUsedOffsets(int binding, int offset, int numOffsets);
|
||||
bool addUsedConstantId(int id);
|
||||
static int computeTypeLocationSize(const TType&, EShLanguage);
|
||||
static int computeTypeUniformLocationSize(const TType&);
|
||||
|
||||
static int getBaseAlignmentScalar(const TType&, int& size);
|
||||
static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
|
||||
static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor);
|
||||
static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
|
||||
static bool improperStraddle(const TType& type, int size, int offset);
|
||||
static void updateOffset(const TType& parentType, const TType& memberType, int& offset, int& memberSize);
|
||||
static int getOffset(const TType& type, int index);
|
||||
static int getBlockSize(const TType& blockType);
|
||||
static int computeBufferReferenceTypeSize(const TType&);
|
||||
bool promote(TIntermOperator*);
|
||||
void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
|
||||
bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
|
||||
|
||||
void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; }
|
||||
const std::string& getSourceFile() const { return sourceFile; }
|
||||
void addSourceText(const char* text, size_t len) { sourceText.append(text, len); }
|
||||
const std::string& getSourceText() const { return sourceText; }
|
||||
const std::map<std::string, std::string>& getIncludeText() const { return includeText; }
|
||||
void addIncludeText(const char* name, const char* text, size_t len) { includeText[name].assign(text,len); }
|
||||
void addProcesses(const std::vector<std::string>& p)
|
||||
{
|
||||
for (int i = 0; i < (int)p.size(); ++i)
|
||||
processes.addProcess(p[i]);
|
||||
}
|
||||
void addProcess(const std::string& process) { processes.addProcess(process); }
|
||||
void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
|
||||
const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
|
||||
|
||||
// Certain explicit conversions are allowed conditionally
|
||||
#ifdef GLSLANG_WEB
|
||||
bool getArithemeticInt8Enabled() const { return false; }
|
||||
bool getArithemeticInt16Enabled() const { return false; }
|
||||
bool getArithemeticFloat16Enabled() const { return false; }
|
||||
#else
|
||||
bool getArithemeticInt8Enabled() const {
|
||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
|
||||
}
|
||||
bool getArithemeticInt16Enabled() const {
|
||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
extensionRequested(E_GL_AMD_gpu_shader_int16) ||
|
||||
#endif
|
||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
||||
}
|
||||
|
||||
bool getArithemeticFloat16Enabled() const {
|
||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
|
||||
#endif
|
||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
|
||||
|
|
@ -832,11 +868,27 @@ protected:
|
|||
bool isConversionAllowed(TOperator op, TIntermTyped* node) const;
|
||||
TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const;
|
||||
std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const;
|
||||
|
||||
// JohnK: I think this function should go away.
|
||||
// This data structure is just a log to pass on to back ends.
|
||||
// Versioning and extensions are handled in Version.cpp, with a rich
|
||||
// set of functions for querying stages, versions, extension enable/disabled, etc.
|
||||
#ifdef GLSLANG_WEB
|
||||
bool extensionRequested(const char *extension) const { return false; }
|
||||
#else
|
||||
bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();}
|
||||
#endif
|
||||
|
||||
static const char* getResourceName(TResourceType);
|
||||
|
||||
const EShLanguage language; // stage, known at construction time
|
||||
#ifdef ENABLE_HLSL
|
||||
public:
|
||||
const char* const implicitThisName;
|
||||
const char* const implicitCounterName;
|
||||
protected:
|
||||
EShSource source; // source language, known a bit later
|
||||
#endif
|
||||
std::string entryPointName;
|
||||
std::string entryPointMangledName;
|
||||
typedef std::list<TCall> TGraph;
|
||||
|
|
@ -852,6 +904,12 @@ protected:
|
|||
int numErrors;
|
||||
int numPushConstants;
|
||||
bool recursive;
|
||||
bool invertY;
|
||||
bool useStorageBuffer;
|
||||
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
|
||||
bool depthReplacing;
|
||||
#ifndef GLSLANG_WEB
|
||||
bool useVulkanMemoryModel;
|
||||
int invocations;
|
||||
int vertices;
|
||||
TLayoutGeometry inputPrimitive;
|
||||
|
|
@ -867,21 +925,17 @@ protected:
|
|||
bool earlyFragmentTests;
|
||||
bool postDepthCoverage;
|
||||
TLayoutDepth depthLayout;
|
||||
bool depthReplacing;
|
||||
bool hlslFunctionality1;
|
||||
int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift
|
||||
bool xfbMode;
|
||||
std::vector<TXfbBuffer> xfbBuffers; // all the data we need to track per xfb buffer
|
||||
bool multiStream;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
bool layoutOverrideCoverage;
|
||||
bool geoPassthroughEXT;
|
||||
int numShaderRecordNVBlocks;
|
||||
ComputeDerivativeMode computeDerivativeMode;
|
||||
int primitives;
|
||||
int numTaskNVBlocks;
|
||||
#endif
|
||||
|
||||
// Base shift values
|
||||
std::array<unsigned int, EResCount> shiftBinding;
|
||||
|
|
@ -892,23 +946,29 @@ protected:
|
|||
std::vector<std::string> resourceSetBinding;
|
||||
bool autoMapBindings;
|
||||
bool autoMapLocations;
|
||||
bool invertY;
|
||||
bool flattenUniformArrays;
|
||||
bool useUnknownFormat;
|
||||
bool hlslOffsets;
|
||||
bool useStorageBuffer;
|
||||
bool useVulkanMemoryModel;
|
||||
bool hlslIoMapping;
|
||||
bool useVariablePointers;
|
||||
|
||||
std::set<TString> ioAccessed; // set of names of statically read/written I/O that might need extra checking
|
||||
std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers
|
||||
std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters
|
||||
std::unordered_set<int> usedConstantId; // specialization constant ids used
|
||||
std::set<TString> semanticNameSet;
|
||||
|
||||
EShTextureSamplerTransformMode textureSamplerTransformMode;
|
||||
|
||||
bool needToLegalize;
|
||||
bool binaryDoubleOutput;
|
||||
bool usePhysicalStorageBuffer;
|
||||
|
||||
std::unordered_map<std::string, int> uniformLocationOverrides;
|
||||
int uniformLocationBase;
|
||||
#endif
|
||||
|
||||
std::unordered_set<int> usedConstantId; // specialization constant ids used
|
||||
std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters
|
||||
std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers
|
||||
// set of names of statically read/written I/O that might need extra checking
|
||||
std::set<TString> ioAccessed;
|
||||
// source code of shader, useful as part of debug information
|
||||
std::string sourceFile;
|
||||
std::string sourceText;
|
||||
|
|
@ -919,14 +979,6 @@ protected:
|
|||
// for OpModuleProcessed, or equivalent
|
||||
TProcesses processes;
|
||||
|
||||
bool needToLegalize;
|
||||
bool binaryDoubleOutput;
|
||||
bool usePhysicalStorageBuffer;
|
||||
|
||||
std::unordered_map<std::string, int> uniformLocationOverrides;
|
||||
int uniformLocationBase;
|
||||
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
|
||||
|
||||
private:
|
||||
void operator=(TIntermediate&); // prevent assignments
|
||||
};
|
||||
|
|
|
|||
|
|
@ -57,26 +57,91 @@ public:
|
|||
TParseVersions(TIntermediate& interm, int version, EProfile profile,
|
||||
const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink,
|
||||
bool forwardCompatible, EShMessages messages)
|
||||
: infoSink(infoSink), version(version), profile(profile), language(language),
|
||||
spvVersion(spvVersion), forwardCompatible(forwardCompatible),
|
||||
:
|
||||
#ifndef GLSLANG_WEB
|
||||
forwardCompatible(forwardCompatible),
|
||||
profile(profile),
|
||||
#endif
|
||||
infoSink(infoSink), version(version),
|
||||
language(language),
|
||||
spvVersion(spvVersion),
|
||||
intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { }
|
||||
virtual ~TParseVersions() { }
|
||||
void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc);
|
||||
void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc);
|
||||
#ifdef GLSLANG_WEB
|
||||
const EProfile profile = EEsProfile;
|
||||
bool isEsProfile() const { return true; }
|
||||
void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc)
|
||||
{
|
||||
if (! (EEsProfile & profileMask))
|
||||
error(loc, "not supported with this profile:", featureDesc, ProfileName(profile));
|
||||
}
|
||||
void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions,
|
||||
const char* const extensions[], const char* featureDesc)
|
||||
{
|
||||
if ((EEsProfile & profileMask) && (minVersion == 0 || version < minVersion))
|
||||
error(loc, "not supported for this version or the enabled extensions", featureDesc, "");
|
||||
}
|
||||
void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension,
|
||||
const char* featureDesc)
|
||||
{
|
||||
profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc);
|
||||
}
|
||||
void initializeExtensionBehavior() { }
|
||||
void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc) { }
|
||||
void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc) { }
|
||||
void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
|
||||
const char* featureDesc) { }
|
||||
void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
|
||||
const char* featureDesc) { }
|
||||
TExtensionBehavior getExtensionBehavior(const char*) { return EBhMissing; }
|
||||
bool extensionTurnedOn(const char* const extension) { return false; }
|
||||
bool extensionsTurnedOn(int numExtensions, const char* const extensions[]) { return false; }
|
||||
void updateExtensionBehavior(int line, const char* const extension, const char* behavior) { }
|
||||
void updateExtensionBehavior(const char* const extension, TExtensionBehavior) { }
|
||||
void checkExtensionStage(const TSourceLoc&, const char* const extension) { }
|
||||
void fullIntegerCheck(const TSourceLoc&, const char* op) { }
|
||||
void doubleCheck(const TSourceLoc&, const char* op) { }
|
||||
bool float16Arithmetic() { return false; }
|
||||
void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { }
|
||||
bool int16Arithmetic() { return false; }
|
||||
void requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { }
|
||||
bool int8Arithmetic() { return false; }
|
||||
void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { }
|
||||
void int64Check(const TSourceLoc&, const char* op, bool builtIn = false) { }
|
||||
void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false) { }
|
||||
void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false) { }
|
||||
bool relaxedErrors() const { return false; }
|
||||
bool suppressWarnings() const { return true; }
|
||||
bool isForwardCompatible() const { return false; }
|
||||
#else
|
||||
bool forwardCompatible; // true if errors are to be given for use of deprecated features
|
||||
EProfile profile; // the declared profile in the shader (core by default)
|
||||
bool isEsProfile() const { return profile == EEsProfile; }
|
||||
void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc);
|
||||
void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions,
|
||||
const char* const extensions[], const char* featureDesc);
|
||||
void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension,
|
||||
const char* featureDesc);
|
||||
virtual void initializeExtensionBehavior();
|
||||
virtual void requireProfile(const TSourceLoc&, int queryProfiles, const char* featureDesc);
|
||||
virtual void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc);
|
||||
virtual void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, const char* const extension, const char* featureDesc);
|
||||
virtual void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc);
|
||||
virtual void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc);
|
||||
virtual void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc);
|
||||
virtual void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc);
|
||||
virtual void unimplemented(const TSourceLoc&, const char* featureDesc);
|
||||
virtual void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc);
|
||||
virtual void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc);
|
||||
virtual void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
|
||||
const char* featureDesc);
|
||||
virtual void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
|
||||
const char* featureDesc);
|
||||
virtual TExtensionBehavior getExtensionBehavior(const char*);
|
||||
virtual bool extensionTurnedOn(const char* const extension);
|
||||
virtual bool extensionsTurnedOn(int numExtensions, const char* const extensions[]);
|
||||
virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior);
|
||||
virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior);
|
||||
virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[],
|
||||
const char* featureDesc);
|
||||
virtual void checkExtensionStage(const TSourceLoc&, const char* const extension);
|
||||
virtual void fullIntegerCheck(const TSourceLoc&, const char* op);
|
||||
|
||||
virtual void unimplemented(const TSourceLoc&, const char* featureDesc);
|
||||
virtual void doubleCheck(const TSourceLoc&, const char* op);
|
||||
virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void float16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
|
|
@ -88,24 +153,34 @@ public:
|
|||
virtual void int8ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual bool int8Arithmetic();
|
||||
virtual void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
virtual void float16OpaqueCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
#endif
|
||||
virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void explicitInt8Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void explicitInt16Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void explicitInt32Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; }
|
||||
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
|
||||
bool isForwardCompatible() const { return forwardCompatible; }
|
||||
#endif // GLSLANG_WEB
|
||||
virtual void spvRemoved(const TSourceLoc&, const char* op);
|
||||
virtual void vulkanRemoved(const TSourceLoc&, const char* op);
|
||||
virtual void requireVulkan(const TSourceLoc&, const char* op);
|
||||
virtual void requireSpv(const TSourceLoc&, const char* op);
|
||||
virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc);
|
||||
virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior);
|
||||
virtual void checkExtensionStage(const TSourceLoc&, const char* const extension);
|
||||
virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
|
||||
|
||||
#if defined(GLSLANG_WEB) && !defined(GLSLANG_WEB_DEVEL)
|
||||
void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...) { addError(); }
|
||||
void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...) { }
|
||||
void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...) { addError(); }
|
||||
void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...) { }
|
||||
#else
|
||||
virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...) = 0;
|
||||
virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
|
|
@ -114,6 +189,7 @@ public:
|
|||
const char* szExtraInfoFormat, ...) = 0;
|
||||
virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
const char* szExtraInfoFormat, ...) = 0;
|
||||
#endif
|
||||
|
||||
void addError() { ++numErrors; }
|
||||
int getNumErrors() const { return numErrors; }
|
||||
|
|
@ -127,20 +203,20 @@ public:
|
|||
void setCurrentString(int string) { currentScanner->setString(string); }
|
||||
|
||||
void getPreamble(std::string&);
|
||||
bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; }
|
||||
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
|
||||
#ifdef ENABLE_HLSL
|
||||
bool isReadingHLSL() const { return (messages & EShMsgReadHlsl) == EShMsgReadHlsl; }
|
||||
bool hlslEnable16BitTypes() const { return (messages & EShMsgHlslEnable16BitTypes) != 0; }
|
||||
bool hlslDX9Compatible() const { return (messages & EShMsgHlslDX9Compatible) != 0; }
|
||||
#else
|
||||
bool isReadingHLSL() const { return false; }
|
||||
#endif
|
||||
|
||||
TInfoSink& infoSink;
|
||||
|
||||
// compilation mode
|
||||
int version; // version, updated by #version in the shader
|
||||
EProfile profile; // the declared profile in the shader (core by default)
|
||||
EShLanguage language; // really the stage
|
||||
SpvVersion spvVersion;
|
||||
bool forwardCompatible; // true if errors are to be given for use of deprecated features
|
||||
TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, T
|
|||
case MacroExpandStarted:
|
||||
break;
|
||||
case MacroExpandUndef:
|
||||
if (! shortCircuit && parseContext.profile == EEsProfile) {
|
||||
if (! shortCircuit && parseContext.isEsProfile()) {
|
||||
const char* message = "undefined macro in expression not allowed in es profile";
|
||||
if (parseContext.relaxedErrors())
|
||||
parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name);
|
||||
|
|
@ -722,6 +722,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
|
|||
parseContext.setCurrentLine(lineRes);
|
||||
|
||||
if (token != '\n') {
|
||||
#ifndef GLSLANG_WEB
|
||||
if (token == PpAtomConstString) {
|
||||
parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line");
|
||||
// We need to save a copy of the string instead of pointing
|
||||
|
|
@ -731,7 +732,9 @@ int TPpContext::CPPline(TPpToken* ppToken)
|
|||
parseContext.setCurrentSourceName(sourceName);
|
||||
hasFile = true;
|
||||
token = scanToken(ppToken);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken);
|
||||
if (! fileErr) {
|
||||
parseContext.setCurrentString(fileRes);
|
||||
|
|
@ -792,10 +795,8 @@ int TPpContext::CPPpragma(TPpToken* ppToken)
|
|||
case PpAtomConstUint:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstInt16:
|
||||
case PpAtomConstUint16:
|
||||
#endif
|
||||
case PpAtomConstFloat:
|
||||
case PpAtomConstDouble:
|
||||
case PpAtomConstFloat16:
|
||||
|
|
@ -954,18 +955,20 @@ int TPpContext::readCPPline(TPpToken* ppToken)
|
|||
case PpAtomIfndef:
|
||||
token = CPPifdef(0, ppToken);
|
||||
break;
|
||||
case PpAtomLine:
|
||||
token = CPPline(ppToken);
|
||||
break;
|
||||
#ifndef GLSLANG_WEB
|
||||
case PpAtomInclude:
|
||||
if(!parseContext.isReadingHLSL()) {
|
||||
parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include");
|
||||
}
|
||||
token = CPPinclude(ppToken);
|
||||
break;
|
||||
case PpAtomLine:
|
||||
token = CPPline(ppToken);
|
||||
break;
|
||||
case PpAtomPragma:
|
||||
token = CPPpragma(ppToken);
|
||||
break;
|
||||
#endif
|
||||
case PpAtomUndef:
|
||||
token = CPPundef(ppToken);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
ch = getChar();
|
||||
int firstDecimal = len;
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
// 1.#INF or -1.#INF
|
||||
if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
|
||||
if ((len < 2) ||
|
||||
|
|
@ -169,6 +170,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Consume leading-zero digits after the decimal point
|
||||
while (ch == '0') {
|
||||
|
|
@ -257,6 +259,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
// Suffix:
|
||||
bool isDouble = false;
|
||||
bool isFloat16 = false;
|
||||
#ifndef GLSLANG_WEB
|
||||
if (ch == 'l' || ch == 'L') {
|
||||
if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl)
|
||||
parseContext.doubleCheck(ppToken->loc, "double floating-point suffix");
|
||||
|
|
@ -295,11 +298,15 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
saveName(ch);
|
||||
isFloat16 = true;
|
||||
}
|
||||
} else if (ch == 'f' || ch == 'F') {
|
||||
} else
|
||||
#endif
|
||||
if (ch == 'f' || ch == 'F') {
|
||||
#ifndef GLSLANG_WEB
|
||||
if (ifdepth == 0)
|
||||
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
|
||||
if (ifdepth == 0 && !parseContext.relaxedErrors())
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
|
||||
#endif
|
||||
if (ifdepth == 0 && !hasDecimalOrExponent)
|
||||
parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||
saveName(ch);
|
||||
|
|
@ -468,9 +475,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
static const int Num_Int64_Extensions = sizeof(Int64_Extensions) / sizeof(Int64_Extensions[0]);
|
||||
|
||||
static const char* const Int16_Extensions[] = {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
E_GL_AMD_gpu_shader_int16,
|
||||
#endif
|
||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||
E_GL_EXT_shader_explicit_arithmetic_types_int16 };
|
||||
static const int Num_Int16_Extensions = sizeof(Int16_Extensions) / sizeof(Int16_Extensions[0]);
|
||||
|
|
@ -579,6 +584,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
ppToken->name[len++] = (char)ch;
|
||||
isUnsigned = true;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
int nextCh = getch();
|
||||
if (nextCh == 'l' || nextCh == 'L') {
|
||||
if (len < MaxTokenLength)
|
||||
|
|
@ -587,7 +593,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
} else
|
||||
ungetch();
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
nextCh = getch();
|
||||
if ((nextCh == 's' || nextCh == 'S') &&
|
||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
|
|
@ -596,12 +601,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
isInt16 = true;
|
||||
} else
|
||||
ungetch();
|
||||
#endif
|
||||
} else if (ch == 'l' || ch == 'L') {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if ((ch == 's' || ch == 'S') &&
|
||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
if (len < MaxTokenLength)
|
||||
|
|
@ -689,6 +692,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
ppToken->name[len++] = (char)ch;
|
||||
isUnsigned = true;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
int nextCh = getch();
|
||||
if (nextCh == 'l' || nextCh == 'L') {
|
||||
if (len < MaxTokenLength)
|
||||
|
|
@ -697,7 +701,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
} else
|
||||
ungetch();
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
nextCh = getch();
|
||||
if ((nextCh == 's' || nextCh == 'S') &&
|
||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
|
|
@ -706,12 +709,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
isInt16 = true;
|
||||
} else
|
||||
ungetch();
|
||||
#endif
|
||||
} else if (ch == 'l' || ch == 'L') {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if ((ch == 's' || ch == 'S') &&
|
||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
if (len < MaxTokenLength)
|
||||
|
|
@ -780,6 +781,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
ppToken->name[len++] = (char)ch;
|
||||
isUnsigned = true;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
int nextCh = getch();
|
||||
if (nextCh == 'l' || nextCh == 'L') {
|
||||
if (len < MaxTokenLength)
|
||||
|
|
@ -788,7 +790,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
} else
|
||||
ungetch();
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
nextCh = getch();
|
||||
if ((nextCh == 's' || nextCh == 'S') &&
|
||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
|
|
@ -797,12 +798,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
isInt16 = true;
|
||||
} else
|
||||
ungetch();
|
||||
#endif
|
||||
} else if (ch == 'l' || ch == 'L') {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if ((ch == 's' || ch == 'S') &&
|
||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
if (len < MaxTokenLength)
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
|
|||
int atom = stream[currentPos++].get(*ppToken);
|
||||
ppToken->loc = parseContext.getCurrentLoc();
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Check for ##, unless the current # is the last character
|
||||
if (atom == '#') {
|
||||
if (peekToken('#')) {
|
||||
|
|
@ -125,6 +126,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
|
|||
atom = PpAtomPaste;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return atom;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
// propagate the 'noContraction' qualifier.
|
||||
//
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#include "propagateNoContraction.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
|
@ -79,7 +81,7 @@ typedef std::unordered_set<glslang::TIntermBranch*> ReturnBranchNodeSet;
|
|||
// the node has 'noContraction' qualifier, otherwise false.
|
||||
bool isPreciseObjectNode(glslang::TIntermTyped* node)
|
||||
{
|
||||
return node->getType().getQualifier().noContraction;
|
||||
return node->getType().getQualifier().isNoContraction();
|
||||
}
|
||||
|
||||
// Returns true if the opcode is a dereferencing one.
|
||||
|
|
@ -864,3 +866,5 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate)
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
|
@ -33,6 +33,8 @@
|
|||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#include "../Include/Common.h"
|
||||
#include "reflection.h"
|
||||
#include "LiveTraverser.h"
|
||||
|
|
@ -396,7 +398,7 @@ public:
|
|||
topLevelArrayStride = variables.back().arrayStride;
|
||||
}
|
||||
|
||||
if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->getBasicType() == EbtAtomicUint)
|
||||
if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->isAtomic())
|
||||
reflection.atomicCounterUniformIndices.push_back(uniformIndex);
|
||||
|
||||
variables.back().topLevelArrayStride = topLevelArrayStride;
|
||||
|
|
@ -701,7 +703,6 @@ public:
|
|||
case EsdBuffer:
|
||||
return GL_SAMPLER_BUFFER;
|
||||
}
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtFloat16:
|
||||
switch ((int)sampler.dim) {
|
||||
case Esd1D:
|
||||
|
|
@ -730,7 +731,6 @@ public:
|
|||
case EsdBuffer:
|
||||
return GL_FLOAT16_SAMPLER_BUFFER_AMD;
|
||||
}
|
||||
#endif
|
||||
case EbtInt:
|
||||
switch ((int)sampler.dim) {
|
||||
case Esd1D:
|
||||
|
|
@ -793,7 +793,6 @@ public:
|
|||
case EsdBuffer:
|
||||
return GL_IMAGE_BUFFER;
|
||||
}
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtFloat16:
|
||||
switch ((int)sampler.dim) {
|
||||
case Esd1D:
|
||||
|
|
@ -812,7 +811,6 @@ public:
|
|||
case EsdBuffer:
|
||||
return GL_FLOAT16_IMAGE_BUFFER_AMD;
|
||||
}
|
||||
#endif
|
||||
case EbtInt:
|
||||
switch ((int)sampler.dim) {
|
||||
case Esd1D:
|
||||
|
|
@ -878,9 +876,7 @@ public:
|
|||
switch (type.getBasicType()) {
|
||||
case EbtFloat: return GL_FLOAT_VEC2 + offset;
|
||||
case EbtDouble: return GL_DOUBLE_VEC2 + offset;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtFloat16: return GL_FLOAT16_VEC2_NV + offset;
|
||||
#endif
|
||||
case EbtInt: return GL_INT_VEC2 + offset;
|
||||
case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset;
|
||||
case EbtInt64: return GL_INT64_ARB + offset;
|
||||
|
|
@ -940,7 +936,6 @@ public:
|
|||
default: return 0;
|
||||
}
|
||||
}
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtFloat16:
|
||||
switch (type.getMatrixCols()) {
|
||||
case 2:
|
||||
|
|
@ -965,7 +960,6 @@ public:
|
|||
default: return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -974,9 +968,7 @@ public:
|
|||
switch (type.getBasicType()) {
|
||||
case EbtFloat: return GL_FLOAT;
|
||||
case EbtDouble: return GL_DOUBLE;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtFloat16: return GL_FLOAT16_NV;
|
||||
#endif
|
||||
case EbtInt: return GL_INT;
|
||||
case EbtUint: return GL_UNSIGNED_INT;
|
||||
case EbtInt64: return GL_INT64_ARB;
|
||||
|
|
@ -1093,6 +1085,7 @@ void TReflection::buildAttributeReflection(EShLanguage stage, const TIntermediat
|
|||
// build counter block index associations for buffers
|
||||
void TReflection::buildCounterIndices(const TIntermediate& intermediate)
|
||||
{
|
||||
#ifdef ENABLE_HLSL
|
||||
// search for ones that have counters
|
||||
for (int i = 0; i < int(indexToUniformBlock.size()); ++i) {
|
||||
const TString counterName(intermediate.addCounterBufferName(indexToUniformBlock[i].name).c_str());
|
||||
|
|
@ -1101,6 +1094,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
|
|||
if (index >= 0)
|
||||
indexToUniformBlock[i].counterIndex = index;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// build Shader Stages mask for all uniforms
|
||||
|
|
@ -1198,3 +1192,5 @@ void TReflection::dump()
|
|||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
#ifndef _REFLECTION_INCLUDED
|
||||
#define _REFLECTION_INCLUDED
|
||||
|
||||
|
|
@ -201,3 +203,5 @@ protected:
|
|||
} // end namespace glslang
|
||||
|
||||
#endif // _REFLECTION_INCLUDED
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
|
@ -432,8 +432,10 @@ public:
|
|||
void addUniformLocationOverride(const char* name, int loc);
|
||||
void setUniformLocationBase(int base);
|
||||
void setInvertY(bool invert);
|
||||
#ifdef ENABLE_HLSL
|
||||
void setHlslIoMapping(bool hlslIoMap);
|
||||
void setFlattenUniformArrays(bool flatten);
|
||||
#endif
|
||||
void setNoStorageFormat(bool useUnknownFormat);
|
||||
void setNanMinMaxClamp(bool nanMinMaxClamp);
|
||||
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode);
|
||||
|
|
@ -459,8 +461,12 @@ public:
|
|||
environment.target.language = lang;
|
||||
environment.target.version = version;
|
||||
}
|
||||
#ifdef ENABLE_HLSL
|
||||
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
|
||||
bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
|
||||
#else
|
||||
bool getEnvTargetHlslFunctionality1() const { return false; }
|
||||
#endif
|
||||
|
||||
// Interface to #include handlers.
|
||||
//
|
||||
|
|
@ -611,6 +617,8 @@ private:
|
|||
TShader& operator=(TShader&);
|
||||
};
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
//
|
||||
// A reflection database and its interface, consistent with the OpenGL API reflection queries.
|
||||
//
|
||||
|
|
@ -726,6 +734,8 @@ public:
|
|||
virtual void addStage(EShLanguage stage) = 0;
|
||||
};
|
||||
|
||||
#endif // GLSLANG_WEB
|
||||
|
||||
// Make one TProgram per set of shaders that will get linked together. Add all
|
||||
// the shaders that are to be linked together. After calling shader.parse()
|
||||
// for all shaders, call link().
|
||||
|
|
@ -745,14 +755,14 @@ public:
|
|||
|
||||
TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
|
||||
// Reflection Interface
|
||||
|
||||
// call first, to do liveness analysis, index mapping, etc.; returns false on failure
|
||||
bool buildReflection(int opts = EShReflectionDefault);
|
||||
|
||||
unsigned getLocalSize(int dim) const; // return dim'th local size
|
||||
int getReflectionIndex(const char *name) const;
|
||||
|
||||
int getNumUniformVariables() const;
|
||||
const TObjectReflection& getUniform(int index) const;
|
||||
int getNumUniformBlocks() const;
|
||||
|
|
@ -831,11 +841,11 @@ public:
|
|||
const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); }
|
||||
|
||||
void dumpReflection();
|
||||
|
||||
// I/O mapping: apply base offsets and map live unbound variables
|
||||
// If resolver is not provided it uses the previous approach
|
||||
// and respects auto assignment and offsets.
|
||||
bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool linkStage(EShLanguage, EShMessages);
|
||||
|
|
@ -845,7 +855,9 @@ protected:
|
|||
TIntermediate* intermediate[EShLangCount];
|
||||
bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage
|
||||
TInfoSink* infoSink;
|
||||
#ifndef GLSLANG_WEB
|
||||
TReflection* reflection;
|
||||
#endif
|
||||
bool linked;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/usr/bin/bash
|
||||
|
||||
if [ "$1" = 'web' ]
|
||||
then
|
||||
m4 -P -DGLSLANG_WEB MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
|
||||
elif [ "$#" -eq 0 ]
|
||||
then
|
||||
m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
|
||||
else
|
||||
echo usage:
|
||||
echo $0 web
|
||||
echo $0
|
||||
exit
|
||||
fi
|
||||
|
||||
bison --defines=MachineIndependent/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o MachineIndependent/glslang_tab.cpp
|
||||
|
|
|
|||
|
|
@ -41,9 +41,7 @@ namespace {
|
|||
|
||||
using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
using CompileToAstTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
#endif
|
||||
|
||||
TEST_P(CompileToAstTest, FromFile)
|
||||
{
|
||||
|
|
@ -52,7 +50,6 @@ TEST_P(CompileToAstTest, FromFile)
|
|||
Target::AST);
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
// Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled).
|
||||
TEST_P(CompileToAstTestNV, FromFile)
|
||||
{
|
||||
|
|
@ -60,7 +57,6 @@ TEST_P(CompileToAstTestNV, FromFile)
|
|||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::AST);
|
||||
}
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
|
|
@ -281,7 +277,6 @@ INSTANTIATE_TEST_CASE_P(
|
|||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
Glsl, CompileToAstTestNV,
|
||||
::testing::ValuesIn(std::vector<std::string>({
|
||||
|
|
@ -289,7 +284,6 @@ INSTANTIATE_TEST_CASE_P(
|
|||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
} // anonymous namespace
|
||||
|
|
|
|||
|
|
@ -72,12 +72,8 @@ using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
|||
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
||||
using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
#endif
|
||||
using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||
|
||||
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
|
||||
|
|
@ -179,7 +175,6 @@ TEST_P(GlslIoMap, FromFile)
|
|||
GetParam().flattenUniforms);
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
|
||||
// Expected to successfully generate SPIR-V.
|
||||
TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
|
||||
|
|
@ -188,9 +183,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
|
|||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
// Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
|
||||
// Expected to successfully generate SPIR-V.
|
||||
TEST_P(CompileVulkanToSpirvTestNV, FromFile)
|
||||
|
|
@ -199,7 +192,6 @@ TEST_P(CompileVulkanToSpirvTestNV, FromFile)
|
|||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
|
||||
{
|
||||
|
|
@ -572,7 +564,6 @@ INSTANTIATE_TEST_CASE_P(
|
|||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
Glsl, CompileVulkanToSpirvTestAMD,
|
||||
::testing::ValuesIn(std::vector<std::string>({
|
||||
|
|
@ -588,9 +579,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
Glsl, CompileVulkanToSpirvTestNV,
|
||||
::testing::ValuesIn(std::vector<std::string>({
|
||||
|
|
@ -638,7 +627,6 @@ INSTANTIATE_TEST_CASE_P(
|
|||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
#endif
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ EShLanguage GetShaderStage(const std::string& stage)
|
|||
return EShLangFragment;
|
||||
} else if (stage == "comp") {
|
||||
return EShLangCompute;
|
||||
#ifdef NV_EXTENSIONS
|
||||
} else if (stage == "rgen") {
|
||||
return EShLangRayGenNV;
|
||||
} else if (stage == "rint") {
|
||||
|
|
@ -77,7 +76,6 @@ EShLanguage GetShaderStage(const std::string& stage)
|
|||
return EShLangTaskNV;
|
||||
} else if (stage == "mesh") {
|
||||
return EShLangMeshNV;
|
||||
#endif
|
||||
} else {
|
||||
assert(0 && "Unknown shader stage");
|
||||
return EShLangCount;
|
||||
|
|
|
|||
|
|
@ -227,7 +227,9 @@ public:
|
|||
shader.setAutoMapBindings(true);
|
||||
}
|
||||
shader.setTextureSamplerTransformMode(texSampTransMode);
|
||||
#ifdef ENABLE_HLSL
|
||||
shader.setFlattenUniformArrays(flattenUniformArrays);
|
||||
#endif
|
||||
|
||||
if (controls & EShMsgSpvRules) {
|
||||
if (controls & EShMsgVulkanRules) {
|
||||
|
|
@ -300,7 +302,9 @@ public:
|
|||
shader.setShiftSsboBinding(baseSsboBinding);
|
||||
shader.setAutoMapBindings(autoMapBindings);
|
||||
shader.setAutoMapLocations(true);
|
||||
#ifdef ENABLE_HLSL
|
||||
shader.setFlattenUniformArrays(flattenUniformArrays);
|
||||
#endif
|
||||
|
||||
bool success = compile(&shader, code, entryPointName, controls);
|
||||
|
||||
|
|
@ -308,7 +312,9 @@ public:
|
|||
program.addShader(&shader);
|
||||
|
||||
success &= program.link(controls);
|
||||
#ifndef GLSLANG_WEB
|
||||
success &= program.mapIO();
|
||||
#endif
|
||||
|
||||
spv::SpvBuildLogger logger;
|
||||
|
||||
|
|
|
|||
|
|
@ -8703,25 +8703,19 @@ void HlslParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
|
|||
for (unsigned int member = 0; member < typeList.size(); ++member) {
|
||||
TQualifier& memberQualifier = typeList[member].type->getQualifier();
|
||||
bool contains64BitType = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool contains32BitType = false;
|
||||
bool contains16BitType = false;
|
||||
int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType, contains32BitType, contains16BitType);
|
||||
#else
|
||||
int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType);
|
||||
#endif
|
||||
// see if we need to auto-assign an offset to this member
|
||||
if (! memberQualifier.hasXfbOffset()) {
|
||||
// "if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8"
|
||||
if (contains64BitType)
|
||||
RoundToPow2(nextOffset, 8);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (contains32BitType)
|
||||
RoundToPow2(nextOffset, 4);
|
||||
// "if applied to an aggregate containing a half float or 16-bit integer, the offset must also be a multiple of 2"
|
||||
else if (contains16BitType)
|
||||
RoundToPow2(nextOffset, 2);
|
||||
#endif
|
||||
memberQualifier.layoutXfbOffset = nextOffset;
|
||||
} else
|
||||
nextOffset = memberQualifier.layoutXfbOffset;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue