Commit 1f2c9771 by John Kessenich

Merge branch GitHub 'master' into GitLab master.

parents 78930325 e7c83cfb
......@@ -1951,7 +1951,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
std::vector<spv::Id> indexes;
int comp;
if (cracked.proj)
comp = 3;
comp = 2; // "The resulting 3rd component of P in the shadow forms is used as Dref"
else
comp = builder.getNumComponents(params.coords) - 1;
indexes.push_back(comp);
......@@ -2871,6 +2871,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
libCall = spv::GLSLstd450UMin;
else
libCall = spv::GLSLstd450SMin;
builder.promoteScalar(precision, operands.front(), operands.back());
break;
case glslang::EOpModf:
libCall = spv::GLSLstd450Modf;
......@@ -2882,6 +2883,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
libCall = spv::GLSLstd450UMax;
else
libCall = spv::GLSLstd450SMax;
builder.promoteScalar(precision, operands.front(), operands.back());
break;
case glslang::EOpPow:
libCall = spv::GLSLstd450Pow;
......@@ -2900,18 +2902,24 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
libCall = spv::GLSLstd450UClamp;
else
libCall = spv::GLSLstd450SClamp;
builder.promoteScalar(precision, operands.front(), operands[1]);
builder.promoteScalar(precision, operands.front(), operands[2]);
break;
case glslang::EOpMix:
if (isFloat)
libCall = spv::GLSLstd450FMix;
else
libCall = spv::GLSLstd450IMix;
builder.promoteScalar(precision, operands.front(), operands.back());
break;
case glslang::EOpStep:
libCall = spv::GLSLstd450Step;
builder.promoteScalar(precision, operands.front(), operands.back());
break;
case glslang::EOpSmoothStep:
libCall = spv::GLSLstd450SmoothStep;
builder.promoteScalar(precision, operands[0], operands[2]);
builder.promoteScalar(precision, operands[1], operands[2]);
break;
case glslang::EOpDistance:
......
......@@ -12,7 +12,7 @@ ERROR: 7 compilation errors. No code generated.
Shader version: 410
invocations = 0
invocations = -1
max_vertices = -1
input primitive = none
output primitive = none
......@@ -65,7 +65,7 @@ ERROR: Linking geometry stage: At least one shader must specify an output layout
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
Shader version: 410
invocations = 0
invocations = 1
max_vertices = -1
input primitive = none
output primitive = none
......
......@@ -10,7 +10,7 @@ ERROR: 6 compilation errors. No code generated.
Shader version: 420
invocations = 0
invocations = -1
max_vertices = -1
input primitive = triangles
output primitive = none
......@@ -137,7 +137,7 @@ ERROR: Linking geometry stage: At least one shader must specify an output layout
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
Shader version: 420
invocations = 0
invocations = 1
max_vertices = -1
input primitive = triangles
output primitive = none
......
......@@ -5,7 +5,7 @@ ERROR: 1 compilation errors. No code generated.
Shader version: 420
invocations = 0
invocations = -1
max_vertices = -1
input primitive = triangles
output primitive = none
......@@ -44,7 +44,7 @@ ERROR: Linking geometry stage: At least one shader must specify an output layout
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
Shader version: 420
invocations = 0
invocations = 1
max_vertices = -1
input primitive = triangles
output primitive = none
......
......@@ -2,7 +2,7 @@
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Shader version: 450
invocations = 0
invocations = -1
max_vertices = -1
input primitive = none
output primitive = none
......@@ -40,7 +40,7 @@ ERROR: Linking geometry stage: At least one shader must specify an output layout
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
Shader version: 450
invocations = 0
invocations = 1
max_vertices = -1
input primitive = none
output primitive = none
......
......@@ -18,7 +18,7 @@ ERROR: 1 compilation errors. No code generated.
Shader version: 150
invocations = 0
invocations = -1
max_vertices = -1
input primitive = none
output primitive = points
......@@ -29,7 +29,7 @@ ERROR: node is still EOpNull!
noMain2.geom
Shader version: 150
invocations = 0
invocations = -1
max_vertices = -1
input primitive = none
output primitive = line_strip
......@@ -52,7 +52,7 @@ ERROR: Linking fragment stage: Multiple function bodies in multiple compilation
main(
Shader version: 150
invocations = 0
invocations = 1
max_vertices = -1
input primitive = none
output primitive = points
......
max_vertices_0.geom
Shader version: 330
invocations = 0
invocations = -1
max_vertices = 0
input primitive = points
output primitive = triangle_strip
......@@ -19,7 +19,7 @@ Linked geometry stage:
Shader version: 330
invocations = 0
invocations = 1
max_vertices = 0
input primitive = points
output primitive = triangle_strip
......
......@@ -12,7 +12,7 @@ Linked geometry stage:
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 18 70 10 29 33
ExecutionMode 4 InputTrianglesAdjacency
ExecutionMode 4 Invocations 0
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip
ExecutionMode 4 OutputVertices 30
Source GLSL 150
......
......@@ -12,7 +12,7 @@ Linked geometry stage:
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 20 13
ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 0
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip
ExecutionMode 4 OutputVertices 3
Source GLSL 330
......
......@@ -163,7 +163,7 @@ Linked fragment stage:
7: Label
16: 13 Load 15(u2drs)
17: 9(fvec4) Load 11(outp)
26: 8(float) CompositeExtract 17 3
26: 8(float) CompositeExtract 17 2
27: 8(float) ImageSampleProjDrefExplicitLod 16 17 26 Grad ConstOffset 20 20 25
31: 30(ptr) AccessChain 11(outp) 29
32: 8(float) Load 31
......
......@@ -7,7 +7,7 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 55
// Id's are bound by 56
Capability Shader
1: ExtInstImport "GLSL.std.450"
......@@ -82,7 +82,8 @@ Linked fragment stage:
51: 6(float) Load 50(blend)
52: 6(float) Load 8(blendscale)
53: 6(float) FMul 51 52
54: 10(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 45 48 53
Store 44(gl_FragColor) 54
54: 10(fvec4) CompositeConstruct 53 53 53 53
55: 10(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 45 48 54
Store 44(gl_FragColor) 55
Return
FunctionEnd
......@@ -8,12 +8,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 290
// Id's are bound by 291
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 289 47
EntryPoint Fragment 4 "main" 290 47
ExecutionMode 4 OriginLowerLeft
Source GLSL 130
Name 4 "main"
......@@ -39,8 +39,8 @@ Linked fragment stage:
Name 276 "gl_FragColor"
Name 279 "u"
Name 282 "blend"
Name 288 "scale"
Name 289 "t"
Name 289 "scale"
Name 290 "t"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
......@@ -103,9 +103,9 @@ Linked fragment stage:
279(u): 278(ptr) Variable UniformConstant
281: TypePointer UniformConstant 6(float)
282(blend): 281(ptr) Variable UniformConstant
287: TypePointer UniformConstant 45(fvec2)
288(scale): 287(ptr) Variable UniformConstant
289(t): 46(ptr) Variable Input
288: TypePointer UniformConstant 45(fvec2)
289(scale): 288(ptr) Variable UniformConstant
290(t): 46(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(blendscale): 7(ptr) Variable Function
......@@ -268,7 +268,7 @@ Linked fragment stage:
Store 26(color) 173
174: 137 Load 139(shadowSampler1D)
175: 22(fvec4) Load 24(coords4D)
176: 6(float) CompositeExtract 175 3
176: 6(float) CompositeExtract 175 2
177: 6(float) ImageSampleProjDrefImplicitLod 174 175 176
178: 22(fvec4) Load 26(color)
179: 22(fvec4) CompositeConstruct 177 177 177 177
......@@ -277,7 +277,7 @@ Linked fragment stage:
181: 137 Load 139(shadowSampler1D)
182: 22(fvec4) Load 24(coords4D)
183: 6(float) Load 10(bias)
184: 6(float) CompositeExtract 182 3
184: 6(float) CompositeExtract 182 2
185: 6(float) ImageSampleProjDrefImplicitLod 181 182 184 Bias 183
186: 22(fvec4) Load 26(color)
187: 22(fvec4) CompositeConstruct 185 185 185 185
......@@ -285,7 +285,7 @@ Linked fragment stage:
Store 26(color) 188
189: 156 Load 158(shadowSampler2D)
190: 22(fvec4) Load 24(coords4D)
191: 6(float) CompositeExtract 190 3
191: 6(float) CompositeExtract 190 2
192: 6(float) ImageSampleProjDrefImplicitLod 189 190 191
193: 22(fvec4) Load 26(color)
194: 22(fvec4) CompositeConstruct 192 192 192 192
......@@ -294,7 +294,7 @@ Linked fragment stage:
196: 156 Load 158(shadowSampler2D)
197: 22(fvec4) Load 24(coords4D)
198: 6(float) Load 10(bias)
199: 6(float) CompositeExtract 197 3
199: 6(float) CompositeExtract 197 2
200: 6(float) ImageSampleProjDrefImplicitLod 196 197 199 Bias 198
201: 22(fvec4) Load 26(color)
202: 22(fvec4) CompositeConstruct 200 200 200 200
......@@ -370,7 +370,8 @@ Linked fragment stage:
283: 6(float) Load 282(blend)
284: 6(float) Load 8(blendscale)
285: 6(float) FMul 283 284
286: 22(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 277 280 285
Store 276(gl_FragColor) 286
286: 22(fvec4) CompositeConstruct 285 285 285 285
287: 22(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 277 280 286
Store 276(gl_FragColor) 287
Return
FunctionEnd
......@@ -174,7 +174,7 @@ Linked vertex stage:
123: 100 Load 102(shadowSampler1D)
124: 18(fvec4) Load 20(coords4D)
125: 6(float) Load 8(lod)
126: 6(float) CompositeExtract 124 3
126: 6(float) CompositeExtract 124 2
127: 6(float) ImageSampleProjDrefExplicitLod 123 124 126 Lod 125
128: 18(fvec4) Load 23(color)
129: 18(fvec4) CompositeConstruct 127 127 127 127
......@@ -183,7 +183,7 @@ Linked vertex stage:
131: 112 Load 114(shadowSampler2D)
132: 18(fvec4) Load 20(coords4D)
133: 6(float) Load 8(lod)
134: 6(float) CompositeExtract 132 3
134: 6(float) CompositeExtract 132 2
135: 6(float) ImageSampleProjDrefExplicitLod 131 132 134 Lod 133
136: 18(fvec4) Load 23(color)
137: 18(fvec4) CompositeConstruct 135 135 135 135
......
......@@ -775,7 +775,7 @@ struct TShaderQualifiers {
TLayoutGeometry geometry; // geometry/tessellation shader in/out primitives
bool pixelCenterInteger; // fragment shader
bool originUpperLeft; // fragment shader
int invocations; // 0 means no declaration
int invocations;
int vertices; // both for tessellation "vertices" and geometry "max_vertices"
TVertexSpacing spacing;
TVertexOrder order;
......@@ -790,7 +790,7 @@ struct TShaderQualifiers {
geometry = ElgNone;
originUpperLeft = false;
pixelCenterInteger = false;
invocations = 0; // 0 means no declaration
invocations = TQualifier::layoutNotSet;
vertices = TQualifier::layoutNotSet;
spacing = EvsNone;
order = EvoNone;
......@@ -813,7 +813,7 @@ struct TShaderQualifiers {
pixelCenterInteger = src.pixelCenterInteger;
if (src.originUpperLeft)
originUpperLeft = src.originUpperLeft;
if (src.invocations != 0)
if (src.invocations != TQualifier::layoutNotSet)
invocations = src.invocations;
if (src.vertices != TQualifier::layoutNotSet)
vertices = src.vertices;
......
......@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "SPIRV99.841"
#define GLSLANG_DATE "12-Dec-2015"
#define GLSLANG_REVISION "SPIRV99.845"
#define GLSLANG_DATE "13-Dec-2015"
......@@ -3889,7 +3889,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
case EShLangGeometry:
if (id == "invocations") {
profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, nullptr, "invocations");
publicType.shaderQualifiers.invocations = value;
if (value == 0)
error(loc, "must be at least 1", "invocations", "");
else
publicType.shaderQualifiers.invocations = value;
return;
}
if (id == "max_vertices") {
......@@ -4276,7 +4279,7 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
if (shaderQualifiers.geometry != ElgNone)
error(loc, message, TQualifier::getGeometryString(shaderQualifiers.geometry), "");
if (shaderQualifiers.invocations > 0)
if (shaderQualifiers.invocations != TQualifier::layoutNotSet)
error(loc, message, "invocations", "");
if (shaderQualifiers.vertices != TQualifier::layoutNotSet) {
if (language == EShLangGeometry)
......@@ -5453,7 +5456,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
if (language == EShLangTessControl)
checkIoArraysConsistency(loc);
}
if (publicType.shaderQualifiers.invocations) {
if (publicType.shaderQualifiers.invocations != TQualifier::layoutNotSet) {
if (publicType.qualifier.storage != EvqVaryingIn)
error(loc, "can only apply to 'in'", "invocations", "");
if (! intermediate.setInvocations(publicType.shaderQualifiers.invocations))
......
......@@ -386,7 +386,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
correct = false;
infoSink.info.message(EPrefixError, "#version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above");
version = profile == EEsProfile ? 310 : 430; // 420 supports the extension, correction is to 430 which does not
profile = ECoreProfile;
}
break;
default:
......
......@@ -359,6 +359,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink)
// overlap/alias/missing I/O, etc.
inOutLocationCheck(infoSink);
// invocations
if (invocations == TQualifier::layoutNotSet)
invocations = 1;
if (inIoAccessed("gl_ClipDistance") && inIoAccessed("gl_ClipVertex"))
error(infoSink, "Can only use one of gl_ClipDistance or gl_ClipVertex (gl_ClipDistance is preferred)");
......@@ -561,7 +565,7 @@ void TIntermediate::inOutLocationCheck(TInfoSink& infoSink)
if (profile == EEsProfile) {
if (numFragOut > 1 && fragOutWithNoLocation)
error(infoSink, "when more than one fragment shader output, all must have location qualifiers");
}
}
}
TIntermSequence& TIntermediate::findLinkerObjects() const
......
......@@ -126,7 +126,8 @@ class TIntermediate {
public:
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), treeRoot(0), profile(p), version(v), spv(0),
numMains(0), numErrors(0), recursive(false),
invocations(0), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false),
invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone),
pixelCenterInteger(false), originUpperLeft(false),
vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), depthLayout(EldNone), depthReplacing(false), blendEquations(0), xfbMode(false)
{
localSize[0] = 1;
......@@ -204,7 +205,7 @@ public:
bool setInvocations(int i)
{
if (invocations > 0)
if (invocations != TQualifier::layoutNotSet)
return invocations == i;
invocations = i;
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment