mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-18 04:53:06 +01:00
Updated glslang.
This commit is contained in:
4
3rdparty/glslang/SPIRV/SpvBuilder.cpp
vendored
4
3rdparty/glslang/SPIRV/SpvBuilder.cpp
vendored
@@ -859,12 +859,14 @@ Id Builder::makeFpConstant(Id type, double d, bool specConstant)
|
||||
return makeFloatConstant(d, specConstant);
|
||||
case 64:
|
||||
return makeDoubleConstant(d, specConstant);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
assert(false);
|
||||
return NoResult;
|
||||
}
|
||||
|
||||
|
||||
Id Builder::findCompositeConstant(Op typeClass, const std::vector<Id>& comps)
|
||||
{
|
||||
Instruction* constant = 0;
|
||||
|
||||
4
3rdparty/glslang/StandAlone/StandAlone.cpp
vendored
4
3rdparty/glslang/StandAlone/StandAlone.cpp
vendored
@@ -160,9 +160,9 @@ const char* variableName = nullptr;
|
||||
bool HlslEnable16BitTypes = false;
|
||||
std::vector<std::string> IncludeDirectoryList;
|
||||
int ClientInputSemanticsVersion = 100; // maps to, say, #define VULKAN 100
|
||||
glslang::EshTargetClientVersion VulkanClientVersion =
|
||||
glslang::EShTargetClientVersion VulkanClientVersion =
|
||||
glslang::EShTargetVulkan_1_0; // would map to, say, Vulkan 1.0
|
||||
glslang::EshTargetClientVersion OpenGLClientVersion =
|
||||
glslang::EShTargetClientVersion OpenGLClientVersion =
|
||||
glslang::EShTargetOpenGL_450; // doesn't influence anything yet, but maps to OpenGL 4.50
|
||||
glslang::EShTargetLanguageVersion TargetVersion =
|
||||
glslang::EShTargetSpv_1_0; // maps to, say, SPIR-V 1.0
|
||||
|
||||
14
3rdparty/glslang/Test/baseResults/cppRelaxSkipTokensErrors.vert.out
vendored
Executable file
14
3rdparty/glslang/Test/baseResults/cppRelaxSkipTokensErrors.vert.out
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
cppRelaxSkipTokensErrors.vert
|
||||
Shader version: 110
|
||||
0:? Sequence
|
||||
0:? Linker Objects
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
||||
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
|
||||
|
||||
Shader version: 110
|
||||
0:? Sequence
|
||||
0:? Linker Objects
|
||||
|
||||
@@ -94,6 +94,7 @@ void main()
|
||||
MemberDecorate 54(ubuf) 0 Offset 0
|
||||
Decorate 54(ubuf) Block
|
||||
Decorate 56 DescriptorSet 3
|
||||
Decorate 69(s2d) Location 0
|
||||
Decorate 69(s2d) DescriptorSet 3
|
||||
3: TypeVoid
|
||||
4: TypeFunction 3
|
||||
|
||||
@@ -97,6 +97,7 @@ void main()
|
||||
Decorate 54(ubuf) Block
|
||||
Decorate 56 DescriptorSet 3
|
||||
Decorate 56 Binding 0
|
||||
Decorate 69(s2d) Location 0
|
||||
Decorate 69(s2d) DescriptorSet 3
|
||||
Decorate 69(s2d) Binding 1
|
||||
3: TypeVoid
|
||||
|
||||
2
3rdparty/glslang/Test/cppBad.vert
vendored
2
3rdparty/glslang/Test/cppBad.vert
vendored
@@ -1,5 +1,5 @@
|
||||
#define m#0#
|
||||
#if m
|
||||
|
||||
#endif
|
||||
#define n()
|
||||
int n"
|
||||
14
3rdparty/glslang/Test/cppRelaxSkipTokensErrors.vert
vendored
Normal file
14
3rdparty/glslang/Test/cppRelaxSkipTokensErrors.vert
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#version 110
|
||||
|
||||
#if 0
|
||||
3.5L
|
||||
3.5h
|
||||
2034h
|
||||
1.#INF
|
||||
0x1234567812345L
|
||||
12323394203923879234L
|
||||
0123s;
|
||||
123s;
|
||||
0123456712345671234L
|
||||
"string"
|
||||
#endif
|
||||
2
3rdparty/glslang/glslang/Include/revision.h
vendored
2
3rdparty/glslang/glslang/Include/revision.h
vendored
@@ -1,3 +1,3 @@
|
||||
// This header is generated by the make-revision script.
|
||||
|
||||
#define GLSLANG_PATCH_LEVEL 2629
|
||||
#define GLSLANG_PATCH_LEVEL 2637
|
||||
|
||||
@@ -2778,8 +2778,8 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
|
||||
error(loc, "can't use auxiliary qualifier on a fragment output", "centroid/sample/patch", "");
|
||||
if (qualifier.isInterpolation())
|
||||
error(loc, "can't use interpolation qualifier on a fragment output", "flat/smooth/noperspective", "");
|
||||
if (publicType.basicType == EbtDouble)
|
||||
error(loc, "cannot contain a double", GetStorageQualifierString(qualifier.storage), "");
|
||||
if (publicType.basicType == EbtDouble || publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64)
|
||||
error(loc, "cannot contain a double, int64, or uint64", GetStorageQualifierString(qualifier.storage), "");
|
||||
break;
|
||||
|
||||
case EShLangCompute:
|
||||
|
||||
@@ -431,7 +431,8 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
|
||||
// no locations added if already present, a built-in variable, a block, or an opaque
|
||||
if (type.getQualifier().hasLocation() || type.isBuiltIn() ||
|
||||
type.getBasicType() == EbtBlock || type.containsOpaque())
|
||||
type.getBasicType() == EbtBlock ||
|
||||
(type.containsOpaque() && intermediate.getSpv().openGl == 0))
|
||||
return -1;
|
||||
|
||||
// no locations on blocks of built-in variables
|
||||
@@ -442,7 +443,11 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
return -1;
|
||||
}
|
||||
|
||||
return nextUniformLocation++;
|
||||
int location = nextUniformLocation;
|
||||
|
||||
nextUniformLocation += TIntermediate::computeTypeUniformLocationSize(type);
|
||||
|
||||
return location;
|
||||
}
|
||||
bool validateInOut(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override
|
||||
{
|
||||
|
||||
@@ -962,6 +962,36 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Same as computeTypeLocationSize but for uniforms
|
||||
int TIntermediate::computeTypeUniformLocationSize(const TType& type)
|
||||
{
|
||||
// "Individual elements of a uniform array are assigned
|
||||
// consecutive locations with the first element taking location
|
||||
// location."
|
||||
if (type.isArray()) {
|
||||
// TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
|
||||
TType elementType(type, 0);
|
||||
if (type.isImplicitlySizedArray()) {
|
||||
// TODO: are there valid cases of having an implicitly-sized array with a location? If so, running this code too early.
|
||||
return computeTypeUniformLocationSize(elementType);
|
||||
} else
|
||||
return type.getOuterArraySize() * computeTypeUniformLocationSize(elementType);
|
||||
}
|
||||
|
||||
// "Each subsequent inner-most member or element gets incremental
|
||||
// locations for the entire structure or array."
|
||||
if (type.isStruct()) {
|
||||
int size = 0;
|
||||
for (int member = 0; member < (int)type.getStruct()->size(); ++member) {
|
||||
TType memberType(type, member);
|
||||
size += computeTypeUniformLocationSize(memberType);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
|
||||
//
|
||||
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
|
||||
|
||||
@@ -590,6 +590,7 @@ public:
|
||||
int addUsedOffsets(int binding, int offset, int numOffsets);
|
||||
bool addUsedConstantId(int id);
|
||||
static int computeTypeLocationSize(const TType&, EShLanguage);
|
||||
static int computeTypeUniformLocationSize(const TType&);
|
||||
|
||||
bool setXfbBufferStride(int buffer, unsigned stride)
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||
ch = getChar();
|
||||
|
||||
// 1.#INF or -1.#INF
|
||||
if (parseContext.intermediate.getSource() == EShSourceHlsl && ch == '#') {
|
||||
if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
|
||||
if ((len < 2) ||
|
||||
(len == 2 && ppToken->name[0] != '1') ||
|
||||
(len == 3 && ppToken->name[1] != '1' && !(ppToken->name[0] == '-' || ppToken->name[0] == '+')) ||
|
||||
@@ -174,9 +174,9 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||
// Suffix:
|
||||
bool isFloat16 = false;
|
||||
if (ch == 'l' || ch == 'L') {
|
||||
if (parseContext.intermediate.getSource() == EShSourceGlsl)
|
||||
if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl)
|
||||
parseContext.doubleCheck(ppToken->loc, "double floating-point suffix");
|
||||
if (! HasDecimalOrExponent)
|
||||
if (ifdepth == 0 && !HasDecimalOrExponent)
|
||||
parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||
if (parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
int ch2 = getChar();
|
||||
@@ -193,9 +193,9 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||
isDouble = 1;
|
||||
}
|
||||
} else if (ch == 'h' || ch == 'H') {
|
||||
if (parseContext.intermediate.getSource() == EShSourceGlsl)
|
||||
if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl)
|
||||
parseContext.float16Check(ppToken->loc, "half floating-point suffix");
|
||||
if (!HasDecimalOrExponent)
|
||||
if (ifdepth == 0 && !HasDecimalOrExponent)
|
||||
parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||
if (parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
int ch2 = getChar();
|
||||
@@ -212,10 +212,11 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||
isFloat16 = true;
|
||||
}
|
||||
} else if (ch == 'f' || ch == 'F') {
|
||||
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
|
||||
if (! parseContext.relaxedErrors())
|
||||
if (ifdepth == 0)
|
||||
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
|
||||
if (ifdepth == 0 && !parseContext.relaxedErrors())
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
|
||||
if (! HasDecimalOrExponent)
|
||||
if (ifdepth == 0 && !HasDecimalOrExponent)
|
||||
parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||
saveName(ch);
|
||||
} else
|
||||
@@ -483,18 +484,22 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
ppToken->name[len] = '\0';
|
||||
|
||||
if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
if (pp->ifdepth == 0) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
"64-bit hexadecimal literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int64_Extensions, Int64_Extensions, "64-bit hexadecimal literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int64_Extensions, Int64_Extensions, "64-bit hexadecimal literal");
|
||||
}
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
} else if (isInt16) {
|
||||
if (pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
"16-bit hexadecimal literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int16_Extensions, Int16_Extensions, "16-bit hexadecimal literal");
|
||||
if (pp->ifdepth == 0) {
|
||||
if (pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
"16-bit hexadecimal literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int16_Extensions, Int16_Extensions, "16-bit hexadecimal literal");
|
||||
}
|
||||
}
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16;
|
||||
@@ -595,18 +600,22 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
pp->parseContext.ppError(ppToken->loc, "octal literal too big", "", "");
|
||||
|
||||
if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
if (pp->ifdepth == 0) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
"64-bit octal literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int64_Extensions, Int64_Extensions, "64-bit octal literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int64_Extensions, Int64_Extensions, "64-bit octal literal");
|
||||
}
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
} else if (isInt16) {
|
||||
if (pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
"16-bit octal literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int16_Extensions, Int16_Extensions, "16-bit octal literal");
|
||||
if (pp->ifdepth == 0) {
|
||||
if (pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
"16-bit octal literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int16_Extensions, Int16_Extensions, "16-bit octal literal");
|
||||
}
|
||||
}
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16;
|
||||
@@ -700,16 +709,18 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
}
|
||||
|
||||
if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
if (pp->ifdepth == 0) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
"64-bit literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int64_Extensions, Int64_Extensions, "64-bit literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int64_Extensions, Int64_Extensions, "64-bit literal");
|
||||
}
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
} else if (isInt16) {
|
||||
if (pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
if (pp->ifdepth == 0 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
|
||||
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
|
||||
"16-bit literal");
|
||||
"16-bit literal");
|
||||
pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0,
|
||||
Num_Int16_Extensions, Int16_Extensions, "16-bit literal");
|
||||
}
|
||||
@@ -972,7 +983,7 @@ int TPpContext::tokenize(TPpToken& ppToken)
|
||||
continue;
|
||||
break;
|
||||
case PpAtomConstString:
|
||||
if (parseContext.intermediate.getSource() != EShSourceHlsl) {
|
||||
if (ifdepth == 0 && parseContext.intermediate.getSource() != EShSourceHlsl) {
|
||||
// HLSL allows string literals.
|
||||
parseContext.ppError(ppToken.loc, "string literals not supported", "\"\"", "");
|
||||
continue;
|
||||
|
||||
8
3rdparty/glslang/glslang/Public/ShaderLang.h
vendored
8
3rdparty/glslang/glslang/Public/ShaderLang.h
vendored
@@ -132,7 +132,9 @@ typedef enum {
|
||||
EShTargetVulkan_1_0 = (1 << 22),
|
||||
EShTargetVulkan_1_1 = (1 << 22) | (1 << 12),
|
||||
EShTargetOpenGL_450 = 450,
|
||||
} EshTargetClientVersion;
|
||||
} EShTargetClientVersion;
|
||||
|
||||
typedef EShTargetClientVersion EshTargetClientVersion;
|
||||
|
||||
typedef enum {
|
||||
EShTargetSpv_1_0 = (1 << 16),
|
||||
@@ -148,7 +150,7 @@ struct TInputLanguage {
|
||||
|
||||
struct TClient {
|
||||
EShClient client;
|
||||
EshTargetClientVersion version; // version of client itself (not the client's input dialect)
|
||||
EShTargetClientVersion version; // version of client itself (not the client's input dialect)
|
||||
};
|
||||
|
||||
struct TTarget {
|
||||
@@ -411,7 +413,7 @@ public:
|
||||
environment.input.dialect = client;
|
||||
environment.input.dialectVersion = version;
|
||||
}
|
||||
void setEnvClient(EShClient client, EshTargetClientVersion version)
|
||||
void setEnvClient(EShClient client, EShTargetClientVersion version)
|
||||
{
|
||||
environment.client.client = client;
|
||||
environment.client.version = version;
|
||||
|
||||
1
3rdparty/glslang/gtests/AST.FromFile.cpp
vendored
1
3rdparty/glslang/gtests/AST.FromFile.cpp
vendored
@@ -99,6 +99,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
"cppComplexExpr.vert",
|
||||
"cppDeepNest.frag",
|
||||
"cppPassMacroName.frag",
|
||||
"cppRelaxSkipTokensErrors.vert",
|
||||
"badChars.frag",
|
||||
"pointCoord.frag",
|
||||
"array.frag",
|
||||
|
||||
4
3rdparty/glslang/gtests/TestFixture.h
vendored
4
3rdparty/glslang/gtests/TestFixture.h
vendored
@@ -197,7 +197,7 @@ public:
|
||||
GlslangResult compileAndLink(
|
||||
const std::string shaderName, const std::string& code,
|
||||
const std::string& entryPointName, EShMessages controls,
|
||||
glslang::EshTargetClientVersion clientTargetVersion,
|
||||
glslang::EShTargetClientVersion clientTargetVersion,
|
||||
bool flattenUniformArrays = false,
|
||||
EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
|
||||
bool disableOptimizer = true,
|
||||
@@ -407,7 +407,7 @@ public:
|
||||
const std::string& testName,
|
||||
Source source,
|
||||
Semantics semantics,
|
||||
glslang::EshTargetClientVersion clientTargetVersion,
|
||||
glslang::EShTargetClientVersion clientTargetVersion,
|
||||
Target target,
|
||||
bool automap = true,
|
||||
const std::string& entryPointName="",
|
||||
|
||||
Reference in New Issue
Block a user