Remove GLSLANG_WEB and GLSLANG_WEB_DEVEL

This CL removes the GLSLANG_WEB and GLSLANG_WEB_DEVEL
cmake build options and their usage in the codebase.

Issue #2958
This commit is contained in:
dan sinclair 2023-07-28 13:49:10 -04:00 committed by GitHub
parent c8c669fc2a
commit d291b15911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 49 additions and 1540 deletions

View File

@ -69,14 +69,6 @@ option(ENABLE_GLSLANG_BINARIES "Builds glslang and spirv-remap" ON)
option(ENABLE_GLSLANG_JS option(ENABLE_GLSLANG_JS
"If using Emscripten, build glslang.js. Otherwise, builds a sample executable for binary-size testing." OFF) "If using Emscripten, build glslang.js. Otherwise, builds a sample executable for binary-size testing." OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_GLSLANG_WEBMIN
"Reduces glslang to minimum needed for web use"
OFF "ENABLE_GLSLANG_JS"
OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_GLSLANG_WEBMIN_DEVEL
"For ENABLE_GLSLANG_WEBMIN builds, enables compilation error messages"
OFF "ENABLE_GLSLANG_WEBMIN"
OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_SINGLE_FILE CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_SINGLE_FILE
"If using Emscripten, enables SINGLE_FILE build" "If using Emscripten, enables SINGLE_FILE build"
OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN" OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN"
@ -86,11 +78,7 @@ CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN" OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN"
OFF) OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_HLSL option(ENABLE_HLSL "Enables HLSL input support" ON)
"Enables HLSL input support"
ON "NOT ENABLE_GLSLANG_WEBMIN"
OFF)
option(ENABLE_RTTI "Enables RTTI" OFF) option(ENABLE_RTTI "Enables RTTI" OFF)
option(ENABLE_EXCEPTIONS "Enables Exceptions" OFF) option(ENABLE_EXCEPTIONS "Enables Exceptions" OFF)
option(ENABLE_OPT "Enables spirv-opt capability if present" ON) option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
@ -112,13 +100,6 @@ if(ENABLE_HLSL)
add_definitions(-DENABLE_HLSL) add_definitions(-DENABLE_HLSL)
endif() endif()
if(ENABLE_GLSLANG_WEBMIN)
add_definitions(-DGLSLANG_WEB)
if(ENABLE_GLSLANG_WEBMIN_DEVEL)
add_definitions(-DGLSLANG_WEB_DEVEL)
endif()
endif()
if(WIN32) if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d") set(CMAKE_DEBUG_POSTFIX "d")
option(OVERRIDE_MSVCCRT "Overrides runtime of MSVC " ON) option(OVERRIDE_MSVCCRT "Overrides runtime of MSVC " ON)
@ -355,18 +336,18 @@ if(ENABLE_GLSLANG_INSTALL)
PATH_EXPORT_TARGETS PATH_EXPORT_TARGETS
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
) )
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/glslang-config-version.cmake" write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/glslang-config-version.cmake"
VERSION ${GLSLANG_VERSION} VERSION ${GLSLANG_VERSION}
COMPATIBILITY SameMajorVersion COMPATIBILITY SameMajorVersion
) )
install( install(
EXPORT glslang-targets EXPORT glslang-targets
NAMESPACE "glslang::" NAMESPACE "glslang::"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
) )
install( install(
FILES FILES
"${CMAKE_CURRENT_BINARY_DIR}/glslang-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/glslang-config.cmake"

View File

@ -256,12 +256,6 @@ Use the steps in [Build Steps](#build-steps), with the following notes/exception
* Set `-DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF`. * Set `-DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF`.
* Set `-DENABLE_HLSL=OFF` if HLSL is not needed. * Set `-DENABLE_HLSL=OFF` if HLSL is not needed.
* For a standalone JS/WASM library, turn on `-DENABLE_GLSLANG_JS=ON`. * For a standalone JS/WASM library, turn on `-DENABLE_GLSLANG_JS=ON`.
* For building a minimum-size web subset of core glslang:
+ turn on `-DENABLE_GLSLANG_WEBMIN=ON` (disables HLSL)
+ execute `updateGrammar web` from the glslang subdirectory
(or if using your own scripts, `m4` needs a `-DGLSLANG_WEB` argument)
+ optionally, for GLSL compilation error messages, turn on
`-DENABLE_GLSLANG_WEBMIN_DEVEL=ON`
* To get a fully minimized build, make sure to use `brotli` to compress the .js * To get a fully minimized build, make sure to use `brotli` to compress the .js
and .wasm files and .wasm files

File diff suppressed because it is too large Load Diff

View File

@ -32,8 +32,6 @@
// 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>
@ -68,5 +66,3 @@ std::string SpvBuildLogger::getAllMessages() const {
} }
} // end spv namespace } // end spv namespace
#endif

View File

@ -46,14 +46,6 @@ 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.
@ -67,7 +59,6 @@ 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&);

View File

@ -46,10 +46,7 @@
#include <algorithm> #include <algorithm>
#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>
@ -283,11 +280,6 @@ 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) {
@ -329,11 +321,6 @@ 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) {
@ -733,7 +720,6 @@ 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:
@ -779,7 +765,6 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
addCapability(CapabilityImageMSArray); addCapability(CapabilityImageMSArray);
} }
} }
#endif
if (emitNonSemanticShaderDebugInfo) if (emitNonSemanticShaderDebugInfo)
{ {
@ -1196,7 +1181,6 @@ Id Builder::makeDebugDeclare(Id const debugLocalVariable, Id const localVariable
return inst->getResultId(); return inst->getResultId();
} }
#ifndef GLSLANG_WEB
Id Builder::makeAccelerationStructureType() Id Builder::makeAccelerationStructureType()
{ {
Instruction *type; Instruction *type;
@ -1241,7 +1225,6 @@ Id Builder::makeHitObjectNVType()
return type->getResultId(); return type->getResultId();
} }
#endif
Id Builder::getDerefTypeId(Id resultId) const Id Builder::getDerefTypeId(Id resultId) const
{ {
@ -1643,10 +1626,6 @@ 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;
@ -1671,15 +1650,10 @@ 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);
@ -1704,17 +1678,11 @@ 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)
{ {
#ifdef GLSLANG_WEB
const int width = 32;
assert(width == getScalarTypeWidth(type));
#else
const int width = getScalarTypeWidth(type); const int width = getScalarTypeWidth(type);
#endif
assert(isFloatType(type)); assert(isFloatType(type));
@ -2846,12 +2814,10 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
if (parameters.component != NoResult) if (parameters.component != NoResult)
texArgs.push_back(parameters.component); texArgs.push_back(parameters.component);
#ifndef GLSLANG_WEB
if (parameters.granularity != NoResult) if (parameters.granularity != NoResult)
texArgs.push_back(parameters.granularity); texArgs.push_back(parameters.granularity);
if (parameters.coarse != NoResult) if (parameters.coarse != NoResult)
texArgs.push_back(parameters.coarse); texArgs.push_back(parameters.coarse);
#endif
// //
// Set up the optional arguments // Set up the optional arguments
@ -2892,7 +2858,6 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask); mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask);
texArgs.push_back(parameters.offsets); texArgs.push_back(parameters.offsets);
} }
#ifndef GLSLANG_WEB
if (parameters.sample) { if (parameters.sample) {
mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask); mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask);
texArgs.push_back(parameters.sample); texArgs.push_back(parameters.sample);
@ -2910,7 +2875,6 @@ 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;
// insert the operand for the mask, if any bits were set. // insert the operand for the mask, if any bits were set.
if (mask != ImageOperandsMaskNone) if (mask != ImageOperandsMaskNone)
@ -2925,7 +2889,6 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
opCode = OpImageSparseFetch; opCode = OpImageSparseFetch;
else else
opCode = OpImageFetch; opCode = OpImageFetch;
#ifndef GLSLANG_WEB
} else if (parameters.granularity && parameters.coarse) { } else if (parameters.granularity && parameters.coarse) {
opCode = OpImageSampleFootprintNV; opCode = OpImageSampleFootprintNV;
} else if (gather) { } else if (gather) {
@ -2939,7 +2902,6 @@ 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)
@ -3302,12 +3264,7 @@ 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);
#ifdef GLSLANG_WEB
const unsigned bitCount = 32;
assert(bitCount == instr->getImmediateOperand(0));
#else
const unsigned bitCount = instr->getImmediateOperand(0); 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) {

View File

@ -285,14 +285,10 @@ 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 bool isCooperativeMatrixType(Id typeId)const
{ {
return getTypeClass(typeId) == OpTypeCooperativeMatrixKHR || getTypeClass(typeId) == OpTypeCooperativeMatrixNV; return getTypeClass(typeId) == OpTypeCooperativeMatrixKHR || getTypeClass(typeId) == OpTypeCooperativeMatrixNV;
} }
#endif
bool isAggregateType(Id typeId) const bool isAggregateType(Id typeId) const
{ return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); } { 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; }
@ -707,11 +703,6 @@ 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(); } 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; } bool isVolatile() const { return volatil; }
bool isNonUniform() const { return nonUniform; } bool isNonUniform() const { return nonUniform; }
bool anyCoherent() const { bool anyCoherent() const {
@ -756,7 +747,6 @@ public:
nonUniform |= other.nonUniform; nonUniform |= other.nonUniform;
return *this; return *this;
} }
#endif
}; };
CoherentFlags coherentFlags; CoherentFlags coherentFlags;
}; };
@ -842,14 +832,12 @@ public:
// Prune unreachable blocks in the CFG and remove unneeded decorations. // Prune unreachable blocks in the CFG and remove unneeded decorations.
void postProcessCFG(); void postProcessCFG();
#ifndef GLSLANG_WEB
// Add capabilities, extensions based on instructions in the module. // Add capabilities, extensions based on instructions in the module.
void postProcessFeatures(); void postProcessFeatures();
// Hook to visit each instruction in a block in a function // Hook to visit each instruction in a block in a function
void postProcess(Instruction&); void postProcess(Instruction&);
// Hook to visit each non-32-bit sized float/int operation in a block. // Hook to visit each non-32-bit sized float/int operation in a block.
void postProcessType(const Instruction&, spv::Id typeId); void postProcessType(const Instruction&, spv::Id typeId);
#endif
void dump(std::vector<unsigned int>&) const; void dump(std::vector<unsigned int>&) const;

View File

@ -57,7 +57,6 @@ namespace spv {
namespace spv { namespace spv {
#ifndef GLSLANG_WEB
// Hook to visit each operand type and result type of an instruction. // Hook to visit each operand type and result type of an instruction.
// Will be called multiple times for one instruction, once for each typed // Will be called multiple times for one instruction, once for each typed
// operand and the result. // operand and the result.
@ -334,7 +333,6 @@ void Builder::postProcess(Instruction& inst)
} }
} }
} }
#endif
// comment in header // comment in header
void Builder::postProcessCFG() void Builder::postProcessCFG()
@ -395,7 +393,6 @@ void Builder::postProcessCFG()
decorations.end()); decorations.end());
} }
#ifndef GLSLANG_WEB
// comment in header // comment in header
void Builder::postProcessFeatures() { void Builder::postProcessFeatures() {
// Add per-instruction capabilities, extensions, etc., // Add per-instruction capabilities, extensions, etc.,
@ -483,14 +480,11 @@ void Builder::postProcessFeatures() {
} }
} }
} }
#endif
// comment in header // comment in header
void Builder::postProcess() { void Builder::postProcess() {
postProcessCFG(); postProcessCFG();
#ifndef GLSLANG_WEB
postProcessFeatures(); postProcessFeatures();
#endif
} }
}; // end spv namespace }; // end spv namespace

View File

@ -158,13 +158,11 @@ void ProcessConfigFile()
{ {
if (ConfigFile.size() == 0) if (ConfigFile.size() == 0)
*GetResources() = *GetDefaultResources(); *GetResources() = *GetDefaultResources();
#ifndef GLSLANG_WEB
else { else {
char* configString = ReadFileData(ConfigFile.c_str()); char* configString = ReadFileData(ConfigFile.c_str());
DecodeResourceLimits(GetResources(), configString); DecodeResourceLimits(GetResources(), configString);
FreeFileData(configString); FreeFileData(configString);
} }
#endif
} }
int ReflectOptions = EShReflectionDefault; int ReflectOptions = EShReflectionDefault;
@ -1342,7 +1340,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
shader->setPreamble(PreambleString.c_str()); shader->setPreamble(PreambleString.c_str());
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);
@ -1374,7 +1371,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
} }
shader->setUniformLocationBase(uniformBase); shader->setUniformLocationBase(uniformBase);
#endif
if (VulkanRulesRelaxed) { if (VulkanRulesRelaxed) {
for (auto& storageOverride : blockStorageOverrides) { for (auto& storageOverride : blockStorageOverrides) {
@ -1434,7 +1430,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
const int defaultVersion = Options & EOptionDefaultDesktop ? 110 : 100; const int defaultVersion = Options & EOptionDefaultDesktop ? 110 : 100;
#ifndef GLSLANG_WEB
if (Options & EOptionOutputPreprocessed) { if (Options & EOptionOutputPreprocessed) {
std::string str; std::string str;
if (shader->preprocess(GetResources(), defaultVersion, ENoProfile, false, false, messages, &str, includer)) { if (shader->preprocess(GetResources(), defaultVersion, ENoProfile, false, false, messages, &str, includer)) {
@ -1446,7 +1441,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
StderrIfNonEmpty(shader->getInfoDebugLog()); StderrIfNonEmpty(shader->getInfoDebugLog());
continue; continue;
} }
#endif
if (! shader->parse(GetResources(), defaultVersion, false, messages, includer)) if (! shader->parse(GetResources(), defaultVersion, false, messages, includer))
CompileFailed = true; CompileFailed = true;
@ -1470,13 +1464,11 @@ 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) &&
@ -1485,13 +1477,11 @@ 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
std::vector<std::string> outputFiles; std::vector<std::string> outputFiles;
@ -1534,10 +1524,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
} }
outputFiles.push_back(GetBinaryName((EShLanguage)stage)); outputFiles.push_back(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
} }
} }
} }
@ -1632,13 +1620,11 @@ int singleMain()
workList.add(item.get()); workList.add(item.get());
}); });
#ifndef GLSLANG_WEB
if (Options & EOptionDumpConfig) { if (Options & EOptionDumpConfig) {
printf("%s", GetDefaultTBuiltInResourceString().c_str()); printf("%s", GetDefaultTBuiltInResourceString().c_str());
if (workList.empty()) if (workList.empty())
return ESuccess; return ESuccess;
} }
#endif
if (Options & EOptionDumpBareVersion) { if (Options & EOptionDumpBareVersion) {
printf("%d:%d.%d.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR, GLSLANG_VERSION_MINOR, printf("%d:%d.%d.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR, GLSLANG_VERSION_MINOR,

View File

@ -67,10 +67,8 @@ enum TBasicType {
EbtRayQuery, EbtRayQuery,
EbtHitObjectNV, EbtHitObjectNV,
EbtCoopmat, EbtCoopmat,
#ifndef GLSLANG_WEB
// SPIR-V type defined by spirv_type // SPIR-V type defined by spirv_type
EbtSpirvType, EbtSpirvType,
#endif
// HLSL types that live only temporarily. // HLSL types that live only temporarily.
EbtString, EbtString,
@ -97,9 +95,7 @@ enum TStorageQualifier {
EvqUniform, // read only, shared with app EvqUniform, // read only, shared with app
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
#ifndef GLSLANG_WEB
EvqSpirvStorageClass, // spirv_storage_class EvqSpirvStorageClass, // spirv_storage_class
#endif
EvqPayload, EvqPayload,
EvqPayloadIn, EvqPayloadIn,
@ -342,10 +338,6 @@ enum TPrecisionQualifier {
EpqHigh 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)
{ {
@ -354,9 +346,7 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q)
case EvqGlobal: return "global"; break; case EvqGlobal: return "global"; break;
case EvqConst: return "const"; break; case EvqConst: return "const"; break;
case EvqConstReadOnly: return "const (read only)"; break; case EvqConstReadOnly: return "const (read only)"; break;
#ifndef GLSLANG_WEB
case EvqSpirvStorageClass: return "spirv_storage_class"; break; case EvqSpirvStorageClass: return "spirv_storage_class"; break;
#endif
case EvqVaryingIn: return "in"; break; case EvqVaryingIn: return "in"; break;
case EvqVaryingOut: return "out"; break; case EvqVaryingOut: return "out"; break;
case EvqUniform: return "uniform"; break; case EvqUniform: return "uniform"; break;
@ -547,7 +537,6 @@ __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)
{ {

View File

@ -234,7 +234,6 @@ public:
break; break;
#ifndef GLSLANG_WEB
case EbtInt16: case EbtInt16:
if (constant.i16Const == i16Const) if (constant.i16Const == i16Const)
return true; return true;
@ -265,7 +264,6 @@ public:
return true; return true;
break; break;
#endif
default: default:
assert(false && "Default missing"); assert(false && "Default missing");
} }
@ -347,7 +345,6 @@ public:
return true; return true;
return false; return false;
#ifndef GLSLANG_WEB
case EbtInt8: case EbtInt8:
if (i8Const > constant.i8Const) if (i8Const > constant.i8Const)
return true; return true;
@ -378,7 +375,6 @@ public:
return true; return true;
return false; return false;
#endif
default: default:
assert(false && "Default missing"); assert(false && "Default missing");
return false; return false;
@ -389,7 +385,6 @@ 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;
@ -419,7 +414,6 @@ 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;
@ -449,14 +443,12 @@ public:
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst + constant.uConst); break; case EbtUint: returnValue.setUConst(uConst + constant.uConst); break;
case EbtDouble: returnValue.setDConst(dConst + constant.dConst); 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 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 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");
} }
@ -471,14 +463,12 @@ public:
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst - constant.uConst); break; case EbtUint: returnValue.setUConst(uConst - constant.uConst); break;
case EbtDouble: returnValue.setDConst(dConst - constant.dConst); 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 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 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");
} }
@ -493,14 +483,12 @@ public:
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst * constant.uConst); break; case EbtUint: returnValue.setUConst(uConst * constant.uConst); break;
case EbtDouble: returnValue.setDConst(dConst * constant.dConst); 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 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 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");
} }
@ -514,14 +502,12 @@ public:
switch (type) { switch (type) {
case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst % constant.uConst); 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 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 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");
} }
@ -532,7 +518,6 @@ 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;
@ -585,19 +570,16 @@ 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 EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
case EbtUint: returnValue.setIConst(iConst >> constant.uConst); 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 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;
@ -605,18 +587,15 @@ public:
switch (constant.type) { switch (constant.type) {
case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break; case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst >> constant.uConst); 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 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;
@ -643,7 +622,6 @@ public:
default: assert(false && "Default missing"); default: assert(false && "Default missing");
} }
break; break;
#endif
default: assert(false && "Default missing"); default: assert(false && "Default missing");
} }
@ -654,7 +632,6 @@ 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;
@ -733,19 +710,16 @@ 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 EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
case EbtUint: returnValue.setIConst(iConst << constant.uConst); 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 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;
@ -753,14 +727,12 @@ public:
switch (constant.type) { switch (constant.type) {
case EbtInt: returnValue.setUConst(uConst << constant.iConst); break; case EbtInt: returnValue.setUConst(uConst << constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst << constant.uConst); 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 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;
@ -777,14 +749,12 @@ public:
switch (type) { switch (type) {
case EbtInt: returnValue.setIConst(iConst & constant.iConst); break; case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst & constant.uConst); 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 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");
} }
@ -798,14 +768,12 @@ public:
switch (type) { switch (type) {
case EbtInt: returnValue.setIConst(iConst | constant.iConst); break; case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst | constant.uConst); 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 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");
} }
@ -819,14 +787,12 @@ public:
switch (type) { switch (type) {
case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break; case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); 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 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");
} }
@ -839,14 +805,12 @@ public:
switch (type) { switch (type) {
case EbtInt: returnValue.setIConst(~iConst); break; case EbtInt: returnValue.setIConst(~iConst); break;
case EbtUint: returnValue.setUConst(~uConst); 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 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");
} }

View File

@ -35,8 +35,6 @@
#pragma once #pragma once
#ifndef GLSLANG_WEB
// //
// GL_EXT_spirv_intrinsics // GL_EXT_spirv_intrinsics
// //
@ -135,5 +133,3 @@ struct TSpirvType {
}; };
} // end namespace glslang } // end namespace glslang
#endif // GLSLANG_WEB

View File

