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()
|
endif()
|
||||||
option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON)
|
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_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_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_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)
|
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
|
# make testing optional
|
||||||
include(CTest)
|
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)
|
if(ENABLE_HLSL)
|
||||||
add_definitions(-DENABLE_HLSL)
|
add_definitions(-DENABLE_HLSL)
|
||||||
endif(ENABLE_HLSL)
|
endif(ENABLE_HLSL)
|
||||||
|
|
||||||
|
if(ENABLE_GLSLANG_WEB)
|
||||||
|
add_definitions(-DGLSLANG_WEB)
|
||||||
|
endif(ENABLE_GLSLANG_WEB)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CMAKE_DEBUG_POSTFIX "d")
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
if(MSVC)
|
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:
|
The command to rebuild is:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
|
||||||
bison --defines=MachineIndependent/glslang_tab.cpp.h
|
bison --defines=MachineIndependent/glslang_tab.cpp.h
|
||||||
-t MachineIndependent/glslang.y
|
-t MachineIndependent/glslang.y
|
||||||
-o MachineIndependent/glslang_tab.cpp
|
-o MachineIndependent/glslang_tab.cpp
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command is also available in the bash script at
|
The above commands are also available in the bash script in `updateGrammar`,
|
||||||
`glslang/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
|
### WASM for the the Web
|
||||||
|
|
||||||
Use the steps in [Build Steps](#build-steps), which following notes/exceptions:
|
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
|
* `emsdk` needs to be present in your executable search path, *PATH* for
|
||||||
Bash-like enivironments
|
Bash-like enivironments
|
||||||
+ Instructions located
|
+ Instructions located
|
||||||
|
|
|
||||||
|
|
@ -25,24 +25,14 @@ set(HEADERS
|
||||||
spvIR.h
|
spvIR.h
|
||||||
doc.h
|
doc.h
|
||||||
SpvTools.h
|
SpvTools.h
|
||||||
disassemble.h)
|
disassemble.h
|
||||||
|
GLSL.ext.AMD.h
|
||||||
|
GLSL.ext.NV.h)
|
||||||
|
|
||||||
set(SPVREMAP_HEADERS
|
set(SPVREMAP_HEADERS
|
||||||
SPVRemapper.h
|
SPVRemapper.h
|
||||||
doc.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})
|
add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
|
||||||
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
|
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
|
||||||
set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
|
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
|
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
@ -66,3 +68,5 @@ std::string SpvBuildLogger::getAllMessages() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end spv namespace
|
} // end spv namespace
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -46,6 +46,14 @@ class SpvBuildLogger {
|
||||||
public:
|
public:
|
||||||
SpvBuildLogger() {}
|
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.
|
// Registers a TBD functionality.
|
||||||
void tbdFunctionality(const std::string& f);
|
void tbdFunctionality(const std::string& f);
|
||||||
// Registers a missing functionality.
|
// Registers a missing functionality.
|
||||||
|
|
@ -59,6 +67,7 @@ public:
|
||||||
// Returns all messages accumulated in the order of:
|
// Returns all messages accumulated in the order of:
|
||||||
// TBD functionalities, missing functionalities, warnings, errors.
|
// TBD functionalities, missing functionalities, warnings, errors.
|
||||||
std::string getAllMessages() const;
|
std::string getAllMessages() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SpvBuildLogger(const SpvBuildLogger&);
|
SpvBuildLogger(const SpvBuildLogger&);
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,9 @@
|
||||||
|
|
||||||
#include "SpvBuilder.h"
|
#include "SpvBuilder.h"
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
#include "hex_float.h"
|
#include "hex_float.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
@ -230,6 +232,11 @@ Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardP
|
||||||
|
|
||||||
Id Builder::makeIntegerType(int width, bool hasSign)
|
Id Builder::makeIntegerType(int width, bool hasSign)
|
||||||
{
|
{
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
assert(width == 32);
|
||||||
|
width = 32;
|
||||||
|
#endif
|
||||||
|
|
||||||
// try to find it
|
// try to find it
|
||||||
Instruction* type;
|
Instruction* type;
|
||||||
for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) {
|
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)
|
Id Builder::makeFloatType(int width)
|
||||||
{
|
{
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
assert(width == 32);
|
||||||
|
width = 32;
|
||||||
|
#endif
|
||||||
|
|
||||||
// try to find it
|
// try to find it
|
||||||
Instruction* type;
|
Instruction* type;
|
||||||
for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) {
|
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));
|
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||||
module.mapInstruction(type);
|
module.mapInstruction(type);
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// deal with capabilities
|
// deal with capabilities
|
||||||
switch (dim) {
|
switch (dim) {
|
||||||
case DimBuffer:
|
case DimBuffer:
|
||||||
|
|
@ -561,6 +574,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
||||||
addCapability(CapabilityImageMSArray);
|
addCapability(CapabilityImageMSArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return type->getResultId();
|
return type->getResultId();
|
||||||
}
|
}
|
||||||
|
|
@ -586,7 +600,7 @@ Id Builder::makeSampledImageType(Id imageType)
|
||||||
return type->getResultId();
|
return type->getResultId();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
#ifndef GLSLANG_WEB
|
||||||
Id Builder::makeAccelerationStructureNVType()
|
Id Builder::makeAccelerationStructureNVType()
|
||||||
{
|
{
|
||||||
Instruction *type;
|
Instruction *type;
|
||||||
|
|
@ -602,6 +616,7 @@ Id Builder::makeAccelerationStructureNVType()
|
||||||
return type->getResultId();
|
return type->getResultId();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Id Builder::getDerefTypeId(Id resultId) const
|
Id Builder::getDerefTypeId(Id resultId) const
|
||||||
{
|
{
|
||||||
Id typeId = getTypeId(resultId);
|
Id typeId = getTypeId(resultId);
|
||||||
|
|
@ -939,6 +954,10 @@ Id Builder::makeFloatConstant(float f, bool specConstant)
|
||||||
|
|
||||||
Id Builder::makeDoubleConstant(double d, bool specConstant)
|
Id Builder::makeDoubleConstant(double d, bool specConstant)
|
||||||
{
|
{
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
assert(0);
|
||||||
|
return NoResult;
|
||||||
|
#else
|
||||||
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
||||||
Id typeId = makeFloatType(64);
|
Id typeId = makeFloatType(64);
|
||||||
union { double db; unsigned long long ull; } u;
|
union { double db; unsigned long long ull; } u;
|
||||||
|
|
@ -963,10 +982,15 @@ Id Builder::makeDoubleConstant(double d, bool specConstant)
|
||||||
module.mapInstruction(c);
|
module.mapInstruction(c);
|
||||||
|
|
||||||
return c->getResultId();
|
return c->getResultId();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
||||||
{
|
{
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
assert(0);
|
||||||
|
return NoResult;
|
||||||
|
#else
|
||||||
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
||||||
Id typeId = makeFloatType(16);
|
Id typeId = makeFloatType(16);
|
||||||
|
|
||||||
|
|
@ -991,25 +1015,33 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
||||||
module.mapInstruction(c);
|
module.mapInstruction(c);
|
||||||
|
|
||||||
return c->getResultId();
|
return c->getResultId();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Id Builder::makeFpConstant(Id type, double d, bool specConstant)
|
Id Builder::makeFpConstant(Id type, double d, bool specConstant)
|
||||||
{
|
{
|
||||||
assert(isFloatType(type));
|
#ifdef GLSLANG_WEB
|
||||||
|
const int width = 32;
|
||||||
|
assert(width == getScalarTypeWidth(type));
|
||||||
|
#else
|
||||||
|
const int width = getScalarTypeWidth(type);
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (getScalarTypeWidth(type)) {
|
assert(isFloatType(type));
|
||||||
case 16:
|
|
||||||
return makeFloat16Constant((float)d, specConstant);
|
|
||||||
case 32:
|
|
||||||
return makeFloatConstant((float)d, specConstant);
|
|
||||||
case 64:
|
|
||||||
return makeDoubleConstant(d, specConstant);
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(false);
|
switch (width) {
|
||||||
return NoResult;
|
case 16:
|
||||||
|
return makeFloat16Constant((float)d, specConstant);
|
||||||
|
case 32:
|
||||||
|
return makeFloatConstant((float)d, specConstant);
|
||||||
|
case 64:
|
||||||
|
return makeDoubleConstant(d, specConstant);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(false);
|
||||||
|
return NoResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps)
|
Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps)
|
||||||
|
|
@ -1825,7 +1857,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||||
if (parameters.component != NoResult)
|
if (parameters.component != NoResult)
|
||||||
texArgs[numArgs++] = parameters.component;
|
texArgs[numArgs++] = parameters.component;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
#ifndef GLSLANG_WEB
|
||||||
if (parameters.granularity != NoResult)
|
if (parameters.granularity != NoResult)
|
||||||
texArgs[numArgs++] = parameters.granularity;
|
texArgs[numArgs++] = parameters.granularity;
|
||||||
if (parameters.coarse != NoResult)
|
if (parameters.coarse != NoResult)
|
||||||
|
|
@ -1872,6 +1904,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||||
mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask);
|
mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask);
|
||||||
texArgs[numArgs++] = parameters.offsets;
|
texArgs[numArgs++] = parameters.offsets;
|
||||||
}
|
}
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (parameters.sample) {
|
if (parameters.sample) {
|
||||||
mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask);
|
mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask);
|
||||||
texArgs[numArgs++] = parameters.sample;
|
texArgs[numArgs++] = parameters.sample;
|
||||||
|
|
@ -1889,6 +1922,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||||
if (parameters.volatil) {
|
if (parameters.volatil) {
|
||||||
mask = mask | ImageOperandsVolatileTexelKHRMask;
|
mask = mask | ImageOperandsVolatileTexelKHRMask;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
mask = mask | signExtensionMask;
|
mask = mask | signExtensionMask;
|
||||||
if (mask == ImageOperandsMaskNone)
|
if (mask == ImageOperandsMaskNone)
|
||||||
--numArgs; // undo speculative reservation for the mask argument
|
--numArgs; // undo speculative reservation for the mask argument
|
||||||
|
|
@ -1904,10 +1938,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||||
opCode = OpImageSparseFetch;
|
opCode = OpImageSparseFetch;
|
||||||
else
|
else
|
||||||
opCode = OpImageFetch;
|
opCode = OpImageFetch;
|
||||||
#ifdef NV_EXTENSIONS
|
#ifndef GLSLANG_WEB
|
||||||
} else if (parameters.granularity && parameters.coarse) {
|
} else if (parameters.granularity && parameters.coarse) {
|
||||||
opCode = OpImageSampleFootprintNV;
|
opCode = OpImageSampleFootprintNV;
|
||||||
#endif
|
|
||||||
} else if (gather) {
|
} else if (gather) {
|
||||||
if (parameters.Dref)
|
if (parameters.Dref)
|
||||||
if (sparse)
|
if (sparse)
|
||||||
|
|
@ -1919,6 +1952,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||||
opCode = OpImageSparseGather;
|
opCode = OpImageSparseGather;
|
||||||
else
|
else
|
||||||
opCode = OpImageGather;
|
opCode = OpImageGather;
|
||||||
|
#endif
|
||||||
} else if (explicitLod) {
|
} else if (explicitLod) {
|
||||||
if (parameters.Dref) {
|
if (parameters.Dref) {
|
||||||
if (proj)
|
if (proj)
|
||||||
|
|
@ -2067,11 +2101,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OpImageQueryLod:
|
case OpImageQueryLod:
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
resultType = makeVectorType(getScalarTypeId(getTypeId(parameters.coords)), 2);
|
resultType = makeVectorType(getScalarTypeId(getTypeId(parameters.coords)), 2);
|
||||||
#else
|
|
||||||
resultType = makeVectorType(makeFloatType(32), 2);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case OpImageQueryLevels:
|
case OpImageQueryLevels:
|
||||||
case OpImageQuerySamples:
|
case OpImageQuerySamples:
|
||||||
|
|
@ -2089,6 +2119,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
|
||||||
if (parameters.lod)
|
if (parameters.lod)
|
||||||
query->addIdOperand(parameters.lod);
|
query->addIdOperand(parameters.lod);
|
||||||
buildPoint->addInstruction(std::unique_ptr<Instruction>(query));
|
buildPoint->addInstruction(std::unique_ptr<Instruction>(query));
|
||||||
|
addCapability(CapabilityImageQuery);
|
||||||
|
|
||||||
return query->getResultId();
|
return query->getResultId();
|
||||||
}
|
}
|
||||||
|
|
@ -2282,7 +2313,12 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
|
||||||
int numRows = getTypeNumRows(resultTypeId);
|
int numRows = getTypeNumRows(resultTypeId);
|
||||||
|
|
||||||
Instruction* instr = module.getInstruction(componentTypeId);
|
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
|
// Optimize matrix constructed from a bigger matrix
|
||||||
if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) {
|
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 isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; }
|
||||||
bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; }
|
bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; }
|
||||||
bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; }
|
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; }
|
bool isCooperativeMatrixType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeMatrixNV; }
|
||||||
|
#endif
|
||||||
bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
|
bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
|
||||||
bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
|
bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
|
||||||
bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; }
|
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.
|
// Accumulate whether anything in the chain of structures has coherent decorations.
|
||||||
struct CoherentFlags {
|
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 coherent : 1;
|
||||||
unsigned devicecoherent : 1;
|
unsigned devicecoherent : 1;
|
||||||
unsigned queuefamilycoherent : 1;
|
unsigned queuefamilycoherent : 1;
|
||||||
|
|
@ -577,7 +589,6 @@ public:
|
||||||
isImage = 0;
|
isImage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoherentFlags() { clear(); }
|
|
||||||
CoherentFlags operator |=(const CoherentFlags &other) {
|
CoherentFlags operator |=(const CoherentFlags &other) {
|
||||||
coherent |= other.coherent;
|
coherent |= other.coherent;
|
||||||
devicecoherent |= other.devicecoherent;
|
devicecoherent |= other.devicecoherent;
|
||||||
|
|
@ -589,6 +600,7 @@ public:
|
||||||
isImage |= other.isImage;
|
isImage |= other.isImage;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
CoherentFlags coherentFlags;
|
CoherentFlags coherentFlags;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,8 @@ namespace spv {
|
||||||
#include "GLSL.std.450.h"
|
#include "GLSL.std.450.h"
|
||||||
#include "GLSL.ext.KHR.h"
|
#include "GLSL.ext.KHR.h"
|
||||||
#include "GLSL.ext.EXT.h"
|
#include "GLSL.ext.EXT.h"
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
#include "GLSL.ext.AMD.h"
|
#include "GLSL.ext.AMD.h"
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
#include "GLSL.ext.NV.h"
|
#include "GLSL.ext.NV.h"
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace spv {
|
namespace spv {
|
||||||
|
|
@ -160,7 +156,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OpExtInst:
|
case OpExtInst:
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
switch (inst.getImmediateOperand(1)) {
|
switch (inst.getImmediateOperand(1)) {
|
||||||
case GLSLstd450Frexp:
|
case GLSLstd450Frexp:
|
||||||
case GLSLstd450FrexpStruct:
|
case GLSLstd450FrexpStruct:
|
||||||
|
|
@ -176,7 +171,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (basicTypeOp == OpTypeFloat && width == 16)
|
if (basicTypeOp == OpTypeFloat && width == 16)
|
||||||
|
|
@ -222,12 +216,10 @@ void Builder::postProcess(Instruction& inst)
|
||||||
addCapability(CapabilityImageQuery);
|
addCapability(CapabilityImageQuery);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case OpGroupNonUniformPartitionNV:
|
case OpGroupNonUniformPartitionNV:
|
||||||
addExtension(E_SPV_NV_shader_subgroup_partitioned);
|
addExtension(E_SPV_NV_shader_subgroup_partitioned);
|
||||||
addCapability(CapabilityGroupNonUniformPartitionedNV);
|
addCapability(CapabilityGroupNonUniformPartitionedNV);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case OpLoad:
|
case OpLoad:
|
||||||
case OpStore:
|
case OpStore:
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,10 @@
|
||||||
#ifndef GLSLANG_SPV_TOOLS_H
|
#ifndef GLSLANG_SPV_TOOLS_H
|
||||||
#define GLSLANG_SPV_TOOLS_H
|
#define GLSLANG_SPV_TOOLS_H
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPT
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../glslang/MachineIndependent/localintermediate.h"
|
#include "../glslang/MachineIndependent/localintermediate.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
@ -59,7 +61,7 @@ struct SpvOptions {
|
||||||
bool validate;
|
bool validate;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_OPT
|
#ifdef ENABLE_OPT
|
||||||
|
|
||||||
// Use the SPIRV-Tools disassembler to print SPIR-V.
|
// Use the SPIRV-Tools disassembler to print SPIR-V.
|
||||||
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
|
void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);
|
||||||
|
|
|
||||||
|
|
@ -52,26 +52,16 @@ namespace spv {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// Include C-based headers that don't have a namespace
|
// Include C-based headers that don't have a namespace
|
||||||
#include "GLSL.std.450.h"
|
#include "GLSL.std.450.h"
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
#include "GLSL.ext.AMD.h"
|
#include "GLSL.ext.AMD.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
#include "GLSL.ext.NV.h"
|
#include "GLSL.ext.NV.h"
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
|
const char* GlslStd450DebugNames[spv::GLSLstd450Count];
|
||||||
|
|
||||||
namespace spv {
|
namespace spv {
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
|
static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
static const char* GLSLextNVGetDebugNames(const char*, unsigned);
|
static const char* GLSLextNVGetDebugNames(const char*, unsigned);
|
||||||
#endif
|
|
||||||
|
|
||||||
static void Kill(std::ostream& out, const char* message)
|
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
|
// used to identify the extended instruction library imported when printing
|
||||||
enum ExtInstSet {
|
enum ExtInstSet {
|
||||||
GLSL450Inst,
|
GLSL450Inst,
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
GLSLextAMDInst,
|
GLSLextAMDInst,
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
GLSLextNVInst,
|
GLSLextNVInst,
|
||||||
#endif
|
|
||||||
|
|
||||||
OpenCLExtInst,
|
OpenCLExtInst,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -499,37 +482,29 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
||||||
const char* name = idDescriptor[stream[word - 2]].c_str();
|
const char* name = idDescriptor[stream[word - 2]].c_str();
|
||||||
if (0 == memcmp("OpenCL", name, 6)) {
|
if (0 == memcmp("OpenCL", name, 6)) {
|
||||||
extInstSet = OpenCLExtInst;
|
extInstSet = OpenCLExtInst;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
} else if (strcmp(spv::E_SPV_AMD_shader_ballot, name) == 0 ||
|
} 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_trinary_minmax, name) == 0 ||
|
||||||
strcmp(spv::E_SPV_AMD_shader_explicit_vertex_parameter, name) == 0 ||
|
strcmp(spv::E_SPV_AMD_shader_explicit_vertex_parameter, name) == 0 ||
|
||||||
strcmp(spv::E_SPV_AMD_gcn_shader, name) == 0) {
|
strcmp(spv::E_SPV_AMD_gcn_shader, name) == 0) {
|
||||||
extInstSet = GLSLextAMDInst;
|
extInstSet = GLSLextAMDInst;
|
||||||
#endif
|
} else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 ||
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
}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_geometry_shader_passthrough, name) == 0 ||
|
||||||
strcmp(spv::E_SPV_NV_viewport_array2, 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_NVX_multiview_per_view_attributes, name) == 0 ||
|
||||||
strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 ||
|
strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 ||
|
||||||
strcmp(spv::E_SPV_NV_mesh_shader, name) == 0) {
|
strcmp(spv::E_SPV_NV_mesh_shader, name) == 0) {
|
||||||
extInstSet = GLSLextNVInst;
|
extInstSet = GLSLextNVInst;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
unsigned entrypoint = stream[word - 1];
|
unsigned entrypoint = stream[word - 1];
|
||||||
if (extInstSet == GLSL450Inst) {
|
if (extInstSet == GLSL450Inst) {
|
||||||
if (entrypoint < GLSLstd450Count) {
|
if (entrypoint < GLSLstd450Count) {
|
||||||
out << "(" << GlslStd450DebugNames[entrypoint] << ")";
|
out << "(" << GlslStd450DebugNames[entrypoint] << ")";
|
||||||
}
|
}
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
} else if (extInstSet == GLSLextAMDInst) {
|
} else if (extInstSet == GLSLextAMDInst) {
|
||||||
out << "(" << GLSLextAMDGetDebugNames(name, entrypoint) << ")";
|
out << "(" << GLSLextAMDGetDebugNames(name, entrypoint) << ")";
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
}
|
}
|
||||||
else if (extInstSet == GLSLextNVInst) {
|
else if (extInstSet == GLSLextNVInst) {
|
||||||
out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")";
|
out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -653,7 +628,6 @@ static void GLSLstd450GetDebugNames(const char** names)
|
||||||
names[GLSLstd450NClamp] = "NClamp";
|
names[GLSLstd450NClamp] = "NClamp";
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint)
|
static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint)
|
||||||
{
|
{
|
||||||
if (strcmp(name, spv::E_SPV_AMD_shader_ballot) == 0) {
|
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";
|
return "Bad";
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
|
static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
|
||||||
{
|
{
|
||||||
if (strcmp(name, spv::E_SPV_NV_sample_mask_override_coverage) == 0 ||
|
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";
|
return "Bad";
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
|
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 C-based headers that don't have a namespace
|
||||||
#include "GLSL.ext.KHR.h"
|
#include "GLSL.ext.KHR.h"
|
||||||
#include "GLSL.ext.EXT.h"
|
#include "GLSL.ext.EXT.h"
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
#include "GLSL.ext.AMD.h"
|
#include "GLSL.ext.AMD.h"
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
#include "GLSL.ext.NV.h"
|
#include "GLSL.ext.NV.h"
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,22 +94,17 @@ const char* ExecutionModelString(int model)
|
||||||
case 4: return "Fragment";
|
case 4: return "Fragment";
|
||||||
case 5: return "GLCompute";
|
case 5: return "GLCompute";
|
||||||
case 6: return "Kernel";
|
case 6: return "Kernel";
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case ExecutionModelTaskNV: return "TaskNV";
|
case ExecutionModelTaskNV: return "TaskNV";
|
||||||
case ExecutionModelMeshNV: return "MeshNV";
|
case ExecutionModelMeshNV: return "MeshNV";
|
||||||
#endif
|
|
||||||
|
|
||||||
default: return "Bad";
|
default: return "Bad";
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case ExecutionModelRayGenerationNV: return "RayGenerationNV";
|
case ExecutionModelRayGenerationNV: return "RayGenerationNV";
|
||||||
case ExecutionModelIntersectionNV: return "IntersectionNV";
|
case ExecutionModelIntersectionNV: return "IntersectionNV";
|
||||||
case ExecutionModelAnyHitNV: return "AnyHitNV";
|
case ExecutionModelAnyHitNV: return "AnyHitNV";
|
||||||
case ExecutionModelClosestHitNV: return "ClosestHitNV";
|
case ExecutionModelClosestHitNV: return "ClosestHitNV";
|
||||||
case ExecutionModelMissNV: return "MissNV";
|
case ExecutionModelMissNV: return "MissNV";
|
||||||
case ExecutionModelCallableNV: return "CallableNV";
|
case ExecutionModelCallableNV: return "CallableNV";
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,13 +174,11 @@ const char* ExecutionModeString(int mode)
|
||||||
|
|
||||||
case 4446: return "PostDepthCoverage";
|
case 4446: return "PostDepthCoverage";
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case ExecutionModeOutputLinesNV: return "OutputLinesNV";
|
case ExecutionModeOutputLinesNV: return "OutputLinesNV";
|
||||||
case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV";
|
case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV";
|
||||||
case ExecutionModeOutputTrianglesNV: return "OutputTrianglesNV";
|
case ExecutionModeOutputTrianglesNV: return "OutputTrianglesNV";
|
||||||
case ExecutionModeDerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV";
|
case ExecutionModeDerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV";
|
||||||
case ExecutionModeDerivativeGroupLinearNV: return "DerivativeGroupLinearNV";
|
case ExecutionModeDerivativeGroupLinearNV: return "DerivativeGroupLinearNV";
|
||||||
#endif
|
|
||||||
|
|
||||||
case ExecutionModePixelInterlockOrderedEXT: return "PixelInterlockOrderedEXT";
|
case ExecutionModePixelInterlockOrderedEXT: return "PixelInterlockOrderedEXT";
|
||||||
case ExecutionModePixelInterlockUnorderedEXT: return "PixelInterlockUnorderedEXT";
|
case ExecutionModePixelInterlockUnorderedEXT: return "PixelInterlockUnorderedEXT";
|
||||||
|
|
@ -220,14 +209,12 @@ const char* StorageClassString(int StorageClass)
|
||||||
case 11: return "Image";
|
case 11: return "Image";
|
||||||
case 12: return "StorageBuffer";
|
case 12: return "StorageBuffer";
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case StorageClassRayPayloadNV: return "RayPayloadNV";
|
case StorageClassRayPayloadNV: return "RayPayloadNV";
|
||||||
case StorageClassHitAttributeNV: return "HitAttributeNV";
|
case StorageClassHitAttributeNV: return "HitAttributeNV";
|
||||||
case StorageClassIncomingRayPayloadNV: return "IncomingRayPayloadNV";
|
case StorageClassIncomingRayPayloadNV: return "IncomingRayPayloadNV";
|
||||||
case StorageClassShaderRecordBufferNV: return "ShaderRecordBufferNV";
|
case StorageClassShaderRecordBufferNV: return "ShaderRecordBufferNV";
|
||||||
case StorageClassCallableDataNV: return "CallableDataNV";
|
case StorageClassCallableDataNV: return "CallableDataNV";
|
||||||
case StorageClassIncomingCallableDataNV: return "IncomingCallableDataNV";
|
case StorageClassIncomingCallableDataNV: return "IncomingCallableDataNV";
|
||||||
#endif
|
|
||||||
|
|
||||||
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
|
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
|
||||||
|
|
||||||
|
|
@ -289,10 +276,7 @@ const char* DecorationString(int decoration)
|
||||||
case DecorationCeiling:
|
case DecorationCeiling:
|
||||||
default: return "Bad";
|
default: return "Bad";
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case DecorationExplicitInterpAMD: return "ExplicitInterpAMD";
|
case DecorationExplicitInterpAMD: return "ExplicitInterpAMD";
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case DecorationOverrideCoverageNV: return "OverrideCoverageNV";
|
case DecorationOverrideCoverageNV: return "OverrideCoverageNV";
|
||||||
case DecorationPassthroughNV: return "PassthroughNV";
|
case DecorationPassthroughNV: return "PassthroughNV";
|
||||||
case DecorationViewportRelativeNV: return "ViewportRelativeNV";
|
case DecorationViewportRelativeNV: return "ViewportRelativeNV";
|
||||||
|
|
@ -301,7 +285,6 @@ const char* DecorationString(int decoration)
|
||||||
case DecorationPerViewNV: return "PerViewNV";
|
case DecorationPerViewNV: return "PerViewNV";
|
||||||
case DecorationPerTaskNV: return "PerTaskNV";
|
case DecorationPerTaskNV: return "PerTaskNV";
|
||||||
case DecorationPerVertexNV: return "PerVertexNV";
|
case DecorationPerVertexNV: return "PerVertexNV";
|
||||||
#endif
|
|
||||||
|
|
||||||
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
|
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
|
||||||
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
|
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
|
||||||
|
|
@ -371,7 +354,6 @@ const char* BuiltInString(int builtIn)
|
||||||
case 4426: return "DrawIndex";
|
case 4426: return "DrawIndex";
|
||||||
case 5014: return "FragStencilRefEXT";
|
case 5014: return "FragStencilRefEXT";
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case 4992: return "BaryCoordNoPerspAMD";
|
case 4992: return "BaryCoordNoPerspAMD";
|
||||||
case 4993: return "BaryCoordNoPerspCentroidAMD";
|
case 4993: return "BaryCoordNoPerspCentroidAMD";
|
||||||
case 4994: return "BaryCoordNoPerspSampleAMD";
|
case 4994: return "BaryCoordNoPerspSampleAMD";
|
||||||
|
|
@ -379,9 +361,6 @@ const char* BuiltInString(int builtIn)
|
||||||
case 4996: return "BaryCoordSmoothCentroidAMD";
|
case 4996: return "BaryCoordSmoothCentroidAMD";
|
||||||
case 4997: return "BaryCoordSmoothSampleAMD";
|
case 4997: return "BaryCoordSmoothSampleAMD";
|
||||||
case 4998: return "BaryCoordPullModelAMD";
|
case 4998: return "BaryCoordPullModelAMD";
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case BuiltInLaunchIdNV: return "LaunchIdNV";
|
case BuiltInLaunchIdNV: return "LaunchIdNV";
|
||||||
case BuiltInLaunchSizeNV: return "LaunchSizeNV";
|
case BuiltInLaunchSizeNV: return "LaunchSizeNV";
|
||||||
case BuiltInWorldRayOriginNV: return "WorldRayOriginNV";
|
case BuiltInWorldRayOriginNV: return "WorldRayOriginNV";
|
||||||
|
|
@ -405,14 +384,12 @@ const char* BuiltInString(int builtIn)
|
||||||
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
|
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
|
||||||
case BuiltInBaryCoordNV: return "BaryCoordNV";
|
case BuiltInBaryCoordNV: return "BaryCoordNV";
|
||||||
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
|
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
|
||||||
#endif
|
|
||||||
|
|
||||||
case BuiltInFragSizeEXT: return "FragSizeEXT";
|
case BuiltInFragSizeEXT: return "FragSizeEXT";
|
||||||
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
|
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||||
|
|
||||||
case 5264: return "FullyCoveredEXT";
|
case 5264: return "FullyCoveredEXT";
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case BuiltInTaskCountNV: return "TaskCountNV";
|
case BuiltInTaskCountNV: return "TaskCountNV";
|
||||||
case BuiltInPrimitiveCountNV: return "PrimitiveCountNV";
|
case BuiltInPrimitiveCountNV: return "PrimitiveCountNV";
|
||||||
case BuiltInPrimitiveIndicesNV: return "PrimitiveIndicesNV";
|
case BuiltInPrimitiveIndicesNV: return "PrimitiveIndicesNV";
|
||||||
|
|
@ -421,7 +398,6 @@ const char* BuiltInString(int builtIn)
|
||||||
case BuiltInLayerPerViewNV: return "LayerPerViewNV";
|
case BuiltInLayerPerViewNV: return "LayerPerViewNV";
|
||||||
case BuiltInMeshViewCountNV: return "MeshViewCountNV";
|
case BuiltInMeshViewCountNV: return "MeshViewCountNV";
|
||||||
case BuiltInMeshViewIndicesNV: return "MeshViewIndicesNV";
|
case BuiltInMeshViewIndicesNV: return "MeshViewIndicesNV";
|
||||||
#endif
|
|
||||||
case BuiltInWarpsPerSMNV: return "WarpsPerSMNV";
|
case BuiltInWarpsPerSMNV: return "WarpsPerSMNV";
|
||||||
case BuiltInSMCountNV: return "SMCountNV";
|
case BuiltInSMCountNV: return "SMCountNV";
|
||||||
case BuiltInWarpIDNV: return "WarpIDNV";
|
case BuiltInWarpIDNV: return "WarpIDNV";
|
||||||
|
|
@ -780,11 +756,9 @@ const char* GroupOperationString(int gop)
|
||||||
case GroupOperationInclusiveScan: return "InclusiveScan";
|
case GroupOperationInclusiveScan: return "InclusiveScan";
|
||||||
case GroupOperationExclusiveScan: return "ExclusiveScan";
|
case GroupOperationExclusiveScan: return "ExclusiveScan";
|
||||||
case GroupOperationClusteredReduce: return "ClusteredReduce";
|
case GroupOperationClusteredReduce: return "ClusteredReduce";
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case GroupOperationPartitionedReduceNV: return "PartitionedReduceNV";
|
case GroupOperationPartitionedReduceNV: return "PartitionedReduceNV";
|
||||||
case GroupOperationPartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV";
|
case GroupOperationPartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV";
|
||||||
case GroupOperationPartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV";
|
case GroupOperationPartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV";
|
||||||
#endif
|
|
||||||
|
|
||||||
default: return "Bad";
|
default: return "Bad";
|
||||||
}
|
}
|
||||||
|
|
@ -901,17 +875,14 @@ const char* CapabilityString(int info)
|
||||||
|
|
||||||
case CapabilityStencilExportEXT: return "StencilExportEXT";
|
case CapabilityStencilExportEXT: return "StencilExportEXT";
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case CapabilityFloat16ImageAMD: return "Float16ImageAMD";
|
case CapabilityFloat16ImageAMD: return "Float16ImageAMD";
|
||||||
case CapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD";
|
case CapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD";
|
||||||
case CapabilityFragmentMaskAMD: return "FragmentMaskAMD";
|
case CapabilityFragmentMaskAMD: return "FragmentMaskAMD";
|
||||||
case CapabilityImageReadWriteLodAMD: return "ImageReadWriteLodAMD";
|
case CapabilityImageReadWriteLodAMD: return "ImageReadWriteLodAMD";
|
||||||
#endif
|
|
||||||
|
|
||||||
case CapabilityAtomicStorageOps: return "AtomicStorageOps";
|
case CapabilityAtomicStorageOps: return "AtomicStorageOps";
|
||||||
|
|
||||||
case CapabilitySampleMaskPostDepthCoverage: return "SampleMaskPostDepthCoverage";
|
case CapabilitySampleMaskPostDepthCoverage: return "SampleMaskPostDepthCoverage";
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV";
|
case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV";
|
||||||
case CapabilityShaderViewportIndexLayerNV: return "ShaderViewportIndexLayerNV";
|
case CapabilityShaderViewportIndexLayerNV: return "ShaderViewportIndexLayerNV";
|
||||||
case CapabilityShaderViewportMaskNV: return "ShaderViewportMaskNV";
|
case CapabilityShaderViewportMaskNV: return "ShaderViewportMaskNV";
|
||||||
|
|
@ -926,7 +897,6 @@ const char* CapabilityString(int info)
|
||||||
case CapabilityImageFootprintNV: return "ImageFootprintNV";
|
case CapabilityImageFootprintNV: return "ImageFootprintNV";
|
||||||
// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT
|
// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT
|
||||||
case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV";
|
case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV";
|
||||||
#endif
|
|
||||||
case CapabilityFragmentDensityEXT: return "FragmentDensityEXT";
|
case CapabilityFragmentDensityEXT: return "FragmentDensityEXT";
|
||||||
|
|
||||||
case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT";
|
case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT";
|
||||||
|
|
@ -1336,7 +1306,6 @@ const char* OpcodeString(int op)
|
||||||
case 4430: return "OpSubgroupAllEqualKHR";
|
case 4430: return "OpSubgroupAllEqualKHR";
|
||||||
case 4432: return "OpSubgroupReadInvocationKHR";
|
case 4432: return "OpSubgroupReadInvocationKHR";
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case 5000: return "OpGroupIAddNonUniformAMD";
|
case 5000: return "OpGroupIAddNonUniformAMD";
|
||||||
case 5001: return "OpGroupFAddNonUniformAMD";
|
case 5001: return "OpGroupFAddNonUniformAMD";
|
||||||
case 5002: return "OpGroupFMinNonUniformAMD";
|
case 5002: return "OpGroupFMinNonUniformAMD";
|
||||||
|
|
@ -1348,14 +1317,12 @@ const char* OpcodeString(int op)
|
||||||
|
|
||||||
case 5011: return "OpFragmentMaskFetchAMD";
|
case 5011: return "OpFragmentMaskFetchAMD";
|
||||||
case 5012: return "OpFragmentFetchAMD";
|
case 5012: return "OpFragmentFetchAMD";
|
||||||
#endif
|
|
||||||
|
|
||||||
case OpReadClockKHR: return "OpReadClockKHR";
|
case OpReadClockKHR: return "OpReadClockKHR";
|
||||||
|
|
||||||
case OpDecorateStringGOOGLE: return "OpDecorateStringGOOGLE";
|
case OpDecorateStringGOOGLE: return "OpDecorateStringGOOGLE";
|
||||||
case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
|
case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV";
|
case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV";
|
||||||
case OpReportIntersectionNV: return "OpReportIntersectionNV";
|
case OpReportIntersectionNV: return "OpReportIntersectionNV";
|
||||||
case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV";
|
case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV";
|
||||||
|
|
@ -1365,7 +1332,6 @@ const char* OpcodeString(int op)
|
||||||
case OpExecuteCallableNV: return "OpExecuteCallableNV";
|
case OpExecuteCallableNV: return "OpExecuteCallableNV";
|
||||||
case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV";
|
case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV";
|
||||||
case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV";
|
case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV";
|
||||||
#endif
|
|
||||||
|
|
||||||
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
|
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
|
||||||
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
|
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
|
||||||
|
|
@ -2685,7 +2651,6 @@ void Parameterize()
|
||||||
|
|
||||||
InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'");
|
InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'");
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'");
|
||||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
|
||||||
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'");
|
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'");
|
||||||
|
|
@ -2724,9 +2689,7 @@ void Parameterize()
|
||||||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'");
|
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'");
|
||||||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'");
|
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'");
|
||||||
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'");
|
InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'");
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X");
|
InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X");
|
||||||
|
|
||||||
InstructionDesc[OpTypeAccelerationStructureNV].setResultAndType(true, false);
|
InstructionDesc[OpTypeAccelerationStructureNV].setResultAndType(true, false);
|
||||||
|
|
@ -2764,7 +2727,6 @@ void Parameterize()
|
||||||
|
|
||||||
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'");
|
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'");
|
||||||
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'");
|
InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'");
|
||||||
#endif
|
|
||||||
|
|
||||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'");
|
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'");
|
||||||
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'");
|
InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'");
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,6 @@ std::string GetDefaultTBuiltInResourceString()
|
||||||
<< "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n"
|
<< "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n"
|
||||||
<< "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
|
<< "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
|
||||||
<< "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n"
|
<< "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n"
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
<< "MaxMeshOutputVerticesNV " << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n"
|
<< "MaxMeshOutputVerticesNV " << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n"
|
||||||
<< "MaxMeshOutputPrimitivesNV " << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n"
|
<< "MaxMeshOutputPrimitivesNV " << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n"
|
||||||
<< "MaxMeshWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n"
|
<< "MaxMeshWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n"
|
||||||
|
|
@ -244,7 +243,6 @@ std::string GetDefaultTBuiltInResourceString()
|
||||||
<< "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n"
|
<< "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n"
|
||||||
<< "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n"
|
<< "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n"
|
||||||
<< "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n"
|
<< "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n"
|
||||||
#endif
|
|
||||||
<< "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
|
<< "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
|
||||||
<< "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
|
<< "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
|
||||||
<< "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
|
<< "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
|
||||||
|
|
@ -451,7 +449,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
|
||||||
resources->maxCombinedClipAndCullDistances = value;
|
resources->maxCombinedClipAndCullDistances = value;
|
||||||
else if (tokenStr == "MaxSamples")
|
else if (tokenStr == "MaxSamples")
|
||||||
resources->maxSamples = value;
|
resources->maxSamples = value;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
else if (tokenStr == "MaxMeshOutputVerticesNV")
|
else if (tokenStr == "MaxMeshOutputVerticesNV")
|
||||||
resources->maxMeshOutputVerticesNV = value;
|
resources->maxMeshOutputVerticesNV = value;
|
||||||
else if (tokenStr == "MaxMeshOutputPrimitivesNV")
|
else if (tokenStr == "MaxMeshOutputPrimitivesNV")
|
||||||
|
|
@ -470,7 +467,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
|
||||||
resources->maxTaskWorkGroupSizeZ_NV = value;
|
resources->maxTaskWorkGroupSizeZ_NV = value;
|
||||||
else if (tokenStr == "MaxMeshViewCountNV")
|
else if (tokenStr == "MaxMeshViewCountNV")
|
||||||
resources->maxMeshViewCountNV = value;
|
resources->maxMeshViewCountNV = value;
|
||||||
#endif
|
|
||||||
else if (tokenStr == "nonInductiveForLoops")
|
else if (tokenStr == "nonInductiveForLoops")
|
||||||
resources->limits.nonInductiveForLoops = (value != 0);
|
resources->limits.nonInductiveForLoops = (value != 0);
|
||||||
else if (tokenStr == "whileLoops")
|
else if (tokenStr == "whileLoops")
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,13 @@ void ProcessConfigFile()
|
||||||
{
|
{
|
||||||
if (ConfigFile.size() == 0)
|
if (ConfigFile.size() == 0)
|
||||||
Resources = glslang::DefaultTBuiltInResource;
|
Resources = glslang::DefaultTBuiltInResource;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
else {
|
else {
|
||||||
char* configString = ReadFileData(ConfigFile.c_str());
|
char* configString = ReadFileData(ConfigFile.c_str());
|
||||||
glslang::DecodeResourceLimits(&Resources, configString);
|
glslang::DecodeResourceLimits(&Resources, configString);
|
||||||
FreeFileData(configString);
|
FreeFileData(configString);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReflectOptions = EShReflectionDefault;
|
int ReflectOptions = EShReflectionDefault;
|
||||||
|
|
@ -255,7 +257,6 @@ const char* GetBinaryName(EShLanguage stage)
|
||||||
case EShLangGeometry: name = "geom.spv"; break;
|
case EShLangGeometry: name = "geom.spv"; break;
|
||||||
case EShLangFragment: name = "frag.spv"; break;
|
case EShLangFragment: name = "frag.spv"; break;
|
||||||
case EShLangCompute: name = "comp.spv"; break;
|
case EShLangCompute: name = "comp.spv"; break;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EShLangRayGenNV: name = "rgen.spv"; break;
|
case EShLangRayGenNV: name = "rgen.spv"; break;
|
||||||
case EShLangIntersectNV: name = "rint.spv"; break;
|
case EShLangIntersectNV: name = "rint.spv"; break;
|
||||||
case EShLangAnyHitNV: name = "rahit.spv"; break;
|
case EShLangAnyHitNV: name = "rahit.spv"; break;
|
||||||
|
|
@ -264,7 +265,6 @@ const char* GetBinaryName(EShLanguage stage)
|
||||||
case EShLangCallableNV: name = "rcall.spv"; break;
|
case EShLangCallableNV: name = "rcall.spv"; break;
|
||||||
case EShLangMeshNV: name = "mesh.spv"; break;
|
case EShLangMeshNV: name = "mesh.spv"; break;
|
||||||
case EShLangTaskNV: name = "task.spv"; break;
|
case EShLangTaskNV: name = "task.spv"; break;
|
||||||
#endif
|
|
||||||
default: name = "unknown"; break;
|
default: name = "unknown"; break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
@ -977,6 +977,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
shader->setPreamble(UserPreamble.get());
|
shader->setPreamble(UserPreamble.get());
|
||||||
shader->addProcesses(Processes);
|
shader->addProcesses(Processes);
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Set IO mapper binding shift values
|
// Set IO mapper binding shift values
|
||||||
for (int r = 0; r < glslang::EResCount; ++r) {
|
for (int r = 0; r < glslang::EResCount; ++r) {
|
||||||
const glslang::TResourceType res = glslang::TResourceType(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)
|
i != baseBindingForSet[res][compUnit.stage].end(); ++i)
|
||||||
shader->setShiftBindingForSet(res, i->second, i->first);
|
shader->setShiftBindingForSet(res, i->second, i->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
|
|
||||||
shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
|
shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
|
||||||
shader->setNanMinMaxClamp(NaNClamp);
|
|
||||||
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
||||||
|
|
||||||
if (Options & EOptionHlslIoMapping)
|
|
||||||
shader->setHlslIoMapping(true);
|
|
||||||
|
|
||||||
if (Options & EOptionAutoMapBindings)
|
if (Options & EOptionAutoMapBindings)
|
||||||
shader->setAutoMapBindings(true);
|
shader->setAutoMapBindings(true);
|
||||||
|
|
||||||
if (Options & EOptionAutoMapLocations)
|
if (Options & EOptionAutoMapLocations)
|
||||||
shader->setAutoMapLocations(true);
|
shader->setAutoMapLocations(true);
|
||||||
|
|
||||||
if (Options & EOptionInvertY)
|
|
||||||
shader->setInvertY(true);
|
|
||||||
|
|
||||||
for (auto& uniOverride : uniformLocationOverrides) {
|
for (auto& uniOverride : uniformLocationOverrides) {
|
||||||
shader->addUniformLocationOverride(uniOverride.first.c_str(),
|
shader->addUniformLocationOverride(uniOverride.first.c_str(),
|
||||||
uniOverride.second);
|
uniOverride.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
shader->setUniformLocationBase(uniformBase);
|
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
|
// Set up the environment, some subsettings take precedence over earlier
|
||||||
// ways of setting things.
|
// ways of setting things.
|
||||||
|
|
@ -1023,8 +1027,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
compUnit.stage, Client, ClientInputSemanticsVersion);
|
compUnit.stage, Client, ClientInputSemanticsVersion);
|
||||||
shader->setEnvClient(Client, ClientVersion);
|
shader->setEnvClient(Client, ClientVersion);
|
||||||
shader->setEnvTarget(TargetLanguage, TargetVersion);
|
shader->setEnvTarget(TargetLanguage, TargetVersion);
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
if (targetHlslFunctionality1)
|
if (targetHlslFunctionality1)
|
||||||
shader->setEnvTargetHlslFunctionality1();
|
shader->setEnvTargetHlslFunctionality1();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
shaders.push_back(shader);
|
shaders.push_back(shader);
|
||||||
|
|
@ -1034,6 +1040,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
DirStackFileIncluder includer;
|
DirStackFileIncluder includer;
|
||||||
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
|
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
|
||||||
includer.pushExternalLocalDirectory(dir); });
|
includer.pushExternalLocalDirectory(dir); });
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (Options & EOptionOutputPreprocessed) {
|
if (Options & EOptionOutputPreprocessed) {
|
||||||
std::string str;
|
std::string str;
|
||||||
if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, messages, &str, includer)) {
|
if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, messages, &str, includer)) {
|
||||||
|
|
@ -1045,6 +1052,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
StderrIfNonEmpty(shader->getInfoDebugLog());
|
StderrIfNonEmpty(shader->getInfoDebugLog());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (! shader->parse(&Resources, defaultVersion, false, messages, includer))
|
if (! shader->parse(&Resources, defaultVersion, false, messages, includer))
|
||||||
CompileFailed = true;
|
CompileFailed = true;
|
||||||
|
|
@ -1067,11 +1075,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages))
|
if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages))
|
||||||
LinkFailed = true;
|
LinkFailed = true;
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Map IO
|
// Map IO
|
||||||
if (Options & EOptionSpv) {
|
if (Options & EOptionSpv) {
|
||||||
if (!program.mapIO())
|
if (!program.mapIO())
|
||||||
LinkFailed = true;
|
LinkFailed = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Report
|
// Report
|
||||||
if (! (Options & EOptionSuppressInfolog) &&
|
if (! (Options & EOptionSuppressInfolog) &&
|
||||||
|
|
@ -1080,11 +1090,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
PutsIfNonEmpty(program.getInfoDebugLog());
|
PutsIfNonEmpty(program.getInfoDebugLog());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Reflect
|
// Reflect
|
||||||
if (Options & EOptionDumpReflection) {
|
if (Options & EOptionDumpReflection) {
|
||||||
program.buildReflection(ReflectOptions);
|
program.buildReflection(ReflectOptions);
|
||||||
program.dumpReflection();
|
program.dumpReflection();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Dump SPIR-V
|
// Dump SPIR-V
|
||||||
if (Options & EOptionSpv) {
|
if (Options & EOptionSpv) {
|
||||||
|
|
@ -1114,8 +1126,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
} else {
|
} else {
|
||||||
glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage));
|
glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage));
|
||||||
}
|
}
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv))
|
if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv))
|
||||||
spv::Disassemble(std::cout, spirv);
|
spv::Disassemble(std::cout, spirv);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1203,11 +1217,13 @@ int singleMain()
|
||||||
workList.add(item.get());
|
workList.add(item.get());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (Options & EOptionDumpConfig) {
|
if (Options & EOptionDumpConfig) {
|
||||||
printf("%s", glslang::GetDefaultTBuiltInResourceString().c_str());
|
printf("%s", glslang::GetDefaultTBuiltInResourceString().c_str());
|
||||||
if (workList.empty())
|
if (workList.empty())
|
||||||
return ESuccess;
|
return ESuccess;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Options & EOptionDumpBareVersion) {
|
if (Options & EOptionDumpBareVersion) {
|
||||||
printf("%d.%d.%d\n",
|
printf("%d.%d.%d\n",
|
||||||
|
|
@ -1379,7 +1395,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
|
||||||
return EShLangFragment;
|
return EShLangFragment;
|
||||||
else if (stageName == "comp")
|
else if (stageName == "comp")
|
||||||
return EShLangCompute;
|
return EShLangCompute;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
else if (stageName == "rgen")
|
else if (stageName == "rgen")
|
||||||
return EShLangRayGenNV;
|
return EShLangRayGenNV;
|
||||||
else if (stageName == "rint")
|
else if (stageName == "rint")
|
||||||
|
|
@ -1396,7 +1411,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
|
||||||
return EShLangMeshNV;
|
return EShLangMeshNV;
|
||||||
else if (stageName == "task")
|
else if (stageName == "task")
|
||||||
return EShLangTaskNV;
|
return EShLangTaskNV;
|
||||||
#endif
|
|
||||||
|
|
||||||
usage();
|
usage();
|
||||||
return EShLangVertex;
|
return EShLangVertex;
|
||||||
|
|
@ -1466,7 +1480,6 @@ void usage()
|
||||||
" .geom for a geometry shader\n"
|
" .geom for a geometry shader\n"
|
||||||
" .frag for a fragment shader\n"
|
" .frag for a fragment shader\n"
|
||||||
" .comp for a compute shader\n"
|
" .comp for a compute shader\n"
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
" .mesh for a mesh shader\n"
|
" .mesh for a mesh shader\n"
|
||||||
" .task for a task shader\n"
|
" .task for a task shader\n"
|
||||||
" .rgen for a ray generation shader\n"
|
" .rgen for a ray generation shader\n"
|
||||||
|
|
@ -1475,7 +1488,6 @@ void usage()
|
||||||
" .rchit for a ray closest hit shader\n"
|
" .rchit for a ray closest hit shader\n"
|
||||||
" .rmiss for a ray miss shader\n"
|
" .rmiss for a ray miss shader\n"
|
||||||
" .rcall for a ray callable shader\n"
|
" .rcall for a ray callable shader\n"
|
||||||
#endif
|
|
||||||
" .glsl for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n"
|
" .glsl for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n"
|
||||||
" .hlsl for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n"
|
" .hlsl for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,14 @@ glspv.vert
|
||||||
ERROR: 0:3: 'push_constant' : only allowed when using GLSL for Vulkan
|
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:6: 'descriptor set' : only allowed when using GLSL for Vulkan
|
||||||
ERROR: 0:8: 'shared' : not allowed when generating SPIR-V
|
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: '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:13: 'gl_VertexIndex' : undeclared identifier
|
||||||
ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier
|
ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier
|
||||||
ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier
|
ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier
|
||||||
ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
|
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
|
SPIR-V is not generated for failed compile or link
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,8 @@ using depth_greater
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "PixelShaderFunction" 18
|
EntryPoint Fragment 4 "PixelShaderFunction" 18
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
ExecutionMode 4 DepthGreater
|
|
||||||
ExecutionMode 4 DepthReplacing
|
ExecutionMode 4 DepthReplacing
|
||||||
|
ExecutionMode 4 DepthGreater
|
||||||
Source HLSL 500
|
Source HLSL 500
|
||||||
Name 4 "PixelShaderFunction"
|
Name 4 "PixelShaderFunction"
|
||||||
Name 10 "@PixelShaderFunction(f1;"
|
Name 10 "@PixelShaderFunction(f1;"
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ using depth_less
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "PixelShaderFunction" 14
|
EntryPoint Fragment 4 "PixelShaderFunction" 14
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
ExecutionMode 4 DepthLess
|
|
||||||
ExecutionMode 4 DepthReplacing
|
ExecutionMode 4 DepthReplacing
|
||||||
|
ExecutionMode 4 DepthLess
|
||||||
Source HLSL 500
|
Source HLSL 500
|
||||||
Name 4 "PixelShaderFunction"
|
Name 4 "PixelShaderFunction"
|
||||||
Name 8 "@PixelShaderFunction("
|
Name 8 "@PixelShaderFunction("
|
||||||
|
|
|
||||||
|
|
@ -170,8 +170,8 @@ using depth_greater
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 22 27 31 36 45 48 51 55
|
EntryPoint Fragment 4 "main" 22 27 31 36 45 48 51 55
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
ExecutionMode 4 DepthGreater
|
|
||||||
ExecutionMode 4 DepthReplacing
|
ExecutionMode 4 DepthReplacing
|
||||||
|
ExecutionMode 4 DepthGreater
|
||||||
Source HLSL 500
|
Source HLSL 500
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
Name 8 "T"
|
Name 8 "T"
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ gl_FragCoord origin is upper left
|
||||||
0:? 'b' ( global 5-element array of highp int)
|
0:? 'b' ( global 5-element array of highp int)
|
||||||
0:? 'c' ( global unsized 4-element array of highp int)
|
0:? 'c' ( global unsized 4-element array of highp int)
|
||||||
0:? 'i' ( global 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@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( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m})
|
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
|
link2.vk.frag
|
||||||
Shader version: 450
|
Shader version: 450
|
||||||
|
|
@ -99,8 +99,8 @@ gl_FragCoord origin is upper left
|
||||||
0:? 'b' ( global unsized 3-element array of highp int)
|
0:? 'b' ( global unsized 3-element array of highp int)
|
||||||
0:? 'c' ( global 7-element array of highp int)
|
0:? 'c' ( global 7-element array of highp int)
|
||||||
0:? 'i' ( global 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@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( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
|
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:
|
Linked fragment stage:
|
||||||
|
|
@ -192,8 +192,8 @@ gl_FragCoord origin is upper left
|
||||||
0:? 'b' ( global 5-element array of highp int)
|
0:? 'b' ( global 5-element array of highp int)
|
||||||
0:? 'c' ( global 7-element array of highp int)
|
0:? 'c' ( global 7-element array of highp int)
|
||||||
0:? 'i' ( global 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@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( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
|
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)
|
0:? 's2D' (layout( binding=1) uniform highp sampler2D)
|
||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
|
|
@ -233,7 +233,7 @@ gl_FragCoord origin is upper left
|
||||||
MemberDecorate 67(bnameImplicit) 0 Offset 0
|
MemberDecorate 67(bnameImplicit) 0 Offset 0
|
||||||
Decorate 67(bnameImplicit) BufferBlock
|
Decorate 67(bnameImplicit) BufferBlock
|
||||||
Decorate 69 DescriptorSet 0
|
Decorate 69 DescriptorSet 0
|
||||||
Decorate 69 Binding 0
|
Decorate 69 Binding 1
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
6: TypeFloat 32
|
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"
|
Name 97 "i"
|
||||||
ModuleProcessed "no-storage-format"
|
ModuleProcessed "no-storage-format"
|
||||||
ModuleProcessed "resource-set-binding 3"
|
ModuleProcessed "resource-set-binding 3"
|
||||||
|
ModuleProcessed "auto-map-bindings"
|
||||||
ModuleProcessed "auto-map-locations"
|
ModuleProcessed "auto-map-locations"
|
||||||
ModuleProcessed "client opengl100"
|
ModuleProcessed "client opengl100"
|
||||||
ModuleProcessed "target-env spirv1.3"
|
ModuleProcessed "target-env spirv1.3"
|
||||||
|
|
@ -99,7 +100,7 @@ void main()
|
||||||
Decorate 56 Binding 0
|
Decorate 56 Binding 0
|
||||||
Decorate 67(s2d) Location 0
|
Decorate 67(s2d) Location 0
|
||||||
Decorate 67(s2d) DescriptorSet 3
|
Decorate 67(s2d) DescriptorSet 3
|
||||||
Decorate 67(s2d) Binding 0
|
Decorate 67(s2d) Binding 1
|
||||||
3: TypeVoid
|
3: TypeVoid
|
||||||
4: TypeFunction 3
|
4: TypeFunction 3
|
||||||
7: TypeInt 32 1
|
7: TypeInt 32 1
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ spv.depthOut.frag
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 8 10 14
|
EntryPoint Fragment 4 "main" 8 10 14
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
ExecutionMode 4 DepthGreater
|
|
||||||
ExecutionMode 4 DepthReplacing
|
ExecutionMode 4 DepthReplacing
|
||||||
|
ExecutionMode 4 DepthGreater
|
||||||
Source GLSL 450
|
Source GLSL 450
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
Name 8 "gl_FragDepth"
|
Name 8 "gl_FragDepth"
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@ spv.hlslDebugInfo.vert
|
||||||
// OpModuleProcessed shift-UBO-binding 6
|
// OpModuleProcessed shift-UBO-binding 6
|
||||||
// OpModuleProcessed shift-ssbo-binding 3
|
// OpModuleProcessed shift-ssbo-binding 3
|
||||||
// OpModuleProcessed shift-uav-binding 5
|
// OpModuleProcessed shift-uav-binding 5
|
||||||
// OpModuleProcessed flatten-uniform-arrays
|
|
||||||
// OpModuleProcessed no-storage-format
|
// OpModuleProcessed no-storage-format
|
||||||
// OpModuleProcessed resource-set-binding t0 0 0
|
// OpModuleProcessed resource-set-binding t0 0 0
|
||||||
// OpModuleProcessed hlsl-iomap
|
|
||||||
// OpModuleProcessed auto-map-bindings
|
// OpModuleProcessed auto-map-bindings
|
||||||
// OpModuleProcessed auto-map-locations
|
// OpModuleProcessed auto-map-locations
|
||||||
|
// OpModuleProcessed flatten-uniform-arrays
|
||||||
|
// OpModuleProcessed hlsl-iomap
|
||||||
// OpModuleProcessed client vulkan100
|
// OpModuleProcessed client vulkan100
|
||||||
// OpModuleProcessed target-env vulkan1.0
|
// OpModuleProcessed target-env vulkan1.0
|
||||||
// OpModuleProcessed source-entrypoint origMain
|
// OpModuleProcessed source-entrypoint origMain
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ Shader version: 450
|
||||||
0:27 Function Definition: main( ( global void)
|
0:27 Function Definition: main( ( global void)
|
||||||
0:27 Function Parameters:
|
0:27 Function Parameters:
|
||||||
0:? Linker Objects
|
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:
|
Linked vertex stage:
|
||||||
|
|
@ -15,7 +15,7 @@ Shader version: 450
|
||||||
0:27 Function Definition: main( ( global void)
|
0:27 Function Definition: main( ( global void)
|
||||||
0:27 Function Parameters:
|
0:27 Function Parameters:
|
||||||
0:? Linker Objects
|
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
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80007
|
// 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 c[];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
buffer bnameRuntime { float r[]; };
|
layout (binding = 0) buffer bnameRuntime { float r[]; };
|
||||||
buffer bnameImplicit { float m[]; };
|
layout (binding = 1) buffer bnameImplicit { float m[]; };
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ int b[];
|
||||||
int c[7];
|
int c[7];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
buffer bnameRuntime { float r[]; };
|
layout (binding = 0) buffer bnameRuntime { float r[]; };
|
||||||
buffer bnameImplicit { float m[4]; };
|
layout (binding = 1) buffer bnameImplicit { float m[4]; };
|
||||||
|
|
||||||
vec4 getColor()
|
vec4 getColor()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASER
|
||||||
# multi-threaded test
|
# multi-threaded test
|
||||||
#
|
#
|
||||||
echo Comparing single thread to multithread for all tests in current directory...
|
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 *.tesc *.tese *.comp > singleThread.out
|
||||||
$EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
|
$EXE -i -C *.vert *.geom *.frag *.tesc *.tese *.comp -t > multiThread.out
|
||||||
diff singleThread.out multiThread.out || HASERROR=1
|
diff singleThread.out multiThread.out || HASERROR=1
|
||||||
if [ $HASERROR -eq 0 ]
|
if [ $HASERROR -eq 0 ]
|
||||||
then
|
then
|
||||||
|
|
@ -145,7 +145,7 @@ echo Testing SPV Debug Information
|
||||||
$EXE -g --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
|
$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
|
-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
|
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
|
-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
|
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 \
|
$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
|
#version 450
|
||||||
|
|
||||||
buffer block {
|
layout(binding = 0) buffer block {
|
||||||
float m0;
|
float m0;
|
||||||
vec3 m4;
|
vec3 m4;
|
||||||
//////
|
//////
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ void main()
|
||||||
}
|
}
|
||||||
|
|
||||||
layout(binding = 0) uniform atomic_uint aui; // ERROR, no atomics in Vulkan
|
layout(binding = 0) uniform atomic_uint aui; // ERROR, no atomics in Vulkan
|
||||||
layout(shared) uniform ub1n { int a; } ub1i; // ERROR, no shared
|
layout(shared, binding = 1) uniform ub1n { int a; } ub1i; // ERROR, no shared
|
||||||
layout(packed) uniform ub2n { int a; } ub2i; // ERROR, no packed
|
layout(packed, binding = 2) uniform ub2n { int a; } ub2i; // ERROR, no packed
|
||||||
|
|
||||||
layout(constant_id=222) const int arraySize = 4;
|
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)
|
endif(WIN32)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
MachineIndependent/glslang.m4
|
||||||
MachineIndependent/glslang.y
|
MachineIndependent/glslang.y
|
||||||
MachineIndependent/glslang_tab.cpp
|
MachineIndependent/glslang_tab.cpp
|
||||||
MachineIndependent/attribute.cpp
|
MachineIndependent/attribute.cpp
|
||||||
|
|
@ -71,15 +72,6 @@ set(HEADERS
|
||||||
MachineIndependent/preprocessor/PpContext.h
|
MachineIndependent/preprocessor/PpContext.h
|
||||||
MachineIndependent/preprocessor/PpTokens.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)
|
glslang_pch(SOURCES MachineIndependent/pch.cpp)
|
||||||
|
|
||||||
add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
|
add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,7 @@ enum TBasicType {
|
||||||
EbtSampler,
|
EbtSampler,
|
||||||
EbtStruct,
|
EbtStruct,
|
||||||
EbtBlock,
|
EbtBlock,
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
EbtAccStructNV,
|
EbtAccStructNV,
|
||||||
#endif
|
|
||||||
|
|
||||||
EbtReference,
|
EbtReference,
|
||||||
|
|
||||||
// HLSL types that live only temporarily.
|
// HLSL types that live only temporarily.
|
||||||
|
|
@ -94,13 +90,11 @@ enum TStorageQualifier {
|
||||||
EvqBuffer, // read/write, shared with app
|
EvqBuffer, // read/write, shared with app
|
||||||
EvqShared, // compute shader's read/write 'shared' qualifier
|
EvqShared, // compute shader's read/write 'shared' qualifier
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
EvqPayloadNV,
|
EvqPayloadNV,
|
||||||
EvqPayloadInNV,
|
EvqPayloadInNV,
|
||||||
EvqHitAttrNV,
|
EvqHitAttrNV,
|
||||||
EvqCallableDataNV,
|
EvqCallableDataNV,
|
||||||
EvqCallableDataInNV,
|
EvqCallableDataInNV,
|
||||||
#endif
|
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
EvqIn, // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter
|
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,
|
EbvSampleMask,
|
||||||
EbvHelperInvocation,
|
EbvHelperInvocation,
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
EbvBaryCoordNoPersp,
|
EbvBaryCoordNoPersp,
|
||||||
EbvBaryCoordNoPerspCentroid,
|
EbvBaryCoordNoPerspCentroid,
|
||||||
EbvBaryCoordNoPerspSample,
|
EbvBaryCoordNoPerspSample,
|
||||||
|
|
@ -229,7 +222,6 @@ enum TBuiltInVariable {
|
||||||
EbvBaryCoordSmoothCentroid,
|
EbvBaryCoordSmoothCentroid,
|
||||||
EbvBaryCoordSmoothSample,
|
EbvBaryCoordSmoothSample,
|
||||||
EbvBaryCoordPullModel,
|
EbvBaryCoordPullModel,
|
||||||
#endif
|
|
||||||
|
|
||||||
EbvViewIndex,
|
EbvViewIndex,
|
||||||
EbvDeviceIndex,
|
EbvDeviceIndex,
|
||||||
|
|
@ -237,7 +229,6 @@ enum TBuiltInVariable {
|
||||||
EbvFragSizeEXT,
|
EbvFragSizeEXT,
|
||||||
EbvFragInvocationCountEXT,
|
EbvFragInvocationCountEXT,
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
EbvViewportMaskNV,
|
EbvViewportMaskNV,
|
||||||
EbvSecondaryPositionNV,
|
EbvSecondaryPositionNV,
|
||||||
EbvSecondaryViewportMaskNV,
|
EbvSecondaryViewportMaskNV,
|
||||||
|
|
@ -273,7 +264,6 @@ enum TBuiltInVariable {
|
||||||
EbvLayerPerViewNV,
|
EbvLayerPerViewNV,
|
||||||
EbvMeshViewCountNV,
|
EbvMeshViewCountNV,
|
||||||
EbvMeshViewIndicesNV,
|
EbvMeshViewIndicesNV,
|
||||||
#endif
|
|
||||||
|
|
||||||
// sm builtins
|
// sm builtins
|
||||||
EbvWarpsPerSM,
|
EbvWarpsPerSM,
|
||||||
|
|
@ -299,6 +289,19 @@ enum TBuiltInVariable {
|
||||||
EbvLast
|
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
|
// These will show up in error messages
|
||||||
__inline const char* GetStorageQualifierString(TStorageQualifier q)
|
__inline const char* GetStorageQualifierString(TStorageQualifier q)
|
||||||
{
|
{
|
||||||
|
|
@ -325,13 +328,11 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q)
|
||||||
case EvqPointCoord: return "gl_PointCoord"; break;
|
case EvqPointCoord: return "gl_PointCoord"; break;
|
||||||
case EvqFragColor: return "fragColor"; break;
|
case EvqFragColor: return "fragColor"; break;
|
||||||
case EvqFragDepth: return "gl_FragDepth"; break;
|
case EvqFragDepth: return "gl_FragDepth"; break;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EvqPayloadNV: return "rayPayloadNV"; break;
|
case EvqPayloadNV: return "rayPayloadNV"; break;
|
||||||
case EvqPayloadInNV: return "rayPayloadInNV"; break;
|
case EvqPayloadInNV: return "rayPayloadInNV"; break;
|
||||||
case EvqHitAttrNV: return "hitAttributeNV"; break;
|
case EvqHitAttrNV: return "hitAttributeNV"; break;
|
||||||
case EvqCallableDataNV: return "callableDataNV"; break;
|
case EvqCallableDataNV: return "callableDataNV"; break;
|
||||||
case EvqCallableDataInNV: return "callableDataInNV"; break;
|
case EvqCallableDataInNV: return "callableDataInNV"; break;
|
||||||
#endif
|
|
||||||
default: return "unknown qualifier";
|
default: return "unknown qualifier";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -413,7 +414,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
||||||
case EbvSampleMask: return "SampleMaskIn";
|
case EbvSampleMask: return "SampleMaskIn";
|
||||||
case EbvHelperInvocation: return "HelperInvocation";
|
case EbvHelperInvocation: return "HelperInvocation";
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbvBaryCoordNoPersp: return "BaryCoordNoPersp";
|
case EbvBaryCoordNoPersp: return "BaryCoordNoPersp";
|
||||||
case EbvBaryCoordNoPerspCentroid: return "BaryCoordNoPerspCentroid";
|
case EbvBaryCoordNoPerspCentroid: return "BaryCoordNoPerspCentroid";
|
||||||
case EbvBaryCoordNoPerspSample: return "BaryCoordNoPerspSample";
|
case EbvBaryCoordNoPerspSample: return "BaryCoordNoPerspSample";
|
||||||
|
|
@ -421,7 +421,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
||||||
case EbvBaryCoordSmoothCentroid: return "BaryCoordSmoothCentroid";
|
case EbvBaryCoordSmoothCentroid: return "BaryCoordSmoothCentroid";
|
||||||
case EbvBaryCoordSmoothSample: return "BaryCoordSmoothSample";
|
case EbvBaryCoordSmoothSample: return "BaryCoordSmoothSample";
|
||||||
case EbvBaryCoordPullModel: return "BaryCoordPullModel";
|
case EbvBaryCoordPullModel: return "BaryCoordPullModel";
|
||||||
#endif
|
|
||||||
|
|
||||||
case EbvViewIndex: return "ViewIndex";
|
case EbvViewIndex: return "ViewIndex";
|
||||||
case EbvDeviceIndex: return "DeviceIndex";
|
case EbvDeviceIndex: return "DeviceIndex";
|
||||||
|
|
@ -429,7 +428,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
||||||
case EbvFragSizeEXT: return "FragSizeEXT";
|
case EbvFragSizeEXT: return "FragSizeEXT";
|
||||||
case EbvFragInvocationCountEXT: return "FragInvocationCountEXT";
|
case EbvFragInvocationCountEXT: return "FragInvocationCountEXT";
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EbvViewportMaskNV: return "ViewportMaskNV";
|
case EbvViewportMaskNV: return "ViewportMaskNV";
|
||||||
case EbvSecondaryPositionNV: return "SecondaryPositionNV";
|
case EbvSecondaryPositionNV: return "SecondaryPositionNV";
|
||||||
case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
|
case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
|
||||||
|
|
@ -464,7 +462,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
|
||||||
case EbvLayerPerViewNV: return "LayerPerViewNV";
|
case EbvLayerPerViewNV: return "LayerPerViewNV";
|
||||||
case EbvMeshViewCountNV: return "MeshViewCountNV";
|
case EbvMeshViewCountNV: return "MeshViewCountNV";
|
||||||
case EbvMeshViewIndicesNV: return "MeshViewIndicesNV";
|
case EbvMeshViewIndicesNV: return "MeshViewIndicesNV";
|
||||||
#endif
|
|
||||||
|
|
||||||
case EbvWarpsPerSM: return "WarpsPerSMNV";
|
case EbvWarpsPerSM: return "WarpsPerSMNV";
|
||||||
case EbvSMCount: return "SMCountNV";
|
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)
|
__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p)
|
||||||
{
|
{
|
||||||
switch (p) {
|
switch (p) {
|
||||||
|
|
@ -494,6 +482,7 @@ __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p)
|
||||||
default: return "unknown precision qualifier";
|
default: return "unknown precision qualifier";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
__inline bool isTypeSignedInt(TBasicType type)
|
__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;
|
int res = -1;
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case EbtInt8:
|
case EbtInt8:
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,28 @@ public:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (type) {
|
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:
|
case EbtInt16:
|
||||||
if (constant.i16Const == i16Const)
|
if (constant.i16Const == i16Const)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -232,16 +254,6 @@ public:
|
||||||
if (constant.u8Const == u8Const)
|
if (constant.u8Const == u8Const)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
break;
|
|
||||||
case EbtInt:
|
|
||||||
if (constant.iConst == iConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case EbtUint:
|
|
||||||
if (constant.uConst == uConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
if (constant.i64Const == i64Const)
|
if (constant.i64Const == i64Const)
|
||||||
|
|
@ -253,16 +265,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EbtDouble:
|
#endif
|
||||||
if (constant.dConst == dConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case EbtBool:
|
|
||||||
if (constant.bConst == bConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
assert(false && "Default missing");
|
assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
@ -329,6 +332,22 @@ public:
|
||||||
{
|
{
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (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:
|
case EbtInt8:
|
||||||
if (i8Const > constant.i8Const)
|
if (i8Const > constant.i8Const)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -348,16 +367,6 @@ public:
|
||||||
if (u16Const > constant.u16Const)
|
if (u16Const > constant.u16Const)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
|
||||||
case EbtInt:
|
|
||||||
if (iConst > constant.iConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
case EbtUint:
|
|
||||||
if (uConst > constant.uConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
if (i64Const > constant.i64Const)
|
if (i64Const > constant.i64Const)
|
||||||
|
|
@ -369,11 +378,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
case EbtDouble:
|
#endif
|
||||||
if (dConst > constant.dConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
default:
|
default:
|
||||||
assert(false && "Default missing");
|
assert(false && "Default missing");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -384,6 +389,7 @@ public:
|
||||||
{
|
{
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt8:
|
case EbtInt8:
|
||||||
if (i8Const < constant.i8Const)
|
if (i8Const < constant.i8Const)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -394,7 +400,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
if (i16Const < constant.i16Const)
|
if (i16Const < constant.i16Const)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -402,17 +408,6 @@ public:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
if (u16Const < constant.u16Const)
|
if (u16Const < constant.u16Const)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
|
||||||
case EbtInt:
|
|
||||||
if (iConst < constant.iConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
case EbtUint:
|
|
||||||
if (uConst < constant.uConst)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
if (i64Const < constant.i64Const)
|
if (i64Const < constant.i64Const)
|
||||||
|
|
@ -424,10 +419,21 @@ public:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
if (dConst < constant.dConst)
|
if (dConst < constant.dConst)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
case EbtInt:
|
||||||
|
if (iConst < constant.iConst)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
case EbtUint:
|
||||||
|
if (uConst < constant.uConst)
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
assert(false && "Default missing");
|
assert(false && "Default missing");
|
||||||
|
|
@ -440,15 +446,17 @@ public:
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (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 EbtInt8: returnValue.setI8Const(i8Const + constant.i8Const); break;
|
||||||
case EbtInt16: returnValue.setI16Const(i16Const + constant.i16Const); 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 EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); break;
|
||||||
case EbtUint8: returnValue.setU8Const(u8Const + constant.u8Const); break;
|
case EbtUint8: returnValue.setU8Const(u8Const + constant.u8Const); break;
|
||||||
case EbtUint16: returnValue.setU16Const(u16Const + constant.u16Const); 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 EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break;
|
||||||
case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break;
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -460,15 +468,17 @@ public:
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (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 EbtInt8: returnValue.setI8Const(i8Const - constant.i8Const); break;
|
||||||
case EbtInt16: returnValue.setI16Const(i16Const - constant.i16Const); 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 EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); break;
|
||||||
case EbtUint8: returnValue.setU8Const(u8Const - constant.u8Const); break;
|
case EbtUint8: returnValue.setU8Const(u8Const - constant.u8Const); break;
|
||||||
case EbtUint16: returnValue.setU16Const(u16Const - constant.u16Const); 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 EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break;
|
||||||
case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break;
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,15 +490,17 @@ public:
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (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 EbtInt8: returnValue.setI8Const(i8Const * constant.i8Const); break;
|
||||||
case EbtInt16: returnValue.setI16Const(i16Const * constant.i16Const); 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 EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); break;
|
||||||
case EbtUint8: returnValue.setU8Const(u8Const * constant.u8Const); break;
|
case EbtUint8: returnValue.setU8Const(u8Const * constant.u8Const); break;
|
||||||
case EbtUint16: returnValue.setU16Const(u16Const * constant.u16Const); 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 EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break;
|
||||||
case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break;
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -500,14 +512,16 @@ public:
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (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 EbtInt8: returnValue.setI8Const(i8Const % constant.i8Const); break;
|
||||||
case EbtInt16: returnValue.setI8Const(i8Const % constant.i16Const); 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 EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break;
|
||||||
case EbtUint8: returnValue.setU8Const(u8Const % constant.u8Const); break;
|
case EbtUint8: returnValue.setU8Const(u8Const % constant.u8Const); break;
|
||||||
case EbtUint16: returnValue.setU16Const(u16Const % constant.u16Const); 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 EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -518,6 +532,7 @@ public:
|
||||||
{
|
{
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt8:
|
case EbtInt8:
|
||||||
switch (constant.type) {
|
switch (constant.type) {
|
||||||
case EbtInt8: returnValue.setI8Const(i8Const >> constant.i8Const); break;
|
case EbtInt8: returnValue.setI8Const(i8Const >> constant.i8Const); break;
|
||||||
|
|
@ -570,32 +585,38 @@ public:
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
switch (constant.type) {
|
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 EbtInt8: returnValue.setIConst(iConst >> constant.i8Const); break;
|
||||||
case EbtUint8: returnValue.setIConst(iConst >> constant.u8Const); break;
|
case EbtUint8: returnValue.setIConst(iConst >> constant.u8Const); break;
|
||||||
case EbtInt16: returnValue.setIConst(iConst >> constant.i16Const); break;
|
case EbtInt16: returnValue.setIConst(iConst >> constant.i16Const); break;
|
||||||
case EbtUint16: returnValue.setIConst(iConst >> constant.u16Const); 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 EbtInt64: returnValue.setIConst(iConst >> constant.i64Const); break;
|
||||||
case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break;
|
case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
switch (constant.type) {
|
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 EbtInt8: returnValue.setUConst(uConst >> constant.i8Const); break;
|
||||||
case EbtUint8: returnValue.setUConst(uConst >> constant.u8Const); break;
|
case EbtUint8: returnValue.setUConst(uConst >> constant.u8Const); break;
|
||||||
case EbtInt16: returnValue.setUConst(uConst >> constant.i16Const); break;
|
case EbtInt16: returnValue.setUConst(uConst >> constant.i16Const); break;
|
||||||
case EbtUint16: returnValue.setUConst(uConst >> constant.u16Const); 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 EbtInt64: returnValue.setUConst(uConst >> constant.i64Const); break;
|
||||||
case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break;
|
case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
switch (constant.type) {
|
switch (constant.type) {
|
||||||
case EbtInt8: returnValue.setI64Const(i64Const >> constant.i8Const); break;
|
case EbtInt8: returnValue.setI64Const(i64Const >> constant.i8Const); break;
|
||||||
|
|
@ -622,6 +643,7 @@ public:
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -632,6 +654,7 @@ public:
|
||||||
{
|
{
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt8:
|
case EbtInt8:
|
||||||
switch (constant.type) {
|
switch (constant.type) {
|
||||||
case EbtInt8: returnValue.setI8Const(i8Const << constant.i8Const); break;
|
case EbtInt8: returnValue.setI8Const(i8Const << constant.i8Const); break;
|
||||||
|
|
@ -684,32 +707,6 @@ public:
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case EbtInt64:
|
||||||
switch (constant.type) {
|
switch (constant.type) {
|
||||||
case EbtInt8: returnValue.setI64Const(i64Const << constant.i8Const); break;
|
case EbtInt8: returnValue.setI64Const(i64Const << constant.i8Const); break;
|
||||||
|
|
@ -736,6 +733,37 @@ public:
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
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");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -747,14 +775,16 @@ public:
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (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 EbtInt8: returnValue.setI8Const(i8Const & constant.i8Const); break;
|
||||||
case EbtUint8: returnValue.setU8Const(u8Const & constant.u8Const); break;
|
case EbtUint8: returnValue.setU8Const(u8Const & constant.u8Const); break;
|
||||||
case EbtInt16: returnValue.setI16Const(i16Const & constant.i16Const); break;
|
case EbtInt16: returnValue.setI16Const(i16Const & constant.i16Const); break;
|
||||||
case EbtUint16: returnValue.setU16Const(u16Const & constant.u16Const); 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 EbtInt64: returnValue.setI64Const(i64Const & constant.i64Const); break;
|
||||||
case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break;
|
case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -766,14 +796,16 @@ public:
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (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 EbtInt8: returnValue.setI8Const(i8Const | constant.i8Const); break;
|
||||||
case EbtUint8: returnValue.setU8Const(u8Const | constant.u8Const); break;
|
case EbtUint8: returnValue.setU8Const(u8Const | constant.u8Const); break;
|
||||||
case EbtInt16: returnValue.setI16Const(i16Const | constant.i16Const); break;
|
case EbtInt16: returnValue.setI16Const(i16Const | constant.i16Const); break;
|
||||||
case EbtUint16: returnValue.setU16Const(u16Const | constant.u16Const); 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 EbtInt64: returnValue.setI64Const(i64Const | constant.i64Const); break;
|
||||||
case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break;
|
case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -785,14 +817,16 @@ public:
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
assert(type == constant.type);
|
assert(type == constant.type);
|
||||||
switch (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 EbtInt8: returnValue.setI8Const(i8Const ^ constant.i8Const); break;
|
||||||
case EbtUint8: returnValue.setU8Const(u8Const ^ constant.u8Const); break;
|
case EbtUint8: returnValue.setU8Const(u8Const ^ constant.u8Const); break;
|
||||||
case EbtInt16: returnValue.setI16Const(i16Const ^ constant.i16Const); break;
|
case EbtInt16: returnValue.setI16Const(i16Const ^ constant.i16Const); break;
|
||||||
case EbtUint16: returnValue.setU16Const(u16Const ^ constant.u16Const); 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 EbtInt64: returnValue.setI64Const(i64Const ^ constant.i64Const); break;
|
||||||
case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break;
|
case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -803,14 +837,16 @@ public:
|
||||||
{
|
{
|
||||||
TConstUnion returnValue;
|
TConstUnion returnValue;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case EbtInt: returnValue.setIConst(~iConst); break;
|
||||||
|
case EbtUint: returnValue.setUConst(~uConst); break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt8: returnValue.setI8Const(~i8Const); break;
|
case EbtInt8: returnValue.setI8Const(~i8Const); break;
|
||||||
case EbtUint8: returnValue.setU8Const(~u8Const); break;
|
case EbtUint8: returnValue.setU8Const(~u8Const); break;
|
||||||
case EbtInt16: returnValue.setI16Const(~i16Const); break;
|
case EbtInt16: returnValue.setI16Const(~i16Const); break;
|
||||||
case EbtUint16: returnValue.setU16Const(~u16Const); 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 EbtInt64: returnValue.setI64Const(~i64Const); break;
|
||||||
case EbtUint64: returnValue.setU64Const(~u64Const); break;
|
case EbtUint64: returnValue.setU64Const(~u64Const); break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,32 +79,64 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||||
bool ms : 1;
|
bool ms : 1;
|
||||||
bool image : 1; // image, combined should be false
|
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 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()
|
#ifdef ENABLE_HLSL
|
||||||
bool external : 1; // GL_OES_EGL_image_external
|
|
||||||
bool yuv : 1; // GL_EXT_YUV_target
|
|
||||||
unsigned int vectorSize : 3; // vector return type size.
|
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 structReturnIndexBits = 4; // number of index bits to use.
|
||||||
static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values
|
static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values
|
||||||
static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type.
|
static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type.
|
||||||
|
|
||||||
// Index into a language specific table of texture return structures.
|
// Index into a language specific table of texture return structures.
|
||||||
unsigned int structReturnIndex : structReturnIndexBits;
|
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.
|
#ifdef GLSLANG_WEB
|
||||||
unsigned int getVectorSize() const { return vectorSize; }
|
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 isSubpass() const { return dim == EsdSubpass; }
|
||||||
bool isCombined() const { return combined; }
|
bool isCombined() const { return combined; }
|
||||||
bool isPureSampler() const { return sampler; }
|
bool isPureSampler() const { return sampler; }
|
||||||
bool isTexture() const { return !sampler && !image; }
|
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 isShadow() const { return shadow; }
|
||||||
bool isArrayed() const { return arrayed; }
|
bool isArrayed() const { return arrayed; }
|
||||||
bool isMultiSample() const { return ms; }
|
|
||||||
bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
|
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
|
|
@ -115,13 +147,17 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||||
ms = false;
|
ms = false;
|
||||||
image = false;
|
image = false;
|
||||||
combined = false;
|
combined = false;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
sampler = false;
|
sampler = false;
|
||||||
external = false;
|
external = false;
|
||||||
yuv = false;
|
yuv = false;
|
||||||
structReturnIndex = noReturnStruct;
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
|
clearReturnStruct();
|
||||||
// by default, returns a single vec4;
|
// by default, returns a single vec4;
|
||||||
vectorSize = 4;
|
vectorSize = 4;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// make a combined sampler and texture
|
// make a combined sampler and texture
|
||||||
|
|
@ -159,6 +195,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||||
ms = m;
|
ms = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// make a subpass input attachment
|
// make a subpass input attachment
|
||||||
void setSubpass(TBasicType t, bool m = false)
|
void setSubpass(TBasicType t, bool m = false)
|
||||||
{
|
{
|
||||||
|
|
@ -176,6 +213,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||||
sampler = true;
|
sampler = true;
|
||||||
shadow = s;
|
shadow = s;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool operator==(const TSampler& right) const
|
bool operator==(const TSampler& right) const
|
||||||
{
|
{
|
||||||
|
|
@ -183,14 +221,14 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||||
dim == right.dim &&
|
dim == right.dim &&
|
||||||
arrayed == right.arrayed &&
|
arrayed == right.arrayed &&
|
||||||
shadow == right.shadow &&
|
shadow == right.shadow &&
|
||||||
ms == right.ms &&
|
isMultiSample() == right.isMultiSample() &&
|
||||||
image == right.image &&
|
isImageClass() == right.isImageClass() &&
|
||||||
combined == right.combined &&
|
isCombined() == right.isCombined() &&
|
||||||
sampler == right.sampler &&
|
isPureSampler() == right.isPureSampler() &&
|
||||||
external == right.external &&
|
isExternal() == right.isExternal() &&
|
||||||
yuv == right.yuv &&
|
isYuv() == right.isYuv() &&
|
||||||
vectorSize == right.vectorSize &&
|
getVectorSize() == right.getVectorSize() &&
|
||||||
structReturnIndex == right.structReturnIndex;
|
getStructReturnIndex() == right.getStructReturnIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const TSampler& right) const
|
bool operator!=(const TSampler& right) const
|
||||||
|
|
@ -202,54 +240,55 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||||
{
|
{
|
||||||
TString s;
|
TString s;
|
||||||
|
|
||||||
if (sampler) {
|
if (isPureSampler()) {
|
||||||
s.append("sampler");
|
s.append("sampler");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EbtFloat: break;
|
case EbtInt: s.append("i"); break;
|
||||||
#ifdef AMD_EXTENSIONS
|
case EbtUint: s.append("u"); break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtFloat16: s.append("f16"); break;
|
case EbtFloat16: s.append("f16"); break;
|
||||||
#endif
|
|
||||||
case EbtInt8: s.append("i8"); break;
|
case EbtInt8: s.append("i8"); break;
|
||||||
case EbtUint16: s.append("u8"); break;
|
case EbtUint16: s.append("u8"); break;
|
||||||
case EbtInt16: s.append("i16"); break;
|
case EbtInt16: s.append("i16"); break;
|
||||||
case EbtUint8: s.append("u16"); 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 EbtInt64: s.append("i64"); break;
|
||||||
case EbtUint64: s.append("u64"); break;
|
case EbtUint64: s.append("u64"); break;
|
||||||
default: break; // some compilers want this
|
#endif
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
if (image) {
|
if (isImageClass()) {
|
||||||
if (dim == EsdSubpass)
|
if (isSubpass())
|
||||||
s.append("subpass");
|
s.append("subpass");
|
||||||
else
|
else
|
||||||
s.append("image");
|
s.append("image");
|
||||||
} else if (combined) {
|
} else if (isCombined()) {
|
||||||
s.append("sampler");
|
s.append("sampler");
|
||||||
} else {
|
} else {
|
||||||
s.append("texture");
|
s.append("texture");
|
||||||
}
|
}
|
||||||
if (external) {
|
if (isExternal()) {
|
||||||
s.append("ExternalOES");
|
s.append("ExternalOES");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
if (yuv) {
|
if (isYuv()) {
|
||||||
return "__" + s + "External2DY2YEXT";
|
return "__" + s + "External2DY2YEXT";
|
||||||
}
|
}
|
||||||
switch (dim) {
|
switch (dim) {
|
||||||
case Esd1D: s.append("1D"); break;
|
|
||||||
case Esd2D: s.append("2D"); break;
|
case Esd2D: s.append("2D"); break;
|
||||||
case Esd3D: s.append("3D"); break;
|
case Esd3D: s.append("3D"); break;
|
||||||
case EsdCube: s.append("Cube"); break;
|
case EsdCube: s.append("Cube"); break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
case Esd1D: s.append("1D"); break;
|
||||||
case EsdRect: s.append("2DRect"); break;
|
case EsdRect: s.append("2DRect"); break;
|
||||||
case EsdBuffer: s.append("Buffer"); break;
|
case EsdBuffer: s.append("Buffer"); break;
|
||||||
case EsdSubpass: s.append("Input"); break;
|
case EsdSubpass: s.append("Input"); break;
|
||||||
|
#endif
|
||||||
default: break; // some compilers want this
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
if (ms)
|
if (isMultiSample())
|
||||||
s.append("MS");
|
s.append("MS");
|
||||||
if (arrayed)
|
if (arrayed)
|
||||||
s.append("Array");
|
s.append("Array");
|
||||||
|
|
@ -442,9 +481,11 @@ public:
|
||||||
{
|
{
|
||||||
precision = EpqNone;
|
precision = EpqNone;
|
||||||
invariant = false;
|
invariant = false;
|
||||||
noContraction = false;
|
|
||||||
makeTemporary();
|
makeTemporary();
|
||||||
declaredBuiltIn = EbvNone;
|
declaredBuiltIn = EbvNone;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
noContraction = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop qualifiers that don't belong in a temporary variable
|
// drop qualifiers that don't belong in a temporary variable
|
||||||
|
|
@ -463,8 +504,10 @@ public:
|
||||||
void clearInterstage()
|
void clearInterstage()
|
||||||
{
|
{
|
||||||
clearInterpolation();
|
clearInterpolation();
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
patch = false;
|
patch = false;
|
||||||
sample = false;
|
sample = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearInterpolation()
|
void clearInterpolation()
|
||||||
|
|
@ -472,11 +515,9 @@ public:
|
||||||
centroid = false;
|
centroid = false;
|
||||||
smooth = false;
|
smooth = false;
|
||||||
flat = false;
|
flat = false;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
nopersp = false;
|
nopersp = false;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
explicitInterp = false;
|
explicitInterp = false;
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
pervertexNV = false;
|
pervertexNV = false;
|
||||||
perPrimitiveNV = false;
|
perPrimitiveNV = false;
|
||||||
perViewNV = false;
|
perViewNV = false;
|
||||||
|
|
@ -519,22 +560,9 @@ public:
|
||||||
static_assert(EbvLast < 256, "need to increase size of TBuiltInVariable bitfields!");
|
static_assert(EbvLast < 256, "need to increase size of TBuiltInVariable bitfields!");
|
||||||
TPrecisionQualifier precision : 3;
|
TPrecisionQualifier precision : 3;
|
||||||
bool invariant : 1; // require canonical treatment for cross-shader invariance
|
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 centroid : 1;
|
||||||
bool smooth : 1;
|
bool smooth : 1;
|
||||||
bool flat : 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 coherent : 1;
|
||||||
bool devicecoherent : 1;
|
bool devicecoherent : 1;
|
||||||
bool queuefamilycoherent : 1;
|
bool queuefamilycoherent : 1;
|
||||||
|
|
@ -545,9 +573,37 @@ public:
|
||||||
bool restrict : 1;
|
bool restrict : 1;
|
||||||
bool readonly : 1;
|
bool readonly : 1;
|
||||||
bool writeonly : 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;
|
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
|
bool isMemory() const
|
||||||
{
|
{
|
||||||
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate;
|
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
|
// include qualifiers that map to load/store availability/visibility/nonprivate memory access operands
|
||||||
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || nonprivate;
|
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || nonprivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInterpolation() const
|
bool isInterpolation() const
|
||||||
{
|
{
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
return flat || smooth || nopersp || explicitInterp;
|
return flat || smooth || nopersp || explicitInterp;
|
||||||
#else
|
|
||||||
return flat || smooth || nopersp;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
bool isExplicitInterpolation() const
|
bool isExplicitInterpolation() const
|
||||||
{
|
{
|
||||||
return explicitInterp;
|
return explicitInterp;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool isAuxiliary() const
|
bool isAuxiliary() const
|
||||||
{
|
{
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
return centroid || patch || sample || pervertexNV;
|
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
|
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
|
bool isIo() const
|
||||||
{
|
{
|
||||||
switch (storage) {
|
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
|
// True if this type of IO is supposed to be arrayed with extra level for per-vertex data
|
||||||
bool isArrayedIo(EShLanguage language) const
|
bool isArrayedIo(EShLanguage language) const
|
||||||
{
|
{
|
||||||
|
|
@ -727,49 +757,50 @@ public:
|
||||||
return ! patch && (isPipeInput() || isPipeOutput());
|
return ! patch && (isPipeInput() || isPipeOutput());
|
||||||
case EShLangTessEvaluation:
|
case EShLangTessEvaluation:
|
||||||
return ! patch && isPipeInput();
|
return ! patch && isPipeInput();
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EShLangFragment:
|
case EShLangFragment:
|
||||||
return pervertexNV && isPipeInput();
|
return pervertexNV && isPipeInput();
|
||||||
case EShLangMeshNV:
|
case EShLangMeshNV:
|
||||||
return ! perTaskNV && isPipeOutput();
|
return ! perTaskNV && isPipeOutput();
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield
|
// Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield
|
||||||
void clearLayout() // all layout
|
void clearLayout() // all layout
|
||||||
{
|
{
|
||||||
clearUniformLayout();
|
clearUniformLayout();
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
layoutPushConstant = false;
|
layoutPushConstant = false;
|
||||||
layoutBufferReference = false;
|
layoutBufferReference = false;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
layoutPassthrough = false;
|
layoutPassthrough = false;
|
||||||
layoutViewportRelative = false;
|
layoutViewportRelative = false;
|
||||||
// -2048 as the default value indicating layoutSecondaryViewportRelative is not set
|
// -2048 as the default value indicating layoutSecondaryViewportRelative is not set
|
||||||
layoutSecondaryViewportRelativeOffset = -2048;
|
layoutSecondaryViewportRelativeOffset = -2048;
|
||||||
layoutShaderRecordNV = false;
|
layoutShaderRecordNV = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
|
layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
|
||||||
|
layoutFormat = ElfNone;
|
||||||
|
#endif
|
||||||
|
|
||||||
clearInterstageLayout();
|
clearInterstageLayout();
|
||||||
|
|
||||||
layoutSpecConstantId = layoutSpecConstantIdEnd;
|
layoutSpecConstantId = layoutSpecConstantIdEnd;
|
||||||
|
|
||||||
layoutFormat = ElfNone;
|
|
||||||
}
|
}
|
||||||
void clearInterstageLayout()
|
void clearInterstageLayout()
|
||||||
{
|
{
|
||||||
layoutLocation = layoutLocationEnd;
|
layoutLocation = layoutLocationEnd;
|
||||||
layoutComponent = layoutComponentEnd;
|
layoutComponent = layoutComponentEnd;
|
||||||
layoutIndex = layoutIndexEnd;
|
layoutIndex = layoutIndexEnd;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
clearStreamLayout();
|
clearStreamLayout();
|
||||||
clearXfbLayout();
|
clearXfbLayout();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
void clearStreamLayout()
|
void clearStreamLayout()
|
||||||
{
|
{
|
||||||
layoutStream = layoutStreamEnd;
|
layoutStream = layoutStreamEnd;
|
||||||
|
|
@ -780,6 +811,7 @@ public:
|
||||||
layoutXfbStride = layoutXfbStrideEnd;
|
layoutXfbStride = layoutXfbStrideEnd;
|
||||||
layoutXfbOffset = layoutXfbOffsetEnd;
|
layoutXfbOffset = layoutXfbOffsetEnd;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool hasNonXfbLayout() const
|
bool hasNonXfbLayout() const
|
||||||
{
|
{
|
||||||
|
|
@ -787,11 +819,9 @@ public:
|
||||||
hasAnyLocation() ||
|
hasAnyLocation() ||
|
||||||
hasStream() ||
|
hasStream() ||
|
||||||
hasFormat() ||
|
hasFormat() ||
|
||||||
#ifdef NV_EXTENSIONS
|
isShaderRecordNV() ||
|
||||||
layoutShaderRecordNV ||
|
isPushConstant() ||
|
||||||
#endif
|
hasBufferReference();
|
||||||
layoutPushConstant ||
|
|
||||||
layoutBufferReference;
|
|
||||||
}
|
}
|
||||||
bool hasLayout() const
|
bool hasLayout() const
|
||||||
{
|
{
|
||||||
|
|
@ -836,6 +866,7 @@ public:
|
||||||
unsigned int layoutSpecConstantId : 11;
|
unsigned int layoutSpecConstantId : 11;
|
||||||
static const unsigned int layoutSpecConstantIdEnd = 0x7FF;
|
static const unsigned int layoutSpecConstantIdEnd = 0x7FF;
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// stored as log2 of the actual alignment value
|
// stored as log2 of the actual alignment value
|
||||||
unsigned int layoutBufferReferenceAlign : 6;
|
unsigned int layoutBufferReferenceAlign : 6;
|
||||||
static const unsigned int layoutBufferReferenceAlignEnd = 0x3F;
|
static const unsigned int layoutBufferReferenceAlignEnd = 0x3F;
|
||||||
|
|
@ -844,8 +875,6 @@ public:
|
||||||
|
|
||||||
bool layoutPushConstant;
|
bool layoutPushConstant;
|
||||||
bool layoutBufferReference;
|
bool layoutBufferReference;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
bool layoutPassthrough;
|
bool layoutPassthrough;
|
||||||
bool layoutViewportRelative;
|
bool layoutViewportRelative;
|
||||||
int layoutSecondaryViewportRelativeOffset;
|
int layoutSecondaryViewportRelativeOffset;
|
||||||
|
|
@ -881,10 +910,6 @@ public:
|
||||||
{
|
{
|
||||||
return layoutPacking != ElpNone;
|
return layoutPacking != ElpNone;
|
||||||
}
|
}
|
||||||
bool hasOffset() const
|
|
||||||
{
|
|
||||||
return layoutOffset != layoutNotSet;
|
|
||||||
}
|
|
||||||
bool hasAlign() const
|
bool hasAlign() const
|
||||||
{
|
{
|
||||||
return layoutAlign != layoutNotSet;
|
return layoutAlign != layoutNotSet;
|
||||||
|
|
@ -899,14 +924,6 @@ public:
|
||||||
{
|
{
|
||||||
return layoutLocation != layoutLocationEnd;
|
return layoutLocation != layoutLocationEnd;
|
||||||
}
|
}
|
||||||
bool hasComponent() const
|
|
||||||
{
|
|
||||||
return layoutComponent != layoutComponentEnd;
|
|
||||||
}
|
|
||||||
bool hasIndex() const
|
|
||||||
{
|
|
||||||
return layoutIndex != layoutIndexEnd;
|
|
||||||
}
|
|
||||||
bool hasSet() const
|
bool hasSet() const
|
||||||
{
|
{
|
||||||
return layoutSet != layoutSetEnd;
|
return layoutSet != layoutSetEnd;
|
||||||
|
|
@ -915,6 +932,38 @@ public:
|
||||||
{
|
{
|
||||||
return layoutBinding != layoutBindingEnd;
|
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
|
bool hasStream() const
|
||||||
{
|
{
|
||||||
return layoutStream != layoutStreamEnd;
|
return layoutStream != layoutStreamEnd;
|
||||||
|
|
@ -945,16 +994,25 @@ public:
|
||||||
{
|
{
|
||||||
return layoutAttachment != layoutAttachmentEnd;
|
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
|
bool hasSpecConstantId() const
|
||||||
{
|
{
|
||||||
// Not the same thing as being a specialization constant, this
|
// Not the same thing as being a specialization constant, this
|
||||||
// is just whether or not it was declared with an ID.
|
// is just whether or not it was declared with an ID.
|
||||||
return layoutSpecConstantId != layoutSpecConstantIdEnd;
|
return layoutSpecConstantId != layoutSpecConstantIdEnd;
|
||||||
}
|
}
|
||||||
bool hasBufferReferenceAlign() const
|
|
||||||
{
|
|
||||||
return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd;
|
|
||||||
}
|
|
||||||
bool isSpecConstant() const
|
bool isSpecConstant() const
|
||||||
{
|
{
|
||||||
// True if type is a specialization constant, whether or not it
|
// True if type is a specialization constant, whether or not it
|
||||||
|
|
@ -962,10 +1020,6 @@ public:
|
||||||
// true front-end constant.
|
// true front-end constant.
|
||||||
return specConstant;
|
return specConstant;
|
||||||
}
|
}
|
||||||
bool isNonUniform() const
|
|
||||||
{
|
|
||||||
return nonUniform;
|
|
||||||
}
|
|
||||||
bool isFrontEndConstant() const
|
bool isFrontEndConstant() const
|
||||||
{
|
{
|
||||||
// True if the front-end knows the final constant value.
|
// True if the front-end knows the final constant value.
|
||||||
|
|
@ -985,11 +1039,13 @@ public:
|
||||||
static const char* getLayoutPackingString(TLayoutPacking packing)
|
static const char* getLayoutPackingString(TLayoutPacking packing)
|
||||||
{
|
{
|
||||||
switch (packing) {
|
switch (packing) {
|
||||||
|
case ElpStd140: return "std140";
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case ElpPacked: return "packed";
|
case ElpPacked: return "packed";
|
||||||
case ElpShared: return "shared";
|
case ElpShared: return "shared";
|
||||||
case ElpStd140: return "std140";
|
|
||||||
case ElpStd430: return "std430";
|
case ElpStd430: return "std430";
|
||||||
case ElpScalar: return "scalar";
|
case ElpScalar: return "scalar";
|
||||||
|
#endif
|
||||||
default: return "none";
|
default: return "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1001,6 +1057,9 @@ public:
|
||||||
default: return "none";
|
default: return "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
static const char* getLayoutFormatString(TLayoutFormat f) { return "none"; }
|
||||||
|
#else
|
||||||
static const char* getLayoutFormatString(TLayoutFormat f)
|
static const char* getLayoutFormatString(TLayoutFormat f)
|
||||||
{
|
{
|
||||||
switch (f) {
|
switch (f) {
|
||||||
|
|
@ -1135,6 +1194,7 @@ public:
|
||||||
default: return "none";
|
default: return "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Qualifiers that don't need to be keep per object. They have shader scope, not object scope.
|
// 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;
|
bool pointMode;
|
||||||
int localSize[3]; // compute shader
|
int localSize[3]; // compute shader
|
||||||
int localSizeSpecId[3]; // compute shader specialization id for gl_WorkGroupSize
|
int localSizeSpecId[3]; // compute shader specialization id for gl_WorkGroupSize
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
bool earlyFragmentTests; // fragment input
|
bool earlyFragmentTests; // fragment input
|
||||||
bool postDepthCoverage; // fragment input
|
bool postDepthCoverage; // fragment input
|
||||||
TLayoutDepth layoutDepth;
|
TLayoutDepth layoutDepth;
|
||||||
bool blendEquation; // true if any blend equation was specified
|
bool blendEquation; // true if any blend equation was specified
|
||||||
int numViews; // multiview extenstions
|
int numViews; // multiview extenstions
|
||||||
TInterlockOrdering interlockOrdering;
|
TInterlockOrdering interlockOrdering;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
bool layoutOverrideCoverage; // true if layout override_coverage set
|
bool layoutOverrideCoverage; // true if layout override_coverage set
|
||||||
bool layoutDerivativeGroupQuads; // true if layout derivative_group_quadsNV set
|
bool layoutDerivativeGroupQuads; // true if layout derivative_group_quadsNV set
|
||||||
bool layoutDerivativeGroupLinear; // true if layout derivative_group_linearNV set
|
bool layoutDerivativeGroupLinear; // true if layout derivative_group_linearNV set
|
||||||
int primitives; // mesh shader "max_primitives"DerivativeGroupLinear; // 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
|
#endif
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
|
|
@ -1180,20 +1242,26 @@ struct TShaderQualifiers {
|
||||||
localSizeSpecId[0] = TQualifier::layoutNotSet;
|
localSizeSpecId[0] = TQualifier::layoutNotSet;
|
||||||
localSizeSpecId[1] = TQualifier::layoutNotSet;
|
localSizeSpecId[1] = TQualifier::layoutNotSet;
|
||||||
localSizeSpecId[2] = TQualifier::layoutNotSet;
|
localSizeSpecId[2] = TQualifier::layoutNotSet;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
earlyFragmentTests = false;
|
earlyFragmentTests = false;
|
||||||
postDepthCoverage = false;
|
postDepthCoverage = false;
|
||||||
layoutDepth = EldNone;
|
layoutDepth = EldNone;
|
||||||
blendEquation = false;
|
blendEquation = false;
|
||||||
numViews = TQualifier::layoutNotSet;
|
numViews = TQualifier::layoutNotSet;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
layoutOverrideCoverage = false;
|
layoutOverrideCoverage = false;
|
||||||
layoutDerivativeGroupQuads = false;
|
layoutDerivativeGroupQuads = false;
|
||||||
layoutDerivativeGroupLinear = false;
|
layoutDerivativeGroupLinear = false;
|
||||||
primitives = TQualifier::layoutNotSet;
|
primitives = TQualifier::layoutNotSet;
|
||||||
#endif
|
|
||||||
interlockOrdering = EioNone;
|
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
|
// Merge in characteristics from the 'src' qualifier. They can override when
|
||||||
// set, but never erase when not set.
|
// set, but never erase when not set.
|
||||||
void merge(const TShaderQualifiers& src)
|
void merge(const TShaderQualifiers& src)
|
||||||
|
|
@ -1222,6 +1290,7 @@ struct TShaderQualifiers {
|
||||||
if (src.localSizeSpecId[i] != TQualifier::layoutNotSet)
|
if (src.localSizeSpecId[i] != TQualifier::layoutNotSet)
|
||||||
localSizeSpecId[i] = src.localSizeSpecId[i];
|
localSizeSpecId[i] = src.localSizeSpecId[i];
|
||||||
}
|
}
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (src.earlyFragmentTests)
|
if (src.earlyFragmentTests)
|
||||||
earlyFragmentTests = true;
|
earlyFragmentTests = true;
|
||||||
if (src.postDepthCoverage)
|
if (src.postDepthCoverage)
|
||||||
|
|
@ -1232,7 +1301,6 @@ struct TShaderQualifiers {
|
||||||
blendEquation = src.blendEquation;
|
blendEquation = src.blendEquation;
|
||||||
if (src.numViews != TQualifier::layoutNotSet)
|
if (src.numViews != TQualifier::layoutNotSet)
|
||||||
numViews = src.numViews;
|
numViews = src.numViews;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
if (src.layoutOverrideCoverage)
|
if (src.layoutOverrideCoverage)
|
||||||
layoutOverrideCoverage = src.layoutOverrideCoverage;
|
layoutOverrideCoverage = src.layoutOverrideCoverage;
|
||||||
if (src.layoutDerivativeGroupQuads)
|
if (src.layoutDerivativeGroupQuads)
|
||||||
|
|
@ -1241,10 +1309,9 @@ struct TShaderQualifiers {
|
||||||
layoutDerivativeGroupLinear = src.layoutDerivativeGroupLinear;
|
layoutDerivativeGroupLinear = src.layoutDerivativeGroupLinear;
|
||||||
if (src.primitives != TQualifier::layoutNotSet)
|
if (src.primitives != TQualifier::layoutNotSet)
|
||||||
primitives = src.primitives;
|
primitives = src.primitives;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (src.interlockOrdering != EioNone)
|
if (src.interlockOrdering != EioNone)
|
||||||
interlockOrdering = src.interlockOrdering;
|
interlockOrdering = src.interlockOrdering;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1271,6 +1338,12 @@ public:
|
||||||
TSourceLoc loc;
|
TSourceLoc loc;
|
||||||
TArraySizes* typeParameters;
|
TArraySizes* typeParameters;
|
||||||
|
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
bool isCoopmat() const { return false; }
|
||||||
|
#else
|
||||||
|
bool isCoopmat() const { return coopmat; }
|
||||||
|
#endif
|
||||||
|
|
||||||
void initType(const TSourceLoc& l)
|
void initType(const TSourceLoc& l)
|
||||||
{
|
{
|
||||||
basicType = EbtVoid;
|
basicType = EbtVoid;
|
||||||
|
|
@ -1374,7 +1447,7 @@ public:
|
||||||
}
|
}
|
||||||
typeName = NewPoolTString(p.userDef->getTypeName().c_str());
|
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 && p.typeParameters->getNumDims() > 0 &&
|
||||||
p.typeParameters->getDimSize(0) == 16) {
|
p.typeParameters->getDimSize(0) == 16) {
|
||||||
basicType = EbtFloat16;
|
basicType = EbtFloat16;
|
||||||
|
|
@ -1483,7 +1556,7 @@ public:
|
||||||
referentType = copyOf.referentType;
|
referentType = copyOf.referentType;
|
||||||
}
|
}
|
||||||
typeParameters = copyOf.typeParameters;
|
typeParameters = copyOf.typeParameters;
|
||||||
coopmat = copyOf.coopmat;
|
coopmat = copyOf.isCoopMat();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make complete copy of the whole type graph rooted at 'copyOf'.
|
// Make complete copy of the whole type graph rooted at 'copyOf'.
|
||||||
|
|
@ -1542,7 +1615,11 @@ public:
|
||||||
virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); }
|
virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); }
|
||||||
virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); }
|
virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); }
|
||||||
virtual int getCumulativeArraySize() const { return arraySizes->getCumulativeSize(); }
|
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 int getImplicitArraySize() const { return arraySizes->getImplicitSize(); }
|
||||||
virtual const TArraySizes* getArraySizes() const { return arraySizes; }
|
virtual const TArraySizes* getArraySizes() const { return arraySizes; }
|
||||||
virtual TArraySizes* getArraySizes() { return arraySizes; }
|
virtual TArraySizes* getArraySizes() { return arraySizes; }
|
||||||
|
|
@ -1580,9 +1657,9 @@ public:
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint
|
virtual bool isOpaque() const { return basicType == EbtSampler
|
||||||
#ifdef NV_EXTENSIONS
|
#ifndef GLSLANG_WEB
|
||||||
|| basicType == EbtAccStructNV
|
|| basicType == EbtAtomicUint || basicType == EbtAccStructNV
|
||||||
#endif
|
#endif
|
||||||
; }
|
; }
|
||||||
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
|
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
|
||||||
|
|
@ -1592,7 +1669,15 @@ public:
|
||||||
virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
|
virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
|
||||||
virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); }
|
virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); }
|
||||||
virtual bool isParameterized() const { return typeParameters != nullptr; }
|
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.
|
// return true if this type contains any subtype which satisfies the given predicate.
|
||||||
template <typename P>
|
template <typename P>
|
||||||
|
|
@ -1673,20 +1758,44 @@ public:
|
||||||
return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } );
|
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);
|
return containsBasicType(EbtInt16) || containsBasicType(EbtUint16);
|
||||||
}
|
}
|
||||||
|
bool contains8BitInt() const
|
||||||
virtual bool contains8BitInt() const
|
|
||||||
{
|
{
|
||||||
return containsBasicType(EbtInt8) || containsBasicType(EbtUint8);
|
return containsBasicType(EbtInt8) || containsBasicType(EbtUint8);
|
||||||
}
|
}
|
||||||
|
bool containsCoopMat() const
|
||||||
virtual bool containsCoopMat() const
|
|
||||||
{
|
{
|
||||||
return contains([](const TType* t) { return t->coopmat; } );
|
return contains([](const TType* t) { return t->coopmat; } );
|
||||||
}
|
}
|
||||||
|
bool containsReference() const
|
||||||
|
{
|
||||||
|
return containsBasicType(EbtReference);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Array editing methods. Array descriptors can be shared across
|
// Array editing methods. Array descriptors can be shared across
|
||||||
// type instances. This allows all uses of the same array
|
// type instances. This allows all uses of the same array
|
||||||
|
|
@ -1746,11 +1855,9 @@ public:
|
||||||
{
|
{
|
||||||
if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed()))
|
if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed()))
|
||||||
changeOuterArraySize(getImplicitArraySize());
|
changeOuterArraySize(getImplicitArraySize());
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
// For multi-dim per-view arrays, set unsized inner dimension size to 1
|
// For multi-dim per-view arrays, set unsized inner dimension size to 1
|
||||||
if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized())
|
if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized())
|
||||||
arraySizes->clearInnerUnsized();
|
arraySizes->clearInnerUnsized();
|
||||||
#endif
|
|
||||||
if (isStruct() && structure->size() > 0) {
|
if (isStruct() && structure->size() > 0) {
|
||||||
int lastMember = (int)structure->size() - 1;
|
int lastMember = (int)structure->size() - 1;
|
||||||
for (int i = 0; i < lastMember; ++i)
|
for (int i = 0; i < lastMember; ++i)
|
||||||
|
|
@ -1808,16 +1915,17 @@ public:
|
||||||
static const char* getBasicString(TBasicType t)
|
static const char* getBasicString(TBasicType t)
|
||||||
{
|
{
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case EbtVoid: return "void";
|
|
||||||
case EbtFloat: return "float";
|
case EbtFloat: return "float";
|
||||||
|
case EbtInt: return "int";
|
||||||
|
case EbtUint: return "uint";
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
case EbtVoid: return "void";
|
||||||
case EbtDouble: return "double";
|
case EbtDouble: return "double";
|
||||||
case EbtFloat16: return "float16_t";
|
case EbtFloat16: return "float16_t";
|
||||||
case EbtInt8: return "int8_t";
|
case EbtInt8: return "int8_t";
|
||||||
case EbtUint8: return "uint8_t";
|
case EbtUint8: return "uint8_t";
|
||||||
case EbtInt16: return "int16_t";
|
case EbtInt16: return "int16_t";
|
||||||
case EbtUint16: return "uint16_t";
|
case EbtUint16: return "uint16_t";
|
||||||
case EbtInt: return "int";
|
|
||||||
case EbtUint: return "uint";
|
|
||||||
case EbtInt64: return "int64_t";
|
case EbtInt64: return "int64_t";
|
||||||
case EbtUint64: return "uint64_t";
|
case EbtUint64: return "uint64_t";
|
||||||
case EbtBool: return "bool";
|
case EbtBool: return "bool";
|
||||||
|
|
@ -1825,14 +1933,20 @@ public:
|
||||||
case EbtSampler: return "sampler/image";
|
case EbtSampler: return "sampler/image";
|
||||||
case EbtStruct: return "structure";
|
case EbtStruct: return "structure";
|
||||||
case EbtBlock: return "block";
|
case EbtBlock: return "block";
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EbtAccStructNV: return "accelerationStructureNV";
|
case EbtAccStructNV: return "accelerationStructureNV";
|
||||||
#endif
|
|
||||||
case EbtReference: return "reference";
|
case EbtReference: return "reference";
|
||||||
|
#endif
|
||||||
default: return "unknown type";
|
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 getCompleteString() const
|
||||||
{
|
{
|
||||||
TString typeString;
|
TString typeString;
|
||||||
|
|
@ -1921,7 +2035,6 @@ public:
|
||||||
appendUint(1u << qualifier.layoutBufferReferenceAlign);
|
appendUint(1u << qualifier.layoutBufferReferenceAlign);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
if (qualifier.layoutPassthrough)
|
if (qualifier.layoutPassthrough)
|
||||||
appendStr(" passthrough");
|
appendStr(" passthrough");
|
||||||
if (qualifier.layoutViewportRelative)
|
if (qualifier.layoutViewportRelative)
|
||||||
|
|
@ -1932,7 +2045,6 @@ public:
|
||||||
}
|
}
|
||||||
if (qualifier.layoutShaderRecordNV)
|
if (qualifier.layoutShaderRecordNV)
|
||||||
appendStr(" shaderRecordNV");
|
appendStr(" shaderRecordNV");
|
||||||
#endif
|
|
||||||
|
|
||||||
appendStr(")");
|
appendStr(")");
|
||||||
}
|
}
|
||||||
|
|
@ -1950,11 +2062,8 @@ public:
|
||||||
appendStr(" flat");
|
appendStr(" flat");
|
||||||
if (qualifier.nopersp)
|
if (qualifier.nopersp)
|
||||||
appendStr(" noperspective");
|
appendStr(" noperspective");
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
if (qualifier.explicitInterp)
|
if (qualifier.explicitInterp)
|
||||||
appendStr(" __explicitInterpAMD");
|
appendStr(" __explicitInterpAMD");
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
if (qualifier.pervertexNV)
|
if (qualifier.pervertexNV)
|
||||||
appendStr(" pervertexNV");
|
appendStr(" pervertexNV");
|
||||||
if (qualifier.perPrimitiveNV)
|
if (qualifier.perPrimitiveNV)
|
||||||
|
|
@ -1963,7 +2072,6 @@ public:
|
||||||
appendStr(" perviewNV");
|
appendStr(" perviewNV");
|
||||||
if (qualifier.perTaskNV)
|
if (qualifier.perTaskNV)
|
||||||
appendStr(" taskNV");
|
appendStr(" taskNV");
|
||||||
#endif
|
|
||||||
if (qualifier.patch)
|
if (qualifier.patch)
|
||||||
appendStr(" patch");
|
appendStr(" patch");
|
||||||
if (qualifier.sample)
|
if (qualifier.sample)
|
||||||
|
|
@ -2078,6 +2186,8 @@ public:
|
||||||
const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); }
|
const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); }
|
||||||
const char* getBuiltInVariableString() const { return GetBuiltInVariableString(qualifier.builtIn); }
|
const char* getBuiltInVariableString() const { return GetBuiltInVariableString(qualifier.builtIn); }
|
||||||
const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); }
|
const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); }
|
||||||
|
#endif
|
||||||
|
|
||||||
const TTypeList* getStruct() const { assert(isStruct()); return structure; }
|
const TTypeList* getStruct() const { assert(isStruct()); return structure; }
|
||||||
void setStruct(TTypeList* s) { assert(isStruct()); structure = s; }
|
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
|
TTypeList* getWritableStruct() const { assert(isStruct()); return structure; } // This should only be used when known to not be sharing with other threads
|
||||||
|
|
@ -2144,12 +2254,12 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sameReferenceType(const TType& right) const
|
bool sameReferenceType(const TType& right) const
|
||||||
{
|
{
|
||||||
if ((basicType == EbtReference) != (right.basicType == EbtReference))
|
if (isReference() != right.isReference())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((basicType != EbtReference) && (right.basicType != EbtReference))
|
if (!isReference() && !right.isReference())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
assert(referentType != nullptr);
|
assert(referentType != nullptr);
|
||||||
|
|
@ -2161,7 +2271,7 @@ public:
|
||||||
return *referentType == *right.referentType;
|
return *referentType == *right.referentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if two types match, in all aspects except arrayness
|
// See if two types match, in all aspects except arrayness
|
||||||
bool sameElementType(const TType& right) const
|
bool sameElementType(const TType& right) const
|
||||||
{
|
{
|
||||||
return basicType == right.basicType && sameElementShape(right);
|
return basicType == right.basicType && sameElementShape(right);
|
||||||
|
|
@ -2196,7 +2306,7 @@ public:
|
||||||
matrixCols == right.matrixCols &&
|
matrixCols == right.matrixCols &&
|
||||||
matrixRows == right.matrixRows &&
|
matrixRows == right.matrixRows &&
|
||||||
vector1 == right.vector1 &&
|
vector1 == right.vector1 &&
|
||||||
coopmat == right.coopmat &&
|
isCoopMat() == right.isCoopMat() &&
|
||||||
sameStructType(right) &&
|
sameStructType(right) &&
|
||||||
sameReferenceType(right);
|
sameReferenceType(right);
|
||||||
}
|
}
|
||||||
|
|
@ -2205,7 +2315,7 @@ public:
|
||||||
// an OK function parameter
|
// an OK function parameter
|
||||||
bool coopMatParameterOK(const TType& right) const
|
bool coopMatParameterOK(const TType& right) const
|
||||||
{
|
{
|
||||||
return coopmat && right.coopmat &&
|
return isCoopMat() && right.isCoopMat() &&
|
||||||
typeParameters == nullptr && right.typeParameters != nullptr;
|
typeParameters == nullptr && right.typeParameters != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2222,12 +2332,13 @@ public:
|
||||||
|
|
||||||
unsigned int getBufferReferenceAlignment() const
|
unsigned int getBufferReferenceAlignment() const
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (getBasicType() == glslang::EbtReference) {
|
if (getBasicType() == glslang::EbtReference) {
|
||||||
return getReferentType()->getQualifier().hasBufferReferenceAlign() ?
|
return getReferentType()->getQualifier().hasBufferReferenceAlign() ?
|
||||||
(1u << getReferentType()->getQualifier().layoutBufferReferenceAlign) : 16u;
|
(1u << getReferentType()->getQualifier().layoutBufferReferenceAlign) : 16u;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -422,11 +422,9 @@ enum TOperator {
|
||||||
EOpReflect,
|
EOpReflect,
|
||||||
EOpRefract,
|
EOpRefract,
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
EOpMin3,
|
EOpMin3,
|
||||||
EOpMax3,
|
EOpMax3,
|
||||||
EOpMid3,
|
EOpMid3,
|
||||||
#endif
|
|
||||||
|
|
||||||
EOpDPdx, // Fragment only
|
EOpDPdx, // Fragment only
|
||||||
EOpDPdy, // Fragment only
|
EOpDPdy, // Fragment only
|
||||||
|
|
@ -441,10 +439,7 @@ enum TOperator {
|
||||||
EOpInterpolateAtCentroid, // Fragment only
|
EOpInterpolateAtCentroid, // Fragment only
|
||||||
EOpInterpolateAtSample, // Fragment only
|
EOpInterpolateAtSample, // Fragment only
|
||||||
EOpInterpolateAtOffset, // Fragment only
|
EOpInterpolateAtOffset, // Fragment only
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
EOpInterpolateAtVertex,
|
EOpInterpolateAtVertex,
|
||||||
#endif
|
|
||||||
|
|
||||||
EOpMatrixTimesMatrix,
|
EOpMatrixTimesMatrix,
|
||||||
EOpOuterProduct,
|
EOpOuterProduct,
|
||||||
|
|
@ -534,7 +529,6 @@ enum TOperator {
|
||||||
EOpSubgroupQuadSwapVertical,
|
EOpSubgroupQuadSwapVertical,
|
||||||
EOpSubgroupQuadSwapDiagonal,
|
EOpSubgroupQuadSwapDiagonal,
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
EOpSubgroupPartition,
|
EOpSubgroupPartition,
|
||||||
EOpSubgroupPartitionedAdd,
|
EOpSubgroupPartitionedAdd,
|
||||||
EOpSubgroupPartitionedMul,
|
EOpSubgroupPartitionedMul,
|
||||||
|
|
@ -557,11 +551,9 @@ enum TOperator {
|
||||||
EOpSubgroupPartitionedExclusiveAnd,
|
EOpSubgroupPartitionedExclusiveAnd,
|
||||||
EOpSubgroupPartitionedExclusiveOr,
|
EOpSubgroupPartitionedExclusiveOr,
|
||||||
EOpSubgroupPartitionedExclusiveXor,
|
EOpSubgroupPartitionedExclusiveXor,
|
||||||
#endif
|
|
||||||
|
|
||||||
EOpSubgroupGuardStop,
|
EOpSubgroupGuardStop,
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
EOpMinInvocations,
|
EOpMinInvocations,
|
||||||
EOpMaxInvocations,
|
EOpMaxInvocations,
|
||||||
EOpAddInvocations,
|
EOpAddInvocations,
|
||||||
|
|
@ -588,7 +580,6 @@ enum TOperator {
|
||||||
EOpCubeFaceIndex,
|
EOpCubeFaceIndex,
|
||||||
EOpCubeFaceCoord,
|
EOpCubeFaceCoord,
|
||||||
EOpTime,
|
EOpTime,
|
||||||
#endif
|
|
||||||
|
|
||||||
EOpAtomicAdd,
|
EOpAtomicAdd,
|
||||||
EOpAtomicMin,
|
EOpAtomicMin,
|
||||||
|
|
@ -795,10 +786,8 @@ enum TOperator {
|
||||||
EOpImageQuerySamples,
|
EOpImageQuerySamples,
|
||||||
EOpImageLoad,
|
EOpImageLoad,
|
||||||
EOpImageStore,
|
EOpImageStore,
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
EOpImageLoadLod,
|
EOpImageLoadLod,
|
||||||
EOpImageStoreLod,
|
EOpImageStoreLod,
|
||||||
#endif
|
|
||||||
EOpImageAtomicAdd,
|
EOpImageAtomicAdd,
|
||||||
EOpImageAtomicMin,
|
EOpImageAtomicMin,
|
||||||
EOpImageAtomicMax,
|
EOpImageAtomicMax,
|
||||||
|
|
@ -813,9 +802,7 @@ enum TOperator {
|
||||||
EOpSubpassLoad,
|
EOpSubpassLoad,
|
||||||
EOpSubpassLoadMS,
|
EOpSubpassLoadMS,
|
||||||
EOpSparseImageLoad,
|
EOpSparseImageLoad,
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
EOpSparseImageLoadLod,
|
EOpSparseImageLoadLod,
|
||||||
#endif
|
|
||||||
|
|
||||||
EOpImageGuardEnd,
|
EOpImageGuardEnd,
|
||||||
|
|
||||||
|
|
@ -853,13 +840,11 @@ enum TOperator {
|
||||||
EOpTextureOffsetClamp,
|
EOpTextureOffsetClamp,
|
||||||
EOpTextureGradClamp,
|
EOpTextureGradClamp,
|
||||||
EOpTextureGradOffsetClamp,
|
EOpTextureGradOffsetClamp,
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
EOpTextureGatherLod,
|
EOpTextureGatherLod,
|
||||||
EOpTextureGatherLodOffset,
|
EOpTextureGatherLodOffset,
|
||||||
EOpTextureGatherLodOffsets,
|
EOpTextureGatherLodOffsets,
|
||||||
EOpFragmentMaskFetch,
|
EOpFragmentMaskFetch,
|
||||||
EOpFragmentFetch,
|
EOpFragmentFetch,
|
||||||
#endif
|
|
||||||
|
|
||||||
EOpSparseTextureGuardBegin,
|
EOpSparseTextureGuardBegin,
|
||||||
|
|
||||||
|
|
@ -879,15 +864,12 @@ enum TOperator {
|
||||||
EOpSparseTextureOffsetClamp,
|
EOpSparseTextureOffsetClamp,
|
||||||
EOpSparseTextureGradClamp,
|
EOpSparseTextureGradClamp,
|
||||||
EOpSparseTextureGradOffsetClamp,
|
EOpSparseTextureGradOffsetClamp,
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
EOpSparseTextureGatherLod,
|
EOpSparseTextureGatherLod,
|
||||||
EOpSparseTextureGatherLodOffset,
|
EOpSparseTextureGatherLodOffset,
|
||||||
EOpSparseTextureGatherLodOffsets,
|
EOpSparseTextureGatherLodOffsets,
|
||||||
#endif
|
|
||||||
|
|
||||||
EOpSparseTextureGuardEnd,
|
EOpSparseTextureGuardEnd,
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
EOpImageFootprintGuardBegin,
|
EOpImageFootprintGuardBegin,
|
||||||
EOpImageSampleFootprintNV,
|
EOpImageSampleFootprintNV,
|
||||||
EOpImageSampleFootprintClampNV,
|
EOpImageSampleFootprintClampNV,
|
||||||
|
|
@ -895,7 +877,6 @@ enum TOperator {
|
||||||
EOpImageSampleFootprintGradNV,
|
EOpImageSampleFootprintGradNV,
|
||||||
EOpImageSampleFootprintGradClampNV,
|
EOpImageSampleFootprintGradClampNV,
|
||||||
EOpImageFootprintGuardEnd,
|
EOpImageFootprintGuardEnd,
|
||||||
#endif
|
|
||||||
EOpSamplingGuardEnd,
|
EOpSamplingGuardEnd,
|
||||||
EOpTextureGuardEnd,
|
EOpTextureGuardEnd,
|
||||||
|
|
||||||
|
|
@ -914,14 +895,12 @@ enum TOperator {
|
||||||
EOpFindLSB,
|
EOpFindLSB,
|
||||||
EOpFindMSB,
|
EOpFindMSB,
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
EOpTraceNV,
|
EOpTraceNV,
|
||||||
EOpReportIntersectionNV,
|
EOpReportIntersectionNV,
|
||||||
EOpIgnoreIntersectionNV,
|
EOpIgnoreIntersectionNV,
|
||||||
EOpTerminateRayNV,
|
EOpTerminateRayNV,
|
||||||
EOpExecuteCallableNV,
|
EOpExecuteCallableNV,
|
||||||
EOpWritePackedPrimitiveIndices4x8NV,
|
EOpWritePackedPrimitiveIndices4x8NV,
|
||||||
#endif
|
|
||||||
//
|
//
|
||||||
// HLSL operations
|
// HLSL operations
|
||||||
//
|
//
|
||||||
|
|
@ -1110,6 +1089,8 @@ public:
|
||||||
virtual bool isStruct() const { return type.isStruct(); }
|
virtual bool isStruct() const { return type.isStruct(); }
|
||||||
virtual bool isFloatingDomain() const { return type.isFloatingDomain(); }
|
virtual bool isFloatingDomain() const { return type.isFloatingDomain(); }
|
||||||
virtual bool isIntegerDomain() const { return type.isIntegerDomain(); }
|
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(); }
|
TString getCompleteString() const { return type.getCompleteString(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -1303,9 +1284,7 @@ struct TCrackedTextureOp {
|
||||||
bool grad;
|
bool grad;
|
||||||
bool subpass;
|
bool subpass;
|
||||||
bool lodClamp;
|
bool lodClamp;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
bool fragMask;
|
bool fragMask;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1321,12 +1300,17 @@ public:
|
||||||
bool isConstructor() const;
|
bool isConstructor() const;
|
||||||
bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; }
|
bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; }
|
||||||
bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; }
|
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 isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; }
|
||||||
bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; }
|
bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; }
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; }
|
bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; }
|
||||||
#endif
|
|
||||||
bool isSparseImage() const { return op == EOpSparseImageLoad; }
|
bool isSparseImage() const { return op == EOpSparseImageLoad; }
|
||||||
|
#endif
|
||||||
|
|
||||||
void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; }
|
void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; }
|
||||||
TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ?
|
TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ?
|
||||||
|
|
@ -1356,9 +1340,7 @@ public:
|
||||||
cracked.grad = false;
|
cracked.grad = false;
|
||||||
cracked.subpass = false;
|
cracked.subpass = false;
|
||||||
cracked.lodClamp = false;
|
cracked.lodClamp = false;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
cracked.fragMask = false;
|
cracked.fragMask = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case EOpImageQuerySize:
|
case EOpImageQuerySize:
|
||||||
|
|
@ -1373,10 +1355,6 @@ public:
|
||||||
case EOpTexture:
|
case EOpTexture:
|
||||||
case EOpSparseTexture:
|
case EOpSparseTexture:
|
||||||
break;
|
break;
|
||||||
case EOpTextureClamp:
|
|
||||||
case EOpSparseTextureClamp:
|
|
||||||
cracked.lodClamp = true;
|
|
||||||
break;
|
|
||||||
case EOpTextureProj:
|
case EOpTextureProj:
|
||||||
cracked.proj = true;
|
cracked.proj = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1388,22 +1366,17 @@ public:
|
||||||
case EOpSparseTextureOffset:
|
case EOpSparseTextureOffset:
|
||||||
cracked.offset = true;
|
cracked.offset = true;
|
||||||
break;
|
break;
|
||||||
case EOpTextureOffsetClamp:
|
|
||||||
case EOpSparseTextureOffsetClamp:
|
|
||||||
cracked.offset = true;
|
|
||||||
cracked.lodClamp = true;
|
|
||||||
break;
|
|
||||||
case EOpTextureFetch:
|
case EOpTextureFetch:
|
||||||
case EOpSparseTextureFetch:
|
case EOpSparseTextureFetch:
|
||||||
cracked.fetch = true;
|
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;
|
cracked.lod = true;
|
||||||
break;
|
break;
|
||||||
case EOpTextureFetchOffset:
|
case EOpTextureFetchOffset:
|
||||||
case EOpSparseTextureFetchOffset:
|
case EOpSparseTextureFetchOffset:
|
||||||
cracked.fetch = true;
|
cracked.fetch = true;
|
||||||
cracked.offset = 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;
|
cracked.lod = true;
|
||||||
break;
|
break;
|
||||||
case EOpTextureProjOffset:
|
case EOpTextureProjOffset:
|
||||||
|
|
@ -1428,11 +1401,6 @@ public:
|
||||||
case EOpSparseTextureGrad:
|
case EOpSparseTextureGrad:
|
||||||
cracked.grad = true;
|
cracked.grad = true;
|
||||||
break;
|
break;
|
||||||
case EOpTextureGradClamp:
|
|
||||||
case EOpSparseTextureGradClamp:
|
|
||||||
cracked.grad = true;
|
|
||||||
cracked.lodClamp = true;
|
|
||||||
break;
|
|
||||||
case EOpTextureGradOffset:
|
case EOpTextureGradOffset:
|
||||||
case EOpSparseTextureGradOffset:
|
case EOpSparseTextureGradOffset:
|
||||||
cracked.grad = true;
|
cracked.grad = true;
|
||||||
|
|
@ -1447,6 +1415,21 @@ public:
|
||||||
cracked.offset = true;
|
cracked.offset = true;
|
||||||
cracked.proj = true;
|
cracked.proj = true;
|
||||||
break;
|
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 EOpTextureGradOffsetClamp:
|
||||||
case EOpSparseTextureGradOffsetClamp:
|
case EOpSparseTextureGradOffsetClamp:
|
||||||
cracked.grad = true;
|
cracked.grad = true;
|
||||||
|
|
@ -1467,7 +1450,6 @@ public:
|
||||||
cracked.gather = true;
|
cracked.gather = true;
|
||||||
cracked.offsets = true;
|
cracked.offsets = true;
|
||||||
break;
|
break;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EOpTextureGatherLod:
|
case EOpTextureGatherLod:
|
||||||
case EOpSparseTextureGatherLod:
|
case EOpSparseTextureGatherLod:
|
||||||
cracked.gather = true;
|
cracked.gather = true;
|
||||||
|
|
@ -1498,8 +1480,6 @@ public:
|
||||||
cracked.subpass = sampler.dim == EsdSubpass;
|
cracked.subpass = sampler.dim == EsdSubpass;
|
||||||
cracked.fragMask = true;
|
cracked.fragMask = true;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EOpImageSampleFootprintNV:
|
case EOpImageSampleFootprintNV:
|
||||||
break;
|
break;
|
||||||
case EOpImageSampleFootprintClampNV:
|
case EOpImageSampleFootprintClampNV:
|
||||||
|
|
@ -1515,11 +1495,11 @@ public:
|
||||||
cracked.lodClamp = true;
|
cracked.lodClamp = true;
|
||||||
cracked.grad = true;
|
cracked.grad = true;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case EOpSubpassLoad:
|
case EOpSubpassLoad:
|
||||||
case EOpSubpassLoadMS:
|
case EOpSubpassLoadMS:
|
||||||
cracked.subpass = true;
|
cracked.subpass = true;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,24 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
||||||
else
|
else
|
||||||
newConstArray[i].setDConst((double)NAN);
|
newConstArray[i].setDConst((double)NAN);
|
||||||
break;
|
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:
|
case EbtInt8:
|
||||||
if (rightUnionArray[i] == (signed char)0)
|
if (rightUnionArray[i] == (signed char)0)
|
||||||
newConstArray[i].setI8Const((signed char)0x7F);
|
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());
|
newConstArray[i].setU16Const(leftUnionArray[i].getU16Const() / rightUnionArray[i].getU16Const());
|
||||||
break;
|
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:
|
case EbtInt64:
|
||||||
if (rightUnionArray[i] == 0ll)
|
if (rightUnionArray[i] == 0ll)
|
||||||
newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll);
|
newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll);
|
||||||
|
|
@ -254,6 +256,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -292,13 +295,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
||||||
newConstArray[i].setIConst(0);
|
newConstArray[i].setIConst(0);
|
||||||
break;
|
break;
|
||||||
} else goto modulo_default;
|
} else goto modulo_default;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == LLONG_MIN) {
|
if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == LLONG_MIN) {
|
||||||
newConstArray[i].setI64Const(0);
|
newConstArray[i].setI64Const(0);
|
||||||
break;
|
break;
|
||||||
} else goto modulo_default;
|
} else goto modulo_default;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == SHRT_MIN) {
|
if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == SHRT_MIN) {
|
||||||
newConstArray[i].setIConst(0);
|
newConstArray[i].setIConst(0);
|
||||||
|
|
@ -527,14 +529,16 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
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 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 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 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 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 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;
|
case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(-static_cast<long long>(unionArray[i].getU64Const()))); break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -669,6 +673,48 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
||||||
break;
|
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:
|
case EOpConvInt8ToBool:
|
||||||
newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break;
|
newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break;
|
||||||
case EOpConvUint8ToBool:
|
case EOpConvUint8ToBool:
|
||||||
|
|
@ -677,20 +723,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
||||||
newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break;
|
newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break;
|
||||||
case EOpConvUint16ToBool:
|
case EOpConvUint16ToBool:
|
||||||
newConstArray[i].setBConst(unionArray[i].getU16Const() != 0); break;
|
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:
|
case EOpConvInt64ToBool:
|
||||||
newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
|
newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
|
||||||
case EOpConvUint64ToBool:
|
case EOpConvUint64ToBool:
|
||||||
newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
|
newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
|
||||||
case EOpConvFloat16ToBool:
|
case EOpConvFloat16ToBool:
|
||||||
newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
|
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:
|
case EOpConvBoolToInt8:
|
||||||
newConstArray[i].setI8Const(unionArray[i].getBConst()); break;
|
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;
|
newConstArray[i].setI16Const(unionArray[i].getBConst()); break;
|
||||||
case EOpConvBoolToUint16:
|
case EOpConvBoolToUint16:
|
||||||
newConstArray[i].setU16Const(unionArray[i].getBConst()); break;
|
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:
|
case EOpConvBoolToInt64:
|
||||||
newConstArray[i].setI64Const(unionArray[i].getBConst()); break;
|
newConstArray[i].setI64Const(unionArray[i].getBConst()); break;
|
||||||
case EOpConvBoolToUint64:
|
case EOpConvBoolToUint64:
|
||||||
newConstArray[i].setU64Const(unionArray[i].getBConst()); break;
|
newConstArray[i].setU64Const(unionArray[i].getBConst()); break;
|
||||||
case EOpConvBoolToFloat16:
|
case EOpConvBoolToFloat16:
|
||||||
newConstArray[i].setDConst(unionArray[i].getBConst()); break;
|
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:
|
case EOpConvInt8ToInt16:
|
||||||
newConstArray[i].setI16Const(unionArray[i].getI8Const()); break;
|
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;
|
newConstArray[i].setU8Const((unsigned char)unionArray[i].getIConst()); break;
|
||||||
case EOpConvIntToUint16:
|
case EOpConvIntToUint16:
|
||||||
newConstArray[i].setU16Const((unsigned char)unionArray[i].getIConst()); break;
|
newConstArray[i].setU16Const((unsigned char)unionArray[i].getIConst()); break;
|
||||||
case EOpConvIntToUint:
|
|
||||||
newConstArray[i].setUConst(unionArray[i].getIConst()); break;
|
|
||||||
case EOpConvIntToUint64:
|
case EOpConvIntToUint64:
|
||||||
newConstArray[i].setU64Const(unionArray[i].getIConst()); break;
|
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;
|
newConstArray[i].setI8Const((signed char)unionArray[i].getUConst()); break;
|
||||||
case EOpConvUintToInt16:
|
case EOpConvUintToInt16:
|
||||||
newConstArray[i].setI16Const((signed short)unionArray[i].getUConst()); break;
|
newConstArray[i].setI16Const((signed short)unionArray[i].getUConst()); break;
|
||||||
case EOpConvUintToInt:
|
|
||||||
newConstArray[i].setIConst(unionArray[i].getUConst()); break;
|
|
||||||
case EOpConvUintToInt64:
|
case EOpConvUintToInt64:
|
||||||
newConstArray[i].setI64Const(unionArray[i].getUConst()); break;
|
newConstArray[i].setI64Const(unionArray[i].getUConst()); break;
|
||||||
case EOpConvUintToUint8:
|
case EOpConvUintToUint8:
|
||||||
|
|
@ -829,16 +855,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
||||||
newConstArray[i].setU64Const(unionArray[i].getUConst()); break;
|
newConstArray[i].setU64Const(unionArray[i].getUConst()); break;
|
||||||
case EOpConvIntToFloat16:
|
case EOpConvIntToFloat16:
|
||||||
newConstArray[i].setDConst(unionArray[i].getIConst()); break;
|
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:
|
case EOpConvUintToFloat16:
|
||||||
newConstArray[i].setDConst(unionArray[i].getUConst()); break;
|
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:
|
case EOpConvInt64ToInt8:
|
||||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI64Const())); break;
|
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI64Const())); break;
|
||||||
case EOpConvInt64ToInt16:
|
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;
|
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
|
||||||
case EOpConvFloatToInt16:
|
case EOpConvFloatToInt16:
|
||||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
|
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:
|
case EOpConvFloatToInt64:
|
||||||
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
||||||
case EOpConvFloatToUint8:
|
case EOpConvFloatToUint8:
|
||||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
||||||
case EOpConvFloatToUint16:
|
case EOpConvFloatToUint16:
|
||||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
|
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:
|
case EOpConvFloatToUint64:
|
||||||
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
||||||
case EOpConvFloatToFloat16:
|
case EOpConvFloatToFloat16:
|
||||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||||
case EOpConvFloatToDouble:
|
|
||||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
|
||||||
case EOpConvDoubleToInt8:
|
case EOpConvDoubleToInt8:
|
||||||
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
|
newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
|
||||||
case EOpConvDoubleToInt16:
|
case EOpConvDoubleToInt16:
|
||||||
newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
|
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:
|
case EOpConvDoubleToInt64:
|
||||||
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
|
||||||
case EOpConvDoubleToUint8:
|
case EOpConvDoubleToUint8:
|
||||||
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
|
||||||
case EOpConvDoubleToUint16:
|
case EOpConvDoubleToUint16:
|
||||||
newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
|
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:
|
case EOpConvDoubleToUint64:
|
||||||
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
|
||||||
case EOpConvDoubleToFloat16:
|
case EOpConvDoubleToFloat16:
|
||||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
||||||
case EOpConvDoubleToFloat:
|
|
||||||
newConstArray[i].setDConst(unionArray[i].getDConst()); break;
|
|
||||||
case EOpConvPtrToUint64:
|
case EOpConvPtrToUint64:
|
||||||
case EOpConvUint64ToPtr:
|
case EOpConvUint64ToPtr:
|
||||||
case EOpConstructReference:
|
case EOpConstructReference:
|
||||||
newConstArray[i].setU64Const(unionArray[i].getU64Const()); break;
|
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
|
// 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:
|
case EbtDouble:
|
||||||
newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
|
newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
|
||||||
break;
|
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:
|
case EbtInt8:
|
||||||
newConstArray[comp].setI8Const(std::min(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()));
|
newConstArray[comp].setI8Const(std::min(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()));
|
||||||
break;
|
break;
|
||||||
|
|
@ -1088,18 +1100,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
newConstArray[comp].setU16Const(std::min(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()));
|
newConstArray[comp].setU16Const(std::min(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()));
|
||||||
break;
|
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:
|
case EbtInt64:
|
||||||
newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
|
newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
|
||||||
break;
|
break;
|
||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
|
newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1110,6 +1117,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
|
newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
|
||||||
break;
|
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:
|
case EbtInt8:
|
||||||
newConstArray[comp].setI8Const(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()));
|
newConstArray[comp].setI8Const(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()));
|
||||||
break;
|
break;
|
||||||
|
|
@ -1122,18 +1136,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
newConstArray[comp].setU16Const(std::max(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()));
|
newConstArray[comp].setU16Const(std::max(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()));
|
||||||
break;
|
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:
|
case EbtInt64:
|
||||||
newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
|
newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
|
||||||
break;
|
break;
|
||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
|
newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
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()),
|
newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()),
|
||||||
childConstUnions[2][arg2comp].getDConst()));
|
childConstUnions[2][arg2comp].getDConst()));
|
||||||
break;
|
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:
|
case EbtInt8:
|
||||||
newConstArray[comp].setI8Const(std::min(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()),
|
newConstArray[comp].setI8Const(std::min(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()),
|
||||||
childConstUnions[2][arg2comp].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()),
|
newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()),
|
||||||
childConstUnions[2][arg2comp].getIConst()));
|
childConstUnions[2][arg2comp].getIConst()));
|
||||||
break;
|
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:
|
case EbtInt64:
|
||||||
newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()),
|
newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()),
|
||||||
childConstUnions[2][arg2comp].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()),
|
newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()),
|
||||||
childConstUnions[2][arg2comp].getU64Const()));
|
childConstUnions[2][arg2comp].getU64Const()));
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default: assert(false && "Default missing");
|
default: assert(false && "Default missing");
|
||||||
}
|
}
|
||||||
break;
|
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);
|
void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources);
|
||||||
|
|
||||||
protected:
|
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 add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion);
|
||||||
void addSubpassSampling(TSampler, const TString& typeName, int version, EProfile profile);
|
void addSubpassSampling(TSampler, const TString& typeName, int version, EProfile profile);
|
||||||
void addQueryFunctions(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)) {
|
if ((op == EOpAdd || op == EOpSub) && extensionRequested(E_GL_EXT_buffer_reference2)) {
|
||||||
|
|
||||||
// No addressing math on struct with unsized array.
|
// No addressing math on struct with unsized array.
|
||||||
if ((left->getBasicType() == EbtReference && left->getType().getReferentType()->containsUnsizedArray()) ||
|
if ((left->isReference() && left->getType().getReferentType()->containsUnsizedArray()) ||
|
||||||
(right->getBasicType() == EbtReference && right->getType().getReferentType()->containsUnsizedArray())) {
|
(right->isReference() && right->getType().getReferentType()->containsUnsizedArray())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left->getBasicType() == EbtReference && isTypeInt(right->getBasicType())) {
|
if (left->isReference() && isTypeInt(right->getBasicType())) {
|
||||||
const TType& referenceType = left->getType();
|
const TType& referenceType = left->getType();
|
||||||
TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(left->getType()), loc, true);
|
TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(left->getType()), loc, true);
|
||||||
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
|
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
|
||||||
|
|
@ -141,7 +141,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op == EOpAdd && right->getBasicType() == EbtReference && isTypeInt(left->getBasicType())) {
|
if (op == EOpAdd && right->isReference() && isTypeInt(left->getBasicType())) {
|
||||||
const TType& referenceType = right->getType();
|
const TType& referenceType = right->getType();
|
||||||
TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(right->getType()), loc, true);
|
TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(right->getType()), loc, true);
|
||||||
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
|
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
|
||||||
|
|
@ -154,7 +154,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
||||||
return node;
|
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);
|
TIntermConstantUnion* size = addConstantUnion((long long)computeBufferReferenceTypeSize(left->getType()), loc, true);
|
||||||
|
|
||||||
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
|
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
|
// No other math operators supported on references
|
||||||
if (left->getBasicType() == EbtReference || right->getBasicType() == EbtReference) {
|
if (left->isReference() || right->isReference()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -216,7 +216,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
||||||
node->getWritableType().getQualifier().makeSpecConstant();
|
node->getWritableType().getQualifier().makeSpecConstant();
|
||||||
|
|
||||||
// If must propagate nonuniform, make a nonuniform.
|
// 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()))
|
isNonuniformPropagating(node->getOp()))
|
||||||
node->getWritableType().getQualifier().nonUniform = true;
|
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
|
// 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
|
// "reference + int" calculation involves a cast back to the original type, which makes it
|
||||||
// not an lvalue.
|
// not an lvalue.
|
||||||
if ((op == EOpAddAssign || op == EOpSubAssign) && left->getBasicType() == EbtReference &&
|
if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference() &&
|
||||||
extensionRequested(E_GL_EXT_buffer_reference2)) {
|
extensionRequested(E_GL_EXT_buffer_reference2)) {
|
||||||
|
|
||||||
if (!(right->getType().isScalar() && right->getType().isIntegerDomain()))
|
if (!(right->getType().isScalar() && right->getType().isIntegerDomain()))
|
||||||
|
|
@ -359,7 +359,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case EOpLogicalNot:
|
case EOpLogicalNot:
|
||||||
if (source == EShSourceHlsl) {
|
if (getSource() == EShSourceHlsl) {
|
||||||
break; // HLSL can promote logical not
|
break; // HLSL can promote logical not
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -383,18 +383,20 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
||||||
//
|
//
|
||||||
TBasicType newType = EbtVoid;
|
TBasicType newType = EbtVoid;
|
||||||
switch (op) {
|
switch (op) {
|
||||||
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 EOpConstructBool: newType = EbtBool; break;
|
||||||
case EOpConstructFloat: newType = EbtFloat; 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 EOpConstructInt64: newType = EbtInt64; break;
|
||||||
|
case EOpConstructUint64: newType = EbtUint64; break;
|
||||||
case EOpConstructDouble: newType = EbtDouble; break;
|
case EOpConstructDouble: newType = EbtDouble; break;
|
||||||
case EOpConstructFloat16: newType = EbtFloat16; break;
|
case EOpConstructFloat16: newType = EbtFloat16; break;
|
||||||
|
#endif
|
||||||
default: break; // some compilers want this
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -449,7 +451,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
||||||
node->getWritableType().getQualifier().makeSpecConstant();
|
node->getWritableType().getQualifier().makeSpecConstant();
|
||||||
|
|
||||||
// If must propagate nonuniform, make a nonuniform.
|
// 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;
|
node->getWritableType().getQualifier().nonUniform = true;
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
@ -536,15 +538,13 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const
|
||||||
return false;
|
return false;
|
||||||
case EbtAtomicUint:
|
case EbtAtomicUint:
|
||||||
case EbtSampler:
|
case EbtSampler:
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EbtAccStructNV:
|
case EbtAccStructNV:
|
||||||
#endif
|
|
||||||
// opaque types can be passed to functions
|
// opaque types can be passed to functions
|
||||||
if (op == EOpFunction)
|
if (op == EOpFunction)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// HLSL can assign samplers directly (no constructor)
|
// HLSL can assign samplers directly (no constructor)
|
||||||
if (source == EShSourceHlsl && node->getBasicType() == EbtSampler)
|
if (getSource() == EShSourceHlsl && node->getBasicType() == EbtSampler)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// samplers can get assigned via a sampler constructor
|
// samplers can get assigned via a sampler constructor
|
||||||
|
|
@ -609,16 +609,17 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (convertTo) {
|
switch (convertTo) {
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
switch (node->getBasicType()) {
|
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 EbtInt8: newOp = EOpConvInt8ToDouble; break;
|
||||||
case EbtUint8: newOp = EOpConvUint8ToDouble; break;
|
case EbtUint8: newOp = EOpConvUint8ToDouble; break;
|
||||||
case EbtInt16: newOp = EOpConvInt16ToDouble; break;
|
case EbtInt16: newOp = EOpConvInt16ToDouble; break;
|
||||||
case EbtUint16: newOp = EOpConvUint16ToDouble; 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 EbtFloat16: newOp = EOpConvFloat16ToDouble; break;
|
||||||
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
|
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
|
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
|
||||||
|
|
@ -626,23 +627,27 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
switch (node->getBasicType()) {
|
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 EbtInt8: newOp = EOpConvInt8ToFloat; break;
|
||||||
case EbtUint8: newOp = EOpConvUint8ToFloat; break;
|
case EbtUint8: newOp = EOpConvUint8ToFloat; break;
|
||||||
case EbtInt16: newOp = EOpConvInt16ToFloat; break;
|
case EbtInt16: newOp = EOpConvInt16ToFloat; break;
|
||||||
case EbtUint16: newOp = EOpConvUint16ToFloat; 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 EbtFloat16: newOp = EOpConvFloat16ToFloat; break;
|
||||||
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
|
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
|
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
switch (node->getBasicType()) {
|
switch (node->getBasicType()) {
|
||||||
case EbtInt8: newOp = EOpConvInt8ToFloat16; break;
|
case EbtInt8: newOp = EOpConvInt8ToFloat16; break;
|
||||||
|
|
@ -660,23 +665,27 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
switch (node->getBasicType()) {
|
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 EbtInt8: newOp = EOpConvInt8ToBool; break;
|
||||||
case EbtUint8: newOp = EOpConvUint8ToBool; break;
|
case EbtUint8: newOp = EOpConvUint8ToBool; break;
|
||||||
case EbtInt16: newOp = EOpConvInt16ToBool; break;
|
case EbtInt16: newOp = EOpConvInt16ToBool; break;
|
||||||
case EbtUint16: newOp = EOpConvUint16ToBool; 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 EbtFloat16: newOp = EOpConvFloat16ToBool; break;
|
||||||
case EbtInt64: newOp = EOpConvInt64ToBool; break;
|
case EbtInt64: newOp = EOpConvInt64ToBool; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToBool; break;
|
case EbtUint64: newOp = EOpConvUint64ToBool; break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt8:
|
case EbtInt8:
|
||||||
switch (node->getBasicType()) {
|
switch (node->getBasicType()) {
|
||||||
case EbtUint8: newOp = EOpConvUint8ToInt8; break;
|
case EbtUint8: newOp = EOpConvUint8ToInt8; break;
|
||||||
|
|
@ -746,41 +755,47 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
switch (node->getBasicType()) {
|
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 EbtInt8: newOp = EOpConvInt8ToInt; break;
|
||||||
case EbtUint8: newOp = EOpConvUint8ToInt; break;
|
case EbtUint8: newOp = EOpConvUint8ToInt; break;
|
||||||
case EbtInt16: newOp = EOpConvInt16ToInt; break;
|
case EbtInt16: newOp = EOpConvInt16ToInt; break;
|
||||||
case EbtUint16: newOp = EOpConvUint16ToInt; 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 EbtDouble: newOp = EOpConvDoubleToInt; break;
|
||||||
case EbtFloat16: newOp = EOpConvFloat16ToInt; break;
|
case EbtFloat16: newOp = EOpConvFloat16ToInt; break;
|
||||||
case EbtInt64: newOp = EOpConvInt64ToInt; break;
|
case EbtInt64: newOp = EOpConvInt64ToInt; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToInt; break;
|
case EbtUint64: newOp = EOpConvUint64ToInt; break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
switch (node->getBasicType()) {
|
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 EbtInt8: newOp = EOpConvInt8ToUint; break;
|
||||||
case EbtUint8: newOp = EOpConvUint8ToUint; break;
|
case EbtUint8: newOp = EOpConvUint8ToUint; break;
|
||||||
case EbtInt16: newOp = EOpConvInt16ToUint; break;
|
case EbtInt16: newOp = EOpConvInt16ToUint; break;
|
||||||
case EbtUint16: newOp = EOpConvUint16ToUint; 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 EbtDouble: newOp = EOpConvDoubleToUint; break;
|
||||||
case EbtFloat16: newOp = EOpConvFloat16ToUint; break;
|
case EbtFloat16: newOp = EOpConvFloat16ToUint; break;
|
||||||
case EbtInt64: newOp = EOpConvInt64ToUint; break;
|
case EbtInt64: newOp = EOpConvInt64ToUint; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToUint; break;
|
case EbtUint64: newOp = EOpConvUint64ToUint; break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
switch (node->getBasicType()) {
|
switch (node->getBasicType()) {
|
||||||
case EbtInt8: newOp = EOpConvInt8ToInt64; break;
|
case EbtInt8: newOp = EOpConvInt8ToInt64; break;
|
||||||
|
|
@ -815,6 +830,7 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -921,7 +937,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no
|
||||||
case EOpLogicalAnd:
|
case EOpLogicalAnd:
|
||||||
case EOpLogicalOr:
|
case EOpLogicalOr:
|
||||||
case EOpLogicalXor:
|
case EOpLogicalXor:
|
||||||
if (source == EShSourceHlsl)
|
if (getSource() == EShSourceHlsl)
|
||||||
promoteTo = std::make_tuple(EbtBool, EbtBool);
|
promoteTo = std::make_tuple(EbtBool, EbtBool);
|
||||||
else
|
else
|
||||||
return std::make_tuple(node0, node1);
|
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.
|
// HLSL can promote bools to ints to make this work.
|
||||||
case EOpLeftShift:
|
case EOpLeftShift:
|
||||||
case EOpRightShift:
|
case EOpRightShift:
|
||||||
if (source == EShSourceHlsl) {
|
if (getSource() == EShSourceHlsl) {
|
||||||
TBasicType node0BasicType = node0->getBasicType();
|
TBasicType node0BasicType = node0->getBasicType();
|
||||||
if (node0BasicType == EbtBool)
|
if (node0BasicType == EbtBool)
|
||||||
node0BasicType = EbtInt;
|
node0BasicType = EbtInt;
|
||||||
|
|
@ -1027,6 +1043,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||||
case EOpConstructFloat:
|
case EOpConstructFloat:
|
||||||
promoteTo = EbtFloat;
|
promoteTo = EbtFloat;
|
||||||
break;
|
break;
|
||||||
|
case EOpConstructInt:
|
||||||
|
promoteTo = EbtInt;
|
||||||
|
break;
|
||||||
|
case EOpConstructUint:
|
||||||
|
promoteTo = EbtUint;
|
||||||
|
break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EOpConstructDouble:
|
case EOpConstructDouble:
|
||||||
promoteTo = EbtDouble;
|
promoteTo = EbtDouble;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1055,18 +1078,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||||
canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
||||||
break;
|
break;
|
||||||
case EOpConstructInt:
|
|
||||||
promoteTo = EbtInt;
|
|
||||||
break;
|
|
||||||
case EOpConstructUint:
|
|
||||||
promoteTo = EbtUint;
|
|
||||||
break;
|
|
||||||
case EOpConstructInt64:
|
case EOpConstructInt64:
|
||||||
promoteTo = EbtInt64;
|
promoteTo = EbtInt64;
|
||||||
break;
|
break;
|
||||||
case EOpConstructUint64:
|
case EOpConstructUint64:
|
||||||
promoteTo = EbtUint64;
|
promoteTo = EbtUint64;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case EOpLogicalNot:
|
case EOpLogicalNot:
|
||||||
|
|
||||||
|
|
@ -1110,7 +1128,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||||
case EOpConstructStruct:
|
case EOpConstructStruct:
|
||||||
case EOpConstructCooperativeMatrix:
|
case EOpConstructCooperativeMatrix:
|
||||||
|
|
||||||
if (type.getBasicType() == EbtReference || node->getType().getBasicType() == EbtReference) {
|
if (type.isReference() || node->getType().isReference()) {
|
||||||
// types must match to assign a reference
|
// types must match to assign a reference
|
||||||
if (type == node->getType())
|
if (type == node->getType())
|
||||||
return node;
|
return node;
|
||||||
|
|
@ -1133,7 +1151,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||||
case EOpLeftShiftAssign:
|
case EOpLeftShiftAssign:
|
||||||
case EOpRightShiftAssign:
|
case EOpRightShiftAssign:
|
||||||
{
|
{
|
||||||
if (source == EShSourceHlsl && node->getType().getBasicType() == EbtBool)
|
if (getSource() == EShSourceHlsl && node->getType().getBasicType() == EbtBool)
|
||||||
promoteTo = type.getBasicType();
|
promoteTo = type.getBasicType();
|
||||||
else {
|
else {
|
||||||
if (isTypeInt(type.getBasicType()) && isTypeInt(node->getBasicType()))
|
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)
|
TIntermTyped* TIntermediate::addUniShapeConversion(TOperator op, const TType& type, TIntermTyped* node)
|
||||||
{
|
{
|
||||||
// some source languages don't do this
|
// some source languages don't do this
|
||||||
switch (source) {
|
switch (getSource()) {
|
||||||
case EShSourceHlsl:
|
case EShSourceHlsl:
|
||||||
break;
|
break;
|
||||||
case EShSourceGlsl:
|
case EShSourceGlsl:
|
||||||
|
|
@ -1232,7 +1250,7 @@ TIntermTyped* TIntermediate::addUniShapeConversion(TOperator op, const TType& ty
|
||||||
void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode)
|
void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode)
|
||||||
{
|
{
|
||||||
// some source languages don't do this
|
// some source languages don't do this
|
||||||
switch (source) {
|
switch (getSource()) {
|
||||||
case EShSourceHlsl:
|
case EShSourceHlsl:
|
||||||
break;
|
break;
|
||||||
case EShSourceGlsl:
|
case EShSourceGlsl:
|
||||||
|
|
@ -1335,7 +1353,7 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped*
|
||||||
// The new node that handles the conversion
|
// The new node that handles the conversion
|
||||||
TOperator constructorOp = mapTypeToConstructorOp(type);
|
TOperator constructorOp = mapTypeToConstructorOp(type);
|
||||||
|
|
||||||
if (source == EShSourceHlsl) {
|
if (getSource() == EShSourceHlsl) {
|
||||||
// HLSL rules for scalar, vector and matrix conversions:
|
// HLSL rules for scalar, vector and matrix conversions:
|
||||||
// 1) scalar can become anything, initializing every component with its value
|
// 1) scalar can become anything, initializing every component with its value
|
||||||
// 2) vector and matrix can become scalar, first element is used (warning: truncation)
|
// 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
|
bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const
|
||||||
{
|
{
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (from) {
|
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:
|
case EbtInt8:
|
||||||
switch (to) {
|
switch (to) {
|
||||||
case EbtUint8:
|
case EbtUint8:
|
||||||
|
|
@ -1495,26 +1537,6 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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:
|
case EbtInt64:
|
||||||
if (to == EbtUint64) {
|
if (to == EbtUint64) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1528,6 +1550,10 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const
|
||||||
|
|
||||||
bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const
|
bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const
|
||||||
{
|
{
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (to == EbtFloat && from == EbtFloat16) {
|
if (to == EbtFloat && from == EbtFloat16) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1538,6 +1564,17 @@ bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const
|
||||||
bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
|
bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
|
||||||
{
|
{
|
||||||
switch (from) {
|
switch (from) {
|
||||||
|
case EbtInt:
|
||||||
|
case EbtUint:
|
||||||
|
switch(to) {
|
||||||
|
case EbtFloat:
|
||||||
|
case EbtDouble:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EbtInt8:
|
case EbtInt8:
|
||||||
case EbtUint8:
|
case EbtUint8:
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
|
|
@ -1551,23 +1588,13 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EbtInt:
|
|
||||||
case EbtUint:
|
|
||||||
switch(to) {
|
|
||||||
case EbtFloat:
|
|
||||||
case EbtDouble:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
if (to == EbtDouble) {
|
if (to == EbtDouble) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1580,7 +1607,7 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
|
||||||
//
|
//
|
||||||
bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op) const
|
bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op) const
|
||||||
{
|
{
|
||||||
if (profile == EEsProfile || version == 110)
|
if (isEsProfile() || version == 110)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (from == to)
|
if (from == to)
|
||||||
|
|
@ -1588,7 +1615,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
|
|
||||||
// TODO: Move more policies into language-specific handlers.
|
// TODO: Move more policies into language-specific handlers.
|
||||||
// Some languages allow more general (or potentially, more specific) conversions under some conditions.
|
// 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 fromConvertable = (from == EbtFloat || from == EbtDouble || from == EbtInt || from == EbtUint || from == EbtBool);
|
||||||
const bool toConvertable = (to == EbtFloat || to == EbtDouble || to == EbtInt || to == EbtUint || to == 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
|
// hlsl supported conversions
|
||||||
if (source == EShSourceHlsl) {
|
if (getSource() == EShSourceHlsl) {
|
||||||
if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
|
if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1670,13 +1697,11 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
return true;
|
return true;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_half_float);
|
return extensionRequested(E_GL_AMD_gpu_shader_half_float);
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1687,34 +1712,28 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
return true;
|
return true;
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return (source == EShSourceHlsl);
|
return getSource() == EShSourceHlsl;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
#endif
|
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
return
|
return
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
|
extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
|
||||||
#endif
|
getSource() == EShSourceHlsl;
|
||||||
(source == EShSourceHlsl);
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
return version >= 400 || (source == EShSourceHlsl);
|
return version >= 400 || getSource() == EShSourceHlsl;
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
return true;
|
return true;
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return (source == EShSourceHlsl);
|
return getSource() == EShSourceHlsl;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1723,11 +1742,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
return true;
|
return true;
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return (source == EShSourceHlsl);
|
return getSource() == EShSourceHlsl;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1738,11 +1755,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
return true;
|
return true;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1751,15 +1766,12 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
return true;
|
return true;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
|
|
@ -1769,10 +1781,8 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
|
|
@ -1780,7 +1790,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1790,7 +1799,12 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType) {
|
static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType)
|
||||||
|
{
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch(sintType) {
|
switch(sintType) {
|
||||||
case EbtInt8:
|
case EbtInt8:
|
||||||
switch(uintType) {
|
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) {
|
switch(type) {
|
||||||
case EbtInt8:
|
case EbtInt8:
|
||||||
return EbtUint8;
|
return EbtUint8;
|
||||||
|
|
@ -1898,10 +1918,10 @@ std::tuple<TBasicType, TBasicType> TIntermediate::getConversionDestinatonType(TB
|
||||||
TBasicType res0 = EbtNumTypes;
|
TBasicType res0 = EbtNumTypes;
|
||||||
TBasicType res1 = EbtNumTypes;
|
TBasicType res1 = EbtNumTypes;
|
||||||
|
|
||||||
if (profile == EEsProfile || version == 110)
|
if (isEsProfile() || version == 110)
|
||||||
return std::make_tuple(res0, res1);;
|
return std::make_tuple(res0, res1);
|
||||||
|
|
||||||
if (source == EShSourceHlsl) {
|
if (getSource() == EShSourceHlsl) {
|
||||||
if (canImplicitlyPromote(type1, type0, op)) {
|
if (canImplicitlyPromote(type1, type0, op)) {
|
||||||
res0 = type0;
|
res0 = type0;
|
||||||
res1 = type0;
|
res1 = type0;
|
||||||
|
|
@ -1970,7 +1990,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
||||||
{
|
{
|
||||||
TOperator op = EOpNull;
|
TOperator op = EOpNull;
|
||||||
|
|
||||||
if (type.getQualifier().nonUniform)
|
if (type.getQualifier().isNonUniform())
|
||||||
return EOpConstructNonuniform;
|
return EOpConstructNonuniform;
|
||||||
|
|
||||||
if (type.isCoopMat())
|
if (type.isCoopMat())
|
||||||
|
|
@ -1981,7 +2001,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
||||||
op = EOpConstructStruct;
|
op = EOpConstructStruct;
|
||||||
break;
|
break;
|
||||||
case EbtSampler:
|
case EbtSampler:
|
||||||
if (type.getSampler().combined)
|
if (type.getSampler().isCombined())
|
||||||
op = EOpConstructTextureSampler;
|
op = EOpConstructTextureSampler;
|
||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
|
|
@ -2023,6 +2043,121 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case EbtDouble:
|
||||||
if (type.getMatrixCols()) {
|
if (type.getMatrixCols()) {
|
||||||
switch (type.getMatrixCols()) {
|
switch (type.getMatrixCols()) {
|
||||||
|
|
@ -2136,82 +2271,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
||||||
default: break; // some compilers want this
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case EbtInt64:
|
||||||
switch(type.getVectorSize()) {
|
switch(type.getVectorSize()) {
|
||||||
case 1: op = EOpConstructInt64; break;
|
case 1: op = EOpConstructInt64; break;
|
||||||
|
|
@ -2230,47 +2289,10 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
||||||
default: break; // some compilers want this
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case EbtReference:
|
||||||
op = EOpConstructReference;
|
op = EOpConstructReference;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2729,6 +2751,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
|
||||||
if (aggRoot && aggRoot->getOp() == EOpNull)
|
if (aggRoot && aggRoot->getOp() == EOpNull)
|
||||||
aggRoot->setOperator(EOpSequence);
|
aggRoot->setOperator(EOpSequence);
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Propagate 'noContraction' label in backward from 'precise' variables.
|
// Propagate 'noContraction' label in backward from 'precise' variables.
|
||||||
glslang::PropagateNoContraction(*this);
|
glslang::PropagateNoContraction(*this);
|
||||||
|
|
||||||
|
|
@ -2739,6 +2762,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
|
||||||
performTextureUpgradeAndSamplerRemovalTransformation(root);
|
performTextureUpgradeAndSamplerRemovalTransformation(root);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
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(Set, CType, Get) leftUnionArray[i].Set(static_cast<CType>(rightUnionArray[i].Get()))
|
||||||
#define PROMOTE_TO_BOOL(Get) leftUnionArray[i].setBConst(rightUnionArray[i].Get() != 0)
|
#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) \
|
#define TO_ALL(Get) \
|
||||||
switch (promoteTo) { \
|
switch (promoteTo) { \
|
||||||
case EbtFloat16: PROMOTE(setDConst, double, Get); break; \
|
case EbtFloat16: PROMOTE(setDConst, double, Get); break; \
|
||||||
|
|
@ -3796,20 +3830,23 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
||||||
case EbtBool: PROMOTE_TO_BOOL(Get); break; \
|
case EbtBool: PROMOTE_TO_BOOL(Get); break; \
|
||||||
default: return node; \
|
default: return node; \
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (node->getType().getBasicType()) {
|
switch (node->getType().getBasicType()) {
|
||||||
case EbtFloat16: TO_ALL(getDConst); break;
|
|
||||||
case EbtFloat: 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 EbtDouble: TO_ALL(getDConst); break;
|
||||||
case EbtInt8: TO_ALL(getI8Const); break;
|
case EbtInt8: TO_ALL(getI8Const); break;
|
||||||
case EbtInt16: TO_ALL(getI16Const); break;
|
case EbtInt16: TO_ALL(getI16Const); break;
|
||||||
case EbtInt: TO_ALL(getIConst); break;
|
|
||||||
case EbtInt64: TO_ALL(getI64Const); break;
|
case EbtInt64: TO_ALL(getI64Const); break;
|
||||||
case EbtUint8: TO_ALL(getU8Const); break;
|
case EbtUint8: TO_ALL(getU8Const); break;
|
||||||
case EbtUint16: TO_ALL(getU16Const); break;
|
case EbtUint16: TO_ALL(getU16Const); break;
|
||||||
case EbtUint: TO_ALL(getUConst); break;
|
|
||||||
case EbtUint64: TO_ALL(getU64Const); break;
|
case EbtUint64: TO_ALL(getU64Const); break;
|
||||||
case EbtBool: TO_ALL(getBConst); break;
|
#endif
|
||||||
default: return node;
|
default: return node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3839,7 +3876,7 @@ bool TIntermediate::specConstantPropagates(const TIntermTyped& node1, const TInt
|
||||||
struct TextureUpgradeAndSamplerRemovalTransform : public TIntermTraverser {
|
struct TextureUpgradeAndSamplerRemovalTransform : public TIntermTraverser {
|
||||||
void visitSymbol(TIntermSymbol* symbol) override {
|
void visitSymbol(TIntermSymbol* symbol) override {
|
||||||
if (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isTexture()) {
|
if (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isTexture()) {
|
||||||
symbol->getWritableType().getSampler().combined = true;
|
symbol->getWritableType().getSampler().setCombined(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool visitAggregate(TVisit, TIntermAggregate* ag) override {
|
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,
|
void C_DECL TParseContextBase::error(const TSourceLoc& loc, const char* szReason, const char* szToken,
|
||||||
const char* szExtraInfoFormat, ...)
|
const char* szExtraInfoFormat, ...)
|
||||||
{
|
{
|
||||||
|
|
@ -113,6 +115,8 @@ void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReaso
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Both test and if necessary, spit out an error, to see if the node is really
|
// 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.
|
// 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 EvqConst: message = "can't modify a const"; break;
|
||||||
case EvqConstReadOnly: 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;
|
case EvqUniform: message = "can't modify a uniform"; break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EvqBuffer:
|
case EvqBuffer:
|
||||||
if (node->getQualifier().readonly)
|
if (node->getQualifier().isReadOnly())
|
||||||
message = "can't modify a readonly buffer";
|
message = "can't modify a readonly buffer";
|
||||||
#ifdef NV_EXTENSIONS
|
if (node->getQualifier().isShaderRecordNV())
|
||||||
if (node->getQualifier().layoutShaderRecordNV)
|
|
||||||
message = "can't modify a shaderrecordnv qualified buffer";
|
message = "can't modify a shaderrecordnv qualified buffer";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EvqHitAttrNV:
|
case EvqHitAttrNV:
|
||||||
if (language != EShLangIntersectNV)
|
if (language != EShLangIntersectNV)
|
||||||
message = "cannot modify hitAttributeNV in this stage";
|
message = "cannot modify hitAttributeNV in this stage";
|
||||||
|
|
@ -172,13 +174,13 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
|
||||||
case EbtSampler:
|
case EbtSampler:
|
||||||
message = "can't modify a sampler";
|
message = "can't modify a sampler";
|
||||||
break;
|
break;
|
||||||
case EbtAtomicUint:
|
|
||||||
message = "can't modify an atomic_uint";
|
|
||||||
break;
|
|
||||||
case EbtVoid:
|
case EbtVoid:
|
||||||
message = "can't modify void";
|
message = "can't modify void";
|
||||||
break;
|
break;
|
||||||
#ifdef NV_EXTENSIONS
|
#ifndef GLSLANG_WEB
|
||||||
|
case EbtAtomicUint:
|
||||||
|
message = "can't modify an atomic_uint";
|
||||||
|
break;
|
||||||
case EbtAccStructNV:
|
case EbtAccStructNV:
|
||||||
message = "can't modify accelerationStructureNV";
|
message = "can't modify accelerationStructureNV";
|
||||||
break;
|
break;
|
||||||
|
|
@ -234,7 +236,7 @@ void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op,
|
||||||
}
|
}
|
||||||
|
|
||||||
TIntermSymbol* symNode = node->getAsSymbolNode();
|
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());
|
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);
|
selector.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
//
|
//
|
||||||
// Make the passed-in variable information become a member of the
|
// Make the passed-in variable information become a member of the
|
||||||
// global uniform block. If this doesn't exist yet, make it.
|
// global uniform block. If this doesn't exist yet, make it.
|
||||||
|
|
@ -618,6 +621,7 @@ void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& mem
|
||||||
|
|
||||||
++firstNewMember;
|
++firstNewMember;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void TParseContextBase::finish()
|
void TParseContextBase::finish()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -97,6 +97,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual ~TParseContextBase() { }
|
virtual ~TParseContextBase() { }
|
||||||
|
|
||||||
|
#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL)
|
||||||
virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
|
virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||||
const char* szExtraInfoFormat, ...);
|
const char* szExtraInfoFormat, ...);
|
||||||
virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken,
|
virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||||
|
|
@ -105,6 +106,7 @@ public:
|
||||||
const char* szExtraInfoFormat, ...);
|
const char* szExtraInfoFormat, ...);
|
||||||
virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||||
const char* szExtraInfoFormat, ...);
|
const char* szExtraInfoFormat, ...);
|
||||||
|
#endif
|
||||||
|
|
||||||
virtual void setLimits(const TBuiltInResource&) = 0;
|
virtual void setLimits(const TBuiltInResource&) = 0;
|
||||||
|
|
||||||
|
|
@ -150,8 +152,10 @@ public:
|
||||||
extensionCallback(line, extension, behavior);
|
extensionCallback(line, extension, behavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
// Manage the global uniform block (default uniforms in GLSL, $Global in 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);
|
virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Potentially rename shader entry point function
|
// Potentially rename shader entry point function
|
||||||
void renameShaderFunction(TString*& name) const
|
void renameShaderFunction(TString*& name) const
|
||||||
|
|
@ -297,10 +301,12 @@ public:
|
||||||
TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
|
TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
|
||||||
void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
|
void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
void makeEditable(TSymbol*&) override;
|
void makeEditable(TSymbol*&) override;
|
||||||
|
void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier);
|
||||||
|
#endif
|
||||||
bool isIoResizeArray(const TType&) const;
|
bool isIoResizeArray(const TType&) const;
|
||||||
void fixIoArraySize(const TSourceLoc&, TType&);
|
void fixIoArraySize(const TSourceLoc&, TType&);
|
||||||
void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier);
|
|
||||||
void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base);
|
void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base);
|
||||||
void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false);
|
void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false);
|
||||||
int getIoArrayImplicitSize(const TQualifier&, TString* featureString = nullptr) const;
|
int getIoArrayImplicitSize(const TQualifier&, TString* featureString = nullptr) const;
|
||||||
|
|
@ -417,6 +423,7 @@ public:
|
||||||
void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode);
|
void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode);
|
||||||
TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body);
|
TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body);
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
TAttributeType attributeFromName(const TString& name) const;
|
TAttributeType attributeFromName(const TString& name) const;
|
||||||
TAttributes* makeAttributes(const TString& identifier) const;
|
TAttributes* makeAttributes(const TString& identifier) const;
|
||||||
TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const;
|
TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const;
|
||||||
|
|
@ -425,9 +432,9 @@ public:
|
||||||
// Determine selection control from attributes
|
// Determine selection control from attributes
|
||||||
void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*);
|
void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*);
|
||||||
void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*);
|
void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*);
|
||||||
|
|
||||||
// Determine loop control from attributes
|
// Determine loop control from attributes
|
||||||
void handleLoopAttributes(const TAttributes& attributes, TIntermNode*);
|
void handleLoopAttributes(const TAttributes& attributes, TIntermNode*);
|
||||||
|
#endif
|
||||||
|
|
||||||
void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember);
|
void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember);
|
||||||
|
|
||||||
|
|
@ -441,7 +448,9 @@ protected:
|
||||||
bool isRuntimeLength(const TIntermTyped&) const;
|
bool isRuntimeLength(const TIntermTyped&) const;
|
||||||
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
|
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
|
||||||
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
|
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
void finish() override;
|
void finish() override;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
|
|
@ -467,10 +476,11 @@ protected:
|
||||||
TQualifier globalUniformDefaults;
|
TQualifier globalUniformDefaults;
|
||||||
TQualifier globalInputDefaults;
|
TQualifier globalInputDefaults;
|
||||||
TQualifier globalOutputDefaults;
|
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)
|
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;
|
bool anyIndexLimits;
|
||||||
|
TIdSetType inductiveLoopIds;
|
||||||
TVector<TIntermTyped*> needsIndexLimitationChecking;
|
TVector<TIntermTyped*> needsIndexLimitationChecking;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -506,6 +516,7 @@ protected:
|
||||||
// array-sizing declarations
|
// array-sizing declarations
|
||||||
//
|
//
|
||||||
TVector<TSymbol*> ioArraySymbolResizeList;
|
TVector<TSymbol*> ioArraySymbolResizeList;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,9 @@ struct str_hash
|
||||||
// A single global usable by all threads, by all versions, by all languages.
|
// 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
|
// 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;
|
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;
|
std::unordered_set<const char*, str_hash, str_eq>* ReservedSet = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -341,9 +343,14 @@ void TScanContext::fillInKeywordMap()
|
||||||
|
|
||||||
(*KeywordMap)["const"] = CONST;
|
(*KeywordMap)["const"] = CONST;
|
||||||
(*KeywordMap)["uniform"] = UNIFORM;
|
(*KeywordMap)["uniform"] = UNIFORM;
|
||||||
(*KeywordMap)["nonuniformEXT"] = NONUNIFORM;
|
|
||||||
(*KeywordMap)["in"] = IN;
|
(*KeywordMap)["in"] = IN;
|
||||||
(*KeywordMap)["out"] = OUT;
|
(*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)["inout"] = INOUT;
|
||||||
(*KeywordMap)["struct"] = STRUCT;
|
(*KeywordMap)["struct"] = STRUCT;
|
||||||
(*KeywordMap)["break"] = BREAK;
|
(*KeywordMap)["break"] = BREAK;
|
||||||
|
|
@ -356,7 +363,6 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["default"] = DEFAULT;
|
(*KeywordMap)["default"] = DEFAULT;
|
||||||
(*KeywordMap)["if"] = IF;
|
(*KeywordMap)["if"] = IF;
|
||||||
(*KeywordMap)["else"] = ELSE;
|
(*KeywordMap)["else"] = ELSE;
|
||||||
(*KeywordMap)["demote"] = DEMOTE;
|
|
||||||
(*KeywordMap)["discard"] = DISCARD;
|
(*KeywordMap)["discard"] = DISCARD;
|
||||||
(*KeywordMap)["return"] = RETURN;
|
(*KeywordMap)["return"] = RETURN;
|
||||||
(*KeywordMap)["void"] = VOID;
|
(*KeywordMap)["void"] = VOID;
|
||||||
|
|
@ -377,8 +383,33 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["mat4"] = MAT4;
|
(*KeywordMap)["mat4"] = MAT4;
|
||||||
(*KeywordMap)["true"] = BOOLCONSTANT;
|
(*KeywordMap)["true"] = BOOLCONSTANT;
|
||||||
(*KeywordMap)["false"] = 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)["attribute"] = ATTRIBUTE;
|
||||||
(*KeywordMap)["varying"] = VARYING;
|
(*KeywordMap)["varying"] = VARYING;
|
||||||
|
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
|
||||||
(*KeywordMap)["buffer"] = BUFFER;
|
(*KeywordMap)["buffer"] = BUFFER;
|
||||||
(*KeywordMap)["coherent"] = COHERENT;
|
(*KeywordMap)["coherent"] = COHERENT;
|
||||||
(*KeywordMap)["devicecoherent"] = DEVICECOHERENT;
|
(*KeywordMap)["devicecoherent"] = DEVICECOHERENT;
|
||||||
|
|
@ -391,24 +422,9 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["writeonly"] = WRITEONLY;
|
(*KeywordMap)["writeonly"] = WRITEONLY;
|
||||||
(*KeywordMap)["atomic_uint"] = ATOMIC_UINT;
|
(*KeywordMap)["atomic_uint"] = ATOMIC_UINT;
|
||||||
(*KeywordMap)["volatile"] = VOLATILE;
|
(*KeywordMap)["volatile"] = VOLATILE;
|
||||||
(*KeywordMap)["layout"] = LAYOUT;
|
|
||||||
(*KeywordMap)["shared"] = SHARED;
|
|
||||||
(*KeywordMap)["patch"] = PATCH;
|
(*KeywordMap)["patch"] = PATCH;
|
||||||
(*KeywordMap)["sample"] = SAMPLE;
|
(*KeywordMap)["sample"] = SAMPLE;
|
||||||
(*KeywordMap)["subroutine"] = SUBROUTINE;
|
(*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)["dmat2"] = DMAT2;
|
||||||
(*KeywordMap)["dmat3"] = DMAT3;
|
(*KeywordMap)["dmat3"] = DMAT3;
|
||||||
(*KeywordMap)["dmat4"] = DMAT4;
|
(*KeywordMap)["dmat4"] = DMAT4;
|
||||||
|
|
@ -458,11 +474,6 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["dvec2"] = DVEC2;
|
(*KeywordMap)["dvec2"] = DVEC2;
|
||||||
(*KeywordMap)["dvec3"] = DVEC3;
|
(*KeywordMap)["dvec3"] = DVEC3;
|
||||||
(*KeywordMap)["dvec4"] = DVEC4;
|
(*KeywordMap)["dvec4"] = DVEC4;
|
||||||
(*KeywordMap)["uint"] = UINT;
|
|
||||||
(*KeywordMap)["uvec2"] = UVEC2;
|
|
||||||
(*KeywordMap)["uvec3"] = UVEC3;
|
|
||||||
(*KeywordMap)["uvec4"] = UVEC4;
|
|
||||||
|
|
||||||
(*KeywordMap)["int64_t"] = INT64_T;
|
(*KeywordMap)["int64_t"] = INT64_T;
|
||||||
(*KeywordMap)["uint64_t"] = UINT64_T;
|
(*KeywordMap)["uint64_t"] = UINT64_T;
|
||||||
(*KeywordMap)["i64vec2"] = I64VEC2;
|
(*KeywordMap)["i64vec2"] = I64VEC2;
|
||||||
|
|
@ -549,6 +560,7 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["f64mat4x2"] = F64MAT4X2;
|
(*KeywordMap)["f64mat4x2"] = F64MAT4X2;
|
||||||
(*KeywordMap)["f64mat4x3"] = F64MAT4X3;
|
(*KeywordMap)["f64mat4x3"] = F64MAT4X3;
|
||||||
(*KeywordMap)["f64mat4x4"] = F64MAT4X4;
|
(*KeywordMap)["f64mat4x4"] = F64MAT4X4;
|
||||||
|
#endif
|
||||||
|
|
||||||
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
||||||
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
|
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
|
||||||
|
|
@ -556,12 +568,6 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW;
|
(*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW;
|
||||||
(*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY;
|
(*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY;
|
||||||
(*KeywordMap)["usamplerCubeArray"] = USAMPLERCUBEARRAY;
|
(*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)["samplerCubeShadow"] = SAMPLERCUBESHADOW;
|
||||||
(*KeywordMap)["sampler2DArray"] = SAMPLER2DARRAY;
|
(*KeywordMap)["sampler2DArray"] = SAMPLER2DARRAY;
|
||||||
(*KeywordMap)["sampler2DArrayShadow"] = SAMPLER2DARRAYSHADOW;
|
(*KeywordMap)["sampler2DArrayShadow"] = SAMPLER2DARRAYSHADOW;
|
||||||
|
|
@ -573,6 +579,16 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["usampler3D"] = USAMPLER3D;
|
(*KeywordMap)["usampler3D"] = USAMPLER3D;
|
||||||
(*KeywordMap)["usamplerCube"] = USAMPLERCUBE;
|
(*KeywordMap)["usamplerCube"] = USAMPLERCUBE;
|
||||||
(*KeywordMap)["usampler2DArray"] = USAMPLER2DARRAY;
|
(*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)["isampler2DRect"] = ISAMPLER2DRECT;
|
||||||
(*KeywordMap)["usampler2DRect"] = USAMPLER2DRECT;
|
(*KeywordMap)["usampler2DRect"] = USAMPLER2DRECT;
|
||||||
(*KeywordMap)["isamplerBuffer"] = ISAMPLERBUFFER;
|
(*KeywordMap)["isamplerBuffer"] = ISAMPLERBUFFER;
|
||||||
|
|
@ -585,8 +601,6 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["usampler2DMSArray"] = USAMPLER2DMSARRAY;
|
(*KeywordMap)["usampler2DMSArray"] = USAMPLER2DMSARRAY;
|
||||||
(*KeywordMap)["sampler1D"] = SAMPLER1D;
|
(*KeywordMap)["sampler1D"] = SAMPLER1D;
|
||||||
(*KeywordMap)["sampler1DShadow"] = SAMPLER1DSHADOW;
|
(*KeywordMap)["sampler1DShadow"] = SAMPLER1DSHADOW;
|
||||||
(*KeywordMap)["sampler3D"] = SAMPLER3D;
|
|
||||||
(*KeywordMap)["sampler2DShadow"] = SAMPLER2DSHADOW;
|
|
||||||
(*KeywordMap)["sampler2DRect"] = SAMPLER2DRECT;
|
(*KeywordMap)["sampler2DRect"] = SAMPLER2DRECT;
|
||||||
(*KeywordMap)["sampler2DRectShadow"] = SAMPLER2DRECTSHADOW;
|
(*KeywordMap)["sampler2DRectShadow"] = SAMPLER2DRECTSHADOW;
|
||||||
(*KeywordMap)["sampler1DArray"] = SAMPLER1DARRAY;
|
(*KeywordMap)["sampler1DArray"] = SAMPLER1DARRAY;
|
||||||
|
|
@ -639,7 +653,6 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["usubpassInput"] = USUBPASSINPUT;
|
(*KeywordMap)["usubpassInput"] = USUBPASSINPUT;
|
||||||
(*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS;
|
(*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS;
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
(*KeywordMap)["f16sampler1D"] = F16SAMPLER1D;
|
(*KeywordMap)["f16sampler1D"] = F16SAMPLER1D;
|
||||||
(*KeywordMap)["f16sampler2D"] = F16SAMPLER2D;
|
(*KeywordMap)["f16sampler2D"] = F16SAMPLER2D;
|
||||||
(*KeywordMap)["f16sampler3D"] = F16SAMPLER3D;
|
(*KeywordMap)["f16sampler3D"] = F16SAMPLER3D;
|
||||||
|
|
@ -685,25 +698,10 @@ void TScanContext::fillInKeywordMap()
|
||||||
|
|
||||||
(*KeywordMap)["f16subpassInput"] = F16SUBPASSINPUT;
|
(*KeywordMap)["f16subpassInput"] = F16SUBPASSINPUT;
|
||||||
(*KeywordMap)["f16subpassInputMS"] = F16SUBPASSINPUTMS;
|
(*KeywordMap)["f16subpassInputMS"] = F16SUBPASSINPUTMS;
|
||||||
#endif
|
|
||||||
|
|
||||||
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
|
|
||||||
(*KeywordMap)["smooth"] = SMOOTH;
|
|
||||||
(*KeywordMap)["flat"] = FLAT;
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
(*KeywordMap)["__explicitInterpAMD"] = EXPLICITINTERPAMD;
|
(*KeywordMap)["__explicitInterpAMD"] = EXPLICITINTERPAMD;
|
||||||
#endif
|
|
||||||
(*KeywordMap)["centroid"] = CENTROID;
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
(*KeywordMap)["pervertexNV"] = PERVERTEXNV;
|
(*KeywordMap)["pervertexNV"] = PERVERTEXNV;
|
||||||
#endif
|
|
||||||
(*KeywordMap)["precise"] = PRECISE;
|
(*KeywordMap)["precise"] = PRECISE;
|
||||||
(*KeywordMap)["invariant"] = INVARIANT;
|
|
||||||
(*KeywordMap)["packed"] = PACKED;
|
|
||||||
(*KeywordMap)["resource"] = RESOURCE;
|
|
||||||
(*KeywordMap)["superp"] = SUPERP;
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
(*KeywordMap)["rayPayloadNV"] = PAYLOADNV;
|
(*KeywordMap)["rayPayloadNV"] = PAYLOADNV;
|
||||||
(*KeywordMap)["rayPayloadInNV"] = PAYLOADINNV;
|
(*KeywordMap)["rayPayloadInNV"] = PAYLOADINNV;
|
||||||
(*KeywordMap)["hitAttributeNV"] = HITATTRNV;
|
(*KeywordMap)["hitAttributeNV"] = HITATTRNV;
|
||||||
|
|
@ -713,7 +711,6 @@ void TScanContext::fillInKeywordMap()
|
||||||
(*KeywordMap)["perprimitiveNV"] = PERPRIMITIVENV;
|
(*KeywordMap)["perprimitiveNV"] = PERPRIMITIVENV;
|
||||||
(*KeywordMap)["perviewNV"] = PERVIEWNV;
|
(*KeywordMap)["perviewNV"] = PERVIEWNV;
|
||||||
(*KeywordMap)["taskNV"] = PERTASKNV;
|
(*KeywordMap)["taskNV"] = PERTASKNV;
|
||||||
#endif
|
|
||||||
|
|
||||||
(*KeywordMap)["fcoopmatNV"] = FCOOPMATNV;
|
(*KeywordMap)["fcoopmatNV"] = FCOOPMATNV;
|
||||||
|
|
||||||
|
|
@ -756,14 +753,17 @@ void TScanContext::fillInKeywordMap()
|
||||||
ReservedSet->insert("cast");
|
ReservedSet->insert("cast");
|
||||||
ReservedSet->insert("namespace");
|
ReservedSet->insert("namespace");
|
||||||
ReservedSet->insert("using");
|
ReservedSet->insert("using");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TScanContext::deleteKeywordMap()
|
void TScanContext::deleteKeywordMap()
|
||||||
{
|
{
|
||||||
delete KeywordMap;
|
delete KeywordMap;
|
||||||
KeywordMap = nullptr;
|
KeywordMap = nullptr;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
delete ReservedSet;
|
delete ReservedSet;
|
||||||
ReservedSet = nullptr;
|
ReservedSet = nullptr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by yylex to get the next token.
|
// 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 PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT;
|
||||||
case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT;
|
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 PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT;
|
||||||
case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT;
|
case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT;
|
||||||
case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT;
|
case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT;
|
||||||
case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT;
|
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 PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT;
|
||||||
case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT;
|
case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT;
|
||||||
|
#endif
|
||||||
case PpAtomIdentifier:
|
case PpAtomIdentifier:
|
||||||
{
|
{
|
||||||
int token = tokenizeIdentifier();
|
int token = tokenizeIdentifier();
|
||||||
|
|
@ -870,8 +872,10 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
|
||||||
|
|
||||||
int TScanContext::tokenizeIdentifier()
|
int TScanContext::tokenizeIdentifier()
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (ReservedSet->find(tokenText) != ReservedSet->end())
|
if (ReservedSet->find(tokenText) != ReservedSet->end())
|
||||||
return reservedWord();
|
return reservedWord();
|
||||||
|
#endif
|
||||||
|
|
||||||
auto it = KeywordMap->find(tokenText);
|
auto it = KeywordMap->find(tokenText);
|
||||||
if (it == KeywordMap->end()) {
|
if (it == KeywordMap->end()) {
|
||||||
|
|
@ -902,16 +906,10 @@ int TScanContext::tokenizeIdentifier()
|
||||||
afterStruct = true;
|
afterStruct = true;
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
case NONUNIFORM:
|
|
||||||
if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier))
|
|
||||||
return keyword;
|
|
||||||
else
|
|
||||||
return identifierOrType();
|
|
||||||
|
|
||||||
case SWITCH:
|
case SWITCH:
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version < 130))
|
(!parseContext.isEsProfile() && parseContext.version < 130))
|
||||||
reservedWord();
|
reservedWord();
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
|
|
@ -943,20 +941,66 @@ int TScanContext::tokenizeIdentifier()
|
||||||
parserToken->sType.lex.b = false;
|
parserToken->sType.lex.b = false;
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
case ATTRIBUTE:
|
case SMOOTH:
|
||||||
case VARYING:
|
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||||
if (parseContext.profile == EEsProfile && parseContext.version >= 300)
|
(!parseContext.isEsProfile() && parseContext.version < 130))
|
||||||
reservedWord();
|
|
||||||
return keyword;
|
|
||||||
|
|
||||||
case BUFFER:
|
|
||||||
afterBuffer = true;
|
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version < 310) ||
|
|
||||||
(parseContext.profile != EEsProfile && parseContext.version < 430))
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
return keyword;
|
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 PAYLOADNV:
|
||||||
case PAYLOADINNV:
|
case PAYLOADINNV:
|
||||||
case HITATTRNV:
|
case HITATTRNV:
|
||||||
|
|
@ -964,14 +1008,12 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case CALLDATAINNV:
|
case CALLDATAINNV:
|
||||||
case ACCSTRUCTNV:
|
case ACCSTRUCTNV:
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version >= 460
|
(!parseContext.isEsProfile() && parseContext.version >= 460
|
||||||
&& parseContext.extensionTurnedOn(E_GL_NV_ray_tracing)))
|
&& parseContext.extensionTurnedOn(E_GL_NV_ray_tracing)))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
#endif
|
|
||||||
|
|
||||||
case ATOMIC_UINT:
|
case ATOMIC_UINT:
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 310) ||
|
if ((parseContext.isEsProfile() && parseContext.version >= 310) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters))
|
parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters))
|
||||||
return keyword;
|
return keyword;
|
||||||
return es30ReservedFromGLSL(420);
|
return es30ReservedFromGLSL(420);
|
||||||
|
|
@ -985,53 +1027,52 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case RESTRICT:
|
case RESTRICT:
|
||||||
case READONLY:
|
case READONLY:
|
||||||
case WRITEONLY:
|
case WRITEONLY:
|
||||||
if (parseContext.profile == EEsProfile && parseContext.version >= 310)
|
if (parseContext.isEsProfile() && parseContext.version >= 310)
|
||||||
return keyword;
|
return keyword;
|
||||||
return es30ReservedFromGLSL(parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420);
|
return es30ReservedFromGLSL(parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420);
|
||||||
|
|
||||||
case VOLATILE:
|
case VOLATILE:
|
||||||
if (parseContext.profile == EEsProfile && parseContext.version >= 310)
|
if (parseContext.isEsProfile() && parseContext.version >= 310)
|
||||||
return keyword;
|
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))))
|
(parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
|
||||||
reservedWord();
|
reservedWord();
|
||||||
return keyword;
|
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:
|
case PATCH:
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
(parseContext.profile == EEsProfile &&
|
(parseContext.isEsProfile() &&
|
||||||
(parseContext.version >= 320 ||
|
(parseContext.version >= 320 ||
|
||||||
parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))) ||
|
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 keyword;
|
||||||
|
|
||||||
return es30ReservedFromGLSL(400);
|
return es30ReservedFromGLSL(400);
|
||||||
|
|
||||||
case SAMPLE:
|
case SAMPLE:
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||||
parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation))
|
parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation))
|
||||||
return keyword;
|
return keyword;
|
||||||
return es30ReservedFromGLSL(400);
|
return es30ReservedFromGLSL(400);
|
||||||
|
|
||||||
case SUBROUTINE:
|
case SUBROUTINE:
|
||||||
return es30ReservedFromGLSL(400);
|
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 HIGH_PRECISION:
|
||||||
case MEDIUM_PRECISION:
|
case MEDIUM_PRECISION:
|
||||||
|
|
@ -1050,6 +1091,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case MAT4X4:
|
case MAT4X4:
|
||||||
return matNxM();
|
return matNxM();
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case DMAT2:
|
case DMAT2:
|
||||||
case DMAT3:
|
case DMAT3:
|
||||||
case DMAT4:
|
case DMAT4:
|
||||||
|
|
@ -1080,7 +1122,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case IIMAGEBUFFER:
|
case IIMAGEBUFFER:
|
||||||
case UIMAGEBUFFER:
|
case UIMAGEBUFFER:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||||
return keyword;
|
return keyword;
|
||||||
return firstGenerationImage(false);
|
return firstGenerationImage(false);
|
||||||
|
|
@ -1104,7 +1146,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case IIMAGECUBEARRAY:
|
case IIMAGECUBEARRAY:
|
||||||
case UIMAGECUBEARRAY:
|
case UIMAGECUBEARRAY:
|
||||||
afterType = true;
|
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))
|
parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
|
||||||
return keyword;
|
return keyword;
|
||||||
return secondGenerationImage();
|
return secondGenerationImage();
|
||||||
|
|
@ -1123,7 +1165,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case DVEC3:
|
case DVEC3:
|
||||||
case DVEC4:
|
case DVEC4:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.profile == EEsProfile || parseContext.version < 400)
|
if (parseContext.isEsProfile() || parseContext.version < 400)
|
||||||
reservedWord();
|
reservedWord();
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
|
|
@ -1137,7 +1179,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case U64VEC4:
|
case U64VEC4:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
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_ARB_gpu_shader_int64) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int64))))
|
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_explicit_arithmetic_types) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_8bit_storage) ||
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_8bit_storage) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8)) &&
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8)) &&
|
||||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
||||||
|
|
@ -1171,11 +1213,8 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case U16VEC4:
|
case U16VEC4:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
(!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||||
(
|
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) ||
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) ||
|
|
||||||
#endif
|
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) ||
|
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) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16))))
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16))))
|
||||||
|
|
@ -1193,7 +1232,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32)) &&
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32)) &&
|
||||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
case FLOAT32_T:
|
case FLOAT32_T:
|
||||||
|
|
@ -1216,7 +1255,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) &&
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) &&
|
||||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
||||||
|
|
@ -1240,7 +1279,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) &&
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) &&
|
||||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
||||||
|
|
@ -1250,11 +1289,8 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case F16VEC4:
|
case F16VEC4:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
(!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||||
(
|
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
|
|
||||||
#endif
|
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) ||
|
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) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16))))
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16))))
|
||||||
|
|
@ -1276,37 +1312,27 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case F16MAT4X4:
|
case F16MAT4X4:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
(!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||||
(
|
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
|
|
||||||
#endif
|
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16))))
|
parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16))))
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
#endif
|
||||||
|
|
||||||
case SAMPLERCUBEARRAY:
|
case SAMPLERCUBEARRAY:
|
||||||
case SAMPLERCUBEARRAYSHADOW:
|
case SAMPLERCUBEARRAYSHADOW:
|
||||||
case ISAMPLERCUBEARRAY:
|
case ISAMPLERCUBEARRAY:
|
||||||
case USAMPLERCUBEARRAY:
|
case USAMPLERCUBEARRAY:
|
||||||
afterType = true;
|
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))
|
parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
|
||||||
return keyword;
|
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();
|
reservedWord();
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
case ISAMPLER1D:
|
|
||||||
case ISAMPLER1DARRAY:
|
|
||||||
case SAMPLER1DARRAYSHADOW:
|
|
||||||
case USAMPLER1D:
|
|
||||||
case USAMPLER1DARRAY:
|
|
||||||
afterType = true;
|
|
||||||
return es30ReservedFromGLSL(130);
|
|
||||||
|
|
||||||
case UINT:
|
case UINT:
|
||||||
case UVEC2:
|
case UVEC2:
|
||||||
case UVEC3:
|
case UVEC3:
|
||||||
|
|
@ -1325,6 +1351,30 @@ int TScanContext::tokenizeIdentifier()
|
||||||
afterType = true;
|
afterType = true;
|
||||||
return nonreservedKeyword(300, 130);
|
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 ISAMPLER2DRECT:
|
||||||
case USAMPLER2DRECT:
|
case USAMPLER2DRECT:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
|
|
@ -1332,7 +1382,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
|
|
||||||
case SAMPLERBUFFER:
|
case SAMPLERBUFFER:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||||
return keyword;
|
return keyword;
|
||||||
return es30ReservedFromGLSL(130);
|
return es30ReservedFromGLSL(130);
|
||||||
|
|
@ -1340,7 +1390,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case ISAMPLERBUFFER:
|
case ISAMPLERBUFFER:
|
||||||
case USAMPLERBUFFER:
|
case USAMPLERBUFFER:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||||
return keyword;
|
return keyword;
|
||||||
return es30ReservedFromGLSL(140);
|
return es30ReservedFromGLSL(140);
|
||||||
|
|
@ -1349,7 +1399,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case ISAMPLER2DMS:
|
case ISAMPLER2DMS:
|
||||||
case USAMPLER2DMS:
|
case USAMPLER2DMS:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.profile == EEsProfile && parseContext.version >= 310)
|
if (parseContext.isEsProfile() && parseContext.version >= 310)
|
||||||
return keyword;
|
return keyword;
|
||||||
return es30ReservedFromGLSL(150);
|
return es30ReservedFromGLSL(150);
|
||||||
|
|
||||||
|
|
@ -1357,7 +1407,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case ISAMPLER2DMSARRAY:
|
case ISAMPLER2DMSARRAY:
|
||||||
case USAMPLER2DMSARRAY:
|
case USAMPLER2DMSARRAY:
|
||||||
afterType = true;
|
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))
|
parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array))
|
||||||
return keyword;
|
return keyword;
|
||||||
return es30ReservedFromGLSL(150);
|
return es30ReservedFromGLSL(150);
|
||||||
|
|
@ -1365,30 +1415,14 @@ int TScanContext::tokenizeIdentifier()
|
||||||
case SAMPLER1D:
|
case SAMPLER1D:
|
||||||
case SAMPLER1DSHADOW:
|
case SAMPLER1DSHADOW:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.profile == EEsProfile)
|
if (parseContext.isEsProfile())
|
||||||
reservedWord();
|
reservedWord();
|
||||||
return keyword;
|
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 SAMPLER2DRECT:
|
||||||
case SAMPLER2DRECTSHADOW:
|
case SAMPLER2DRECTSHADOW:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.profile == EEsProfile)
|
if (parseContext.isEsProfile())
|
||||||
reservedWord();
|
reservedWord();
|
||||||
else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) {
|
else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) {
|
||||||
if (parseContext.relaxedErrors())
|
if (parseContext.relaxedErrors())
|
||||||
|
|
@ -1400,10 +1434,10 @@ int TScanContext::tokenizeIdentifier()
|
||||||
|
|
||||||
case SAMPLER1DARRAY:
|
case SAMPLER1DARRAY:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.profile == EEsProfile && parseContext.version == 300)
|
if (parseContext.isEsProfile() && parseContext.version == 300)
|
||||||
reservedWord();
|
reservedWord();
|
||||||
else if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
else if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version < 130))
|
(!parseContext.isEsProfile() && parseContext.version < 130))
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
|
|
@ -1473,7 +1507,6 @@ int TScanContext::tokenizeIdentifier()
|
||||||
else
|
else
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case F16SAMPLER1D:
|
case F16SAMPLER1D:
|
||||||
case F16SAMPLER2D:
|
case F16SAMPLER2D:
|
||||||
case F16SAMPLER3D:
|
case F16SAMPLER3D:
|
||||||
|
|
@ -1522,98 +1555,42 @@ int TScanContext::tokenizeIdentifier()
|
||||||
afterType = true;
|
afterType = true;
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) &&
|
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) &&
|
||||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
!parseContext.isEsProfile() && parseContext.version >= 450))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
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:
|
case EXPLICITINTERPAMD:
|
||||||
if (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
|
if (!parseContext.isEsProfile() && parseContext.version >= 450 &&
|
||||||
parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter))
|
parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case PERVERTEXNV:
|
case PERVERTEXNV:
|
||||||
if (((parseContext.profile != EEsProfile && parseContext.version >= 450) ||
|
if (((!parseContext.isEsProfile() && parseContext.version >= 450) ||
|
||||||
(parseContext.profile == EEsProfile && parseContext.version >= 320)) &&
|
(parseContext.isEsProfile() && parseContext.version >= 320)) &&
|
||||||
parseContext.extensionTurnedOn(E_GL_NV_fragment_shader_barycentric))
|
parseContext.extensionTurnedOn(E_GL_NV_fragment_shader_barycentric))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
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:
|
case PRECISE:
|
||||||
if ((parseContext.profile == EEsProfile &&
|
if ((parseContext.isEsProfile() &&
|
||||||
(parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) ||
|
(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;
|
return keyword;
|
||||||
if (parseContext.profile == EEsProfile && parseContext.version == 310) {
|
if (parseContext.isEsProfile() && parseContext.version == 310) {
|
||||||
reservedWord();
|
reservedWord();
|
||||||
return keyword;
|
return keyword;
|
||||||
}
|
}
|
||||||
return identifierOrType();
|
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 PERPRIMITIVENV:
|
||||||
case PERVIEWNV:
|
case PERVIEWNV:
|
||||||
case PERTASKNV:
|
case PERTASKNV:
|
||||||
if ((parseContext.profile != EEsProfile && parseContext.version >= 450) ||
|
if ((!parseContext.isEsProfile() && parseContext.version >= 450) ||
|
||||||
(parseContext.profile == EEsProfile && parseContext.version >= 320) ||
|
(parseContext.isEsProfile() && parseContext.version >= 320) ||
|
||||||
parseContext.extensionTurnedOn(E_GL_NV_mesh_shader))
|
parseContext.extensionTurnedOn(E_GL_NV_mesh_shader))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
#endif
|
|
||||||
|
|
||||||
case FCOOPMATNV:
|
case FCOOPMATNV:
|
||||||
afterType = true;
|
afterType = true;
|
||||||
|
|
@ -1627,6 +1604,7 @@ int TScanContext::tokenizeIdentifier()
|
||||||
return keyword;
|
return keyword;
|
||||||
else
|
else
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc);
|
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 (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) {
|
||||||
if (variable->isUserType() &&
|
if (variable->isUserType() &&
|
||||||
// treat redeclaration of forward-declared buffer/uniform reference as an identifier
|
// treat redeclaration of forward-declared buffer/uniform reference as an identifier
|
||||||
!(variable->getType().getBasicType() == EbtReference && afterBuffer)) {
|
!(variable->getType().isReference() && afterBuffer)) {
|
||||||
afterType = true;
|
afterType = true;
|
||||||
|
|
||||||
return TYPE_NAME;
|
return TYPE_NAME;
|
||||||
|
|
@ -1675,7 +1653,7 @@ int TScanContext::identifierOrReserved(bool reserved)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseContext.forwardCompatible)
|
if (parseContext.isForwardCompatible())
|
||||||
parseContext.warn(loc, "using future reserved keyword", tokenText, "");
|
parseContext.warn(loc, "using future reserved keyword", tokenText, "");
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
@ -1688,13 +1666,13 @@ int TScanContext::es30ReservedFromGLSL(int version)
|
||||||
if (parseContext.symbolTable.atBuiltInLevel())
|
if (parseContext.symbolTable.atBuiltInLevel())
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
|
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version < version)) {
|
(!parseContext.isEsProfile() && parseContext.version < version)) {
|
||||||
if (parseContext.forwardCompatible)
|
if (parseContext.isForwardCompatible())
|
||||||
parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, "");
|
parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, "");
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
} else if (parseContext.profile == EEsProfile && parseContext.version >= 300)
|
} else if (parseContext.isEsProfile() && parseContext.version >= 300)
|
||||||
reservedWord();
|
reservedWord();
|
||||||
|
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
@ -1704,9 +1682,9 @@ int TScanContext::es30ReservedFromGLSL(int version)
|
||||||
// showed up, both in an es version and a non-ES version.
|
// showed up, both in an es version and a non-ES version.
|
||||||
int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion)
|
int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion)
|
||||||
{
|
{
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version < esVersion) ||
|
if ((parseContext.isEsProfile() && parseContext.version < esVersion) ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version < nonEsVersion)) {
|
(!parseContext.isEsProfile() && parseContext.version < nonEsVersion)) {
|
||||||
if (parseContext.forwardCompatible)
|
if (parseContext.isForwardCompatible())
|
||||||
parseContext.warn(loc, "using future keyword", tokenText, "");
|
parseContext.warn(loc, "using future keyword", tokenText, "");
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
@ -1717,10 +1695,10 @@ int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion)
|
||||||
|
|
||||||
int TScanContext::precisionKeyword()
|
int TScanContext::precisionKeyword()
|
||||||
{
|
{
|
||||||
if (parseContext.profile == EEsProfile || parseContext.version >= 130)
|
if (parseContext.isEsProfile() || parseContext.version >= 130)
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
if (parseContext.forwardCompatible)
|
if (parseContext.isForwardCompatible())
|
||||||
parseContext.warn(loc, "using ES precision qualifier keyword", tokenText, "");
|
parseContext.warn(loc, "using ES precision qualifier keyword", tokenText, "");
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
@ -1733,7 +1711,7 @@ int TScanContext::matNxM()
|
||||||
if (parseContext.version > 110)
|
if (parseContext.version > 110)
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
if (parseContext.forwardCompatible)
|
if (parseContext.isForwardCompatible())
|
||||||
parseContext.warn(loc, "using future non-square matrix type keyword", tokenText, "");
|
parseContext.warn(loc, "using future non-square matrix type keyword", tokenText, "");
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
@ -1743,16 +1721,16 @@ int TScanContext::dMat()
|
||||||
{
|
{
|
||||||
afterType = true;
|
afterType = true;
|
||||||
|
|
||||||
if (parseContext.profile == EEsProfile && parseContext.version >= 300) {
|
if (parseContext.isEsProfile() && parseContext.version >= 300) {
|
||||||
reservedWord();
|
reservedWord();
|
||||||
|
|
||||||
return keyword;
|
return keyword;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseContext.profile != EEsProfile && parseContext.version >= 400)
|
if (!parseContext.isEsProfile() && parseContext.version >= 400)
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
if (parseContext.forwardCompatible)
|
if (parseContext.isForwardCompatible())
|
||||||
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
@ -1761,19 +1739,19 @@ int TScanContext::dMat()
|
||||||
int TScanContext::firstGenerationImage(bool inEs310)
|
int TScanContext::firstGenerationImage(bool inEs310)
|
||||||
{
|
{
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
(parseContext.profile != EEsProfile && (parseContext.version >= 420 ||
|
(!parseContext.isEsProfile() && (parseContext.version >= 420 ||
|
||||||
parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) ||
|
parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) ||
|
||||||
(inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310))
|
(inEs310 && parseContext.isEsProfile() && parseContext.version >= 310))
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
if ((parseContext.profile == EEsProfile && parseContext.version >= 300) ||
|
if ((parseContext.isEsProfile() && parseContext.version >= 300) ||
|
||||||
(parseContext.profile != EEsProfile && parseContext.version >= 130)) {
|
(!parseContext.isEsProfile() && parseContext.version >= 130)) {
|
||||||
reservedWord();
|
reservedWord();
|
||||||
|
|
||||||
return keyword;
|
return keyword;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseContext.forwardCompatible)
|
if (parseContext.isForwardCompatible())
|
||||||
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
@ -1781,17 +1759,17 @@ int TScanContext::firstGenerationImage(bool inEs310)
|
||||||
|
|
||||||
int TScanContext::secondGenerationImage()
|
int TScanContext::secondGenerationImage()
|
||||||
{
|
{
|
||||||
if (parseContext.profile == EEsProfile && parseContext.version >= 310) {
|
if (parseContext.isEsProfile() && parseContext.version >= 310) {
|
||||||
reservedWord();
|
reservedWord();
|
||||||
return keyword;
|
return keyword;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
(parseContext.profile != EEsProfile &&
|
(!parseContext.isEsProfile() &&
|
||||||
(parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
|
(parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
|
||||||
return keyword;
|
return keyword;
|
||||||
|
|
||||||
if (parseContext.forwardCompatible)
|
if (parseContext.isForwardCompatible())
|
||||||
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
parseContext.warn(loc, "using future type keyword", tokenText, "");
|
||||||
|
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
|
||||||
|
|
@ -326,6 +326,7 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
||||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source,
|
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source,
|
||||||
infoSink, commonTable, symbolTables);
|
infoSink, commonTable, symbolTables);
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// check for tessellation
|
// check for tessellation
|
||||||
if ((profile != EEsProfile && version >= 150) ||
|
if ((profile != EEsProfile && version >= 150) ||
|
||||||
(profile == EEsProfile && version >= 310)) {
|
(profile == EEsProfile && version >= 310)) {
|
||||||
|
|
@ -347,7 +348,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
||||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source,
|
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source,
|
||||||
infoSink, commonTable, symbolTables);
|
infoSink, commonTable, symbolTables);
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
// check for ray tracing stages
|
// check for ray tracing stages
|
||||||
if (profile != EEsProfile && version >= 450) {
|
if (profile != EEsProfile && version >= 450) {
|
||||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGenNV, source,
|
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGenNV, source,
|
||||||
|
|
@ -377,8 +377,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
||||||
infoSink, commonTable, symbolTables);
|
infoSink, commonTable, symbolTables);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -479,11 +477,13 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
||||||
// Function to Print all builtins
|
// Function to Print all builtins
|
||||||
void DumpBuiltinSymbolTable(TInfoSink& infoSink, const TSymbolTable& symbolTable)
|
void DumpBuiltinSymbolTable(TInfoSink& infoSink, const TSymbolTable& symbolTable)
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
infoSink.debug << "BuiltinSymbolTable {\n";
|
infoSink.debug << "BuiltinSymbolTable {\n";
|
||||||
|
|
||||||
symbolTable.dump(infoSink, true);
|
symbolTable.dump(infoSink, true);
|
||||||
|
|
||||||
infoSink.debug << "}\n";
|
infoSink.debug << "}\n";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if the shader was correctly specified for version/profile/stage.
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Correct for stage type...
|
// Correct for stage type...
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
case EShLangGeometry:
|
case EShLangGeometry:
|
||||||
|
|
@ -612,7 +613,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
||||||
version = profile == EEsProfile ? 310 : 420;
|
version = profile == EEsProfile ? 310 : 420;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EShLangRayGenNV:
|
case EShLangRayGenNV:
|
||||||
case EShLangIntersectNV:
|
case EShLangIntersectNV:
|
||||||
case EShLangAnyHitNV:
|
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");
|
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;
|
version = profile == EEsProfile ? 320 : 450;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -646,7 +645,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
||||||
// Check for SPIR-V compatibility
|
// Check for SPIR-V compatibility
|
||||||
if (spvVersion.spv != 0) {
|
if (spvVersion.spv != 0) {
|
||||||
switch (profile) {
|
switch (profile) {
|
||||||
case EEsProfile:
|
case EEsProfile:
|
||||||
if (spvVersion.vulkan > 0 && version < 310) {
|
if (spvVersion.vulkan > 0 && version < 310) {
|
||||||
correct = false;
|
correct = false;
|
||||||
infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher");
|
infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher");
|
||||||
|
|
@ -675,6 +674,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return correct;
|
return correct;
|
||||||
}
|
}
|
||||||
|
|
@ -833,13 +833,17 @@ bool ProcessDeferred(
|
||||||
|
|
||||||
// Get all the stages, languages, clients, and other environment
|
// Get all the stages, languages, clients, and other environment
|
||||||
// stuff sorted out.
|
// stuff sorted out.
|
||||||
EShSource source = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl;
|
EShSource sourceGuess = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl;
|
||||||
SpvVersion spvVersion;
|
SpvVersion spvVersion;
|
||||||
EShLanguage stage = compiler->getLanguage();
|
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)
|
if (environment != nullptr && environment->target.hlslFunctionality1)
|
||||||
intermediate.setHlslFunctionality1();
|
intermediate.setHlslFunctionality1();
|
||||||
|
#else
|
||||||
|
const EShSource source = EShSourceGlsl;
|
||||||
|
#endif
|
||||||
// First, without using the preprocessor or parser, find the #version, so we know what
|
// 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
|
// 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.
|
// outlined above, just the user shader, after the system and user preambles.
|
||||||
|
|
@ -852,6 +856,7 @@ bool ProcessDeferred(
|
||||||
: userInput.scanVersion(version, profile, versionNotFirstToken);
|
: userInput.scanVersion(version, profile, versionNotFirstToken);
|
||||||
bool versionNotFound = version == 0;
|
bool versionNotFound = version == 0;
|
||||||
if (forceDefaultVersionAndProfile && source == EShSourceGlsl) {
|
if (forceDefaultVersionAndProfile && source == EShSourceGlsl) {
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (! (messages & EShMsgSuppressWarnings) && ! versionNotFound &&
|
if (! (messages & EShMsgSuppressWarnings) && ! versionNotFound &&
|
||||||
(version != defaultVersion || profile != defaultProfile)) {
|
(version != defaultVersion || profile != defaultProfile)) {
|
||||||
compiler->infoSink.info << "Warning, (version, profile) forced to be ("
|
compiler->infoSink.info << "Warning, (version, profile) forced to be ("
|
||||||
|
|
@ -859,7 +864,7 @@ bool ProcessDeferred(
|
||||||
<< "), while in source code it is ("
|
<< "), while in source code it is ("
|
||||||
<< version << ", " << ProfileName(profile) << ")\n";
|
<< version << ", " << ProfileName(profile) << ")\n";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (versionNotFound) {
|
if (versionNotFound) {
|
||||||
versionNotFirstToken = false;
|
versionNotFirstToken = false;
|
||||||
versionNotFirst = false;
|
versionNotFirst = false;
|
||||||
|
|
@ -872,6 +877,7 @@ bool ProcessDeferred(
|
||||||
bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage,
|
bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage,
|
||||||
versionNotFirst, defaultVersion, source, version, profile, spvVersion);
|
versionNotFirst, defaultVersion, source, version, profile, spvVersion);
|
||||||
bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst));
|
bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst));
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
bool warnVersionNotFirst = false;
|
bool warnVersionNotFirst = false;
|
||||||
if (! versionWillBeError && versionNotFirstToken) {
|
if (! versionWillBeError && versionNotFirstToken) {
|
||||||
if (messages & EShMsgRelaxedErrors)
|
if (messages & EShMsgRelaxedErrors)
|
||||||
|
|
@ -879,6 +885,7 @@ bool ProcessDeferred(
|
||||||
else
|
else
|
||||||
versionWillBeError = true;
|
versionWillBeError = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
intermediate.setSource(source);
|
intermediate.setSource(source);
|
||||||
intermediate.setVersion(version);
|
intermediate.setVersion(version);
|
||||||
|
|
@ -887,8 +894,10 @@ bool ProcessDeferred(
|
||||||
RecordProcesses(intermediate, messages, sourceEntryPointName);
|
RecordProcesses(intermediate, messages, sourceEntryPointName);
|
||||||
if (spvVersion.vulkan > 0)
|
if (spvVersion.vulkan > 0)
|
||||||
intermediate.setOriginUpperLeft();
|
intermediate.setOriginUpperLeft();
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
|
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
|
||||||
intermediate.setHlslOffsets();
|
intermediate.setHlslOffsets();
|
||||||
|
#endif
|
||||||
if (messages & EShMsgDebugInfo) {
|
if (messages & EShMsgDebugInfo) {
|
||||||
intermediate.setSourceFile(names[numPre]);
|
intermediate.setSourceFile(names[numPre]);
|
||||||
for (int s = 0; s < numStrings; ++s) {
|
for (int s = 0; s < numStrings; ++s) {
|
||||||
|
|
@ -938,11 +947,13 @@ bool ProcessDeferred(
|
||||||
parseContext->setLimits(*resources);
|
parseContext->setLimits(*resources);
|
||||||
if (! goodVersion)
|
if (! goodVersion)
|
||||||
parseContext->addError();
|
parseContext->addError();
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (warnVersionNotFirst) {
|
if (warnVersionNotFirst) {
|
||||||
TSourceLoc loc;
|
TSourceLoc loc;
|
||||||
loc.init();
|
loc.init();
|
||||||
parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", "");
|
parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", "");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
parseContext->initializeExtensionBehavior();
|
parseContext->initializeExtensionBehavior();
|
||||||
|
|
||||||
|
|
@ -973,6 +984,8 @@ bool ProcessDeferred(
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
// Responsible for keeping track of the most recent source string and line in
|
// Responsible for keeping track of the most recent source string and line in
|
||||||
// the preprocessor and outputting newlines appropriately if the source string
|
// the preprocessor and outputting newlines appropriately if the source string
|
||||||
// or line changes.
|
// or line changes.
|
||||||
|
|
@ -1169,6 +1182,8 @@ struct DoPreprocessing {
|
||||||
std::string* outputString;
|
std::string* outputString;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// DoFullParse is a valid ProcessingConext template argument for fully
|
// DoFullParse is a valid ProcessingConext template argument for fully
|
||||||
// parsing the shader. It populates the "intermediate" with the AST.
|
// parsing the shader. It populates the "intermediate" with the AST.
|
||||||
struct DoFullParse{
|
struct DoFullParse{
|
||||||
|
|
@ -1199,6 +1214,7 @@ struct DoFullParse{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Take a single compilation unit, and run the preprocessor on it.
|
// Take a single compilation unit, and run the preprocessor on it.
|
||||||
// Return: True if there were no issues found in preprocessing,
|
// Return: True if there were no issues found in preprocessing,
|
||||||
// False if during preprocessing any unknown version, pragmas or
|
// False if during preprocessing any unknown version, pragmas or
|
||||||
|
|
@ -1231,6 +1247,7 @@ bool PreprocessDeferred(
|
||||||
forwardCompatible, messages, intermediate, parser,
|
forwardCompatible, messages, intermediate, parser,
|
||||||
false, includer);
|
false, includer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// do a partial compile on the given strings for a single compilation unit
|
// 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);
|
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
|
// Set binding base for given resource type
|
||||||
void TShader::setShiftBinding(TResourceType res, unsigned int base) {
|
void TShader::setShiftBinding(TResourceType res, unsigned int base) {
|
||||||
intermediate->setShiftBinding(res, base);
|
intermediate->setShiftBinding(res, base);
|
||||||
|
|
@ -1776,7 +1798,7 @@ void TShader::setShiftSsboBinding(unsigned int base) { setShiftBinding(EResSs
|
||||||
// Enables binding automapping using TIoMapper
|
// Enables binding automapping using TIoMapper
|
||||||
void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); }
|
void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); }
|
||||||
// Enables position.Y output negation in vertex shader
|
// 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
|
// Fragile: currently within one stage: simple auto-assignment of location
|
||||||
void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); }
|
void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); }
|
||||||
void TShader::addUniformLocationOverride(const char* name, int loc)
|
void TShader::addUniformLocationOverride(const char* name, int loc)
|
||||||
|
|
@ -1787,13 +1809,16 @@ void TShader::setUniformLocationBase(int base)
|
||||||
{
|
{
|
||||||
intermediate->setUniformLocationBase(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:
|
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
|
||||||
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
|
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
|
||||||
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }
|
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }
|
||||||
void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
|
#endif
|
||||||
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); }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Turn the shader strings into a parse tree in the TIntermediate.
|
// Turn the shader strings into a parse tree in the TIntermediate.
|
||||||
|
|
@ -1817,6 +1842,7 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
|
||||||
&environment);
|
&environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Fill in a string with the result of preprocessing ShaderStrings
|
// Fill in a string with the result of preprocessing ShaderStrings
|
||||||
// Returns true if all extensions, pragmas and version strings were valid.
|
// Returns true if all extensions, pragmas and version strings were valid.
|
||||||
//
|
//
|
||||||
|
|
@ -1841,6 +1867,7 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources,
|
||||||
defaultProfile, forceDefaultVersionAndProfile,
|
defaultProfile, forceDefaultVersionAndProfile,
|
||||||
forwardCompatible, message, includer, *intermediate, output_string);
|
forwardCompatible, message, includer, *intermediate, output_string);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const char* TShader::getInfoLog()
|
const char* TShader::getInfoLog()
|
||||||
{
|
{
|
||||||
|
|
@ -1852,7 +1879,11 @@ const char* TShader::getInfoDebugLog()
|
||||||
return infoSink->debug.c_str();
|
return infoSink->debug.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
TProgram::TProgram() : reflection(0), linked(false)
|
TProgram::TProgram() :
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
reflection(0),
|
||||||
|
#endif
|
||||||
|
linked(false)
|
||||||
{
|
{
|
||||||
pool = new TPoolAllocator;
|
pool = new TPoolAllocator;
|
||||||
infoSink = new TInfoSink;
|
infoSink = new TInfoSink;
|
||||||
|
|
@ -1865,7 +1896,9 @@ TProgram::TProgram() : reflection(0), linked(false)
|
||||||
TProgram::~TProgram()
|
TProgram::~TProgram()
|
||||||
{
|
{
|
||||||
delete infoSink;
|
delete infoSink;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
delete reflection;
|
delete reflection;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int s = 0; s < EShLangCount; ++s)
|
for (int s = 0; s < EShLangCount; ++s)
|
||||||
if (newedIntermediate[s])
|
if (newedIntermediate[s])
|
||||||
|
|
@ -1910,6 +1943,7 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
|
||||||
if (stages[stage].size() == 0)
|
if (stages[stage].size() == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
int numEsShaders = 0, numNonEsShaders = 0;
|
int numEsShaders = 0, numNonEsShaders = 0;
|
||||||
for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) {
|
for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) {
|
||||||
if ((*it)->intermediate->getProfile() == EEsProfile) {
|
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)
|
for (it = stages[stage].begin(); it != stages[stage].end(); ++it)
|
||||||
intermediate[stage]->merge(*infoSink, *(*it)->intermediate);
|
intermediate[stage]->merge(*infoSink, *(*it)->intermediate);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
intermediate[stage] = stages[stage].front()->intermediate;
|
||||||
|
#endif
|
||||||
intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0);
|
intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0);
|
||||||
|
|
||||||
if (messages & EShMsgAST)
|
if (messages & EShMsgAST)
|
||||||
|
|
@ -1977,6 +2013,8 @@ const char* TProgram::getInfoDebugLog()
|
||||||
return infoSink->debug.c_str();
|
return infoSink->debug.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reflection implementation.
|
// Reflection implementation.
|
||||||
//
|
//
|
||||||
|
|
@ -2054,4 +2092,6 @@ bool TProgram::mapIO(TIoMapResolver* pResolver, TIoMapper* pIoMapper)
|
||||||
return ioMapper->doMap(pResolver, *infoSink);
|
return ioMapper->doMap(pResolver, *infoSink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
|
||||||
|
|
@ -61,54 +61,56 @@ void TType::buildMangledName(TString& mangledName) const
|
||||||
|
|
||||||
switch (basicType) {
|
switch (basicType) {
|
||||||
case EbtFloat: mangledName += 'f'; break;
|
case EbtFloat: mangledName += 'f'; break;
|
||||||
case EbtDouble: mangledName += 'd'; break;
|
|
||||||
case EbtFloat16: mangledName += "f16"; break;
|
|
||||||
case EbtInt: mangledName += 'i'; break;
|
case EbtInt: mangledName += 'i'; break;
|
||||||
case EbtUint: mangledName += 'u'; 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 EbtInt8: mangledName += "i8"; break;
|
||||||
case EbtUint8: mangledName += "u8"; break;
|
case EbtUint8: mangledName += "u8"; break;
|
||||||
case EbtInt16: mangledName += "i16"; break;
|
case EbtInt16: mangledName += "i16"; break;
|
||||||
case EbtUint16: mangledName += "u16"; break;
|
case EbtUint16: mangledName += "u16"; break;
|
||||||
case EbtInt64: mangledName += "i64"; break;
|
case EbtInt64: mangledName += "i64"; break;
|
||||||
case EbtUint64: mangledName += "u64"; break;
|
case EbtUint64: mangledName += "u64"; break;
|
||||||
case EbtBool: mangledName += 'b'; break;
|
|
||||||
case EbtAtomicUint: mangledName += "au"; break;
|
case EbtAtomicUint: mangledName += "au"; break;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EbtAccStructNV: mangledName += "asnv"; break;
|
case EbtAccStructNV: mangledName += "asnv"; break;
|
||||||
#endif
|
#endif
|
||||||
case EbtSampler:
|
case EbtSampler:
|
||||||
switch (sampler.type) {
|
switch (sampler.type) {
|
||||||
#ifdef AMD_EXTENSIONS
|
#ifndef GLSLANG_WEB
|
||||||
case EbtFloat16: mangledName += "f16"; break;
|
case EbtFloat16: mangledName += "f16"; break;
|
||||||
#endif
|
#endif
|
||||||
case EbtInt: mangledName += "i"; break;
|
case EbtInt: mangledName += "i"; break;
|
||||||
case EbtUint: mangledName += "u"; break;
|
case EbtUint: mangledName += "u"; break;
|
||||||
default: break; // some compilers want this
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
if (sampler.image)
|
if (sampler.isImageClass())
|
||||||
mangledName += "I"; // a normal image
|
mangledName += "I"; // a normal image or subpass
|
||||||
else if (sampler.sampler)
|
else if (sampler.isPureSampler())
|
||||||
mangledName += "p"; // a "pure" sampler
|
mangledName += "p"; // a "pure" sampler
|
||||||
else if (!sampler.combined)
|
else if (!sampler.isCombined())
|
||||||
mangledName += "t"; // a "pure" texture
|
mangledName += "t"; // a "pure" texture
|
||||||
else
|
else
|
||||||
mangledName += "s"; // traditional combined sampler
|
mangledName += "s"; // traditional combined sampler
|
||||||
if (sampler.arrayed)
|
if (sampler.isArrayed())
|
||||||
mangledName += "A";
|
mangledName += "A";
|
||||||
if (sampler.shadow)
|
if (sampler.isShadow())
|
||||||
mangledName += "S";
|
mangledName += "S";
|
||||||
if (sampler.external)
|
if (sampler.isExternal())
|
||||||
mangledName += "E";
|
mangledName += "E";
|
||||||
if (sampler.yuv)
|
if (sampler.isYuv())
|
||||||
mangledName += "Y";
|
mangledName += "Y";
|
||||||
switch (sampler.dim) {
|
switch (sampler.dim) {
|
||||||
case Esd1D: mangledName += "1"; break;
|
|
||||||
case Esd2D: mangledName += "2"; break;
|
case Esd2D: mangledName += "2"; break;
|
||||||
case Esd3D: mangledName += "3"; break;
|
case Esd3D: mangledName += "3"; break;
|
||||||
case EsdCube: mangledName += "C"; break;
|
case EsdCube: mangledName += "C"; break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
case Esd1D: mangledName += "1"; break;
|
||||||
case EsdRect: mangledName += "R2"; break;
|
case EsdRect: mangledName += "R2"; break;
|
||||||
case EsdBuffer: mangledName += "B"; break;
|
case EsdBuffer: mangledName += "B"; break;
|
||||||
case EsdSubpass: mangledName += "P"; break;
|
case EsdSubpass: mangledName += "P"; break;
|
||||||
|
#endif
|
||||||
default: break; // some compilers want this
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,7 +119,7 @@ void TType::buildMangledName(TString& mangledName) const
|
||||||
mangledName += "-tx-struct";
|
mangledName += "-tx-struct";
|
||||||
|
|
||||||
char text[16]; // plenty enough space for the small integers.
|
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;
|
mangledName += text;
|
||||||
} else {
|
} else {
|
||||||
switch (sampler.getVectorSize()) {
|
switch (sampler.getVectorSize()) {
|
||||||
|
|
@ -128,7 +130,7 @@ void TType::buildMangledName(TString& mangledName) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sampler.ms)
|
if (sampler.isMultiSample())
|
||||||
mangledName += "M";
|
mangledName += "M";
|
||||||
break;
|
break;
|
||||||
case EbtStruct:
|
case EbtStruct:
|
||||||
|
|
@ -172,6 +174,8 @@ void TType::buildMangledName(TString& mangledName) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
//
|
//
|
||||||
// Dump functions.
|
// Dump functions.
|
||||||
//
|
//
|
||||||
|
|
@ -250,6 +254,8 @@ void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Functions have buried pointers to delete.
|
// Functions have buried pointers to delete.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,11 @@ public:
|
||||||
}
|
}
|
||||||
virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); }
|
virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); }
|
||||||
virtual const char** getExtensions() const { return extensions->data(); }
|
virtual const char** getExtensions() const { return extensions->data(); }
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0;
|
virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0;
|
||||||
void dumpExtensions(TInfoSink& infoSink) const;
|
void dumpExtensions(TInfoSink& infoSink) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
virtual bool isReadOnly() const { return ! writable; }
|
virtual bool isReadOnly() const { return ! writable; }
|
||||||
virtual void makeReadOnly() { writable = false; }
|
virtual void makeReadOnly() { writable = false; }
|
||||||
|
|
@ -193,7 +196,9 @@ public:
|
||||||
}
|
}
|
||||||
virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); }
|
virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); }
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
virtual void dump(TInfoSink& infoSink, bool complete = false) const;
|
virtual void dump(TInfoSink& infoSink, bool complete = false) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit TVariable(const TVariable&);
|
explicit TVariable(const TVariable&);
|
||||||
|
|
@ -314,7 +319,9 @@ public:
|
||||||
virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; }
|
virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; }
|
||||||
virtual const TParameter& operator[](int i) const { 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;
|
virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit TFunction(const TFunction&);
|
explicit TFunction(const TFunction&);
|
||||||
|
|
@ -374,7 +381,9 @@ public:
|
||||||
virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); }
|
virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); }
|
||||||
|
|
||||||
virtual int getAnonId() const { return anonId; }
|
virtual int getAnonId() const { return anonId; }
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
|
virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit TAnonMember(const TAnonMember&);
|
explicit TAnonMember(const TAnonMember&);
|
||||||
|
|
@ -542,7 +551,9 @@ public:
|
||||||
|
|
||||||
void relateToOperator(const char* name, TOperator op);
|
void relateToOperator(const char* name, TOperator op);
|
||||||
void setFunctionExtensions(const char* name, int num, const char* const extensions[]);
|
void setFunctionExtensions(const char* name, int num, const char* const extensions[]);
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
void dump(TInfoSink& infoSink, bool complete = false) const;
|
void dump(TInfoSink& infoSink, bool complete = false) const;
|
||||||
|
#endif
|
||||||
TSymbolTableLevel* clone() const;
|
TSymbolTableLevel* clone() const;
|
||||||
void readOnly();
|
void readOnly();
|
||||||
|
|
||||||
|
|
@ -843,7 +854,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int getMaxSymbolId() { return uniqueId; }
|
int getMaxSymbolId() { return uniqueId; }
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
void dump(TInfoSink& infoSink, bool complete = false) const;
|
void dump(TInfoSink& infoSink, bool complete = false) const;
|
||||||
|
#endif
|
||||||
void copyTable(const TSymbolTable& copyOf);
|
void copyTable(const TSymbolTable& copyOf);
|
||||||
|
|
||||||
void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); }
|
void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); }
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,8 @@
|
||||||
|
|
||||||
namespace glslang {
|
namespace glslang {
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize all extensions, almost always to 'disable', as once their features
|
// Initialize all extensions, almost always to 'disable', as once their features
|
||||||
// are incorporated into a core version, their features are supported through allowing that
|
// 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_cpp_style_line_directive] = EBhDisable;
|
||||||
extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable;
|
extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable;
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
extensionBehavior[E_GL_AMD_shader_ballot] = EBhDisable;
|
extensionBehavior[E_GL_AMD_shader_ballot] = EBhDisable;
|
||||||
extensionBehavior[E_GL_AMD_shader_trinary_minmax] = EBhDisable;
|
extensionBehavior[E_GL_AMD_shader_trinary_minmax] = EBhDisable;
|
||||||
extensionBehavior[E_GL_AMD_shader_explicit_vertex_parameter] = 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_image_load_store_lod] = EBhDisable;
|
||||||
extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable;
|
extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable;
|
||||||
extensionBehavior[E_GL_AMD_gpu_shader_half_float_fetch] = 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_GL_NV_sample_mask_override_coverage] = EBhDisable;
|
||||||
extensionBehavior[E_SPV_NV_geometry_shader_passthrough] = EBhDisable;
|
extensionBehavior[E_SPV_NV_geometry_shader_passthrough] = EBhDisable;
|
||||||
extensionBehavior[E_GL_NV_viewport_array2] = 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_compute_shader_derivatives] = EBhDisable;
|
||||||
extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable;
|
extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable;
|
||||||
extensionBehavior[E_GL_NV_mesh_shader] = EBhDisable;
|
extensionBehavior[E_GL_NV_mesh_shader] = EBhDisable;
|
||||||
#endif
|
|
||||||
|
|
||||||
extensionBehavior[E_GL_NV_cooperative_matrix] = EBhDisable;
|
extensionBehavior[E_GL_NV_cooperative_matrix] = EBhDisable;
|
||||||
extensionBehavior[E_GL_NV_shader_sm_builtins] = 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_float32] = EBhDisable;
|
||||||
extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float64] = 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,
|
// 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).
|
// or needed by the preprocessor (which does not use a shared symbol table).
|
||||||
void TParseVersions::getPreamble(std::string& preamble)
|
void TParseVersions::getPreamble(std::string& preamble)
|
||||||
{
|
{
|
||||||
if (profile == EEsProfile) {
|
if (isEsProfile()) {
|
||||||
preamble =
|
preamble =
|
||||||
"#define GL_ES 1\n"
|
"#define GL_ES 1\n"
|
||||||
"#define GL_FRAGMENT_PRECISION_HIGH 1\n"
|
"#define GL_FRAGMENT_PRECISION_HIGH 1\n"
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
;
|
||||||
|
#else
|
||||||
"#define GL_OES_texture_3D 1\n"
|
"#define GL_OES_texture_3D 1\n"
|
||||||
"#define GL_OES_standard_derivatives 1\n"
|
"#define GL_OES_standard_derivatives 1\n"
|
||||||
"#define GL_EXT_frag_depth 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"
|
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
|
||||||
;
|
;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
if (isEsProfile() && version >= 300) {
|
||||||
if (profile == EEsProfile && version >= 300) {
|
|
||||||
preamble += "#define GL_NV_shader_noperspective_interpolation 1\n";
|
preamble += "#define GL_NV_shader_noperspective_interpolation 1\n";
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
preamble =
|
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_atomic_int64 1\n"
|
||||||
"#define E_GL_EXT_shader_realtime_clock 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_ballot 1\n"
|
||||||
"#define GL_AMD_shader_trinary_minmax 1\n"
|
"#define GL_AMD_shader_trinary_minmax 1\n"
|
||||||
"#define GL_AMD_shader_explicit_vertex_parameter 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_image_load_store_lod 1\n"
|
||||||
"#define GL_AMD_shader_fragment_mask 1\n"
|
"#define GL_AMD_shader_fragment_mask 1\n"
|
||||||
"#define GL_AMD_gpu_shader_half_float_fetch 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_sample_mask_override_coverage 1\n"
|
||||||
"#define GL_NV_geometry_shader_passthrough 1\n"
|
"#define GL_NV_geometry_shader_passthrough 1\n"
|
||||||
"#define GL_NV_viewport_array2 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_compute_shader_derivatives 1\n"
|
||||||
"#define GL_NV_shader_texture_footprint 1\n"
|
"#define GL_NV_shader_texture_footprint 1\n"
|
||||||
"#define GL_NV_mesh_shader 1\n"
|
"#define GL_NV_mesh_shader 1\n"
|
||||||
#endif
|
|
||||||
"#define GL_NV_cooperative_matrix 1\n"
|
"#define GL_NV_cooperative_matrix 1\n"
|
||||||
|
|
||||||
"#define GL_EXT_shader_explicit_arithmetic_types 1\n"
|
"#define GL_EXT_shader_explicit_arithmetic_types 1\n"
|
||||||
|
|
@ -458,10 +454,12 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||||
if (profile == ECompatibilityProfile)
|
if (profile == ECompatibilityProfile)
|
||||||
preamble += "#define GL_compatibility_profile 1\n";
|
preamble += "#define GL_compatibility_profile 1\n";
|
||||||
}
|
}
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((profile != EEsProfile && version >= 140) ||
|
#ifndef GLSLANG_WEB
|
||||||
(profile == EEsProfile && version >= 310)) {
|
if ((!isEsProfile() && version >= 140) ||
|
||||||
|
(isEsProfile() && version >= 310)) {
|
||||||
preamble +=
|
preamble +=
|
||||||
"#define GL_EXT_device_group 1\n"
|
"#define GL_EXT_device_group 1\n"
|
||||||
"#define GL_EXT_multiview 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_cpp_style_line_directive 1\n"
|
||||||
"#define GL_GOOGLE_include_directive 1\n"
|
"#define GL_GOOGLE_include_directive 1\n"
|
||||||
;
|
;
|
||||||
|
#endif
|
||||||
|
|
||||||
// #define VULKAN XXXX
|
// #define VULKAN XXXX
|
||||||
const int numberBufSize = 12;
|
const int numberBufSize = 12;
|
||||||
|
|
@ -491,6 +490,8 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||||
preamble += numberBuf;
|
preamble += numberBuf;
|
||||||
preamble += "\n";
|
preamble += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// #define GL_SPIRV XXXX
|
// #define GL_SPIRV XXXX
|
||||||
if (spvVersion.openGl > 0) {
|
if (spvVersion.openGl > 0) {
|
||||||
preamble += "#define GL_SPIRV ";
|
preamble += "#define GL_SPIRV ";
|
||||||
|
|
@ -498,22 +499,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||||
preamble += numberBuf;
|
preamble += numberBuf;
|
||||||
preamble += "\n";
|
preamble += "\n";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -523,12 +509,12 @@ const char* StageName(EShLanguage stage)
|
||||||
{
|
{
|
||||||
switch(stage) {
|
switch(stage) {
|
||||||
case EShLangVertex: return "vertex";
|
case EShLangVertex: return "vertex";
|
||||||
|
case EShLangFragment: return "fragment";
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case EShLangTessControl: return "tessellation control";
|
case EShLangTessControl: return "tessellation control";
|
||||||
case EShLangTessEvaluation: return "tessellation evaluation";
|
case EShLangTessEvaluation: return "tessellation evaluation";
|
||||||
case EShLangGeometry: return "geometry";
|
case EShLangGeometry: return "geometry";
|
||||||
case EShLangFragment: return "fragment";
|
|
||||||
case EShLangCompute: return "compute";
|
case EShLangCompute: return "compute";
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EShLangRayGenNV: return "ray-generation";
|
case EShLangRayGenNV: return "ray-generation";
|
||||||
case EShLangIntersectNV: return "intersection";
|
case EShLangIntersectNV: return "intersection";
|
||||||
case EShLangAnyHitNV: return "any-hit";
|
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()
|
// 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);
|
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
|
// 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.
|
// 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.
|
// 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".
|
// 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)
|
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);
|
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
|
||||||
else if (strcmp(extension, "GL_KHR_shader_subgroup_quad") == 0)
|
else if (strcmp(extension, "GL_KHR_shader_subgroup_quad") == 0)
|
||||||
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
|
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
else if (strcmp(extension, "GL_NV_shader_subgroup_partitioned") == 0)
|
else if (strcmp(extension, "GL_NV_shader_subgroup_partitioned") == 0)
|
||||||
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
|
updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
|
||||||
#endif
|
|
||||||
else if (strcmp(extension, "GL_EXT_buffer_reference2") == 0)
|
else if (strcmp(extension, "GL_EXT_buffer_reference2") == 0)
|
||||||
updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString);
|
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.
|
// Check if extension is used with correct shader stage.
|
||||||
void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * const extension)
|
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
|
// GL_NV_mesh_shader extension is only allowed in task/mesh shaders
|
||||||
if (strcmp(extension, "GL_NV_mesh_shader") == 0) {
|
if (strcmp(extension, "GL_NV_mesh_shader") == 0) {
|
||||||
requireStage(loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask | EShLangFragmentMask),
|
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, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader");
|
||||||
profileRequires(loc, EEsProfile, 320, 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.
|
// 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) {
|
if (!builtIn) {
|
||||||
const char* const extensions[] = {
|
const char* const extensions[] = {
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_half_float,
|
E_GL_AMD_gpu_shader_half_float,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
||||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
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()
|
bool TParseVersions::float16Arithmetic()
|
||||||
{
|
{
|
||||||
const char* const extensions[] = {
|
const char* const extensions[] = {
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_half_float,
|
E_GL_AMD_gpu_shader_half_float,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
||||||
return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions);
|
return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions);
|
||||||
|
|
@ -919,9 +914,7 @@ bool TParseVersions::float16Arithmetic()
|
||||||
bool TParseVersions::int16Arithmetic()
|
bool TParseVersions::int16Arithmetic()
|
||||||
{
|
{
|
||||||
const char* const extensions[] = {
|
const char* const extensions[] = {
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_int16,
|
E_GL_AMD_gpu_shader_int16,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
||||||
return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions);
|
return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions);
|
||||||
|
|
@ -943,9 +936,7 @@ void TParseVersions::requireFloat16Arithmetic(const TSourceLoc& loc, const char*
|
||||||
combined += featureDesc;
|
combined += featureDesc;
|
||||||
|
|
||||||
const char* const extensions[] = {
|
const char* const extensions[] = {
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_half_float,
|
E_GL_AMD_gpu_shader_half_float,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
||||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str());
|
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;
|
combined += featureDesc;
|
||||||
|
|
||||||
const char* const extensions[] = {
|
const char* const extensions[] = {
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_int16,
|
E_GL_AMD_gpu_shader_int16,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
||||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str());
|
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) {
|
if (!builtIn) {
|
||||||
const char* const extensions[] = {
|
const char* const extensions[] = {
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_half_float,
|
E_GL_AMD_gpu_shader_half_float,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_16bit_storage,
|
E_GL_EXT_shader_16bit_storage,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_float16};
|
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
|
// Call for any operation needing GLSL float16 opaque-type support
|
||||||
void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, bool builtIn)
|
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);
|
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Call for any operation needing GLSL explicit int16 data-type support.
|
// Call for any operation needing GLSL explicit int16 data-type support.
|
||||||
void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn)
|
void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||||
{
|
{
|
||||||
if (! builtIn) {
|
if (! builtIn) {
|
||||||
const char* const extensions[] = {
|
const char* const extensions[] = {
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_int16,
|
E_GL_AMD_gpu_shader_int16,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
||||||
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
||||||
|
|
@ -1056,9 +1039,7 @@ void TParseVersions::int16ScalarVectorCheck(const TSourceLoc& loc, const char* o
|
||||||
{
|
{
|
||||||
if (! builtIn) {
|
if (! builtIn) {
|
||||||
const char* const extensions[] = {
|
const char* const extensions[] = {
|
||||||
#if AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_int16,
|
E_GL_AMD_gpu_shader_int16,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_16bit_storage,
|
E_GL_EXT_shader_16bit_storage,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_int16};
|
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);
|
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
|
|
||||||
// Call for any operation removed because SPIR-V is in use.
|
// Call for any operation removed because SPIR-V is in use.
|
||||||
void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
|
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.
|
// Call for any operation that requires Vulkan.
|
||||||
void TParseVersions::requireVulkan(const TSourceLoc& loc, const char* op)
|
void TParseVersions::requireVulkan(const TSourceLoc& loc, const char* op)
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (spvVersion.vulkan == 0)
|
if (spvVersion.vulkan == 0)
|
||||||
error(loc, "only allowed when using GLSL for Vulkan", op, "");
|
error(loc, "only allowed when using GLSL for Vulkan", op, "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call for any operation that requires SPIR-V.
|
// Call for any operation that requires SPIR-V.
|
||||||
void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op)
|
void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op)
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (spvVersion.spv == 0)
|
if (spvVersion.spv == 0)
|
||||||
error(loc, "only allowed when generating SPIR-V", op, "");
|
error(loc, "only allowed when generating SPIR-V", op, "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace glslang
|
} // 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_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive";
|
||||||
const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_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_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_trinary_minmax = "GL_AMD_shader_trinary_minmax";
|
||||||
const char* const E_GL_AMD_shader_explicit_vertex_parameter = "GL_AMD_shader_explicit_vertex_parameter";
|
const char* const E_GL_AMD_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_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_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";
|
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_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";
|
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 char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 };
|
||||||
const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]);
|
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_cooperative_matrix = "GL_NV_cooperative_matrix";
|
||||||
const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins";
|
const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins";
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
#include "attribute.h"
|
#include "attribute.h"
|
||||||
#include "../Include/intermediate.h"
|
#include "../Include/intermediate.h"
|
||||||
#include "ParseHelper.h"
|
#include "ParseHelper.h"
|
||||||
|
|
@ -339,5 +341,6 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@
|
||||||
#define GL_DOUBLE_MAT4x2 0x8F4D
|
#define GL_DOUBLE_MAT4x2 0x8F4D
|
||||||
#define GL_DOUBLE_MAT4x3 0x8F4E
|
#define GL_DOUBLE_MAT4x3 0x8F4E
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
// Those constants are borrowed from extension NV_gpu_shader5
|
// Those constants are borrowed from extension NV_gpu_shader5
|
||||||
#define GL_FLOAT16_NV 0x8FF8
|
#define GL_FLOAT16_NV 0x8FF8
|
||||||
#define GL_FLOAT16_VEC2_NV 0x8FF9
|
#define GL_FLOAT16_VEC2_NV 0x8FF9
|
||||||
|
|
@ -94,7 +93,6 @@
|
||||||
#define GL_FLOAT16_MAT3x4_AMD 0x91CB
|
#define GL_FLOAT16_MAT3x4_AMD 0x91CB
|
||||||
#define GL_FLOAT16_MAT4x2_AMD 0x91CC
|
#define GL_FLOAT16_MAT4x2_AMD 0x91CC
|
||||||
#define GL_FLOAT16_MAT4x3_AMD 0x91CD
|
#define GL_FLOAT16_MAT4x3_AMD 0x91CD
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GL_SAMPLER_1D 0x8B5D
|
#define GL_SAMPLER_1D 0x8B5D
|
||||||
#define GL_SAMPLER_2D 0x8B5E
|
#define GL_SAMPLER_2D 0x8B5E
|
||||||
|
|
@ -117,7 +115,6 @@
|
||||||
#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
|
#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
|
||||||
#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
|
#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
#define GL_FLOAT16_SAMPLER_1D_AMD 0x91CE
|
#define GL_FLOAT16_SAMPLER_1D_AMD 0x91CE
|
||||||
#define GL_FLOAT16_SAMPLER_2D_AMD 0x91CF
|
#define GL_FLOAT16_SAMPLER_2D_AMD 0x91CF
|
||||||
#define GL_FLOAT16_SAMPLER_3D_AMD 0x91D0
|
#define GL_FLOAT16_SAMPLER_3D_AMD 0x91D0
|
||||||
|
|
@ -149,7 +146,6 @@
|
||||||
#define GL_FLOAT16_IMAGE_BUFFER_AMD 0x91E8
|
#define GL_FLOAT16_IMAGE_BUFFER_AMD 0x91E8
|
||||||
#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD 0x91E9
|
#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD 0x91E9
|
||||||
#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD 0x91EA
|
#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD 0x91EA
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GL_INT_SAMPLER_1D 0x8DC9
|
#define GL_INT_SAMPLER_1D 0x8DC9
|
||||||
#define GL_INT_SAMPLER_2D 0x8DCA
|
#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
|
# define YYTOKENTYPE
|
||||||
enum yytokentype
|
enum yytokentype
|
||||||
{
|
{
|
||||||
ATTRIBUTE = 258,
|
CONST = 258,
|
||||||
VARYING = 259,
|
BOOL = 259,
|
||||||
FLOAT16_T = 260,
|
INT = 260,
|
||||||
FLOAT = 261,
|
UINT = 261,
|
||||||
FLOAT32_T = 262,
|
FLOAT = 262,
|
||||||
DOUBLE = 263,
|
BVEC2 = 263,
|
||||||
FLOAT64_T = 264,
|
BVEC3 = 264,
|
||||||
CONST = 265,
|
BVEC4 = 265,
|
||||||
BOOL = 266,
|
IVEC2 = 266,
|
||||||
INT = 267,
|
IVEC3 = 267,
|
||||||
UINT = 268,
|
IVEC4 = 268,
|
||||||
INT64_T = 269,
|
UVEC2 = 269,
|
||||||
UINT64_T = 270,
|
UVEC3 = 270,
|
||||||
INT32_T = 271,
|
UVEC4 = 271,
|
||||||
UINT32_T = 272,
|
VEC2 = 272,
|
||||||
INT16_T = 273,
|
VEC3 = 273,
|
||||||
UINT16_T = 274,
|
VEC4 = 274,
|
||||||
INT8_T = 275,
|
MAT2 = 275,
|
||||||
UINT8_T = 276,
|
MAT3 = 276,
|
||||||
BREAK = 277,
|
MAT4 = 277,
|
||||||
CONTINUE = 278,
|
MAT2X2 = 278,
|
||||||
DO = 279,
|
MAT2X3 = 279,
|
||||||
ELSE = 280,
|
MAT2X4 = 280,
|
||||||
FOR = 281,
|
MAT3X2 = 281,
|
||||||
IF = 282,
|
MAT3X3 = 282,
|
||||||
DISCARD = 283,
|
MAT3X4 = 283,
|
||||||
RETURN = 284,
|
MAT4X2 = 284,
|
||||||
SWITCH = 285,
|
MAT4X3 = 285,
|
||||||
CASE = 286,
|
MAT4X4 = 286,
|
||||||
DEFAULT = 287,
|
SAMPLER2D = 287,
|
||||||
SUBROUTINE = 288,
|
SAMPLER3D = 288,
|
||||||
DEMOTE = 289,
|
SAMPLERCUBE = 289,
|
||||||
BVEC2 = 290,
|
SAMPLER2DSHADOW = 290,
|
||||||
BVEC3 = 291,
|
SAMPLERCUBESHADOW = 291,
|
||||||
BVEC4 = 292,
|
SAMPLER2DARRAY = 292,
|
||||||
IVEC2 = 293,
|
SAMPLER2DARRAYSHADOW = 293,
|
||||||
IVEC3 = 294,
|
ISAMPLER2D = 294,
|
||||||
IVEC4 = 295,
|
ISAMPLER3D = 295,
|
||||||
UVEC2 = 296,
|
ISAMPLERCUBE = 296,
|
||||||
UVEC3 = 297,
|
ISAMPLER2DARRAY = 297,
|
||||||
UVEC4 = 298,
|
USAMPLER2D = 298,
|
||||||
I64VEC2 = 299,
|
USAMPLER3D = 299,
|
||||||
I64VEC3 = 300,
|
USAMPLERCUBE = 300,
|
||||||
I64VEC4 = 301,
|
USAMPLER2DARRAY = 301,
|
||||||
U64VEC2 = 302,
|
SAMPLERCUBEARRAY = 302,
|
||||||
U64VEC3 = 303,
|
SAMPLERCUBEARRAYSHADOW = 303,
|
||||||
U64VEC4 = 304,
|
ISAMPLERCUBEARRAY = 304,
|
||||||
I32VEC2 = 305,
|
USAMPLERCUBEARRAY = 305,
|
||||||
I32VEC3 = 306,
|
ATTRIBUTE = 306,
|
||||||
I32VEC4 = 307,
|
VARYING = 307,
|
||||||
U32VEC2 = 308,
|
FLOAT16_T = 308,
|
||||||
U32VEC3 = 309,
|
FLOAT32_T = 309,
|
||||||
U32VEC4 = 310,
|
DOUBLE = 310,
|
||||||
I16VEC2 = 311,
|
FLOAT64_T = 311,
|
||||||
I16VEC3 = 312,
|
INT64_T = 312,
|
||||||
I16VEC4 = 313,
|
UINT64_T = 313,
|
||||||
U16VEC2 = 314,
|
INT32_T = 314,
|
||||||
U16VEC3 = 315,
|
UINT32_T = 315,
|
||||||
U16VEC4 = 316,
|
INT16_T = 316,
|
||||||
I8VEC2 = 317,
|
UINT16_T = 317,
|
||||||
I8VEC3 = 318,
|
INT8_T = 318,
|
||||||
I8VEC4 = 319,
|
UINT8_T = 319,
|
||||||
U8VEC2 = 320,
|
I64VEC2 = 320,
|
||||||
U8VEC3 = 321,
|
I64VEC3 = 321,
|
||||||
U8VEC4 = 322,
|
I64VEC4 = 322,
|
||||||
VEC2 = 323,
|
U64VEC2 = 323,
|
||||||
VEC3 = 324,
|
U64VEC3 = 324,
|
||||||
VEC4 = 325,
|
U64VEC4 = 325,
|
||||||
MAT2 = 326,
|
I32VEC2 = 326,
|
||||||
MAT3 = 327,
|
I32VEC3 = 327,
|
||||||
MAT4 = 328,
|
I32VEC4 = 328,
|
||||||
CENTROID = 329,
|
U32VEC2 = 329,
|
||||||
IN = 330,
|
U32VEC3 = 330,
|
||||||
OUT = 331,
|
U32VEC4 = 331,
|
||||||
INOUT = 332,
|
I16VEC2 = 332,
|
||||||
UNIFORM = 333,
|
I16VEC3 = 333,
|
||||||
PATCH = 334,
|
I16VEC4 = 334,
|
||||||
SAMPLE = 335,
|
U16VEC2 = 335,
|
||||||
BUFFER = 336,
|
U16VEC3 = 336,
|
||||||
SHARED = 337,
|
U16VEC4 = 337,
|
||||||
NONUNIFORM = 338,
|
I8VEC2 = 338,
|
||||||
PAYLOADNV = 339,
|
I8VEC3 = 339,
|
||||||
PAYLOADINNV = 340,
|
I8VEC4 = 340,
|
||||||
HITATTRNV = 341,
|
U8VEC2 = 341,
|
||||||
CALLDATANV = 342,
|
U8VEC3 = 342,
|
||||||
CALLDATAINNV = 343,
|
U8VEC4 = 343,
|
||||||
COHERENT = 344,
|
DVEC2 = 344,
|
||||||
VOLATILE = 345,
|
DVEC3 = 345,
|
||||||
RESTRICT = 346,
|
DVEC4 = 346,
|
||||||
READONLY = 347,
|
DMAT2 = 347,
|
||||||
WRITEONLY = 348,
|
DMAT3 = 348,
|
||||||
DEVICECOHERENT = 349,
|
DMAT4 = 349,
|
||||||
QUEUEFAMILYCOHERENT = 350,
|
F16VEC2 = 350,
|
||||||
WORKGROUPCOHERENT = 351,
|
F16VEC3 = 351,
|
||||||
SUBGROUPCOHERENT = 352,
|
F16VEC4 = 352,
|
||||||
NONPRIVATE = 353,
|
F16MAT2 = 353,
|
||||||
DVEC2 = 354,
|
F16MAT3 = 354,
|
||||||
DVEC3 = 355,
|
F16MAT4 = 355,
|
||||||
DVEC4 = 356,
|
F32VEC2 = 356,
|
||||||
DMAT2 = 357,
|
F32VEC3 = 357,
|
||||||
DMAT3 = 358,
|
F32VEC4 = 358,
|
||||||
DMAT4 = 359,
|
F32MAT2 = 359,
|
||||||
F16VEC2 = 360,
|
F32MAT3 = 360,
|
||||||
F16VEC3 = 361,
|
F32MAT4 = 361,
|
||||||
F16VEC4 = 362,
|
F64VEC2 = 362,
|
||||||
F16MAT2 = 363,
|
F64VEC3 = 363,
|
||||||
F16MAT3 = 364,
|
F64VEC4 = 364,
|
||||||
F16MAT4 = 365,
|
F64MAT2 = 365,
|
||||||
F32VEC2 = 366,
|
F64MAT3 = 366,
|
||||||
F32VEC3 = 367,
|
F64MAT4 = 367,
|
||||||
F32VEC4 = 368,
|
DMAT2X2 = 368,
|
||||||
F32MAT2 = 369,
|
DMAT2X3 = 369,
|
||||||
F32MAT3 = 370,
|
DMAT2X4 = 370,
|
||||||
F32MAT4 = 371,
|
DMAT3X2 = 371,
|
||||||
F64VEC2 = 372,
|
DMAT3X3 = 372,
|
||||||
F64VEC3 = 373,
|
DMAT3X4 = 373,
|
||||||
F64VEC4 = 374,
|
DMAT4X2 = 374,
|
||||||
F64MAT2 = 375,
|
DMAT4X3 = 375,
|
||||||
F64MAT3 = 376,
|
DMAT4X4 = 376,
|
||||||
F64MAT4 = 377,
|
F16MAT2X2 = 377,
|
||||||
NOPERSPECTIVE = 378,
|
F16MAT2X3 = 378,
|
||||||
FLAT = 379,
|
F16MAT2X4 = 379,
|
||||||
SMOOTH = 380,
|
F16MAT3X2 = 380,
|
||||||
LAYOUT = 381,
|
F16MAT3X3 = 381,
|
||||||
EXPLICITINTERPAMD = 382,
|
F16MAT3X4 = 382,
|
||||||
PERVERTEXNV = 383,
|
F16MAT4X2 = 383,
|
||||||
PERPRIMITIVENV = 384,
|
F16MAT4X3 = 384,
|
||||||
PERVIEWNV = 385,
|
F16MAT4X4 = 385,
|
||||||
PERTASKNV = 386,
|
F32MAT2X2 = 386,
|
||||||
MAT2X2 = 387,
|
F32MAT2X3 = 387,
|
||||||
MAT2X3 = 388,
|
F32MAT2X4 = 388,
|
||||||
MAT2X4 = 389,
|
F32MAT3X2 = 389,
|
||||||
MAT3X2 = 390,
|
F32MAT3X3 = 390,
|
||||||
MAT3X3 = 391,
|
F32MAT3X4 = 391,
|
||||||
MAT3X4 = 392,
|
F32MAT4X2 = 392,
|
||||||
MAT4X2 = 393,
|
F32MAT4X3 = 393,
|
||||||
MAT4X3 = 394,
|
F32MAT4X4 = 394,
|
||||||
MAT4X4 = 395,
|
F64MAT2X2 = 395,
|
||||||
DMAT2X2 = 396,
|
F64MAT2X3 = 396,
|
||||||
DMAT2X3 = 397,
|
F64MAT2X4 = 397,
|
||||||
DMAT2X4 = 398,
|
F64MAT3X2 = 398,
|
||||||
DMAT3X2 = 399,
|
F64MAT3X3 = 399,
|
||||||
DMAT3X3 = 400,
|
F64MAT3X4 = 400,
|
||||||
DMAT3X4 = 401,
|
F64MAT4X2 = 401,
|
||||||
DMAT4X2 = 402,
|
F64MAT4X3 = 402,
|
||||||
DMAT4X3 = 403,
|
F64MAT4X4 = 403,
|
||||||
DMAT4X4 = 404,
|
ATOMIC_UINT = 404,
|
||||||
F16MAT2X2 = 405,
|
ACCSTRUCTNV = 405,
|
||||||
F16MAT2X3 = 406,
|
FCOOPMATNV = 406,
|
||||||
F16MAT2X4 = 407,
|
SAMPLER1D = 407,
|
||||||
F16MAT3X2 = 408,
|
SAMPLER1DARRAY = 408,
|
||||||
F16MAT3X3 = 409,
|
SAMPLER1DARRAYSHADOW = 409,
|
||||||
F16MAT3X4 = 410,
|
ISAMPLER1D = 410,
|
||||||
F16MAT4X2 = 411,
|
SAMPLER1DSHADOW = 411,
|
||||||
F16MAT4X3 = 412,
|
SAMPLER2DRECT = 412,
|
||||||
F16MAT4X4 = 413,
|
SAMPLER2DRECTSHADOW = 413,
|
||||||
F32MAT2X2 = 414,
|
ISAMPLER2DRECT = 414,
|
||||||
F32MAT2X3 = 415,
|
USAMPLER2DRECT = 415,
|
||||||
F32MAT2X4 = 416,
|
SAMPLERBUFFER = 416,
|
||||||
F32MAT3X2 = 417,
|
ISAMPLERBUFFER = 417,
|
||||||
F32MAT3X3 = 418,
|
USAMPLERBUFFER = 418,
|
||||||
F32MAT3X4 = 419,
|
SAMPLER2DMS = 419,
|
||||||
F32MAT4X2 = 420,
|
ISAMPLER2DMS = 420,
|
||||||
F32MAT4X3 = 421,
|
USAMPLER2DMS = 421,
|
||||||
F32MAT4X4 = 422,
|
SAMPLER2DMSARRAY = 422,
|
||||||
F64MAT2X2 = 423,
|
ISAMPLER2DMSARRAY = 423,
|
||||||
F64MAT2X3 = 424,
|
USAMPLER2DMSARRAY = 424,
|
||||||
F64MAT2X4 = 425,
|
SAMPLEREXTERNALOES = 425,
|
||||||
F64MAT3X2 = 426,
|
SAMPLEREXTERNAL2DY2YEXT = 426,
|
||||||
F64MAT3X3 = 427,
|
ISAMPLER1DARRAY = 427,
|
||||||
F64MAT3X4 = 428,
|
USAMPLER1D = 428,
|
||||||
F64MAT4X2 = 429,
|
USAMPLER1DARRAY = 429,
|
||||||
F64MAT4X3 = 430,
|
F16SAMPLER1D = 430,
|
||||||
F64MAT4X4 = 431,
|
F16SAMPLER2D = 431,
|
||||||
ATOMIC_UINT = 432,
|
F16SAMPLER3D = 432,
|
||||||
ACCSTRUCTNV = 433,
|
F16SAMPLER2DRECT = 433,
|
||||||
FCOOPMATNV = 434,
|
F16SAMPLERCUBE = 434,
|
||||||
SAMPLER1D = 435,
|
F16SAMPLER1DARRAY = 435,
|
||||||
SAMPLER2D = 436,
|
F16SAMPLER2DARRAY = 436,
|
||||||
SAMPLER3D = 437,
|
F16SAMPLERCUBEARRAY = 437,
|
||||||
SAMPLERCUBE = 438,
|
F16SAMPLERBUFFER = 438,
|
||||||
SAMPLER1DSHADOW = 439,
|
F16SAMPLER2DMS = 439,
|
||||||
SAMPLER2DSHADOW = 440,
|
F16SAMPLER2DMSARRAY = 440,
|
||||||
SAMPLERCUBESHADOW = 441,
|
F16SAMPLER1DSHADOW = 441,
|
||||||
SAMPLER1DARRAY = 442,
|
F16SAMPLER2DSHADOW = 442,
|
||||||
SAMPLER2DARRAY = 443,
|
F16SAMPLER1DARRAYSHADOW = 443,
|
||||||
SAMPLER1DARRAYSHADOW = 444,
|
F16SAMPLER2DARRAYSHADOW = 444,
|
||||||
SAMPLER2DARRAYSHADOW = 445,
|
F16SAMPLER2DRECTSHADOW = 445,
|
||||||
ISAMPLER1D = 446,
|
F16SAMPLERCUBESHADOW = 446,
|
||||||
ISAMPLER2D = 447,
|
F16SAMPLERCUBEARRAYSHADOW = 447,
|
||||||
ISAMPLER3D = 448,
|
IMAGE1D = 448,
|
||||||
ISAMPLERCUBE = 449,
|
IIMAGE1D = 449,
|
||||||
ISAMPLER1DARRAY = 450,
|
UIMAGE1D = 450,
|
||||||
ISAMPLER2DARRAY = 451,
|
IMAGE2D = 451,
|
||||||
USAMPLER1D = 452,
|
IIMAGE2D = 452,
|
||||||
USAMPLER2D = 453,
|
UIMAGE2D = 453,
|
||||||
USAMPLER3D = 454,
|
IMAGE3D = 454,
|
||||||
USAMPLERCUBE = 455,
|
IIMAGE3D = 455,
|
||||||
USAMPLER1DARRAY = 456,
|
UIMAGE3D = 456,
|
||||||
USAMPLER2DARRAY = 457,
|
IMAGE2DRECT = 457,
|
||||||
SAMPLER2DRECT = 458,
|
IIMAGE2DRECT = 458,
|
||||||
SAMPLER2DRECTSHADOW = 459,
|
UIMAGE2DRECT = 459,
|
||||||
ISAMPLER2DRECT = 460,
|
IMAGECUBE = 460,
|
||||||
USAMPLER2DRECT = 461,
|
IIMAGECUBE = 461,
|
||||||
SAMPLERBUFFER = 462,
|
UIMAGECUBE = 462,
|
||||||
ISAMPLERBUFFER = 463,
|
IMAGEBUFFER = 463,
|
||||||
USAMPLERBUFFER = 464,
|
IIMAGEBUFFER = 464,
|
||||||
SAMPLERCUBEARRAY = 465,
|
UIMAGEBUFFER = 465,
|
||||||
SAMPLERCUBEARRAYSHADOW = 466,
|
IMAGE1DARRAY = 466,
|
||||||
ISAMPLERCUBEARRAY = 467,
|
IIMAGE1DARRAY = 467,
|
||||||
USAMPLERCUBEARRAY = 468,
|
UIMAGE1DARRAY = 468,
|
||||||
SAMPLER2DMS = 469,
|
IMAGE2DARRAY = 469,
|
||||||
ISAMPLER2DMS = 470,
|
IIMAGE2DARRAY = 470,
|
||||||
USAMPLER2DMS = 471,
|
UIMAGE2DARRAY = 471,
|
||||||
SAMPLER2DMSARRAY = 472,
|
IMAGECUBEARRAY = 472,
|
||||||
ISAMPLER2DMSARRAY = 473,
|
IIMAGECUBEARRAY = 473,
|
||||||
USAMPLER2DMSARRAY = 474,
|
UIMAGECUBEARRAY = 474,
|
||||||
SAMPLEREXTERNALOES = 475,
|
IMAGE2DMS = 475,
|
||||||
SAMPLEREXTERNAL2DY2YEXT = 476,
|
IIMAGE2DMS = 476,
|
||||||
F16SAMPLER1D = 477,
|
UIMAGE2DMS = 477,
|
||||||
F16SAMPLER2D = 478,
|
IMAGE2DMSARRAY = 478,
|
||||||
F16SAMPLER3D = 479,
|
IIMAGE2DMSARRAY = 479,
|
||||||
F16SAMPLER2DRECT = 480,
|
UIMAGE2DMSARRAY = 480,
|
||||||
F16SAMPLERCUBE = 481,
|
F16IMAGE1D = 481,
|
||||||
F16SAMPLER1DARRAY = 482,
|
F16IMAGE2D = 482,
|
||||||
F16SAMPLER2DARRAY = 483,
|
F16IMAGE3D = 483,
|
||||||
F16SAMPLERCUBEARRAY = 484,
|
F16IMAGE2DRECT = 484,
|
||||||
F16SAMPLERBUFFER = 485,
|
F16IMAGECUBE = 485,
|
||||||
F16SAMPLER2DMS = 486,
|
F16IMAGE1DARRAY = 486,
|
||||||
F16SAMPLER2DMSARRAY = 487,
|
F16IMAGE2DARRAY = 487,
|
||||||
F16SAMPLER1DSHADOW = 488,
|
F16IMAGECUBEARRAY = 488,
|
||||||
F16SAMPLER2DSHADOW = 489,
|
F16IMAGEBUFFER = 489,
|
||||||
F16SAMPLER1DARRAYSHADOW = 490,
|
F16IMAGE2DMS = 490,
|
||||||
F16SAMPLER2DARRAYSHADOW = 491,
|
F16IMAGE2DMSARRAY = 491,
|
||||||
F16SAMPLER2DRECTSHADOW = 492,
|
SAMPLER = 492,
|
||||||
F16SAMPLERCUBESHADOW = 493,
|
SAMPLERSHADOW = 493,
|
||||||
F16SAMPLERCUBEARRAYSHADOW = 494,
|
TEXTURE1D = 494,
|
||||||
SAMPLER = 495,
|
TEXTURE2D = 495,
|
||||||
SAMPLERSHADOW = 496,
|
TEXTURE3D = 496,
|
||||||
TEXTURE1D = 497,
|
TEXTURECUBE = 497,
|
||||||
TEXTURE2D = 498,
|
TEXTURE1DARRAY = 498,
|
||||||
TEXTURE3D = 499,
|
TEXTURE2DARRAY = 499,
|
||||||
TEXTURECUBE = 500,
|
ITEXTURE1D = 500,
|
||||||
TEXTURE1DARRAY = 501,
|
ITEXTURE2D = 501,
|
||||||
TEXTURE2DARRAY = 502,
|
ITEXTURE3D = 502,
|
||||||
ITEXTURE1D = 503,
|
ITEXTURECUBE = 503,
|
||||||
ITEXTURE2D = 504,
|
ITEXTURE1DARRAY = 504,
|
||||||
ITEXTURE3D = 505,
|
ITEXTURE2DARRAY = 505,
|
||||||
ITEXTURECUBE = 506,
|
UTEXTURE1D = 506,
|
||||||
ITEXTURE1DARRAY = 507,
|
UTEXTURE2D = 507,
|
||||||
ITEXTURE2DARRAY = 508,
|
UTEXTURE3D = 508,
|
||||||
UTEXTURE1D = 509,
|
UTEXTURECUBE = 509,
|
||||||
UTEXTURE2D = 510,
|
UTEXTURE1DARRAY = 510,
|
||||||
UTEXTURE3D = 511,
|
UTEXTURE2DARRAY = 511,
|
||||||
UTEXTURECUBE = 512,
|
TEXTURE2DRECT = 512,
|
||||||
UTEXTURE1DARRAY = 513,
|
ITEXTURE2DRECT = 513,
|
||||||
UTEXTURE2DARRAY = 514,
|
UTEXTURE2DRECT = 514,
|
||||||
TEXTURE2DRECT = 515,
|
TEXTUREBUFFER = 515,
|
||||||
ITEXTURE2DRECT = 516,
|
ITEXTUREBUFFER = 516,
|
||||||
UTEXTURE2DRECT = 517,
|
UTEXTUREBUFFER = 517,
|
||||||
TEXTUREBUFFER = 518,
|
TEXTURECUBEARRAY = 518,
|
||||||
ITEXTUREBUFFER = 519,
|
ITEXTURECUBEARRAY = 519,
|
||||||
UTEXTUREBUFFER = 520,
|
UTEXTURECUBEARRAY = 520,
|
||||||
TEXTURECUBEARRAY = 521,
|
TEXTURE2DMS = 521,
|
||||||
ITEXTURECUBEARRAY = 522,
|
ITEXTURE2DMS = 522,
|
||||||
UTEXTURECUBEARRAY = 523,
|
UTEXTURE2DMS = 523,
|
||||||
TEXTURE2DMS = 524,
|
TEXTURE2DMSARRAY = 524,
|
||||||
ITEXTURE2DMS = 525,
|
ITEXTURE2DMSARRAY = 525,
|
||||||
UTEXTURE2DMS = 526,
|
UTEXTURE2DMSARRAY = 526,
|
||||||
TEXTURE2DMSARRAY = 527,
|
F16TEXTURE1D = 527,
|
||||||
ITEXTURE2DMSARRAY = 528,
|
F16TEXTURE2D = 528,
|
||||||
UTEXTURE2DMSARRAY = 529,
|
F16TEXTURE3D = 529,
|
||||||
F16TEXTURE1D = 530,
|
F16TEXTURE2DRECT = 530,
|
||||||
F16TEXTURE2D = 531,
|
F16TEXTURECUBE = 531,
|
||||||
F16TEXTURE3D = 532,
|
F16TEXTURE1DARRAY = 532,
|
||||||
F16TEXTURE2DRECT = 533,
|
F16TEXTURE2DARRAY = 533,
|
||||||
F16TEXTURECUBE = 534,
|
F16TEXTURECUBEARRAY = 534,
|
||||||
F16TEXTURE1DARRAY = 535,
|
F16TEXTUREBUFFER = 535,
|
||||||
F16TEXTURE2DARRAY = 536,
|
F16TEXTURE2DMS = 536,
|
||||||
F16TEXTURECUBEARRAY = 537,
|
F16TEXTURE2DMSARRAY = 537,
|
||||||
F16TEXTUREBUFFER = 538,
|
SUBPASSINPUT = 538,
|
||||||
F16TEXTURE2DMS = 539,
|
SUBPASSINPUTMS = 539,
|
||||||
F16TEXTURE2DMSARRAY = 540,
|
ISUBPASSINPUT = 540,
|
||||||
SUBPASSINPUT = 541,
|
ISUBPASSINPUTMS = 541,
|
||||||
SUBPASSINPUTMS = 542,
|
USUBPASSINPUT = 542,
|
||||||
ISUBPASSINPUT = 543,
|
USUBPASSINPUTMS = 543,
|
||||||
ISUBPASSINPUTMS = 544,
|
F16SUBPASSINPUT = 544,
|
||||||
USUBPASSINPUT = 545,
|
F16SUBPASSINPUTMS = 545,
|
||||||
USUBPASSINPUTMS = 546,
|
LEFT_OP = 546,
|
||||||
F16SUBPASSINPUT = 547,
|
RIGHT_OP = 547,
|
||||||
F16SUBPASSINPUTMS = 548,
|
INC_OP = 548,
|
||||||
IMAGE1D = 549,
|
DEC_OP = 549,
|
||||||
IIMAGE1D = 550,
|
LE_OP = 550,
|
||||||
UIMAGE1D = 551,
|
GE_OP = 551,
|
||||||
IMAGE2D = 552,
|
EQ_OP = 552,
|
||||||
IIMAGE2D = 553,
|
NE_OP = 553,
|
||||||
UIMAGE2D = 554,
|
AND_OP = 554,
|
||||||
IMAGE3D = 555,
|
OR_OP = 555,
|
||||||
IIMAGE3D = 556,
|
XOR_OP = 556,
|
||||||
UIMAGE3D = 557,
|
MUL_ASSIGN = 557,
|
||||||
IMAGE2DRECT = 558,
|
DIV_ASSIGN = 558,
|
||||||
IIMAGE2DRECT = 559,
|
ADD_ASSIGN = 559,
|
||||||
UIMAGE2DRECT = 560,
|
MOD_ASSIGN = 560,
|
||||||
IMAGECUBE = 561,
|
LEFT_ASSIGN = 561,
|
||||||
IIMAGECUBE = 562,
|
RIGHT_ASSIGN = 562,
|
||||||
UIMAGECUBE = 563,
|
AND_ASSIGN = 563,
|
||||||
IMAGEBUFFER = 564,
|
XOR_ASSIGN = 564,
|
||||||
IIMAGEBUFFER = 565,
|
OR_ASSIGN = 565,
|
||||||
UIMAGEBUFFER = 566,
|
SUB_ASSIGN = 566,
|
||||||
IMAGE1DARRAY = 567,
|
LEFT_PAREN = 567,
|
||||||
IIMAGE1DARRAY = 568,
|
RIGHT_PAREN = 568,
|
||||||
UIMAGE1DARRAY = 569,
|
LEFT_BRACKET = 569,
|
||||||
IMAGE2DARRAY = 570,
|
RIGHT_BRACKET = 570,
|
||||||
IIMAGE2DARRAY = 571,
|
LEFT_BRACE = 571,
|
||||||
UIMAGE2DARRAY = 572,
|
RIGHT_BRACE = 572,
|
||||||
IMAGECUBEARRAY = 573,
|
DOT = 573,
|
||||||
IIMAGECUBEARRAY = 574,
|
COMMA = 574,
|
||||||
UIMAGECUBEARRAY = 575,
|
COLON = 575,
|
||||||
IMAGE2DMS = 576,
|
EQUAL = 576,
|
||||||
IIMAGE2DMS = 577,
|
SEMICOLON = 577,
|
||||||
UIMAGE2DMS = 578,
|
BANG = 578,
|
||||||
IMAGE2DMSARRAY = 579,
|
DASH = 579,
|
||||||
IIMAGE2DMSARRAY = 580,
|
TILDE = 580,
|
||||||
UIMAGE2DMSARRAY = 581,
|
PLUS = 581,
|
||||||
F16IMAGE1D = 582,
|
STAR = 582,
|
||||||
F16IMAGE2D = 583,
|
SLASH = 583,
|
||||||
F16IMAGE3D = 584,
|
PERCENT = 584,
|
||||||
F16IMAGE2DRECT = 585,
|
LEFT_ANGLE = 585,
|
||||||
F16IMAGECUBE = 586,
|
RIGHT_ANGLE = 586,
|
||||||
F16IMAGE1DARRAY = 587,
|
VERTICAL_BAR = 587,
|
||||||
F16IMAGE2DARRAY = 588,
|
CARET = 588,
|
||||||
F16IMAGECUBEARRAY = 589,
|
AMPERSAND = 589,
|
||||||
F16IMAGEBUFFER = 590,
|
QUESTION = 590,
|
||||||
F16IMAGE2DMS = 591,
|
INVARIANT = 591,
|
||||||
F16IMAGE2DMSARRAY = 592,
|
HIGH_PRECISION = 592,
|
||||||
STRUCT = 593,
|
MEDIUM_PRECISION = 593,
|
||||||
VOID = 594,
|
LOW_PRECISION = 594,
|
||||||
WHILE = 595,
|
PRECISION = 595,
|
||||||
IDENTIFIER = 596,
|
PACKED = 596,
|
||||||
TYPE_NAME = 597,
|
RESOURCE = 597,
|
||||||
FLOATCONSTANT = 598,
|
SUPERP = 598,
|
||||||
DOUBLECONSTANT = 599,
|
FLOATCONSTANT = 599,
|
||||||
INT16CONSTANT = 600,
|
INTCONSTANT = 600,
|
||||||
UINT16CONSTANT = 601,
|
UINTCONSTANT = 601,
|
||||||
INT32CONSTANT = 602,
|
BOOLCONSTANT = 602,
|
||||||
UINT32CONSTANT = 603,
|
IDENTIFIER = 603,
|
||||||
INTCONSTANT = 604,
|
TYPE_NAME = 604,
|
||||||
UINTCONSTANT = 605,
|
CENTROID = 605,
|
||||||
INT64CONSTANT = 606,
|
IN = 606,
|
||||||
UINT64CONSTANT = 607,
|
OUT = 607,
|
||||||
BOOLCONSTANT = 608,
|
INOUT = 608,
|
||||||
FLOAT16CONSTANT = 609,
|
STRUCT = 609,
|
||||||
LEFT_OP = 610,
|
VOID = 610,
|
||||||
RIGHT_OP = 611,
|
WHILE = 611,
|
||||||
INC_OP = 612,
|
BREAK = 612,
|
||||||
DEC_OP = 613,
|
CONTINUE = 613,
|
||||||
LE_OP = 614,
|
DO = 614,
|
||||||
GE_OP = 615,
|
ELSE = 615,
|
||||||
EQ_OP = 616,
|
FOR = 616,
|
||||||
NE_OP = 617,
|
IF = 617,
|
||||||
AND_OP = 618,
|
DISCARD = 618,
|
||||||
OR_OP = 619,
|
RETURN = 619,
|
||||||
XOR_OP = 620,
|
SWITCH = 620,
|
||||||
MUL_ASSIGN = 621,
|
CASE = 621,
|
||||||
DIV_ASSIGN = 622,
|
DEFAULT = 622,
|
||||||
ADD_ASSIGN = 623,
|
UNIFORM = 623,
|
||||||
MOD_ASSIGN = 624,
|
SHARED = 624,
|
||||||
LEFT_ASSIGN = 625,
|
FLAT = 625,
|
||||||
RIGHT_ASSIGN = 626,
|
SMOOTH = 626,
|
||||||
AND_ASSIGN = 627,
|
LAYOUT = 627,
|
||||||
XOR_ASSIGN = 628,
|
DOUBLECONSTANT = 628,
|
||||||
OR_ASSIGN = 629,
|
INT16CONSTANT = 629,
|
||||||
SUB_ASSIGN = 630,
|
UINT16CONSTANT = 630,
|
||||||
LEFT_PAREN = 631,
|
FLOAT16CONSTANT = 631,
|
||||||
RIGHT_PAREN = 632,
|
INT32CONSTANT = 632,
|
||||||
LEFT_BRACKET = 633,
|
UINT32CONSTANT = 633,
|
||||||
RIGHT_BRACKET = 634,
|
INT64CONSTANT = 634,
|
||||||
LEFT_BRACE = 635,
|
UINT64CONSTANT = 635,
|
||||||
RIGHT_BRACE = 636,
|
SUBROUTINE = 636,
|
||||||
DOT = 637,
|
DEMOTE = 637,
|
||||||
COMMA = 638,
|
PAYLOADNV = 638,
|
||||||
COLON = 639,
|
PAYLOADINNV = 639,
|
||||||
EQUAL = 640,
|
HITATTRNV = 640,
|
||||||
SEMICOLON = 641,
|
CALLDATANV = 641,
|
||||||
BANG = 642,
|
CALLDATAINNV = 642,
|
||||||
DASH = 643,
|
PATCH = 643,
|
||||||
TILDE = 644,
|
SAMPLE = 644,
|
||||||
PLUS = 645,
|
BUFFER = 645,
|
||||||
STAR = 646,
|
NONUNIFORM = 646,
|
||||||
SLASH = 647,
|
COHERENT = 647,
|
||||||
PERCENT = 648,
|
VOLATILE = 648,
|
||||||
LEFT_ANGLE = 649,
|
RESTRICT = 649,
|
||||||
RIGHT_ANGLE = 650,
|
READONLY = 650,
|
||||||
VERTICAL_BAR = 651,
|
WRITEONLY = 651,
|
||||||
CARET = 652,
|
DEVICECOHERENT = 652,
|
||||||
AMPERSAND = 653,
|
QUEUEFAMILYCOHERENT = 653,
|
||||||
QUESTION = 654,
|
WORKGROUPCOHERENT = 654,
|
||||||
INVARIANT = 655,
|
SUBGROUPCOHERENT = 655,
|
||||||
PRECISE = 656,
|
NONPRIVATE = 656,
|
||||||
HIGH_PRECISION = 657,
|
NOPERSPECTIVE = 657,
|
||||||
MEDIUM_PRECISION = 658,
|
EXPLICITINTERPAMD = 658,
|
||||||
LOW_PRECISION = 659,
|
PERVERTEXNV = 659,
|
||||||
PRECISION = 660,
|
PERPRIMITIVENV = 660,
|
||||||
PACKED = 661,
|
PERVIEWNV = 661,
|
||||||
RESOURCE = 662,
|
PERTASKNV = 662,
|
||||||
SUPERP = 663
|
PRECISE = 663
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -459,7 +459,7 @@ extern int yydebug;
|
||||||
|
|
||||||
union YYSTYPE
|
union YYSTYPE
|
||||||
{
|
{
|
||||||
#line 71 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
#line 96 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
glslang::TSourceLoc loc;
|
glslang::TSourceLoc loc;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
#include "localintermediate.h"
|
#include "localintermediate.h"
|
||||||
#include "../Include/InfoSink.h"
|
#include "../Include/InfoSink.h"
|
||||||
|
|
||||||
|
|
@ -174,7 +176,7 @@ bool TOutputTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node)
|
||||||
case EOpIndexIndirect: out.debug << "indirect index"; break;
|
case EOpIndexIndirect: out.debug << "indirect index"; break;
|
||||||
case EOpIndexDirectStruct:
|
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();
|
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 << (*members)[node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst()].type->getFieldName();
|
||||||
out.debug << ": direct index for structure"; break;
|
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 EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break;
|
||||||
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
||||||
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
||||||
case EOpSubgroupPartitionedMul: out.debug << "subgroupPartitionedMulNV"; 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 EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break;
|
||||||
case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break;
|
case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break;
|
||||||
case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break;
|
case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case EOpClip: out.debug << "clip"; break;
|
case EOpClip: out.debug << "clip"; break;
|
||||||
case EOpIsFinite: out.debug << "isfinite"; break;
|
case EOpIsFinite: out.debug << "isfinite"; break;
|
||||||
|
|
@ -648,7 +648,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
||||||
|
|
||||||
case EOpSparseTexelsResident: out.debug << "sparseTexelsResident"; break;
|
case EOpSparseTexelsResident: out.debug << "sparseTexelsResident"; break;
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EOpMinInvocations: out.debug << "minInvocations"; break;
|
case EOpMinInvocations: out.debug << "minInvocations"; break;
|
||||||
case EOpMaxInvocations: out.debug << "maxInvocations"; break;
|
case EOpMaxInvocations: out.debug << "maxInvocations"; break;
|
||||||
case EOpAddInvocations: out.debug << "addInvocations"; 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 EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break;
|
||||||
case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break;
|
case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
||||||
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
||||||
|
|
@ -863,7 +861,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
||||||
|
|
||||||
case EOpReadInvocation: out.debug << "readInvocation"; break;
|
case EOpReadInvocation: out.debug << "readInvocation"; break;
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EOpSwizzleInvocations: out.debug << "swizzleInvocations"; break;
|
case EOpSwizzleInvocations: out.debug << "swizzleInvocations"; break;
|
||||||
case EOpSwizzleInvocationsMasked: out.debug << "swizzleInvocationsMasked"; break;
|
case EOpSwizzleInvocationsMasked: out.debug << "swizzleInvocationsMasked"; break;
|
||||||
case EOpWriteInvocation: out.debug << "writeInvocation"; 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 EOpMin3: out.debug << "min3"; break;
|
||||||
case EOpMax3: out.debug << "max3"; break;
|
case EOpMax3: out.debug << "max3"; break;
|
||||||
case EOpMid3: out.debug << "mid3"; break;
|
case EOpMid3: out.debug << "mid3"; break;
|
||||||
|
|
||||||
case EOpTime: out.debug << "time"; break;
|
case EOpTime: out.debug << "time"; break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case EOpAtomicAdd: out.debug << "AtomicAdd"; break;
|
case EOpAtomicAdd: out.debug << "AtomicAdd"; break;
|
||||||
case EOpAtomicMin: out.debug << "AtomicMin"; 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 EOpImageAtomicCompSwap: out.debug << "imageAtomicCompSwap"; break;
|
||||||
case EOpImageAtomicLoad: out.debug << "imageAtomicLoad"; break;
|
case EOpImageAtomicLoad: out.debug << "imageAtomicLoad"; break;
|
||||||
case EOpImageAtomicStore: out.debug << "imageAtomicStore"; break;
|
case EOpImageAtomicStore: out.debug << "imageAtomicStore"; break;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EOpImageLoadLod: out.debug << "imageLoadLod"; break;
|
case EOpImageLoadLod: out.debug << "imageLoadLod"; break;
|
||||||
case EOpImageStoreLod: out.debug << "imageStoreLod"; break;
|
case EOpImageStoreLod: out.debug << "imageStoreLod"; break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case EOpTextureQuerySize: out.debug << "textureSize"; break;
|
case EOpTextureQuerySize: out.debug << "textureSize"; break;
|
||||||
case EOpTextureQueryLod: out.debug << "textureQueryLod"; 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 EOpTextureOffsetClamp: out.debug << "textureOffsetClamp"; break;
|
||||||
case EOpTextureGradClamp: out.debug << "textureGradClamp"; break;
|
case EOpTextureGradClamp: out.debug << "textureGradClamp"; break;
|
||||||
case EOpTextureGradOffsetClamp: out.debug << "textureGradOffsetClamp"; break;
|
case EOpTextureGradOffsetClamp: out.debug << "textureGradOffsetClamp"; break;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EOpTextureGatherLod: out.debug << "textureGatherLod"; break;
|
case EOpTextureGatherLod: out.debug << "textureGatherLod"; break;
|
||||||
case EOpTextureGatherLodOffset: out.debug << "textureGatherLodOffset"; break;
|
case EOpTextureGatherLodOffset: out.debug << "textureGatherLodOffset"; break;
|
||||||
case EOpTextureGatherLodOffsets: out.debug << "textureGatherLodOffsets"; break;
|
case EOpTextureGatherLodOffsets: out.debug << "textureGatherLodOffsets"; break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case EOpSparseTexture: out.debug << "sparseTexture"; break;
|
case EOpSparseTexture: out.debug << "sparseTexture"; break;
|
||||||
case EOpSparseTextureOffset: out.debug << "sparseTextureOffset"; 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 EOpSparseTextureOffsetClamp: out.debug << "sparseTextureOffsetClamp"; break;
|
||||||
case EOpSparseTextureGradClamp: out.debug << "sparseTextureGradClamp"; break;
|
case EOpSparseTextureGradClamp: out.debug << "sparseTextureGradClamp"; break;
|
||||||
case EOpSparseTextureGradOffsetClamp: out.debug << "sparseTextureGradOffsetClam"; break;
|
case EOpSparseTextureGradOffsetClamp: out.debug << "sparseTextureGradOffsetClam"; break;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EOpSparseTextureGatherLod: out.debug << "sparseTextureGatherLod"; break;
|
case EOpSparseTextureGatherLod: out.debug << "sparseTextureGatherLod"; break;
|
||||||
case EOpSparseTextureGatherLodOffset: out.debug << "sparseTextureGatherLodOffset"; break;
|
case EOpSparseTextureGatherLodOffset: out.debug << "sparseTextureGatherLodOffset"; break;
|
||||||
case EOpSparseTextureGatherLodOffsets: out.debug << "sparseTextureGatherLodOffsets"; break;
|
case EOpSparseTextureGatherLodOffsets: out.debug << "sparseTextureGatherLodOffsets"; break;
|
||||||
case EOpSparseImageLoadLod: out.debug << "sparseImageLoadLod"; break;
|
case EOpSparseImageLoadLod: out.debug << "sparseImageLoadLod"; break;
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EOpImageSampleFootprintNV: out.debug << "imageSampleFootprintNV"; break;
|
case EOpImageSampleFootprintNV: out.debug << "imageSampleFootprintNV"; break;
|
||||||
case EOpImageSampleFootprintClampNV: out.debug << "imageSampleFootprintClampNV"; break;
|
case EOpImageSampleFootprintClampNV: out.debug << "imageSampleFootprintClampNV"; break;
|
||||||
case EOpImageSampleFootprintLodNV: out.debug << "imageSampleFootprintLodNV"; break;
|
case EOpImageSampleFootprintLodNV: out.debug << "imageSampleFootprintLodNV"; break;
|
||||||
case EOpImageSampleFootprintGradNV: out.debug << "imageSampleFootprintGradNV"; break;
|
case EOpImageSampleFootprintGradNV: out.debug << "imageSampleFootprintGradNV"; break;
|
||||||
case EOpImageSampleFootprintGradClampNV: out.debug << "mageSampleFootprintGradClampNV"; break;
|
case EOpImageSampleFootprintGradClampNV: out.debug << "mageSampleFootprintGradClampNV"; break;
|
||||||
#endif
|
|
||||||
case EOpAddCarry: out.debug << "addCarry"; break;
|
case EOpAddCarry: out.debug << "addCarry"; break;
|
||||||
case EOpSubBorrow: out.debug << "subBorrow"; break;
|
case EOpSubBorrow: out.debug << "subBorrow"; break;
|
||||||
case EOpUMulExtended: out.debug << "uMulExtended"; 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 EOpInterpolateAtSample: out.debug << "interpolateAtSample"; break;
|
||||||
case EOpInterpolateAtOffset: out.debug << "interpolateAtOffset"; break;
|
case EOpInterpolateAtOffset: out.debug << "interpolateAtOffset"; break;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EOpInterpolateAtVertex: out.debug << "interpolateAtVertex"; break;
|
case EOpInterpolateAtVertex: out.debug << "interpolateAtVertex"; break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case EOpSinCos: out.debug << "sincos"; break;
|
case EOpSinCos: out.debug << "sincos"; break;
|
||||||
case EOpGenMul: out.debug << "mul"; 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 EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break;
|
||||||
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
||||||
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
||||||
case EOpSubgroupPartitionedMul: out.debug << "subgroupPartitionedMulNV"; 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 EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break;
|
||||||
case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break;
|
case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break;
|
||||||
case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break;
|
case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
||||||
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EOpTraceNV: out.debug << "traceNV"; break;
|
case EOpTraceNV: out.debug << "traceNV"; break;
|
||||||
case EOpReportIntersectionNV: out.debug << "reportIntersectionNV"; break;
|
case EOpReportIntersectionNV: out.debug << "reportIntersectionNV"; break;
|
||||||
case EOpIgnoreIntersectionNV: out.debug << "ignoreIntersectionNV"; break;
|
case EOpIgnoreIntersectionNV: out.debug << "ignoreIntersectionNV"; break;
|
||||||
case EOpTerminateRayNV: out.debug << "terminateRayNV"; break;
|
case EOpTerminateRayNV: out.debug << "terminateRayNV"; break;
|
||||||
case EOpExecuteCallableNV: out.debug << "executeCallableNV"; break;
|
case EOpExecuteCallableNV: out.debug << "executeCallableNV"; break;
|
||||||
case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break;
|
case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break;
|
case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break;
|
||||||
case EOpCooperativeMatrixStore: out.debug << "Store 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";
|
infoSink.debug << "interlock ordering = " << TQualifier::getInterlockOrderingString(interlockOrdering) << "\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EShLangMeshNV:
|
case EShLangMeshNV:
|
||||||
infoSink.debug << "max_vertices = " << vertices << "\n";
|
infoSink.debug << "max_vertices = " << vertices << "\n";
|
||||||
infoSink.debug << "max_primitives = " << primitives << "\n";
|
infoSink.debug << "max_primitives = " << primitives << "\n";
|
||||||
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
|
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
|
||||||
// Fall through
|
// Fall through
|
||||||
|
|
||||||
case EShLangTaskNV:
|
case EShLangTaskNV:
|
||||||
// Fall through
|
// Fall through
|
||||||
#endif
|
|
||||||
case EShLangCompute:
|
case EShLangCompute:
|
||||||
infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n";
|
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
|
} // end namespace glslang
|
||||||
|
|
||||||
|
#endif // not GLSLANG_WEB
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
#include "../Include/Common.h"
|
#include "../Include/Common.h"
|
||||||
#include "../Include/InfoSink.h"
|
#include "../Include/InfoSink.h"
|
||||||
|
|
||||||
|
|
@ -75,7 +77,7 @@ public:
|
||||||
target = &inputList;
|
target = &inputList;
|
||||||
else if (base->getQualifier().storage == EvqVaryingOut)
|
else if (base->getQualifier().storage == EvqVaryingOut)
|
||||||
target = &outputList;
|
target = &outputList;
|
||||||
else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().layoutPushConstant)
|
else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().isPushConstant())
|
||||||
target = &uniformList;
|
target = &uniformList;
|
||||||
if (target) {
|
if (target) {
|
||||||
TVarEntryInfo ent = {base->getId(), base, ! traverseAll};
|
TVarEntryInfo ent = {base->getId(), base, ! traverseAll};
|
||||||
|
|
@ -355,7 +357,7 @@ struct TSymbolValidater
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (base->getQualifier().isUniformOrBuffer() && ! base->getQualifier().layoutPushConstant) {
|
} else if (base->getQualifier().isUniformOrBuffer() && ! base->getQualifier().isPushConstant()) {
|
||||||
// validate uniform type;
|
// validate uniform type;
|
||||||
for (int i = 0; i < EShLangCount; i++) {
|
for (int i = 0; i < EShLangCount; i++) {
|
||||||
if (i != currentStage && outVarMaps[i] != nullptr) {
|
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
|
// no locations added if already present, a built-in variable, a block, or an opaque
|
||||||
if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock ||
|
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;
|
return ent.newLocation = -1;
|
||||||
}
|
}
|
||||||
// no locations on blocks of built-in variables
|
// no locations on blocks of built-in variables
|
||||||
|
|
@ -672,7 +674,7 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
|
||||||
} else {
|
} else {
|
||||||
// no locations added if already present, a built-in variable, a block, or an opaque
|
// no locations added if already present, a built-in variable, a block, or an opaque
|
||||||
if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock ||
|
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;
|
return ent.newLocation = -1;
|
||||||
}
|
}
|
||||||
// no locations on blocks of built-in variables
|
// 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:
|
The following IO resolver maps types in HLSL register space, as follows:
|
||||||
|
|
||||||
|
|
@ -1023,6 +1026,7 @@ struct TDefaultHlslIoResolver : public TDefaultIoResolverBase {
|
||||||
return ent.newBinding = -1;
|
return ent.newBinding = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
// Map I/O variables to provided offsets, and make bindings for
|
// Map I/O variables to provided offsets, and make bindings for
|
||||||
// unbound but live variables.
|
// unbound but live variables.
|
||||||
|
|
@ -1044,6 +1048,7 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
|
||||||
return false;
|
return false;
|
||||||
// if no resolver is provided, use the default resolver with the given shifts and auto map settings
|
// if no resolver is provided, use the default resolver with the given shifts and auto map settings
|
||||||
TDefaultIoResolver defaultResolver(intermediate);
|
TDefaultIoResolver defaultResolver(intermediate);
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
TDefaultHlslIoResolver defaultHlslResolver(intermediate);
|
TDefaultHlslIoResolver defaultHlslResolver(intermediate);
|
||||||
if (resolver == nullptr) {
|
if (resolver == nullptr) {
|
||||||
// TODO: use a passed in IO mapper for this
|
// TODO: use a passed in IO mapper for this
|
||||||
|
|
@ -1053,6 +1058,10 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
|
||||||
resolver = &defaultResolver;
|
resolver = &defaultResolver;
|
||||||
}
|
}
|
||||||
resolver->addStage(stage);
|
resolver->addStage(stage);
|
||||||
|
#else
|
||||||
|
resolver = &defaultResolver;
|
||||||
|
#endif
|
||||||
|
|
||||||
TVarLiveMap inVarMap, outVarMap, uniformVarMap;
|
TVarLiveMap inVarMap, outVarMap, uniformVarMap;
|
||||||
TVarLiveVector inVector, outVector, uniformVector;
|
TVarLiveVector inVector, outVector, uniformVector;
|
||||||
TVarGatherTraverser iter_binding_all(intermediate, true, inVarMap, outVarMap, uniformVarMap);
|
TVarGatherTraverser iter_binding_all(intermediate, true, inVarMap, outVarMap, uniformVarMap);
|
||||||
|
|
@ -1232,3 +1241,5 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
#ifndef _IOMAPPER_INCLUDED
|
#ifndef _IOMAPPER_INCLUDED
|
||||||
#define _IOMAPPER_INCLUDED
|
#define _IOMAPPER_INCLUDED
|
||||||
|
|
||||||
|
|
@ -176,7 +178,7 @@ protected:
|
||||||
|
|
||||||
// Return true if this is a UAV (unordered access view) type:
|
// Return true if this is a UAV (unordered access view) type:
|
||||||
static bool isUavType(const glslang::TType& type) {
|
static bool isUavType(const glslang::TType& type) {
|
||||||
if (type.getQualifier().readonly)
|
if (type.getQualifier().isReadOnly())
|
||||||
return false;
|
return false;
|
||||||
return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) ||
|
return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) ||
|
||||||
(type.getQualifier().storage == EvqBuffer);
|
(type.getQualifier().storage == EvqBuffer);
|
||||||
|
|
@ -293,3 +295,5 @@ public:
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
||||||
#endif // _IOMAPPER_INCLUDED
|
#endif // _IOMAPPER_INCLUDED
|
||||||
|
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
|
|
|
||||||
|
|
@ -187,12 +187,14 @@ bool TIndexTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node)
|
||||||
//
|
//
|
||||||
void TParseContext::constantIndexExpressionCheck(TIntermNode* index)
|
void TParseContext::constantIndexExpressionCheck(TIntermNode* index)
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
TIndexTraverser it(inductiveLoopIds);
|
TIndexTraverser it(inductiveLoopIds);
|
||||||
|
|
||||||
index->traverse(&it);
|
index->traverse(&it);
|
||||||
|
|
||||||
if (it.bad)
|
if (it.bad)
|
||||||
error(it.badLoc, "Non-constant-index-expression", "limitations", "");
|
error(it.badLoc, "Non-constant-index-expression", "limitations", "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,10 @@ namespace glslang {
|
||||||
//
|
//
|
||||||
void TIntermediate::error(TInfoSink& infoSink, const char* message)
|
void TIntermediate::error(TInfoSink& infoSink, const char* message)
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
infoSink.info.prefix(EPrefixError);
|
infoSink.info.prefix(EPrefixError);
|
||||||
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
|
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
|
||||||
|
#endif
|
||||||
|
|
||||||
++numErrors;
|
++numErrors;
|
||||||
}
|
}
|
||||||
|
|
@ -65,8 +67,10 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message)
|
||||||
// Link-time warning.
|
// Link-time warning.
|
||||||
void TIntermediate::warn(TInfoSink& infoSink, const char* message)
|
void TIntermediate::warn(TInfoSink& infoSink, const char* message)
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
infoSink.info.prefix(EPrefixWarning);
|
infoSink.info.prefix(EPrefixWarning);
|
||||||
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
|
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
|
// 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)
|
void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
mergeCallGraphs(infoSink, unit);
|
mergeCallGraphs(infoSink, unit);
|
||||||
mergeModes(infoSink, unit);
|
mergeModes(infoSink, unit);
|
||||||
mergeTrees(infoSink, unit);
|
mergeTrees(infoSink, unit);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit)
|
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());
|
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_MAX(member) member = std::max(member, unit.member)
|
||||||
#define MERGE_TRUE(member) if (unit.member) 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)
|
if (language != unit.language)
|
||||||
error(infoSink, "stages must match when linking into a single stage");
|
error(infoSink, "stages must match when linking into a single stage");
|
||||||
|
|
||||||
if (source == EShSourceNone)
|
if (getSource() == EShSourceNone)
|
||||||
source = unit.source;
|
setSource(unit.getSource());
|
||||||
if (source != unit.source)
|
if (getSource() != unit.getSource())
|
||||||
error(infoSink, "can't link compilation units from different source languages");
|
error(infoSink, "can't link compilation units from different source languages");
|
||||||
|
|
||||||
if (treeRoot == nullptr) {
|
if (treeRoot == nullptr) {
|
||||||
|
|
@ -116,7 +124,7 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
||||||
version = unit.version;
|
version = unit.version;
|
||||||
requestedExtensions = unit.requestedExtensions;
|
requestedExtensions = unit.requestedExtensions;
|
||||||
} else {
|
} else {
|
||||||
if ((profile == EEsProfile) != (unit.profile == EEsProfile))
|
if ((isEsProfile()) != (unit.isEsProfile()))
|
||||||
error(infoSink, "Cannot cross link ES and desktop profiles");
|
error(infoSink, "Cannot cross link ES and desktop profiles");
|
||||||
else if (unit.profile == ECompatibilityProfile)
|
else if (unit.profile == ECompatibilityProfile)
|
||||||
profile = ECompatibilityProfile;
|
profile = ECompatibilityProfile;
|
||||||
|
|
@ -142,18 +150,13 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
||||||
if (vertices == TQualifier::layoutNotSet)
|
if (vertices == TQualifier::layoutNotSet)
|
||||||
vertices = unit.vertices;
|
vertices = unit.vertices;
|
||||||
else if (vertices != unit.vertices) {
|
else if (vertices != unit.vertices) {
|
||||||
if (language == EShLangGeometry
|
if (language == EShLangGeometry || language == EShLangMeshNV)
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
|| language == EShLangMeshNV
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
error(infoSink, "Contradictory layout max_vertices values");
|
error(infoSink, "Contradictory layout max_vertices values");
|
||||||
else if (language == EShLangTessControl)
|
else if (language == EShLangTessControl)
|
||||||
error(infoSink, "Contradictory layout vertices values");
|
error(infoSink, "Contradictory layout vertices values");
|
||||||
else
|
else
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
if (primitives == TQualifier::layoutNotSet)
|
if (primitives == TQualifier::layoutNotSet)
|
||||||
primitives = unit.primitives;
|
primitives = unit.primitives;
|
||||||
else if (primitives != unit.primitives) {
|
else if (primitives != unit.primitives) {
|
||||||
|
|
@ -162,7 +165,6 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
||||||
else
|
else
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (inputPrimitive == ElgNone)
|
if (inputPrimitive == ElgNone)
|
||||||
inputPrimitive = unit.inputPrimitive;
|
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);
|
xfbBuffers[b].implicitStride = std::max(xfbBuffers[b].implicitStride, unit.xfbBuffers[b].implicitStride);
|
||||||
if (unit.xfbBuffers[b].contains64BitType)
|
if (unit.xfbBuffers[b].contains64BitType)
|
||||||
xfbBuffers[b].contains64BitType = true;
|
xfbBuffers[b].contains64BitType = true;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
if (unit.xfbBuffers[b].contains32BitType)
|
if (unit.xfbBuffers[b].contains32BitType)
|
||||||
xfbBuffers[b].contains32BitType = true;
|
xfbBuffers[b].contains32BitType = true;
|
||||||
if (unit.xfbBuffers[b].contains16BitType)
|
if (unit.xfbBuffers[b].contains16BitType)
|
||||||
xfbBuffers[b].contains16BitType = true;
|
xfbBuffers[b].contains16BitType = true;
|
||||||
#endif
|
|
||||||
// TODO: 4.4 link: enhanced layouts: compare ranges
|
// TODO: 4.4 link: enhanced layouts: compare ranges
|
||||||
}
|
}
|
||||||
|
|
||||||
MERGE_TRUE(multiStream);
|
MERGE_TRUE(multiStream);
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
MERGE_TRUE(layoutOverrideCoverage);
|
MERGE_TRUE(layoutOverrideCoverage);
|
||||||
MERGE_TRUE(geoPassthroughEXT);
|
MERGE_TRUE(geoPassthroughEXT);
|
||||||
#endif
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < unit.shiftBinding.size(); ++i) {
|
for (unsigned int i = 0; i < unit.shiftBinding.size(); ++i) {
|
||||||
if (unit.shiftBinding[i] > 0)
|
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...
|
// Getting this far means we have two existing trees to merge...
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
numShaderRecordNVBlocks += unit.numShaderRecordNVBlocks;
|
numShaderRecordNVBlocks += unit.numShaderRecordNVBlocks;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
numTaskNVBlocks += unit.numTaskNVBlocks;
|
numTaskNVBlocks += unit.numTaskNVBlocks;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Get the top-level globals of each unit
|
// Get the top-level globals of each unit
|
||||||
TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence();
|
TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence();
|
||||||
|
|
@ -315,6 +307,8 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit)
|
||||||
ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end());
|
ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// Traverser that seeds an ID map with all built-ins, and tracks the
|
// Traverser that seeds an ID map with all built-ins, and tracks the
|
||||||
// maximum ID used.
|
// maximum ID used.
|
||||||
// (It would be nice to put this in a function, but that causes warnings
|
// (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...
|
// 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:");
|
error(infoSink, "Presence of precise qualifier must match:");
|
||||||
writeTypeComparison = true;
|
writeTypeComparison = true;
|
||||||
}
|
}
|
||||||
|
|
@ -545,13 +539,14 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
||||||
if (symbol.getQualifier().centroid != unitSymbol.getQualifier().centroid ||
|
if (symbol.getQualifier().centroid != unitSymbol.getQualifier().centroid ||
|
||||||
symbol.getQualifier().smooth != unitSymbol.getQualifier().smooth ||
|
symbol.getQualifier().smooth != unitSymbol.getQualifier().smooth ||
|
||||||
symbol.getQualifier().flat != unitSymbol.getQualifier().flat ||
|
symbol.getQualifier().flat != unitSymbol.getQualifier().flat ||
|
||||||
symbol.getQualifier().sample != unitSymbol.getQualifier().sample ||
|
symbol.getQualifier().isSample()!= unitSymbol.getQualifier().isSample() ||
|
||||||
symbol.getQualifier().patch != unitSymbol.getQualifier().patch ||
|
symbol.getQualifier().isPatch() != unitSymbol.getQualifier().isPatch() ||
|
||||||
symbol.getQualifier().nopersp != unitSymbol.getQualifier().nopersp) {
|
symbol.getQualifier().isNonPerspective() != unitSymbol.getQualifier().isNonPerspective()) {
|
||||||
error(infoSink, "Interpolation and auxiliary storage qualifiers must match:");
|
error(infoSink, "Interpolation and auxiliary storage qualifiers must match:");
|
||||||
writeTypeComparison = true;
|
writeTypeComparison = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Memory...
|
// Memory...
|
||||||
if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent ||
|
if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent ||
|
||||||
symbol.getQualifier().devicecoherent != unitSymbol.getQualifier().devicecoherent ||
|
symbol.getQualifier().devicecoherent != unitSymbol.getQualifier().devicecoherent ||
|
||||||
|
|
@ -566,6 +561,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
||||||
error(infoSink, "Memory qualifiers must match:");
|
error(infoSink, "Memory qualifiers must match:");
|
||||||
writeTypeComparison = true;
|
writeTypeComparison = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Layouts...
|
// Layouts...
|
||||||
// TODO: 4.4 enhanced layouts: Generalize to include offset/align: current spec
|
// TODO: 4.4 enhanced layouts: Generalize to include offset/align: current spec
|
||||||
|
|
@ -609,15 +605,12 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (numEntryPoints < 1) {
|
if (numEntryPoints < 1) {
|
||||||
if (source == EShSourceGlsl)
|
if (getSource() == EShSourceGlsl)
|
||||||
error(infoSink, "Missing entry point: Each stage requires one entry point");
|
error(infoSink, "Missing entry point: Each stage requires one entry point");
|
||||||
else
|
else
|
||||||
warn(infoSink, "Entry point not found");
|
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
|
// recursion and missing body checking
|
||||||
checkCallGraphCycles(infoSink);
|
checkCallGraphCycles(infoSink);
|
||||||
checkCallGraphBodies(infoSink, keepUncalled);
|
checkCallGraphBodies(infoSink, keepUncalled);
|
||||||
|
|
@ -625,6 +618,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||||
// overlap/alias/missing I/O, etc.
|
// overlap/alias/missing I/O, etc.
|
||||||
inOutLocationCheck(infoSink);
|
inOutLocationCheck(infoSink);
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
if (getNumPushConstants() > 1)
|
||||||
|
error(infoSink, "Only one push_constant block is allowed per stage");
|
||||||
|
|
||||||
// invocations
|
// invocations
|
||||||
if (invocations == TQualifier::layoutNotSet)
|
if (invocations == TQualifier::layoutNotSet)
|
||||||
invocations = 1;
|
invocations = 1;
|
||||||
|
|
@ -642,12 +639,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||||
for (size_t b = 0; b < xfbBuffers.size(); ++b) {
|
for (size_t b = 0; b < xfbBuffers.size(); ++b) {
|
||||||
if (xfbBuffers[b].contains64BitType)
|
if (xfbBuffers[b].contains64BitType)
|
||||||
RoundToPow2(xfbBuffers[b].implicitStride, 8);
|
RoundToPow2(xfbBuffers[b].implicitStride, 8);
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
else if (xfbBuffers[b].contains32BitType)
|
else if (xfbBuffers[b].contains32BitType)
|
||||||
RoundToPow2(xfbBuffers[b].implicitStride, 4);
|
RoundToPow2(xfbBuffers[b].implicitStride, 4);
|
||||||
else if (xfbBuffers[b].contains16BitType)
|
else if (xfbBuffers[b].contains16BitType)
|
||||||
RoundToPow2(xfbBuffers[b].implicitStride, 2);
|
RoundToPow2(xfbBuffers[b].implicitStride, 2);
|
||||||
#endif
|
|
||||||
|
|
||||||
// "It is a compile-time or link-time error to have
|
// "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
|
// 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:");
|
error(infoSink, "xfb_stride must be multiple of 8 for buffer holding a double or 64-bit integer:");
|
||||||
infoSink.info.prefix(EPrefixError);
|
infoSink.info.prefix(EPrefixError);
|
||||||
infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
|
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 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:");
|
error(infoSink, "xfb_stride must be multiple of 4:");
|
||||||
infoSink.info.prefix(EPrefixError);
|
infoSink.info.prefix(EPrefixError);
|
||||||
infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
|
infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
|
||||||
}
|
}
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
// "If the buffer is capturing any
|
// "If the buffer is capturing any
|
||||||
// outputs with half-precision or 16-bit integer components, the stride must be a multiple of 2"
|
// 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)) {
|
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";
|
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
|
// "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the
|
||||||
// implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents."
|
// implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents."
|
||||||
if (xfbBuffers[b].stride > (unsigned int)(4 * resources.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=...)");
|
error(infoSink, "At least one shader must specify an output layout(vertices=...)");
|
||||||
break;
|
break;
|
||||||
case EShLangTessEvaluation:
|
case EShLangTessEvaluation:
|
||||||
if (source == EShSourceGlsl) {
|
if (getSource() == EShSourceGlsl) {
|
||||||
if (inputPrimitive == ElgNone)
|
if (inputPrimitive == ElgNone)
|
||||||
error(infoSink, "At least one shader must specify an input layout primitive");
|
error(infoSink, "At least one shader must specify an input layout primitive");
|
||||||
if (vertexSpacing == EvsNone)
|
if (vertexSpacing == EvsNone)
|
||||||
|
|
@ -730,8 +719,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||||
break;
|
break;
|
||||||
case EShLangCompute:
|
case EShLangCompute:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
case EShLangRayGenNV:
|
case EShLangRayGenNV:
|
||||||
case EShLangIntersectNV:
|
case EShLangIntersectNV:
|
||||||
case EShLangAnyHitNV:
|
case EShLangAnyHitNV:
|
||||||
|
|
@ -764,8 +751,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||||
if (numTaskNVBlocks > 1)
|
if (numTaskNVBlocks > 1)
|
||||||
error(infoSink, "Only one taskNV interface block is allowed per shader");
|
error(infoSink, "Only one taskNV interface block is allowed per shader");
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error(infoSink, "Unknown Stage.");
|
error(infoSink, "Unknown Stage.");
|
||||||
break;
|
break;
|
||||||
|
|
@ -787,6 +772,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||||
} finalLinkTraverser;
|
} finalLinkTraverser;
|
||||||
|
|
||||||
treeRoot->traverse(&finalLinkTraverser);
|
treeRoot->traverse(&finalLinkTraverser);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -973,7 +959,7 @@ void TIntermediate::inOutLocationCheck(TInfoSink& infoSink)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile == EEsProfile) {
|
if (isEsProfile()) {
|
||||||
if (numFragOut > 1 && fragOutWithNoLocation)
|
if (numFragOut > 1 && fragOutWithNoLocation)
|
||||||
error(infoSink, "when more than one fragment shader output, all must have location qualifiers");
|
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.
|
// So, for the case of dvec3, we need two independent ioRanges.
|
||||||
|
|
||||||
int collision = -1; // no collision
|
int collision = -1; // no collision
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
|
if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
|
||||||
(qualifier.isPipeInput() || qualifier.isPipeOutput())) {
|
(qualifier.isPipeInput() || qualifier.isPipeOutput())) {
|
||||||
// Dealing with dvec3 in/out split across two locations.
|
// 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)
|
if (collision < 0)
|
||||||
usedIo[set].push_back(range2);
|
usedIo[set].push_back(range2);
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Not a dvec3 in/out split across two locations, generic path.
|
// Not a dvec3 in/out split across two locations, generic path.
|
||||||
// Need a single IO-range block.
|
// 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);
|
TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0);
|
||||||
|
|
||||||
// check for collisions, except for vertex inputs on desktop targeting OpenGL
|
// 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);
|
collision = checkLocationRange(set, range, type, typeCollision);
|
||||||
|
|
||||||
if (collision < 0)
|
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: 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.
|
// TODO: are there valid cases of having an unsized array with a location? If so, running this code too early.
|
||||||
TType elementType(type, 0);
|
TType elementType(type, 0);
|
||||||
if (type.isSizedArray()
|
if (type.isSizedArray() && !type.getQualifier().isPerView())
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
&& !type.getQualifier().isPerView()
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage);
|
return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage);
|
||||||
else {
|
else {
|
||||||
#ifdef NV_EXTENSIONS
|
#ifndef GLSLANG_WEB
|
||||||
// unset perViewNV attributes for arrayed per-view outputs: "perviewNV vec4 v[MAX_VIEWS][3];"
|
// unset perViewNV attributes for arrayed per-view outputs: "perviewNV vec4 v[MAX_VIEWS][3];"
|
||||||
elementType.getQualifier().perViewNV = false;
|
elementType.getQualifier().perViewNV = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1273,6 +1258,8 @@ int TIntermediate::computeTypeUniformLocationSize(const TType& type)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
// Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
|
// 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.
|
// 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];
|
TXfbBuffer& buffer = xfbBuffers[qualifier.layoutXfbBuffer];
|
||||||
|
|
||||||
// compute the range
|
// compute the range
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
unsigned int size = computeTypeXfbSize(type, buffer.contains64BitType, buffer.contains32BitType, buffer.contains16BitType);
|
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);
|
buffer.implicitStride = std::max(buffer.implicitStride, qualifier.layoutXfbOffset + size);
|
||||||
TRange range(qualifier.layoutXfbOffset, qualifier.layoutXfbOffset + size - 1);
|
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.
|
// Recursively figure out how many bytes of xfb buffer are used by the given type.
|
||||||
// Return the size of type, in bytes.
|
// Return the size of type, in bytes.
|
||||||
// Sets contains64BitType to true if the type contains a 64-bit data type.
|
// 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 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.
|
// 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.
|
// 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
|
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,
|
// "...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.
|
// 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
|
// TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
|
||||||
assert(type.isSizedArray());
|
assert(type.isSizedArray());
|
||||||
TType elementType(type, 0);
|
TType elementType(type, 0);
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType, contains16BitType, contains16BitType);
|
return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType, contains16BitType, contains16BitType);
|
||||||
#else
|
|
||||||
return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.isStruct()) {
|
if (type.isStruct()) {
|
||||||
unsigned int size = 0;
|
unsigned int size = 0;
|
||||||
bool structContains64BitType = false;
|
bool structContains64BitType = false;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
bool structContains32BitType = false;
|
bool structContains32BitType = false;
|
||||||
bool structContains16BitType = false;
|
bool structContains16BitType = false;
|
||||||
#endif
|
|
||||||
for (int member = 0; member < (int)type.getStruct()->size(); ++member) {
|
for (int member = 0; member < (int)type.getStruct()->size(); ++member) {
|
||||||
TType memberType(type, member);
|
TType memberType(type, member);
|
||||||
// "... if applied to
|
// "... if applied to
|
||||||
// an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8,
|
// 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."
|
// and the space taken in the buffer will be a multiple of 8."
|
||||||
bool memberContains64BitType = false;
|
bool memberContains64BitType = false;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
bool memberContains32BitType = false;
|
bool memberContains32BitType = false;
|
||||||
bool memberContains16BitType = false;
|
bool memberContains16BitType = false;
|
||||||
int memberSize = computeTypeXfbSize(memberType, memberContains64BitType, memberContains32BitType, memberContains16BitType);
|
int memberSize = computeTypeXfbSize(memberType, memberContains64BitType, memberContains32BitType, memberContains16BitType);
|
||||||
#else
|
|
||||||
int memberSize = computeTypeXfbSize(memberType, memberContains64BitType);
|
|
||||||
#endif
|
|
||||||
if (memberContains64BitType) {
|
if (memberContains64BitType) {
|
||||||
structContains64BitType = true;
|
structContains64BitType = true;
|
||||||
RoundToPow2(size, 8);
|
RoundToPow2(size, 8);
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
} else if (memberContains32BitType) {
|
} else if (memberContains32BitType) {
|
||||||
structContains32BitType = true;
|
structContains32BitType = true;
|
||||||
RoundToPow2(size, 4);
|
RoundToPow2(size, 4);
|
||||||
} else if (memberContains16BitType) {
|
} else if (memberContains16BitType) {
|
||||||
structContains16BitType = true;
|
structContains16BitType = true;
|
||||||
RoundToPow2(size, 2);
|
RoundToPow2(size, 2);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
size += memberSize;
|
size += memberSize;
|
||||||
}
|
}
|
||||||
|
|
@ -1375,14 +1341,12 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
||||||
if (structContains64BitType) {
|
if (structContains64BitType) {
|
||||||
contains64BitType = true;
|
contains64BitType = true;
|
||||||
RoundToPow2(size, 8);
|
RoundToPow2(size, 8);
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
} else if (structContains32BitType) {
|
} else if (structContains32BitType) {
|
||||||
contains32BitType = true;
|
contains32BitType = true;
|
||||||
RoundToPow2(size, 4);
|
RoundToPow2(size, 4);
|
||||||
} else if (structContains16BitType) {
|
} else if (structContains16BitType) {
|
||||||
contains16BitType = true;
|
contains16BitType = true;
|
||||||
RoundToPow2(size, 2);
|
RoundToPow2(size, 2);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return size;
|
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) {
|
if (type.getBasicType() == EbtDouble || type.getBasicType() == EbtInt64 || type.getBasicType() == EbtUint64) {
|
||||||
contains64BitType = true;
|
contains64BitType = true;
|
||||||
return 8 * numComponents;
|
return 8 * numComponents;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
} else if (type.getBasicType() == EbtFloat16 || type.getBasicType() == EbtInt16 || type.getBasicType() == EbtUint16) {
|
} else if (type.getBasicType() == EbtFloat16 || type.getBasicType() == EbtInt16 || type.getBasicType() == EbtUint16) {
|
||||||
contains16BitType = true;
|
contains16BitType = true;
|
||||||
return 2 * numComponents;
|
return 2 * numComponents;
|
||||||
|
|
@ -1412,12 +1375,10 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
||||||
contains32BitType = true;
|
contains32BitType = true;
|
||||||
return 4 * numComponents;
|
return 4 * numComponents;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
} else
|
|
||||||
return 4 * numComponents;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
const int baseAlignmentVec4Std140 = 16;
|
const int baseAlignmentVec4Std140 = 16;
|
||||||
|
|
||||||
// Return the size and alignment of a component of the given type.
|
// 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..
|
// Return value is the alignment..
|
||||||
int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
|
int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
|
||||||
{
|
{
|
||||||
|
#ifdef GLSLANG_WEB
|
||||||
|
size = 4; return 4;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (type.getBasicType()) {
|
switch (type.getBasicType()) {
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
|
|
@ -1741,7 +1706,7 @@ int TIntermediate::getBlockSize(const TType& blockType)
|
||||||
|
|
||||||
int TIntermediate::computeBufferReferenceTypeSize(const TType& type)
|
int TIntermediate::computeBufferReferenceTypeSize(const TType& type)
|
||||||
{
|
{
|
||||||
assert(type.getBasicType() == EbtReference);
|
assert(type.isReference());
|
||||||
int size = getBlockSize(*type.getReferentType());
|
int size = getBlockSize(*type.getReferentType());
|
||||||
|
|
||||||
int align = type.getBufferReferenceAlignment();
|
int align = type.getBufferReferenceAlignment();
|
||||||
|
|
|
||||||
|
|
@ -149,20 +149,14 @@ struct TOffsetRange {
|
||||||
|
|
||||||
// Things that need to be tracked per xfb buffer.
|
// Things that need to be tracked per xfb buffer.
|
||||||
struct TXfbBuffer {
|
struct TXfbBuffer {
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false),
|
TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false),
|
||||||
contains32BitType(false), contains16BitType(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
|
std::vector<TRange> ranges; // byte offsets that have already been assigned
|
||||||
unsigned int stride;
|
unsigned int stride;
|
||||||
unsigned int implicitStride;
|
unsigned int implicitStride;
|
||||||
bool contains64BitType;
|
bool contains64BitType;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
bool contains32BitType;
|
bool contains32BitType;
|
||||||
bool contains16BitType;
|
bool contains16BitType;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Track a set of strings describing how the module was processed.
|
// Track a set of strings describing how the module was processed.
|
||||||
|
|
@ -217,7 +211,6 @@ class TSymbolTable;
|
||||||
class TSymbol;
|
class TSymbol;
|
||||||
class TVariable;
|
class TVariable;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
//
|
//
|
||||||
// Texture and Sampler transformation mode.
|
// Texture and Sampler transformation mode.
|
||||||
//
|
//
|
||||||
|
|
@ -226,7 +219,6 @@ enum ComputeDerivativeMode {
|
||||||
LayoutDerivativeGroupQuads, // derivative_group_quadsNV
|
LayoutDerivativeGroupQuads, // derivative_group_quadsNV
|
||||||
LayoutDerivativeGroupLinear, // derivative_group_linearNV
|
LayoutDerivativeGroupLinear, // derivative_group_linearNV
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set of helper functions to help parse and build the tree.
|
// Set of helper functions to help parse and build the tree.
|
||||||
|
|
@ -234,41 +226,48 @@ enum ComputeDerivativeMode {
|
||||||
class TIntermediate {
|
class TIntermediate {
|
||||||
public:
|
public:
|
||||||
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) :
|
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) :
|
||||||
|
language(l),
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
implicitThisName("@this"), implicitCounterName("@count"),
|
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),
|
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),
|
invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet),
|
||||||
inputPrimitive(ElgNone), outputPrimitive(ElgNone),
|
inputPrimitive(ElgNone), outputPrimitive(ElgNone),
|
||||||
pixelCenterInteger(false), originUpperLeft(false),
|
pixelCenterInteger(false), originUpperLeft(false),
|
||||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false),
|
vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false),
|
||||||
postDepthCoverage(false), depthLayout(EldNone), depthReplacing(false),
|
postDepthCoverage(false), depthLayout(EldNone),
|
||||||
hlslFunctionality1(false),
|
hlslFunctionality1(false),
|
||||||
blendEquations(0), xfbMode(false), multiStream(false),
|
blendEquations(0), xfbMode(false), multiStream(false),
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
layoutOverrideCoverage(false),
|
layoutOverrideCoverage(false),
|
||||||
geoPassthroughEXT(false),
|
geoPassthroughEXT(false),
|
||||||
numShaderRecordNVBlocks(0),
|
numShaderRecordNVBlocks(0),
|
||||||
computeDerivativeMode(LayoutDerivativeNone),
|
computeDerivativeMode(LayoutDerivativeNone),
|
||||||
primitives(TQualifier::layoutNotSet),
|
primitives(TQualifier::layoutNotSet),
|
||||||
numTaskNVBlocks(0),
|
numTaskNVBlocks(0),
|
||||||
#endif
|
|
||||||
autoMapBindings(false),
|
autoMapBindings(false),
|
||||||
autoMapLocations(false),
|
autoMapLocations(false),
|
||||||
invertY(false),
|
|
||||||
flattenUniformArrays(false),
|
flattenUniformArrays(false),
|
||||||
useUnknownFormat(false),
|
useUnknownFormat(false),
|
||||||
hlslOffsets(false),
|
hlslOffsets(false),
|
||||||
useStorageBuffer(false),
|
|
||||||
useVulkanMemoryModel(false),
|
|
||||||
hlslIoMapping(false),
|
hlslIoMapping(false),
|
||||||
useVariablePointers(false),
|
useVariablePointers(false),
|
||||||
textureSamplerTransformMode(EShTexSampTransKeep),
|
textureSamplerTransformMode(EShTexSampTransKeep),
|
||||||
needToLegalize(false),
|
needToLegalize(false),
|
||||||
binaryDoubleOutput(false),
|
binaryDoubleOutput(false),
|
||||||
usePhysicalStorageBuffer(false),
|
usePhysicalStorageBuffer(false),
|
||||||
uniformLocationBase(0),
|
uniformLocationBase(0)
|
||||||
nanMinMaxClamp(false)
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
localSize[0] = 1;
|
localSize[0] = 1;
|
||||||
localSize[1] = 1;
|
localSize[1] = 1;
|
||||||
localSize[2] = 1;
|
localSize[2] = 1;
|
||||||
|
|
@ -276,152 +275,9 @@ public:
|
||||||
localSizeSpecId[1] = TQualifier::layoutNotSet;
|
localSizeSpecId[1] = TQualifier::layoutNotSet;
|
||||||
localSizeSpecId[2] = TQualifier::layoutNotSet;
|
localSizeSpecId[2] = TQualifier::layoutNotSet;
|
||||||
xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
|
xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
|
||||||
|
|
||||||
shiftBinding.fill(0);
|
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; }
|
void setVersion(int v) { version = v; }
|
||||||
int getVersion() const { return version; }
|
int getVersion() const { return version; }
|
||||||
|
|
@ -485,9 +341,35 @@ public:
|
||||||
int getNumEntryPoints() const { return numEntryPoints; }
|
int getNumEntryPoints() const { return numEntryPoints; }
|
||||||
int getNumErrors() const { return numErrors; }
|
int getNumErrors() const { return numErrors; }
|
||||||
void addPushConstantCount() { ++numPushConstants; }
|
void addPushConstantCount() { ++numPushConstants; }
|
||||||
#ifdef NV_EXTENSIONS
|
void setLimits(const TBuiltInResource& r) { resources = r; }
|
||||||
void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; }
|
|
||||||
void addTaskNVCount() { ++numTaskNVBlocks; }
|
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
|
#endif
|
||||||
|
|
||||||
bool isRecursive() const { return recursive; }
|
bool isRecursive() const { return recursive; }
|
||||||
|
|
@ -566,6 +448,152 @@ public:
|
||||||
void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
|
void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
|
||||||
void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&);
|
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)
|
bool setInvocations(int i)
|
||||||
{
|
{
|
||||||
if (invocations != TQualifier::layoutNotSet)
|
if (invocations != TQualifier::layoutNotSet)
|
||||||
|
|
@ -635,7 +663,6 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
|
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
|
||||||
|
|
||||||
void setXfbMode() { xfbMode = true; }
|
void setXfbMode() { xfbMode = true; }
|
||||||
bool getXfbMode() const { return xfbMode; }
|
bool getXfbMode() const { return xfbMode; }
|
||||||
void setMultiStream() { multiStream = true; }
|
void setMultiStream() { multiStream = true; }
|
||||||
|
|
@ -648,14 +675,10 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; }
|
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; }
|
void setPostDepthCoverage() { postDepthCoverage = true; }
|
||||||
bool getPostDepthCoverage() const { return postDepthCoverage; }
|
bool getPostDepthCoverage() const { return postDepthCoverage; }
|
||||||
|
void setEarlyFragmentTests() { earlyFragmentTests = true; }
|
||||||
|
bool getEarlyFragmentTests() const { return earlyFragmentTests; }
|
||||||
bool setDepth(TLayoutDepth d)
|
bool setDepth(TLayoutDepth d)
|
||||||
{
|
{
|
||||||
if (depthLayout != EldNone)
|
if (depthLayout != EldNone)
|
||||||
|
|
@ -664,29 +687,12 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
TLayoutDepth getDepth() const { return depthLayout; }
|
TLayoutDepth getDepth() const { return depthLayout; }
|
||||||
void setDepthReplacing() { depthReplacing = true; }
|
void setOriginUpperLeft() { originUpperLeft = true; }
|
||||||
bool isDepthReplacing() const { return depthReplacing; }
|
bool getOriginUpperLeft() const { return originUpperLeft; }
|
||||||
|
void setPixelCenterInteger() { pixelCenterInteger = true; }
|
||||||
void setHlslFunctionality1() { hlslFunctionality1 = true; }
|
bool getPixelCenterInteger() const { return pixelCenterInteger; }
|
||||||
bool getHlslFunctionality1() const { return hlslFunctionality1; }
|
|
||||||
|
|
||||||
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
|
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
|
||||||
unsigned int getBlendEquations() const { return blendEquations; }
|
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)
|
bool setXfbBufferStride(int buffer, unsigned stride)
|
||||||
{
|
{
|
||||||
if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd)
|
if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd)
|
||||||
|
|
@ -696,28 +702,14 @@ public:
|
||||||
}
|
}
|
||||||
unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; }
|
unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; }
|
||||||
int addXfbBufferOffset(const TType&);
|
int addXfbBufferOffset(const TType&);
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const;
|
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const;
|
||||||
#else
|
|
||||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType) const;
|
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; }
|
void setLayoutOverrideCoverage() { layoutOverrideCoverage = true; }
|
||||||
bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; }
|
bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; }
|
||||||
void setGeoPassthroughEXT() { geoPassthroughEXT = true; }
|
void setGeoPassthroughEXT() { geoPassthroughEXT = true; }
|
||||||
bool getGeoPassthroughEXT() const { return geoPassthroughEXT; }
|
bool getGeoPassthroughEXT() const { return geoPassthroughEXT; }
|
||||||
void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; }
|
void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; }
|
||||||
|
bool hasLayoutDerivativeModeNone() const { return computeDerivativeMode != LayoutDerivativeNone; }
|
||||||
ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; }
|
ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; }
|
||||||
bool setPrimitives(int m)
|
bool setPrimitives(int m)
|
||||||
{
|
{
|
||||||
|
|
@ -727,28 +719,10 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int getPrimitives() const { return primitives; }
|
int getPrimitives() const { return primitives; }
|
||||||
#endif
|
|
||||||
|
|
||||||
const char* addSemanticName(const TString& name)
|
const char* addSemanticName(const TString& name)
|
||||||
{
|
{
|
||||||
return semanticNameSet.insert(name).first->c_str();
|
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)
|
void addUniformLocationOverride(const char* nameStr, int location)
|
||||||
{
|
{
|
||||||
std::string name = nameStr;
|
std::string name = nameStr;
|
||||||
|
|
@ -768,38 +742,100 @@ public:
|
||||||
void setUniformLocationBase(int base) { uniformLocationBase = base; }
|
void setUniformLocationBase(int base) { uniformLocationBase = base; }
|
||||||
int getUniformLocationBase() const { return uniformLocationBase; }
|
int getUniformLocationBase() const { return uniformLocationBase; }
|
||||||
|
|
||||||
void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
|
|
||||||
bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
|
|
||||||
|
|
||||||
void setNeedsLegalization() { needToLegalize = true; }
|
void setNeedsLegalization() { needToLegalize = true; }
|
||||||
bool needsLegalization() const { return needToLegalize; }
|
bool needsLegalization() const { return needToLegalize; }
|
||||||
|
|
||||||
void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
|
void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
|
||||||
bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
|
bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
|
||||||
|
#endif
|
||||||
|
|
||||||
const char* const implicitThisName;
|
#ifdef ENABLE_HLSL
|
||||||
const char* const implicitCounterName;
|
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
|
// 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 {
|
bool getArithemeticInt8Enabled() const {
|
||||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
|
||||||
}
|
}
|
||||||
bool getArithemeticInt16Enabled() const {
|
bool getArithemeticInt16Enabled() const {
|
||||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
extensionRequested(E_GL_AMD_gpu_shader_int16) ||
|
extensionRequested(E_GL_AMD_gpu_shader_int16) ||
|
||||||
#endif
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getArithemeticFloat16Enabled() const {
|
bool getArithemeticFloat16Enabled() const {
|
||||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
|
extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
|
||||||
#endif
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
|
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;
|
bool isConversionAllowed(TOperator op, TIntermTyped* node) const;
|
||||||
TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const;
|
TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const;
|
||||||
std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) 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();}
|
bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();}
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char* getResourceName(TResourceType);
|
static const char* getResourceName(TResourceType);
|
||||||
|
|
||||||
const EShLanguage language; // stage, known at construction time
|
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
|
EShSource source; // source language, known a bit later
|
||||||
|
#endif
|
||||||
std::string entryPointName;
|
std::string entryPointName;
|
||||||
std::string entryPointMangledName;
|
std::string entryPointMangledName;
|
||||||
typedef std::list<TCall> TGraph;
|
typedef std::list<TCall> TGraph;
|
||||||
|
|
@ -852,6 +904,12 @@ protected:
|
||||||
int numErrors;
|
int numErrors;
|
||||||
int numPushConstants;
|
int numPushConstants;
|
||||||
bool recursive;
|
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 invocations;
|
||||||
int vertices;
|
int vertices;
|
||||||
TLayoutGeometry inputPrimitive;
|
TLayoutGeometry inputPrimitive;
|
||||||
|
|
@ -867,21 +925,17 @@ protected:
|
||||||
bool earlyFragmentTests;
|
bool earlyFragmentTests;
|
||||||
bool postDepthCoverage;
|
bool postDepthCoverage;
|
||||||
TLayoutDepth depthLayout;
|
TLayoutDepth depthLayout;
|
||||||
bool depthReplacing;
|
|
||||||
bool hlslFunctionality1;
|
bool hlslFunctionality1;
|
||||||
int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift
|
int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift
|
||||||
bool xfbMode;
|
bool xfbMode;
|
||||||
std::vector<TXfbBuffer> xfbBuffers; // all the data we need to track per xfb buffer
|
std::vector<TXfbBuffer> xfbBuffers; // all the data we need to track per xfb buffer
|
||||||
bool multiStream;
|
bool multiStream;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
bool layoutOverrideCoverage;
|
bool layoutOverrideCoverage;
|
||||||
bool geoPassthroughEXT;
|
bool geoPassthroughEXT;
|
||||||
int numShaderRecordNVBlocks;
|
int numShaderRecordNVBlocks;
|
||||||
ComputeDerivativeMode computeDerivativeMode;
|
ComputeDerivativeMode computeDerivativeMode;
|
||||||
int primitives;
|
int primitives;
|
||||||
int numTaskNVBlocks;
|
int numTaskNVBlocks;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Base shift values
|
// Base shift values
|
||||||
std::array<unsigned int, EResCount> shiftBinding;
|
std::array<unsigned int, EResCount> shiftBinding;
|
||||||
|
|
@ -892,23 +946,29 @@ protected:
|
||||||
std::vector<std::string> resourceSetBinding;
|
std::vector<std::string> resourceSetBinding;
|
||||||
bool autoMapBindings;
|
bool autoMapBindings;
|
||||||
bool autoMapLocations;
|
bool autoMapLocations;
|
||||||
bool invertY;
|
|
||||||
bool flattenUniformArrays;
|
bool flattenUniformArrays;
|
||||||
bool useUnknownFormat;
|
bool useUnknownFormat;
|
||||||
bool hlslOffsets;
|
bool hlslOffsets;
|
||||||
bool useStorageBuffer;
|
|
||||||
bool useVulkanMemoryModel;
|
|
||||||
bool hlslIoMapping;
|
bool hlslIoMapping;
|
||||||
bool useVariablePointers;
|
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;
|
std::set<TString> semanticNameSet;
|
||||||
|
|
||||||
EShTextureSamplerTransformMode textureSamplerTransformMode;
|
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
|
// source code of shader, useful as part of debug information
|
||||||
std::string sourceFile;
|
std::string sourceFile;
|
||||||
std::string sourceText;
|
std::string sourceText;
|
||||||
|
|
@ -919,14 +979,6 @@ protected:
|
||||||
// for OpModuleProcessed, or equivalent
|
// for OpModuleProcessed, or equivalent
|
||||||
TProcesses processes;
|
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:
|
private:
|
||||||
void operator=(TIntermediate&); // prevent assignments
|
void operator=(TIntermediate&); // prevent assignments
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -57,26 +57,91 @@ public:
|
||||||
TParseVersions(TIntermediate& interm, int version, EProfile profile,
|
TParseVersions(TIntermediate& interm, int version, EProfile profile,
|
||||||
const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink,
|
const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink,
|
||||||
bool forwardCompatible, EShMessages messages)
|
bool forwardCompatible, EShMessages messages)
|
||||||
: infoSink(infoSink), version(version), profile(profile), language(language),
|
:
|
||||||
spvVersion(spvVersion), forwardCompatible(forwardCompatible),
|
#ifndef GLSLANG_WEB
|
||||||
intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { }
|
forwardCompatible(forwardCompatible),
|
||||||
|
profile(profile),
|
||||||
|
#endif
|
||||||
|
infoSink(infoSink), version(version),
|
||||||
|
language(language),
|
||||||
|
spvVersion(spvVersion),
|
||||||
|
intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { }
|
||||||
virtual ~TParseVersions() { }
|
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 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 checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc);
|
||||||
virtual void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, 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[],
|
||||||
virtual void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc);
|
const char* featureDesc);
|
||||||
virtual void ppRequireExtensions(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 TExtensionBehavior getExtensionBehavior(const char*);
|
||||||
virtual bool extensionTurnedOn(const char* const extension);
|
virtual bool extensionTurnedOn(const char* const extension);
|
||||||
virtual bool extensionsTurnedOn(int numExtensions, const char* const extensions[]);
|
virtual bool extensionsTurnedOn(int numExtensions, const char* const extensions[]);
|
||||||
virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior);
|
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 fullIntegerCheck(const TSourceLoc&, const char* op);
|
||||||
|
|
||||||
|
virtual void unimplemented(const TSourceLoc&, const char* featureDesc);
|
||||||
virtual void doubleCheck(const TSourceLoc&, const char* op);
|
virtual void doubleCheck(const TSourceLoc&, const char* op);
|
||||||
virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||||
virtual void float16ScalarVectorCheck(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 void int8ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||||
virtual bool int8Arithmetic();
|
virtual bool int8Arithmetic();
|
||||||
virtual void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc);
|
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);
|
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 int64Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||||
virtual void explicitInt8Check(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 explicitInt16Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||||
virtual void explicitInt32Check(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 explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||||
virtual void explicitFloat64Check(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 spvRemoved(const TSourceLoc&, const char* op);
|
||||||
virtual void vulkanRemoved(const TSourceLoc&, const char* op);
|
virtual void vulkanRemoved(const TSourceLoc&, const char* op);
|
||||||
virtual void requireVulkan(const TSourceLoc&, const char* op);
|
virtual void requireVulkan(const TSourceLoc&, const char* op);
|
||||||
virtual void requireSpv(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,
|
virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||||
const char* szExtraInfoFormat, ...) = 0;
|
const char* szExtraInfoFormat, ...) = 0;
|
||||||
virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken,
|
virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||||
|
|
@ -114,6 +189,7 @@ public:
|
||||||
const char* szExtraInfoFormat, ...) = 0;
|
const char* szExtraInfoFormat, ...) = 0;
|
||||||
virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||||
const char* szExtraInfoFormat, ...) = 0;
|
const char* szExtraInfoFormat, ...) = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
void addError() { ++numErrors; }
|
void addError() { ++numErrors; }
|
||||||
int getNumErrors() const { return numErrors; }
|
int getNumErrors() const { return numErrors; }
|
||||||
|
|
@ -127,20 +203,20 @@ public:
|
||||||
void setCurrentString(int string) { currentScanner->setString(string); }
|
void setCurrentString(int string) { currentScanner->setString(string); }
|
||||||
|
|
||||||
void getPreamble(std::string&);
|
void getPreamble(std::string&);
|
||||||
bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; }
|
#ifdef ENABLE_HLSL
|
||||||
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
|
|
||||||
bool isReadingHLSL() const { return (messages & EShMsgReadHlsl) == EShMsgReadHlsl; }
|
bool isReadingHLSL() const { return (messages & EShMsgReadHlsl) == EShMsgReadHlsl; }
|
||||||
bool hlslEnable16BitTypes() const { return (messages & EShMsgHlslEnable16BitTypes) != 0; }
|
bool hlslEnable16BitTypes() const { return (messages & EShMsgHlslEnable16BitTypes) != 0; }
|
||||||
bool hlslDX9Compatible() const { return (messages & EShMsgHlslDX9Compatible) != 0; }
|
bool hlslDX9Compatible() const { return (messages & EShMsgHlslDX9Compatible) != 0; }
|
||||||
|
#else
|
||||||
|
bool isReadingHLSL() const { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
TInfoSink& infoSink;
|
TInfoSink& infoSink;
|
||||||
|
|
||||||
// compilation mode
|
// compilation mode
|
||||||
int version; // version, updated by #version in the shader
|
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
|
EShLanguage language; // really the stage
|
||||||
SpvVersion spvVersion;
|
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
|
TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -545,7 +545,7 @@ int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, T
|
||||||
case MacroExpandStarted:
|
case MacroExpandStarted:
|
||||||
break;
|
break;
|
||||||
case MacroExpandUndef:
|
case MacroExpandUndef:
|
||||||
if (! shortCircuit && parseContext.profile == EEsProfile) {
|
if (! shortCircuit && parseContext.isEsProfile()) {
|
||||||
const char* message = "undefined macro in expression not allowed in es profile";
|
const char* message = "undefined macro in expression not allowed in es profile";
|
||||||
if (parseContext.relaxedErrors())
|
if (parseContext.relaxedErrors())
|
||||||
parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name);
|
parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name);
|
||||||
|
|
@ -722,6 +722,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
|
||||||
parseContext.setCurrentLine(lineRes);
|
parseContext.setCurrentLine(lineRes);
|
||||||
|
|
||||||
if (token != '\n') {
|
if (token != '\n') {
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (token == PpAtomConstString) {
|
if (token == PpAtomConstString) {
|
||||||
parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line");
|
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
|
// We need to save a copy of the string instead of pointing
|
||||||
|
|
@ -731,7 +732,9 @@ int TPpContext::CPPline(TPpToken* ppToken)
|
||||||
parseContext.setCurrentSourceName(sourceName);
|
parseContext.setCurrentSourceName(sourceName);
|
||||||
hasFile = true;
|
hasFile = true;
|
||||||
token = scanToken(ppToken);
|
token = scanToken(ppToken);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken);
|
token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken);
|
||||||
if (! fileErr) {
|
if (! fileErr) {
|
||||||
parseContext.setCurrentString(fileRes);
|
parseContext.setCurrentString(fileRes);
|
||||||
|
|
@ -792,10 +795,8 @@ int TPpContext::CPPpragma(TPpToken* ppToken)
|
||||||
case PpAtomConstUint:
|
case PpAtomConstUint:
|
||||||
case PpAtomConstInt64:
|
case PpAtomConstInt64:
|
||||||
case PpAtomConstUint64:
|
case PpAtomConstUint64:
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case PpAtomConstInt16:
|
case PpAtomConstInt16:
|
||||||
case PpAtomConstUint16:
|
case PpAtomConstUint16:
|
||||||
#endif
|
|
||||||
case PpAtomConstFloat:
|
case PpAtomConstFloat:
|
||||||
case PpAtomConstDouble:
|
case PpAtomConstDouble:
|
||||||
case PpAtomConstFloat16:
|
case PpAtomConstFloat16:
|
||||||
|
|
@ -954,18 +955,20 @@ int TPpContext::readCPPline(TPpToken* ppToken)
|
||||||
case PpAtomIfndef:
|
case PpAtomIfndef:
|
||||||
token = CPPifdef(0, ppToken);
|
token = CPPifdef(0, ppToken);
|
||||||
break;
|
break;
|
||||||
|
case PpAtomLine:
|
||||||
|
token = CPPline(ppToken);
|
||||||
|
break;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
case PpAtomInclude:
|
case PpAtomInclude:
|
||||||
if(!parseContext.isReadingHLSL()) {
|
if(!parseContext.isReadingHLSL()) {
|
||||||
parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include");
|
parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include");
|
||||||
}
|
}
|
||||||
token = CPPinclude(ppToken);
|
token = CPPinclude(ppToken);
|
||||||
break;
|
break;
|
||||||
case PpAtomLine:
|
|
||||||
token = CPPline(ppToken);
|
|
||||||
break;
|
|
||||||
case PpAtomPragma:
|
case PpAtomPragma:
|
||||||
token = CPPpragma(ppToken);
|
token = CPPpragma(ppToken);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case PpAtomUndef:
|
case PpAtomUndef:
|
||||||
token = CPPundef(ppToken);
|
token = CPPundef(ppToken);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||||
ch = getChar();
|
ch = getChar();
|
||||||
int firstDecimal = len;
|
int firstDecimal = len;
|
||||||
|
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
// 1.#INF or -1.#INF
|
// 1.#INF or -1.#INF
|
||||||
if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
|
if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
|
||||||
if ((len < 2) ||
|
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
|
// Consume leading-zero digits after the decimal point
|
||||||
while (ch == '0') {
|
while (ch == '0') {
|
||||||
|
|
@ -257,6 +259,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||||
// Suffix:
|
// Suffix:
|
||||||
bool isDouble = false;
|
bool isDouble = false;
|
||||||
bool isFloat16 = false;
|
bool isFloat16 = false;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (ch == 'l' || ch == 'L') {
|
if (ch == 'l' || ch == 'L') {
|
||||||
if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl)
|
if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl)
|
||||||
parseContext.doubleCheck(ppToken->loc, "double floating-point suffix");
|
parseContext.doubleCheck(ppToken->loc, "double floating-point suffix");
|
||||||
|
|
@ -295,11 +298,15 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||||
saveName(ch);
|
saveName(ch);
|
||||||
isFloat16 = true;
|
isFloat16 = true;
|
||||||
}
|
}
|
||||||
} else if (ch == 'f' || ch == 'F') {
|
} else
|
||||||
|
#endif
|
||||||
|
if (ch == 'f' || ch == 'F') {
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
if (ifdepth == 0)
|
if (ifdepth == 0)
|
||||||
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
|
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
|
||||||
if (ifdepth == 0 && !parseContext.relaxedErrors())
|
if (ifdepth == 0 && !parseContext.relaxedErrors())
|
||||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
|
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
|
||||||
|
#endif
|
||||||
if (ifdepth == 0 && !hasDecimalOrExponent)
|
if (ifdepth == 0 && !hasDecimalOrExponent)
|
||||||
parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||||
saveName(ch);
|
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 int Num_Int64_Extensions = sizeof(Int64_Extensions) / sizeof(Int64_Extensions[0]);
|
||||||
|
|
||||||
static const char* const Int16_Extensions[] = {
|
static const char* const Int16_Extensions[] = {
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
E_GL_AMD_gpu_shader_int16,
|
E_GL_AMD_gpu_shader_int16,
|
||||||
#endif
|
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types,
|
E_GL_EXT_shader_explicit_arithmetic_types,
|
||||||
E_GL_EXT_shader_explicit_arithmetic_types_int16 };
|
E_GL_EXT_shader_explicit_arithmetic_types_int16 };
|
||||||
static const int Num_Int16_Extensions = sizeof(Int16_Extensions) / sizeof(Int16_Extensions[0]);
|
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;
|
ppToken->name[len++] = (char)ch;
|
||||||
isUnsigned = true;
|
isUnsigned = true;
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
int nextCh = getch();
|
int nextCh = getch();
|
||||||
if (nextCh == 'l' || nextCh == 'L') {
|
if (nextCh == 'l' || nextCh == 'L') {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
|
|
@ -587,7 +593,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||||
} else
|
} else
|
||||||
ungetch();
|
ungetch();
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
nextCh = getch();
|
nextCh = getch();
|
||||||
if ((nextCh == 's' || nextCh == 'S') &&
|
if ((nextCh == 's' || nextCh == 'S') &&
|
||||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||||
|
|
@ -596,12 +601,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||||
isInt16 = true;
|
isInt16 = true;
|
||||||
} else
|
} else
|
||||||
ungetch();
|
ungetch();
|
||||||
#endif
|
|
||||||
} else if (ch == 'l' || ch == 'L') {
|
} else if (ch == 'l' || ch == 'L') {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
ppToken->name[len++] = (char)ch;
|
ppToken->name[len++] = (char)ch;
|
||||||
isInt64 = true;
|
isInt64 = true;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
} else if ((ch == 's' || ch == 'S') &&
|
} else if ((ch == 's' || ch == 'S') &&
|
||||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
|
|
@ -689,6 +692,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||||
ppToken->name[len++] = (char)ch;
|
ppToken->name[len++] = (char)ch;
|
||||||
isUnsigned = true;
|
isUnsigned = true;
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
int nextCh = getch();
|
int nextCh = getch();
|
||||||
if (nextCh == 'l' || nextCh == 'L') {
|
if (nextCh == 'l' || nextCh == 'L') {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
|
|
@ -697,7 +701,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||||
} else
|
} else
|
||||||
ungetch();
|
ungetch();
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
nextCh = getch();
|
nextCh = getch();
|
||||||
if ((nextCh == 's' || nextCh == 'S') &&
|
if ((nextCh == 's' || nextCh == 'S') &&
|
||||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||||
|
|
@ -706,12 +709,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||||
isInt16 = true;
|
isInt16 = true;
|
||||||
} else
|
} else
|
||||||
ungetch();
|
ungetch();
|
||||||
#endif
|
|
||||||
} else if (ch == 'l' || ch == 'L') {
|
} else if (ch == 'l' || ch == 'L') {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
ppToken->name[len++] = (char)ch;
|
ppToken->name[len++] = (char)ch;
|
||||||
isInt64 = true;
|
isInt64 = true;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
} else if ((ch == 's' || ch == 'S') &&
|
} else if ((ch == 's' || ch == 'S') &&
|
||||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
|
|
@ -780,6 +781,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||||
ppToken->name[len++] = (char)ch;
|
ppToken->name[len++] = (char)ch;
|
||||||
isUnsigned = true;
|
isUnsigned = true;
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
int nextCh = getch();
|
int nextCh = getch();
|
||||||
if (nextCh == 'l' || nextCh == 'L') {
|
if (nextCh == 'l' || nextCh == 'L') {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
|
|
@ -788,7 +790,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||||
} else
|
} else
|
||||||
ungetch();
|
ungetch();
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
nextCh = getch();
|
nextCh = getch();
|
||||||
if ((nextCh == 's' || nextCh == 'S') &&
|
if ((nextCh == 's' || nextCh == 'S') &&
|
||||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||||
|
|
@ -797,12 +798,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||||
isInt16 = true;
|
isInt16 = true;
|
||||||
} else
|
} else
|
||||||
ungetch();
|
ungetch();
|
||||||
#endif
|
|
||||||
} else if (ch == 'l' || ch == 'L') {
|
} else if (ch == 'l' || ch == 'L') {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
ppToken->name[len++] = (char)ch;
|
ppToken->name[len++] = (char)ch;
|
||||||
isInt64 = true;
|
isInt64 = true;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
} else if ((ch == 's' || ch == 'S') &&
|
} else if ((ch == 's' || ch == 'S') &&
|
||||||
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||||
if (len < MaxTokenLength)
|
if (len < MaxTokenLength)
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
|
||||||
int atom = stream[currentPos++].get(*ppToken);
|
int atom = stream[currentPos++].get(*ppToken);
|
||||||
ppToken->loc = parseContext.getCurrentLoc();
|
ppToken->loc = parseContext.getCurrentLoc();
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
// Check for ##, unless the current # is the last character
|
// Check for ##, unless the current # is the last character
|
||||||
if (atom == '#') {
|
if (atom == '#') {
|
||||||
if (peekToken('#')) {
|
if (peekToken('#')) {
|
||||||
|
|
@ -125,6 +126,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
|
||||||
atom = PpAtomPaste;
|
atom = PpAtomPaste;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return atom;
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@
|
||||||
// propagate the 'noContraction' qualifier.
|
// propagate the 'noContraction' qualifier.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
#include "propagateNoContraction.h"
|
#include "propagateNoContraction.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
@ -79,7 +81,7 @@ typedef std::unordered_set<glslang::TIntermBranch*> ReturnBranchNodeSet;
|
||||||
// the node has 'noContraction' qualifier, otherwise false.
|
// the node has 'noContraction' qualifier, otherwise false.
|
||||||
bool isPreciseObjectNode(glslang::TIntermTyped* node)
|
bool isPreciseObjectNode(glslang::TIntermTyped* node)
|
||||||
{
|
{
|
||||||
return node->getType().getQualifier().noContraction;
|
return node->getType().getQualifier().isNoContraction();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the opcode is a dereferencing one.
|
// 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.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
#include "../Include/Common.h"
|
#include "../Include/Common.h"
|
||||||
#include "reflection.h"
|
#include "reflection.h"
|
||||||
#include "LiveTraverser.h"
|
#include "LiveTraverser.h"
|
||||||
|
|
@ -396,7 +398,7 @@ public:
|
||||||
topLevelArrayStride = variables.back().arrayStride;
|
topLevelArrayStride = variables.back().arrayStride;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->getBasicType() == EbtAtomicUint)
|
if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->isAtomic())
|
||||||
reflection.atomicCounterUniformIndices.push_back(uniformIndex);
|
reflection.atomicCounterUniformIndices.push_back(uniformIndex);
|
||||||
|
|
||||||
variables.back().topLevelArrayStride = topLevelArrayStride;
|
variables.back().topLevelArrayStride = topLevelArrayStride;
|
||||||
|
|
@ -701,7 +703,6 @@ public:
|
||||||
case EsdBuffer:
|
case EsdBuffer:
|
||||||
return GL_SAMPLER_BUFFER;
|
return GL_SAMPLER_BUFFER;
|
||||||
}
|
}
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
switch ((int)sampler.dim) {
|
switch ((int)sampler.dim) {
|
||||||
case Esd1D:
|
case Esd1D:
|
||||||
|
|
@ -730,7 +731,6 @@ public:
|
||||||
case EsdBuffer:
|
case EsdBuffer:
|
||||||
return GL_FLOAT16_SAMPLER_BUFFER_AMD;
|
return GL_FLOAT16_SAMPLER_BUFFER_AMD;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
switch ((int)sampler.dim) {
|
switch ((int)sampler.dim) {
|
||||||
case Esd1D:
|
case Esd1D:
|
||||||
|
|
@ -793,7 +793,6 @@ public:
|
||||||
case EsdBuffer:
|
case EsdBuffer:
|
||||||
return GL_IMAGE_BUFFER;
|
return GL_IMAGE_BUFFER;
|
||||||
}
|
}
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
switch ((int)sampler.dim) {
|
switch ((int)sampler.dim) {
|
||||||
case Esd1D:
|
case Esd1D:
|
||||||
|
|
@ -812,7 +811,6 @@ public:
|
||||||
case EsdBuffer:
|
case EsdBuffer:
|
||||||
return GL_FLOAT16_IMAGE_BUFFER_AMD;
|
return GL_FLOAT16_IMAGE_BUFFER_AMD;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
switch ((int)sampler.dim) {
|
switch ((int)sampler.dim) {
|
||||||
case Esd1D:
|
case Esd1D:
|
||||||
|
|
@ -878,9 +876,7 @@ public:
|
||||||
switch (type.getBasicType()) {
|
switch (type.getBasicType()) {
|
||||||
case EbtFloat: return GL_FLOAT_VEC2 + offset;
|
case EbtFloat: return GL_FLOAT_VEC2 + offset;
|
||||||
case EbtDouble: return GL_DOUBLE_VEC2 + offset;
|
case EbtDouble: return GL_DOUBLE_VEC2 + offset;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtFloat16: return GL_FLOAT16_VEC2_NV + offset;
|
case EbtFloat16: return GL_FLOAT16_VEC2_NV + offset;
|
||||||
#endif
|
|
||||||
case EbtInt: return GL_INT_VEC2 + offset;
|
case EbtInt: return GL_INT_VEC2 + offset;
|
||||||
case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset;
|
case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset;
|
||||||
case EbtInt64: return GL_INT64_ARB + offset;
|
case EbtInt64: return GL_INT64_ARB + offset;
|
||||||
|
|
@ -940,7 +936,6 @@ public:
|
||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
switch (type.getMatrixCols()) {
|
switch (type.getMatrixCols()) {
|
||||||
case 2:
|
case 2:
|
||||||
|
|
@ -965,7 +960,6 @@ public:
|
||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -974,9 +968,7 @@ public:
|
||||||
switch (type.getBasicType()) {
|
switch (type.getBasicType()) {
|
||||||
case EbtFloat: return GL_FLOAT;
|
case EbtFloat: return GL_FLOAT;
|
||||||
case EbtDouble: return GL_DOUBLE;
|
case EbtDouble: return GL_DOUBLE;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
case EbtFloat16: return GL_FLOAT16_NV;
|
case EbtFloat16: return GL_FLOAT16_NV;
|
||||||
#endif
|
|
||||||
case EbtInt: return GL_INT;
|
case EbtInt: return GL_INT;
|
||||||
case EbtUint: return GL_UNSIGNED_INT;
|
case EbtUint: return GL_UNSIGNED_INT;
|
||||||
case EbtInt64: return GL_INT64_ARB;
|
case EbtInt64: return GL_INT64_ARB;
|
||||||
|
|
@ -1093,6 +1085,7 @@ void TReflection::buildAttributeReflection(EShLanguage stage, const TIntermediat
|
||||||
// build counter block index associations for buffers
|
// build counter block index associations for buffers
|
||||||
void TReflection::buildCounterIndices(const TIntermediate& intermediate)
|
void TReflection::buildCounterIndices(const TIntermediate& intermediate)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
// search for ones that have counters
|
// search for ones that have counters
|
||||||
for (int i = 0; i < int(indexToUniformBlock.size()); ++i) {
|
for (int i = 0; i < int(indexToUniformBlock.size()); ++i) {
|
||||||
const TString counterName(intermediate.addCounterBufferName(indexToUniformBlock[i].name).c_str());
|
const TString counterName(intermediate.addCounterBufferName(indexToUniformBlock[i].name).c_str());
|
||||||
|
|
@ -1101,6 +1094,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
indexToUniformBlock[i].counterIndex = index;
|
indexToUniformBlock[i].counterIndex = index;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// build Shader Stages mask for all uniforms
|
// build Shader Stages mask for all uniforms
|
||||||
|
|
@ -1198,3 +1192,5 @@ void TReflection::dump()
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
#ifndef _REFLECTION_INCLUDED
|
#ifndef _REFLECTION_INCLUDED
|
||||||
#define _REFLECTION_INCLUDED
|
#define _REFLECTION_INCLUDED
|
||||||
|
|
||||||
|
|
@ -201,3 +203,5 @@ protected:
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
||||||
#endif // _REFLECTION_INCLUDED
|
#endif // _REFLECTION_INCLUDED
|
||||||
|
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
|
|
@ -432,8 +432,10 @@ public:
|
||||||
void addUniformLocationOverride(const char* name, int loc);
|
void addUniformLocationOverride(const char* name, int loc);
|
||||||
void setUniformLocationBase(int base);
|
void setUniformLocationBase(int base);
|
||||||
void setInvertY(bool invert);
|
void setInvertY(bool invert);
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
void setHlslIoMapping(bool hlslIoMap);
|
void setHlslIoMapping(bool hlslIoMap);
|
||||||
void setFlattenUniformArrays(bool flatten);
|
void setFlattenUniformArrays(bool flatten);
|
||||||
|
#endif
|
||||||
void setNoStorageFormat(bool useUnknownFormat);
|
void setNoStorageFormat(bool useUnknownFormat);
|
||||||
void setNanMinMaxClamp(bool nanMinMaxClamp);
|
void setNanMinMaxClamp(bool nanMinMaxClamp);
|
||||||
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode);
|
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode);
|
||||||
|
|
@ -459,8 +461,12 @@ public:
|
||||||
environment.target.language = lang;
|
environment.target.language = lang;
|
||||||
environment.target.version = version;
|
environment.target.version = version;
|
||||||
}
|
}
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
|
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
|
||||||
bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
|
bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
|
||||||
|
#else
|
||||||
|
bool getEnvTargetHlslFunctionality1() const { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
// Interface to #include handlers.
|
// Interface to #include handlers.
|
||||||
//
|
//
|
||||||
|
|
@ -611,6 +617,8 @@ private:
|
||||||
TShader& operator=(TShader&);
|
TShader& operator=(TShader&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
//
|
//
|
||||||
// A reflection database and its interface, consistent with the OpenGL API reflection queries.
|
// A reflection database and its interface, consistent with the OpenGL API reflection queries.
|
||||||
//
|
//
|
||||||
|
|
@ -726,6 +734,8 @@ public:
|
||||||
virtual void addStage(EShLanguage stage) = 0;
|
virtual void addStage(EShLanguage stage) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // GLSLANG_WEB
|
||||||
|
|
||||||
// Make one TProgram per set of shaders that will get linked together. Add all
|
// 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()
|
// the shaders that are to be linked together. After calling shader.parse()
|
||||||
// for all shaders, call link().
|
// for all shaders, call link().
|
||||||
|
|
@ -745,14 +755,14 @@ public:
|
||||||
|
|
||||||
TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
|
TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
|
||||||
|
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
|
||||||
// Reflection Interface
|
// Reflection Interface
|
||||||
|
|
||||||
// call first, to do liveness analysis, index mapping, etc.; returns false on failure
|
// call first, to do liveness analysis, index mapping, etc.; returns false on failure
|
||||||
bool buildReflection(int opts = EShReflectionDefault);
|
bool buildReflection(int opts = EShReflectionDefault);
|
||||||
|
|
||||||
unsigned getLocalSize(int dim) const; // return dim'th local size
|
unsigned getLocalSize(int dim) const; // return dim'th local size
|
||||||
int getReflectionIndex(const char *name) const;
|
int getReflectionIndex(const char *name) const;
|
||||||
|
|
||||||
int getNumUniformVariables() const;
|
int getNumUniformVariables() const;
|
||||||
const TObjectReflection& getUniform(int index) const;
|
const TObjectReflection& getUniform(int index) const;
|
||||||
int getNumUniformBlocks() const;
|
int getNumUniformBlocks() const;
|
||||||
|
|
@ -831,11 +841,11 @@ public:
|
||||||
const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); }
|
const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); }
|
||||||
|
|
||||||
void dumpReflection();
|
void dumpReflection();
|
||||||
|
|
||||||
// I/O mapping: apply base offsets and map live unbound variables
|
// I/O mapping: apply base offsets and map live unbound variables
|
||||||
// If resolver is not provided it uses the previous approach
|
// If resolver is not provided it uses the previous approach
|
||||||
// and respects auto assignment and offsets.
|
// and respects auto assignment and offsets.
|
||||||
bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr);
|
bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool linkStage(EShLanguage, EShMessages);
|
bool linkStage(EShLanguage, EShMessages);
|
||||||
|
|
@ -845,7 +855,9 @@ protected:
|
||||||
TIntermediate* intermediate[EShLangCount];
|
TIntermediate* intermediate[EShLangCount];
|
||||||
bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage
|
bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage
|
||||||
TInfoSink* infoSink;
|
TInfoSink* infoSink;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
TReflection* reflection;
|
TReflection* reflection;
|
||||||
|
#endif
|
||||||
bool linked;
|
bool linked;
|
||||||
|
|
||||||
private:
|
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
|
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>>;
|
using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
using CompileToAstTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileToAstTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_P(CompileToAstTest, FromFile)
|
TEST_P(CompileToAstTest, FromFile)
|
||||||
{
|
{
|
||||||
|
|
@ -52,7 +50,6 @@ TEST_P(CompileToAstTest, FromFile)
|
||||||
Target::AST);
|
Target::AST);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
// Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled).
|
// Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled).
|
||||||
TEST_P(CompileToAstTestNV, FromFile)
|
TEST_P(CompileToAstTestNV, FromFile)
|
||||||
{
|
{
|
||||||
|
|
@ -60,7 +57,6 @@ TEST_P(CompileToAstTestNV, FromFile)
|
||||||
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||||
Target::AST);
|
Target::AST);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
|
|
@ -281,7 +277,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
Glsl, CompileToAstTestNV,
|
Glsl, CompileToAstTestNV,
|
||||||
::testing::ValuesIn(std::vector<std::string>({
|
::testing::ValuesIn(std::vector<std::string>({
|
||||||
|
|
@ -289,7 +284,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||||
})),
|
})),
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
|
||||||
|
|
@ -72,12 +72,8 @@ using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
||||||
using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
#endif
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
#endif
|
|
||||||
using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
|
|
||||||
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
|
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
|
||||||
|
|
@ -179,7 +175,6 @@ TEST_P(GlslIoMap, FromFile)
|
||||||
GetParam().flattenUniforms);
|
GetParam().flattenUniforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
// Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
|
// Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
|
||||||
// Expected to successfully generate SPIR-V.
|
// Expected to successfully generate SPIR-V.
|
||||||
TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
|
TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
|
||||||
|
|
@ -188,9 +183,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
|
||||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||||
Target::Spv);
|
Target::Spv);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
// Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
|
// Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
|
||||||
// Expected to successfully generate SPIR-V.
|
// Expected to successfully generate SPIR-V.
|
||||||
TEST_P(CompileVulkanToSpirvTestNV, FromFile)
|
TEST_P(CompileVulkanToSpirvTestNV, FromFile)
|
||||||
|
|
@ -199,7 +192,6 @@ TEST_P(CompileVulkanToSpirvTestNV, FromFile)
|
||||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||||
Target::Spv);
|
Target::Spv);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
|
TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
|
||||||
{
|
{
|
||||||
|
|
@ -572,7 +564,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
Glsl, CompileVulkanToSpirvTestAMD,
|
Glsl, CompileVulkanToSpirvTestAMD,
|
||||||
::testing::ValuesIn(std::vector<std::string>({
|
::testing::ValuesIn(std::vector<std::string>({
|
||||||
|
|
@ -588,9 +579,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||||
})),
|
})),
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
Glsl, CompileVulkanToSpirvTestNV,
|
Glsl, CompileVulkanToSpirvTestNV,
|
||||||
::testing::ValuesIn(std::vector<std::string>({
|
::testing::ValuesIn(std::vector<std::string>({
|
||||||
|
|
@ -638,7 +627,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||||
})),
|
})),
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
|
Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ EShLanguage GetShaderStage(const std::string& stage)
|
||||||
return EShLangFragment;
|
return EShLangFragment;
|
||||||
} else if (stage == "comp") {
|
} else if (stage == "comp") {
|
||||||
return EShLangCompute;
|
return EShLangCompute;
|
||||||
#ifdef NV_EXTENSIONS
|
|
||||||
} else if (stage == "rgen") {
|
} else if (stage == "rgen") {
|
||||||
return EShLangRayGenNV;
|
return EShLangRayGenNV;
|
||||||
} else if (stage == "rint") {
|
} else if (stage == "rint") {
|
||||||
|
|
@ -77,7 +76,6 @@ EShLanguage GetShaderStage(const std::string& stage)
|
||||||
return EShLangTaskNV;
|
return EShLangTaskNV;
|
||||||
} else if (stage == "mesh") {
|
} else if (stage == "mesh") {
|
||||||
return EShLangMeshNV;
|
return EShLangMeshNV;
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
assert(0 && "Unknown shader stage");
|
assert(0 && "Unknown shader stage");
|
||||||
return EShLangCount;
|
return EShLangCount;
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,9 @@ public:
|
||||||
shader.setAutoMapBindings(true);
|
shader.setAutoMapBindings(true);
|
||||||
}
|
}
|
||||||
shader.setTextureSamplerTransformMode(texSampTransMode);
|
shader.setTextureSamplerTransformMode(texSampTransMode);
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
shader.setFlattenUniformArrays(flattenUniformArrays);
|
shader.setFlattenUniformArrays(flattenUniformArrays);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (controls & EShMsgSpvRules) {
|
if (controls & EShMsgSpvRules) {
|
||||||
if (controls & EShMsgVulkanRules) {
|
if (controls & EShMsgVulkanRules) {
|
||||||
|
|
@ -300,7 +302,9 @@ public:
|
||||||
shader.setShiftSsboBinding(baseSsboBinding);
|
shader.setShiftSsboBinding(baseSsboBinding);
|
||||||
shader.setAutoMapBindings(autoMapBindings);
|
shader.setAutoMapBindings(autoMapBindings);
|
||||||
shader.setAutoMapLocations(true);
|
shader.setAutoMapLocations(true);
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
shader.setFlattenUniformArrays(flattenUniformArrays);
|
shader.setFlattenUniformArrays(flattenUniformArrays);
|
||||||
|
#endif
|
||||||
|
|
||||||
bool success = compile(&shader, code, entryPointName, controls);
|
bool success = compile(&shader, code, entryPointName, controls);
|
||||||
|
|
||||||
|
|
@ -308,7 +312,9 @@ public:
|
||||||
program.addShader(&shader);
|
program.addShader(&shader);
|
||||||
|
|
||||||
success &= program.link(controls);
|
success &= program.link(controls);
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
success &= program.mapIO();
|
success &= program.mapIO();
|
||||||
|
#endif
|
||||||
|
|
||||||
spv::SpvBuildLogger logger;
|
spv::SpvBuildLogger logger;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8703,25 +8703,19 @@ void HlslParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
|
||||||
for (unsigned int member = 0; member < typeList.size(); ++member) {
|
for (unsigned int member = 0; member < typeList.size(); ++member) {
|
||||||
TQualifier& memberQualifier = typeList[member].type->getQualifier();
|
TQualifier& memberQualifier = typeList[member].type->getQualifier();
|
||||||
bool contains64BitType = false;
|
bool contains64BitType = false;
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
bool contains32BitType = false;
|
bool contains32BitType = false;
|
||||||
bool contains16BitType = false;
|
bool contains16BitType = false;
|
||||||
int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType, contains32BitType, contains16BitType);
|
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
|
// see if we need to auto-assign an offset to this member
|
||||||
if (! memberQualifier.hasXfbOffset()) {
|
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 applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8"
|
||||||
if (contains64BitType)
|
if (contains64BitType)
|
||||||
RoundToPow2(nextOffset, 8);
|
RoundToPow2(nextOffset, 8);
|
||||||
#ifdef AMD_EXTENSIONS
|
|
||||||
else if (contains32BitType)
|
else if (contains32BitType)
|
||||||
RoundToPow2(nextOffset, 4);
|
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"
|
// "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)
|
else if (contains16BitType)
|
||||||
RoundToPow2(nextOffset, 2);
|
RoundToPow2(nextOffset, 2);
|
||||||
#endif
|
|
||||||
memberQualifier.layoutXfbOffset = nextOffset;
|
memberQualifier.layoutXfbOffset = nextOffset;
|
||||||
} else
|
} else
|
||||||
nextOffset = memberQualifier.layoutXfbOffset;
|
nextOffset = memberQualifier.layoutXfbOffset;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue