Updated glslang.

This commit is contained in:
Бранимир Караџић 2019-10-26 07:56:51 -07:00
parent 8494200645
commit ab89d9b498
37 changed files with 3228 additions and 1990 deletions

245
3rdparty/glslang/BUILD.bazel vendored Normal file
View File

@ -0,0 +1,245 @@
package(
default_visibility = ["//visibility:public"],
)
# Description:
#
# Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator.
licenses(["notice"])
exports_files(["LICENSE"])
COMMON_COPTS = select({
"@bazel_tools//src/conditions:windows": [""],
"//conditions:default": [
"-Wall",
"-Wuninitialized",
"-Wunused",
"-Wunused-local-typedefs",
"-Wunused-parameter",
"-Wunused-value",
"-Wunused-variable",
"-Wno-reorder",
"-std=c++11",
"-fvisibility=hidden",
"-fvisibility-inlines-hidden",
"-fno-exceptions",
"-fno-rtti",
],
})
cc_library(
name = "glslang",
srcs = glob(
[
"glslang/GenericCodeGen/*.cpp",
"glslang/MachineIndependent/*.cpp",
"glslang/MachineIndependent/preprocessor/*.cpp",
"hlsl/*.cpp",
],
exclude = [
"glslang/MachineIndependent/pch.cpp",
"glslang/MachineIndependent/pch.h",
"hlsl/pch.cpp",
"hlsl/pch.h",
],
) + [
"OGLCompilersDLL/InitializeDll.cpp",
] + select({
"@bazel_tools//src/conditions:windows":
["glslang/OSDependent/Windows/ossource.cpp"],
"//conditions:default":
["glslang/OSDependent/Unix/ossource.cpp"],
}),
hdrs = glob([
"glslang/Include/*.h",
"glslang/MachineIndependent/*.h",
"glslang/MachineIndependent/preprocessor/*.h",
"hlsl/*.h",
]) + [
"OGLCompilersDLL/InitializeDll.h",
"StandAlone/DirStackFileIncluder.h",
"glslang/OSDependent/osinclude.h",
"glslang/Public/ShaderLang.h",
],
copts = COMMON_COPTS,
defines = [
"AMD_EXTENSIONS",
"ENABLE_HLSL=0",
"ENABLE_OPT=0",
"NV_EXTENSIONS",
],
linkopts = select({
"@bazel_tools//src/conditions:windows": [""],
"//conditions:default": ["-lm", "-lpthread"],
}),
linkstatic = 1,
)
genrule(
name = "export_spirv_headers",
srcs = [
"SPIRV/GLSL.ext.AMD.h",
"SPIRV/GLSL.ext.EXT.h",
"SPIRV/GLSL.ext.KHR.h",
"SPIRV/GLSL.ext.NV.h",
"SPIRV/GLSL.std.450.h",
"SPIRV/spirv.hpp",
],
outs = [
"include/SPIRV/GLSL.ext.AMD.h",
"include/SPIRV/GLSL.ext.EXT.h",
"include/SPIRV/GLSL.ext.KHR.h",
"include/SPIRV/GLSL.ext.NV.h",
"include/SPIRV/GLSL.std.450.h",
"include/SPIRV/spirv.hpp",
],
cmd = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/",
)
cc_library(
name = "SPIRV_headers",
hdrs = [":export_spirv_headers"],
copts = COMMON_COPTS,
includes = [
"include",
"include/SPIRV",
],
linkstatic = 1,
)
cc_library(
name = "SPIRV",
srcs = glob(
["SPIRV/*.cpp"],
exclude = [
"SPIRV/SpvTools.cpp",
],
),
hdrs = [
"SPIRV/GlslangToSpv.h",
"SPIRV/Logger.h",
"SPIRV/SPVRemapper.h",
"SPIRV/SpvBuilder.h",
"SPIRV/SpvTools.h",
"SPIRV/bitutils.h",
"SPIRV/disassemble.h",
"SPIRV/doc.h",
"SPIRV/hex_float.h",
"SPIRV/spvIR.h",
],
copts = COMMON_COPTS,
includes = ["SPIRV"],
linkopts = select({
"@bazel_tools//src/conditions:windows": [""],
"//conditions:default": ["-lm"],
}),
linkstatic = 1,
deps = [
":SPIRV_headers",
":glslang",
],
)
cc_library(
name = "glslang-default-resource-limits",
srcs = ["StandAlone/ResourceLimits.cpp"],
hdrs = ["StandAlone/ResourceLimits.h"],
copts = COMMON_COPTS,
linkstatic = 1,
deps = [":glslang"],
)
cc_binary(
name = "glslangValidator",
srcs = [
"StandAlone/StandAlone.cpp",
"StandAlone/Worklist.h",
],
copts = COMMON_COPTS,
deps = [
":SPIRV",
":glslang",
":glslang-default-resource-limits",
],
)
cc_binary(
name = "spirv-remap",
srcs = ["StandAlone/spirv-remap.cpp"],
copts = COMMON_COPTS,
deps = [
":SPIRV",
":glslang",
":glslang-default-resource-limits",
],
)
filegroup(
name = "test_files",
srcs = glob(
["Test/**"],
exclude = [
"Test/bump",
"Test/glslangValidator",
"Test/runtests",
],
),
)
cc_library(
name = "glslang_test_lib",
testonly = 1,
srcs = [
"gtests/HexFloat.cpp",
"gtests/Initializer.h",
"gtests/Settings.cpp",
"gtests/Settings.h",
"gtests/TestFixture.cpp",
"gtests/TestFixture.h",
"gtests/main.cpp",
],
copts = COMMON_COPTS,
data = [":test_files"],
defines = select({
# Unfortunately we can't use $(location) in cc_library at the moment.
# See https://github.com/bazelbuild/bazel/issues/1023
# So we'll specify the path manually.
"@bazel_tools//src/conditions:windows":
["GLSLANG_TEST_DIRECTORY='\"../../../../../Test\"'"],
"//conditions:default":
["GLSLANG_TEST_DIRECTORY='\"Test\"'"],
}),
linkstatic = 1,
deps = [
":SPIRV",
":glslang",
":glslang-default-resource-limits",
"@com_google_googletest//:gtest",
],
)
GLSLANG_TESTS = glob(
["gtests/*.FromFile.cpp"],
# Since we are not building the SPIRV-Tools dependency, the following tests
# cannot be performed.
exclude = [
"gtests/Hlsl.FromFile.cpp",
"gtests/Spv.FromFile.cpp",
],
)
[cc_test(
name = test_file.replace("gtests/", "").replace(".FromFile.cpp", "") + "_test",
srcs = [test_file],
copts = COMMON_COPTS,
data = [
":test_files",
],
deps = [
":SPIRV",
":glslang",
":glslang_test_lib",
],
) for test_file in GLSLANG_TESTS]

View File

@ -33,6 +33,19 @@
import("//build_overrides/glslang.gni")
# Both Chromium and Fuchsia use by default a set of warning errors
# that is far too strict to compile this project. These are also
# typically appended after |cflags|, overriding target-specific
# definitions. To work around this, determine which configs to
# add and remove in order to succesfully build the project.
if (defined(is_fuchsia_tree) && is_fuchsia_tree) {
_configs_to_remove = [ "//build/config:default_warnings" ]
_configs_to_add = []
} else {
_configs_to_remove = [ "//build/config/compiler:chromium_code" ]
_configs_to_add = [ "//build/config/compiler:no_chromium_code" ]
}
spirv_tools_dir = glslang_spirv_tools_dir
config("glslang_public") {
@ -182,8 +195,8 @@ source_set("glslang_sources") {
"${spirv_tools_dir}:spvtools_val",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs -= _configs_to_remove
configs += _configs_to_add
}
source_set("glslang_default_resource_limits_sources") {
@ -196,8 +209,8 @@ source_set("glslang_default_resource_limits_sources") {
]
public_configs = [ ":glslang_public" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs -= _configs_to_remove
configs += _configs_to_add
}
executable("glslang_validator") {
@ -214,8 +227,8 @@ executable("glslang_validator") {
":glslang_sources",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs -= _configs_to_remove
configs += _configs_to_add
}
executable("spirv-remap") {
@ -227,6 +240,6 @@ executable("spirv-remap") {
":glslang_sources",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs -= _configs_to_remove
configs += _configs_to_add
}

View File

@ -6,6 +6,9 @@ if (POLICY CMP0048)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Enable compile commands database
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Adhere to GNU filesystem layout conventions
include(GNUInstallDirs)

View File

@ -292,8 +292,8 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage)
switch (stage) {
case EShLangVertex: return spv::ExecutionModelVertex;
case EShLangFragment: return spv::ExecutionModelFragment;
#ifndef GLSLANG_WEB
case EShLangCompute: return spv::ExecutionModelGLCompute;
#ifndef GLSLANG_WEB
case EShLangTessControl: return spv::ExecutionModelTessellationControl;
case EShLangTessEvaluation: return spv::ExecutionModelTessellationEvaluation;
case EShLangGeometry: return spv::ExecutionModelGeometry;
@ -374,22 +374,20 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useSto
// Translate glslang type to SPIR-V memory decorations.
void TranslateMemoryDecoration(const glslang::TQualifier& qualifier, std::vector<spv::Decoration>& memory, bool useVulkanMemoryModel)
{
#ifndef GLSLANG_WEB
if (!useVulkanMemoryModel) {
if (qualifier.coherent)
if (qualifier.isCoherent())
memory.push_back(spv::DecorationCoherent);
if (qualifier.volatil) {
if (qualifier.isVolatile()) {
memory.push_back(spv::DecorationVolatile);
memory.push_back(spv::DecorationCoherent);
}
}
if (qualifier.restrict)
if (qualifier.isRestrict())
memory.push_back(spv::DecorationRestrict);
if (qualifier.isReadOnly())
memory.push_back(spv::DecorationNonWritable);
if (qualifier.isWriteOnly())
memory.push_back(spv::DecorationNonReadable);
#endif
}
// Translate glslang type to SPIR-V layout decorations.
@ -673,6 +671,13 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case glslang::EbvFace: return spv::BuiltInFrontFacing;
case glslang::EbvFragDepth: return spv::BuiltInFragDepth;
case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups;
case glslang::EbvWorkGroupSize: return spv::BuiltInWorkgroupSize;
case glslang::EbvWorkGroupId: return spv::BuiltInWorkgroupId;
case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId;
case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex;
case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId;
#ifndef GLSLANG_WEB
// These *Distance capabilities logically belong here, but if the member is declared and
// then never used, consumers of SPIR-V prefer the capability not be declared.
@ -757,12 +762,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case glslang::EbvTessCoord: return spv::BuiltInTessCoord;
case glslang::EbvPatchVertices: return spv::BuiltInPatchVertices;
case glslang::EbvHelperInvocation: return spv::BuiltInHelperInvocation;
case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups;
case glslang::EbvWorkGroupSize: return spv::BuiltInWorkgroupSize;
case glslang::EbvWorkGroupId: return spv::BuiltInWorkgroupId;
case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId;
case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex;
case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId;
case glslang::EbvSubGroupSize:
builder.addExtension(spv::E_SPV_KHR_shader_ballot);
@ -1203,8 +1202,8 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
case glslang::EvqGlobal: return spv::StorageClassPrivate;
case glslang::EvqConstReadOnly: return spv::StorageClassFunction;
case glslang::EvqTemporary: return spv::StorageClassFunction;
#ifndef GLSLANG_WEB
case glslang::EvqShared: return spv::StorageClassWorkgroup;
#ifndef GLSLANG_WEB
case glslang::EvqPayloadNV: return spv::StorageClassRayPayloadNV;
case glslang::EvqPayloadInNV: return spv::StorageClassIncomingRayPayloadNV;
case glslang::EvqHitAttrNV: return spv::StorageClassHitAttributeNV;
@ -1465,13 +1464,20 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
if (mode != spv::ExecutionModeMax)
builder.addExecutionMode(shaderEntry, (spv::ExecutionMode)mode);
switch (glslangIntermediate->getInterlockOrdering()) {
case glslang::EioPixelInterlockOrdered: mode = spv::ExecutionModePixelInterlockOrderedEXT; break;
case glslang::EioPixelInterlockUnordered: mode = spv::ExecutionModePixelInterlockUnorderedEXT; break;
case glslang::EioSampleInterlockOrdered: mode = spv::ExecutionModeSampleInterlockOrderedEXT; break;
case glslang::EioSampleInterlockUnordered: mode = spv::ExecutionModeSampleInterlockUnorderedEXT; break;
case glslang::EioShadingRateInterlockOrdered: mode = spv::ExecutionModeShadingRateInterlockOrderedEXT; break;
case glslang::EioShadingRateInterlockUnordered: mode = spv::ExecutionModeShadingRateInterlockUnorderedEXT; break;
default: mode = spv::ExecutionModeMax; break;
case glslang::EioPixelInterlockOrdered: mode = spv::ExecutionModePixelInterlockOrderedEXT;
break;
case glslang::EioPixelInterlockUnordered: mode = spv::ExecutionModePixelInterlockUnorderedEXT;
break;
case glslang::EioSampleInterlockOrdered: mode = spv::ExecutionModeSampleInterlockOrderedEXT;
break;
case glslang::EioSampleInterlockUnordered: mode = spv::ExecutionModeSampleInterlockUnorderedEXT;
break;
case glslang::EioShadingRateInterlockOrdered: mode = spv::ExecutionModeShadingRateInterlockOrderedEXT;
break;
case glslang::EioShadingRateInterlockUnordered: mode = spv::ExecutionModeShadingRateInterlockUnorderedEXT;
break;
default: mode = spv::ExecutionModeMax;
break;
}
if (mode != spv::ExecutionModeMax) {
builder.addExecutionMode(shaderEntry, (spv::ExecutionMode)mode);
@ -1489,7 +1495,6 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
#endif
break;
#ifndef GLSLANG_WEB
case EShLangCompute:
builder.addCapability(spv::CapabilityShader);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
@ -1505,6 +1510,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives);
}
break;
#ifndef GLSLANG_WEB
case EShLangTessEvaluation:
case EShLangTessControl:
builder.addCapability(spv::CapabilityTessellation);
@ -2546,7 +2552,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
binOp = glslang::EOpMod;
break;
#ifndef GLSLANG_WEB
case glslang::EOpEmitVertex:
case glslang::EOpEndPrimitive:
case glslang::EOpBarrier:
@ -2570,10 +2575,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
// These all have 0 operands and will naturally finish up in the code below for 0 operands
break;
case glslang::EOpAtomicStore:
noReturnValue = true;
// fallthrough
case glslang::EOpAtomicLoad:
case glslang::EOpAtomicAdd:
case glslang::EOpAtomicMin:
case glslang::EOpAtomicMax:
@ -2585,6 +2586,14 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
atomic = true;
break;
#ifndef GLSLANG_WEB
case glslang::EOpAtomicStore:
noReturnValue = true;
// fallthrough
case glslang::EOpAtomicLoad:
atomic = true;
break;
case glslang::EOpAtomicCounterAdd:
case glslang::EOpAtomicCounterSubtract:
case glslang::EOpAtomicCounterMin:
@ -2667,6 +2676,19 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
if (arg == 1)
lvalue = true;
break;
case glslang::EOpAtomicAdd:
case glslang::EOpAtomicMin:
case glslang::EOpAtomicMax:
case glslang::EOpAtomicAnd:
case glslang::EOpAtomicOr:
case glslang::EOpAtomicXor:
case glslang::EOpAtomicExchange:
case glslang::EOpAtomicCompSwap:
if (arg == 0)
lvalue = true;
break;
#ifndef GLSLANG_WEB
case glslang::EOpFrexp:
if (arg == 1)
@ -2685,14 +2707,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
invertedType = convertGlslangToSpvType(glslangOperands[0]->getAsBinaryNode()->getLeft()->getType());
}
break;
case glslang::EOpAtomicAdd:
case glslang::EOpAtomicMin:
case glslang::EOpAtomicMax:
case glslang::EOpAtomicAnd:
case glslang::EOpAtomicOr:
case glslang::EOpAtomicXor:
case glslang::EOpAtomicExchange:
case glslang::EOpAtomicCompSwap:
case glslang::EOpAtomicLoad:
case glslang::EOpAtomicStore:
case glslang::EOpAtomicCounterAdd:
@ -2818,12 +2832,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
builder.createNoResultOp(spv::OpCooperativeMatrixStoreNV, idImmOps);
result = 0;
} else if (atomic) {
// Handle all atomics
result = createAtomicOperation(node->getOp(), precision, resultType(), operands, node->getBasicType(), lvalueCoherentFlags);
} else
#endif
{
if (atomic) {
// Handle all atomics
result = createAtomicOperation(node->getOp(), precision, resultType(), operands, node->getBasicType(), lvalueCoherentFlags);
} else {
// Pass through to generic operations.
switch (glslangOperands.size()) {
case 0:
@ -3535,8 +3549,8 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5);
builder.addCapability(spv::CapabilityRuntimeDescriptorArrayEXT);
}
spvType = builder.makeRuntimeArray(spvType);
#endif
spvType = builder.makeRuntimeArray(spvType);
}
if (stride > 0)
builder.addDecoration(spvType, spv::DecorationArrayStride, stride);
@ -3701,6 +3715,7 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
for (unsigned int i = 0; i < memory.size(); ++i)
builder.addMemberDecoration(spvType, member, memory[i]);
}
#endif
// Location assignment was already completed correctly by the front end,
@ -4159,9 +4174,11 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
// memory and use RestrictPointer/AliasedPointer.
if (originalParam(type.getQualifier().storage, type, false) ||
!writableParam(type.getQualifier().storage)) {
decorations.push_back(type.getQualifier().restrict ? spv::DecorationRestrict : spv::DecorationAliased);
decorations.push_back(type.getQualifier().isRestrict() ? spv::DecorationRestrict :
spv::DecorationAliased);
} else {
decorations.push_back(type.getQualifier().restrict ? spv::DecorationRestrictPointerEXT : spv::DecorationAliasedPointerEXT);
decorations.push_back(type.getQualifier().isRestrict() ? spv::DecorationRestrictPointerEXT :
spv::DecorationAliasedPointerEXT);
}
}
};
@ -4969,6 +4986,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
}
}
#ifndef GLSLANG_WEB
// nonprivate
if (imageType.getQualifier().nonprivate) {
params.nonprivate = true;
@ -4978,6 +4996,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
if (imageType.getQualifier().volatil) {
params.volatil = true;
}
#endif
std::vector<spv::Id> result( 1,
builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather,
@ -7170,6 +7189,48 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
case glslang::EOpRefract:
libCall = spv::GLSLstd450Refract;
break;
case glslang::EOpBarrier:
{
// This is for the extended controlBarrier function, with four operands.
// The unextended barrier() goes through createNoArgOperation.
assert(operands.size() == 4);
unsigned int executionScope = builder.getConstantScalar(operands[0]);
unsigned int memoryScope = builder.getConstantScalar(operands[1]);
unsigned int semantics = builder.getConstantScalar(operands[2]) | builder.getConstantScalar(operands[3]);
builder.createControlBarrier((spv::Scope)executionScope, (spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics);
if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask |
spv::MemorySemanticsMakeVisibleKHRMask |
spv::MemorySemanticsOutputMemoryKHRMask |
spv::MemorySemanticsVolatileMask)) {
builder.addCapability(spv::CapabilityVulkanMemoryModelKHR);
}
if (glslangIntermediate->usingVulkanMemoryModel() && (executionScope == spv::ScopeDevice || memoryScope == spv::ScopeDevice)) {
builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR);
}
return 0;
}
break;
case glslang::EOpMemoryBarrier:
{
// This is for the extended memoryBarrier function, with three operands.
// The unextended memoryBarrier() goes through createNoArgOperation.
assert(operands.size() == 3);
unsigned int memoryScope = builder.getConstantScalar(operands[0]);
unsigned int semantics = builder.getConstantScalar(operands[1]) | builder.getConstantScalar(operands[2]);
builder.createMemoryBarrier((spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics);
if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask |
spv::MemorySemanticsMakeVisibleKHRMask |
spv::MemorySemanticsOutputMemoryKHRMask |
spv::MemorySemanticsVolatileMask)) {
builder.addCapability(spv::CapabilityVulkanMemoryModelKHR);
}
if (glslangIntermediate->usingVulkanMemoryModel() && memoryScope == spv::ScopeDevice) {
builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR);
}
return 0;
}
break;
#ifndef GLSLANG_WEB
case glslang::EOpInterpolateAtSample:
if (typeProxy == glslang::EbtFloat16)
@ -7328,47 +7389,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_explicit_vertex_parameter);
libCall = spv::InterpolateAtVertexAMD;
break;
case glslang::EOpBarrier:
{
// This is for the extended controlBarrier function, with four operands.
// The unextended barrier() goes through createNoArgOperation.
assert(operands.size() == 4);
unsigned int executionScope = builder.getConstantScalar(operands[0]);
unsigned int memoryScope = builder.getConstantScalar(operands[1]);
unsigned int semantics = builder.getConstantScalar(operands[2]) | builder.getConstantScalar(operands[3]);
builder.createControlBarrier((spv::Scope)executionScope, (spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics);
if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask |
spv::MemorySemanticsMakeVisibleKHRMask |
spv::MemorySemanticsOutputMemoryKHRMask |
spv::MemorySemanticsVolatileMask)) {
builder.addCapability(spv::CapabilityVulkanMemoryModelKHR);
}
if (glslangIntermediate->usingVulkanMemoryModel() && (executionScope == spv::ScopeDevice || memoryScope == spv::ScopeDevice)) {
builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR);
}
return 0;
}
break;
case glslang::EOpMemoryBarrier:
{
// This is for the extended memoryBarrier function, with three operands.
// The unextended memoryBarrier() goes through createNoArgOperation.
assert(operands.size() == 3);
unsigned int memoryScope = builder.getConstantScalar(operands[0]);
unsigned int semantics = builder.getConstantScalar(operands[1]) | builder.getConstantScalar(operands[2]);
builder.createMemoryBarrier((spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics);
if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask |
spv::MemorySemanticsMakeVisibleKHRMask |
spv::MemorySemanticsOutputMemoryKHRMask |
spv::MemorySemanticsVolatileMask)) {
builder.addCapability(spv::CapabilityVulkanMemoryModelKHR);
}
if (glslangIntermediate->usingVulkanMemoryModel() && memoryScope == spv::ScopeDevice) {
builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR);
}
return 0;
}
break;
case glslang::EOpReportIntersectionNV:
{
@ -7476,17 +7496,10 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
// Intrinsics with no arguments (or no return value, and no precision).
spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId)
{
#ifndef GLSLANG_WEB
// GLSL memory barriers use queuefamily scope in new model, device scope in old model
spv::Scope memoryBarrierScope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice;
switch (op) {
case glslang::EOpEmitVertex:
builder.createNoResultOp(spv::OpEmitVertex);
return 0;
case glslang::EOpEndPrimitive:
builder.createNoResultOp(spv::OpEndPrimitive);
return 0;
case glslang::EOpBarrier:
if (glslangIntermediate->getStage() == EShLangTessControl) {
if (glslangIntermediate->usingVulkanMemoryModel()) {
@ -7507,18 +7520,10 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAllMemory |
spv::MemorySemanticsAcquireReleaseMask);
return 0;
case glslang::EOpMemoryBarrierAtomicCounter:
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAtomicCounterMemoryMask |
spv::MemorySemanticsAcquireReleaseMask);
return 0;
case glslang::EOpMemoryBarrierBuffer:
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsUniformMemoryMask |
spv::MemorySemanticsAcquireReleaseMask);
return 0;
case glslang::EOpMemoryBarrierImage:
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsImageMemoryMask |
spv::MemorySemanticsAcquireReleaseMask);
return 0;
case glslang::EOpMemoryBarrierShared:
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsWorkgroupMemoryMask |
spv::MemorySemanticsAcquireReleaseMask);
@ -7527,6 +7532,15 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
builder.createMemoryBarrier(spv::ScopeWorkgroup, spv::MemorySemanticsAllMemory |
spv::MemorySemanticsAcquireReleaseMask);
return 0;
#ifndef GLSLANG_WEB
case glslang::EOpMemoryBarrierAtomicCounter:
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAtomicCounterMemoryMask |
spv::MemorySemanticsAcquireReleaseMask);
return 0;
case glslang::EOpMemoryBarrierImage:
builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsImageMemoryMask |
spv::MemorySemanticsAcquireReleaseMask);
return 0;
case glslang::EOpAllMemoryBarrierWithGroupSync:
builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeDevice,
spv::MemorySemanticsAllMemory |
@ -7571,6 +7585,14 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
builder.createMemoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsWorkgroupMemoryMask |
spv::MemorySemanticsAcquireReleaseMask);
return spv::NoResult;
case glslang::EOpEmitVertex:
builder.createNoResultOp(spv::OpEmitVertex);
return 0;
case glslang::EOpEndPrimitive:
builder.createNoResultOp(spv::OpEndPrimitive);
return 0;
case glslang::EOpSubgroupElect: {
std::vector<spv::Id> operands;
return createSubgroupOperation(op, typeId, operands, glslang::EbtVoid);
@ -7618,10 +7640,10 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
builder.addCapability(spv::CapabilityShaderClockKHR);
return builder.createOp(spv::OpReadClockKHR, typeId, args);
}
#endif
default:
break;
}
#endif
logger->missingFunctionality("unknown operation with no arguments");
@ -7826,7 +7848,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
// We now know we have a specialization constant to build
#ifndef GLSLANG_WEB
// gl_WorkGroupSize is a special case until the front-end handles hierarchical specialization constants,
// even then, it's specialization ids are handled by special case syntax in GLSL: layout(local_size_x = ...
if (node.getType().getQualifier().builtIn == glslang::EbvWorkGroupSize) {
@ -7841,7 +7862,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
}
return builder.makeCompositeConstant(builder.makeVectorType(builder.makeUintType(32), 3), dimConstId, true);
}
#endif
// An AST node labelled as specialization constant should be a symbol node.
// Its initializer should either be a sub tree with constant nodes, or a constant union array.