@ -86,20 +86,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
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() bool sampler : 1; // true means a pure sampler, other fields should be clear()
#ifdef GLSLANG_WEB
bool is1D() const { return false; }
bool isBuffer() const { return false; }
bool isRect() const { return false; }
bool isSubpass() const { return false; }
bool isAttachmentEXT() const { return false; }
bool isCombined() const { return true; }
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
unsigned int vectorSize : 3; // vector return type size. unsigned int vectorSize : 3; // vector return type size.
// Some languages support structures as sample results. Storing the whole structure in the // 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. // TSampler is too large, so there is an index to a separate table.
@ -132,7 +118,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool isExternal() const { return external; } bool isExternal() const { return external; }
void setExternal(bool e) { external = e; } void setExternal(bool e) { external = e; }
bool isYuv() const { return yuv; } bool isYuv() const { return yuv; }
#endif
bool isTexture() const { return !sampler && !image; } bool isTexture() const { return !sampler && !image; }
bool isPureSampler() const { return sampler; } bool isPureSampler() const { return sampler; }
@ -152,10 +137,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
image = false; image = false;
combined = false; combined = false;
sampler = false; sampler = false;
#ifndef GLSLANG_WEB
external = false; external = false;
yuv = false; yuv = false;
#endif
#ifdef ENABLE_HLSL #ifdef ENABLE_HLSL
clearReturnStruct(); clearReturnStruct();
@ -207,7 +190,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
shadow = s; shadow = s;
} }
#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)
{ {
@ -226,7 +208,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
image = true; image = true;
dim = EsdAttachmentEXT; dim = EsdAttachmentEXT;
} }
#endif
bool operator==(const TSampler& right) const bool operator==(const TSampler& right) const
{ {
@ -264,7 +245,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
switch (type) { switch (type) {
case EbtInt: s.append("i"); break; case EbtInt: s.append("i"); break;
case EbtUint: s.append("u"); break; case EbtUint: s.append("u"); break;
#ifndef GLSLANG_WEB
case EbtFloat16: s.append("f16"); break; case EbtFloat16: s.append("f16"); break;
case EbtInt8: s.append("i8"); break; case EbtInt8: s.append("i8"); break;
case EbtUint16: s.append("u8"); break; case EbtUint16: s.append("u8"); break;
@ -272,7 +252,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
case EbtUint8: s.append("u16"); break; case EbtUint8: s.append("u16"); 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;
#endif
default: break; default: break;
} }
if (isImageClass()) { if (isImageClass()) {
@ -298,13 +277,11 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
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 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;
case EsdAttachmentEXT: s.append(""); break; case EsdAttachmentEXT: s.append(""); break;
#endif
default: break; // some compilers want this default: break; // some compilers want this
} }
if (isMultiSample()) if (isMultiSample())
@ -533,12 +510,10 @@ public:
invariant = false; invariant = false;
makeTemporary(); makeTemporary();
declaredBuiltIn = EbvNone; declaredBuiltIn = EbvNone;
#ifndef GLSLANG_WEB
noContraction = false; noContraction = false;
nullInit = false; nullInit = false;
spirvByReference = false; spirvByReference = false;
spirvLiteral = false; spirvLiteral = false;
#endif
defaultBlock = false; defaultBlock = false;
} }
@ -555,21 +530,17 @@ public:
nullInit = false; nullInit = false;
defaultBlock = false; defaultBlock = false;
clearLayout(); clearLayout();
#ifndef GLSLANG_WEB
spirvStorageClass = -1; spirvStorageClass = -1;
spirvDecorate = nullptr; spirvDecorate = nullptr;
spirvByReference = false; spirvByReference = false;
spirvLiteral = false; spirvLiteral = false;
#endif
} }
void clearInterstage() void clearInterstage()
{ {
clearInterpolation(); clearInterpolation();
#ifndef GLSLANG_WEB
patch = false; patch = false;
sample = false; sample = false;
#endif
} }
void clearInterpolation() void clearInterpolation()
@ -577,20 +548,17 @@ public:
centroid = false; centroid = false;
smooth = false; smooth = false;
flat = false; flat = false;
#ifndef GLSLANG_WEB
nopersp = false; nopersp = false;
explicitInterp = false; explicitInterp = false;
pervertexNV = false; pervertexNV = false;
perPrimitiveNV = false; perPrimitiveNV = false;
perViewNV = false; perViewNV = false;
perTaskNV = false; perTaskNV = false;
#endif
pervertexEXT = false; pervertexEXT = false;
} }
void clearMemory() void clearMemory()
{ {
#ifndef GLSLANG_WEB
coherent = false; coherent = false;
devicecoherent = false; devicecoherent = false;
queuefamilycoherent = false; queuefamilycoherent = false;
@ -602,7 +570,6 @@ public:
restrict = false; restrict = false;
readonly = false; readonly = false;
writeonly = false; writeonly = false;
#endif
} }
const char* semanticName; const char* semanticName;
@ -621,31 +588,6 @@ public:
bool explicitOffset : 1; bool explicitOffset : 1;
bool defaultBlock : 1; // default blocks with matching names have structures merged when linking bool defaultBlock : 1; // default blocks with matching names have structures merged when linking
#ifdef GLSLANG_WEB
bool isWriteOnly() const { return false; }
bool isReadOnly() const { return false; }
bool isRestrict() const { return false; }
bool isCoherent() const { return false; }
bool isVolatile() 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; }
bool isPervertexEXT() const { return pervertexEXT; }
void setNullInit() {}
bool isNullInit() const { return false; }
void setSpirvByReference() { }
bool isSpirvByReference() { return false; }
void setSpirvLiteral() { }
bool isSpirvLiteral() { return false; }
#else
bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects
bool nopersp : 1; bool nopersp : 1;
bool explicitInterp : 1; bool explicitInterp : 1;
@ -712,7 +654,6 @@ public:
bool isSpirvByReference() const { return spirvByReference; } bool isSpirvByReference() const { return spirvByReference; }
void setSpirvLiteral() { spirvLiteral = true; } void setSpirvLiteral() { spirvLiteral = true; }
bool isSpirvLiteral() const { return spirvLiteral; } bool isSpirvLiteral() const { return spirvLiteral; }
#endif
bool isPipeInput() const bool isPipeInput() const
{ {
@ -843,9 +784,7 @@ public:
} }
void setBlockStorage(TBlockStorageClass newBacking) { void setBlockStorage(TBlockStorageClass newBacking) {
#ifndef GLSLANG_WEB
layoutPushConstant = (newBacking == EbsPushConstant); layoutPushConstant = (newBacking == EbsPushConstant);
#endif
switch (newBacking) { switch (newBacking) {
case EbsUniform : case EbsUniform :
if (layoutPacking == ElpStd430) { if (layoutPacking == ElpStd430) {
@ -857,23 +796,16 @@ public:
case EbsStorageBuffer : case EbsStorageBuffer :
storage = EvqBuffer; storage = EvqBuffer;
break; break;
#ifndef GLSLANG_WEB
case EbsPushConstant : case EbsPushConstant :
storage = EvqUniform; storage = EvqUniform;
layoutSet = TQualifier::layoutSetEnd; layoutSet = TQualifier::layoutSetEnd;
layoutBinding = TQualifier::layoutBindingEnd; layoutBinding = TQualifier::layoutBindingEnd;
break; break;
#endif
default: default:
break; break;
} }
} }
#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 isPerPrimitive() const { return perPrimitiveNV; }
bool isPerView() const { return perViewNV; } bool isPerView() const { return perViewNV; }
bool isTaskMemory() const { return perTaskNV; } bool isTaskMemory() const { return perTaskNV; }
@ -907,14 +839,12 @@ public:
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;
layoutPassthrough = false; layoutPassthrough = false;
@ -927,7 +857,6 @@ public:
layoutBindlessImage = false; layoutBindlessImage = false;
layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd; layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
layoutFormat = ElfNone; layoutFormat = ElfNone;
#endif
clearInterstageLayout(); clearInterstageLayout();
@ -937,14 +866,11 @@ public:
{ {
layoutLocation = layoutLocationEnd; layoutLocation = layoutLocationEnd;
layoutComponent = layoutComponentEnd; layoutComponent = layoutComponentEnd;
#ifndef GLSLANG_WEB
layoutIndex = layoutIndexEnd; layoutIndex = layoutIndexEnd;
clearStreamLayout(); clearStreamLayout();
clearXfbLayout(); clearXfbLayout();
#endif
} }
#ifndef GLSLANG_WEB
void clearStreamLayout() void clearStreamLayout()
{ {
layoutStream = layoutStreamEnd; layoutStream = layoutStreamEnd;
@ -955,7 +881,6 @@ public:
layoutXfbStride = layoutXfbStrideEnd; layoutXfbStride = layoutXfbStrideEnd;
layoutXfbOffset = layoutXfbOffsetEnd; layoutXfbOffset = layoutXfbOffsetEnd;
} }
#endif
bool hasNonXfbLayout() const bool hasNonXfbLayout() const
{ {
@ -1011,7 +936,6 @@ 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;
@ -1032,7 +956,6 @@ public:
bool layoutBindlessSampler; bool layoutBindlessSampler;
bool layoutBindlessImage; bool layoutBindlessImage;
#endif
bool hasUniformLayout() const bool hasUniformLayout() const
{ {
@ -1052,9 +975,7 @@ public:
layoutSet = layoutSetEnd; layoutSet = layoutSetEnd;
layoutBinding = layoutBindingEnd; layoutBinding = layoutBindingEnd;
#ifndef GLSLANG_WEB
layoutAttachment = layoutAttachmentEnd; layoutAttachment = layoutAttachmentEnd;
#endif
} }
bool hasMatrix() const bool hasMatrix() const
@ -1087,26 +1008,6 @@ 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; }
unsigned getIndex() const { return 0; }
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 isShaderRecord() const { return false; }
bool hasBufferReference() const { return false; }
bool hasBufferReferenceAlign() const { return false; }
bool isNonUniform() const { return false; }
#else
bool hasOffset() const bool hasOffset() const
{ {
return layoutOffset != layoutNotSet; return layoutOffset != layoutNotSet;
@ -1181,7 +1082,7 @@ public:
const TSpirvDecorate& getSpirvDecorate() const { assert(spirvDecorate); return *spirvDecorate; } const TSpirvDecorate& getSpirvDecorate() const { assert(spirvDecorate); return *spirvDecorate; }
TSpirvDecorate& getSpirvDecorate() { assert(spirvDecorate); return *spirvDecorate; } TSpirvDecorate& getSpirvDecorate() { assert(spirvDecorate); return *spirvDecorate; }
TString getSpirvDecorateQualifierString() const; TString getSpirvDecorateQualifierString() const;
#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
@ -1215,12 +1116,10 @@ public:
{ {
switch (packing) { switch (packing) {
case ElpStd140: return "std140"; case ElpStd140: return "std140";
#ifndef GLSLANG_WEB
case ElpPacked: return "packed"; case ElpPacked: return "packed";
case ElpShared: return "shared"; case ElpShared: return "shared";
case ElpStd430: return "std430"; case ElpStd430: return "std430";
case ElpScalar: return "scalar"; case ElpScalar: return "scalar";
#endif
default: return "none"; default: return "none";
} }
} }
@ -1232,9 +1131,6 @@ 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) {
@ -1388,7 +1284,6 @@ 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.
@ -1405,7 +1300,6 @@ struct TShaderQualifiers {
int localSize[3]; // compute shader int localSize[3]; // compute shader
bool localSizeNotDefault[3]; // compute shader bool localSizeNotDefault[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
bool earlyAndLateFragmentTestsAMD; //fragment input bool earlyAndLateFragmentTestsAMD; //fragment input
@ -1424,9 +1318,6 @@ struct TShaderQualifiers {
bool layoutPrimitiveCulling; // true if layout primitive_culling set bool layoutPrimitiveCulling; // true if layout primitive_culling set
TLayoutDepth getDepth() const { return layoutDepth; } TLayoutDepth getDepth() const { return layoutDepth; }
TLayoutStencil getStencil() const { return layoutStencil; } TLayoutStencil getStencil() const { return layoutStencil; }
#else
TLayoutDepth getDepth() const { return EldNone; }
#endif
void init() void init()
{ {
@ -1447,7 +1338,6 @@ 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;
earlyAndLateFragmentTestsAMD = false; earlyAndLateFragmentTestsAMD = false;
postDepthCoverage = false; postDepthCoverage = false;
@ -1464,14 +1354,9 @@ struct TShaderQualifiers {
layoutPrimitiveCulling = false; layoutPrimitiveCulling = false;
primitives = TQualifier::layoutNotSet; primitives = TQualifier::layoutNotSet;
interlockOrdering = EioNone; interlockOrdering = EioNone;
#endif
} }
#ifdef GLSLANG_WEB
bool hasBlendEquation() const { return false; }
#else
bool hasBlendEquation() const { return blendEquation; } 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.
@ -1504,7 +1389,6 @@ 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.earlyAndLateFragmentTestsAMD) if (src.earlyAndLateFragmentTestsAMD)
@ -1537,7 +1421,6 @@ struct TShaderQualifiers {
interlockOrdering = src.interlockOrdering; interlockOrdering = src.interlockOrdering;
if (src.layoutPrimitiveCulling) if (src.layoutPrimitiveCulling)
layoutPrimitiveCulling = src.layoutPrimitiveCulling; layoutPrimitiveCulling = src.layoutPrimitiveCulling;
#endif
} }
}; };
@ -1577,20 +1460,12 @@ public:
const TType* userDef; const TType* userDef;
TSourceLoc loc; TSourceLoc loc;
TTypeParameters* typeParameters; TTypeParameters* typeParameters;
#ifndef GLSLANG_WEB
// SPIR-V type defined by spirv_type directive // SPIR-V type defined by spirv_type directive
TSpirvType* spirvType; TSpirvType* spirvType;
#endif
#ifdef GLSLANG_WEB
bool isCoopmat() const { return false; }
bool isCoopmatNV() const { return false; }
bool isCoopmatKHR() const { return false; }
#else
bool isCoopmat() const { return coopmatNV || coopmatKHR; } bool isCoopmat() const { return coopmatNV || coopmatKHR; }
bool isCoopmatNV() const { return coopmatNV; } bool isCoopmatNV() const { return coopmatNV; }
bool isCoopmatKHR() const { return coopmatKHR; } bool isCoopmatKHR() const { return coopmatKHR; }
#endif
void initType(const TSourceLoc& l) void initType(const TSourceLoc& l)
{ {
@ -1604,9 +1479,7 @@ public:
typeParameters = nullptr; typeParameters = nullptr;
coopmatNV = false; coopmatNV = false;
coopmatKHR = false; coopmatKHR = false;
#ifndef GLSLANG_WEB
spirvType = nullptr; spirvType = nullptr;
#endif
} }
void initQualifiers(bool global = false) void initQualifiers(bool global = false)
@ -1643,10 +1516,8 @@ public:
return matrixCols == 0 && vectorSize == 1 && arraySizes == nullptr && userDef == nullptr; return matrixCols == 0 && vectorSize == 1 && arraySizes == nullptr && userDef == nullptr;
} }
#ifndef GLSLANG_WEB
// GL_EXT_spirv_intrinsics // GL_EXT_spirv_intrinsics
void setSpirvType(const TSpirvInstruction& spirvInst, const TSpirvTypeParameters* typeParams = nullptr); void setSpirvType(const TSpirvInstruction& spirvInst, const TSpirvTypeParameters* typeParams = nullptr);
#endif
// "Image" is a superset of "Subpass" // "Image" is a superset of "Subpass"
bool isImage() const { return basicType == EbtSampler && sampler.isImage(); } bool isImage() const { return basicType == EbtSampler && sampler.isImage(); }
@ -1665,10 +1536,8 @@ public:
explicit TType(TBasicType t = EbtVoid, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0, explicit TType(TBasicType t = EbtVoid, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0,
bool isVector = false) : bool isVector = false) :
basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1),
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr) arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
#ifndef GLSLANG_WEB spirvType(nullptr)
, spirvType(nullptr)
#endif
{ {
sampler.clear(); sampler.clear();
qualifier.clear(); qualifier.clear();
@ -1679,10 +1548,8 @@ public:
TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0, TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0,
bool isVector = false) : bool isVector = false) :
basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1),
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr) arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
#ifndef GLSLANG_WEB spirvType(nullptr)
, spirvType(nullptr)
#endif
{ {
sampler.clear(); sampler.clear();
qualifier.clear(); qualifier.clear();
@ -1695,10 +1562,8 @@ public:
explicit TType(const TPublicType& p) : explicit TType(const TPublicType& p) :
basicType(p.basicType), basicType(p.basicType),
vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(-1), vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), coopmatNV(p.coopmatNV), coopmatKHR(p.coopmatKHR), coopmatKHRuse(-1),
arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters) arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters),
#ifndef GLSLANG_WEB spirvType(p.spirvType)
, spirvType(p.spirvType)
#endif
{ {
if (basicType == EbtSampler) if (basicType == EbtSampler)
sampler = p.sampler; sampler = p.sampler;
@ -1746,10 +1611,7 @@ public:
TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) : TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) :
basicType(EbtSampler), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), basicType(EbtSampler), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1),
arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr), arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr),
sampler(sampler), typeParameters(nullptr) sampler(sampler), typeParameters(nullptr), spirvType(nullptr)
#ifndef GLSLANG_WEB
, spirvType(nullptr)
#endif
{ {
qualifier.clear(); qualifier.clear();
qualifier.storage = q; qualifier.storage = q;
@ -1801,10 +1663,8 @@ public:
// for making structures, ... // for making structures, ...
TType(TTypeList* userDef, const TString& n) : TType(TTypeList* userDef, const TString& n) :
basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1),
arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr) arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
#ifndef GLSLANG_WEB spirvType(nullptr)
, spirvType(nullptr)
#endif
{ {
sampler.clear(); sampler.clear();
qualifier.clear(); qualifier.clear();
@ -1813,10 +1673,8 @@ public:
// For interface blocks // For interface blocks
TType(TTypeList* userDef, const TString& n, const TQualifier& q) : TType(TTypeList* userDef, const TString& n, const TQualifier& q) :
basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1),
qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr) qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr),
#ifndef GLSLANG_WEB spirvType(nullptr)
, spirvType(nullptr)
#endif
{ {
sampler.clear(); sampler.clear();
typeName = NewPoolTString(n.c_str()); typeName = NewPoolTString(n.c_str());
@ -1824,10 +1682,8 @@ public:
// for block reference (first parameter must be EbtReference) // for block reference (first parameter must be EbtReference)
explicit TType(TBasicType t, const TType &p, const TString& n) : explicit TType(TBasicType t, const TType &p, const TString& n) :
basicType(t), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1), basicType(t), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmatNV(false), coopmatKHR(false), coopmatKHRuse(-1),
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr) arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr),
#ifndef GLSLANG_WEB spirvType(nullptr)
, spirvType(nullptr)
#endif
{ {
assert(t == EbtReference); assert(t == EbtReference);
typeName = NewPoolTString(n.c_str()); typeName = NewPoolTString(n.c_str());
@ -1859,9 +1715,7 @@ public:
referentType = copyOf.referentType; referentType = copyOf.referentType;
} }
typeParameters = copyOf.typeParameters; typeParameters = copyOf.typeParameters;
#ifndef GLSLANG_WEB
spirvType = copyOf.spirvType; spirvType = copyOf.spirvType;
#endif
coopmatNV = copyOf.isCoopMatNV(); coopmatNV = copyOf.isCoopMatNV();
coopmatKHR = copyOf.isCoopMatKHR(); coopmatKHR = copyOf.isCoopMatKHR();
coopmatKHRuse = copyOf.coopmatKHRuse; coopmatKHRuse = copyOf.coopmatKHRuse;
@ -1940,11 +1794,7 @@ 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(); }
#ifdef GLSLANG_WEB
bool isArrayOfArrays() const { return false; }
#else
bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; } 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; }
@ -1986,11 +1836,8 @@ public:
return false; return false;
} }
virtual bool isOpaque() const { return basicType == EbtSampler virtual bool isOpaque() const { return basicType == EbtSampler
#ifndef GLSLANG_WEB || basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtRayQuery
|| basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtRayQuery || basicType == EbtHitObjectNV; }
|| basicType == EbtHitObjectNV
#endif
; }
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; } virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
virtual bool isAttachmentEXT() const { return basicType == EbtSampler && getSampler().isAttachmentEXT(); } virtual bool isAttachmentEXT() const { return basicType == EbtSampler && getSampler().isAttachmentEXT(); }
@ -2002,21 +1849,12 @@ public:
// Check the block-name convention of creating a block without populating it's members: // Check the block-name convention of creating a block without populating it's members:
virtual bool isUnusableName() const { return isStruct() && structure == nullptr; } virtual bool isUnusableName() const { return isStruct() && structure == nullptr; }
virtual bool isParameterized() const { return typeParameters != nullptr; } virtual bool isParameterized() const { return typeParameters != nullptr; }
#ifdef GLSLANG_WEB
bool isAtomic() const { return false; }
bool isCoopMat() const { return false; }
bool isCoopMatNV() const { return false; }
bool isCoopMatKHR() const { return false; }
bool isReference() const { return false; }
bool isSpirvType() const { return false; }
#else
bool isAtomic() const { return basicType == EbtAtomicUint; } bool isAtomic() const { return basicType == EbtAtomicUint; }
bool isCoopMat() const { return coopmatNV || coopmatKHR; } bool isCoopMat() const { return coopmatNV || coopmatKHR; }
bool isCoopMatNV() const { return coopmatNV; } bool isCoopMatNV() const { return coopmatNV; }
bool isCoopMatKHR() const { return coopmatKHR; } bool isCoopMatKHR() const { return coopmatKHR; }
bool isReference() const { return getBasicType() == EbtReference; } bool isReference() const { return getBasicType() == EbtReference; }
bool isSpirvType() const { return getBasicType() == EbtSpirvType; } bool isSpirvType() const { return getBasicType() == EbtSpirvType; }
#endif
int getCoopMatKHRuse() const { return coopmatKHRuse; } int getCoopMatKHRuse() const { return coopmatKHRuse; }
// 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.
@ -2103,15 +1941,6 @@ public:
return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } ); return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } );
} }
#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 bool containsDouble() const
{ {
return containsBasicType(EbtDouble); return containsBasicType(EbtDouble);
@ -2140,7 +1969,6 @@ public:
{ {
return containsBasicType(EbtReference); 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
@ -2235,7 +2063,6 @@ public:
case EbtInt: return "int"; case EbtInt: return "int";
case EbtUint: return "uint"; case EbtUint: return "uint";
case EbtSampler: return "sampler/image"; case EbtSampler: return "sampler/image";
#ifndef GLSLANG_WEB
case EbtVoid: return "void"; case EbtVoid: return "void";
case EbtDouble: return "double"; case EbtDouble: return "double";
case EbtFloat16: return "float16_t"; case EbtFloat16: return "float16_t";
@ -2255,18 +2082,10 @@ public:
case EbtString: return "string"; case EbtString: return "string";
case EbtSpirvType: return "spirv_type"; case EbtSpirvType: return "spirv_type";
case EbtCoopmat: return "coopmat"; case EbtCoopmat: return "coopmat";
#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(bool syntactic = false, bool getQualifiers = true, bool getPrecision = true, TString getCompleteString(bool syntactic = false, bool getQualifiers = true, bool getPrecision = true,
bool getType = true, TString name = "", TString structName = "") const bool getType = true, TString name = "", TString structName = "") const
{ {
@ -2640,7 +2459,6 @@ 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; }
@ -2834,14 +2652,12 @@ public:
(typeParameters != nullptr && right.typeParameters != nullptr && *typeParameters == *right.typeParameters)); (typeParameters != nullptr && right.typeParameters != nullptr && *typeParameters == *right.typeParameters));
} }
#ifndef GLSLANG_WEB
// See if two type's SPIR-V type contents match // See if two type's SPIR-V type contents match
bool sameSpirvType(const TType& right) const bool sameSpirvType(const TType& right) const
{ {
return ((spirvType == nullptr && right.spirvType == nullptr) || return ((spirvType == nullptr && right.spirvType == nullptr) ||
(spirvType != nullptr && right.spirvType != nullptr && *spirvType == *right.spirvType)); (spirvType != nullptr && right.spirvType != nullptr && *spirvType == *right.spirvType));
} }
#endif
// See if two type's elements match in all ways except basic type // See if two type's elements match in all ways except basic type
// If mismatch in structure members, return member indices in lpidx and rpidx. // If mismatch in structure members, return member indices in lpidx and rpidx.
@ -2928,11 +2744,7 @@ public:
// See if two types match in all ways (just the actual type, not qualification) // See if two types match in all ways (just the actual type, not qualification)
bool operator==(const TType& right) const bool operator==(const TType& right) const
{ {
#ifndef GLSLANG_WEB
return sameElementType(right) && sameArrayness(right) && sameTypeParameters(right) && sameCoopMatUse(right) && sameSpirvType(right); return sameElementType(right) && sameArrayness(right) && sameTypeParameters(right) && sameCoopMatUse(right) && sameSpirvType(right);
#else
return sameElementType(right) && sameArrayness(right) && sameTypeParameters(right);
#endif
} }
bool operator!=(const TType& right) const bool operator!=(const TType& right) const
@ -2942,18 +2754,14 @@ 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;
} }
#endif
return 0; return 0;
} }
#ifndef GLSLANG_WEB
const TSpirvType& getSpirvType() const { assert(spirvType); return *spirvType; } const TSpirvType& getSpirvType() const { assert(spirvType); return *spirvType; }
#endif
protected: protected:
// Require consumer to pick between deep copy and shallow copy. // Require consumer to pick between deep copy and shallow copy.
@ -2967,7 +2775,6 @@ protected:
{ {
shallowCopy(copyOf); shallowCopy(copyOf);
#ifndef GLSLANG_WEB
// GL_EXT_spirv_intrinsics // GL_EXT_spirv_intrinsics
if (copyOf.qualifier.spirvDecorate) { if (copyOf.qualifier.spirvDecorate) {
qualifier.spirvDecorate = new TSpirvDecorate; qualifier.spirvDecorate = new TSpirvDecorate;
@ -2978,7 +2785,6 @@ protected:
spirvType = new TSpirvType; spirvType = new TSpirvType;
*spirvType = *copyOf.spirvType; *spirvType = *copyOf.spirvType;
} }
#endif
if (copyOf.arraySizes) { if (copyOf.arraySizes) {
arraySizes = new TArraySizes; arraySizes = new TArraySizes;
@ -3043,9 +2849,7 @@ protected:
TString *typeName; // for structure type name TString *typeName; // for structure type name
TSampler sampler; TSampler sampler;
TTypeParameters *typeParameters;// nullptr unless a parameterized type; can be shared across types TTypeParameters *typeParameters;// nullptr unless a parameterized type; can be shared across types
#ifndef GLSLANG_WEB
TSpirvType* spirvType; // SPIR-V type defined by spirv_type directive TSpirvType* spirvType; // SPIR-V type defined by spirv_type directive
#endif
}; };
} // end namespace glslang } // end namespace glslang

View File

@ -72,9 +72,7 @@ enum TOperator {
EOpFunctionCall, EOpFunctionCall,
EOpFunction, // For function definition EOpFunction, // For function definition
EOpParameters, // an aggregate listing the parameters to a function EOpParameters, // an aggregate listing the parameters to a function
#ifndef GLSLANG_WEB
EOpSpirvInst, EOpSpirvInst,
#endif
// //
// Unary operators // Unary operators
@ -1335,12 +1333,7 @@ public:
// per process threadPoolAllocator, then it causes increased memory usage per compile // per process threadPoolAllocator, then it causes increased memory usage per compile
// it is essential to use "symbol = sym" to assign to symbol // it is essential to use "symbol = sym" to assign to symbol
TIntermSymbol(long long i, const TString& n, const TType& t) TIntermSymbol(long long i, const TString& n, const TType& t)
: TIntermTyped(t), id(i), : TIntermTyped(t), id(i), flattenSubset(-1), constSubtree(nullptr) { name = n; }
#ifndef GLSLANG_WEB
flattenSubset(-1),
#endif
constSubtree(nullptr)
{ name = n; }
virtual long long getId() const { return id; } virtual long long getId() const { return id; }
virtual void changeId(long long i) { id = i; } virtual void changeId(long long i) { id = i; }
virtual const TString& getName() const { return name; } virtual const TString& getName() const { return name; }
@ -1351,12 +1344,10 @@ public:
const TConstUnionArray& getConstArray() const { return constArray; } const TConstUnionArray& getConstArray() const { return constArray; }
void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; } void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; }
TIntermTyped* getConstSubtree() const { return constSubtree; } TIntermTyped* getConstSubtree() const { return constSubtree; }
#ifndef GLSLANG_WEB
void setFlattenSubset(int subset) { flattenSubset = subset; } void setFlattenSubset(int subset) { flattenSubset = subset; }
virtual const TString& getAccessName() const; virtual const TString& getAccessName() const;
int getFlattenSubset() const { return flattenSubset; } // -1 means full object int getFlattenSubset() const { return flattenSubset; } // -1 means full object
#endif
// This is meant for cases where a node has already been constructed, and // This is meant for cases where a node has already been constructed, and
// later on, it becomes necessary to switch to a different symbol. // later on, it becomes necessary to switch to a different symbol.
@ -1364,9 +1355,7 @@ public:
protected: protected:
long long id; // the unique id of the symbol this node represents long long id; // the unique id of the symbol this node represents
#ifndef GLSLANG_WEB
int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced
#endif
TString name; // the name of the symbol this node represents TString name; // the name of the symbol this node represents
TConstUnionArray constArray; // if the symbol is a front-end compile-time constant, this is its value TConstUnionArray constArray; // if the symbol is a front-end compile-time constant, this is its value
TIntermTyped* constSubtree; TIntermTyped* constSubtree;
@ -1421,19 +1410,11 @@ 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; }
bool isSubgroup() 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; }
bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; } bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; }
bool isSparseImage() const { return op == EOpSparseImageLoad; } bool isSparseImage() const { return op == EOpSparseImageLoad; }
bool isSubgroup() const { return op > EOpSubgroupGuardStart && op < EOpSubgroupGuardStop; } bool isSubgroup() const { return op > EOpSubgroupGuardStart && op < EOpSubgroupGuardStop; }
#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 ?
@ -1539,7 +1520,6 @@ public:
cracked.offset = true; cracked.offset = true;
cracked.proj = true; cracked.proj = true;
break; break;
#ifndef GLSLANG_WEB
case EOpTextureClamp: case EOpTextureClamp:
case EOpSparseTextureClamp: case EOpSparseTextureClamp:
cracked.lodClamp = true; cracked.lodClamp = true;
@ -1626,7 +1606,6 @@ public:
case EOpColorAttachmentReadEXT: case EOpColorAttachmentReadEXT:
cracked.attachmentEXT = true; cracked.attachmentEXT = true;
break; break;
#endif
default: default:
break; break;
} }
@ -1677,15 +1656,11 @@ public:
virtual TIntermUnary* getAsUnaryNode() { return this; } virtual TIntermUnary* getAsUnaryNode() { return this; }
virtual const TIntermUnary* getAsUnaryNode() const { return this; } virtual const TIntermUnary* getAsUnaryNode() const { return this; }
virtual void updatePrecision(); virtual void updatePrecision();
#ifndef GLSLANG_WEB
void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; } void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; }
const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; }
#endif
protected: protected:
TIntermTyped* operand; TIntermTyped* operand;
#ifndef GLSLANG_WEB
TSpirvInstruction spirvInst; TSpirvInstruction spirvInst;
#endif
}; };
typedef TVector<TIntermNode*> TIntermSequence; typedef TVector<TIntermNode*> TIntermSequence;
@ -1717,10 +1692,8 @@ public:
bool getDebug() const { return debug; } bool getDebug() const { return debug; }
void setPragmaTable(const TPragmaTable& pTable); void setPragmaTable(const TPragmaTable& pTable);
const TPragmaTable& getPragmaTable() const { return *pragmaTable; } const TPragmaTable& getPragmaTable() const { return *pragmaTable; }
#ifndef GLSLANG_WEB
void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; } void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; }
const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; }
#endif
protected: protected:
TIntermAggregate(const TIntermAggregate&); // disallow copy constructor TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
@ -1731,9 +1704,7 @@ protected:
bool optimize; bool optimize;
bool debug; bool debug;
TPragmaTable* pragmaTable; TPragmaTable* pragmaTable;
#ifndef GLSLANG_WEB
TSpirvInstruction spirvInst; TSpirvInstruction spirvInst;
#endif
}; };
// //

