Commit 237b6c51 by John Kessenich

Merge branch 'master' from GitHub into GitLab master

parents 32894b28 e00e72de
...@@ -5,7 +5,6 @@ set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix") ...@@ -5,7 +5,6 @@ set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix")
project(glslang) project(glslang)
if(WIN32) if(WIN32)
set(CMAKE_GENERATOR_TOOLSET "v110" CACHE STRING "Platform Toolset" FORCE)
include(ChooseMSVCCRT.cmake) include(ChooseMSVCCRT.cmake)
add_definitions(-DGLSLANG_OSINCLUDE_WIN32) add_definitions(-DGLSLANG_OSINCLUDE_WIN32)
elseif(UNIX) elseif(UNIX)
......
...@@ -599,9 +599,11 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) ...@@ -599,9 +599,11 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
builder.setAccessChainLValue(id); builder.setAccessChainLValue(id);
} else { } else {
// finish off the entry-point SPV instruction by adding the Input/Output <id> // finish off the entry-point SPV instruction by adding the Input/Output <id>
spv::StorageClass sc = builder.getStorageClass(id); if (builder.isPointer(id)) {
if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput) spv::StorageClass sc = builder.getStorageClass(id);
entryPoint->addIdOperand(id); if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput)
entryPoint->addIdOperand(id);
}
} }
} }
...@@ -822,7 +824,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI ...@@ -822,7 +824,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
if (node->getOp() == glslang::EOpAtomicCounterIncrement || if (node->getOp() == glslang::EOpAtomicCounterIncrement ||
node->getOp() == glslang::EOpAtomicCounterDecrement || node->getOp() == glslang::EOpAtomicCounterDecrement ||
node->getOp() == glslang::EOpAtomicCounter) node->getOp() == glslang::EOpAtomicCounter ||
node->getOp() == glslang::EOpInterpolateAtCentroid)
operand = builder.accessChainGetLValue(); // Special case l-value operands operand = builder.accessChainGetLValue(); // Special case l-value operands
else else
operand = builder.accessChainLoad(convertGlslangToSpvType(node->getOperand()->getType())); operand = builder.accessChainLoad(convertGlslangToSpvType(node->getOperand()->getType()));
...@@ -1174,6 +1177,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt ...@@ -1174,6 +1177,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
if (arg == 1) if (arg == 1)
lvalue = true; lvalue = true;
break; break;
case glslang::EOpInterpolateAtSample:
case glslang::EOpInterpolateAtOffset:
if (arg == 0)
lvalue = true;
break;
case glslang::EOpAtomicAdd: case glslang::EOpAtomicAdd:
case glslang::EOpAtomicMin: case glslang::EOpAtomicMin:
case glslang::EOpAtomicMax: case glslang::EOpAtomicMax:
...@@ -1849,6 +1857,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -1849,6 +1857,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
// Check for queries // Check for queries
if (cracked.query) { if (cracked.query) {
// a sampled image needs to have the image extracted first
if (builder.isSampledImage(params.sampler))
params.sampler = builder.createUnaryOp(spv::OpImage, builder.getImageType(params.sampler), params.sampler);
switch (node->getOp()) { switch (node->getOp()) {
case glslang::EOpImageQuerySize: case glslang::EOpImageQuerySize:
case glslang::EOpTextureQuerySize: case glslang::EOpTextureQuerySize:
...@@ -2508,7 +2519,9 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: ...@@ -2508,7 +2519,9 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
case glslang::EOpFwidthCoarse: case glslang::EOpFwidthCoarse:
unaryOp = spv::OpFwidthCoarse; unaryOp = spv::OpFwidthCoarse;
break; break;
case glslang::EOpInterpolateAtCentroid:
libCall = spv::GLSLstd450InterpolateAtCentroid;
break;
case glslang::EOpAny: case glslang::EOpAny:
unaryOp = spv::OpAny; unaryOp = spv::OpAny;
break; break;
...@@ -2840,7 +2853,12 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: ...@@ -2840,7 +2853,12 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
case glslang::EOpRefract: case glslang::EOpRefract:
libCall = spv::GLSLstd450Refract; libCall = spv::GLSLstd450Refract;
break; break;
case glslang::EOpInterpolateAtSample:
libCall = spv::GLSLstd450InterpolateAtSample;
break;
case glslang::EOpInterpolateAtOffset:
libCall = spv::GLSLstd450InterpolateAtOffset;
break;
case glslang::EOpAddCarry: case glslang::EOpAddCarry:
opCode = spv::OpIAddCarry; opCode = spv::OpIAddCarry;
typeId = builder.makeStructResultType(typeId0, typeId0); typeId = builder.makeStructResultType(typeId0, typeId0);
......
...@@ -122,23 +122,24 @@ public: ...@@ -122,23 +122,24 @@ public:
Id getContainedTypeId(Id typeId, int) const; Id getContainedTypeId(Id typeId, int) const;
StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); } StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); }
bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); } bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); } bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
bool isVector(Id resultId) const { return isVectorType(getTypeId(resultId)); } bool isVector(Id resultId) const { return isVectorType(getTypeId(resultId)); }
bool isMatrix(Id resultId) const { return isMatrixType(getTypeId(resultId)); } bool isMatrix(Id resultId) const { return isMatrixType(getTypeId(resultId)); }
bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); } bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); }
bool isBoolType(Id typeId) const { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); } bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); }
bool isPointerType(Id typeId) const { return getTypeClass(typeId) == OpTypePointer; } bool isBoolType(Id typeId) const { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
bool isScalarType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat || getTypeClass(typeId) == OpTypeInt || getTypeClass(typeId) == OpTypeBool; } bool isPointerType(Id typeId) const { return getTypeClass(typeId) == OpTypePointer; }
bool isVectorType(Id typeId) const { return getTypeClass(typeId) == OpTypeVector; } bool isScalarType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat || getTypeClass(typeId) == OpTypeInt || getTypeClass(typeId) == OpTypeBool; }
bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; } bool isVectorType(Id typeId) const { return getTypeClass(typeId) == OpTypeVector; }
bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; } bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; }
bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; } bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; }
bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId); } bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; }
bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; } bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId); }
bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; } bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; } bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; }
bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; }
bool isConstantOpCode(Op opcode) const; bool isConstantOpCode(Op opcode) const;
bool isConstant(Id resultId) const { return isConstantOpCode(getOpCode(resultId)); } bool isConstant(Id resultId) const { return isConstantOpCode(getOpCode(resultId)); }
......
...@@ -293,7 +293,12 @@ public: ...@@ -293,7 +293,12 @@ public:
Instruction* getInstruction(Id id) const { return idToInstruction[id]; } Instruction* getInstruction(Id id) const { return idToInstruction[id]; }
spv::Id getTypeId(Id resultId) const { return idToInstruction[resultId]->getTypeId(); } spv::Id getTypeId(Id resultId) const { return idToInstruction[resultId]->getTypeId(); }
StorageClass getStorageClass(Id typeId) const { return (StorageClass)idToInstruction[typeId]->getImmediateOperand(0); } StorageClass getStorageClass(Id typeId) const
{
assert(idToInstruction[typeId]->getOpCode() == spv::OpTypePointer);
return (StorageClass)idToInstruction[typeId]->getImmediateOperand(0);
}
void dump(std::vector<unsigned int>& out) const void dump(std::vector<unsigned int>& out) const
{ {
for (int f = 0; f < (int)functions.size(); ++f) for (int f = 0; f < (int)functions.size(); ++f)
......
...@@ -5,7 +5,7 @@ Linked fragment stage: ...@@ -5,7 +5,7 @@ Linked fragment stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 97 // Id's are bound by 99
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
...@@ -22,41 +22,41 @@ Linked fragment stage: ...@@ -22,41 +22,41 @@ Linked fragment stage:
Name 33 "gl_ClipDistance" Name 33 "gl_ClipDistance"
Name 43 "k" Name 43 "k"
Name 55 "sampR" Name 55 "sampR"
Name 62 "sampB" Name 63 "sampB"
Name 84 "samp2Da" Name 86 "samp2Da"
Name 88 "bn" Name 90 "bn"
MemberName 88(bn) 0 "matra" MemberName 90(bn) 0 "matra"
MemberName 88(bn) 1 "matca" MemberName 90(bn) 1 "matca"
MemberName 88(bn) 2 "matr" MemberName 90(bn) 2 "matr"
MemberName 88(bn) 3 "matc" MemberName 90(bn) 3 "matc"
MemberName 88(bn) 4 "matrdef" MemberName 90(bn) 4 "matrdef"
Name 90 "" Name 92 ""
Name 93 "bi" Name 95 "bi"
MemberName 93(bi) 0 "v" MemberName 95(bi) 0 "v"
Name 96 "bname" Name 98 "bname"
Decorate 16(gl_FrontFacing) BuiltIn FrontFacing Decorate 16(gl_FrontFacing) BuiltIn FrontFacing
Decorate 33(gl_ClipDistance) BuiltIn ClipDistance Decorate 33(gl_ClipDistance) BuiltIn ClipDistance
Decorate 87 ArrayStride 64 Decorate 89 ArrayStride 64
Decorate 87 ArrayStride 64 Decorate 89 ArrayStride 64
MemberDecorate 88(bn) 0 RowMajor MemberDecorate 90(bn) 0 RowMajor
MemberDecorate 88(bn) 0 Offset 0 MemberDecorate 90(bn) 0 Offset 0
MemberDecorate 88(bn) 0 MatrixStride 16 MemberDecorate 90(bn) 0 MatrixStride 16
MemberDecorate 88(bn) 1 ColMajor MemberDecorate 90(bn) 1 ColMajor
MemberDecorate 88(bn) 1 Offset 256 MemberDecorate 90(bn) 1 Offset 256
MemberDecorate 88(bn) 1 MatrixStride 16 MemberDecorate 90(bn) 1 MatrixStride 16
MemberDecorate 88(bn) 2 RowMajor MemberDecorate 90(bn) 2 RowMajor
MemberDecorate 88(bn) 2 Offset 512 MemberDecorate 90(bn) 2 Offset 512
MemberDecorate 88(bn) 2 MatrixStride 16 MemberDecorate 90(bn) 2 MatrixStride 16
MemberDecorate 88(bn) 3 ColMajor MemberDecorate 90(bn) 3 ColMajor
MemberDecorate 88(bn) 3 Offset 576 MemberDecorate 90(bn) 3 Offset 576
MemberDecorate 88(bn) 3 MatrixStride 16 MemberDecorate 90(bn) 3 MatrixStride 16
MemberDecorate 88(bn) 4 RowMajor MemberDecorate 90(bn) 4 RowMajor
MemberDecorate 88(bn) 4 Offset 640 MemberDecorate 90(bn) 4 Offset 640
MemberDecorate 88(bn) 4 MatrixStride 16 MemberDecorate 90(bn) 4 MatrixStride 16
Decorate 88(bn) Block Decorate 90(bn) Block
Decorate 92 ArrayStride 16 Decorate 94 ArrayStride 16
MemberDecorate 93(bi) 0 Offset 0 MemberDecorate 95(bi) 0 Offset 0
Decorate 93(bi) Block Decorate 95(bi) Block
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -92,31 +92,31 @@ Linked fragment stage: ...@@ -92,31 +92,31 @@ Linked fragment stage:
53: TypeSampledImage 52 53: TypeSampledImage 52
54: TypePointer UniformConstant 53 54: TypePointer UniformConstant 53
55(sampR): 54(ptr) Variable UniformConstant 55(sampR): 54(ptr) Variable UniformConstant
57: TypeVector 34(int) 2 58: TypeVector 34(int) 2
59: TypeImage 34(int) Buffer sampled format:Unknown 60: TypeImage 34(int) Buffer sampled format:Unknown
60: TypeSampledImage 59 61: TypeSampledImage 60
61: TypePointer UniformConstant 60 62: TypePointer UniformConstant 61
62(sampB): 61(ptr) Variable UniformConstant 63(sampB): 62(ptr) Variable UniformConstant
67: TypeVector 6(float) 2 69: TypeVector 6(float) 2
70: 6(float) Constant 1120403456 72: 6(float) Constant 1120403456
72: 29(int) Constant 3 74: 29(int) Constant 3
80: TypeImage 6(float) 2D sampled format:Unknown 82: TypeImage 6(float) 2D sampled format:Unknown
81: TypeSampledImage 80 83: TypeSampledImage 82
82: TypeArray 81 72 84: TypeArray 83 74
83: TypePointer UniformConstant 82 85: TypePointer UniformConstant 84
84(samp2Da): 83(ptr) Variable UniformConstant 86(samp2Da): 85(ptr) Variable UniformConstant
85: TypeMatrix 26(fvec4) 4 87: TypeMatrix 26(fvec4) 4
86: 29(int) Constant 4 88: 29(int) Constant 4
87: TypeArray 85 86 89: TypeArray 87 88
88(bn): TypeStruct 87 87 85 85 85 90(bn): TypeStruct 89 89 87 87 87
89: TypePointer Uniform 88(bn) 91: TypePointer Uniform 90(bn)
90: 89(ptr) Variable Uniform 92: 91(ptr) Variable Uniform
91: TypeVector 6(float) 3 93: TypeVector 6(float) 3
92: TypeArray 91(fvec3) 50 94: TypeArray 93(fvec3) 50
93(bi): TypeStruct 92 95(bi): TypeStruct 94
94: TypeArray 93(bi) 86 96: TypeArray 95(bi) 88
95: TypePointer Uniform 94 97: TypePointer Uniform 96
96(bname): 95(ptr) Variable Uniform 98(bname): 97(ptr) Variable Uniform
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
13: 12(ptr) Variable Function 13: 12(ptr) Variable Function
...@@ -145,25 +145,27 @@ Linked fragment stage: ...@@ -145,25 +145,27 @@ Linked fragment stage:
51: 40(ptr) AccessChain 28(o) 50 51: 40(ptr) AccessChain 28(o) 50
Store 51 49 Store 51 49
56: 53 Load 55(sampR) 56: 53 Load 55(sampR)
58: 57(ivec2) ImageQuerySize 56 57: 52 Image 56
63: 60 Load 62(sampB) 59: 58(ivec2) ImageQuerySize 57
64: 34(int) ImageQuerySize 63 64: 61 Load 63(sampB)
65: 57(ivec2) CompositeConstruct 64 64 65: 60 Image 64
66: 57(ivec2) IAdd 58 65 66: 34(int) ImageQuerySize 65
68: 67(fvec2) ConvertSToF 66 67: 58(ivec2) CompositeConstruct 66 66
69: 6(float) CompositeExtract 68 0 68: 58(ivec2) IAdd 59 67
71: 6(float) FDiv 69 70 70: 69(fvec2) ConvertSToF 68
73: 40(ptr) AccessChain 28(o) 72 71: 6(float) CompositeExtract 70 0
Store 73 71 73: 6(float) FDiv 71 72
74: 6(float) FunctionCall 8(foo() 75: 40(ptr) AccessChain 28(o) 74
75: 40(ptr) AccessChain 28(o) 50 Store 75 73
Store 75 74 76: 6(float) FunctionCall 8(foo()
77: 40(ptr) AccessChain 28(o) 50
Store 77 76
Return Return
FunctionEnd FunctionEnd
8(foo(): 6(float) Function None 7 8(foo(): 6(float) Function None 7
9: Label 9: Label
76: 6(float) Load 11(i1) 78: 6(float) Load 11(i1)
77: 6(float) Load 24(i2) 79: 6(float) Load 24(i2)
78: 6(float) FAdd 76 77 80: 6(float) FAdd 78 79
ReturnValue 78 ReturnValue 80
FunctionEnd FunctionEnd
spv.bool.vert
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 49
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 23 47 48
Source GLSL 450
Name 4 "main"
Name 10 "foo(b1;"
Name 9 "b"
Name 21 "gl_PerVertex"
MemberName 21(gl_PerVertex) 0 "gl_Position"
MemberName 21(gl_PerVertex) 1 "gl_PointSize"
MemberName 21(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 21(gl_PerVertex) 3 "gl_CullDistance"
Name 23 ""
Name 28 "ubname"
MemberName 28(ubname) 0 "b"
Name 30 "ubinst"
Name 31 "param"
Name 47 "gl_VertexID"
Name 48 "gl_InstanceID"
MemberDecorate 21(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 21(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 21(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 21(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 21(gl_PerVertex) Block
Decorate 28(ubname) GLSLShared
Decorate 28(ubname) Block
Decorate 47(gl_VertexID) BuiltIn VertexId
Decorate 48(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeBool
7: TypePointer Function 6(bool)
8: TypeFunction 6(bool) 7(ptr)
13: 6(bool) ConstantFalse
16: TypeFloat 32
17: TypeVector 16(float) 4
18: TypeInt 32 0
19: 18(int) Constant 1
20: TypeArray 16(float) 19
21(gl_PerVertex): TypeStruct 17(fvec4) 16(float) 20 20
22: TypePointer Output 21(gl_PerVertex)
23: 22(ptr) Variable Output
24: TypeInt 32 1
25: 24(int) Constant 0
26: TypePointer Function 17(fvec4)
28(ubname): TypeStruct 6(bool)
29: TypePointer Uniform 28(ubname)
30(ubinst): 29(ptr) Variable Uniform
32: TypePointer Uniform 6(bool)
38: 16(float) Constant 0
39: 17(fvec4) ConstantComposite 38 38 38 38
41: 16(float) Constant 1065353216
42: 17(fvec4) ConstantComposite 41 41 41 41
44: TypePointer Output 17(fvec4)
46: TypePointer Input 24(int)
47(gl_VertexID): 46(ptr) Variable Input
48(gl_InstanceID): 46(ptr) Variable Input
4(main): 2 Function None 3
5: Label
27: 26(ptr) Variable Function
31(param): 7(ptr) Variable Function
33: 32(ptr) AccessChain 30(ubinst) 25
34: 6(bool) Load 33
Store 31(param) 34
35: 6(bool) FunctionCall 10(foo(b1;) 31(param)
SelectionMerge 37 None
BranchConditional 35 36 40
36: Label
Store 27 39
Branch 37
40: Label
Store 27 42
Branch 37
37: Label
43: 17(fvec4) Load 27
45: 44(ptr) AccessChain 23 25
Store 45 43
Return
FunctionEnd
10(foo(b1;): 6(bool) Function None 8
9(b): 7(ptr) FunctionParameter
11: Label
12: 6(bool) Load 9(b)
14: 6(bool) INotEqual 12 13
ReturnValue 14
FunctionEnd
spv.interpOps.frag
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 101
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 13 24 33 41 99
ExecutionMode 4 OriginLowerLeft
Source GLSL 450
Name 4 "main"
Name 9 "f4"
Name 13 "if1"
Name 24 "if2"
Name 33 "if3"
Name 41 "if4"
Name 47 "samp"
Name 73 "offset"
Name 99 "fragColor"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: 6(float) Constant 0
11: 7(fvec4) ConstantComposite 10 10 10 10
12: TypePointer Input 6(float)
13(if1): 12(ptr) Variable Input
15: TypeInt 32 0
16: 15(int) Constant 0
17: TypePointer Function 6(float)
22: TypeVector 6(float) 2
23: TypePointer Input 22(fvec2)
24(if2): 23(ptr) Variable Input
31: TypeVector 6(float) 3
32: TypePointer Input 31(fvec3)
33(if3): 32(ptr) Variable Input
40: TypePointer Input 7(fvec4)
41(if4): 40(ptr) Variable Input
45: TypeInt 32 1
46: TypePointer UniformConstant 45(int)
47(samp): 46(ptr) Variable UniformConstant
72: TypePointer UniformConstant 22(fvec2)
73(offset): 72(ptr) Variable UniformConstant
98: TypePointer Output 7(fvec4)
99(fragColor): 98(ptr) Variable Output
4(main): 2 Function None 3
5: Label
9(f4): 8(ptr) Variable Function
Store 9(f4) 11
14: 6(float) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 13(if1)
18: 17(ptr) AccessChain 9(f4) 16
19: 6(float) Load 18
20: 6(float) FAdd 19 14
21: 17(ptr) AccessChain 9(f4) 16
Store 21 20
25: 22(fvec2) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 24(if2)
26: 7(fvec4) Load 9(f4)
27: 22(fvec2) VectorShuffle 26 26 0 1
28: 22(fvec2) FAdd 27 25
29: 7(fvec4) Load 9(f4)
30: 7(fvec4) VectorShuffle 29 28 4 5 2 3
Store 9(f4) 30
34: 31(fvec3) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 33(if3)
35: 7(fvec4) Load 9(f4)
36: 31(fvec3) VectorShuffle 35 35 0 1 2
37: 31(fvec3) FAdd 36 34
38: 7(fvec4) Load 9(f4)
39: 7(fvec4) VectorShuffle 38 37 4 5 6 3
Store 9(f4) 39
42: 7(fvec4) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 41(if4)
43: 7(fvec4) Load 9(f4)
44: 7(fvec4) FAdd 43 42
Store 9(f4) 44
48: 45(int) Load 47(samp)
49: 6(float) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 13(if1) 48
50: 17(ptr) AccessChain 9(f4) 16
51: 6(float) Load 50
52: 6(float) FAdd 51 49
53: 17(ptr) AccessChain 9(f4) 16
Store 53 52
54: 45(int) Load 47(samp)
55: 22(fvec2) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 24(if2) 54
56: 7(fvec4) Load 9(f4)
57: 22(fvec2) VectorShuffle 56 56 0 1
58: 22(fvec2) FAdd 57 55
59: 7(fvec4) Load 9(f4)
60: 7(fvec4) VectorShuffle 59 58 4 5 2 3
Store 9(f4) 60
61: 45(int) Load 47(samp)
62: 31(fvec3) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 33(if3) 61
63: 7(fvec4) Load 9(f4)
64: 31(fvec3) VectorShuffle 63 63 0 1 2
65: 31(fvec3) FAdd 64 62
66: 7(fvec4) Load 9(f4)
67: 7(fvec4) VectorShuffle 66 65 4 5 6 3
Store 9(f4) 67
68: 45(int) Load 47(samp)
69: 7(fvec4) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 41(if4) 68
70: 7(fvec4) Load 9(f4)
71: 7(fvec4) FAdd 70 69
Store 9(f4) 71
74: 22(fvec2) Load 73(offset)
75: 6(float) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 13(if1) 74
76: 17(ptr) AccessChain 9(f4) 16
77: 6(float) Load 76
78: 6(float) FAdd 77 75
79: 17(ptr) AccessChain 9(f4) 16
Store 79 78
80: 22(fvec2) Load 73(offset)
81: 22(fvec2) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 24(if2) 80
82: 7(fvec4) Load 9(f4)
83: 22(fvec2) VectorShuffle 82 82 0 1
84: 22(fvec2) FAdd 83 81
85: 7(fvec4) Load 9(f4)
86: 7(fvec4) VectorShuffle 85 84 4 5 2 3
Store 9(f4) 86
87: 22(fvec2) Load 73(offset)
88: 31(fvec3) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 33(if3) 87
89: 7(fvec4) Load 9(f4)
90: 31(fvec3) VectorShuffle 89 89 0 1 2
91: 31(fvec3) FAdd 90 88
92: 7(fvec4) Load 9(f4)
93: 7(fvec4) VectorShuffle 92 91 4 5 6 3
Store 9(f4) 93
94: 22(fvec2) Load 73(offset)
95: 7(fvec4) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 41(if4) 94
96: 7(fvec4) Load 9(f4)
97: 7(fvec4) FAdd 96 95
Store 9(f4) 97
100: 7(fvec4) Load 9(f4)
Store 99(fragColor) 100
Return
FunctionEnd
...@@ -7,12 +7,12 @@ Linked fragment stage: ...@@ -7,12 +7,12 @@ Linked fragment stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 277 // Id's are bound by 278
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 29 17 55 26 84 91 81 276 246 EntryPoint Fragment 4 "main" 29 17 55 26 84 91 81 277 247
ExecutionMode 4 OriginLowerLeft ExecutionMode 4 OriginLowerLeft
Source GLSL 430 Source GLSL 430
Name 4 "main" Name 4 "main"
...@@ -39,17 +39,17 @@ Linked fragment stage: ...@@ -39,17 +39,17 @@ Linked fragment stage:
Name 227 "is2DArray" Name 227 "is2DArray"
Name 237 "iv2" Name 237 "iv2"
Name 241 "sCubeShadow" Name 241 "sCubeShadow"
Name 246 "FragData" Name 247 "FragData"
Name 258 "is2Dms" Name 259 "is2Dms"
Name 262 "us2D" Name 263 "us2D"
Name 266 "us3D" Name 267 "us3D"
Name 270 "usCube" Name 271 "usCube"
Name 274 "us2DArray" Name 275 "us2DArray"
Name 276 "ic4D" Name 277 "ic4D"
Decorate 81(ic3D) Flat Decorate 81(ic3D) Flat
Decorate 84(ic1D) Flat Decorate 84(ic1D) Flat
Decorate 91(ic2D) Flat Decorate 91(ic2D) Flat
Decorate 276(ic4D) Flat Decorate 277(ic4D) Flat
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -140,31 +140,31 @@ Linked fragment stage: ...@@ -140,31 +140,31 @@ Linked fragment stage:
240: TypePointer UniformConstant 239 240: TypePointer UniformConstant 239
241(sCubeShadow): 240(ptr) Variable UniformConstant 241(sCubeShadow): 240(ptr) Variable UniformConstant
243: 67(int) Constant 2 243: 67(int) Constant 2
245: TypePointer Output 7(fvec4) 246: TypePointer Output 7(fvec4)
246(FragData): 245(ptr) Variable Output 247(FragData): 246(ptr) Variable Output
250: 6(float) Constant 0 251: 6(float) Constant 0
255: TypeImage 67(int) 2D multi-sampled sampled format:Unknown 256: TypeImage 67(int) 2D multi-sampled sampled format:Unknown
256: TypeSampledImage 255 257: TypeSampledImage 256
257: TypePointer UniformConstant 256 258: TypePointer UniformConstant 257
258(is2Dms): 257(ptr) Variable UniformConstant 259(is2Dms): 258(ptr) Variable UniformConstant
259: TypeImage 32(int) 2D sampled format:Unknown 260: TypeImage 32(int) 2D sampled format:Unknown
260: TypeSampledImage 259 261: TypeSampledImage 260
261: TypePointer UniformConstant 260 262: TypePointer UniformConstant 261
262(us2D): 261(ptr) Variable UniformConstant 263(us2D): 262(ptr) Variable UniformConstant
263: TypeImage 32(int) 3D sampled format:Unknown 264: TypeImage 32(int) 3D sampled format:Unknown
264: TypeSampledImage 263 265: TypeSampledImage 264
265: TypePointer UniformConstant 264 266: TypePointer UniformConstant 265
266(us3D): 265(ptr) Variable UniformConstant 267(us3D): 266(ptr) Variable UniformConstant
267: TypeImage 32(int) Cube sampled format:Unknown 268: TypeImage 32(int) Cube sampled format:Unknown
268: TypeSampledImage 267 269: TypeSampledImage 268
269: TypePointer UniformConstant 268 270: TypePointer UniformConstant 269
270(usCube): 269(ptr) Variable UniformConstant 271(usCube): 270(ptr) Variable UniformConstant
271: TypeImage 32(int) 2D array sampled format:Unknown 272: TypeImage 32(int) 2D array sampled format:Unknown
272: TypeSampledImage 271 273: TypeSampledImage 272
273: TypePointer UniformConstant 272 274: TypePointer UniformConstant 273
274(us2DArray): 273(ptr) Variable UniformConstant 275(us2DArray): 274(ptr) Variable UniformConstant
275: TypePointer Input 162(ivec4) 276: TypePointer Input 162(ivec4)
276(ic4D): 275(ptr) Variable Input 277(ic4D): 276(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
9(v): 8(ptr) Variable Function 9(v): 8(ptr) Variable Function
...@@ -345,15 +345,16 @@ Linked fragment stage: ...@@ -345,15 +345,16 @@ Linked fragment stage:
235: 7(fvec4) FAdd 234 233 235: 7(fvec4) FAdd 234 233
Store 9(v) 235 Store 9(v) 235
242: 239 Load 241(sCubeShadow) 242: 239 Load 241(sCubeShadow)
244: 68(ivec2) ImageQuerySizeLod 242 243 244: 238 Image 242
Store 237(iv2) 244 245: 68(ivec2) ImageQuerySizeLod 244 243
247: 7(fvec4) Load 9(v) Store 237(iv2) 245
248: 68(ivec2) Load 237(iv2) 248: 7(fvec4) Load 9(v)
249: 15(fvec2) ConvertSToF 248 249: 68(ivec2) Load 237(iv2)
251: 6(float) CompositeExtract 249 0 250: 15(fvec2) ConvertSToF 249
252: 6(float) CompositeExtract 249 1 252: 6(float) CompositeExtract 250 0
253: 7(fvec4) CompositeConstruct 251 252 250 250 253: 6(float) CompositeExtract 250 1
254: 7(fvec4) FAdd 247 253 254: 7(fvec4) CompositeConstruct 252 253 251 251
Store 246(FragData) 254 255: 7(fvec4) FAdd 248 254
Store 247(FragData) 255
Return Return
FunctionEnd FunctionEnd
#version 450
const bool condition = false;
uniform ubname {
bool b;
} ubinst;
bool foo(bool b)
{
return b != condition;
}
void main()
{
gl_Position = foo(ubinst.b) ? vec4(0.0) : vec4(1.0);
}
#version 450
in float if1;
in vec2 if2;
in vec3 if3;
in vec4 if4;
uniform int samp;
uniform vec2 offset;
out vec4 fragColor;
void main()
{
vec4 f4 = vec4(0.0);
f4.x += interpolateAtCentroid(if1);
f4.xy += interpolateAtCentroid(if2);
f4.xyz += interpolateAtCentroid(if3);
f4 += interpolateAtCentroid(if4);
f4.x += interpolateAtSample(if1, samp);
f4.xy += interpolateAtSample(if2, samp);
f4.xyz += interpolateAtSample(if3, samp);
f4 += interpolateAtSample(if4, samp);
f4.x += interpolateAtOffset(if1, offset);
f4.xy += interpolateAtOffset(if2, offset);
f4.xyz += interpolateAtOffset(if3, offset);
f4 += interpolateAtOffset(if4, offset);
fragColor = f4;
}
...@@ -30,6 +30,7 @@ spv.accessChain.frag ...@@ -30,6 +30,7 @@ spv.accessChain.frag
spv.aggOps.frag spv.aggOps.frag
spv.always-discard.frag spv.always-discard.frag
spv.always-discard2.frag spv.always-discard2.frag
spv.bool.vert
spv.conditionalDiscard.frag spv.conditionalDiscard.frag
spv.conversion.frag spv.conversion.frag
spv.dataOut.frag spv.dataOut.frag
...@@ -45,6 +46,7 @@ spv.forLoop.frag ...@@ -45,6 +46,7 @@ spv.forLoop.frag
spv.forwardFun.frag spv.forwardFun.frag
spv.functionCall.frag spv.functionCall.frag
spv.functionSemantics.frag spv.functionSemantics.frag
spv.interpOps.frag
spv.length.frag spv.length.frag
spv.localAggregates.frag spv.localAggregates.frag
spv.loops.frag spv.loops.frag
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // 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). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "SPIRV99.824" #define GLSLANG_REVISION "SPIRV99.831"
#define GLSLANG_DATE "06-Dec-2015" #define GLSLANG_DATE "08-Dec-2015"
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