View File

@ -173,6 +173,7 @@ void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int>
if (options->generateDebugInfo) {
optimizer.RegisterPass(spvtools::CreatePropagateLineInfoPass());
}
optimizer.RegisterPass(spvtools::CreateWrapOpKillPass());
optimizer.RegisterPass(spvtools::CreateDeadBranchElimPass());
optimizer.RegisterPass(spvtools::CreateMergeReturnPass());
optimizer.RegisterPass(spvtools::CreateInlineExhaustivePass());
@ -196,8 +197,6 @@ void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int>
optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass());
if (options->optimizeSize) {
optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass());
// TODO(greg-lunarg): Add this when AMD driver issues are resolved
// optimizer.RegisterPass(CreateCommonUniformElimPass());
}
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
optimizer.RegisterPass(spvtools::CreateCFGCleanupPass());

View File

@ -4,8 +4,9 @@ set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
set_property(TARGET glslang-default-resource-limits PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(glslang-default-resource-limits
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${PROJECT_SOURCE_DIR})
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
set(SOURCES StandAlone.cpp DirStackFileIncluder.h)
set(REMAPPER_SOURCES spirv-remap.cpp)

View File

@ -1 +1 @@
388096 ../build/install/bin/glslangValidator.exe
396288 ../build/install/bin/glslangValidator.exe

View File

@ -0,0 +1,157 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 108
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %gl_NumWorkGroups %gl_WorkGroupID %gl_LocalInvocationID %gl_GlobalInvocationID %gl_LocalInvocationIndex
OpExecutionMode %main LocalSize 2 5 7
OpSource ESSL 310
OpName %main "main"
OpName %bName "bName"
OpMemberName %bName 0 "size"
OpMemberName %bName 1 "count"
OpMemberName %bName 2 "data"
OpName %bInst "bInst"
OpName %s "s"
OpName %arrX "arrX"
OpName %arrY "arrY"
OpName %arrZ "arrZ"
OpName %gl_NumWorkGroups "gl_NumWorkGroups"
OpName %gl_WorkGroupID "gl_WorkGroupID"
OpName %gl_LocalInvocationID "gl_LocalInvocationID"
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex"
OpDecorate %_runtimearr_v4float ArrayStride 16
OpMemberDecorate %bName 0 Offset 0
OpMemberDecorate %bName 1 Offset 16
OpMemberDecorate %bName 2 Offset 32
OpDecorate %bName BufferBlock
OpDecorate %bInst DescriptorSet 0
OpDecorate %bInst Binding 0
OpDecorate %39 SpecId 18
OpDecorate %41 SpecId 19
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
OpDecorate %gl_NumWorkGroups BuiltIn NumWorkgroups
OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
%void = OpTypeVoid
%3 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%int = OpTypeInt 32 1
%v3uint = OpTypeVector %uint 3
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_runtimearr_v4float = OpTypeRuntimeArray %v4float
%bName = OpTypeStruct %int %v3uint %_runtimearr_v4float
%_ptr_Uniform_bName = OpTypePointer Uniform %bName
%bInst = OpVariable %_ptr_Uniform_bName Uniform
%int_2 = OpConstant %int 2
%int_0 = OpConstant %int 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%float_7 = OpConstant %float 7
%24 = OpConstantComposite %v4float %float_7 %float_7 %float_7 %float_7
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%uint_1 = OpConstant %uint 1
%uint_3400 = OpConstant %uint 3400
%uint_72 = OpConstant %uint 72
%uint_197645 = OpConstant %uint 197645
%_arr_v4float_uint_197645 = OpTypeArray %v4float %uint_197645
%_ptr_Workgroup__arr_v4float_uint_197645 = OpTypePointer Workgroup %_arr_v4float_uint_197645
%s = OpVariable %_ptr_Workgroup__arr_v4float_uint_197645 Workgroup
%int_3 = OpConstant %int 3
%float_0 = OpConstant %float 0
%39 = OpSpecConstant %uint 2
%uint_5 = OpConstant %uint 5
%41 = OpSpecConstant %uint 7
%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %39 %uint_5 %41
%uint_0 = OpConstant %uint 0
%_arr_int_44 = OpTypeArray %int %44
%_ptr_Private__arr_int_44 = OpTypePointer Private %_arr_int_44
%arrX = OpVariable %_ptr_Private__arr_int_44 Private
%_ptr_Private_int = OpTypePointer Private %int
%_arr_int_52 = OpTypeArray %int %52
%_ptr_Private__arr_int_52 = OpTypePointer Private %_arr_int_52
%arrY = OpVariable %_ptr_Private__arr_int_52 Private
%_arr_int_59 = OpTypeArray %int %59
%_ptr_Private__arr_int_59 = OpTypePointer Private %_arr_int_59
%arrZ = OpVariable %_ptr_Private__arr_int_59 Private
%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
%int_1 = OpConstant %int 1
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%gl_NumWorkGroups = OpVariable %_ptr_Input_v3uint Input
%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input
%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%_ptr_Input_uint = OpTypePointer Input %uint
%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
%int_5 = OpConstant %int 5
%int_197645 = OpConstant %int 197645
%main = OpFunction %void None %3
%5 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%20 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%21 = OpLoad %int %20
%22 = OpSDiv %int %21 %int_2
%26 = OpAccessChain %_ptr_Uniform_v4float %bInst %int_2 %22
%27 = OpLoad %v4float %26
%28 = OpFMul %v4float %27 %24
%29 = OpAccessChain %_ptr_Uniform_v4float %bInst %int_2 %22
OpStore %29 %28
OpMemoryBarrier %uint_1 %uint_3400
OpMemoryBarrier %uint_2 %uint_3400
OpMemoryBarrier %uint_1 %uint_264
OpMemoryBarrier %uint_1 %uint_72
%44 = OpCompositeExtract %uint %gl_WorkGroupSize 0
%49 = OpAccessChain %_ptr_Private_int %arrX %int_0
%50 = OpLoad %int %49
%51 = OpConvertSToF %float %50
%52 = OpCompositeExtract %uint %gl_WorkGroupSize 1
%56 = OpAccessChain %_ptr_Private_int %arrY %int_0
%57 = OpLoad %int %56
%58 = OpConvertSToF %float %57
%59 = OpCompositeExtract %uint %gl_WorkGroupSize 2
%63 = OpAccessChain %_ptr_Private_int %arrZ %int_0
%64 = OpLoad %int %63
%65 = OpConvertSToF %float %64
%66 = OpCompositeConstruct %v4float %float_0 %51 %58 %65
%68 = OpAccessChain %_ptr_Workgroup_v4float %s %int_3
OpStore %68 %66
%72 = OpLoad %v3uint %gl_NumWorkGroups
%73 = OpIAdd %v3uint %72 %gl_WorkGroupSize
%75 = OpLoad %v3uint %gl_WorkGroupID
%76 = OpIAdd %v3uint %73 %75
%78 = OpLoad %v3uint %gl_LocalInvocationID
%79 = OpIAdd %v3uint %76 %78
%81 = OpLoad %v3uint %gl_GlobalInvocationID
%84 = OpLoad %uint %gl_LocalInvocationIndex
%85 = OpCompositeConstruct %v3uint %84 %84 %84
%86 = OpIMul %v3uint %81 %85
%87 = OpIAdd %v3uint %79 %86
%89 = OpAccessChain %_ptr_Uniform_v3uint %bInst %int_1
OpStore %89 %87
%90 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%91 = OpAtomicIAdd %int %90 %uint_1 %uint_0 %int_2
%92 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%93 = OpAtomicSMin %int %92 %uint_1 %uint_0 %int_2
%94 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%95 = OpAtomicSMax %int %94 %uint_1 %uint_0 %int_2
%96 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%97 = OpAtomicAnd %int %96 %uint_1 %uint_0 %int_2
%98 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%99 = OpAtomicOr %int %98 %uint_1 %uint_0 %int_2
%100 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%101 = OpAtomicXor %int %100 %uint_1 %uint_0 %int_2
%102 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%103 = OpAtomicExchange %int %102 %uint_1 %uint_0 %int_2
%104 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
%106 = OpAtomicCompareExchange %int %104 %uint_1 %uint_0 %uint_0 %int_2 %int_5
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,178 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 99
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %color %i
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 310
OpName %main "main"
OpName %color "color"
OpName %t2d "t2d"
OpName %s "s"
OpName %t3d "t3d"
OpName %sA "sA"
OpName %sShadow "sShadow"
OpName %i "i"
OpName %tex2D "tex2D"
OpName %texCube "texCube"
OpName %tex2DArray "tex2DArray"
OpName %itex2D "itex2D"
OpName %itex3D "itex3D"
OpName %itexCube "itexCube"
OpName %itex2DArray "itex2DArray"
OpName %utex2D "utex2D"
OpName %utex3D "utex3D"
OpName %utexCube "utexCube"
OpName %utex2DArray "utex2DArray"
OpName %tex3D "tex3D"
OpDecorate %color Location 0
OpDecorate %t2d RelaxedPrecision
OpDecorate %t2d DescriptorSet 0
OpDecorate %t2d Binding 3
OpDecorate %14 RelaxedPrecision
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 0
OpDecorate %23 RelaxedPrecision
OpDecorate %t3d DescriptorSet 0
OpDecorate %t3d Binding 4
OpDecorate %sA DescriptorSet 0
OpDecorate %sA Binding 2
OpDecorate %48 RelaxedPrecision
OpDecorate %51 RelaxedPrecision
OpDecorate %sShadow DescriptorSet 0
OpDecorate %sShadow Binding 1
OpDecorate %i RelaxedPrecision
OpDecorate %i Flat
OpDecorate %i Location 0
OpDecorate %tex2D RelaxedPrecision
OpDecorate %tex2D DescriptorSet 0
OpDecorate %tex2D Binding 5
OpDecorate %texCube RelaxedPrecision
OpDecorate %texCube DescriptorSet 0
OpDecorate %texCube Binding 6
OpDecorate %tex2DArray DescriptorSet 0
OpDecorate %tex2DArray Binding 15
OpDecorate %itex2D DescriptorSet 0
OpDecorate %itex2D Binding 16
OpDecorate %itex3D DescriptorSet 0
OpDecorate %itex3D Binding 17
OpDecorate %itexCube DescriptorSet 0
OpDecorate %itexCube Binding 18
OpDecorate %itex2DArray DescriptorSet 0
OpDecorate %itex2DArray Binding 19
OpDecorate %utex2D DescriptorSet 0
OpDecorate %utex2D Binding 20
OpDecorate %utex3D DescriptorSet 0
OpDecorate %utex3D Binding 21
OpDecorate %utexCube DescriptorSet 0
OpDecorate %utexCube Binding 22
OpDecorate %utex2DArray DescriptorSet 0
OpDecorate %utex2DArray Binding 23
OpDecorate %tex3D DescriptorSet 0
OpDecorate %tex3D Binding 36
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%color = OpVariable %_ptr_Output_v4float Output
%10 = OpTypeImage %float 2D 0 0 0 1 Unknown
%11 = OpTypeSampledImage %10
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%t2d = OpVariable %_ptr_UniformConstant_11 UniformConstant
%15 = OpTypeSampler
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
%s = OpVariable %_ptr_UniformConstant_15 UniformConstant
%v2float = OpTypeVector %float 2
%float_0_5 = OpConstant %float 0.5
%22 = OpConstantComposite %v2float %float_0_5 %float_0_5
%24 = OpTypeImage %float 3D 0 0 0 1 Unknown
%25 = OpTypeSampledImage %24
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_25_uint_4 = OpTypeArray %25 %uint_4
%_ptr_UniformConstant__arr_25_uint_4 = OpTypePointer UniformConstant %_arr_25_uint_4
%t3d = OpVariable %_ptr_UniformConstant__arr_25_uint_4 UniformConstant
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25
%_arr_15_uint_4 = OpTypeArray %15 %uint_4
%_ptr_UniformConstant__arr_15_uint_4 = OpTypePointer UniformConstant %_arr_15_uint_4
%sA = OpVariable %_ptr_UniformConstant__arr_15_uint_4 UniformConstant
%int_2 = OpConstant %int 2
%v3float = OpTypeVector %float 3
%44 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5
%sShadow = OpVariable %_ptr_UniformConstant_15 UniformConstant
%_ptr_Input_int = OpTypePointer Input %int
%i = OpVariable %_ptr_Input_int Input
%tex2D = OpVariable %_ptr_UniformConstant_11 UniformConstant
%58 = OpTypeImage %float Cube 0 0 0 1 Unknown
%59 = OpTypeSampledImage %58
%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
%texCube = OpVariable %_ptr_UniformConstant_59 UniformConstant
%62 = OpTypeImage %float 2D 0 1 0 1 Unknown
%63 = OpTypeSampledImage %62
%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
%tex2DArray = OpVariable %_ptr_UniformConstant_63 UniformConstant
%66 = OpTypeImage %int 2D 0 0 0 1 Unknown
%67 = OpTypeSampledImage %66
%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
%itex2D = OpVariable %_ptr_UniformConstant_67 UniformConstant
%70 = OpTypeImage %int 3D 0 0 0 1 Unknown
%71 = OpTypeSampledImage %70
%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
%itex3D = OpVariable %_ptr_UniformConstant_71 UniformConstant
%74 = OpTypeImage %int Cube 0 0 0 1 Unknown
%75 = OpTypeSampledImage %74
%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
%itexCube = OpVariable %_ptr_UniformConstant_75 UniformConstant
%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
%79 = OpTypeSampledImage %78
%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
%itex2DArray = OpVariable %_ptr_UniformConstant_79 UniformConstant
%82 = OpTypeImage %uint 2D 0 0 0 1 Unknown
%83 = OpTypeSampledImage %82
%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
%utex2D = OpVariable %_ptr_UniformConstant_83 UniformConstant
%86 = OpTypeImage %uint 3D 0 0 0 1 Unknown
%87 = OpTypeSampledImage %86
%_ptr_UniformConstant_87 = OpTypePointer UniformConstant %87
%utex3D = OpVariable %_ptr_UniformConstant_87 UniformConstant
%90 = OpTypeImage %uint Cube 0 0 0 1 Unknown
%91 = OpTypeSampledImage %90
%_ptr_UniformConstant_91 = OpTypePointer UniformConstant %91
%utexCube = OpVariable %_ptr_UniformConstant_91 UniformConstant
%94 = OpTypeImage %uint 2D 0 1 0 1 Unknown
%95 = OpTypeSampledImage %94
%_ptr_UniformConstant_95 = OpTypePointer UniformConstant %95
%utex2DArray = OpVariable %_ptr_UniformConstant_95 UniformConstant
%tex3D = OpVariable %_ptr_UniformConstant_25 UniformConstant
%main = OpFunction %void None %3
%5 = OpLabel
%14 = OpLoad %11 %t2d
%18 = OpLoad %15 %s
%19 = OpSampledImage %11 %14 %18
%23 = OpImageSampleImplicitLod %v4float %19 %22
OpStore %color %23
%34 = OpAccessChain %_ptr_UniformConstant_25 %t3d %int_1
%35 = OpLoad %25 %34
%40 = OpAccessChain %_ptr_UniformConstant_15 %sA %int_2
%41 = OpLoad %15 %40
%42 = OpSampledImage %25 %35 %41
%45 = OpImageSampleImplicitLod %v4float %42 %44
%46 = OpLoad %v4float %color
%47 = OpFAdd %v4float %46 %45
OpStore %color %47
%48 = OpLoad %11 %t2d
%49 = OpLoad %15 %s
%50 = OpSampledImage %11 %48 %49
%51 = OpImageSampleImplicitLod %v4float %50 %22
%52 = OpLoad %v4float %color
%53 = OpFAdd %v4float %52 %51
OpStore %color %53
OpReturn
OpFunctionEnd

50
3rdparty/glslang/Test/web.comp vendored Normal file
View File

@ -0,0 +1,50 @@
#version 310 es
layout(local_size_x_id = 18, local_size_z_id = 19) in;
layout(local_size_x = 2) in;
layout(local_size_y = 5) in;
layout(local_size_z = 7) in;
const int total = gl_MaxComputeWorkGroupCount.x
+ gl_MaxComputeWorkGroupCount.y
+ gl_MaxComputeWorkGroupCount.z
+ gl_MaxComputeUniformComponents
+ gl_MaxComputeTextureImageUnits;
shared vec4 s[total];
int arrX[gl_WorkGroupSize.x];
int arrY[gl_WorkGroupSize.y];
int arrZ[gl_WorkGroupSize.z];
layout(binding = 0, set = 0) buffer bName {
int size;
uvec3 count;
vec4 data[];
} bInst;
void main()
{
barrier();
bInst.data[bInst.size / 2] *= vec4(7.0);
memoryBarrier();
groupMemoryBarrier();
memoryBarrierShared();
memoryBarrierBuffer();
s[3] = vec4(0, arrX[0], arrY[0], arrZ[0]);
bInst.count = gl_NumWorkGroups + gl_WorkGroupSize + gl_WorkGroupID + gl_LocalInvocationID +
gl_GlobalInvocationID * gl_LocalInvocationIndex;
atomicAdd(bInst.size, 2);
atomicMin(bInst.size, 2);
atomicMax(bInst.size, 2);
atomicAnd(bInst.size, 2);
atomicOr(bInst.size, 2);
atomicXor(bInst.size, 2);
atomicExchange(bInst.size, 2);
atomicCompSwap(bInst.size, 5, 2);
}

63
3rdparty/glslang/Test/web.separate.frag vendored Normal file
View File

@ -0,0 +1,63 @@
#version 310 es
precision highp sampler;
precision highp samplerShadow;
precision highp texture2DArray;
precision highp itexture2D;
precision highp itexture3D;
precision highp itextureCube;
precision highp itexture2DArray;
precision highp utexture2D;
precision highp utexture3D;
precision highp utextureCube;
precision highp utexture2DArray;
precision highp texture3D;
precision highp float;
layout(binding = 0) uniform sampler s;
layout(binding = 1) uniform samplerShadow sShadow;
layout(binding = 2) uniform sampler sA[4];
layout(binding = 3) uniform texture2D t2d;
layout(binding = 4) uniform texture3D t3d[4];
layout(location = 0) flat in int i;
layout(location = 0) out vec4 color;
void main()
{
color = texture(sampler2D(t2d, s), vec2(0.5));
color += texture(sampler3D(t3d[1], sA[2]), vec3(0.5));
color += texture(sampler2D(t2d, s), vec2(0.5));
}
layout(binding = 5) uniform texture2D tex2D;
layout(binding = 6) uniform textureCube texCube;
layout(binding = 15) uniform texture2DArray tex2DArray;
layout(binding = 16) uniform itexture2D itex2D;
layout(binding = 17) uniform itexture3D itex3D;
layout(binding = 18) uniform itextureCube itexCube;
layout(binding = 19) uniform itexture2DArray itex2DArray;
layout(binding = 20) uniform utexture2D utex2D;
layout(binding = 21) uniform utexture3D utex3D;
layout(binding = 22) uniform utextureCube utexCube;
layout(binding = 23) uniform utexture2DArray utex2DArray;
layout(binding = 36) uniform texture3D tex3D;
void foo()
{
sampler2D (tex2D, s);
samplerCube (texCube, s);
samplerCubeShadow (texCube, sShadow);
sampler2DArray (tex2DArray, s);
sampler2DArrayShadow (tex2DArray, sShadow);
isampler2D (itex2D, s);
isampler3D (itex3D, s);
isamplerCube (itexCube, s);
isampler2DArray (itex2DArray, s);
usampler2D (utex2D, s);
usampler3D (utex3D, s);
usamplerCube (utexCube, s);
usampler2DArray (utex2DArray, s);
sampler3D (tex3D, s);
sampler2DShadow (tex2D, sShadow);
}

View File

@ -5,3 +5,5 @@ web.controlFlow.frag
web.operations.frag
web.texture.frag
web.array.frag
web.separate.frag
web.comp

27
3rdparty/glslang/WORKSPACE vendored Normal file
View File

@ -0,0 +1,27 @@
workspace(name = "org_khronos_glslang")
load(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
)
http_archive(
name = "com_google_googletest",
sha256 = "ef9e2e12e7bf115ee48b427ae171fc869eeaf1b532c0fcfd982f6a353d2471b4",
strip_prefix = "googletest-37ae1fc5e6be26f367d76c078beabd7024fed53a",
urls = ["https://github.com/google/googletest/archive/37ae1fc5e6be26f367d76c078beabd7024fed53a.zip"], # 2018-07-16
)
http_archive(
name = "com_googlesource_code_re2",
sha256 = "b885bb965ab4b6cf8718bbb8154d8f6474cd00331481b6d3e390babb3532263e",
strip_prefix = "re2-e860767c86e577b87deadf24cc4567ea83c4f162/",
urls = ["https://github.com/google/re2/archive/e860767c86e577b87deadf24cc4567ea83c4f162.zip"],
)
http_archive(
name = "com_google_effcee",
build_file = "BUILD.effcee.bazel",
sha256 = "b0c21a01995fdf9792510566d78d5e7fe6f83cb4ba986eba691f4926f127cb34",
strip_prefix = "effcee-8f0a61dc95e0df18c18e0ac56d83b3fa9d2fe90b/",
urls = ["https://github.com/google/effcee/archive/8f0a61dc95e0df18c18e0ac56d83b3fa9d2fe90b.zip"],
)

View File

@ -79,6 +79,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool ms : 1;
bool image : 1; // image, combined should be false
bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler
bool sampler : 1; // true means a pure sampler, other fields should be clear()
#ifdef ENABLE_HLSL
unsigned int vectorSize : 3; // vector return type size.
unsigned int getVectorSize() const { return vectorSize; }
@ -105,8 +106,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool isRect() const { return false; }
bool isSubpass() const { return false; }
bool isCombined() const { return true; }
bool isPureSampler() const { return false; }
bool isTexture() const { return false; }
bool isImage() const { return false; }
bool isImageClass() const { return false; }
bool isMultiSample() const { return false; }
@ -114,7 +113,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
void setExternal(bool e) { }
bool isYuv() const { return false; }
#else
bool sampler : 1; // true means a pure sampler, other fields should be clear()
bool external : 1; // GL_OES_EGL_image_external
bool yuv : 1; // GL_EXT_YUV_target
// Some languages support structures as sample results. Storing the whole structure in the
@ -125,8 +123,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool isRect() const { return dim == EsdRect; }
bool isSubpass() const { return dim == EsdSubpass; }
bool isCombined() const { return combined; }
bool isPureSampler() const { return sampler; }
bool isTexture() const { return !sampler && !image; }
bool isImage() const { return image && !isSubpass(); }
bool isImageClass() const { return image; }
bool isMultiSample() const { return ms; }
@ -134,6 +130,9 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
void setExternal(bool e) { external = e; }
bool isYuv() const { return yuv; }
#endif
bool isTexture() const { return !sampler && !image; }
bool isPureSampler() const { return sampler; }
void setCombined(bool c) { combined = c; }
void setBasicType(TBasicType t) { type = t; }
TBasicType getBasicType() const { return type; }
@ -149,8 +148,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
ms = false;
image = false;
combined = false;
#ifndef GLSLANG_WEB
sampler = false;
#ifndef GLSLANG_WEB
external = false;
yuv = false;
#endif
@ -197,6 +196,14 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
ms = m;
}
// make a pure sampler, no texture, no image, nothing combined, the 'sampler' keyword
void setPureSampler(bool s)
{
clear();
sampler = true;
shadow = s;
}
#ifndef GLSLANG_WEB
// make a subpass input attachment
void setSubpass(TBasicType t, bool m = false)
@ -207,14 +214,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
dim = EsdSubpass;
ms = m;
}
// make a pure sampler, no texture, no image, nothing combined, the 'sampler' keyword
void setPureSampler(bool s)
{
clear();
sampler = true;
shadow = s;
}
#endif
bool operator==(const TSampler& right) const
@ -529,6 +528,7 @@ public:
void clearMemory()
{
#ifndef GLSLANG_WEB
coherent = false;
devicecoherent = false;
queuefamilycoherent = false;
@ -539,6 +539,7 @@ public:
restrict = false;
readonly = false;
writeonly = false;
#endif
}
const char* semanticName;
@ -551,16 +552,6 @@ public:
bool centroid : 1;
bool smooth : 1;
bool flat : 1;
bool coherent : 1;
bool devicecoherent : 1;
bool queuefamilycoherent : 1;
bool workgroupcoherent : 1;
bool subgroupcoherent : 1;
bool nonprivate : 1;
bool volatil : 1;
bool restrict : 1;
bool readonly : 1;
bool writeonly : 1;
// having a constant_id is not sufficient: expressions have no id, but are still specConstant
bool specConstant : 1;
bool nonUniform : 1;
@ -568,6 +559,9 @@ public:
#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; }
@ -589,8 +583,21 @@ public:
bool perTaskNV : 1;
bool patch : 1;
bool sample : 1;
bool restrict : 1;
bool readonly : 1;
bool writeonly : 1;
bool coherent : 1;
bool volatil : 1;
bool devicecoherent : 1;
bool queuefamilycoherent : 1;
bool workgroupcoherent : 1;
bool subgroupcoherent : 1;
bool nonprivate : 1;
bool isWriteOnly() const { return writeonly; }
bool isReadOnly() const { return readonly; }
bool isRestrict() const { return restrict; }
bool isCoherent() const { return coherent; }
bool isVolatile() const { return volatil; }
bool isSample() const { return sample; }
bool isMemory() const
{
@ -781,8 +788,8 @@ public:
{
layoutLocation = layoutLocationEnd;
layoutComponent = layoutComponentEnd;
layoutIndex = layoutIndexEnd;
#ifndef GLSLANG_WEB
layoutIndex = layoutIndexEnd;
clearStreamLayout();
clearXfbLayout();
#endif
@ -887,7 +894,9 @@ public:
layoutSet = layoutSetEnd;
layoutBinding = layoutBindingEnd;
#ifndef GLSLANG_WEB
layoutAttachment = layoutAttachmentEnd;
#endif
}
bool hasMatrix() const
@ -924,6 +933,7 @@ public:
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; }
@ -948,6 +958,7 @@ public:
{
return layoutIndex != layoutIndexEnd;
}
unsigned getIndex() const { return layoutIndex; }
bool hasComponent() const
{
return layoutComponent != layoutComponentEnd;
@ -1922,6 +1933,7 @@ public:
case EbtFloat: return "float";
case EbtInt: return "int";
case EbtUint: return "uint";
case EbtSampler: return "sampler/image";
#ifndef GLSLANG_WEB
case EbtVoid: return "void";
case EbtDouble: return "double";
@ -1934,7 +1946,6 @@ public:
case EbtUint64: return "uint64_t";
case EbtBool: return "bool";
case EbtAtomicUint: return "atomic_uint";
case EbtSampler: return "sampler/image";
case EbtStruct: return "structure";
case EbtBlock: return "block";
case EbtAccStructNV: return "accelerationStructureNV";

View File

@ -1310,11 +1310,13 @@ public:
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 isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; }
bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; }
bool isSparseImage() const { return op == EOpSparseImageLoad; }
bool isSubgroup() const { return op > EOpSubgroupGuardStart && op < EOpSubgroupGuardStop; }
#endif
void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; }

View File

@ -85,18 +85,18 @@ const int TypeStringScalarMask = ~TypeStringColumnMask; // take type to
enum ArgType {
// numbers hardcoded to correspond to 'TypeString'; order and value matter
TypeB = 1 << 0, // Boolean
TypeF = 1 << 1, // float 32
TypeI = 1 << 2, // int 32
TypeU = 1 << 3, // uint 32
TypeF16 = 1 << 4, // float 16
TypeF64 = 1 << 5, // float 64
TypeI8 = 1 << 6, // int 8
TypeI16 = 1 << 7, // int 16
TypeI64 = 1 << 8, // int 64
TypeU8 = 1 << 9, // uint 8
TypeU16 = 1 << 10, // uint 16
TypeU64 = 1 << 11, // uint 64
TypeB = 1 << 0, // Boolean
TypeF = 1 << 1, // float 32
TypeI = 1 << 2, // int 32
TypeU = 1 << 3, // uint 32
TypeF16 = 1 << 4, // float 16
TypeF64 = 1 << 5, // float 64
TypeI8 = 1 << 6, // int 8
TypeI16 = 1 << 7, // int 16
TypeI64 = 1 << 8, // int 64
TypeU8 = 1 << 9, // uint 8
TypeU16 = 1 << 10, // uint 16
TypeU64 = 1 << 11, // uint 64
};
// Mixtures of the above, to help the function tables
const ArgType TypeFI = static_cast<ArgType>(TypeF | TypeI);
@ -106,22 +106,22 @@ const ArgType TypeIU = static_cast<ArgType>(TypeI | TypeU);
// The relationships between arguments and return type, whether anything is
// output, or other unusual situations.
enum ArgClass {
ClassRegular = 0, // nothing special, just all vector widths with matching return type; traditional arithmetic
ClassLS = 1 << 0, // the last argument is also held fixed as a (type-matched) scalar while the others cycle
ClassXLS = 1 << 1, // the last argument is exclusively a (type-matched) scalar while the others cycle
ClassLS2 = 1 << 2, // the last two arguments are held fixed as a (type-matched) scalar while the others cycle
ClassFS = 1 << 3, // the first argument is held fixed as a (type-matched) scalar while the others cycle
ClassFS2 = 1 << 4, // the first two arguments are held fixed as a (type-matched) scalar while the others cycle
ClassLO = 1 << 5, // the last argument is an output
ClassB = 1 << 6, // return type cycles through only bool/bvec, matching vector width of args
ClassLB = 1 << 7, // last argument cycles through only bool/bvec, matching vector width of args
ClassV1 = 1 << 8, // scalar only
ClassFIO = 1 << 9, // first argument is inout
ClassRS = 1 << 10, // the return is held scalar as the arguments cycle
ClassNS = 1 << 11, // no scalar prototype
ClassCV = 1 << 12, // first argument is 'coherent volatile'
ClassFO = 1 << 13, // first argument is output
ClassV3 = 1 << 14, // vec3 only
ClassRegular = 0, // nothing special, just all vector widths with matching return type; traditional arithmetic
ClassLS = 1 << 0, // the last argument is also held fixed as a (type-matched) scalar while the others cycle
ClassXLS = 1 << 1, // the last argument is exclusively a (type-matched) scalar while the others cycle
ClassLS2 = 1 << 2, // the last two arguments are held fixed as a (type-matched) scalar while the others cycle
ClassFS = 1 << 3, // the first argument is held fixed as a (type-matched) scalar while the others cycle
ClassFS2 = 1 << 4, // the first two arguments are held fixed as a (type-matched) scalar while the others cycle
ClassLO = 1 << 5, // the last argument is an output
ClassB = 1 << 6, // return type cycles through only bool/bvec, matching vector width of args
ClassLB = 1 << 7, // last argument cycles through only bool/bvec, matching vector width of args
ClassV1 = 1 << 8, // scalar only
ClassFIO = 1 << 9, // first argument is inout
ClassRS = 1 << 10, // the return is held scalar as the arguments cycle
ClassNS = 1 << 11, // no scalar prototype
ClassCV = 1 << 12, // first argument is 'coherent volatile'
ClassFO = 1 << 13, // first argument is output
ClassV3 = 1 << 14, // vec3 only
};
// Mixtures of the above, to help the function tables
const ArgClass ClassV1FIOCV = (ArgClass)(ClassV1 | ClassFIO | ClassCV);
@ -147,6 +147,7 @@ EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECo
// Declare pointers to put into the table for versioning.
#ifdef GLSLANG_WEB
const Versioning* Es300Desktop130 = nullptr;
const Versioning* Es310Desktop430 = nullptr;
#else
const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr },
{ EDesktopProfile, 0, 130, 0, nullptr },
@ -256,7 +257,6 @@ const BuiltInFunction BaseFunctions[] = {
{ EOpGreaterThanEqual, "greaterThanEqual", 2, TypeU, ClassBNS, Es300Desktop130 },
{ EOpVectorEqual, "equal", 2, TypeU, ClassBNS, Es300Desktop130 },
{ EOpVectorNotEqual, "notEqual", 2, TypeU, ClassBNS, Es300Desktop130 },
#ifndef GLSLANG_WEB
{ EOpAtomicAdd, "atomicAdd", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
{ EOpAtomicMin, "atomicMin", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
{ EOpAtomicMax, "atomicMax", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
@ -265,9 +265,11 @@ const BuiltInFunction BaseFunctions[] = {
{ EOpAtomicXor, "atomicXor", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
{ EOpAtomicExchange, "atomicExchange", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
{ EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCV, Es310Desktop430 },
#ifndef GLSLANG_WEB
{ EOpMix, "mix", 3, TypeB, ClassRegular, Es310Desktop450 },
{ EOpMix, "mix", 3, TypeIU, ClassLB, Es310Desktop450 },
#endif
{ EOpNull }
};
@ -278,6 +280,59 @@ const BuiltInFunction DerivativeFunctions[] = {
{ EOpNull }
};
// For functions declared some other way, but still use the table to relate to operator.
struct CustomFunction {
TOperator op; // operator to map the name to
const char* name; // function name
const Versioning* versioning; // nullptr means always a valid version
};
const CustomFunction CustomFunctions[] = {
{ EOpBarrier, "barrier", nullptr },
{ EOpMemoryBarrierShared, "memoryBarrierShared", nullptr },
{ EOpGroupMemoryBarrier, "groupMemoryBarrier", nullptr },
{ EOpMemoryBarrier, "memoryBarrier", nullptr },
{ EOpMemoryBarrierBuffer, "memoryBarrierBuffer", nullptr },
{ EOpPackSnorm2x16, "packSnorm2x16", nullptr },
{ EOpUnpackSnorm2x16, "unpackSnorm2x16", nullptr },
{ EOpPackUnorm2x16, "packUnorm2x16", nullptr },
{ EOpUnpackUnorm2x16, "unpackUnorm2x16", nullptr },
{ EOpPackHalf2x16, "packHalf2x16", nullptr },
{ EOpUnpackHalf2x16, "unpackHalf2x16", nullptr },
{ EOpMul, "matrixCompMult", nullptr },
{ EOpOuterProduct, "outerProduct", nullptr },
{ EOpTranspose, "transpose", nullptr },
{ EOpDeterminant, "determinant", nullptr },
{ EOpMatrixInverse, "inverse", nullptr },
{ EOpFloatBitsToInt, "floatBitsToInt", nullptr },
{ EOpFloatBitsToUint, "floatBitsToUint", nullptr },
{ EOpIntBitsToFloat, "intBitsToFloat", nullptr },
{ EOpUintBitsToFloat, "uintBitsToFloat", nullptr },
{ EOpTextureQuerySize, "textureSize", nullptr },
{ EOpTextureQueryLod, "textureQueryLod", nullptr },
{ EOpTextureQueryLevels, "textureQueryLevels", nullptr },
{ EOpTextureQuerySamples, "textureSamples", nullptr },
{ EOpTexture, "texture", nullptr },
{ EOpTextureProj, "textureProj", nullptr },
{ EOpTextureLod, "textureLod", nullptr },
{ EOpTextureOffset, "textureOffset", nullptr },
{ EOpTextureFetch, "texelFetch", nullptr },
{ EOpTextureFetchOffset, "texelFetchOffset", nullptr },
{ EOpTextureProjOffset, "textureProjOffset", nullptr },
{ EOpTextureLodOffset, "textureLodOffset", nullptr },
{ EOpTextureProjLod, "textureProjLod", nullptr },
{ EOpTextureProjLodOffset, "textureProjLodOffset", nullptr },
{ EOpTextureGrad, "textureGrad", nullptr },
{ EOpTextureGradOffset, "textureGradOffset", nullptr },
{ EOpTextureProjGrad, "textureProjGrad", nullptr },
{ EOpTextureProjGradOffset, "textureProjGradOffset", nullptr },
{ EOpNull }
};
// For the given table of functions, add all the indicated prototypes for each
// one, to be returned in the passed in decls.
void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
@ -331,8 +386,10 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
if (arg == function.numArguments - 1 && (function.classes & ClassLO))
decls.append("out ");
if (arg == 0) {
#ifndef GLSLANG_WEB
if (function.classes & ClassCV)
decls.append("coherent volatile ");
#endif
if (function.classes & ClassFIO)
decls.append("inout ");
if (function.classes & ClassFO)
@ -382,9 +439,10 @@ bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile
// Relate a single table of built-ins to their AST operator.
// This can get called redundantly (especially for the common built-ins, when
// called once per stage). This is a performance issue only, not a correctness
// concern. It is done for quality arising from simplicity, as there are subtlies
// concern. It is done for quality arising from simplicity, as there are subtleties
// to get correct if instead trying to do it surgically.
void RelateTabledBuiltins(const BuiltInFunction* functions, TSymbolTable& symbolTable)
template<class FunctionT>
void RelateTabledBuiltins(const FunctionT* functions, TSymbolTable& symbolTable)
{
while (functions->op != EOpNull) {
symbolTable.relateToOperator(functions->name, functions->op);
@ -408,10 +466,6 @@ void TBuiltIns::addTabledBuiltins(int version, EProfile profile, const SpvVersio
forEachFunction(commonBuiltins, BaseFunctions);
forEachFunction(stageBuiltins[EShLangFragment], DerivativeFunctions);
#ifdef GLSLANG_WEB
return;
#endif
if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450))
forEachFunction(stageBuiltins[EShLangCompute], DerivativeFunctions);
}
@ -421,6 +475,7 @@ void TBuiltIns::relateTabledBuiltins(int /* version */, EProfile /* profile */,
{
RelateTabledBuiltins(BaseFunctions, symbolTable);
RelateTabledBuiltins(DerivativeFunctions, symbolTable);
RelateTabledBuiltins(CustomFunctions, symbolTable);
}
inline bool IncludeLegacy(int version, EProfile profile, const SpvVersion& spvVersion)
@ -465,7 +520,7 @@ TBuiltIns::TBuiltIns()
dimMap[Esd1D] = 1;
dimMap[EsdRect] = 2;
dimMap[EsdBuffer] = 1;
dimMap[EsdSubpass] = 2; // potientially unused for now
dimMap[EsdSubpass] = 2; // potentially unused for now
#endif
}
@ -484,6 +539,10 @@ TBuiltIns::~TBuiltIns()
//
void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion)
{
#ifdef GLSLANG_WEB
version = 310;
profile = EEsProfile;
#endif
addTabledBuiltins(version, profile, spvVersion);
//============================================================================
@ -1306,14 +1365,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
commonBuiltins.append(
"mediump vec2 unpackHalf2x16(highp uint);"
"\n");
}
#ifndef GLSLANG_WEB
else if (profile != EEsProfile && version >= 420) {
} else if (profile != EEsProfile && version >= 420) {
commonBuiltins.append(
" vec2 unpackHalf2x16(highp uint);"
"\n");
}
#ifndef GLSLANG_WEB
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 400)) {
commonBuiltins.append(
@ -3795,6 +3853,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void EndPrimitive();"
"\n");
}
#endif
//============================================================================
//
@ -3824,15 +3883,20 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
);
if ((profile != EEsProfile && version >= 420) || esBarrier) {
commonBuiltins.append(
"void memoryBarrierAtomicCounter();"
"void memoryBarrierBuffer();"
"void memoryBarrierImage();"
);
stageBuiltins[EShLangCompute].append(
"void memoryBarrierShared();"
"void groupMemoryBarrier();"
);
}
#ifndef GLSLANG_WEB
if ((profile != EEsProfile && version >= 420) || esBarrier) {
commonBuiltins.append(
"void memoryBarrierAtomicCounter();"
"void memoryBarrierImage();"
);
}
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
stageBuiltins[EShLangMeshNV].append(
"void memoryBarrierShared();"
@ -4279,6 +4343,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
#endif
//============================================================================
//
@ -4308,6 +4373,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
#ifndef GLSLANG_WEB
//============================================================================
//
// Define the interface to the mesh/task shader.
@ -5314,10 +5380,9 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
#ifdef GLSLANG_WEB
const int ms = 0;
#else
for (int ms = 0; ms <= 1; ++ms)
for (int ms = 0; ms <= 1; ++ms) // loop over "bool" multisample or not
#endif
{
#ifndef GLSLANG_WEB
if ((ms || image) && shadow)
continue;
if (ms && profile != EEsProfile && version < 150)
@ -5326,7 +5391,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
continue;
if (ms && profile == EEsProfile && version < 310)
continue;
#endif
for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not
#ifdef GLSLANG_WEB
@ -5431,14 +5495,12 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
}
}
#ifndef GLSLANG_WEB
//
// sparseTexelsResidentARB()
//
if (profile != EEsProfile && version >= 450) {
commonBuiltins.append("bool sparseTexelsResidentARB(int code);\n");
}
#endif
}
//
@ -5725,6 +5787,11 @@ void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, in
//
void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
{
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
//
// texturing
//
@ -6005,6 +6072,11 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
//
void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
{
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
switch (sampler.dim) {
case Esd2D:
case EsdRect:
@ -6243,6 +6315,11 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in
//
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.
//
@ -6300,9 +6377,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append(builtInConstant);
}
#ifdef GLSLANG_WEB
}
#else
#ifndef GLSLANG_WEB
if (version >= 310) {
// geometry
@ -6584,8 +6659,29 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents);
s.append(builtInConstant);
}
#endif
}
// compute
if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX,
resources.maxComputeWorkGroupCountY,
resources.maxComputeWorkGroupCountZ);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX,
resources.maxComputeWorkGroupSizeY,
resources.maxComputeWorkGroupSizeZ);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits);
s.append(builtInConstant);
s.append("\n");
}
#ifndef GLSLANG_WEB
// images (some in compute below)
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 130)) {
@ -6601,6 +6697,18 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append(builtInConstant);
}
// compute
if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
s.append(builtInConstant);
s.append("\n");
}
// atomic counters (some in compute below)
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 420)) {
@ -6638,31 +6746,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append("\n");
}
// compute
if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX,
resources.maxComputeWorkGroupCountY,
resources.maxComputeWorkGroupCountZ);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX,
resources.maxComputeWorkGroupSizeY,
resources.maxComputeWorkGroupSizeZ);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
s.append(builtInConstant);
s.append("\n");
}
// GL_ARB_cull_distance
if (profile != EEsProfile && version >= 450) {
snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances);
@ -6781,6 +6864,11 @@ static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVar
//
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
// that cannot be declared with the text strings.
@ -7547,7 +7635,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
#endif
break;
#ifndef GLSLANG_WEB
case EShLangCompute:
BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
@ -7555,6 +7642,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
#ifndef GLSLANG_WEB
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
}
if (profile != EEsProfile && version < 430) {
symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_ARB_compute_shader);
@ -7636,14 +7732,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
}
// GL_KHR_shader_subgroup
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
@ -7674,8 +7762,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);
}
#endif
break;
#ifndef GLSLANG_WEB
case EShLangRayGenNV:
case EShLangIntersectNV:
case EShLangAnyHitNV:
@ -8034,21 +8124,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
relateTabledBuiltins(version, profile, spvVersion, language, symbolTable);
symbolTable.relateToOperator("matrixCompMult", EOpMul);
// 120 and 150 are correct for both ES and desktop
if (version >= 120) {
symbolTable.relateToOperator("outerProduct", EOpOuterProduct);
symbolTable.relateToOperator("transpose", EOpTranspose);
if (version >= 150) {
symbolTable.relateToOperator("determinant", EOpDeterminant);
symbolTable.relateToOperator("inverse", EOpMatrixInverse);
}
}
symbolTable.relateToOperator("floatBitsToInt", EOpFloatBitsToInt);
symbolTable.relateToOperator("floatBitsToUint", EOpFloatBitsToUint);
symbolTable.relateToOperator("intBitsToFloat", EOpIntBitsToFloat);
symbolTable.relateToOperator("uintBitsToFloat", EOpUintBitsToFloat);
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64);
symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64);
@ -8063,14 +8138,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("int16BitsToHalf", EOpInt16BitsToFloat16);
symbolTable.relateToOperator("uint16BitsToHalf", EOpUint16BitsToFloat16);
#endif
symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16);
symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16);
symbolTable.relateToOperator("packUnorm2x16", EOpPackUnorm2x16);
symbolTable.relateToOperator("unpackUnorm2x16", EOpUnpackUnorm2x16);
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("packSnorm4x8", EOpPackSnorm4x8);
symbolTable.relateToOperator("unpackSnorm4x8", EOpUnpackSnorm4x8);
symbolTable.relateToOperator("packUnorm4x8", EOpPackUnorm4x8);
@ -8078,17 +8146,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("packDouble2x32", EOpPackDouble2x32);
symbolTable.relateToOperator("unpackDouble2x32", EOpUnpackDouble2x32);
#endif
symbolTable.relateToOperator("packHalf2x16", EOpPackHalf2x16);
symbolTable.relateToOperator("unpackHalf2x16", EOpUnpackHalf2x16);
symbolTable.relateToOperator("packInt2x32", EOpPackInt2x32);
symbolTable.relateToOperator("unpackInt2x32", EOpUnpackInt2x32);
symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32);
symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);
symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16);
symbolTable.relateToOperator("packUint2x16", EOpPackUint2x16);
@ -8109,11 +8172,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("unpack16", EOpUnpack16);
symbolTable.relateToOperator("unpack8", EOpUnpack8);
symbolTable.relateToOperator("barrier", EOpBarrier);
symbolTable.relateToOperator("controlBarrier", EOpBarrier);
symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);
symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad);
@ -8156,10 +8216,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("findMSB", EOpFindMSB);
symbolTable.relateToOperator("helperInvocationEXT", EOpIsHelperInvocation);
#endif
if (PureOperatorBuiltins) {
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("imageSize", EOpImageQuerySize);
symbolTable.relateToOperator("imageSamples", EOpImageQuerySamples);
symbolTable.relateToOperator("imageLoad", EOpImageLoad);
@ -8177,28 +8235,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad);
symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS);
#endif
symbolTable.relateToOperator("textureSize", EOpTextureQuerySize);
symbolTable.relateToOperator("textureQueryLod", EOpTextureQueryLod);
symbolTable.relateToOperator("textureQueryLevels", EOpTextureQueryLevels);
symbolTable.relateToOperator("textureSamples", EOpTextureQuerySamples);
symbolTable.relateToOperator("texture", EOpTexture);
symbolTable.relateToOperator("textureProj", EOpTextureProj);
symbolTable.relateToOperator("textureLod", EOpTextureLod);
symbolTable.relateToOperator("textureOffset", EOpTextureOffset);
symbolTable.relateToOperator("texelFetch", EOpTextureFetch);
symbolTable.relateToOperator("texelFetchOffset", EOpTextureFetchOffset);
symbolTable.relateToOperator("textureProjOffset", EOpTextureProjOffset);
symbolTable.relateToOperator("textureLodOffset", EOpTextureLodOffset);
symbolTable.relateToOperator("textureProjLod", EOpTextureProjLod);
symbolTable.relateToOperator("textureProjLodOffset", EOpTextureProjLodOffset);
symbolTable.relateToOperator("textureGrad", EOpTextureGrad);
symbolTable.relateToOperator("textureGradOffset", EOpTextureGradOffset);
symbolTable.relateToOperator("textureProjGrad", EOpTextureProjGrad);
symbolTable.relateToOperator("textureProjGradOffset", EOpTextureProjGradOffset);
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("textureGather", EOpTextureGather);
symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset);
symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets);
@ -8440,10 +8477,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("shadow2DEXT", EOpTexture);
symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj);
}
#endif
}
#ifndef GLSLANG_WEB
switch(language) {
case EShLangVertex:
break;
@ -8481,8 +8516,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
break;
case EShLangCompute:
symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);
symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);
if ((profile != EEsProfile && version >= 450) ||
(profile == EEsProfile && version >= 320)) {

View File

@ -801,10 +801,8 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
//
// Add a new newNode for the conversion.
//
TIntermUnary* newNode = nullptr;
TOperator newOp = EOpNull;
#ifndef GLSLANG_WEB
bool convertToIntTypes = (convertTo == EbtInt8 || convertTo == EbtUint8 ||
convertTo == EbtInt16 || convertTo == EbtUint16 ||
convertTo == EbtInt || convertTo == EbtUint ||
@ -838,7 +836,10 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
(node->getBasicType() == EbtFloat16 && ! convertToFloatTypes))
return nullptr;
}
#endif
TIntermUnary* newNode = nullptr;
TOperator newOp = EOpNull;
if (!buildConvertOp(convertTo, node->getBasicType(), newOp)) {
return nullptr;
}
@ -847,11 +848,14 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
newNode = addUnaryNode(newOp, node, node->getLoc(), newType);
if (node->getAsConstantUnion()) {
#ifndef GLSLANG_WEB
// 8/16-bit storage extensions don't support 8/16-bit constants, so don't fold conversions
// to those types
if ((getArithemeticInt8Enabled() || !(convertTo == EbtInt8 || convertTo == EbtUint8)) &&
(getArithemeticInt16Enabled() || !(convertTo == EbtInt16 || convertTo == EbtUint16)) &&
(getArithemeticFloat16Enabled() || !(convertTo == EbtFloat16))) {
(getArithemeticFloat16Enabled() || !(convertTo == EbtFloat16)))
#endif
{
TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType);
if (folded)
return folded;

View File

@ -1160,6 +1160,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
const TQualifier& argQualifier = argType.getQualifier();
if (argQualifier.isMemory() && (argType.containsOpaque() || argType.isReference())) {
const char* message = "argument cannot drop memory qualifier when passed to formal parameter";
#ifndef GLSLANG_WEB
if (argQualifier.volatil && ! formalQualifier.volatil)
error(arguments->getLoc(), message, "volatile", "");
if (argQualifier.coherent && ! (formalQualifier.devicecoherent || formalQualifier.coherent))
@ -1179,6 +1180,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
// Don't check 'restrict', it is different than the rest:
// "...but only restrict can be taken away from a calling argument, by a formal parameter that
// lacks the restrict qualifier..."
#endif
}
if (!builtIn && argQualifier.getFormat() != formalQualifier.getFormat()) {
// we have mismatched formats, which should only be allowed if writeonly
@ -2201,7 +2203,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
break;
}
if (callNode.getOp() > EOpSubgroupGuardStart && callNode.getOp() < EOpSubgroupGuardStop) {
if (callNode.isSubgroup()) {
// these require SPIR-V 1.3
if (spvVersion.spv > 0 && spvVersion.spv < EShTargetSpv_1_3)
error(loc, "requires SPIR-V 1.3", "subgroup op", "");
@ -2779,6 +2781,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
// it, in which case the type comes from the argument instead of from the
// constructor function.
switch (op) {
#ifndef GLSLANG_WEB
case EOpConstructNonuniform:
if (node != nullptr && node->getAsTyped() != nullptr) {
type.shallowCopy(node->getAsTyped()->getType());
@ -2786,6 +2789,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
type.getQualifier().nonUniform = true;
}
break;
#endif
default:
type.shallowCopy(function.getType());
break;
@ -2794,10 +2798,8 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
// See if it's a matrix
bool constructingMatrix = false;
switch (op) {
#ifndef GLSLANG_WEB
case EOpConstructTextureSampler:
return constructorTextureSamplerError(loc, function);
#endif
case EOpConstructMat2x2:
case EOpConstructMat2x3:
case EOpConstructMat2x4:
@ -3389,11 +3391,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing an array");
}
break;
#ifndef GLSLANG_WEB
case EShLangCompute:
if (! symbolTable.atBuiltInLevel())
error(loc, "global storage input qualifier cannot be used in a compute shader", "in", "");
break;
#ifndef GLSLANG_WEB
case EShLangTessControl:
if (qualifier.patch)
error(loc, "can only use on output in tessellation-control shader", "patch", "");
@ -3434,10 +3436,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
error(loc, "cannot contain a double, int64, or uint64", GetStorageQualifierString(qualifier.storage), "");
break;
#ifndef GLSLANG_WEB
case EShLangCompute:
error(loc, "global storage output qualifier cannot be used in a compute shader", "out", "");
break;
#ifndef GLSLANG_WEB
case EShLangTessEvaluation:
if (qualifier.patch)
error(loc, "can only use on input in tessellation-evaluation shader", "patch", "");
@ -3815,10 +3817,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
// for ES, if size isn't coming from an initializer, it has to be explicitly declared now,
// with very few exceptions
// last member of ssbo block exception:
if (qualifier.storage == EvqBuffer && lastMember)
return;
// implicitly-sized io exceptions:
switch (language) {
case EShLangGeometry:
@ -3853,6 +3851,10 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
#endif
// last member of ssbo block exception:
if (qualifier.storage == EvqBuffer && lastMember)
return;
arraySizeRequiredCheck(loc, *arraySizes);
}
@ -4477,6 +4479,7 @@ void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQu
void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& qualifier, TType& type)
{
#ifndef GLSLANG_WEB
if (qualifier.isMemory()) {
type.getQualifier().volatil = qualifier.volatil;
type.getQualifier().coherent = qualifier.coherent;
@ -4489,6 +4492,7 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali
type.getQualifier().writeonly = qualifier.writeonly;
type.getQualifier().restrict = qualifier.restrict;
}
#endif
if (qualifier.isAuxiliary() ||
qualifier.isInterpolation())
@ -5295,11 +5299,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
error(loc, "needs a literal integer", "buffer_reference_align", "");
return;
}
#endif
switch (language) {
case EShLangVertex:
break;
#ifndef GLSLANG_WEB
case EShLangTessControl:
if (id == "vertices") {
if (value == 0)
@ -5312,9 +5315,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
}
break;
case EShLangTessEvaluation:
break;
case EShLangGeometry:
if (id == "invocations") {
profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, nullptr, "invocations");
@ -5387,16 +5387,17 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
case EShLangTaskNV:
// Fall through
#endif
case EShLangCompute:
if (id.compare(0, 11, "local_size_") == 0) {
#ifndef GLSLANG_WEB
if (language == EShLangMeshNV || language == EShLangTaskNV) {
requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize");
}
else
{
} else {
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize");
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
}
#endif
if (nonLiteral)
error(loc, "needs a literal integer", "local_size", "");
if (id.size() == 12 && value == 0) {
@ -5434,12 +5435,11 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
}
}
break;
default:
break;
}
#endif // GLSLANG_WEB
error(loc, "there is no such layout identifier for this stage taking an assigned value", id.c_str(), "");
}
@ -7386,6 +7386,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
for (unsigned int member = 0; member < typeList.size(); ++member) {
TQualifier& memberQualifier = typeList[member].type->getQualifier();
const TSourceLoc& memberLoc = typeList[member].loc;
#ifndef GLSLANG_WEB
if (memberQualifier.hasStream()) {
if (defaultQualification.layoutStream != memberQualifier.layoutStream)
error(memberLoc, "member cannot contradict block", "stream", "");
@ -7399,6 +7400,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
if (defaultQualification.layoutXfbBuffer != memberQualifier.layoutXfbBuffer)
error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", "");
}
#endif
if (memberQualifier.hasPacking())
error(memberLoc, "member of block cannot have a packing layout qualifier", typeList[member].type->getFieldName().c_str(), "");
@ -7441,6 +7443,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
layoutMemberLocationArrayCheck(loc, memberWithLocation, arraySizes);
#ifndef GLSLANG_WEB
// Ensure that the block has an XfbBuffer assigned. This is needed
// because if the block has a XfbOffset assigned, then it is
// assumed that it has implicitly assigned the current global
@ -7450,6 +7453,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
if (!currentBlockQualifier.hasXfbBuffer() && currentBlockQualifier.hasXfbOffset())
currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer;
}
#endif
// Process the members
fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation);
@ -8006,6 +8010,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
else
error(loc, "can only apply to 'in'", "point_mode", "");
}
#endif
for (int i = 0; i < 3; ++i) {
if (publicType.shaderQualifiers.localSizeNotDefault[i]) {
if (publicType.qualifier.storage == EvqVaryingIn) {
@ -8022,7 +8027,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
}
if (intermediate.getLocalSize(i) > (unsigned int)max)
error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", "");
} else if (language == EShLangMeshNV) {
}
#ifndef GLSLANG_WEB
else if (language == EShLangMeshNV) {
switch (i) {
case 0: max = resources.maxMeshWorkGroupSizeX_NV; break;
case 1: max = resources.maxMeshWorkGroupSizeY_NV; break;
@ -8040,7 +8047,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
}
if (intermediate.getLocalSize(i) > (unsigned int)max)
error(loc, "too large; see gl_MaxTaskWorkGroupSizeNV", "local_size", "");
} else {
}
#endif
else {
assert(0);
}
@ -8065,6 +8074,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
}
}
#ifndef GLSLANG_WEB
if (publicType.shaderQualifiers.earlyFragmentTests) {
if (publicType.qualifier.storage == EvqVaryingIn)
intermediate.setEarlyFragmentTests();

View File

@ -343,6 +343,7 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["const"] = CONST;
(*KeywordMap)["uniform"] = UNIFORM;
(*KeywordMap)["buffer"] = BUFFER;
(*KeywordMap)["in"] = IN;
(*KeywordMap)["out"] = OUT;
(*KeywordMap)["smooth"] = SMOOTH;
@ -410,7 +411,6 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["attribute"] = ATTRIBUTE;
(*KeywordMap)["varying"] = VARYING;
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
(*KeywordMap)["buffer"] = BUFFER;
(*KeywordMap)["coherent"] = COHERENT;
(*KeywordMap)["devicecoherent"] = DEVICECOHERENT;
(*KeywordMap)["queuefamilycoherent"] = QUEUEFAMILYCOHERENT;
@ -564,10 +564,6 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["sampler2D"] = SAMPLER2D;
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
(*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY;
(*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW;
(*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY;
(*KeywordMap)["usamplerCubeArray"] = USAMPLERCUBEARRAY;
(*KeywordMap)["samplerCubeShadow"] = SAMPLERCUBESHADOW;
(*KeywordMap)["sampler2DArray"] = SAMPLER2DARRAY;
(*KeywordMap)["sampler2DArrayShadow"] = SAMPLER2DARRAYSHADOW;
@ -582,7 +578,30 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["sampler3D"] = SAMPLER3D;
(*KeywordMap)["sampler2DShadow"] = SAMPLER2DSHADOW;
(*KeywordMap)["texture2D"] = TEXTURE2D;
(*KeywordMap)["textureCube"] = TEXTURECUBE;
(*KeywordMap)["texture2DArray"] = TEXTURE2DARRAY;
(*KeywordMap)["itexture2D"] = ITEXTURE2D;
(*KeywordMap)["itexture3D"] = ITEXTURE3D;
(*KeywordMap)["itextureCube"] = ITEXTURECUBE;
(*KeywordMap)["itexture2DArray"] = ITEXTURE2DARRAY;
(*KeywordMap)["utexture2D"] = UTEXTURE2D;
(*KeywordMap)["utexture3D"] = UTEXTURE3D;
(*KeywordMap)["utextureCube"] = UTEXTURECUBE;
(*KeywordMap)["utexture2DArray"] = UTEXTURE2DARRAY;
(*KeywordMap)["texture3D"] = TEXTURE3D;
(*KeywordMap)["sampler"] = SAMPLER;
(*KeywordMap)["samplerShadow"] = SAMPLERSHADOW;
#ifndef GLSLANG_WEB
(*KeywordMap)["textureCubeArray"] = TEXTURECUBEARRAY;
(*KeywordMap)["itextureCubeArray"] = ITEXTURECUBEARRAY;
(*KeywordMap)["utextureCubeArray"] = UTEXTURECUBEARRAY;
(*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY;
(*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW;
(*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY;
(*KeywordMap)["usamplerCubeArray"] = USAMPLERCUBEARRAY;
(*KeywordMap)["sampler1DArrayShadow"] = SAMPLER1DARRAYSHADOW;
(*KeywordMap)["isampler1DArray"] = ISAMPLER1DARRAY;
(*KeywordMap)["usampler1D"] = USAMPLER1D;
@ -609,28 +628,11 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["__samplerExternal2DY2YEXT"] = SAMPLEREXTERNAL2DY2YEXT; // GL_EXT_YUV_target
(*KeywordMap)["sampler"] = SAMPLER;
(*KeywordMap)["samplerShadow"] = SAMPLERSHADOW;
(*KeywordMap)["texture2D"] = TEXTURE2D;
(*KeywordMap)["textureCube"] = TEXTURECUBE;
(*KeywordMap)["textureCubeArray"] = TEXTURECUBEARRAY;
(*KeywordMap)["itextureCubeArray"] = ITEXTURECUBEARRAY;
(*KeywordMap)["utextureCubeArray"] = UTEXTURECUBEARRAY;
(*KeywordMap)["itexture1DArray"] = ITEXTURE1DARRAY;
(*KeywordMap)["utexture1D"] = UTEXTURE1D;
(*KeywordMap)["itexture1D"] = ITEXTURE1D;
(*KeywordMap)["utexture1DArray"] = UTEXTURE1DARRAY;
(*KeywordMap)["textureBuffer"] = TEXTUREBUFFER;
(*KeywordMap)["texture2DArray"] = TEXTURE2DARRAY;
(*KeywordMap)["itexture2D"] = ITEXTURE2D;
(*KeywordMap)["itexture3D"] = ITEXTURE3D;
(*KeywordMap)["itextureCube"] = ITEXTURECUBE;
(*KeywordMap)["itexture2DArray"] = ITEXTURE2DARRAY;
(*KeywordMap)["utexture2D"] = UTEXTURE2D;
(*KeywordMap)["utexture3D"] = UTEXTURE3D;
(*KeywordMap)["utextureCube"] = UTEXTURECUBE;
(*KeywordMap)["utexture2DArray"] = UTEXTURE2DARRAY;
(*KeywordMap)["itexture2DRect"] = ITEXTURE2DRECT;
(*KeywordMap)["utexture2DRect"] = UTEXTURE2DRECT;
(*KeywordMap)["itextureBuffer"] = ITEXTUREBUFFER;
@ -642,7 +644,6 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["itexture2DMSArray"] = ITEXTURE2DMSARRAY;
(*KeywordMap)["utexture2DMSArray"] = UTEXTURE2DMSARRAY;
(*KeywordMap)["texture1D"] = TEXTURE1D;
(*KeywordMap)["texture3D"] = TEXTURE3D;
(*KeywordMap)["texture2DRect"] = TEXTURE2DRECT;
(*KeywordMap)["texture1DArray"] = TEXTURE1DARRAY;
@ -904,6 +905,13 @@ int TScanContext::tokenizeIdentifier()
case CASE:
return keyword;
case BUFFER:
afterBuffer = true;
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
(!parseContext.isEsProfile() && parseContext.version < 430))
return identifierOrType();
return keyword;
case STRUCT:
afterStruct = true;
return keyword;
@ -997,12 +1005,6 @@ int TScanContext::tokenizeIdentifier()
if (parseContext.isEsProfile() && parseContext.version >= 300)
reservedWord();
return keyword;
case BUFFER:
afterBuffer = true;
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
(!parseContext.isEsProfile() && parseContext.version < 430))
return identifierOrType();
return keyword;
case PAYLOADNV:
case PAYLOADINNV:
case HITATTRNV:
@ -1057,13 +1059,12 @@ int TScanContext::tokenizeIdentifier()
case SUBROUTINE:
return es30ReservedFromGLSL(400);
#endif
case SHARED:
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
(!parseContext.isEsProfile() && parseContext.version < 140))
return identifierOrType();
return keyword;
#endif
case LAYOUT:
{
const int numLayoutExts = 2;
@ -1321,7 +1322,6 @@ int TScanContext::tokenizeIdentifier()
return keyword;
return identifierOrType();
#endif
case SAMPLERCUBEARRAY:
case SAMPLERCUBEARRAYSHADOW:
@ -1335,6 +1335,15 @@ int TScanContext::tokenizeIdentifier()
reservedWord();
return keyword;
case TEXTURECUBEARRAY:
case ITEXTURECUBEARRAY:
case UTEXTURECUBEARRAY:
if (parseContext.spvVersion.vulkan > 0)
return keyword;
else
return identifierOrType();
#endif
case UINT:
case UVEC2:
case UVEC3:
@ -1369,6 +1378,25 @@ int TScanContext::tokenizeIdentifier()
}
return keyword;
case TEXTURE2D:
case TEXTURECUBE:
case TEXTURE2DARRAY:
case ITEXTURE2D:
case ITEXTURE3D:
case ITEXTURECUBE:
case ITEXTURE2DARRAY:
case UTEXTURE2D:
case UTEXTURE3D:
case UTEXTURECUBE:
case UTEXTURE2DARRAY:
case TEXTURE3D:
case SAMPLER:
case SAMPLERSHADOW:
if (parseContext.spvVersion.vulkan > 0)
return keyword;
else
return identifierOrType();
#ifndef GLSLANG_WEB
case ISAMPLER1D:
case ISAMPLER1DARRAY:
@ -1458,25 +1486,11 @@ int TScanContext::tokenizeIdentifier()
return keyword;
return identifierOrType();
case TEXTURE2D:
case TEXTURECUBE:
case TEXTURECUBEARRAY:
case ITEXTURECUBEARRAY:
case UTEXTURECUBEARRAY:
case ITEXTURE1DARRAY:
case UTEXTURE1D:
case ITEXTURE1D:
case UTEXTURE1DARRAY:
case TEXTUREBUFFER:
case TEXTURE2DARRAY:
case ITEXTURE2D:
case ITEXTURE3D:
case ITEXTURECUBE:
case ITEXTURE2DARRAY:
case UTEXTURE2D:
case UTEXTURE3D:
case UTEXTURECUBE:
case UTEXTURE2DARRAY:
case ITEXTURE2DRECT:
case UTEXTURE2DRECT:
case ITEXTUREBUFFER:
@ -1488,11 +1502,8 @@ int TScanContext::tokenizeIdentifier()
case ITEXTURE2DMSARRAY:
case UTEXTURE2DMSARRAY:
case TEXTURE1D:
case TEXTURE3D:
case TEXTURE2DRECT:
case TEXTURE1DARRAY:
case SAMPLER:
case SAMPLERSHADOW:
if (parseContext.spvVersion.vulkan > 0)
return keyword;
else

View File

@ -288,6 +288,11 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi
EShLanguage language, EShSource source, TInfoSink& infoSink, TSymbolTable** commonTable,
TSymbolTable** symbolTables)
{
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
(*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]);
InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spvVersion, language, source,
infoSink, *symbolTables[language]);
@ -304,6 +309,11 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi
//
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));
if (builtInParseables == nullptr)
@ -341,6 +351,7 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
(profile == EEsProfile && version >= 310))
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangGeometry, source,
infoSink, commonTable, symbolTables);
#endif
// check for compute
if ((profile != EEsProfile && version >= 420) ||
@ -375,7 +386,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
(profile == EEsProfile && version >= 320))
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTaskNV, source,
infoSink, commonTable, symbolTables);
#endif
return true;
}
@ -871,6 +881,11 @@ bool ProcessDeferred(
bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage,
versionNotFirst, defaultVersion, source, version, profile, spvVersion);
#ifdef GLSLANG_WEB
profile = EEsProfile;
version = 310;
#endif
bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst));
#ifndef GLSLANG_WEB
bool warnVersionNotFirst = false;

View File

@ -527,11 +527,11 @@ const char* StageName(EShLanguage stage)
switch(stage) {
case EShLangVertex: return "vertex";
case EShLangFragment: return "fragment";
case EShLangCompute: return "compute";
#ifndef GLSLANG_WEB
case EShLangTessControl: return "tessellation control";
case EShLangTessEvaluation: return "tessellation evaluation";
case EShLangGeometry: return "geometry";
case EShLangCompute: return "compute";
case EShLangRayGenNV: return "ray-generation";
case EShLangIntersectNV: return "intersection";
case EShLangAnyHitNV: return "any-hit";

View File

@ -38,7 +38,7 @@
//
// Do not edit the .y file, only edit the .m4 file.
// The .y bison file is not a source file, it is a derivitive 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.
//
// Code sandwiched between a pair:
@ -49,7 +49,7 @@
// ...
// GLSLANG_WEB_EXCLUDE_OFF
//
// Will be exluded from the grammar when m4 is executed as:
// Will be excluded from the grammar when m4 is executed as:
//
// m4 -P -DGLSLANG_WEB
//
@ -166,8 +166,12 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
%token <lex> ISAMPLER2DARRAY USAMPLER2D USAMPLER3D
%token <lex> USAMPLERCUBE USAMPLER2DARRAY
%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
%token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
// separate image/sampler
%token <lex> SAMPLER SAMPLERSHADOW
%token <lex> TEXTURE2D TEXTURE3D TEXTURECUBE TEXTURE2DARRAY
%token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY
%token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY
GLSLANG_WEB_EXCLUDE_ON
@ -203,6 +207,8 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
// combined image/sampler
%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
%token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
%token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
%token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT
%token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER
@ -233,18 +239,12 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
%token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
// pure sampler
%token <lex> SAMPLER SAMPLERSHADOW
// texture without sampler
%token <lex> TEXTURE1D TEXTURE2D TEXTURE3D TEXTURECUBE
%token <lex> TEXTURE1DARRAY TEXTURE2DARRAY
%token <lex> ITEXTURE1D ITEXTURE2D ITEXTURE3D ITEXTURECUBE
%token <lex> ITEXTURE1DARRAY ITEXTURE2DARRAY UTEXTURE1D UTEXTURE2D UTEXTURE3D
%token <lex> UTEXTURECUBE UTEXTURE1DARRAY UTEXTURE2DARRAY
%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
%token <lex> TEXTURE1D ITEXTURE1D UTEXTURE1D
%token <lex> TEXTURE1DARRAY ITEXTURE1DARRAY UTEXTURE1DARRAY
%token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT
%token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER
%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
%token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
%token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
@ -277,7 +277,7 @@ GLSLANG_WEB_EXCLUDE_OFF
%token <lex> CENTROID IN OUT INOUT
%token <lex> STRUCT VOID WHILE
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> UNIFORM SHARED
%token <lex> UNIFORM SHARED BUFFER
%token <lex> FLAT SMOOTH LAYOUT
GLSLANG_WEB_EXCLUDE_ON
@ -285,7 +285,7 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> INT64CONSTANT UINT64CONSTANT
%token <lex> SUBROUTINE DEMOTE
%token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
%token <lex> PATCH SAMPLE BUFFER NONUNIFORM
%token <lex> PATCH SAMPLE NONUNIFORM
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
%token <lex> SUBGROUPCOHERENT NONPRIVATE
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
@ -1360,7 +1360,6 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.storage = EvqUniform;
}
GLSLANG_WEB_EXCLUDE_ON
| SHARED {
parseContext.globalCheck($1.loc, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
@ -1374,6 +1373,7 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc);
$$.qualifier.storage = EvqBuffer;
}
GLSLANG_WEB_EXCLUDE_ON
| ATTRIBUTE {
parseContext.requireStage($1.loc, EShLangVertex, "attribute");
parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
@ -2354,6 +2354,16 @@ GLSLANG_WEB_EXCLUDE_OFF
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, EsdCube, false, true);
}
| SAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true);
}
| SAMPLER2DARRAYSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true, true);
}
GLSLANG_WEB_EXCLUDE_ON
| SAMPLER1DSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
@ -2370,17 +2380,6 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd1D, true, true);
}
GLSLANG_WEB_EXCLUDE_OFF
| SAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true);
}
| SAMPLER2DARRAYSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true, true);
}
| SAMPLERCUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
@ -2391,7 +2390,6 @@ GLSLANG_WEB_EXCLUDE_OFF
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, EsdCube, true, true);
}
GLSLANG_WEB_EXCLUDE_ON
| F16SAMPLER1D {
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
@ -2491,30 +2489,11 @@ GLSLANG_WEB_EXCLUDE_OFF
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, EsdCube);
}
GLSLANG_WEB_EXCLUDE_ON
| ISAMPLER1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, Esd1D, true);
}
GLSLANG_WEB_EXCLUDE_OFF
| ISAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, Esd2D, true);
}
| ISAMPLERCUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, EsdCube, true);
}
GLSLANG_WEB_EXCLUDE_ON
| USAMPLER1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd1D);
}
GLSLANG_WEB_EXCLUDE_OFF
| USAMPLER2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
@ -2531,21 +2510,121 @@ GLSLANG_WEB_EXCLUDE_OFF
$$.sampler.set(EbtUint, EsdCube);
}
GLSLANG_WEB_EXCLUDE_ON
| ISAMPLER1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, Esd1D, true);
}
| ISAMPLERCUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, EsdCube, true);
}
| USAMPLER1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd1D);
}
| USAMPLER1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd1D, true);
}
| USAMPLERCUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, EsdCube, true);
}
| TEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube, true);
}
| ITEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, EsdCube, true);
}
| UTEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube, true);
}
GLSLANG_WEB_EXCLUDE_OFF
| USAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd2D, true);
}
| USAMPLERCUBEARRAY {
| TEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, EsdCube, true);
$$.sampler.setTexture(EbtFloat, Esd2D);
}
| TEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd3D);
}
| TEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D, true);
}
| TEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube);
}
| ITEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd2D);
}
| ITEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd3D);
}
| ITEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, EsdCube);
}
| ITEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd2D, true);
}
| UTEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd2D);
}
| UTEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd3D);
}
| UTEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube);
}
| UTEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd2D, true);
}
| SAMPLER {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setPureSampler(false);
}
| SAMPLERSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setPureSampler(true);
}
GLSLANG_WEB_EXCLUDE_ON
| SAMPLER2DRECT {
@ -2643,16 +2722,6 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd2D, true, false, true);
}
| SAMPLER {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setPureSampler(false);
}
| SAMPLERSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setPureSampler(true);
}
| TEXTURE1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
@ -2664,33 +2733,18 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd1D);
}
| TEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D);
}
| F16TEXTURE2D {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd2D);
}
| TEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd3D);
}
| F16TEXTURE3D {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd3D);
}
| TEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube);
}
| F16TEXTURECUBE {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
@ -2708,22 +2762,12 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd1D, true);
}
| TEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D, true);
}
| F16TEXTURE2DARRAY {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd2D, true);
}
| TEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube, true);
}
| F16TEXTURECUBEARRAY {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
@ -2735,71 +2779,21 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd1D);
}
| ITEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd2D);
}
| ITEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd3D);
}
| ITEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, EsdCube);
}
| ITEXTURE1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd1D, true);
}
| ITEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd2D, true);
}
| ITEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, EsdCube, true);
}
| UTEXTURE1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd1D);
}
| UTEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd2D);
}
| UTEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd3D);
}
| UTEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube);
}
| UTEXTURE1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd1D, true);
}
| UTEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd2D, true);
}
| UTEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube, true);
}
| TEXTURE2DRECT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;

View File

@ -38,7 +38,7 @@
//
// Do not edit the .y file, only edit the .m4 file.
// The .y bison file is not a source file, it is a derivitive 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.
//
// Code sandwiched between a pair:
@ -49,7 +49,7 @@
// ...
// GLSLANG_WEB_EXCLUDE_OFF
//
// Will be exluded from the grammar when m4 is executed as:
// Will be excluded from the grammar when m4 is executed as:
//
// m4 -P -DGLSLANG_WEB
//
@ -166,8 +166,12 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
%token <lex> ISAMPLER2DARRAY USAMPLER2D USAMPLER3D
%token <lex> USAMPLERCUBE USAMPLER2DARRAY
%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
%token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
// separate image/sampler
%token <lex> SAMPLER SAMPLERSHADOW
%token <lex> TEXTURE2D TEXTURE3D TEXTURECUBE TEXTURE2DARRAY
%token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY
%token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY
@ -203,6 +207,8 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
// combined image/sampler
%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
%token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
%token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
%token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT
%token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER
@ -233,18 +239,12 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
%token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
// pure sampler
%token <lex> SAMPLER SAMPLERSHADOW
// texture without sampler
%token <lex> TEXTURE1D TEXTURE2D TEXTURE3D TEXTURECUBE
%token <lex> TEXTURE1DARRAY TEXTURE2DARRAY
%token <lex> ITEXTURE1D ITEXTURE2D ITEXTURE3D ITEXTURECUBE
%token <lex> ITEXTURE1DARRAY ITEXTURE2DARRAY UTEXTURE1D UTEXTURE2D UTEXTURE3D
%token <lex> UTEXTURECUBE UTEXTURE1DARRAY UTEXTURE2DARRAY
%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
%token <lex> TEXTURE1D ITEXTURE1D UTEXTURE1D
%token <lex> TEXTURE1DARRAY ITEXTURE1DARRAY UTEXTURE1DARRAY
%token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT
%token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER
%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
%token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
%token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
@ -277,7 +277,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> CENTROID IN OUT INOUT
%token <lex> STRUCT VOID WHILE
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> UNIFORM SHARED
%token <lex> UNIFORM SHARED BUFFER
%token <lex> FLAT SMOOTH LAYOUT
@ -285,7 +285,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> INT64CONSTANT UINT64CONSTANT
%token <lex> SUBROUTINE DEMOTE
%token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
%token <lex> PATCH SAMPLE BUFFER NONUNIFORM
%token <lex> PATCH SAMPLE NONUNIFORM
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
%token <lex> SUBGROUPCOHERENT NONPRIVATE
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
@ -1360,7 +1360,6 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.storage = EvqUniform;
}
| SHARED {
parseContext.globalCheck($1.loc, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
@ -1374,6 +1373,7 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.storage = EvqBuffer;
}
| ATTRIBUTE {
parseContext.requireStage($1.loc, EShLangVertex, "attribute");
parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
@ -2354,6 +2354,16 @@ type_specifier_nonarray
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, EsdCube, false, true);
}
| SAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true);
}
| SAMPLER2DARRAYSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true, true);
}
| SAMPLER1DSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
@ -2370,17 +2380,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd1D, true, true);
}
| SAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true);
}
| SAMPLER2DARRAYSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true, true);
}
| SAMPLERCUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
@ -2391,7 +2390,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, EsdCube, true, true);
}
| F16SAMPLER1D {
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
@ -2491,30 +2489,11 @@ type_specifier_nonarray
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, EsdCube);
}
| ISAMPLER1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, Esd1D, true);
}
| ISAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, Esd2D, true);
}
| ISAMPLERCUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, EsdCube, true);
}
| USAMPLER1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd1D);
}
| USAMPLER2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
@ -2531,21 +2510,121 @@ type_specifier_nonarray
$$.sampler.set(EbtUint, EsdCube);
}
| ISAMPLER1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, Esd1D, true);
}
| ISAMPLERCUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtInt, EsdCube, true);
}
| USAMPLER1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd1D);
}
| USAMPLER1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd1D, true);
}
| USAMPLERCUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, EsdCube, true);
}
| TEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube, true);
}
| ITEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, EsdCube, true);
}
| UTEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube, true);
}
| USAMPLER2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd2D, true);
}
| USAMPLERCUBEARRAY {
| TEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, EsdCube, true);
$$.sampler.setTexture(EbtFloat, Esd2D);
}
| TEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd3D);
}
| TEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D, true);
}
| TEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube);
}
| ITEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd2D);
}
| ITEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd3D);
}
| ITEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, EsdCube);
}
| ITEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd2D, true);
}
| UTEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd2D);
}
| UTEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd3D);
}
| UTEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube);
}
| UTEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd2D, true);
}
| SAMPLER {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setPureSampler(false);
}
| SAMPLERSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setPureSampler(true);
}
| SAMPLER2DRECT {
@ -2643,16 +2722,6 @@ type_specifier_nonarray
$$.basicType = EbtSampler;
$$.sampler.set(EbtUint, Esd2D, true, false, true);
}
| SAMPLER {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setPureSampler(false);
}
| SAMPLERSHADOW {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setPureSampler(true);
}
| TEXTURE1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
@ -2664,33 +2733,18 @@ type_specifier_nonarray
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd1D);
}
| TEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D);
}
| F16TEXTURE2D {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd2D);
}
| TEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd3D);
}
| F16TEXTURE3D {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd3D);
}
| TEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube);
}
| F16TEXTURECUBE {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
@ -2708,22 +2762,12 @@ type_specifier_nonarray
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd1D, true);
}
| TEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D, true);
}
| F16TEXTURE2DARRAY {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd2D, true);
}
| TEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube, true);
}
| F16TEXTURECUBEARRAY {
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
@ -2735,71 +2779,21 @@ type_specifier_nonarray
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd1D);
}
| ITEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd2D);
}
| ITEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd3D);
}
| ITEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, EsdCube);
}
| ITEXTURE1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd1D, true);
}
| ITEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, Esd2D, true);
}
| ITEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtInt, EsdCube, true);
}
| UTEXTURE1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd1D);
}
| UTEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd2D);
}
| UTEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd3D);
}
| UTEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube);
}
| UTEXTURE1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd1D, true);
}
| UTEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, Esd2D, true);
}
| UTEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtUint, EsdCube, true);
}
| TEXTURE2DRECT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;