View File

@ -177,7 +177,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
break; 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);
@ -227,7 +226,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
break; break;
default: default:
return nullptr; return nullptr;
#endif
} }
} }
break; break;
@ -266,7 +264,6 @@ 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);
@ -277,7 +274,6 @@ 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;
#endif
default: default:
modulo_default: modulo_default:
newConstArray[i] = leftUnionArray[i] % rightUnionArray[i]; newConstArray[i] = leftUnionArray[i] % rightUnionArray[i];
@ -507,14 +503,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
: -unionArray[i].getIConst()); : -unionArray[i].getIConst());
break; break;
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); 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 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;
} }
@ -684,7 +678,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
case EOpConvDoubleToInt: case EOpConvDoubleToInt:
newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break; 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:
@ -919,7 +912,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
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
@ -1066,7 +1058,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
case EbtUint: case EbtUint:
newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
break; 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;
@ -1085,7 +1076,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
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;
@ -1102,7 +1092,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
case EbtUint: case EbtUint:
newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
break; 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;
@ -1121,7 +1110,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
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;
@ -1137,7 +1125,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()),
childConstUnions[2][arg2comp].getUConst())); childConstUnions[2][arg2comp].getUConst()));
break; 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()));
@ -1166,7 +1153,6 @@ 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;

View File

@ -144,10 +144,6 @@ struct Versioning {
EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECompatibilityProfile); EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECompatibilityProfile);
// Declare pointers to put into the table for versioning. // Declare pointers to put into the table for versioning.
#ifdef GLSLANG_WEB
const Versioning* Es300Desktop130 = nullptr;
const Versioning* Es310Desktop420 = nullptr;
#else
const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr }, const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr },
{ EDesktopProfile, 0, 130, 0, nullptr }, { EDesktopProfile, 0, 130, 0, nullptr },
{ EBadProfile } }; { EBadProfile } };
@ -162,7 +158,6 @@ EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECo
{ EDesktopProfile, 0, 450, 0, nullptr }, { EDesktopProfile, 0, 450, 0, nullptr },
{ EBadProfile } }; { EBadProfile } };
const Versioning* Es310Desktop450 = &Es310Desktop450Version[0]; const Versioning* Es310Desktop450 = &Es310Desktop450Version[0];
#endif
// The main descriptor of what a set of function prototypes can look like, and // The main descriptor of what a set of function prototypes can look like, and
// a pointer to extra versioning information, when needed. // a pointer to extra versioning information, when needed.
@ -264,10 +259,8 @@ const BuiltInFunction BaseFunctions[] = {
{ EOpAtomicXor, "atomicXor", 2, TypeIU, ClassV1FIOCV, Es310Desktop420 }, { EOpAtomicXor, "atomicXor", 2, TypeIU, ClassV1FIOCV, Es310Desktop420 },
{ EOpAtomicExchange, "atomicExchange", 2, TypeIU, ClassV1FIOCV, Es310Desktop420 }, { EOpAtomicExchange, "atomicExchange", 2, TypeIU, ClassV1FIOCV, Es310Desktop420 },
{ EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCV, Es310Desktop420 }, { EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCV, Es310Desktop420 },
#ifndef GLSLANG_WEB
{ EOpMix, "mix", 3, TypeB, ClassRegular, Es310Desktop450 }, { EOpMix, "mix", 3, TypeB, ClassRegular, Es310Desktop450 },
{ EOpMix, "mix", 3, TypeIU, ClassLB, Es310Desktop450 }, { EOpMix, "mix", 3, TypeIU, ClassLB, Es310Desktop450 },
#endif
{ EOpNull } { EOpNull }
}; };
@ -386,10 +379,8 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
if (arg == function.numArguments - 1 && (function.classes & ClassLO)) if (arg == function.numArguments - 1 && (function.classes & ClassLO))
decls.append("out "); decls.append("out ");
if (arg == 0) { if (arg == 0) {
#ifndef GLSLANG_WEB
if (function.classes & ClassCV) if (function.classes & ClassCV)
decls.append("coherent volatile "); decls.append("coherent volatile ");
#endif
if (function.classes & ClassFIO) if (function.classes & ClassFIO)
decls.append("inout "); decls.append("inout ");
if (function.classes & ClassFO) if (function.classes & ClassFO)
@ -416,11 +407,6 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
// See if the tabled versioning information allows the current version. // See if the tabled versioning information allows the current version.
bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile, const SpvVersion& /* spVersion */) bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile, const SpvVersion& /* spVersion */)
{ {
#if defined(GLSLANG_WEB)
// all entries in table are valid
return true;
#endif
// nullptr means always valid // nullptr means always valid
if (function.versioning == nullptr) if (function.versioning == nullptr)
return true; return true;
@ -501,7 +487,6 @@ TBuiltIns::TBuiltIns()
prefixes[EbtFloat] = ""; prefixes[EbtFloat] = "";
prefixes[EbtInt] = "i"; prefixes[EbtInt] = "i";
prefixes[EbtUint] = "u"; prefixes[EbtUint] = "u";
#if !defined(GLSLANG_WEB)
prefixes[EbtFloat16] = "f16"; prefixes[EbtFloat16] = "f16";
prefixes[EbtInt8] = "i8"; prefixes[EbtInt8] = "i8";
prefixes[EbtUint8] = "u8"; prefixes[EbtUint8] = "u8";
@ -509,7 +494,6 @@ TBuiltIns::TBuiltIns()
prefixes[EbtUint16] = "u16"; prefixes[EbtUint16] = "u16";
prefixes[EbtInt64] = "i64"; prefixes[EbtInt64] = "i64";
prefixes[EbtUint64] = "u64"; prefixes[EbtUint64] = "u64";
#endif
postfixes[2] = "2"; postfixes[2] = "2";
postfixes[3] = "3"; postfixes[3] = "3";
@ -519,13 +503,11 @@ TBuiltIns::TBuiltIns()
dimMap[Esd2D] = 2; dimMap[Esd2D] = 2;
dimMap[Esd3D] = 3; dimMap[Esd3D] = 3;
dimMap[EsdCube] = 3; dimMap[EsdCube] = 3;
#ifndef GLSLANG_WEB
dimMap[Esd1D] = 1; dimMap[Esd1D] = 1;
dimMap[EsdRect] = 2; dimMap[EsdRect] = 2;
dimMap[EsdBuffer] = 1; dimMap[EsdBuffer] = 1;
dimMap[EsdSubpass] = 2; // potentially unused for now dimMap[EsdSubpass] = 2; // potentially unused for now
dimMap[EsdAttachmentEXT] = 2; // potentially unused for now dimMap[EsdAttachmentEXT] = 2; // potentially unused for now
#endif
} }
TBuiltIns::~TBuiltIns() TBuiltIns::~TBuiltIns()
@ -543,10 +525,6 @@ TBuiltIns::~TBuiltIns()
// //
void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion) void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion)
{ {
#ifdef GLSLANG_WEB
version = 310;
profile = EEsProfile;
#endif
addTabledBuiltins(version, profile, spvVersion); addTabledBuiltins(version, profile, spvVersion);
//============================================================================ //============================================================================
@ -555,7 +533,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
// //
//============================================================================ //============================================================================
#ifndef GLSLANG_WEB
// //
// Derivatives Functions. // Derivatives Functions.
// //
@ -1500,7 +1477,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void atomicStore(coherent volatile out double, double, int, int, int);" "void atomicStore(coherent volatile out double, double, int, int, int);"
"\n"); "\n");
} }
#endif // !GLSLANG_WEB
if ((profile == EEsProfile && version >= 300) || if ((profile == EEsProfile && version >= 300) ||
(profile != EEsProfile && version >= 150)) { // GL_ARB_shader_bit_encoding (profile != EEsProfile && version >= 150)) { // GL_ARB_shader_bit_encoding
@ -1528,7 +1504,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n"); "\n");
} }
#ifndef GLSLANG_WEB
if ((profile != EEsProfile && version >= 400) || if ((profile != EEsProfile && version >= 400) ||
(profile == EEsProfile && version >= 310)) { // GL_OES_gpu_shader5 (profile == EEsProfile && version >= 310)) { // GL_OES_gpu_shader5
@ -1606,7 +1581,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n"); "\n");
} }
#endif
if ((profile == EEsProfile && version >= 300) || if ((profile == EEsProfile && version >= 300) ||
(profile != EEsProfile && version >= 150)) { (profile != EEsProfile && version >= 150)) {
@ -1635,7 +1609,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n"); "\n");
} }
#ifndef GLSLANG_WEB
if ((profile == EEsProfile && version >= 310) || if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 150)) { (profile != EEsProfile && version >= 150)) {
commonBuiltins.append( commonBuiltins.append(
@ -1655,7 +1628,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"vec4 unpackUnorm4x8(highp uint);" "vec4 unpackUnorm4x8(highp uint);"
"\n"); "\n");
} }
#endif
// //
// Matrix Functions. // Matrix Functions.
@ -1714,7 +1686,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
} }
} }
#ifndef GLSLANG_WEB
// //
// Original-style texture functions existing in all stages. // Original-style texture functions existing in all stages.
// (Per-stage functions below.) // (Per-stage functions below.)
@ -4257,7 +4228,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void EndPrimitive();" "void EndPrimitive();"
"\n"); "\n");
} }
#endif // !GLSLANG_WEB
//============================================================================ //============================================================================
// //
@ -4294,7 +4264,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void groupMemoryBarrier();" "void groupMemoryBarrier();"
); );
} }
#ifndef GLSLANG_WEB
if ((profile != EEsProfile && version >= 420) || esBarrier) { if ((profile != EEsProfile && version >= 420) || esBarrier) {
if (spvVersion.vulkan == 0 || spvVersion.vulkanRelaxed) { if (spvVersion.vulkan == 0 || spvVersion.vulkanRelaxed) {
commonBuiltins.append("void memoryBarrierAtomicCounter();"); commonBuiltins.append("void memoryBarrierAtomicCounter();");
@ -4842,7 +4811,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void SetMeshOutputsEXT(uint, uint);" "void SetMeshOutputsEXT(uint, uint);"
"\n"); "\n");
} }
#endif // !GLSLANG_WEB
//============================================================================ //============================================================================
// //
@ -4864,13 +4832,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"highp float diff;" // f - n "highp float diff;" // f - n
); );
} else { } else {
#ifndef GLSLANG_WEB
commonBuiltins.append( commonBuiltins.append(
"float near;" // n "float near;" // n
"float far;" // f "float far;" // f
"float diff;" // f - n "float diff;" // f - n
); );
#endif
} }
commonBuiltins.append( commonBuiltins.append(
@ -4879,7 +4845,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n"); "\n");
} }
#if !defined(GLSLANG_WEB)
if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) { if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) {
// //
// Matrix state. p. 31, 32, 37, 39, 40. // Matrix state. p. 31, 32, 37, 39, 40.
@ -4997,7 +4962,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n"); "\n");
} }
#endif // !GLSLANG_WEB
//============================================================================ //============================================================================
// //
@ -5027,7 +4991,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n"); "\n");
} }
#ifndef GLSLANG_WEB
//============================================================================ //============================================================================
// //
// Define the interface to the mesh/task shader. // Define the interface to the mesh/task shader.
@ -5310,19 +5273,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in highp int gl_InstanceID;" // needs qualifier fixed later "in highp int gl_InstanceID;" // needs qualifier fixed later
); );
if (spvVersion.vulkan > 0) if (spvVersion.vulkan > 0)
#endif
stageBuiltins[EShLangVertex].append( stageBuiltins[EShLangVertex].append(
"in highp int gl_VertexIndex;" "in highp int gl_VertexIndex;"
"in highp int gl_InstanceIndex;" "in highp int gl_InstanceIndex;"
); );
#ifndef GLSLANG_WEB
if (version < 310) if (version < 310)
#endif
stageBuiltins[EShLangVertex].append( stageBuiltins[EShLangVertex].append(
"highp vec4 gl_Position;" // needs qualifier fixed later "highp vec4 gl_Position;" // needs qualifier fixed later
"highp float gl_PointSize;" // needs qualifier fixed later "highp float gl_PointSize;" // needs qualifier fixed later
); );
#ifndef GLSLANG_WEB
else else
stageBuiltins[EShLangVertex].append( stageBuiltins[EShLangVertex].append(
"out gl_PerVertex {" "out gl_PerVertex {"
@ -5800,7 +5759,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"mediump vec2 gl_PointCoord;" // needs qualifier fixed later "mediump vec2 gl_PointCoord;" // needs qualifier fixed later
); );
} }
#endif
if (version >= 300) { if (version >= 300) {
stageBuiltins[EShLangFragment].append( stageBuiltins[EShLangFragment].append(
"highp vec4 gl_FragCoord;" // needs qualifier fixed later "highp vec4 gl_FragCoord;" // needs qualifier fixed later
@ -5809,7 +5767,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"highp float gl_FragDepth;" // needs qualifier fixed later "highp float gl_FragDepth;" // needs qualifier fixed later
); );
} }
#ifndef GLSLANG_WEB
if (version >= 310) { if (version >= 310) {
stageBuiltins[EShLangFragment].append( stageBuiltins[EShLangFragment].append(
"bool gl_HelperInvocation;" // needs qualifier fixed later "bool gl_HelperInvocation;" // needs qualifier fixed later
@ -5854,15 +5811,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"flat in highp int gl_ShadingRateEXT;" // GL_EXT_fragment_shading_rate "flat in highp int gl_ShadingRateEXT;" // GL_EXT_fragment_shading_rate
); );
} }
#endif
stageBuiltins[EShLangFragment].append("\n"); stageBuiltins[EShLangFragment].append("\n");
if (version >= 130) if (version >= 130)
add2ndGenerationSamplingImaging(version, profile, spvVersion); add2ndGenerationSamplingImaging(version, profile, spvVersion);
#ifndef GLSLANG_WEB
if ((profile != EEsProfile && version >= 140) || if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) { (profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangFragment].append( stageBuiltins[EShLangFragment].append(
@ -6254,7 +6208,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
} }
} }
} }
#endif // !GLSLANG_WEB
// printf("%s\n", commonBuiltins.c_str()); // printf("%s\n", commonBuiltins.c_str());
// printf("%s\n", stageBuiltins[EShLangFragment].c_str()); // printf("%s\n", stageBuiltins[EShLangFragment].c_str());
@ -6273,26 +6226,14 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
// enumerate all the types // enumerate all the types
const TBasicType bTypes[] = { EbtFloat, EbtInt, EbtUint, const TBasicType bTypes[] = { EbtFloat, EbtInt, EbtUint,
#if !defined(GLSLANG_WEB) EbtFloat16
EbtFloat16
#endif
}; };
#ifdef GLSLANG_WEB
bool skipBuffer = true;
bool skipCubeArrayed = true;
const int image = 0;
#else
bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140); bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140);
bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130); bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130);
for (int image = 0; image <= 1; ++image) // loop over "bool" image vs sampler for (int image = 0; image <= 1; ++image) // loop over "bool" image vs sampler
#endif
{ {
for (int shadow = 0; shadow <= 1; ++shadow) { // loop over "bool" shadow or not for (int shadow = 0; shadow <= 1; ++shadow) { // loop over "bool" shadow or not
#ifdef GLSLANG_WEB
const int ms = 0;
#else
for (int ms = 0; ms <= 1; ++ms) // loop over "bool" multisample or not for (int ms = 0; ms <= 1; ++ms) // loop over "bool" multisample or not
#endif
{ {
if ((ms || image) && shadow) if ((ms || image) && shadow)
continue; continue;
@ -6304,9 +6245,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
continue; continue;
for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not
#ifdef GLSLANG_WEB
for (int dim = Esd2D; dim <= EsdCube; ++dim) { // 2D, 3D, and Cube
#else
for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass
if (dim == EsdAttachmentEXT) if (dim == EsdAttachmentEXT)
continue; continue;
@ -6330,7 +6268,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
continue; continue;
if (ms && arrayed && profile == EEsProfile && version < 310) if (ms && arrayed && profile == EEsProfile && version < 310)
continue; continue;
#endif
if (dim == Esd3D && shadow) if (dim == Esd3D && shadow)
continue; continue;
if (dim == EsdCube && arrayed && skipCubeArrayed) if (dim == EsdCube && arrayed && skipCubeArrayed)
@ -6340,25 +6277,21 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
// Loop over the bTypes // Loop over the bTypes
for (size_t bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) { for (size_t bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) {
#ifndef GLSLANG_WEB
if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile || version < 450)) if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile || version < 450))
continue; continue;
if (dim == EsdRect && version < 140 && bType > 0) if (dim == EsdRect && version < 140 && bType > 0)
continue; continue;
#endif
if (shadow && (bTypes[bType] == EbtInt || bTypes[bType] == EbtUint)) if (shadow && (bTypes[bType] == EbtInt || bTypes[bType] == EbtUint))
continue; continue;
// //
// Now, make all the function prototypes for the type we just built... // Now, make all the function prototypes for the type we just built...
// //
TSampler sampler; TSampler sampler;
#ifndef GLSLANG_WEB
if (dim == EsdSubpass) { if (dim == EsdSubpass) {
sampler.setSubpass(bTypes[bType], ms ? true : false); sampler.setSubpass(bTypes[bType], ms ? true : false);
} else if (dim == EsdAttachmentEXT) { } else if (dim == EsdAttachmentEXT) {
sampler.setAttachmentEXT(bTypes[bType]); sampler.setAttachmentEXT(bTypes[bType]);
} else } else
#endif
if (image) { if (image) {
sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false, sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,
shadow ? true : false, shadow ? true : false,
@ -6371,12 +6304,10 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
TString typeName = sampler.getString(); TString typeName = sampler.getString();
#ifndef GLSLANG_WEB
if (dim == EsdSubpass) { if (dim == EsdSubpass) {
addSubpassSampling(sampler, typeName, version, profile); addSubpassSampling(sampler, typeName, version, profile);
continue; continue;
} }
#endif
addQueryFunctions(sampler, typeName, version, profile); addQueryFunctions(sampler, typeName, version, profile);
@ -6384,7 +6315,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
addImageFunctions(sampler, typeName, version, profile); addImageFunctions(sampler, typeName, version, profile);
else { else {
addSamplingFunctions(sampler, typeName, version, profile); addSamplingFunctions(sampler, typeName, version, profile);
#ifndef GLSLANG_WEB
addGatherFunctions(sampler, typeName, version, profile); addGatherFunctions(sampler, typeName, version, profile);
if (spvVersion.vulkan > 0 && sampler.isCombined() && !sampler.shadow) { if (spvVersion.vulkan > 0 && sampler.isCombined() && !sampler.shadow) {
// Base Vulkan allows texelFetch() for // Base Vulkan allows texelFetch() for
@ -6400,7 +6330,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
addSamplingFunctions(sampler, textureTypeName, version, profile); addSamplingFunctions(sampler, textureTypeName, version, profile);
addQueryFunctions(sampler, textureTypeName, version, profile); addQueryFunctions(sampler, textureTypeName, version, profile);
} }
#endif
} }
} }
} }
@ -6431,16 +6360,6 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int
int sizeDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0) - (sampler.dim == EsdCube ? 1 : 0); int sizeDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0) - (sampler.dim == EsdCube ? 1 : 0);
#ifdef GLSLANG_WEB
commonBuiltins.append("highp ");
commonBuiltins.append("ivec");
commonBuiltins.append(postfixes[sizeDims]);
commonBuiltins.append(" textureSize(");
commonBuiltins.append(typeName);
commonBuiltins.append(",int);\n");
return;
#endif
if (sampler.isImage() && ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 420))) if (sampler.isImage() && ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 420)))
return; return;
@ -6760,11 +6679,6 @@ void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, in
// //
void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
{ {
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
// //
// texturing // texturing
// //
@ -6839,11 +6753,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
continue; continue;
// loop over 16-bit floating-point texel addressing // loop over 16-bit floating-point texel addressing
#if defined(GLSLANG_WEB)
const int f16TexAddr = 0;
#else
for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr)
#endif
{ {
if (f16TexAddr && sampler.type != EbtFloat16) if (f16TexAddr && sampler.type != EbtFloat16)
continue; continue;
@ -6852,11 +6762,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
totalDims--; totalDims--;
} }
// loop over "bool" lod clamp // loop over "bool" lod clamp
#if defined(GLSLANG_WEB)
const int lodClamp = 0;
#else
for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp)
#endif
{ {
if (lodClamp && (profile == EEsProfile || version < 450)) if (lodClamp && (profile == EEsProfile || version < 450))
continue; continue;
@ -6864,11 +6770,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
continue; continue;
// loop over "bool" sparse or not // loop over "bool" sparse or not
#if defined(GLSLANG_WEB)
const int sparse = 0;
#else
for (int sparse = 0; sparse <= 1; ++sparse) for (int sparse = 0; sparse <= 1; ++sparse)
#endif
{ {
if (sparse && (profile == EEsProfile || version < 450)) if (sparse && (profile == EEsProfile || version < 450))
continue; continue;
@ -7045,11 +6947,6 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
// //
void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
{ {
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
switch (sampler.dim) { switch (sampler.dim) {
case Esd2D: case Esd2D:
case EsdRect: case EsdRect:
@ -7288,11 +7185,6 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in
// //
void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language) void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language)
{ {
#ifdef GLSLANG_WEB
version = 310;
profile = EEsProfile;
#endif
// //
// Initialize the context-dependent (resource-dependent) built-in strings for parsing. // Initialize the context-dependent (resource-dependent) built-in strings for parsing.
// //
@ -7350,7 +7242,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append(builtInConstant); s.append(builtInConstant);
} }
#ifndef GLSLANG_WEB
if (version >= 310) { if (version >= 310) {
// geometry // geometry
@ -7673,7 +7564,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents); snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents);
s.append(builtInConstant); s.append(builtInConstant);
} }
#endif
} }
// compute // compute
@ -7695,7 +7585,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append("\n"); s.append("\n");
} }
#ifndef GLSLANG_WEB
// images (some in compute below) // images (some in compute below)
if ((profile == EEsProfile && version >= 310) || if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 130)) { (profile != EEsProfile && version >= 130)) {
@ -7797,7 +7686,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append("\n"); s.append("\n");
} }
#endif
s.append("\n"); s.append("\n");
} }
@ -7900,11 +7788,6 @@ static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVar
// //
void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable) void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable)
{ {
#ifdef GLSLANG_WEB
version = 310;
profile = EEsProfile;
#endif
// //
// Tag built-in variables and functions with additional qualifier and extension information // Tag built-in variables and functions with additional qualifier and extension information
// that cannot be declared with the text strings. // that cannot be declared with the text strings.
@ -7924,7 +7807,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);
} }
#ifndef GLSLANG_WEB
if (spvVersion.vulkan == 0) { if (spvVersion.vulkan == 0) {
SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable); SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable);
SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable); SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable);
@ -8098,7 +7980,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
case EShLangTessEvaluation: case EShLangTessEvaluation:
case EShLangGeometry: case EShLangGeometry:
#endif // !GLSLANG_WEB
SpecialQualifier("gl_Position", EvqPosition, EbvPosition, symbolTable); SpecialQualifier("gl_Position", EvqPosition, EbvPosition, symbolTable);
SpecialQualifier("gl_PointSize", EvqPointSize, EbvPointSize, symbolTable); SpecialQualifier("gl_PointSize", EvqPointSize, EbvPointSize, symbolTable);
@ -8108,7 +7989,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_out", "gl_Position", EbvPosition, symbolTable); BuiltInVariable("gl_out", "gl_Position", EbvPosition, symbolTable);
BuiltInVariable("gl_out", "gl_PointSize", EbvPointSize, symbolTable); BuiltInVariable("gl_out", "gl_PointSize", EbvPointSize, symbolTable);
#ifndef GLSLANG_WEB
SpecialQualifier("gl_ClipVertex", EvqClipVertex, EbvClipVertex, symbolTable); SpecialQualifier("gl_ClipVertex", EvqClipVertex, EbvClipVertex, symbolTable);
BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable); BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable);
@ -8288,8 +8168,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
} }
} }
#endif // !GLSLANG_WEB
break; break;
case EShLangFragment: case EShLangFragment:
@ -8306,7 +8184,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
} }
} }
SpecialQualifier("gl_FragDepth", EvqFragDepth, EbvFragDepth, symbolTable); SpecialQualifier("gl_FragDepth", EvqFragDepth, EbvFragDepth, symbolTable);
#ifndef GLSLANG_WEB
SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, EbvFragDepth, symbolTable); SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, EbvFragDepth, symbolTable);
SpecialQualifier("gl_FragStencilRefARB", EvqFragStencil, EbvFragStencilRef, symbolTable); SpecialQualifier("gl_FragStencilRefARB", EvqFragStencil, EbvFragStencilRef, symbolTable);
SpecialQualifier("gl_HelperInvocation", EvqVaryingIn, EbvHelperInvocation, symbolTable); SpecialQualifier("gl_HelperInvocation", EvqVaryingIn, EbvHelperInvocation, symbolTable);
@ -8848,7 +8725,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("stencilAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image); symbolTable.setFunctionExtensions("stencilAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
symbolTable.setFunctionExtensions("depthAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image); symbolTable.setFunctionExtensions("depthAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
symbolTable.setFunctionExtensions("colorAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image); symbolTable.setFunctionExtensions("colorAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
#endif // !GLSLANG_WEB
break; break;
case EShLangCompute: case EShLangCompute:
@ -8861,7 +8737,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
#ifndef GLSLANG_WEB
if ((profile != EEsProfile && version >= 140) || if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) { (profile == EEsProfile && version >= 310)) {
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
@ -9010,10 +8885,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
} }
#endif // !GLSLANG_WEB
break; break;
#if !defined(GLSLANG_WEB)
case EShLangRayGen: case EShLangRayGen:
case EShLangIntersect: case EShLangIntersect:
case EShLangAnyHit: case EShLangAnyHit:
@ -9582,7 +9455,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate); symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
} }
break; break;
#endif
default: default:
assert(false && "Language not supported"); assert(false && "Language not supported");
@ -9598,7 +9470,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
relateTabledBuiltins(version, profile, spvVersion, language, symbolTable); relateTabledBuiltins(version, profile, spvVersion, language, symbolTable);
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64); symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64);
symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64); symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64);
symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble); symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble);
@ -10195,7 +10066,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
default: default:
assert(false && "Language not supported"); assert(false && "Language not supported");
} }
#endif // !GLSLANG_WEB
} }
// //
@ -10209,7 +10079,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
// //
void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)
{ {
#ifndef GLSLANG_WEB
if (profile != EEsProfile && version >= 430 && version < 440) { if (profile != EEsProfile && version >= 430 && version < 440) {
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts); symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts);
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &E_GL_ARB_enhanced_layouts); symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &E_GL_ARB_enhanced_layouts);
@ -10281,7 +10150,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
default: default:
break; break;
} }
#endif
} }
} // end namespace glslang } // end namespace glslang

View File