File diff suppressed because it is too large Load Diff

View File

@ -89,227 +89,227 @@ extern int yydebug;
USAMPLER3D = 299,
USAMPLERCUBE = 300,
USAMPLER2DARRAY = 301,
SAMPLERCUBEARRAY = 302,
SAMPLERCUBEARRAYSHADOW = 303,
ISAMPLERCUBEARRAY = 304,
USAMPLERCUBEARRAY = 305,
ATTRIBUTE = 306,
VARYING = 307,
FLOAT16_T = 308,
FLOAT32_T = 309,
DOUBLE = 310,
FLOAT64_T = 311,
INT64_T = 312,
UINT64_T = 313,
INT32_T = 314,
UINT32_T = 315,
INT16_T = 316,
UINT16_T = 317,
INT8_T = 318,
UINT8_T = 319,
I64VEC2 = 320,
I64VEC3 = 321,
I64VEC4 = 322,
U64VEC2 = 323,
U64VEC3 = 324,
U64VEC4 = 325,
I32VEC2 = 326,
I32VEC3 = 327,
I32VEC4 = 328,
U32VEC2 = 329,
U32VEC3 = 330,
U32VEC4 = 331,
I16VEC2 = 332,
I16VEC3 = 333,
I16VEC4 = 334,
U16VEC2 = 335,
U16VEC3 = 336,
U16VEC4 = 337,
I8VEC2 = 338,
I8VEC3 = 339,
I8VEC4 = 340,
U8VEC2 = 341,
U8VEC3 = 342,
U8VEC4 = 343,
DVEC2 = 344,
DVEC3 = 345,
DVEC4 = 346,
DMAT2 = 347,
DMAT3 = 348,
DMAT4 = 349,
F16VEC2 = 350,
F16VEC3 = 351,
F16VEC4 = 352,
F16MAT2 = 353,
F16MAT3 = 354,
F16MAT4 = 355,
F32VEC2 = 356,
F32VEC3 = 357,
F32VEC4 = 358,
F32MAT2 = 359,
F32MAT3 = 360,
F32MAT4 = 361,
F64VEC2 = 362,
F64VEC3 = 363,
F64VEC4 = 364,
F64MAT2 = 365,
F64MAT3 = 366,
F64MAT4 = 367,
DMAT2X2 = 368,
DMAT2X3 = 369,
DMAT2X4 = 370,
DMAT3X2 = 371,
DMAT3X3 = 372,
DMAT3X4 = 373,
DMAT4X2 = 374,
DMAT4X3 = 375,
DMAT4X4 = 376,
F16MAT2X2 = 377,
F16MAT2X3 = 378,
F16MAT2X4 = 379,
F16MAT3X2 = 380,
F16MAT3X3 = 381,
F16MAT3X4 = 382,
F16MAT4X2 = 383,
F16MAT4X3 = 384,
F16MAT4X4 = 385,
F32MAT2X2 = 386,
F32MAT2X3 = 387,
F32MAT2X4 = 388,
F32MAT3X2 = 389,
F32MAT3X3 = 390,
F32MAT3X4 = 391,
F32MAT4X2 = 392,
F32MAT4X3 = 393,
F32MAT4X4 = 394,
F64MAT2X2 = 395,
F64MAT2X3 = 396,
F64MAT2X4 = 397,
F64MAT3X2 = 398,
F64MAT3X3 = 399,
F64MAT3X4 = 400,
F64MAT4X2 = 401,
F64MAT4X3 = 402,
F64MAT4X4 = 403,
ATOMIC_UINT = 404,
ACCSTRUCTNV = 405,
FCOOPMATNV = 406,
ICOOPMATNV = 407,
UCOOPMATNV = 408,
SAMPLER1D = 409,
SAMPLER1DARRAY = 410,
SAMPLER1DARRAYSHADOW = 411,
ISAMPLER1D = 412,
SAMPLER1DSHADOW = 413,
SAMPLER2DRECT = 414,
SAMPLER2DRECTSHADOW = 415,
ISAMPLER2DRECT = 416,
USAMPLER2DRECT = 417,
SAMPLERBUFFER = 418,
ISAMPLERBUFFER = 419,
USAMPLERBUFFER = 420,
SAMPLER2DMS = 421,
ISAMPLER2DMS = 422,
USAMPLER2DMS = 423,
SAMPLER2DMSARRAY = 424,
ISAMPLER2DMSARRAY = 425,
USAMPLER2DMSARRAY = 426,
SAMPLEREXTERNALOES = 427,
SAMPLEREXTERNAL2DY2YEXT = 428,
ISAMPLER1DARRAY = 429,
USAMPLER1D = 430,
USAMPLER1DARRAY = 431,
F16SAMPLER1D = 432,
F16SAMPLER2D = 433,
F16SAMPLER3D = 434,
F16SAMPLER2DRECT = 435,
F16SAMPLERCUBE = 436,
F16SAMPLER1DARRAY = 437,
F16SAMPLER2DARRAY = 438,
F16SAMPLERCUBEARRAY = 439,
F16SAMPLERBUFFER = 440,
F16SAMPLER2DMS = 441,
F16SAMPLER2DMSARRAY = 442,
F16SAMPLER1DSHADOW = 443,
F16SAMPLER2DSHADOW = 444,
F16SAMPLER1DARRAYSHADOW = 445,
F16SAMPLER2DARRAYSHADOW = 446,
F16SAMPLER2DRECTSHADOW = 447,
F16SAMPLERCUBESHADOW = 448,
F16SAMPLERCUBEARRAYSHADOW = 449,
IMAGE1D = 450,
IIMAGE1D = 451,
UIMAGE1D = 452,
IMAGE2D = 453,
IIMAGE2D = 454,
UIMAGE2D = 455,
IMAGE3D = 456,
IIMAGE3D = 457,
UIMAGE3D = 458,
IMAGE2DRECT = 459,
IIMAGE2DRECT = 460,
UIMAGE2DRECT = 461,
IMAGECUBE = 462,
IIMAGECUBE = 463,
UIMAGECUBE = 464,
IMAGEBUFFER = 465,
IIMAGEBUFFER = 466,
UIMAGEBUFFER = 467,
IMAGE1DARRAY = 468,
IIMAGE1DARRAY = 469,
UIMAGE1DARRAY = 470,
IMAGE2DARRAY = 471,
IIMAGE2DARRAY = 472,
UIMAGE2DARRAY = 473,
IMAGECUBEARRAY = 474,
IIMAGECUBEARRAY = 475,
UIMAGECUBEARRAY = 476,
IMAGE2DMS = 477,
IIMAGE2DMS = 478,
UIMAGE2DMS = 479,
IMAGE2DMSARRAY = 480,
IIMAGE2DMSARRAY = 481,
UIMAGE2DMSARRAY = 482,
F16IMAGE1D = 483,
F16IMAGE2D = 484,
F16IMAGE3D = 485,
F16IMAGE2DRECT = 486,
F16IMAGECUBE = 487,
F16IMAGE1DARRAY = 488,
F16IMAGE2DARRAY = 489,
F16IMAGECUBEARRAY = 490,
F16IMAGEBUFFER = 491,
F16IMAGE2DMS = 492,
F16IMAGE2DMSARRAY = 493,
SAMPLER = 494,
SAMPLERSHADOW = 495,
TEXTURE1D = 496,
TEXTURE2D = 497,
TEXTURE3D = 498,
TEXTURECUBE = 499,
TEXTURE1DARRAY = 500,
TEXTURE2DARRAY = 501,
ITEXTURE1D = 502,
ITEXTURE2D = 503,
ITEXTURE3D = 504,
ITEXTURECUBE = 505,
ITEXTURE1DARRAY = 506,
ITEXTURE2DARRAY = 507,
UTEXTURE1D = 508,
UTEXTURE2D = 509,
UTEXTURE3D = 510,
UTEXTURECUBE = 511,
UTEXTURE1DARRAY = 512,
UTEXTURE2DARRAY = 513,
TEXTURE2DRECT = 514,
ITEXTURE2DRECT = 515,
UTEXTURE2DRECT = 516,
TEXTUREBUFFER = 517,
ITEXTUREBUFFER = 518,
UTEXTUREBUFFER = 519,
TEXTURECUBEARRAY = 520,
ITEXTURECUBEARRAY = 521,
UTEXTURECUBEARRAY = 522,
SAMPLER = 302,
SAMPLERSHADOW = 303,
TEXTURE2D = 304,
TEXTURE3D = 305,
TEXTURECUBE = 306,
TEXTURE2DARRAY = 307,
ITEXTURE2D = 308,
ITEXTURE3D = 309,
ITEXTURECUBE = 310,
ITEXTURE2DARRAY = 311,
UTEXTURE2D = 312,
UTEXTURE3D = 313,
UTEXTURECUBE = 314,
UTEXTURE2DARRAY = 315,
ATTRIBUTE = 316,
VARYING = 317,
FLOAT16_T = 318,
FLOAT32_T = 319,
DOUBLE = 320,
FLOAT64_T = 321,
INT64_T = 322,
UINT64_T = 323,
INT32_T = 324,
UINT32_T = 325,
INT16_T = 326,
UINT16_T = 327,
INT8_T = 328,
UINT8_T = 329,
I64VEC2 = 330,
I64VEC3 = 331,
I64VEC4 = 332,
U64VEC2 = 333,
U64VEC3 = 334,
U64VEC4 = 335,
I32VEC2 = 336,
I32VEC3 = 337,
I32VEC4 = 338,
U32VEC2 = 339,
U32VEC3 = 340,
U32VEC4 = 341,
I16VEC2 = 342,
I16VEC3 = 343,
I16VEC4 = 344,
U16VEC2 = 345,
U16VEC3 = 346,
U16VEC4 = 347,
I8VEC2 = 348,
I8VEC3 = 349,
I8VEC4 = 350,
U8VEC2 = 351,
U8VEC3 = 352,
U8VEC4 = 353,
DVEC2 = 354,
DVEC3 = 355,
DVEC4 = 356,
DMAT2 = 357,
DMAT3 = 358,
DMAT4 = 359,
F16VEC2 = 360,
F16VEC3 = 361,
F16VEC4 = 362,
F16MAT2 = 363,
F16MAT3 = 364,
F16MAT4 = 365,
F32VEC2 = 366,
F32VEC3 = 367,
F32VEC4 = 368,
F32MAT2 = 369,
F32MAT3 = 370,
F32MAT4 = 371,
F64VEC2 = 372,
F64VEC3 = 373,
F64VEC4 = 374,
F64MAT2 = 375,
F64MAT3 = 376,
F64MAT4 = 377,
DMAT2X2 = 378,
DMAT2X3 = 379,
DMAT2X4 = 380,
DMAT3X2 = 381,
DMAT3X3 = 382,
DMAT3X4 = 383,
DMAT4X2 = 384,
DMAT4X3 = 385,
DMAT4X4 = 386,
F16MAT2X2 = 387,
F16MAT2X3 = 388,
F16MAT2X4 = 389,
F16MAT3X2 = 390,
F16MAT3X3 = 391,
F16MAT3X4 = 392,
F16MAT4X2 = 393,
F16MAT4X3 = 394,
F16MAT4X4 = 395,
F32MAT2X2 = 396,
F32MAT2X3 = 397,
F32MAT2X4 = 398,
F32MAT3X2 = 399,
F32MAT3X3 = 400,
F32MAT3X4 = 401,
F32MAT4X2 = 402,
F32MAT4X3 = 403,
F32MAT4X4 = 404,
F64MAT2X2 = 405,
F64MAT2X3 = 406,
F64MAT2X4 = 407,
F64MAT3X2 = 408,
F64MAT3X3 = 409,
F64MAT3X4 = 410,
F64MAT4X2 = 411,
F64MAT4X3 = 412,
F64MAT4X4 = 413,
ATOMIC_UINT = 414,
ACCSTRUCTNV = 415,
FCOOPMATNV = 416,
ICOOPMATNV = 417,
UCOOPMATNV = 418,
SAMPLERCUBEARRAY = 419,
SAMPLERCUBEARRAYSHADOW = 420,
ISAMPLERCUBEARRAY = 421,
USAMPLERCUBEARRAY = 422,
SAMPLER1D = 423,
SAMPLER1DARRAY = 424,
SAMPLER1DARRAYSHADOW = 425,
ISAMPLER1D = 426,
SAMPLER1DSHADOW = 427,
SAMPLER2DRECT = 428,
SAMPLER2DRECTSHADOW = 429,
ISAMPLER2DRECT = 430,
USAMPLER2DRECT = 431,
SAMPLERBUFFER = 432,
ISAMPLERBUFFER = 433,
USAMPLERBUFFER = 434,
SAMPLER2DMS = 435,
ISAMPLER2DMS = 436,
USAMPLER2DMS = 437,
SAMPLER2DMSARRAY = 438,
ISAMPLER2DMSARRAY = 439,
USAMPLER2DMSARRAY = 440,
SAMPLEREXTERNALOES = 441,
SAMPLEREXTERNAL2DY2YEXT = 442,
ISAMPLER1DARRAY = 443,
USAMPLER1D = 444,
USAMPLER1DARRAY = 445,
F16SAMPLER1D = 446,
F16SAMPLER2D = 447,
F16SAMPLER3D = 448,
F16SAMPLER2DRECT = 449,
F16SAMPLERCUBE = 450,
F16SAMPLER1DARRAY = 451,
F16SAMPLER2DARRAY = 452,
F16SAMPLERCUBEARRAY = 453,
F16SAMPLERBUFFER = 454,
F16SAMPLER2DMS = 455,
F16SAMPLER2DMSARRAY = 456,
F16SAMPLER1DSHADOW = 457,
F16SAMPLER2DSHADOW = 458,
F16SAMPLER1DARRAYSHADOW = 459,
F16SAMPLER2DARRAYSHADOW = 460,
F16SAMPLER2DRECTSHADOW = 461,
F16SAMPLERCUBESHADOW = 462,
F16SAMPLERCUBEARRAYSHADOW = 463,
IMAGE1D = 464,
IIMAGE1D = 465,
UIMAGE1D = 466,
IMAGE2D = 467,
IIMAGE2D = 468,
UIMAGE2D = 469,
IMAGE3D = 470,
IIMAGE3D = 471,
UIMAGE3D = 472,
IMAGE2DRECT = 473,
IIMAGE2DRECT = 474,
UIMAGE2DRECT = 475,
IMAGECUBE = 476,
IIMAGECUBE = 477,
UIMAGECUBE = 478,
IMAGEBUFFER = 479,
IIMAGEBUFFER = 480,
UIMAGEBUFFER = 481,
IMAGE1DARRAY = 482,
IIMAGE1DARRAY = 483,
UIMAGE1DARRAY = 484,
IMAGE2DARRAY = 485,
IIMAGE2DARRAY = 486,
UIMAGE2DARRAY = 487,
IMAGECUBEARRAY = 488,
IIMAGECUBEARRAY = 489,
UIMAGECUBEARRAY = 490,
IMAGE2DMS = 491,
IIMAGE2DMS = 492,
UIMAGE2DMS = 493,
IMAGE2DMSARRAY = 494,
IIMAGE2DMSARRAY = 495,
UIMAGE2DMSARRAY = 496,
F16IMAGE1D = 497,
F16IMAGE2D = 498,
F16IMAGE3D = 499,
F16IMAGE2DRECT = 500,
F16IMAGECUBE = 501,
F16IMAGE1DARRAY = 502,
F16IMAGE2DARRAY = 503,
F16IMAGECUBEARRAY = 504,
F16IMAGEBUFFER = 505,
F16IMAGE2DMS = 506,
F16IMAGE2DMSARRAY = 507,
TEXTURECUBEARRAY = 508,
ITEXTURECUBEARRAY = 509,
UTEXTURECUBEARRAY = 510,
TEXTURE1D = 511,
ITEXTURE1D = 512,
UTEXTURE1D = 513,
TEXTURE1DARRAY = 514,
ITEXTURE1DARRAY = 515,
UTEXTURE1DARRAY = 516,
TEXTURE2DRECT = 517,
ITEXTURE2DRECT = 518,
UTEXTURE2DRECT = 519,
TEXTUREBUFFER = 520,
ITEXTUREBUFFER = 521,
UTEXTUREBUFFER = 522,
TEXTURE2DMS = 523,
ITEXTURE2DMS = 524,
UTEXTURE2DMS = 525,
@ -414,27 +414,27 @@ extern int yydebug;
DEFAULT = 624,
UNIFORM = 625,
SHARED = 626,
FLAT = 627,
SMOOTH = 628,
LAYOUT = 629,
DOUBLECONSTANT = 630,
INT16CONSTANT = 631,
UINT16CONSTANT = 632,
FLOAT16CONSTANT = 633,
INT32CONSTANT = 634,
UINT32CONSTANT = 635,
INT64CONSTANT = 636,
UINT64CONSTANT = 637,
SUBROUTINE = 638,
DEMOTE = 639,
PAYLOADNV = 640,
PAYLOADINNV = 641,
HITATTRNV = 642,
CALLDATANV = 643,
CALLDATAINNV = 644,
PATCH = 645,
SAMPLE = 646,
BUFFER = 647,
BUFFER = 627,
FLAT = 628,
SMOOTH = 629,
LAYOUT = 630,
DOUBLECONSTANT = 631,
INT16CONSTANT = 632,
UINT16CONSTANT = 633,
FLOAT16CONSTANT = 634,
INT32CONSTANT = 635,
UINT32CONSTANT = 636,
INT64CONSTANT = 637,
UINT64CONSTANT = 638,
SUBROUTINE = 639,
DEMOTE = 640,
PAYLOADNV = 641,
PAYLOADINNV = 642,
HITATTRNV = 643,
CALLDATANV = 644,
CALLDATAINNV = 645,
PATCH = 646,
SAMPLE = 647,
NONUNIFORM = 648,
COHERENT = 649,
VOLATILE = 650,

View File

@ -496,6 +496,7 @@ void TIntermediate::mergeImplicitArraySizes(TType& type, const TType& unitType)
//
void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol, bool crossStage)
{
#ifndef GLSLANG_WEB
bool writeTypeComparison = false;
// Types have to match
@ -546,7 +547,6 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
writeTypeComparison = true;
}
#ifndef GLSLANG_WEB
// Memory...
if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent ||
symbol.getQualifier().devicecoherent != unitSymbol.getQualifier().devicecoherent ||
@ -561,7 +561,6 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
error(infoSink, "Memory qualifiers must match:");
writeTypeComparison = true;
}
#endif
// Layouts...
// TODO: 4.4 enhanced layouts: Generalize to include offset/align: current spec
@ -591,6 +590,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
if (writeTypeComparison)
infoSink.info << " " << symbol.getName() << ": \"" << symbol.getType().getCompleteString() << "\" versus \"" <<
unitSymbol.getType().getCompleteString() << "\"\n";
#endif
}
//
@ -1095,7 +1095,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
}
// combine location and component ranges
TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0);
TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.getIndex() : 0);
// check for collisions, except for vertex inputs on desktop targeting OpenGL
if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)

View File

@ -147,6 +147,7 @@ struct TOffsetRange {
TRange offset;
};
#ifndef GLSLANG_WEB
// Things that need to be tracked per xfb buffer.
struct TXfbBuffer {
TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false),
@ -158,6 +159,7 @@ struct TXfbBuffer {
bool contains32BitType;
bool contains16BitType;
};
#endif
// Track a set of strings describing how the module was processed.
// Using the form:
@ -267,7 +269,6 @@ public:
uniformLocationBase(0)
#endif
{
#ifndef GLSLANG_WEB
localSize[0] = 1;
localSize[1] = 1;
localSize[2] = 1;
@ -277,6 +278,7 @@ public:
localSizeSpecId[0] = TQualifier::layoutNotSet;
localSizeSpecId[1] = TQualifier::layoutNotSet;
localSizeSpecId[2] = TQualifier::layoutNotSet;
#ifndef GLSLANG_WEB
xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
shiftBinding.fill(0);
#endif
@ -465,7 +467,23 @@ public:
bool usingStorageBuffer() const { return useStorageBuffer; }
void setDepthReplacing() { depthReplacing = true; }
bool isDepthReplacing() const { return depthReplacing; }
bool setLocalSize(int dim, int size)
{
if (localSizeNotDefault[dim])
return size == localSize[dim];
localSizeNotDefault[dim] = true;
localSize[dim] = size;
return true;
}
unsigned int getLocalSize(int dim) const { return localSize[dim]; }
bool setLocalSizeSpecId(int dim, int id)
{
if (localSizeSpecId[dim] != TQualifier::layoutNotSet)
return id == localSizeSpecId[dim];
localSizeSpecId[dim] = id;
return true;
}
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
#ifdef GLSLANG_WEB
void output(TInfoSink&, bool tree) { }
@ -492,6 +510,7 @@ public:
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);
@ -655,24 +674,6 @@ public:
}
TInterlockOrdering getInterlockOrdering() const { return interlockOrdering; }
bool setLocalSize(int dim, int size)
{
if (localSizeNotDefault[dim])
return size == localSize[dim];
localSizeNotDefault[dim] = true;
localSize[dim] = size;
return true;
}
unsigned int getLocalSize(int dim) const { return localSize[dim]; }
bool setLocalSizeSpecId(int dim, int id)
{
if (localSizeSpecId[dim] != TQualifier::layoutNotSet)
return id == localSizeSpecId[dim];
localSizeSpecId[dim] = id;
return true;
}
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
void setXfbMode() { xfbMode = true; }
bool getXfbMode() const { return xfbMode; }
void setMultiStream() { multiStream = true; }
@ -757,7 +758,7 @@ public:
void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
#endif
#endif // GLSLANG_WEB
#ifdef ENABLE_HLSL
void setHlslFunctionality1() { hlslFunctionality1 = true; }
@ -920,6 +921,9 @@ protected:
bool useStorageBuffer;
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
bool depthReplacing;
int localSize[3];
bool localSizeNotDefault[3];
int localSizeSpecId[3];
#ifndef GLSLANG_WEB
bool useVulkanMemoryModel;
int invocations;
@ -932,9 +936,6 @@ protected:
TVertexOrder vertexOrder;
TInterlockOrdering interlockOrdering;
bool pointMode;
int localSize[3];
bool localSizeNotDefault[3];
int localSizeSpecId[3];
bool earlyFragmentTests;
bool postDepthCoverage;
TLayoutDepth depthLayout;