@ -388,7 +388,6 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child,
case EOpConstructFloat: newType = EbtFloat; break; case EOpConstructFloat: newType = EbtFloat; break;
case EOpConstructInt: newType = EbtInt; break; case EOpConstructInt: newType = EbtInt; break;
case EOpConstructUint: newType = EbtUint; break; case EOpConstructUint: newType = EbtUint; break;
#ifndef GLSLANG_WEB
case EOpConstructInt8: newType = EbtInt8; break; case EOpConstructInt8: newType = EbtInt8; break;
case EOpConstructUint8: newType = EbtUint8; break; case EOpConstructUint8: newType = EbtUint8; break;
case EOpConstructInt16: newType = EbtInt16; break; case EOpConstructInt16: newType = EbtInt16; break;
@ -397,7 +396,6 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child,
case EOpConstructUint64: newType = EbtUint64; 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
} }
@ -569,7 +567,6 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const
bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& newOp) const bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& newOp) const
{ {
switch (dst) { switch (dst) {
#ifndef GLSLANG_WEB
case EbtDouble: case EbtDouble:
switch (src) { switch (src) {
case EbtUint: newOp = EOpConvUintToDouble; break; case EbtUint: newOp = EOpConvUintToDouble; break;
@ -587,13 +584,11 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
return false; return false;
} }
break; break;
#endif
case EbtFloat: case EbtFloat:
switch (src) { switch (src) {
case EbtInt: newOp = EOpConvIntToFloat; break; case EbtInt: newOp = EOpConvIntToFloat; break;
case EbtUint: newOp = EOpConvUintToFloat; break; case EbtUint: newOp = EOpConvUintToFloat; break;
case EbtBool: newOp = EOpConvBoolToFloat; break; case EbtBool: newOp = EOpConvBoolToFloat; break;
#ifndef GLSLANG_WEB
case EbtDouble: newOp = EOpConvDoubleToFloat; break; 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;
@ -602,12 +597,10 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
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 false; return false;
} }
break; break;
#ifndef GLSLANG_WEB
case EbtFloat16: case EbtFloat16:
switch (src) { switch (src) {
case EbtInt8: newOp = EOpConvInt8ToFloat16; break; case EbtInt8: newOp = EOpConvInt8ToFloat16; break;
@ -625,13 +618,11 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
return false; return false;
} }
break; break;
#endif
case EbtBool: case EbtBool:
switch (src) { switch (src) {
case EbtInt: newOp = EOpConvIntToBool; break; case EbtInt: newOp = EOpConvIntToBool; break;
case EbtUint: newOp = EOpConvUintToBool; break; case EbtUint: newOp = EOpConvUintToBool; break;
case EbtFloat: newOp = EOpConvFloatToBool; break; case EbtFloat: newOp = EOpConvFloatToBool; break;
#ifndef GLSLANG_WEB
case EbtDouble: newOp = EOpConvDoubleToBool; break; 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;
@ -640,12 +631,10 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
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 false; return false;
} }
break; break;
#ifndef GLSLANG_WEB
case EbtInt8: case EbtInt8:
switch (src) { switch (src) {
case EbtUint8: newOp = EOpConvUint8ToInt8; break; case EbtUint8: newOp = EOpConvUint8ToInt8; break;
@ -715,14 +704,12 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
return false; return false;
} }
break; break;
#endif
case EbtInt: case EbtInt:
switch (src) { switch (src) {
case EbtUint: newOp = EOpConvUintToInt; break; case EbtUint: newOp = EOpConvUintToInt; break;
case EbtBool: newOp = EOpConvBoolToInt; break; case EbtBool: newOp = EOpConvBoolToInt; break;
case EbtFloat: newOp = EOpConvFloatToInt; 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;
@ -731,7 +718,6 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
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 false; return false;
} }
@ -741,7 +727,6 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
case EbtInt: newOp = EOpConvIntToUint; break; case EbtInt: newOp = EOpConvIntToUint; break;
case EbtBool: newOp = EOpConvBoolToUint; break; case EbtBool: newOp = EOpConvBoolToUint; break;
case EbtFloat: newOp = EOpConvFloatToUint; 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;
@ -750,7 +735,6 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
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
// For bindless texture type conversion, add a dummy convert op, just // For bindless texture type conversion, add a dummy convert op, just
// to generate a new TIntermTyped // to generate a new TIntermTyped
// uvec2(any sampler type) // uvec2(any sampler type)
@ -760,7 +744,6 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
return false; return false;
} }
break; break;
#ifndef GLSLANG_WEB
case EbtInt64: case EbtInt64:
switch (src) { switch (src) {
case EbtInt8: newOp = EOpConvInt8ToInt64; break; case EbtInt8: newOp = EOpConvInt8ToInt64; break;
@ -795,7 +778,6 @@ bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& ne
return false; return false;
} }
break; break;
#endif
default: default:
return false; return false;
} }
@ -811,7 +793,6 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
// Add a new newNode for the conversion. // Add a new newNode for the conversion.
// //
#ifndef GLSLANG_WEB
bool convertToIntTypes = (convertTo == EbtInt8 || convertTo == EbtUint8 || bool convertToIntTypes = (convertTo == EbtInt8 || convertTo == EbtUint8 ||
convertTo == EbtInt16 || convertTo == EbtUint16 || convertTo == EbtInt16 || convertTo == EbtUint16 ||
convertTo == EbtInt || convertTo == EbtUint || convertTo == EbtInt || convertTo == EbtUint ||
@ -848,7 +829,6 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
return nullptr; return nullptr;
} }
} }
#endif
TIntermUnary* newNode = nullptr; TIntermUnary* newNode = nullptr;
TOperator newOp = EOpNull; TOperator newOp = EOpNull;
@ -860,13 +840,11 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
newNode = addUnaryNode(newOp, node, node->getLoc(), newType); newNode = addUnaryNode(newOp, node, node->getLoc(), newType);
if (node->getAsConstantUnion()) { if (node->getAsConstantUnion()) {
#ifndef GLSLANG_WEB
// 8/16-bit storage extensions don't support 8/16-bit constants, so don't fold conversions // 8/16-bit storage extensions don't support 8/16-bit constants, so don't fold conversions
// to those types // to those types
if ((getArithemeticInt8Enabled() || !(convertTo == EbtInt8 || convertTo == EbtUint8)) && if ((getArithemeticInt8Enabled() || !(convertTo == EbtInt8 || convertTo == EbtUint8)) &&
(getArithemeticInt16Enabled() || !(convertTo == EbtInt16 || convertTo == EbtUint16)) && (getArithemeticInt16Enabled() || !(convertTo == EbtInt16 || convertTo == EbtUint16)) &&
(getArithemeticFloat16Enabled() || !(convertTo == EbtFloat16))) (getArithemeticFloat16Enabled() || !(convertTo == EbtFloat16)))
#endif
{ {
TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType); TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType);
if (folded) if (folded)
@ -1066,7 +1044,6 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EOpConstructFloat: case EOpConstructFloat:
case EOpConstructInt: case EOpConstructInt:
case EOpConstructUint: case EOpConstructUint:
#ifndef GLSLANG_WEB
case EOpConstructDouble: case EOpConstructDouble:
case EOpConstructFloat16: case EOpConstructFloat16:
case EOpConstructInt8: case EOpConstructInt8:
@ -1077,8 +1054,6 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EOpConstructUint64: case EOpConstructUint64:
break; break;
#endif
// //
// Implicit conversions // Implicit conversions
// //
@ -1166,7 +1141,6 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
} }
bool canPromoteConstant = true; bool canPromoteConstant = true;
#ifndef GLSLANG_WEB
// GL_EXT_shader_16bit_storage can't do OpConstantComposite with // GL_EXT_shader_16bit_storage can't do OpConstantComposite with
// 16-bit types, so disable promotion for those types. // 16-bit types, so disable promotion for those types.
// Many issues with this, from JohnK: // Many issues with this, from JohnK:
@ -1194,7 +1168,6 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
default: default:
break; break;
} }
#endif
if (canPromoteConstant && node->getAsConstantUnion()) if (canPromoteConstant && node->getAsConstantUnion())
return promoteConstantUnion(type.getBasicType(), node->getAsConstantUnion()); return promoteConstantUnion(type.getBasicType(), node->getAsConstantUnion());
@ -1491,10 +1464,6 @@ 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: case EbtInt:
switch(to) { switch(to) {
@ -1575,10 +1544,6 @@ 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 {
@ -1599,7 +1564,6 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
break; break;
} }
break; break;
#ifndef GLSLANG_WEB
case EbtInt8: case EbtInt8:
case EbtUint8: case EbtUint8:
case EbtInt16: case EbtInt16:
@ -1619,7 +1583,6 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
return true; return true;
} }
break; break;
#endif
default: default:
break; break;
} }
@ -1821,10 +1784,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
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) {
@ -1885,11 +1844,6 @@ 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;
@ -2182,7 +2136,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
} }
} }
break; break;
#ifndef GLSLANG_WEB
case EbtDouble: case EbtDouble:
if (type.getMatrixCols()) { if (type.getMatrixCols()) {
switch (type.getMatrixCols()) { switch (type.getMatrixCols()) {
@ -2321,7 +2274,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
case EbtAccStruct: case EbtAccStruct:
op = EOpConstructAccStruct; op = EOpConstructAccStruct;
break; break;
#endif
default: default:
break; break;
} }
@ -2802,7 +2754,6 @@ 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);
@ -2816,7 +2767,6 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
assert(0); assert(0);
break; break;
} }
#endif
return true; return true;
} }
@ -3910,16 +3860,6 @@ 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; \
@ -3936,14 +3876,12 @@ 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 EbtFloat: TO_ALL(getDConst); break; case EbtFloat: TO_ALL(getDConst); break;
case EbtInt: TO_ALL(getIConst); break; case EbtInt: TO_ALL(getIConst); break;
case EbtUint: TO_ALL(getUConst); break; case EbtUint: TO_ALL(getUConst); break;
case EbtBool: TO_ALL(getBConst); break; case EbtBool: TO_ALL(getBConst); break;
#ifndef GLSLANG_WEB
case EbtFloat16: TO_ALL(getDConst); break; 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;
@ -3952,7 +3890,6 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
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 EbtUint64: TO_ALL(getU64Const); break; case EbtUint64: TO_ALL(getU64Const); break;
#endif
default: return node; default: return node;
} }
} }

View File

@ -67,8 +67,6 @@ 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, ...)
{ {
@ -118,8 +116,6 @@ 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.
@ -140,7 +136,6 @@ 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().isReadOnly()) if (node->getQualifier().isReadOnly())
message = "can't modify a readonly buffer"; message = "can't modify a readonly buffer";
@ -151,7 +146,6 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
if (language != EShLangIntersect) if (language != EShLangIntersect)
message = "cannot modify hitAttributeNV in this stage"; message = "cannot modify hitAttributeNV in this stage";
break; break;
#endif
default: default:
// //
@ -165,7 +159,6 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
case EbtVoid: case EbtVoid:
message = "can't modify void"; message = "can't modify void";
break; break;
#ifndef GLSLANG_WEB
case EbtAtomicUint: case EbtAtomicUint:
message = "can't modify an atomic_uint"; message = "can't modify an atomic_uint";
break; break;
@ -178,7 +171,6 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
case EbtHitObjectNV: case EbtHitObjectNV:
message = "can't modify hitObjectNV"; message = "can't modify hitObjectNV";
break; break;
#endif
default: default:
break; break;
} }

File diff suppressed because it is too large Load Diff

View File

@ -104,7 +104,6 @@ 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,
@ -113,7 +112,6 @@ 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;
@ -331,10 +329,8 @@ 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); 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 handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base); void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base);
@ -467,7 +463,6 @@ public:
const TTypeList* recordStructCopy(TStructRecord&, const TType*, const TType*); const TTypeList* recordStructCopy(TStructRecord&, const TType*, const TType*);
TLayoutFormat mapLegacyLayoutFormat(TLayoutFormat legacyLayoutFormat, TBasicType imageType); TLayoutFormat mapLegacyLayoutFormat(TLayoutFormat legacyLayoutFormat, TBasicType imageType);
#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;
@ -494,8 +489,6 @@ public:
TSpirvInstruction* makeSpirvInstruction(const TSourceLoc& loc, const TString& name, int value); TSpirvInstruction* makeSpirvInstruction(const TSourceLoc& loc, const TString& name, int value);
TSpirvInstruction* mergeSpirvInstruction(const TSourceLoc& loc, TSpirvInstruction* spirvInst1, TSpirvInstruction* mergeSpirvInstruction(const TSourceLoc& loc, TSpirvInstruction* spirvInst1,
TSpirvInstruction* spirvInst2); TSpirvInstruction* spirvInst2);
#endif
void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember); void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember);
protected: protected:
@ -508,9 +501,7 @@ 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
virtual const char* getGlobalUniformBlockName() const override; virtual const char* getGlobalUniformBlockName() const override;
virtual void finalizeGlobalUniformBlockLayout(TVariable&) override; virtual void finalizeGlobalUniformBlockLayout(TVariable&) override;
@ -547,7 +538,6 @@ protected:
TQualifier globalOutputDefaults; TQualifier globalOutputDefaults;
TQualifier globalSharedDefaults; TQualifier globalSharedDefaults;
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)
#ifndef GLSLANG_WEB
int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point
bool anyIndexLimits; bool anyIndexLimits;
TIdSetType inductiveLoopIds; TIdSetType inductiveLoopIds;
@ -588,7 +578,6 @@ protected:
// array-sizing declarations // array-sizing declarations
// //
TVector<TSymbol*> ioArraySymbolResizeList; TVector<TSymbol*> ioArraySymbolResizeList;
#endif
}; };
} // end namespace glslang } // end namespace glslang

View File

@ -324,9 +324,7 @@ 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
} }
@ -409,7 +407,6 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["uvec3"] = UVEC3; (*KeywordMap)["uvec3"] = UVEC3;
(*KeywordMap)["uvec4"] = UVEC4; (*KeywordMap)["uvec4"] = UVEC4;
#ifndef GLSLANG_WEB
(*KeywordMap)["nonuniformEXT"] = NONUNIFORM; (*KeywordMap)["nonuniformEXT"] = NONUNIFORM;
(*KeywordMap)["demote"] = DEMOTE; (*KeywordMap)["demote"] = DEMOTE;
(*KeywordMap)["attribute"] = ATTRIBUTE; (*KeywordMap)["attribute"] = ATTRIBUTE;
@ -599,7 +596,6 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["spirv_storage_class"] = SPIRV_STORAGE_CLASS; (*KeywordMap)["spirv_storage_class"] = SPIRV_STORAGE_CLASS;
(*KeywordMap)["spirv_by_reference"] = SPIRV_BY_REFERENCE; (*KeywordMap)["spirv_by_reference"] = SPIRV_BY_REFERENCE;
(*KeywordMap)["spirv_literal"] = SPIRV_LITERAL; (*KeywordMap)["spirv_literal"] = SPIRV_LITERAL;
#endif
(*KeywordMap)["sampler2D"] = SAMPLER2D; (*KeywordMap)["sampler2D"] = SAMPLER2D;
(*KeywordMap)["samplerCube"] = SAMPLERCUBE; (*KeywordMap)["samplerCube"] = SAMPLERCUBE;
@ -633,7 +629,6 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["sampler"] = SAMPLER; (*KeywordMap)["sampler"] = SAMPLER;
(*KeywordMap)["samplerShadow"] = SAMPLERSHADOW; (*KeywordMap)["samplerShadow"] = SAMPLERSHADOW;
#ifndef GLSLANG_WEB
(*KeywordMap)["textureCubeArray"] = TEXTURECUBEARRAY; (*KeywordMap)["textureCubeArray"] = TEXTURECUBEARRAY;
(*KeywordMap)["itextureCubeArray"] = ITEXTURECUBEARRAY; (*KeywordMap)["itextureCubeArray"] = ITEXTURECUBEARRAY;
(*KeywordMap)["utextureCubeArray"] = UTEXTURECUBEARRAY; (*KeywordMap)["utextureCubeArray"] = UTEXTURECUBEARRAY;
@ -814,17 +809,14 @@ 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.
@ -905,14 +897,12 @@ 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; 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 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();
@ -934,10 +924,8 @@ 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()) {
@ -1060,7 +1048,6 @@ int TScanContext::tokenizeIdentifier()
return identifierOrReserved(reserved); return identifierOrReserved(reserved);
} }
#ifndef GLSLANG_WEB
case NOPERSPECTIVE: case NOPERSPECTIVE:
if (parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation)) if (parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation))
return keyword; return keyword;
@ -1147,7 +1134,7 @@ int TScanContext::tokenizeIdentifier()
case SUBROUTINE: case SUBROUTINE:
return es30ReservedFromGLSL(400); return es30ReservedFromGLSL(400);
#endif
case SHARED: case SHARED:
if ((parseContext.isEsProfile() && parseContext.version < 300) || if ((parseContext.isEsProfile() && parseContext.version < 300) ||
(!parseContext.isEsProfile() && parseContext.version < 140)) (!parseContext.isEsProfile() && parseContext.version < 140))
@ -1182,7 +1169,6 @@ 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:
@ -1487,7 +1473,6 @@ int TScanContext::tokenizeIdentifier()
return keyword; return keyword;
else else
return identifierOrType(); return identifierOrType();
#endif
case UINT: case UINT:
case UVEC2: case UVEC2:
@ -1542,7 +1527,6 @@ int TScanContext::tokenizeIdentifier()
else else
return identifierOrType(); return identifierOrType();
#ifndef GLSLANG_WEB
case ISAMPLER1D: case ISAMPLER1D:
case ISAMPLER1DARRAY: case ISAMPLER1DARRAY:
case SAMPLER1DARRAYSHADOW: case SAMPLER1DARRAYSHADOW:
@ -1824,7 +1808,6 @@ int TScanContext::tokenizeIdentifier()
&& parseContext.extensionTurnedOn(E_GL_NV_shader_invocation_reorder))) && parseContext.extensionTurnedOn(E_GL_NV_shader_invocation_reorder)))
return keyword; return keyword;
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);

View File

@ -295,11 +295,6 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi
EShLanguage language, EShSource source, TInfoSink& infoSink, TSymbolTable** commonTable, EShLanguage language, EShSource source, TInfoSink& infoSink, TSymbolTable** commonTable,
TSymbolTable** symbolTables) TSymbolTable** symbolTables)
{ {
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
(*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]); (*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]);
InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spvVersion, language, source, InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spvVersion, language, source,
infoSink, *symbolTables[language]); infoSink, *symbolTables[language]);
@ -316,11 +311,6 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi
// //
bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, const SpvVersion& spvVersion, EShSource source) bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, const SpvVersion& spvVersion, EShSource source)
{ {
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
std::unique_ptr<TBuiltInParseables> builtInParseables(CreateBuiltInParseables(infoSink, source)); std::unique_ptr<TBuiltInParseables> builtInParseables(CreateBuiltInParseables(infoSink, source));
if (builtInParseables == nullptr) if (builtInParseables == nullptr)
@ -343,7 +333,6 @@ 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)) {
@ -392,7 +381,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
(profile == EEsProfile && version >= 320)) (profile == EEsProfile && version >= 320))
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTask, source, InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTask, source,
infoSink, commonTable, symbolTables); infoSink, commonTable, symbolTables);
#endif // !GLSLANG_WEB
return true; return true;
} }
@ -494,13 +482,11 @@ 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)
{ {
#if !defined(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.
@ -598,7 +584,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
break; break;
} }
#if !defined(GLSLANG_WEB)
// Correct for stage type... // Correct for stage type...
switch (stage) { switch (stage) {
case EShLangGeometry: case EShLangGeometry:
@ -686,7 +671,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
break; break;
} }
} }
#endif
return correct; return correct;
} }
@ -876,7 +860,6 @@ 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) {
#if !defined(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 ("
@ -884,7 +867,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;
@ -899,13 +882,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);
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst)); bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst));
#if !defined(GLSLANG_WEB)
bool warnVersionNotFirst = false; bool warnVersionNotFirst = false;
if (! versionWillBeError && versionNotFirstToken) { if (! versionWillBeError && versionNotFirstToken) {
if (messages & EShMsgRelaxedErrors) if (messages & EShMsgRelaxedErrors)
@ -913,7 +890,6 @@ bool ProcessDeferred(
else else
versionWillBeError = true; versionWillBeError = true;
} }
#endif
intermediate.setSource(source); intermediate.setSource(source);
intermediate.setVersion(version); intermediate.setVersion(version);
@ -978,13 +954,11 @@ bool ProcessDeferred(
parseContext->setLimits(*resources); parseContext->setLimits(*resources);
if (! goodVersion) if (! goodVersion)
parseContext->addError(); parseContext->addError();
#if !defined(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();
@ -1016,8 +990,6 @@ bool ProcessDeferred(
return success; return success;
} }
#if !defined(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.
@ -1214,8 +1186,6 @@ 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{
@ -1246,7 +1216,6 @@ struct DoFullParse{
} }
}; };
#if !defined(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
@ -1281,7 +1250,6 @@ bool PreprocessDeferred(
forwardCompatible, messages, intermediate, parser, forwardCompatible, messages, intermediate, parser,
false, includer, "", environment); false, includer, "", environment);
} }
#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
@ -1831,8 +1799,6 @@ void TShader::setDxPositionW(bool invert) { intermediate->setDxPos
void TShader::setEnhancedMsgs() { intermediate->setEnhancedMsgs(); } void TShader::setEnhancedMsgs() { intermediate->setEnhancedMsgs(); }
void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); } 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);
@ -1874,7 +1840,6 @@ void TShader::setUniformLocationBase(int base)
void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); } void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
void TShader::setResourceSetBinding(const std::vector<std::string>& base) { intermediate->setResourceSetBinding(base); } void TShader::setResourceSetBinding(const std::vector<std::string>& base) { intermediate->setResourceSetBinding(base); }
void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); } void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); }
#endif
void TShader::addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing) { intermediate->addBlockStorageOverride(nameStr, backing); } void TShader::addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing) { intermediate->addBlockStorageOverride(nameStr, backing); }
@ -1913,7 +1878,6 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
&environment); &environment);
} }
#if !defined(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.
// //
@ -1939,7 +1903,6 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources,
forwardCompatible, message, includer, *intermediate, output_string, forwardCompatible, message, includer, *intermediate, output_string,
&environment); &environment);
} }
#endif
const char* TShader::getInfoLog() const char* TShader::getInfoLog()
{ {
@ -1951,11 +1914,7 @@ const char* TShader::getInfoDebugLog()
return infoSink->debug.c_str(); return infoSink->debug.c_str();
} }
TProgram::TProgram() : TProgram::TProgram() : reflection(nullptr), linked(false)
#if !defined(GLSLANG_WEB)
reflection(nullptr),
#endif
linked(false)
{ {
pool = new TPoolAllocator; pool = new TPoolAllocator;
infoSink = new TInfoSink; infoSink = new TInfoSink;
@ -1968,9 +1927,7 @@ TProgram::TProgram() :
TProgram::~TProgram() TProgram::~TProgram()
{ {
delete infoSink; delete infoSink;
#if !defined(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])
@ -2018,7 +1975,6 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
if (stages[stage].size() == 0) if (stages[stage].size() == 0)
return true; return true;
#if !defined(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) {
@ -2069,9 +2025,6 @@ 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)
@ -2153,8 +2106,6 @@ const char* TProgram::getInfoDebugLog()
return infoSink->debug.c_str(); return infoSink->debug.c_str();
} }
#if !defined(GLSLANG_WEB)
// //
// Reflection implementation. // Reflection implementation.
// //
@ -2235,6 +2186,4 @@ 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

View File

@ -33,8 +33,6 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#ifndef GLSLANG_WEB
// //
// GL_EXT_spirv_intrinsics // GL_EXT_spirv_intrinsics
// //
@ -360,5 +358,3 @@ TSpirvInstruction* TParseContext::mergeSpirvInstruction(const TSourceLoc& loc, T
} }
} // end namespace glslang } // end namespace glslang
#endif // GLSLANG_WEB

View File

@ -65,7 +65,6 @@ void TType::buildMangledName(TString& mangledName) const
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; case EbtBool: mangledName += 'b'; break;
#ifndef GLSLANG_WEB
case EbtDouble: mangledName += 'd'; break; case EbtDouble: mangledName += 'd'; break;
case EbtFloat16: mangledName += "f16"; break; case EbtFloat16: mangledName += "f16"; break;
case EbtInt8: mangledName += "i8"; break; case EbtInt8: mangledName += "i8"; break;
@ -79,12 +78,9 @@ void TType::buildMangledName(TString& mangledName) const
case EbtRayQuery: mangledName += "rq"; break; case EbtRayQuery: mangledName += "rq"; break;
case EbtSpirvType: mangledName += "spv-t"; break; case EbtSpirvType: mangledName += "spv-t"; break;
case EbtHitObjectNV: mangledName += "ho"; break; case EbtHitObjectNV: mangledName += "ho"; break;
#endif
case EbtSampler: case EbtSampler:
switch (sampler.type) { switch (sampler.type) {
#ifndef GLSLANG_WEB
case EbtFloat16: mangledName += "f16"; break; case EbtFloat16: mangledName += "f16"; break;
#endif
case EbtInt: mangledName += "i"; break; case EbtInt: mangledName += "i"; break;
case EbtUint: mangledName += "u"; break; case EbtUint: mangledName += "u"; break;
case EbtInt64: mangledName += "i64"; break; case EbtInt64: mangledName += "i64"; break;
@ -111,12 +107,10 @@ void TType::buildMangledName(TString& mangledName) const
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 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
} }
@ -184,8 +178,6 @@ void TType::buildMangledName(TString& mangledName) const
} }
} }
#if !defined(GLSLANG_WEB)
// //
// Dump functions. // Dump functions.
// //
@ -264,8 +256,6 @@ void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const
} }
} }
#endif
// //
// Functions have buried pointers to delete. // Functions have buried pointers to delete.
// //
@ -398,9 +388,7 @@ TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf)
implicitThis = copyOf.implicitThis; implicitThis = copyOf.implicitThis;
illegalImplicitThis = copyOf.illegalImplicitThis; illegalImplicitThis = copyOf.illegalImplicitThis;
defaultParamCount = copyOf.defaultParamCount; defaultParamCount = copyOf.defaultParamCount;
#ifndef GLSLANG_WEB
spirvInst = copyOf.spirvInst; spirvInst = copyOf.spirvInst;
#endif
} }
TFunction* TFunction::clone() const TFunction* TFunction::clone() const

View File

@ -117,10 +117,8 @@ 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(); }
#if !defined(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; }
@ -196,9 +194,7 @@ public:
} }
virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); } virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); }
#if !defined(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&);
@ -321,18 +317,14 @@ public:
virtual const TParameter& operator[](int i) const { return parameters[i]; } virtual const TParameter& operator[](int i) const { return parameters[i]; }
const TQualifier& getQualifier() const { return returnType.getQualifier(); } const TQualifier& getQualifier() const { return returnType.getQualifier(); }
#ifndef GLSLANG_WEB
virtual void setSpirvInstruction(const TSpirvInstruction& inst) virtual void setSpirvInstruction(const TSpirvInstruction& inst)
{ {
relateToOperator(EOpSpirvInst); relateToOperator(EOpSpirvInst);
spirvInst = inst; spirvInst = inst;
} }
virtual const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } virtual const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; }
#endif
#if !defined(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&);
@ -354,9 +346,7 @@ protected:
// but is not allowed to use them, or see hidden symbols instead. // but is not allowed to use them, or see hidden symbols instead.
int defaultParamCount; int defaultParamCount;
#ifndef GLSLANG_WEB
TSpirvInstruction spirvInst; // SPIR-V instruction qualifiers TSpirvInstruction spirvInst; // SPIR-V instruction qualifiers
#endif
}; };
// //
@ -396,9 +386,7 @@ 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; }
#if !defined(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&);
@ -583,9 +571,7 @@ 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[]);
#if !defined(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();
@ -913,9 +899,7 @@ public:
} }
long long getMaxSymbolId() { return uniqueId; } long long getMaxSymbolId() { return uniqueId; }
#if !defined(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); }

View File

@ -151,8 +151,6 @@
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
@ -385,8 +383,6 @@ void TParseVersions::initializeExtensionBehavior()
spvUnsupportedExt.push_back(E_GL_ARB_bindless_texture); spvUnsupportedExt.push_back(E_GL_ARB_bindless_texture);
} }
#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)
@ -395,9 +391,6 @@ void TParseVersions::getPreamble(std::string& preamble)
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"
@ -596,11 +589,8 @@ void TParseVersions::getPreamble(std::string& preamble)
if (version >= 130) { if (version >= 130) {
preamble +="#define GL_FRAGMENT_PRECISION_HIGH 1\n"; preamble +="#define GL_FRAGMENT_PRECISION_HIGH 1\n";
} }
#endif // GLSLANG_WEB
} }
#ifndef GLSLANG_WEB
if ((!isEsProfile() && version >= 140) || if ((!isEsProfile() && version >= 140) ||
(isEsProfile() && version >= 310)) { (isEsProfile() && version >= 310)) {
preamble += preamble +=
@ -628,7 +618,6 @@ void TParseVersions::getPreamble(std::string& preamble)
preamble += preamble +=
"#define GL_EXT_terminate_invocation 1\n" "#define GL_EXT_terminate_invocation 1\n"
; ;
#endif
// #define VULKAN XXXX // #define VULKAN XXXX
const int numberBufSize = 12; const int numberBufSize = 12;
@ -640,7 +629,6 @@ void TParseVersions::getPreamble(std::string& preamble)
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 ";
@ -648,9 +636,7 @@ void TParseVersions::getPreamble(std::string& preamble)
preamble += numberBuf; preamble += numberBuf;
preamble += "\n"; preamble += "\n";
} }
#endif
#ifndef GLSLANG_WEB
// GL_EXT_spirv_intrinsics // GL_EXT_spirv_intrinsics
if (!isEsProfile()) { if (!isEsProfile()) {
switch (language) { switch (language) {
@ -671,7 +657,6 @@ void TParseVersions::getPreamble(std::string& preamble)
default: break; default: break;
} }
} }
#endif
} }
// //
@ -683,7 +668,6 @@ const char* StageName(EShLanguage stage)
case EShLangVertex: return "vertex"; case EShLangVertex: return "vertex";
case EShLangFragment: return "fragment"; case EShLangFragment: return "fragment";
case EShLangCompute: return "compute"; case EShLangCompute: return "compute";
#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";
@ -695,7 +679,6 @@ const char* StageName(EShLanguage stage)
case EShLangCallable: return "callable"; case EShLangCallable: return "callable";
case EShLangMesh: return "mesh"; case EShLangMesh: return "mesh";
case EShLangTask: return "task"; case EShLangTask: return "task";
#endif
default: return "unknown stage"; default: return "unknown stage";
} }
} }
@ -720,7 +703,6 @@ 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(): // When to use requireProfile():
// //
@ -758,7 +740,6 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
{ {
if (profile & profileMask) { if (profile & profileMask) {
bool okay = minVersion > 0 && version >= minVersion; bool okay = minVersion > 0 && version >= minVersion;
#ifndef GLSLANG_WEB
for (int i = 0; i < numExtensions; ++i) { for (int i = 0; i < numExtensions; ++i) {
switch (getExtensionBehavior(extensions[i])) { switch (getExtensionBehavior(extensions[i])) {
case EBhWarn: case EBhWarn:
@ -771,7 +752,6 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
default: break; // some compilers want this default: break; // some compilers want this
} }
} }
#endif
if (! okay) if (! okay)
error(loc, "not supported for this version or the enabled extensions", featureDesc, ""); error(loc, "not supported for this version or the enabled extensions", featureDesc, "");
} }
@ -1362,7 +1342,7 @@ void TParseVersions::coopmatCheck(const TSourceLoc& loc, const char* op, bool bu
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)
{ {
@ -1380,26 +1360,20 @@ 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
} }
void TParseVersions::requireSpv(const TSourceLoc& loc, const char *op, unsigned int version) void TParseVersions::requireSpv(const TSourceLoc& loc, const char *op, unsigned int version)
{ {
#ifndef GLSLANG_WEB
if (spvVersion.spv < version) if (spvVersion.spv < version)
error(loc, "not supported for current targeted SPIR-V version", op, ""); error(loc, "not supported for current targeted SPIR-V version", op, "");
#endif
} }
} // end namespace glslang } // end namespace glslang

View File

@ -34,8 +34,6 @@
// 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"
@ -367,5 +365,3 @@ void TParseContext::handleFunctionAttributes(const TSourceLoc& loc, const TAttri
} }
} // end namespace glslang } // end namespace glslang
#endif // GLSLANG_WEB

View File