View File

@ -5,14 +5,14 @@
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Tools",
"subdir" : "External/spirv-tools",
"commit" : "c3ca04741945c332ddbeb7d7125dbae2809b7195"
"commit" : "02910ffdffaa2966f613ede0c516645f5555c13c"
},
{
"name" : "spirv-tools/external/spirv-headers",
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Headers",
"subdir" : "External/spirv-tools/external/spirv-headers",
"commit" : "b252a50953ac4375cb1864e94f4b0234db9d215d"
"commit" : "af64a9e826bf5bb5fcd2434dd71be1e41e922563"
}
]
}

View File

@ -0,0 +1,60 @@
#!/bin/bash
# Copyright (C) 2019 Google, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Linux Build Script.
# Fail on any error.
set -e
# Display commands being run.
set -x
CC=clang
CXX=clang++
SRC=$PWD/github/glslang
cd $SRC
# Bazel limitation: No 'External' directory is allowed!!
mv External third_party
gsutil cp gs://bazel/0.29.1/release/bazel-0.29.1-linux-x86_64 .
chmod +x bazel-0.29.1-linux-x86_64
echo $(date): Build everything...
./bazel-0.29.1-linux-x86_64 build :all
echo $(date): Build completed.
echo $(date): Starting bazel test...
./bazel-0.29.1-linux-x86_64 test :all
echo $(date): Bazel test completed.

View File

@ -0,0 +1,35 @@
# Copyright (C) 2019 Google, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Continuous build configuration.
build_file: "glslang/kokoro/linux-clang-release-bazel/build.sh"

View File

@ -0,0 +1,35 @@
# Copyright (C) 2019 Google, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Presubmit build configuration.
build_file: "glslang/kokoro/linux-clang-release-bazel/build.sh"

View File

@ -0,0 +1,60 @@
#!/bin/bash
# Copyright (C) 2019 Google, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# macOS Build Script.
# Fail on any error.
set -e
# Display commands being run.
set -x
CC=clang
CXX=clang++
SRC=$PWD/github/glslang
cd $SRC
mv External third_party
# Get bazel 0.29.1.
gsutil cp gs://bazel/0.29.1/release/bazel-0.29.1-darwin-x86_64 .
chmod +x bazel-0.29.1-darwin-x86_64
echo $(date): Build everything...
./bazel-0.29.1-darwin-x86_64 build :all
echo $(date): Build completed.
echo $(date): Starting bazel test...
./bazel-0.29.1-darwin-x86_64 test :all
echo $(date): Bazel test completed.

View File

@ -0,0 +1,35 @@
# Copyright (C) 2019 Google, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Continuous build configuration.
build_file: "glslang/kokoro/macos-clang-release-bazel/build.sh"

View File

@ -0,0 +1,35 @@
# Copyright (C) 2019 Google, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Presubmit build configuration.
build_file: "glslang/kokoro/macos-clang-release-bazel/build.sh"

View File

@ -0,0 +1,75 @@
:: Copyright (C) 2019 Google, Inc.
::
:: All rights reserved.
::
:: Redistribution and use in source and binary forms, with or without
:: modification, are permitted provided that the following conditions
:: are met:
::
:: Redistributions of source code must retain the above copyright
:: notice, this list of conditions and the following disclaimer.
::
:: Redistributions in binary form must reproduce the above
:: copyright notice, this list of conditions and the following
:: disclaimer in the documentation and/or other materials provided
:: with the distribution.
::
:: Neither the name of Google Inc. nor the names of its
:: contributors may be used to endorse or promote products derived
:: from this software without specific prior written permission.
::
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
:: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
:: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
:: FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
:: COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
:: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
:: BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
:: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
:: CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
:: LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
:: ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
:: POSSIBILITY OF SUCH DAMAGE.
:: Copyright (c) 2019 Google LLC.
::
:: Windows Build Script.
@echo on
set SRC=%cd%\github\glslang
:: Force usage of python 3.6
set PATH=C:\python36;%PATH%
cd %SRC%
mv External third_party
:: REM Install Bazel.
wget -q https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-windows-x86_64.zip
unzip -q bazel-0.29.1-windows-x86_64.zip
:: Set up MSVC
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
set BAZEL_VS=C:\Program Files (x86)\Microsoft Visual Studio 14.0
set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
set BAZEL_SH=c:\tools\msys64\usr\bin\bash.exe
set BAZEL_PYTHON=c:\tools\python2\python.exe
:: #########################################
:: Start building.
:: #########################################
echo "Build everything... %DATE% %TIME%"
bazel.exe build :all
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
echo "Build Completed %DATE% %TIME%"
:: ##############
:: Run the tests
:: ##############
echo "Running Tests... %DATE% %TIME%"
bazel.exe test :all
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
echo "Tests Completed %DATE% %TIME%"
exit /b 0

View File

@ -0,0 +1,35 @@
# Copyright (C) 2019 Google, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Continuous build configuration.
build_file: "glslang/kokoro/windows-msvc-2015-release-bazel/build.bat"

View File

@ -0,0 +1,35 @@
# Copyright (C) 2019 Google, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Presubmit build configuration.
build_file: "glslang/kokoro/windows-msvc-2015-release-bazel/build.bat"