@ -42,26 +42,9 @@
// The .y bison file is not a source file, it is a derivative of the .m4 file. // The .y bison file is not a source file, it is a derivative of the .m4 file.
// The m4 file needs to be processed by m4 to generate the .y bison file. // The m4 file needs to be processed by m4 to generate the .y bison file.
// //
// Code sandwiched between a pair:
//
// GLSLANG_WEB_EXCLUDE_ON
// ...
// ...
// ...
// GLSLANG_WEB_EXCLUDE_OFF
//
// Will be excluded from the grammar when m4 is executed as:
//
// m4 -P -DGLSLANG_WEB
//
// It will be included when m4 is executed as:
//
// m4 -P // m4 -P
// //
m4_define(`GLSLANG_WEB_EXCLUDE_ON', `m4_ifdef(`GLSLANG_WEB', `m4_divert(`-1')')')
m4_define(`GLSLANG_WEB_EXCLUDE_OFF', `m4_ifdef(`GLSLANG_WEB', `m4_divert')')
/** /**
* This is bison grammar and productions for parsing all versions of the * This is bison grammar and productions for parsing all versions of the
* GLSL shading languages. * GLSL shading languages.
@ -177,8 +160,6 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY %token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY
%token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY %token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY
GLSLANG_WEB_EXCLUDE_ON
%token <lex> ATTRIBUTE VARYING %token <lex> ATTRIBUTE VARYING
%token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T %token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T
%token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T %token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T
@ -282,8 +263,6 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL %token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL
%token <lex> ATTACHMENTEXT IATTACHMENTEXT UATTACHMENTEXT %token <lex> ATTACHMENTEXT IATTACHMENTEXT UATTACHMENTEXT
GLSLANG_WEB_EXCLUDE_OFF
%token <lex> LEFT_OP RIGHT_OP %token <lex> LEFT_OP RIGHT_OP
%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
@ -309,7 +288,6 @@ GLSLANG_WEB_EXCLUDE_OFF
%token <lex> UNIFORM SHARED BUFFER TILEIMAGEEXT %token <lex> UNIFORM SHARED BUFFER TILEIMAGEEXT
%token <lex> FLAT SMOOTH LAYOUT %token <lex> FLAT SMOOTH LAYOUT
GLSLANG_WEB_EXCLUDE_ON
%token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT %token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT
%token <lex> INT64CONSTANT UINT64CONSTANT %token <lex> INT64CONSTANT UINT64CONSTANT
%token <lex> SUBROUTINE DEMOTE %token <lex> SUBROUTINE DEMOTE
@ -320,7 +298,6 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT %token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT %token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT
%token <lex> PRECISE %token <lex> PRECISE
GLSLANG_WEB_EXCLUDE_OFF
%type <interm> assignment_operator unary_operator %type <interm> assignment_operator unary_operator
%type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression %type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
@ -367,7 +344,6 @@ GLSLANG_WEB_EXCLUDE_OFF
%type <interm.identifierList> identifier_list %type <interm.identifierList> identifier_list
GLSLANG_WEB_EXCLUDE_ON
%type <interm.type> precise_qualifier non_uniform_qualifier %type <interm.type> precise_qualifier non_uniform_qualifier
%type <interm.typeList> type_name_list %type <interm.typeList> type_name_list
%type <interm.attributes> attribute attribute_list single_attribute %type <interm.attributes> attribute attribute_list single_attribute
@ -386,7 +362,6 @@ GLSLANG_WEB_EXCLUDE_ON
%type <interm.spirvTypeParams> spirv_type_parameter_list spirv_type_parameter %type <interm.spirvTypeParams> spirv_type_parameter_list spirv_type_parameter
%type <interm.spirvInst> spirv_instruction_qualifier %type <interm.spirvInst> spirv_instruction_qualifier
%type <interm.spirvInst> spirv_instruction_qualifier_list spirv_instruction_qualifier_id %type <interm.spirvInst> spirv_instruction_qualifier_list spirv_instruction_qualifier_id
GLSLANG_WEB_EXCLUDE_OFF
%start translation_unit %start translation_unit
%% %%
@ -419,7 +394,6 @@ primary_expression
| BOOLCONSTANT { | BOOLCONSTANT {
$$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
} }
GLSLANG_WEB_EXCLUDE_ON
| STRING_LITERAL { | STRING_LITERAL {
$$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true);
} }
@ -457,7 +431,6 @@ GLSLANG_WEB_EXCLUDE_ON
parseContext.float16Check($1.loc, "half float literal"); parseContext.float16Check($1.loc, "half float literal");
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true);
} }
GLSLANG_WEB_EXCLUDE_OFF
; ;
postfix_expression postfix_expression
@ -583,13 +556,11 @@ function_identifier
$$.function = new TFunction(empty, TType(EbtVoid), EOpNull); $$.function = new TFunction(empty, TType(EbtVoid), EOpNull);
} }
} }
GLSLANG_WEB_EXCLUDE_ON
| non_uniform_qualifier { | non_uniform_qualifier {
// Constructor // Constructor
$$.intermNode = 0; $$.intermNode = 0;
$$.function = parseContext.handleConstructorCall($1.loc, $1); $$.function = parseContext.handleConstructorCall($1.loc, $1);
} }
GLSLANG_WEB_EXCLUDE_OFF
; ;
unary_expression unary_expression
@ -899,7 +870,6 @@ declaration
$$ = 0; $$ = 0;
// TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
} }
GLSLANG_WEB_EXCLUDE_ON
| spirv_instruction_qualifier function_prototype SEMICOLON { | spirv_instruction_qualifier function_prototype SEMICOLON {
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier"); parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier");
$2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier $2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier
@ -912,7 +882,6 @@ GLSLANG_WEB_EXCLUDE_ON
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier"); parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier");
$$ = 0; $$ = 0;
} }
GLSLANG_WEB_EXCLUDE_OFF
| init_declarator_list SEMICOLON { | init_declarator_list SEMICOLON {
if ($1.intermNode && $1.intermNode->getAsAggregate()) if ($1.intermNode && $1.intermNode->getAsAggregate())
$1.intermNode->getAsAggregate()->setOperator(EOpSequence); $1.intermNode->getAsAggregate()->setOperator(EOpSequence);
@ -1182,9 +1151,7 @@ single_declaration
: fully_specified_type { : fully_specified_type {
$$.type = $1; $$.type = $1;
$$.intermNode = 0; $$.intermNode = 0;
GLSLANG_WEB_EXCLUDE_ON
parseContext.declareTypeDefaults($$.loc, $$.type); parseContext.declareTypeDefaults($$.loc, $$.type);
GLSLANG_WEB_EXCLUDE_OFF
} }
| fully_specified_type IDENTIFIER { | fully_specified_type IDENTIFIER {
$$.type = $1; $$.type = $1;
@ -1270,7 +1237,6 @@ interpolation_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.flat = true; $$.qualifier.flat = true;
} }
GLSLANG_WEB_EXCLUDE_ON
| NOPERSPECTIVE { | NOPERSPECTIVE {
parseContext.globalCheck($1.loc, "noperspective"); parseContext.globalCheck($1.loc, "noperspective");
parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective");
@ -1335,7 +1301,6 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.perTaskNV = true; $$.qualifier.perTaskNV = true;
} }
GLSLANG_WEB_EXCLUDE_OFF
; ;
layout_qualifier layout_qualifier
@ -1370,7 +1335,6 @@ layout_qualifier_id
} }
; ;
GLSLANG_WEB_EXCLUDE_ON
precise_qualifier precise_qualifier
: PRECISE { : PRECISE {
parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise");
@ -1379,7 +1343,6 @@ precise_qualifier
$$.qualifier.noContraction = true; $$.qualifier.noContraction = true;
} }
; ;
GLSLANG_WEB_EXCLUDE_OFF
type_qualifier type_qualifier
: single_type_qualifier { : single_type_qualifier {
@ -1414,7 +1377,6 @@ single_type_qualifier
// allow inheritance of storage qualifier from block declaration // allow inheritance of storage qualifier from block declaration
$$ = $1; $$ = $1;
} }
GLSLANG_WEB_EXCLUDE_ON
| precise_qualifier { | precise_qualifier {
// allow inheritance of storage qualifier from block declaration // allow inheritance of storage qualifier from block declaration
$$ = $1; $$ = $1;
@ -1441,7 +1403,6 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.setSpirvLiteral(); $$.qualifier.setSpirvLiteral();
} }
GLSLANG_WEB_EXCLUDE_OFF
; ;
storage_qualifier storage_qualifier
@ -1496,7 +1457,6 @@ storage_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqBuffer; $$.qualifier.storage = EvqBuffer;
} }
GLSLANG_WEB_EXCLUDE_ON
| ATTRIBUTE { | ATTRIBUTE {
parseContext.requireStage($1.loc, EShLangVertex, "attribute"); parseContext.requireStage($1.loc, EShLangVertex, "attribute");
parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute"); parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
@ -1689,10 +1649,8 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqtaskPayloadSharedEXT; $$.qualifier.storage = EvqtaskPayloadSharedEXT;
} }
GLSLANG_WEB_EXCLUDE_OFF
; ;
GLSLANG_WEB_EXCLUDE_ON
non_uniform_qualifier non_uniform_qualifier
: NONUNIFORM { : NONUNIFORM {
$$.init($1.loc); $$.init($1.loc);
@ -1710,7 +1668,6 @@ type_name_list
// 2) save all of the identifiers for future comparison with the declared function // 2) save all of the identifiers for future comparison with the declared function
} }
; ;
GLSLANG_WEB_EXCLUDE_OFF
type_specifier type_specifier
: type_specifier_nonarray type_parameter_specifier_opt { : type_specifier_nonarray type_parameter_specifier_opt {
@ -1940,7 +1897,6 @@ type_specifier_nonarray
$$.basicType = EbtFloat; $$.basicType = EbtFloat;
$$.setMatrix(4, 4); $$.setMatrix(4, 4);
} }
GLSLANG_WEB_EXCLUDE_ON
| DOUBLE { | DOUBLE {
parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double"); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double");
if (! parseContext.symbolTable.atBuiltInLevel()) if (! parseContext.symbolTable.atBuiltInLevel())
@ -2559,7 +2515,6 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd1D); $$.sampler.set(EbtFloat, Esd1D);
} }
GLSLANG_WEB_EXCLUDE_OFF
| SAMPLER2D { | SAMPLER2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2595,7 +2550,6 @@ GLSLANG_WEB_EXCLUDE_OFF
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true, true); $$.sampler.set(EbtFloat, Esd2D, true, true);
} }
GLSLANG_WEB_EXCLUDE_ON
| SAMPLER1DSHADOW { | SAMPLER1DSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2704,7 +2658,6 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtInt, Esd1D); $$.sampler.set(EbtInt, Esd1D);
} }
GLSLANG_WEB_EXCLUDE_OFF
| ISAMPLER2D { | ISAMPLER2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2740,7 +2693,6 @@ GLSLANG_WEB_EXCLUDE_OFF
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtUint, EsdCube); $$.sampler.set(EbtUint, EsdCube);
} }
GLSLANG_WEB_EXCLUDE_ON
| ISAMPLER1DARRAY { | ISAMPLER1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2781,7 +2733,6 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube, true); $$.sampler.setTexture(EbtUint, EsdCube, true);
} }
GLSLANG_WEB_EXCLUDE_OFF
| USAMPLER2DARRAY { | USAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2857,7 +2808,6 @@ GLSLANG_WEB_EXCLUDE_OFF
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setPureSampler(true); $$.sampler.setPureSampler(true);
} }
GLSLANG_WEB_EXCLUDE_ON
| SAMPLER2DRECT { | SAMPLER2DRECT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -3566,7 +3516,6 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtHitObjectNV; $$.basicType = EbtHitObjectNV;
} }
GLSLANG_WEB_EXCLUDE_OFF
| struct_specifier { | struct_specifier {
$$ = $1; $$ = $1;
$$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@ -3721,7 +3670,6 @@ initializer
: assignment_expression { : assignment_expression {
$$ = $1; $$ = $1;
} }
GLSLANG_WEB_EXCLUDE_ON
| LEFT_BRACE initializer_list RIGHT_BRACE { | LEFT_BRACE initializer_list RIGHT_BRACE {
const char* initFeature = "{ } style initializers"; const char* initFeature = "{ } style initializers";
parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
@ -3740,10 +3688,8 @@ GLSLANG_WEB_EXCLUDE_ON
parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature);
$$ = parseContext.intermediate.makeAggregate($1.loc); $$ = parseContext.intermediate.makeAggregate($1.loc);
} }
GLSLANG_WEB_EXCLUDE_OFF
; ;
GLSLANG_WEB_EXCLUDE_ON
initializer_list initializer_list
: initializer { : initializer {
$$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc()); $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
@ -3752,7 +3698,6 @@ initializer_list
$$ = parseContext.intermediate.growAggregate($1, $3); $$ = parseContext.intermediate.growAggregate($1, $3);
} }
; ;
GLSLANG_WEB_EXCLUDE_OFF
declaration_statement declaration_statement
: declaration { $$ = $1; } : declaration { $$ = $1; }
@ -3773,12 +3718,9 @@ simple_statement
| case_label { $$ = $1; } | case_label { $$ = $1; }
| iteration_statement { $$ = $1; } | iteration_statement { $$ = $1; }
| jump_statement { $$ = $1; } | jump_statement { $$ = $1; }
GLSLANG_WEB_EXCLUDE_ON
| demote_statement { $$ = $1; } | demote_statement { $$ = $1; }
GLSLANG_WEB_EXCLUDE_OFF
; ;
GLSLANG_WEB_EXCLUDE_ON
demote_statement demote_statement
: DEMOTE SEMICOLON { : DEMOTE SEMICOLON {
parseContext.requireStage($1.loc, EShLangFragment, "demote"); parseContext.requireStage($1.loc, EShLangFragment, "demote");
@ -3786,7 +3728,6 @@ demote_statement
$$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc); $$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc);
} }
; ;
GLSLANG_WEB_EXCLUDE_OFF
compound_statement compound_statement
: LEFT_BRACE RIGHT_BRACE { $$ = 0; } : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
@ -3870,13 +3811,11 @@ selection_statement
: selection_statement_nonattributed { : selection_statement_nonattributed {
$$ = $1; $$ = $1;
} }
GLSLANG_WEB_EXCLUDE_ON
| attribute selection_statement_nonattributed { | attribute selection_statement_nonattributed {
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
parseContext.handleSelectionAttributes(*$1, $2); parseContext.handleSelectionAttributes(*$1, $2);
$$ = $2; $$ = $2;
} }
GLSLANG_WEB_EXCLUDE_OFF
selection_statement_nonattributed selection_statement_nonattributed
: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement { : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
@ -3918,13 +3857,11 @@ switch_statement
: switch_statement_nonattributed { : switch_statement_nonattributed {
$$ = $1; $$ = $1;
} }
GLSLANG_WEB_EXCLUDE_ON
| attribute switch_statement_nonattributed { | attribute switch_statement_nonattributed {
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
parseContext.handleSwitchAttributes(*$1, $2); parseContext.handleSwitchAttributes(*$1, $2);
$$ = $2; $$ = $2;
} }
GLSLANG_WEB_EXCLUDE_OFF
switch_statement_nonattributed switch_statement_nonattributed
: SWITCH LEFT_PAREN expression RIGHT_PAREN { : SWITCH LEFT_PAREN expression RIGHT_PAREN {
@ -3983,13 +3920,11 @@ iteration_statement
: iteration_statement_nonattributed { : iteration_statement_nonattributed {
$$ = $1; $$ = $1;
} }
GLSLANG_WEB_EXCLUDE_ON
| attribute iteration_statement_nonattributed { | attribute iteration_statement_nonattributed {
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
parseContext.handleLoopAttributes(*$1, $2); parseContext.handleLoopAttributes(*$1, $2);
$$ = $2; $$ = $2;
} }
GLSLANG_WEB_EXCLUDE_OFF
iteration_statement_nonattributed iteration_statement_nonattributed
: WHILE LEFT_PAREN { : WHILE LEFT_PAREN {
@ -4103,7 +4038,6 @@ jump_statement
parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation"); parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation");
$$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc); $$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc);
} }
GLSLANG_WEB_EXCLUDE_ON
| TERMINATE_RAY SEMICOLON { | TERMINATE_RAY SEMICOLON {
parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT"); parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT");
$$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc); $$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc);
@ -4112,7 +4046,6 @@ GLSLANG_WEB_EXCLUDE_ON
parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT"); parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT");
$$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc); $$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc);
} }
GLSLANG_WEB_EXCLUDE_OFF
; ;
// Grammar Note: No 'goto'. Gotos are not supported. // Grammar Note: No 'goto'. Gotos are not supported.
@ -4137,13 +4070,11 @@ external_declaration
| declaration { | declaration {
$$ = $1; $$ = $1;
} }
GLSLANG_WEB_EXCLUDE_ON
| SEMICOLON { | SEMICOLON {
parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon"); parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
$$ = nullptr; $$ = nullptr;
} }
GLSLANG_WEB_EXCLUDE_OFF
; ;
function_definition function_definition
@ -4187,7 +4118,6 @@ function_definition
} }
; ;
GLSLANG_WEB_EXCLUDE_ON
attribute attribute
: LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET {
$$ = $3; $$ = $3;
@ -4208,9 +4138,7 @@ single_attribute
| IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN { | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN {
$$ = parseContext.makeAttributes(*$1.string, $3); $$ = parseContext.makeAttributes(*$1.string, $3);
} }
GLSLANG_WEB_EXCLUDE_OFF
GLSLANG_WEB_EXCLUDE_ON
spirv_requirements_list spirv_requirements_list
: spirv_requirements_parameter { : spirv_requirements_parameter {
$$ = $1; $$ = $1;
@ -4487,6 +4415,5 @@ spirv_instruction_qualifier_id
| IDENTIFIER EQUAL INTCONSTANT { | IDENTIFIER EQUAL INTCONSTANT {
$$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i); $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i);
} }
GLSLANG_WEB_EXCLUDE_OFF
%% %%

View File

@ -42,26 +42,9 @@
// The .y bison file is not a source file, it is a derivative of the .m4 file. // The .y bison file is not a source file, it is a derivative of the .m4 file.
// The m4 file needs to be processed by m4 to generate the .y bison file. // The m4 file needs to be processed by m4 to generate the .y bison file.
// //
// Code sandwiched between a pair:
//
// GLSLANG_WEB_EXCLUDE_ON
// ...
// ...
// ...
// GLSLANG_WEB_EXCLUDE_OFF
//
// Will be excluded from the grammar when m4 is executed as:
//
// m4 -P -DGLSLANG_WEB
//
// It will be included when m4 is executed as:
//
// m4 -P // m4 -P
// //
/** /**
* This is bison grammar and productions for parsing all versions of the * This is bison grammar and productions for parsing all versions of the
* GLSL shading languages. * GLSL shading languages.
@ -177,8 +160,6 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY %token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY
%token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY %token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY
%token <lex> ATTRIBUTE VARYING %token <lex> ATTRIBUTE VARYING
%token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T %token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T
%token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T %token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T
@ -282,8 +263,6 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL %token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL
%token <lex> ATTACHMENTEXT IATTACHMENTEXT UATTACHMENTEXT %token <lex> ATTACHMENTEXT IATTACHMENTEXT UATTACHMENTEXT
%token <lex> LEFT_OP RIGHT_OP %token <lex> LEFT_OP RIGHT_OP
%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
@ -309,7 +288,6 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> UNIFORM SHARED BUFFER TILEIMAGEEXT %token <lex> UNIFORM SHARED BUFFER TILEIMAGEEXT
%token <lex> FLAT SMOOTH LAYOUT %token <lex> FLAT SMOOTH LAYOUT
%token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT %token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT
%token <lex> INT64CONSTANT UINT64CONSTANT %token <lex> INT64CONSTANT UINT64CONSTANT
%token <lex> SUBROUTINE DEMOTE %token <lex> SUBROUTINE DEMOTE
@ -321,7 +299,6 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT %token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV PERPRIMITIVEEXT TASKPAYLOADWORKGROUPEXT
%token <lex> PRECISE %token <lex> PRECISE
%type <interm> assignment_operator unary_operator %type <interm> assignment_operator unary_operator
%type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression %type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
%type <interm.intermTypedNode> expression integer_expression assignment_expression %type <interm.intermTypedNode> expression integer_expression assignment_expression
@ -367,7 +344,6 @@ extern int yylex(YYSTYPE*, TParseContext&);
%type <interm.identifierList> identifier_list %type <interm.identifierList> identifier_list
%type <interm.type> precise_qualifier non_uniform_qualifier %type <interm.type> precise_qualifier non_uniform_qualifier
%type <interm.typeList> type_name_list %type <interm.typeList> type_name_list
%type <interm.attributes> attribute attribute_list single_attribute %type <interm.attributes> attribute attribute_list single_attribute
@ -387,7 +363,6 @@ extern int yylex(YYSTYPE*, TParseContext&);
%type <interm.spirvInst> spirv_instruction_qualifier %type <interm.spirvInst> spirv_instruction_qualifier
%type <interm.spirvInst> spirv_instruction_qualifier_list spirv_instruction_qualifier_id %type <interm.spirvInst> spirv_instruction_qualifier_list spirv_instruction_qualifier_id
%start translation_unit %start translation_unit
%% %%
@ -419,7 +394,6 @@ primary_expression
| BOOLCONSTANT { | BOOLCONSTANT {
$$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
} }
| STRING_LITERAL { | STRING_LITERAL {
$$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true);
} }
@ -457,7 +431,6 @@ primary_expression
parseContext.float16Check($1.loc, "half float literal"); parseContext.float16Check($1.loc, "half float literal");
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true);
} }
; ;
postfix_expression postfix_expression
@ -583,13 +556,11 @@ function_identifier
$$.function = new TFunction(empty, TType(EbtVoid), EOpNull); $$.function = new TFunction(empty, TType(EbtVoid), EOpNull);
} }
} }
| non_uniform_qualifier { | non_uniform_qualifier {
// Constructor // Constructor
$$.intermNode = 0; $$.intermNode = 0;
$$.function = parseContext.handleConstructorCall($1.loc, $1); $$.function = parseContext.handleConstructorCall($1.loc, $1);
} }
; ;
unary_expression unary_expression
@ -899,7 +870,6 @@ declaration
$$ = 0; $$ = 0;
// TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
} }
| spirv_instruction_qualifier function_prototype SEMICOLON { | spirv_instruction_qualifier function_prototype SEMICOLON {
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier"); parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier");
$2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier $2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier
@ -912,7 +882,6 @@ declaration
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier"); parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier");
$$ = 0; $$ = 0;
} }
| init_declarator_list SEMICOLON { | init_declarator_list SEMICOLON {
if ($1.intermNode && $1.intermNode->getAsAggregate()) if ($1.intermNode && $1.intermNode->getAsAggregate())
$1.intermNode->getAsAggregate()->setOperator(EOpSequence); $1.intermNode->getAsAggregate()->setOperator(EOpSequence);
@ -1182,9 +1151,7 @@ single_declaration
: fully_specified_type { : fully_specified_type {
$$.type = $1; $$.type = $1;
$$.intermNode = 0; $$.intermNode = 0;
parseContext.declareTypeDefaults($$.loc, $$.type); parseContext.declareTypeDefaults($$.loc, $$.type);
} }
| fully_specified_type IDENTIFIER { | fully_specified_type IDENTIFIER {
$$.type = $1; $$.type = $1;
@ -1270,7 +1237,6 @@ interpolation_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.flat = true; $$.qualifier.flat = true;
} }
| NOPERSPECTIVE { | NOPERSPECTIVE {
parseContext.globalCheck($1.loc, "noperspective"); parseContext.globalCheck($1.loc, "noperspective");
parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective");
@ -1335,7 +1301,6 @@ interpolation_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.perTaskNV = true; $$.qualifier.perTaskNV = true;
} }
; ;
layout_qualifier layout_qualifier
@ -1370,7 +1335,6 @@ layout_qualifier_id
} }
; ;
precise_qualifier precise_qualifier
: PRECISE { : PRECISE {
parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise");
@ -1380,7 +1344,6 @@ precise_qualifier
} }
; ;
type_qualifier type_qualifier
: single_type_qualifier { : single_type_qualifier {
$$ = $1; $$ = $1;
@ -1414,7 +1377,6 @@ single_type_qualifier
// allow inheritance of storage qualifier from block declaration // allow inheritance of storage qualifier from block declaration
$$ = $1; $$ = $1;
} }
| precise_qualifier { | precise_qualifier {
// allow inheritance of storage qualifier from block declaration // allow inheritance of storage qualifier from block declaration
$$ = $1; $$ = $1;
@ -1441,7 +1403,6 @@ single_type_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.setSpirvLiteral(); $$.qualifier.setSpirvLiteral();
} }
; ;
storage_qualifier storage_qualifier
@ -1496,7 +1457,6 @@ storage_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqBuffer; $$.qualifier.storage = EvqBuffer;
} }
| ATTRIBUTE { | ATTRIBUTE {
parseContext.requireStage($1.loc, EShLangVertex, "attribute"); parseContext.requireStage($1.loc, EShLangVertex, "attribute");
parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute"); parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
@ -1689,10 +1649,8 @@ storage_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqtaskPayloadSharedEXT; $$.qualifier.storage = EvqtaskPayloadSharedEXT;
} }
; ;
non_uniform_qualifier non_uniform_qualifier
: NONUNIFORM { : NONUNIFORM {
$$.init($1.loc); $$.init($1.loc);
@ -1711,7 +1669,6 @@ type_name_list
} }
; ;
type_specifier type_specifier
: type_specifier_nonarray type_parameter_specifier_opt { : type_specifier_nonarray type_parameter_specifier_opt {
$$ = $1; $$ = $1;
@ -1940,7 +1897,6 @@ type_specifier_nonarray
$$.basicType = EbtFloat; $$.basicType = EbtFloat;
$$.setMatrix(4, 4); $$.setMatrix(4, 4);
} }
| DOUBLE { | DOUBLE {
parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double"); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double");
if (! parseContext.symbolTable.atBuiltInLevel()) if (! parseContext.symbolTable.atBuiltInLevel())
@ -2559,7 +2515,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd1D); $$.sampler.set(EbtFloat, Esd1D);
} }
| SAMPLER2D { | SAMPLER2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2595,7 +2550,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true, true); $$.sampler.set(EbtFloat, Esd2D, true, true);
} }
| SAMPLER1DSHADOW { | SAMPLER1DSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2704,7 +2658,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtInt, Esd1D); $$.sampler.set(EbtInt, Esd1D);
} }
| ISAMPLER2D { | ISAMPLER2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2740,7 +2693,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtUint, EsdCube); $$.sampler.set(EbtUint, EsdCube);
} }
| ISAMPLER1DARRAY { | ISAMPLER1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2781,7 +2733,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube, true); $$.sampler.setTexture(EbtUint, EsdCube, true);
} }
| USAMPLER2DARRAY { | USAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2857,7 +2808,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setPureSampler(true); $$.sampler.setPureSampler(true);
} }
| SAMPLER2DRECT { | SAMPLER2DRECT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -3566,7 +3516,6 @@ type_specifier_nonarray
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtHitObjectNV; $$.basicType = EbtHitObjectNV;
} }
| struct_specifier { | struct_specifier {
$$ = $1; $$ = $1;
$$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@ -3721,7 +3670,6 @@ initializer
: assignment_expression { : assignment_expression {
$$ = $1; $$ = $1;
} }
| LEFT_BRACE initializer_list RIGHT_BRACE { | LEFT_BRACE initializer_list RIGHT_BRACE {
const char* initFeature = "{ } style initializers"; const char* initFeature = "{ } style initializers";
parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
@ -3740,10 +3688,8 @@ initializer
parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature);
$$ = parseContext.intermediate.makeAggregate($1.loc); $$ = parseContext.intermediate.makeAggregate($1.loc);
} }
; ;
initializer_list initializer_list
: initializer { : initializer {
$$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc()); $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
@ -3753,7 +3699,6 @@ initializer_list
} }
; ;
declaration_statement declaration_statement
: declaration { $$ = $1; } : declaration { $$ = $1; }
; ;
@ -3773,12 +3718,9 @@ simple_statement
| case_label { $$ = $1; } | case_label { $$ = $1; }
| iteration_statement { $$ = $1; } | iteration_statement { $$ = $1; }
| jump_statement { $$ = $1; } | jump_statement { $$ = $1; }
| demote_statement { $$ = $1; } | demote_statement { $$ = $1; }
; ;
demote_statement demote_statement
: DEMOTE SEMICOLON { : DEMOTE SEMICOLON {
parseContext.requireStage($1.loc, EShLangFragment, "demote"); parseContext.requireStage($1.loc, EShLangFragment, "demote");
@ -3787,7 +3729,6 @@ demote_statement
} }
; ;
compound_statement compound_statement
: LEFT_BRACE RIGHT_BRACE { $$ = 0; } : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
| LEFT_BRACE { | LEFT_BRACE {
@ -3870,14 +3811,12 @@ selection_statement
: selection_statement_nonattributed { : selection_statement_nonattributed {
$$ = $1; $$ = $1;
} }
| attribute selection_statement_nonattributed { | attribute selection_statement_nonattributed {
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
parseContext.handleSelectionAttributes(*$1, $2); parseContext.handleSelectionAttributes(*$1, $2);
$$ = $2; $$ = $2;
} }
selection_statement_nonattributed selection_statement_nonattributed
: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement { : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
parseContext.boolCheck($1.loc, $3); parseContext.boolCheck($1.loc, $3);
@ -3918,14 +3857,12 @@ switch_statement
: switch_statement_nonattributed { : switch_statement_nonattributed {
$$ = $1; $$ = $1;
} }
| attribute switch_statement_nonattributed { | attribute switch_statement_nonattributed {
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
parseContext.handleSwitchAttributes(*$1, $2); parseContext.handleSwitchAttributes(*$1, $2);
$$ = $2; $$ = $2;
} }
switch_statement_nonattributed switch_statement_nonattributed
: SWITCH LEFT_PAREN expression RIGHT_PAREN { : SWITCH LEFT_PAREN expression RIGHT_PAREN {
// start new switch sequence on the switch stack // start new switch sequence on the switch stack
@ -3983,14 +3920,12 @@ iteration_statement
: iteration_statement_nonattributed { : iteration_statement_nonattributed {
$$ = $1; $$ = $1;
} }
| attribute iteration_statement_nonattributed { | attribute iteration_statement_nonattributed {
parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute"); parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
parseContext.handleLoopAttributes(*$1, $2); parseContext.handleLoopAttributes(*$1, $2);
$$ = $2; $$ = $2;
} }
iteration_statement_nonattributed iteration_statement_nonattributed
: WHILE LEFT_PAREN { : WHILE LEFT_PAREN {
if (! parseContext.limits.whileLoops) if (! parseContext.limits.whileLoops)
@ -4103,7 +4038,6 @@ jump_statement
parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation"); parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation");
$$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc); $$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc);
} }
| TERMINATE_RAY SEMICOLON { | TERMINATE_RAY SEMICOLON {
parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT"); parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT");
$$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc); $$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc);
@ -4112,7 +4046,6 @@ jump_statement
parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT"); parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT");
$$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc); $$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc);
} }
; ;
// Grammar Note: No 'goto'. Gotos are not supported. // Grammar Note: No 'goto'. Gotos are not supported.
@ -4137,13 +4070,11 @@ external_declaration
| declaration { | declaration {
$$ = $1; $$ = $1;
} }
| SEMICOLON { | SEMICOLON {
parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon"); parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
$$ = nullptr; $$ = nullptr;
} }
; ;
function_definition function_definition
@ -4187,7 +4118,6 @@ function_definition
} }
; ;
attribute attribute
: LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET {
$$ = $3; $$ = $3;
@ -4209,8 +4139,6 @@ single_attribute
$$ = parseContext.makeAttributes(*$1.string, $3); $$ = parseContext.makeAttributes(*$1.string, $3);
} }
spirv_requirements_list spirv_requirements_list
: spirv_requirements_parameter { : spirv_requirements_parameter {
$$ = $1; $$ = $1;
@ -4488,5 +4416,4 @@ spirv_instruction_qualifier_id
$$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i); $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i);
} }
%% %%

View File

@ -36,8 +36,6 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#if !defined(GLSLANG_WEB)
#include "localintermediate.h" #include "localintermediate.h"
#include "../Include/InfoSink.h" #include "../Include/InfoSink.h"
@ -669,9 +667,7 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpDeclare: out.debug << "Declare"; break; case EOpDeclare: out.debug << "Declare"; break;
#ifndef GLSLANG_WEB
case EOpSpirvInst: out.debug << "spirv_instruction"; break; case EOpSpirvInst: out.debug << "spirv_instruction"; break;
#endif
default: out.debug.message(EPrefixError, "Bad unary op"); default: out.debug.message(EPrefixError, "Bad unary op");
} }
@ -1146,9 +1142,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpHitObjectGetShaderRecordBufferHandleNV: out.debug << "HitObjectReadShaderRecordBufferHandleNV"; break; case EOpHitObjectGetShaderRecordBufferHandleNV: out.debug << "HitObjectReadShaderRecordBufferHandleNV"; break;
case EOpReorderThreadNV: out.debug << "ReorderThreadNV"; break; case EOpReorderThreadNV: out.debug << "ReorderThreadNV"; break;
#ifndef GLSLANG_WEB
case EOpSpirvInst: out.debug << "spirv_instruction"; break; case EOpSpirvInst: out.debug << "spirv_instruction"; break;
#endif
case EOpStencilAttachmentReadEXT: out.debug << "stencilAttachmentReadEXT"; break; case EOpStencilAttachmentReadEXT: out.debug << "stencilAttachmentReadEXT"; break;
case EOpDepthAttachmentReadEXT: out.debug << "depthAttachmentReadEXT"; break; case EOpDepthAttachmentReadEXT: out.debug << "depthAttachmentReadEXT"; break;
@ -1611,5 +1605,3 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
} }
} // end namespace glslang } // end namespace glslang
#endif // !GLSLANG_WEB

View File

@ -33,8 +33,6 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#if !defined(GLSLANG_WEB)
#include "../Include/Common.h" #include "../Include/Common.h"
#include "../Include/InfoSink.h" #include "../Include/InfoSink.h"
#include "../Include/Types.h" #include "../Include/Types.h"
@ -1714,5 +1712,3 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
} }
} // end namespace glslang } // end namespace glslang
#endif // !GLSLANG_WEB

View File

@ -33,8 +33,6 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#if !defined(GLSLANG_WEB)
#ifndef _IOMAPPER_INCLUDED #ifndef _IOMAPPER_INCLUDED
#define _IOMAPPER_INCLUDED #define _IOMAPPER_INCLUDED
@ -359,5 +357,3 @@ private:
} // end namespace glslang } // end namespace glslang
#endif // _IOMAPPER_INCLUDED #endif // _IOMAPPER_INCLUDED
#endif // !GLSLANG_WEB

View File

@ -187,14 +187,12 @@ 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

View File

@ -57,13 +57,11 @@ namespace glslang {
// //
void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage unitStage) void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage unitStage)
{ {
#ifndef GLSLANG_WEB
infoSink.info.prefix(EPrefixError); infoSink.info.prefix(EPrefixError);
if (unitStage < EShLangCount) if (unitStage < EShLangCount)
infoSink.info << "Linking " << StageName(getStage()) << " and " << StageName(unitStage) << " stages: " << message << "\n"; infoSink.info << "Linking " << StageName(getStage()) << " and " << StageName(unitStage) << " stages: " << message << "\n";
else else
infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n"; infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
#endif
++numErrors; ++numErrors;
} }
@ -71,13 +69,11 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message, EShLanguage
// Link-time warning. // Link-time warning.
void TIntermediate::warn(TInfoSink& infoSink, const char* message, EShLanguage unitStage) void TIntermediate::warn(TInfoSink& infoSink, const char* message, EShLanguage unitStage)
{ {
#ifndef GLSLANG_WEB
infoSink.info.prefix(EPrefixWarning); infoSink.info.prefix(EPrefixWarning);
if (unitStage < EShLangCount) if (unitStage < EShLangCount)
infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n"; infoSink.info << "Linking " << StageName(language) << " and " << StageName(unitStage) << " stages: " << message << "\n";
else else
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
@ -89,11 +85,9 @@ void TIntermediate::warn(TInfoSink& infoSink, const char* message, EShLanguage u
// //
void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
{ {
#if !defined(GLSLANG_WEB)
mergeCallGraphs(infoSink, unit); mergeCallGraphs(infoSink, unit);
mergeModes(infoSink, unit); mergeModes(infoSink, unit);
mergeTrees(infoSink, unit); mergeTrees(infoSink, unit);
#endif
} }
// //
@ -161,8 +155,6 @@ 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());
} }
#if !defined(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;
@ -381,8 +373,6 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit)
ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end()); ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end());
} }
#endif
static const TString& getNameForIdMap(TIntermSymbol* symbol) static const TString& getNameForIdMap(TIntermSymbol* symbol)
{ {
TShaderInterface si = symbol->getType().getShaderInterface(); TShaderInterface si = symbol->getType().getShaderInterface();
@ -859,7 +849,6 @@ void TIntermediate::mergeImplicitArraySizes(TType& type, const TType& unitType)
// //
void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol, EShLanguage unitStage) void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol, EShLanguage unitStage)
{ {
#if !defined(GLSLANG_WEB)
bool crossStage = getStage() != unitStage; bool crossStage = getStage() != unitStage;
bool writeTypeComparison = false; bool writeTypeComparison = false;
bool errorReported = false; bool errorReported = false;
@ -1187,7 +1176,6 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
} }
} }
} }
#endif
} }
void TIntermediate::sharedBlockCheck(TInfoSink& infoSink) void TIntermediate::sharedBlockCheck(TInfoSink& infoSink)
@ -1234,7 +1222,6 @@ 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) if (getNumPushConstants() > 1)
error(infoSink, "Only one push_constant block is allowed per stage"); error(infoSink, "Only one push_constant block is allowed per stage");
@ -1392,7 +1379,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
} finalLinkTraverser; } finalLinkTraverser;
treeRoot->traverse(&finalLinkTraverser); treeRoot->traverse(&finalLinkTraverser);
#endif
} }
// //
@ -1687,7 +1673,6 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
// For raytracing IO (payloads and callabledata) each declaration occupies a single // For raytracing IO (payloads and callabledata) each declaration occupies a single
// slot irrespective of type. // slot irrespective of type.
int collision = -1; // no collision int collision = -1; // no collision
#ifndef GLSLANG_WEB
if (qualifier.isAnyPayload() || qualifier.isAnyCallable() || qualifier.isHitObjectAttrNV()) { if (qualifier.isAnyPayload() || qualifier.isAnyCallable() || qualifier.isHitObjectAttrNV()) {
TRange range(qualifier.layoutLocation, qualifier.layoutLocation); TRange range(qualifier.layoutLocation, qualifier.layoutLocation);
collision = checkLocationRT(set, qualifier.layoutLocation); collision = checkLocationRT(set, qualifier.layoutLocation);
@ -1723,7 +1708,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
} }
return collision; return collision;
} }
#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.
@ -1846,10 +1831,8 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage)
if (type.isSizedArray() && !type.getQualifier().isPerView()) if (type.isSizedArray() && !type.getQualifier().isPerView())
return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage); return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage);
else { else {
#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
return computeTypeLocationSize(elementType, stage); return computeTypeLocationSize(elementType, stage);
} }
} }
@ -1925,8 +1908,6 @@ 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.
@ -2044,8 +2025,6 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
} }
} }
#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.
@ -2053,10 +2032,6 @@ 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:
@ -2396,7 +2371,6 @@ int TIntermediate::computeBufferReferenceTypeSize(const TType& type)
return size; return size;
} }
#ifndef GLSLANG_WEB
bool TIntermediate::isIoResizeArray(const TType& type, EShLanguage language) { bool TIntermediate::isIoResizeArray(const TType& type, EShLanguage language) {
return type.isArray() && return type.isArray() &&
((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) || ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) ||
@ -2408,6 +2382,5 @@ bool TIntermediate::isIoResizeArray(const TType& type, EShLanguage language) {
(language == EShLangMesh && type.getQualifier().storage == EvqVaryingOut && (language == EShLangMesh && type.getQualifier().storage == EvqVaryingOut &&
!type.getQualifier().perTaskNV)); !type.getQualifier().perTaskNV));
} }
#endif // not GLSLANG_WEB
} // end namespace glslang } // end namespace glslang

View File

@ -147,7 +147,6 @@ struct TOffsetRange {
TRange offset; TRange offset;
}; };
#ifndef GLSLANG_WEB
// Things that need to be tracked per xfb buffer. // Things that need to be tracked per xfb buffer.
struct TXfbBuffer { struct TXfbBuffer {
TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false), TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false),
@ -159,7 +158,6 @@ struct TXfbBuffer {
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.
// This includes command line options, transforms, etc., ideally inclusive enough // This includes command line options, transforms, etc., ideally inclusive enough
@ -311,9 +309,7 @@ public:
atomicCounterBlockName(""), atomicCounterBlockName(""),
globalUniformBlockSet(TQualifier::layoutSetEnd), globalUniformBlockSet(TQualifier::layoutSetEnd),
globalUniformBlockBinding(TQualifier::layoutBindingEnd), globalUniformBlockBinding(TQualifier::layoutBindingEnd),
atomicCounterBlockSet(TQualifier::layoutSetEnd) atomicCounterBlockSet(TQualifier::layoutSetEnd),
#ifndef GLSLANG_WEB
,
implicitThisName("@this"), implicitCounterName("@count"), implicitThisName("@this"), implicitCounterName("@count"),
source(EShSourceNone), source(EShSourceNone),
useVulkanMemoryModel(false), useVulkanMemoryModel(false),
@ -352,7 +348,6 @@ public:
spirvRequirement(nullptr), spirvRequirement(nullptr),
spirvExecutionMode(nullptr), spirvExecutionMode(nullptr),
uniformLocationBase(0) uniformLocationBase(0)
#endif
{ {
localSize[0] = 1; localSize[0] = 1;
localSize[1] = 1; localSize[1] = 1;
@ -363,10 +358,8 @@ public:
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
xfbBuffers.resize(TQualifier::layoutXfbBufferEnd); xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
shiftBinding.fill(0); shiftBinding.fill(0);
#endif
} }
void setVersion(int v) void setVersion(int v)
@ -636,38 +629,6 @@ public:
localSizeSpecId[1] != TQualifier::layoutNotSet || localSizeSpecId[1] != TQualifier::layoutNotSet ||
localSizeSpecId[2] != TQualifier::layoutNotSet; localSizeSpecId[2] != TQualifier::layoutNotSet;
} }
#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 getNonCoherentColorAttachmentReadEXT() const { return false; }
bool getNonCoherentDepthAttachmentReadEXT() const { return false; }
bool getNonCoherentStencilAttachmentReadEXT() const { return false; }
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 addShaderRecordCount() { }
void addTaskNVCount() { }
void addTaskPayloadEXTCount() { }
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; }
ComputeDerivativeMode getLayoutDerivativeModeNone() const { return LayoutDerivativeNone; }
#else
void output(TInfoSink&, bool tree); void output(TInfoSink&, bool tree);
bool isEsProfile() const { return profile == EEsProfile; } bool isEsProfile() const { return profile == EEsProfile; }
@ -1006,7 +967,6 @@ public:
void insertSpirvExecutionModeId(int executionMode, const TIntermAggregate* args); void insertSpirvExecutionModeId(int executionMode, const TIntermAggregate* args);
bool hasSpirvExecutionMode() const { return spirvExecutionMode != nullptr; } bool hasSpirvExecutionMode() const { return spirvExecutionMode != nullptr; }
const TSpirvExecutionMode& getSpirvExecutionMode() const { return *spirvExecutionMode; } const TSpirvExecutionMode& getSpirvExecutionMode() const { return *spirvExecutionMode; }
#endif // GLSLANG_WEB
void addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing) void addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing)
{ {
@ -1113,12 +1073,6 @@ public:
void setUniqueId(unsigned long long id) { uniqueId = id; } void setUniqueId(unsigned long long id) { uniqueId = id; }
// 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; }
void updateNumericFeature(TNumericFeatures::feature f, bool on) { }
#else
bool getArithemeticInt8Enabled() const { bool getArithemeticInt8Enabled() const {
return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) || return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) ||
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int8); numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int8);
@ -1136,7 +1090,6 @@ public:
} }
void updateNumericFeature(TNumericFeatures::feature f, bool on) void updateNumericFeature(TNumericFeatures::feature f, bool on)
{ on ? numericFeatures.insert(f) : numericFeatures.erase(f); } { on ? numericFeatures.insert(f) : numericFeatures.erase(f); }
#endif
protected: protected:
TIntermSymbol* addSymbol(long long Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&); TIntermSymbol* addSymbol(long long Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
@ -1208,7 +1161,6 @@ protected:
unsigned int globalUniformBlockBinding; unsigned int globalUniformBlockBinding;
unsigned int atomicCounterBlockSet; unsigned int atomicCounterBlockSet;
#ifndef GLSLANG_WEB
public: public:
const char* const implicitThisName; const char* const implicitThisName;
const char* const implicitCounterName; const char* const implicitCounterName;
@ -1279,7 +1231,6 @@ protected:
std::unordered_map<std::string, int> uniformLocationOverrides; std::unordered_map<std::string, int> uniformLocationOverrides;
int uniformLocationBase; int uniformLocationBase;
TNumericFeatures numericFeatures; TNumericFeatures numericFeatures;
#endif
std::unordered_map<std::string, TBlockStorageClass> blockBackingOverrides; std::unordered_map<std::string, TBlockStorageClass> blockBackingOverrides;
std::unordered_set<int> usedConstantId; // specialization constant ids used std::unordered_set<int> usedConstantId; // specialization constant ids used

View File

@ -58,10 +58,8 @@ public:
const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink, const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink,
bool forwardCompatible, EShMessages messages) bool forwardCompatible, EShMessages messages)
: :
#if !defined(GLSLANG_WEB)
forwardCompatible(forwardCompatible), forwardCompatible(forwardCompatible),
profile(profile), profile(profile),
#endif
infoSink(infoSink), version(version), infoSink(infoSink), version(version),
language(language), language(language),
spvVersion(spvVersion), spvVersion(spvVersion),
@ -69,54 +67,7 @@ public:
virtual ~TParseVersions() { } virtual ~TParseVersions() { }
void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc); void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc);
void requireStage(const TSourceLoc&, EShLanguage, 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 extensionRequires(const TSourceLoc&, const char* const extension, const char* behavior) { }
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 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) EProfile profile; // the declared profile in the shader (core by default)
bool isEsProfile() const { return profile == EEsProfile; } bool isEsProfile() const { return profile == EEsProfile; }
@ -168,24 +119,13 @@ public:
bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; }
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
bool isForwardCompatible() const { return forwardCompatible; } 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 void requireSpv(const TSourceLoc&, const char *op, unsigned int version); virtual void requireSpv(const TSourceLoc&, const char *op, unsigned int version);
#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,
@ -194,7 +134,6 @@ 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; }

View File

@ -736,7 +736,6 @@ 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
@ -746,9 +745,7 @@ 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);
@ -974,7 +971,6 @@ int TPpContext::readCPPline(TPpToken* ppToken)
case PpAtomLine: case PpAtomLine:
token = CPPline(ppToken); token = CPPline(ppToken);
break; 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");
@ -984,7 +980,6 @@ int TPpContext::readCPPline(TPpToken* ppToken)
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;

View File

@ -260,7 +260,6 @@ 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");
@ -300,14 +299,11 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
isFloat16 = true; isFloat16 = true;
} }
} else } else
#endif
if (ch == 'f' || ch == 'F') { 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);
@ -583,7 +579,6 @@ 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)
@ -609,7 +604,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
if (len < MaxTokenLength) if (len < MaxTokenLength)
ppToken->name[len++] = (char)ch; ppToken->name[len++] = (char)ch;
isInt16 = true; isInt16 = true;
#endif
} else } else
ungetch(); ungetch();
ppToken->name[len] = '\0'; ppToken->name[len] = '\0';
@ -687,7 +681,6 @@ 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)
@ -713,7 +706,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
if (len < MaxTokenLength) if (len < MaxTokenLength)
ppToken->name[len++] = (char)ch; ppToken->name[len++] = (char)ch;
isInt16 = true; isInt16 = true;
#endif
} else { } else {
ungetch(); ungetch();
} }
@ -795,7 +787,6 @@ 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)
@ -821,7 +812,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
if (len < MaxTokenLength) if (len < MaxTokenLength)
ppToken->name[len++] = (char)ch; ppToken->name[len++] = (char)ch;
isInt16 = true; isInt16 = true;
#endif
} else } else
ungetch(); ungetch();
ppToken->name[len] = '\0'; ppToken->name[len] = '\0';
@ -884,7 +874,6 @@ 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)
@ -910,7 +899,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
if (len < MaxTokenLength) if (len < MaxTokenLength)
ppToken->name[len++] = (char)ch; ppToken->name[len++] = (char)ch;
isInt16 = true; isInt16 = true;
#endif
} else } else
ungetch(); ungetch();

View File

@ -113,7 +113,6 @@ 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('#')) {
@ -123,7 +122,6 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
atom = PpAtomPaste; atom = PpAtomPaste;
} }
} }
#endif
return atom; return atom;
} }

View File

@ -37,8 +37,6 @@
// propagate the 'noContraction' qualifier. // propagate the 'noContraction' qualifier.
// //
#ifndef GLSLANG_WEB
#include "propagateNoContraction.h" #include "propagateNoContraction.h"
#include <cstdlib> #include <cstdlib>
@ -866,5 +864,3 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate)
} }
} }
} }
#endif // GLSLANG_WEB

View File

@ -33,8 +33,6 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#if !defined(GLSLANG_WEB)
#include "../Include/Common.h" #include "../Include/Common.h"
#include "reflection.h" #include "reflection.h"
#include "LiveTraverser.h" #include "LiveTraverser.h"
@ -1270,5 +1268,3 @@ void TReflection::dump()
} }
} // end namespace glslang } // end namespace glslang
#endif // !GLSLANG_WEB

View File

@ -33,8 +33,6 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#if !defined(GLSLANG_WEB)
#ifndef _REFLECTION_INCLUDED #ifndef _REFLECTION_INCLUDED
#define _REFLECTION_INCLUDED #define _REFLECTION_INCLUDED
@ -219,5 +217,3 @@ protected:
} // end namespace glslang } // end namespace glslang
#endif // _REFLECTION_INCLUDED #endif // _REFLECTION_INCLUDED
#endif // !GLSLANG_WEB

View File

@ -728,8 +728,6 @@ private:
TShader& operator=(TShader&); TShader& operator=(TShader&);
}; };
#if !defined(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.
// //
@ -846,8 +844,6 @@ public:
virtual void addStage(EShLanguage stage, TIntermediate& stageIntermediate) = 0; virtual void addStage(EShLanguage stage, TIntermediate& stageIntermediate) = 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().
@ -867,8 +863,6 @@ public:
TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; } TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
#if !defined(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
@ -961,7 +955,6 @@ public:
// 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.
GLSLANG_EXPORT bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr); GLSLANG_EXPORT bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr);
#endif // !GLSLANG_WEB
protected: protected:
GLSLANG_EXPORT bool linkStage(EShLanguage, EShMessages); GLSLANG_EXPORT bool linkStage(EShLanguage, EShMessages);
@ -972,9 +965,7 @@ 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;
#if !defined(GLSLANG_WEB)
TReflection* reflection; TReflection* reflection;
#endif
bool linked; bool linked;
private: private:

View File

@ -33,17 +33,5 @@
# 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.
if [ "$1" = 'web' ] m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
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

View File

@ -42,7 +42,6 @@
#include "glslang/MachineIndependent/iomapper.h" #include "glslang/MachineIndependent/iomapper.h"
#include "glslang/MachineIndependent/reflection.h" #include "glslang/MachineIndependent/reflection.h"
#ifndef GLSLANG_WEB
namespace glslangtest { namespace glslangtest {
namespace { namespace {
@ -352,4 +351,3 @@ INSTANTIATE_TEST_SUITE_P(
} // anonymous namespace } // anonymous namespace
} // namespace glslangtest } // namespace glslangtest
#endif

View File

@ -75,10 +75,8 @@ TEST_P(LinkTestVulkan, FromFile)
result.linkingOutput = program.getInfoLog(); result.linkingOutput = program.getInfoLog();
result.linkingError = program.getInfoDebugLog(); result.linkingError = program.getInfoDebugLog();
#if !defined(GLSLANG_WEB) if (success)
if (success) program.mapIO();
program.mapIO();
#endif
if (success && (controls & EShMsgSpvRules)) { if (success && (controls & EShMsgSpvRules)) {
spv::SpvBuildLogger logger; spv::SpvBuildLogger logger;

View File

@ -254,10 +254,8 @@ public:
glslang::TProgram program; glslang::TProgram program;
program.addShader(&shader); program.addShader(&shader);
success &= program.link(controls); success &= program.link(controls);
#if !defined(GLSLANG_WEB)
if (success) if (success)
program.mapIO(); program.mapIO();
#endif
if (success && (controls & EShMsgSpvRules)) { if (success && (controls & EShMsgSpvRules)) {
spv::SpvBuildLogger logger; spv::SpvBuildLogger logger;
@ -318,10 +316,8 @@ public:
program.addShader(&shader); program.addShader(&shader);
success &= program.link(controls); success &= program.link(controls);
#if !defined(GLSLANG_WEB)
if (success) if (success)
program.mapIO(); program.mapIO();
#endif
spv::SpvBuildLogger logger; spv::SpvBuildLogger logger;
@ -363,10 +359,8 @@ public:
glslang::TProgram program; glslang::TProgram program;
program.addShader(&shader); program.addShader(&shader);
success &= program.link(controls); success &= program.link(controls);
#if !defined(GLSLANG_WEB)
if (success) if (success)
program.mapIO(); program.mapIO();
#endif
if (success && (controls & EShMsgSpvRules)) { if (success && (controls & EShMsgSpvRules)) {
spv::SpvBuildLogger logger; spv::SpvBuildLogger logger;

View File

@ -42,7 +42,6 @@
#include "glslang/MachineIndependent/iomapper.h" #include "glslang/MachineIndependent/iomapper.h"
#include "glslang/MachineIndependent/reflection.h" #include "glslang/MachineIndependent/reflection.h"
#ifndef GLSLANG_WEB
namespace glslangtest { namespace glslangtest {
namespace { namespace {
@ -303,4 +302,3 @@ INSTANTIATE_TEST_SUITE_P(
} // anonymous namespace } // anonymous namespace
} // namespace glslangtest } // namespace glslangtest
#endif