Unverified Commit b03da6ed by John Kessenich Committed by GitHub

Merge pull request #1761 from KhronosGroup/SPIR-V_1.4

SPV 1.4: Add code generation for SPIR-V 1.4 features
parents 2dd4ab3a 08e01e79
......@@ -1306,11 +1306,13 @@ void Builder::makeDiscard()
}
// Comments in header
Id Builder::createVariable(StorageClass storageClass, Id type, const char* name)
Id Builder::createVariable(StorageClass storageClass, Id type, const char* name, Id initializer)
{
Id pointerType = makePointer(storageClass, type);
Instruction* inst = new Instruction(getUniqueId(), pointerType, OpVariable);
inst->addImmediateOperand(storageClass);
if (initializer != NoResult)
inst->addIdOperand(initializer);
switch (storageClass) {
case StorageClassFunction:
......@@ -1806,7 +1808,7 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, const
// Accept all parameters needed to create a texture instruction.
// Create the correct instruction based on the inputs, and make the call.
Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
bool noImplicitLod, const TextureParameters& parameters)
bool noImplicitLod, const TextureParameters& parameters, ImageOperandsMask signExtensionMask)
{
static const int maxTextureArgs = 10;
Id texArgs[maxTextureArgs] = {};
......@@ -1833,8 +1835,8 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
//
// Set up the optional arguments
//
int optArgNum = numArgs; // track which operand, if it exists, is the mask of optional arguments
++numArgs; // speculatively make room for the mask operand
int optArgNum = numArgs; // track which operand, if it exists, is the mask of optional arguments
++numArgs; // speculatively make room for the mask operand
ImageOperandsMask mask = ImageOperandsMaskNone; // the mask operand
if (parameters.bias) {
mask = (ImageOperandsMask)(mask | ImageOperandsBiasMask);
......@@ -1887,6 +1889,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
if (parameters.volatil) {
mask = mask | ImageOperandsVolatileTexelKHRMask;
}
mask = mask | signExtensionMask;
if (mask == ImageOperandsMaskNone)
--numArgs; // undo speculative reservation for the mask argument
else
......@@ -2649,12 +2652,19 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
if (constant) {
id = createCompositeExtract(accessChain.base, swizzleBase, indexes);
} else {
// make a new function variable for this r-value
Id lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable");
// store into it
createStore(accessChain.base, lValue);
Id lValue = NoResult;
if (spvVersion >= Spv_1_4) {
// make a new function variable for this r-value, using an initializer,
// and mark it as NonWritable so that downstream it can be detected as a lookup
// table
lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable",
accessChain.base);
addDecoration(lValue, DecorationNonWritable);
} else {
lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable");
// store into it
createStore(accessChain.base, lValue);
}
// move base to the new variable
accessChain.base = lValue;
accessChain.isRValue = false;
......@@ -2956,14 +2966,14 @@ void Builder::createSelectionMerge(Block* mergeBlock, unsigned int control)
}
void Builder::createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
unsigned int dependencyLength)
const std::vector<unsigned int>& operands)
{
Instruction* merge = new Instruction(OpLoopMerge);
merge->addIdOperand(mergeBlock->getId());
merge->addIdOperand(continueBlock->getId());
merge->addImmediateOperand(control);
if ((control & LoopControlDependencyLengthMask) != 0)
merge->addImmediateOperand(dependencyLength);
for (int op = 0; op < (int)operands.size(); ++op)
merge->addImmediateOperand(operands[op]);
buildPoint->addInstruction(std::unique_ptr<Instruction>(merge));
}
......
......@@ -61,6 +61,14 @@
namespace spv {
typedef enum {
Spv_1_0 = (1 << 16),
Spv_1_1 = (1 << 16) | (1 << 8),
Spv_1_2 = (1 << 16) | (2 << 8),
Spv_1_3 = (1 << 16) | (3 << 8),
Spv_1_4 = (1 << 16) | (4 << 8),
} SpvVersion;
class Builder {
public:
Builder(unsigned int spvVersion, unsigned int userNumber, SpvBuildLogger* logger);
......@@ -300,7 +308,7 @@ public:
void makeDiscard();
// Create a global or function local or IO variable.
Id createVariable(StorageClass, Id type, const char* name = 0);
Id createVariable(StorageClass, Id type, const char* name = 0, Id initializer = NoResult);
// Create an intermediate with an undefined value.
Id createUndefined(Id type);
......@@ -408,7 +416,8 @@ public:
};
// Select the correct texture operation based on all inputs, and emit the correct instruction
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, bool noImplicit, const TextureParameters&);
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
bool noImplicit, const TextureParameters&, ImageOperandsMask);
// Emit the OpTextureQuery* instruction that was passed in.
// Figure out the right return value and type, and return it.
......@@ -662,7 +671,7 @@ public:
void createBranch(Block* block);
void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, unsigned int dependencyLength);
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, const std::vector<unsigned int>& operands);
// Sets to generate opcode for specialization constants.
void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; }
......
......@@ -52,8 +52,21 @@ namespace glslang {
spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger)
{
switch (spvVersion.vulkan) {
case glslang::EShTargetVulkan_1_0: return spv_target_env::SPV_ENV_VULKAN_1_0;
case glslang::EShTargetVulkan_1_1: return spv_target_env::SPV_ENV_VULKAN_1_1;
case glslang::EShTargetVulkan_1_0:
return spv_target_env::SPV_ENV_VULKAN_1_0;
case glslang::EShTargetVulkan_1_1:
switch (spvVersion.spv) {
case EShTargetSpv_1_0:
case EShTargetSpv_1_1:
case EShTargetSpv_1_2:
case EShTargetSpv_1_3:
return spv_target_env::SPV_ENV_VULKAN_1_1;
case EShTargetSpv_1_4:
return spv_target_env::SPV_ENV_VULKAN_1_1_SPIRV_1_4;
default:
logger->missingFunctionality("Target version for SPIRV-Tools validator");
return spv_target_env::SPV_ENV_VULKAN_1_1;
}
default:
break;
}
......
......@@ -575,7 +575,7 @@ const char* ImageChannelDataTypeString(int type)
}
}
const int ImageOperandsCeiling = 12;
const int ImageOperandsCeiling = 14;
const char* ImageOperandsString(int format)
{
......@@ -592,6 +592,8 @@ const char* ImageOperandsString(int format)
case ImageOperandsMakeTexelVisibleKHRShift: return "MakeTexelVisibleKHR";
case ImageOperandsNonPrivateTexelKHRShift: return "NonPrivateTexelKHR";
case ImageOperandsVolatileTexelKHRShift: return "VolatileTexelKHR";
case ImageOperandsSignExtendShift: return "SignExtend";
case ImageOperandsZeroExtendShift: return "ZeroExtend";
case ImageOperandsCeiling:
default:
......@@ -674,15 +676,20 @@ const char* SelectControlString(int cont)
}
}
const int LoopControlCeiling = 4;
const int LoopControlCeiling = LoopControlPartialCountShift + 1;
const char* LoopControlString(int cont)
{
switch (cont) {
case 0: return "Unroll";
case 1: return "DontUnroll";
case 2: return "DependencyInfinite";
case 3: return "DependencyLength";
case LoopControlUnrollShift: return "Unroll";
case LoopControlDontUnrollShift: return "DontUnroll";
case LoopControlDependencyInfiniteShift: return "DependencyInfinite";
case LoopControlDependencyLengthShift: return "DependencyLength";
case LoopControlMinIterationsShift: return "MinIterations";
case LoopControlMaxIterationsShift: return "MaxIterations";
case LoopControlIterationMultipleShift: return "IterationMultiple";
case LoopControlPeelCountShift: return "PeelCount";
case LoopControlPartialCountShift: return "PartialCount";
case LoopControlCeiling:
default: return "Bad";
......@@ -1026,6 +1033,7 @@ const char* OpcodeString(int op)
case 82: return "OpCompositeInsert";
case 83: return "OpCopyObject";
case 84: return "OpTranspose";
case OpCopyLogical: return "OpCopyLogical";
case 85: return "Bad";
case 86: return "OpSampledImage";
case 87: return "OpImageSampleImplicitLod";
......@@ -1933,6 +1941,8 @@ void Parameterize()
InstructionDesc[OpTranspose].operands.push(OperandId, "'Matrix'");
InstructionDesc[OpCopyLogical].operands.push(OperandId, "'Operand'");
InstructionDesc[OpIsNan].operands.push(OperandId, "'x'");
InstructionDesc[OpIsInf].operands.push(OperandId, "'x'");
......
......@@ -56,7 +56,7 @@ ERROR: node is still EOpNull!
0:28 Function Definition: attExt( ( global void)
0:28 Function Parameters:
0:30 Sequence
0:30 Loop with condition not tested first: Dependency -3
0:30 Loop with condition not tested first
0:30 Loop Condition
0:30 Constant:
0:30 true (const bool)
......
spv.1.4.LoopControl.frag
WARNING: 0:15: 'min_iterations' : expected a single integer argument
WARNING: 0:15: 'max_iterations' : expected a single integer argument
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 54
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 53
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_control_flow_attributes"
Name 4 "main"
Name 8 "i"
Name 32 "i"
Name 42 "i"
Name 53 "cond"
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
16: 6(int) Constant 8
17: TypeBool
20: 6(int) Constant 1
27: 17(bool) ConstantTrue
52: TypePointer Private 17(bool)
53(cond): 52(ptr) Variable Private
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
32(i): 7(ptr) Variable Function
42(i): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
LoopMerge 12 13 MinIterations MaxIterations 3 7
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
Branch 13
13: Label
19: 6(int) Load 8(i)
21: 6(int) IAdd 19 20
Store 8(i) 21
Branch 10
12: Label
Branch 22
22: Label
LoopMerge 24 25 IterationMultiple 2
Branch 26
26: Label
BranchConditional 27 23 24
23: Label
Branch 25
25: Label
Branch 22
24: Label
Branch 28
28: Label
LoopMerge 30 31 PeelCount 5
Branch 29
29: Label
Branch 31
31: Label
BranchConditional 27 28 30
30: Label
Store 32(i) 9
Branch 33
33: Label
LoopMerge 35 36 PartialCount 4
Branch 37
37: Label
38: 6(int) Load 32(i)
39: 17(bool) SLessThan 38 16
BranchConditional 39 34 35
34: Label
Branch 36
36: Label
40: 6(int) Load 32(i)
41: 6(int) IAdd 40 20
Store 32(i) 41
Branch 33
35: Label
Store 42(i) 9
Branch 43
43: Label
LoopMerge 45 46 None
Branch 47
47: Label
48: 6(int) Load 42(i)
49: 17(bool) SLessThan 48 16
BranchConditional 49 44 45
44: Label
Branch 46
46: Label
50: 6(int) Load 42(i)
51: 6(int) IAdd 50 20
Store 42(i) 51
Branch 43
45: Label
Return
FunctionEnd
spv.1.4.NonWritable.frag
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 38
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8 31
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 8 "color"
Name 31 "index"
Name 34 "indexable"
Decorate 8(color) Location 0
Decorate 31(index) Flat
Decorate 31(index) Location 0
Decorate 34(indexable) NonWritable
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Output 6(float)
8(color): 7(ptr) Variable Output
9: TypeInt 32 0
10: 9(int) Constant 16
11: TypeArray 6(float) 10
12: 6(float) Constant 1065353216
13: 6(float) Constant 1073741824
14: 6(float) Constant 1077936128
15: 6(float) Constant 1082130432
16: 6(float) Constant 1084227584
17: 6(float) Constant 1086324736
18: 6(float) Constant 1088421888
19: 6(float) Constant 1090519040
20: 6(float) Constant 1091567616
21: 6(float) Constant 1092616192
22: 6(float) Constant 1093664768
23: 6(float) Constant 1094713344
24: 6(float) Constant 1095761920
25: 6(float) Constant 1096810496
26: 6(float) Constant 1097859072
27: 6(float) Constant 1098907648
28: 11 ConstantComposite 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
29: TypeInt 32 1
30: TypePointer Input 29(int)
31(index): 30(ptr) Variable Input
33: TypePointer Function 11
35: TypePointer Function 6(float)
4(main): 2 Function None 3
5: Label
34(indexable): 33(ptr) Variable Function 28
32: 29(int) Load 31(index)
36: 35(ptr) AccessChain 34(indexable) 32
37: 6(float) Load 36
Store 8(color) 37
Return
FunctionEnd
spv.1.4.OpCopyLogical.comp
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 65
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 19 27 35 51 60
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 450
Name 4 "main"
Name 12 "MyStruct"
MemberName 12(MyStruct) 0 "foo"
MemberName 12(MyStruct) 1 "sb"
Name 14 "t"
Name 16 "MyStruct"
MemberName 16(MyStruct) 0 "foo"
MemberName 16(MyStruct) 1 "sb"
Name 17 "SSBO0"
MemberName 17(SSBO0) 0 "a"
Name 19 "inBuf"
Name 25 "SSBO1"
MemberName 25(SSBO1) 0 "b"
Name 27 "outBuf"
Name 32 "MyStruct"
MemberName 32(MyStruct) 0 "foo"
MemberName 32(MyStruct) 1 "sb"
Name 33 "UBO"
MemberName 33(UBO) 0 "c"
Name 35 "uBuf"
Name 44 "Nested"
MemberName 44(Nested) 0 "f"
MemberName 44(Nested) 1 "S"
Name 46 "n"
Name 48 "Nested"
MemberName 48(Nested) 0 "f"
MemberName 48(Nested) 1 "S"
Name 49 "UBON"
MemberName 49(UBON) 0 "N1"
Name 51 "uBufN"
Name 57 "Nested"
MemberName 57(Nested) 0 "f"
MemberName 57(Nested) 1 "S"
Name 58 "SSBO1N"
MemberName 58(SSBO1N) 0 "N2"
Name 60 "outBufN"
Decorate 15 ArrayStride 8
MemberDecorate 16(MyStruct) 0 Offset 0
MemberDecorate 16(MyStruct) 1 Offset 16
MemberDecorate 17(SSBO0) 0 Offset 0
Decorate 17(SSBO0) Block
Decorate 19(inBuf) DescriptorSet 0
Decorate 19(inBuf) Binding 0
MemberDecorate 25(SSBO1) 0 Offset 0
Decorate 25(SSBO1) Block
Decorate 27(outBuf) DescriptorSet 0
Decorate 27(outBuf) Binding 1
Decorate 31 ArrayStride 16
MemberDecorate 32(MyStruct) 0 Offset 0
MemberDecorate 32(MyStruct) 1 Offset 32
MemberDecorate 33(UBO) 0 Offset 0
Decorate 33(UBO) Block
Decorate 35(uBuf) DescriptorSet 0
Decorate 35(uBuf) Binding 2
Decorate 47 ArrayStride 48
MemberDecorate 48(Nested) 0 Offset 0
MemberDecorate 48(Nested) 1 Offset 16
MemberDecorate 49(UBON) 0 Offset 0
Decorate 49(UBON) Block
Decorate 51(uBufN) DescriptorSet 0
Decorate 51(uBufN) Binding 2
Decorate 56 ArrayStride 24
MemberDecorate 57(Nested) 0 Offset 0
MemberDecorate 57(Nested) 1 Offset 8
MemberDecorate 58(SSBO1N) 0 Offset 0
Decorate 58(SSBO1N) Block
Decorate 60(outBufN) DescriptorSet 0
Decorate 60(outBufN) Binding 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 2
8: TypeInt 32 0
9: 8(int) Constant 2
10: TypeArray 7(fvec2) 9
11: TypeInt 32 1
12(MyStruct): TypeStruct 10 11(int)
13: TypePointer Function 12(MyStruct)
15: TypeArray 7(fvec2) 9
16(MyStruct): TypeStruct 15 11(int)
17(SSBO0): TypeStruct 16(MyStruct)
18: TypePointer StorageBuffer 17(SSBO0)
19(inBuf): 18(ptr) Variable StorageBuffer
20: 11(int) Constant 0
21: TypePointer StorageBuffer 16(MyStruct)
25(SSBO1): TypeStruct 16(MyStruct)
26: TypePointer StorageBuffer 25(SSBO1)
27(outBuf): 26(ptr) Variable StorageBuffer
31: TypeArray 7(fvec2) 9
32(MyStruct): TypeStruct 31 11(int)
33(UBO): TypeStruct 32(MyStruct)
34: TypePointer Uniform 33(UBO)
35(uBuf): 34(ptr) Variable Uniform
36: TypePointer Uniform 32(MyStruct)
43: TypeArray 12(MyStruct) 9
44(Nested): TypeStruct 6(float) 43
45: TypePointer Function 44(Nested)
47: TypeArray 32(MyStruct) 9
48(Nested): TypeStruct 6(float) 47
49(UBON): TypeStruct 48(Nested)
50: TypePointer Uniform 49(UBON)
51(uBufN): 50(ptr) Variable Uniform
52: TypePointer Uniform 48(Nested)
56: TypeArray 16(MyStruct) 9
57(Nested): TypeStruct 6(float) 56
58(SSBO1N): TypeStruct 57(Nested)
59: TypePointer StorageBuffer 58(SSBO1N)
60(outBufN): 59(ptr) Variable StorageBuffer
62: TypePointer StorageBuffer 57(Nested)
4(main): 2 Function None 3
5: Label
14(t): 13(ptr) Variable Function
46(n): 45(ptr) Variable Function
22: 21(ptr) AccessChain 19(inBuf) 20
23:16(MyStruct) Load 22
24:12(MyStruct) CopyLogical 23
Store 14(t) 24
28:12(MyStruct) Load 14(t)
29: 21(ptr) AccessChain 27(outBuf) 20
30:16(MyStruct) CopyLogical 28
Store 29 30
37: 36(ptr) AccessChain 35(uBuf) 20
38:32(MyStruct) Load 37
39:12(MyStruct) CopyLogical 38
Store 14(t) 39
40:12(MyStruct) Load 14(t)
41: 21(ptr) AccessChain 27(outBuf) 20
42:16(MyStruct) CopyLogical 40
Store 41 42
53: 52(ptr) AccessChain 51(uBufN) 20
54: 48(Nested) Load 53
55: 44(Nested) CopyLogical 54
Store 46(n) 55
61: 44(Nested) Load 46(n)
63: 62(ptr) AccessChain 60(outBufN) 20
64: 57(Nested) CopyLogical 61
Store 63 64
Return
FunctionEnd
spv.1.4.OpCopyLogical.funcall.frag
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 60
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 25 37
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "S"
MemberName 9(S) 0 "m"
Name 12 "fooConst(struct-S-mf441;"
Name 11 "s"
Name 17 "foo(struct-S-mf441;"
Name 16 "s"
Name 20 "fooOut(struct-S-mf441;"
Name 19 "s"
Name 22 "S"
MemberName 22(S) 0 "m"
Name 23 "blockName"
MemberName 23(blockName) 0 "s1"
Name 25 ""
Name 31 "S"
MemberName 31(S) 0 "m"
Name 32 "arg"
Name 37 "s2"
Name 40 "param"
Name 45 "param"
Name 48 "param"
Name 56 "param"
MemberDecorate 22(S) 0 ColMajor
MemberDecorate 22(S) 0 Offset 0
MemberDecorate 22(S) 0 MatrixStride 16
MemberDecorate 23(blockName) 0 Offset 0
Decorate 23(blockName) Block
Decorate 25 DescriptorSet 0
Decorate 25 Binding 0
MemberDecorate 31(S) 0 ColMajor
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeMatrix 7(fvec4) 4
9(S): TypeStruct 8
10: TypeFunction 2 9(S)
14: TypePointer Function 9(S)
15: TypeFunction 2 14(ptr)
22(S): TypeStruct 8
23(blockName): TypeStruct 22(S)
24: TypePointer StorageBuffer 23(blockName)
25: 24(ptr) Variable StorageBuffer
26: TypeInt 32 1
27: 26(int) Constant 0
28: TypePointer StorageBuffer 22(S)
31(S): TypeStruct 8
36: TypePointer Private 9(S)
37(s2): 36(ptr) Variable Private
4(main): 2 Function None 3
5: Label
32(arg): 14(ptr) Variable Function
40(param): 14(ptr) Variable Function
45(param): 14(ptr) Variable Function
48(param): 14(ptr) Variable Function
56(param): 14(ptr) Variable Function
29: 28(ptr) AccessChain 25 27
30: 22(S) Load 29
33: 9(S) CopyLogical 30
Store 32(arg) 33
34: 9(S) Load 32(arg)
35: 2 FunctionCall 12(fooConst(struct-S-mf441;) 34
38: 9(S) Load 37(s2)
39: 2 FunctionCall 12(fooConst(struct-S-mf441;) 38
41: 28(ptr) AccessChain 25 27
42: 22(S) Load 41
43: 9(S) CopyLogical 42
Store 40(param) 43
44: 2 FunctionCall 17(foo(struct-S-mf441;) 40(param)
46: 9(S) Load 37(s2)
Store 45(param) 46
47: 2 FunctionCall 17(foo(struct-S-mf441;) 45(param)
49: 28(ptr) AccessChain 25 27
50: 22(S) Load 49
51: 9(S) CopyLogical 50
Store 48(param) 51
52: 2 FunctionCall 20(fooOut(struct-S-mf441;) 48(param)
53: 9(S) Load 48(param)
54: 28(ptr) AccessChain 25 27
55: 22(S) CopyLogical 53
Store 54 55
57: 9(S) Load 37(s2)
Store 56(param) 57
58: 2 FunctionCall 20(fooOut(struct-S-mf441;) 56(param)
59: 9(S) Load 56(param)
Store 37(s2) 59
Return
FunctionEnd
12(fooConst(struct-S-mf441;): 2 Function None 10
11(s): 9(S) FunctionParameter
13: Label
Return
FunctionEnd
17(foo(struct-S-mf441;): 2 Function None 15
16(s): 14(ptr) FunctionParameter
18: Label
Return
FunctionEnd
20(fooOut(struct-S-mf441;): 2 Function None 15
19(s): 14(ptr) FunctionParameter
21: Label
Return
FunctionEnd
spv.1.4.OpEntryPoint.frag
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 64
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 11 14 17 25 33 41
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "functionv"
Name 11 "inv"
Name 14 "globalv"
Name 17 "outv"
Name 23 "ubt"
MemberName 23(ubt) 0 "v"
Name 25 "uniformv"
Name 31 "pushB"
MemberName 31(pushB) 0 "a"
Name 33 "pushv"
Name 39 "bbt"
MemberName 39(bbt) 0 "f"
Name 41 "bufferv"
Decorate 11(inv) Location 0
Decorate 17(outv) Location 0
MemberDecorate 23(ubt) 0 Offset 0
Decorate 23(ubt) Block
Decorate 25(uniformv) DescriptorSet 0
Decorate 25(uniformv) Binding 0
MemberDecorate 31(pushB) 0 Offset 0
Decorate 31(pushB) Block
Decorate 33(pushv) Binding 2
MemberDecorate 39(bbt) 0 Offset 0
Decorate 39(bbt) Block
Decorate 41(bufferv) DescriptorSet 0
Decorate 41(bufferv) Binding 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: TypePointer Input 7(fvec4)
11(inv): 10(ptr) Variable Input
13: TypePointer Private 7(fvec4)
14(globalv): 13(ptr) Variable Private
16: TypePointer Output 7(fvec4)
17(outv): 16(ptr) Variable Output
23(ubt): TypeStruct 7(fvec4)
24: TypePointer Uniform 23(ubt)
25(uniformv): 24(ptr) Variable Uniform
26: TypeInt 32 1
27: 26(int) Constant 0
28: TypePointer Uniform 7(fvec4)
31(pushB): TypeStruct 26(int)
32: TypePointer PushConstant 31(pushB)
33(pushv): 32(ptr) Variable PushConstant
34: TypePointer PushConstant 26(int)
39(bbt): TypeStruct 6(float)
40: TypePointer StorageBuffer 39(bbt)
41(bufferv): 40(ptr) Variable StorageBuffer
42: TypePointer StorageBuffer 6(float)
4(main): 2 Function None 3
5: Label
9(functionv): 8(ptr) Variable Function
12: 7(fvec4) Load 11(inv)
Store 9(functionv) 12
15: 7(fvec4) Load 11(inv)
Store 14(globalv) 15
18: 7(fvec4) Load 9(functionv)
19: 7(fvec4) Load 11(inv)
20: 7(fvec4) FAdd 18 19
21: 7(fvec4) Load 14(globalv)
22: 7(fvec4) FAdd 20 21
29: 28(ptr) AccessChain 25(uniformv) 27
30: 7(fvec4) Load 29
35: 34(ptr) AccessChain 33(pushv) 27
36: 26(int) Load 35
37: 6(float) ConvertSToF 36
38: 7(fvec4) VectorTimesScalar 30 37
43: 42(ptr) AccessChain 41(bufferv) 27
44: 6(float) Load 43
45: 7(fvec4) VectorTimesScalar 38 44
46: 7(fvec4) FAdd 22 45
Store 17(outv) 46
47: 7(fvec4) Load 9(functionv)
48: 7(fvec4) Load 11(inv)
49: 7(fvec4) FAdd 47 48
50: 7(fvec4) Load 14(globalv)
51: 7(fvec4) FAdd 49 50
52: 28(ptr) AccessChain 25(uniformv) 27
53: 7(fvec4) Load 52
54: 34(ptr) AccessChain 33(pushv) 27
55: 26(int) Load 54
56: 6(float) ConvertSToF 55
57: 7(fvec4) VectorTimesScalar 53 56
58: 42(ptr) AccessChain 41(bufferv) 27
59: 6(float) Load 58
60: 7(fvec4) VectorTimesScalar 57 59
61: 7(fvec4) FAdd 51 60
62: 7(fvec4) Load 17(outv)
63: 7(fvec4) FAdd 62 61
Store 17(outv) 63
Return
FunctionEnd
spv.1.4.OpSelect.frag
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 98
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 17 20 82 84
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 6 "fun1("
Name 8 "fun2("
Name 12 "f1"
Name 14 "f2"
Name 17 "outv"
Name 20 "cond"
Name 30 "iv1"
Name 34 "iv2"
Name 53 "m1"
Name 59 "m2"
Name 75 "S1"
MemberName 75(S1) 0 "a"
MemberName 75(S1) 1 "b"
Name 77 "fv"
Name 82 "in1"
Name 84 "in2"
Decorate 17(outv) Location 0
Decorate 20(cond) Flat
Decorate 20(cond) Location 4
Decorate 82(in1) Flat
Decorate 82(in1) Location 0
Decorate 84(in2) Flat
Decorate 84(in2) Location 2
2: TypeVoid
3: TypeFunction 2
10: TypeFloat 32
11: TypePointer Function 10(float)
13: 10(float) Constant 1065353216
15: 10(float) Constant 1073741824
16: TypePointer Output 10(float)
17(outv): 16(ptr) Variable Output
18: TypeInt 32 1
19: TypePointer Input 18(int)
20(cond): 19(ptr) Variable Input
22: 18(int) Constant 8
23: TypeBool
28: TypeVector 18(int) 4
29: TypePointer Function 28(ivec4)
39: 18(int) Constant 0
44: TypeInt 32 0
45: 44(int) Constant 2
50: TypeVector 10(float) 3
51: TypeMatrix 50(fvec3) 3
52: TypePointer Function 51
54: 10(float) Constant 0
55: 50(fvec3) ConstantComposite 13 54 54
56: 50(fvec3) ConstantComposite 54 13 54
57: 50(fvec3) ConstantComposite 54 54 13
58: 51 ConstantComposite 55 56 57
60: 50(fvec3) ConstantComposite 15 54 54
61: 50(fvec3) ConstantComposite 54 15 54
62: 50(fvec3) ConstantComposite 54 54 15
63: 51 ConstantComposite 60 61 62
65: 18(int) Constant 20
70: 18(int) Constant 2
71: 44(int) Constant 1
75(S1): TypeStruct 10(float) 18(int)
76: TypePointer Function 75(S1)
79: 18(int) Constant 5
81: TypePointer Input 75(S1)
82(in1): 81(ptr) Variable Input
84(in2): 81(ptr) Variable Input
4(main): 2 Function None 3
5: Label
12(f1): 11(ptr) Variable Function
14(f2): 11(ptr) Variable Function
30(iv1): 29(ptr) Variable Function
34(iv2): 29(ptr) Variable Function
53(m1): 52(ptr) Variable Function
59(m2): 52(ptr) Variable Function
77(fv): 76(ptr) Variable Function
Store 12(f1) 13
Store 14(f2) 15
21: 18(int) Load 20(cond)
24: 23(bool) SLessThan 21 22
25: 10(float) Load 12(f1)
26: 10(float) Load 14(f2)
27: 10(float) Select 24 25 26
Store 17(outv) 27
31: 10(float) Load 12(f1)
32: 18(int) ConvertFToS 31
33: 28(ivec4) CompositeConstruct 32 32 32 32
Store 30(iv1) 33
35: 10(float) Load 14(f2)
36: 18(int) ConvertFToS 35
37: 28(ivec4) CompositeConstruct 36 36 36 36
Store 34(iv2) 37
38: 18(int) Load 20(cond)
40: 23(bool) SGreaterThan 38 39
41: 28(ivec4) Load 30(iv1)
42: 28(ivec4) Load 34(iv2)
43: 28(ivec4) Select 40 41 42
46: 18(int) CompositeExtract 43 2
47: 10(float) ConvertSToF 46
48: 10(float) Load 17(outv)
49: 10(float) FMul 48 47
Store 17(outv) 49
Store 53(m1) 58
Store 59(m2) 63
64: 18(int) Load 20(cond)
66: 23(bool) SLessThan 64 65
67: 51 Load 53(m1)
68: 51 Load 59(m2)
69: 51 Select 66 67 68
72: 10(float) CompositeExtract 69 2 1
73: 10(float) Load 17(outv)
74: 10(float) FMul 73 72
Store 17(outv) 74
78: 18(int) Load 20(cond)
80: 23(bool) SGreaterThan 78 79
83: 75(S1) Load 82(in1)
85: 75(S1) Load 84(in2)
86: 75(S1) Select 80 83 85
Store 77(fv) 86
87: 11(ptr) AccessChain 77(fv) 39
88: 10(float) Load 87
89: 10(float) Load 17(outv)
90: 10(float) FMul 89 88
Store 17(outv) 90
91: 18(int) Load 20(cond)
92: 23(bool) SGreaterThan 91 39
SelectionMerge 94 None
BranchConditional 92 93 96
93: Label
95: 2 FunctionCall 6(fun1()
Branch 94
96: Label
97: 2 FunctionCall 8(fun2()
Branch 94
94: Label
Return
FunctionEnd
6(fun1(): 2 Function None 3
7: Label
Return
FunctionEnd
8(fun2(): 2 Function None 3
9: Label
Return
FunctionEnd
spv.1.4.image.frag
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 104
Capability Shader
Capability StorageImageMultisample
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 26 30 40 52 64 77 89 100 103
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "v"
Name 15 "iv"
Name 21 "uv"
Name 26 "i2D"
Name 30 "ic2D"
Name 40 "ii2D"
Name 52 "ui2D"
Name 64 "i2DMS"
Name 77 "ii2DMS"
Name 89 "ui2DMS"
Name 100 "fragData"
Name 103 "value"
Decorate 26(i2D) DescriptorSet 0
Decorate 26(i2D) Binding 1
Decorate 30(ic2D) Flat
Decorate 40(ii2D) DescriptorSet 0
Decorate 40(ii2D) Binding 12
Decorate 52(ui2D) DescriptorSet 0
Decorate 52(ui2D) Binding 12
Decorate 64(i2DMS) DescriptorSet 0
Decorate 64(i2DMS) Binding 9
Decorate 77(ii2DMS) DescriptorSet 0
Decorate 77(ii2DMS) Binding 13
Decorate 89(ui2DMS) DescriptorSet 0
Decorate 89(ui2DMS) Binding 13
Decorate 103(value) Flat
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: TypeInt 32 1
13: TypeVector 12(int) 4
14: TypePointer Function 13(ivec4)
16: 12(int) Constant 0
17: 13(ivec4) ConstantComposite 16 16 16 16
18: TypeInt 32 0
19: TypeVector 18(int) 4
20: TypePointer Function 19(ivec4)
22: 18(int) Constant 0
23: 19(ivec4) ConstantComposite 22 22 22 22
24: TypeImage 6(float) 2D nonsampled format:Rgba32f
25: TypePointer UniformConstant 24
26(i2D): 25(ptr) Variable UniformConstant
28: TypeVector 12(int) 2
29: TypePointer Input 28(ivec2)
30(ic2D): 29(ptr) Variable Input
38: TypeImage 12(int) 2D nonsampled format:R32i
39: TypePointer UniformConstant 38
40(ii2D): 39(ptr) Variable UniformConstant
50: TypeImage 18(int) 2D nonsampled format:R32ui
51: TypePointer UniformConstant 50
52(ui2D): 51(ptr) Variable UniformConstant
62: TypeImage 6(float) 2D multi-sampled nonsampled format:Rgba32f
63: TypePointer UniformConstant 62
64(i2DMS): 63(ptr) Variable UniformConstant
67: 12(int) Constant 1
73: 12(int) Constant 2
75: TypeImage 12(int) 2D multi-sampled nonsampled format:R32i
76: TypePointer UniformConstant 75
77(ii2DMS): 76(ptr) Variable UniformConstant
87: TypeImage 18(int) 2D multi-sampled nonsampled format:R32ui
88: TypePointer UniformConstant 87
89(ui2DMS): 88(ptr) Variable UniformConstant
99: TypePointer Output 7(fvec4)
100(fragData): 99(ptr) Variable Output
102: TypePointer Input 18(int)
103(value): 102(ptr) Variable Input
4(main): 2 Function None 3
5: Label
9(v): 8(ptr) Variable Function
15(iv): 14(ptr) Variable Function
21(uv): 20(ptr) Variable Function
Store 9(v) 11
Store 15(iv) 17
Store 21(uv) 23
27: 24 Load 26(i2D)
31: 28(ivec2) Load 30(ic2D)
32: 7(fvec4) ImageRead 27 31
33: 7(fvec4) Load 9(v)
34: 7(fvec4) FAdd 33 32
Store 9(v) 34
35: 24 Load 26(i2D)
36: 28(ivec2) Load 30(ic2D)
37: 7(fvec4) Load 9(v)
ImageWrite 35 36 37
41: 38 Load 40(ii2D)
42: 28(ivec2) Load 30(ic2D)
43: 13(ivec4) ImageRead 41 42 SignExtend
44: 7(fvec4) ConvertSToF 43
45: 7(fvec4) Load 9(v)
46: 7(fvec4) FAdd 45 44
Store 9(v) 46
47: 38 Load 40(ii2D)
48: 28(ivec2) Load 30(ic2D)
49: 13(ivec4) Load 15(iv)
ImageWrite 47 48 49 SignExtend
53: 50 Load 52(ui2D)
54: 28(ivec2) Load 30(ic2D)
55: 19(ivec4) ImageRead 53 54 ZeroExtend
56: 7(fvec4) ConvertUToF 55
57: 7(fvec4) Load 9(v)
58: 7(fvec4) FAdd 57 56
Store 9(v) 58
59: 50 Load 52(ui2D)
60: 28(ivec2) Load 30(ic2D)
61: 19(ivec4) Load 21(uv)
ImageWrite 59 60 61 ZeroExtend
65: 62 Load 64(i2DMS)
66: 28(ivec2) Load 30(ic2D)
68: 7(fvec4) ImageRead 65 66 Sample 67
69: 7(fvec4) Load 9(v)
70: 7(fvec4) FAdd 69 68
Store 9(v) 70
71: 62 Load 64(i2DMS)
72: 28(ivec2) Load 30(ic2D)
74: 7(fvec4) Load 9(v)
ImageWrite 71 72 74 Sample 73
78: 75 Load 77(ii2DMS)
79: 28(ivec2) Load 30(ic2D)
80: 13(ivec4) ImageRead 78 79 Sample SignExtend 67
81: 7(fvec4) ConvertSToF 80
82: 7(fvec4) Load 9(v)
83: 7(fvec4) FAdd 82 81
Store 9(v) 83
84: 75 Load 77(ii2DMS)
85: 28(ivec2) Load 30(ic2D)
86: 13(ivec4) Load 15(iv)
ImageWrite 84 85 86 Sample SignExtend 73
90: 87 Load 89(ui2DMS)
91: 28(ivec2) Load 30(ic2D)
92: 19(ivec4) ImageRead 90 91 Sample ZeroExtend 67
93: 7(fvec4) ConvertUToF 92
94: 7(fvec4) Load 9(v)
95: 7(fvec4) FAdd 94 93
Store 9(v) 95
96: 87 Load 89(ui2DMS)
97: 28(ivec2) Load 30(ic2D)
98: 19(ivec4) Load 21(uv)
ImageWrite 96 97 98 Sample ZeroExtend 73
101: 7(fvec4) Load 9(v)
Store 100(fragData) 101
Return
FunctionEnd
spv.1.4.texture.frag
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 79
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 15 19 28 40 51 54 76 78
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "color"
Name 15 "texSampler2D"
Name 19 "coords2D"
Name 28 "itexSampler2D"
Name 40 "utexSampler2D"
Name 51 "iCoords2D"
Name 54 "iLod"
Name 76 "t"
Name 78 "color"
Decorate 15(texSampler2D) DescriptorSet 0
Decorate 15(texSampler2D) Binding 0
Decorate 28(itexSampler2D) DescriptorSet 0
Decorate 28(itexSampler2D) Binding 0
Decorate 40(utexSampler2D) DescriptorSet 0
Decorate 40(utexSampler2D) Binding 0
Decorate 51(iCoords2D) Flat
Decorate 54(iLod) Flat
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: TypeImage 6(float) 2D sampled format:Unknown
13: TypeSampledImage 12
14: TypePointer UniformConstant 13
15(texSampler2D): 14(ptr) Variable UniformConstant
17: TypeVector 6(float) 2
18: TypePointer Input 17(fvec2)
19(coords2D): 18(ptr) Variable Input
24: TypeInt 32 1
25: TypeImage 24(int) 2D sampled format:Unknown
26: TypeSampledImage 25
27: TypePointer UniformConstant 26
28(itexSampler2D): 27(ptr) Variable UniformConstant
31: TypeVector 24(int) 4
36: TypeInt 32 0
37: TypeImage 36(int) 2D sampled format:Unknown
38: TypeSampledImage 37
39: TypePointer UniformConstant 38
40(utexSampler2D): 39(ptr) Variable UniformConstant
43: TypeVector 36(int) 4
49: TypeVector 24(int) 2
50: TypePointer Input 49(ivec2)
51(iCoords2D): 50(ptr) Variable Input
53: TypePointer Input 24(int)
54(iLod): 53(ptr) Variable Input
76(t): 18(ptr) Variable Input
77: TypePointer Output 7(fvec4)
78(color): 77(ptr) Variable Output
4(main): 2 Function None 3
5: Label
9(color): 8(ptr) Variable Function
Store 9(color) 11
16: 13 Load 15(texSampler2D)
20: 17(fvec2) Load 19(coords2D)
21: 7(fvec4) ImageSampleImplicitLod 16 20
22: 7(fvec4) Load 9(color)
23: 7(fvec4) FAdd 22 21
Store 9(color) 23
29: 26 Load 28(itexSampler2D)
30: 17(fvec2) Load 19(coords2D)
32: 31(ivec4) ImageSampleImplicitLod 29 30 SignExtend
33: 7(fvec4) ConvertSToF 32
34: 7(fvec4) Load 9(color)
35: 7(fvec4) FAdd 34 33
Store 9(color) 35
41: 38 Load 40(utexSampler2D)
42: 17(fvec2) Load 19(coords2D)
44: 43(ivec4) ImageSampleImplicitLod 41 42 ZeroExtend
45: 7(fvec4) ConvertUToF 44
46: 7(fvec4) Load 9(color)
47: 7(fvec4) FAdd 46 45
Store 9(color) 47
48: 13 Load 15(texSampler2D)
52: 49(ivec2) Load 51(iCoords2D)
55: 24(int) Load 54(iLod)
56: 12 Image 48
57: 7(fvec4) ImageFetch 56 52 Lod 55
58: 7(fvec4) Load 9(color)
59: 7(fvec4) FAdd 58 57
Store 9(color) 59
60: 26 Load 28(itexSampler2D)
61: 49(ivec2) Load 51(iCoords2D)
62: 24(int) Load 54(iLod)
63: 25 Image 60
64: 31(ivec4) ImageFetch 63 61 Lod SignExtend 62
65: 7(fvec4) ConvertSToF 64
66: 7(fvec4) Load 9(color)
67: 7(fvec4) FAdd 66 65
Store 9(color) 67
68: 38 Load 40(utexSampler2D)
69: 49(ivec2) Load 51(iCoords2D)
70: 24(int) Load 54(iLod)
71: 37 Image 68
72: 43(ivec4) ImageFetch 71 69 Lod ZeroExtend 70
73: 7(fvec4) ConvertUToF 72
74: 7(fvec4) Load 9(color)
75: 7(fvec4) FAdd 74 73
Store 9(color) 75
Return
FunctionEnd
spv.controlFlowAttributes.frag
WARNING: 0:20: '' : attribute with arguments not recognized, skipping
WARNING: 0:21: '' : attribute with arguments not recognized, skipping
WARNING: 0:22: '' : attribute with arguments not recognized, skipping
WARNING: 0:20: 'unroll' : expected no arguments
WARNING: 0:21: 'dont_unroll' : expected no arguments
WARNING: 0:22: 'dependency_infinite' : expected no arguments
WARNING: 0:23: 'dependency_length' : expected a single integer argument
WARNING: 0:24: '' : attribute with arguments not recognized, skipping
WARNING: 0:25: '' : attribute with arguments not recognized, skipping
......
#version 450
#extension GL_EXT_control_flow_attributes : enable
bool cond;
void main()
{
[[min_iterations(3), max_iterations(7)]] for (int i = 0; i < 8; ++i) { }
[[iteration_multiple(2)]] while(true) { }
[[peel_count(5)]] do { } while(true);
[[partial_count(4)]] for (int i = 0; i < 8; ++i) { }
// warnings on all these
[[min_iterations, max_iterations]] for (int i = 0; i < 8; ++i) { }
//[[iteration_multiple(0)]] while(true) { }
//[[peel_count]] do { } while(true);
//[[partial_count]] for (int i = 0; i < 8; ++i) { }
}
#version 450
layout(location = 0) flat in int index;
layout(location = 0) out float color;
// lookup table
const float table[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
void main()
{
color = table[index];
}
#version 450 core
struct MyStruct
{
vec2 foo[2];
int sb;
};
layout(binding = 0, std430) buffer SSBO0
{
MyStruct a;
} inBuf;
layout(binding = 1, std430) buffer SSBO1
{
MyStruct b;
} outBuf;
layout(binding = 2, std140) uniform UBO
{
MyStruct c;
} uBuf;
struct Nested {
float f;
MyStruct S[2];
};
layout(binding = 2, std140) uniform UBON
{
Nested N1;
} uBufN;
layout(binding = 1, std430) buffer SSBO1N
{
Nested N2;
} outBufN;
void main()
{
MyStruct t = inBuf.a;
outBuf.b = t;
t = uBuf.c;
outBuf.b = t;
Nested n = uBufN.N1;
outBufN.N2 = n;
}
#version 450
struct S { mat4 m; };
buffer blockName { S s1; }; // need an S with decoration
S s2; // no decorations on S
void fooConst(const in S s) { }
void foo(in S s) { }
void fooOut(inout S s) { }
void main()
{
fooConst(s1);
fooConst(s2);
foo(s1);
foo(s2);
fooOut(s1);
fooOut(s2);
}
\ No newline at end of file
#version 450 core
struct MyStruct
{
vec2 foo[2];
bool sb;
};
layout(binding = 0, std430) buffer SSBO0
{
MyStruct a;
} inBuf;
layout(binding = 1, std430) buffer SSBO1
{
MyStruct b;
} outBuf;
layout(binding = 2, std140) uniform UBO
{
MyStruct c;
} uBuf;
struct Nested {
bool b;
MyStruct S[2];
};
layout(binding = 2, std140) uniform UBON
{
Nested N1;
} uBufN;
layout(binding = 1, std430) buffer SSBO1N
{
Nested N2;
} outBufN;
void main()
{
MyStruct t = inBuf.a;
outBuf.b = t;
t = uBuf.c;
outBuf.b = t;
Nested n = uBufN.N1;
outBufN.N2 = n;
}
#version 450
layout(location = 0) in vec4 inv;
layout(location = 0) out vec4 outv;
vec4 globalv;
layout(binding = 0) uniform ubt {
vec4 v;
} uniformv;
layout(binding = 1) buffer bbt {
float f;
} bufferv;
layout(binding = 2, push_constant) uniform pushB {
int a;
} pushv;
void main()
{
vec4 functionv;
functionv = inv;
globalv = inv;
outv = functionv + inv + globalv + uniformv.v * pushv.a * bufferv.f;
outv += functionv + inv + globalv + uniformv.v * pushv.a * bufferv.f;
}
#version 450
struct S1 {
float a;
int b;
};
layout(location = 0) flat in S1 in1;
layout(location = 2) flat in S1 in2;
layout(location = 4) flat in int cond;
layout(location = 0) out float outv;
void fun1(){}
void fun2(){}
void main()
{
// glslang will only make OpSelect for very trivial looking expressions
float f1 = 1.0;
float f2 = 2.0;
outv = cond < 8 ? f1 : f2; // in all versions
ivec4 iv1 = ivec4(f1);
ivec4 iv2 = ivec4(f2);
outv *= (cond > 0 ? iv1 : iv2).z; // in all versions, but in 1.4 as scalar condition, not smeared ala mix()
mat3 m1 = mat3(1.0);
mat3 m2 = mat3(2.0);
outv *= (cond < 20 ? m1 : m2)[2][1]; // in 1.4, but not before
S1 fv = cond > 5 ? in1 : in2; // in 1.4, but not before
outv *= fv.a;
cond > 0 ? fun1() : fun2(); // not allowed by any version
}
#version 450
layout(rgba32f, binding = 1) uniform image2D i2D;
layout(r32i, binding = 12) uniform iimage2D ii2D;
layout(r32ui, binding = 12) uniform uimage2D ui2D;
layout(rgba32f, binding = 9) uniform image2DMS i2DMS;
layout(r32i, binding = 13) uniform iimage2DMS ii2DMS;
layout(r32ui, binding = 13) uniform uimage2DMS ui2DMS;
flat in ivec2 ic2D;
flat in uint value;
out vec4 fragData;
void main()
{
vec4 v = vec4(0.0);
ivec4 iv = ivec4(0.0);
uvec4 uv = uvec4(0.0);
v += imageLoad(i2D, ic2D);
imageStore(i2D, ic2D, v);
v += imageLoad(ii2D, ic2D);
imageStore(ii2D, ic2D, iv);
v += imageLoad(ui2D, ic2D);
imageStore(ui2D, ic2D, uv);
v += imageLoad(i2DMS, ic2D, 1);
imageStore(i2DMS, ic2D, 2, v);
v += imageLoad(ii2DMS, ic2D, 1);
imageStore(ii2DMS, ic2D, 2, iv);
v += imageLoad(ui2DMS, ic2D, 1);
imageStore(ui2DMS, ic2D, 2, uv);
fragData = v;
}
#version 450
#extension GL_ARB_sparse_texture2: enable
uniform sampler2D s2D;
uniform isampler2D is2D;
uniform usampler2D us2D;
layout(rgba32f) uniform image2D i2D;
layout(rgba32i) uniform iimage2DMS ii2DMS;
layout(rgba32ui) uniform uimage3D ui3D;
in vec2 c2;
in vec3 c3;
in vec4 c4;
in flat ivec2 ic2;
in flat ivec3 ic3;
in flat ivec2 offsets[4];
out vec4 outColor;
void main()
{
int resident = 0;
vec4 texel = vec4(0.0);
ivec4 itexel = ivec4(0);
uvec4 utexel = uvec4(0);
resident |= sparseTextureARB(s2D, c2, texel);
resident |= sparseTextureARB(is2D, c2, texel);
resident |= sparseTextureARB(us2D, c2, texel);
resident |= sparseTextureLodARB( s2D, c2, 2.0, texel);
resident |= sparseTextureLodARB(is2D, c2, 2.0, texel);
resident |= sparseTextureLodARB(us2D, c2, 2.0, texel);
resident |= sparseTexelFetchARB( s2D, ivec2(c2), 2, texel);
resident |= sparseTexelFetchARB(is2D, ivec2(c2), 2, texel);
resident |= sparseTexelFetchARB(us2D, ivec2(c2), 2, texel);
resident |= sparseImageLoadARB(i2D, ic2, texel);
resident |= sparseImageLoadARB(ii2DMS, ic2, 3, texel);
resident |= sparseImageLoadARB(ui3D, ic3, utexel);
outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
}
\ No newline at end of file
#version 450
uniform sampler2D texSampler2D;
uniform isampler2D itexSampler2D;
uniform usampler2D utexSampler2D;
in vec2 t;
in vec2 coords2D;
flat in ivec2 iCoords2D;
out vec4 color;
flat in int iLod;
void main()
{
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
color += texture( texSampler2D, coords2D);
color += texture(itexSampler2D, coords2D);
color += texture(utexSampler2D, coords2D);
color += texelFetch( texSampler2D, iCoords2D, iLod);
color += texelFetch(itexSampler2D, iCoords2D, iLod);
color += texelFetch(utexSampler2D, iCoords2D, iLod);
}
\ No newline at end of file
......@@ -1116,7 +1116,12 @@ public:
first(testFirst),
unroll(false),
dontUnroll(false),
dependency(0)
dependency(0),
minIterations(0),
maxIterations(iterationsInfinite),
iterationMultiple(1),
peelCount(0),
partialCount(0)
{ }
virtual TIntermLoop* getAsLoopNode() { return this; }
......@@ -1128,14 +1133,36 @@ public:
bool testFirst() const { return first; }
void setUnroll() { unroll = true; }
void setDontUnroll() { dontUnroll = true; }
void setDontUnroll() {
dontUnroll = true;
peelCount = 0;
partialCount = 0;
}
bool getUnroll() const { return unroll; }
bool getDontUnroll() const { return dontUnroll; }
static const unsigned int dependencyInfinite = 0xFFFFFFFF;
static const unsigned int iterationsInfinite = 0xFFFFFFFF;
void setLoopDependency(int d) { dependency = d; }
int getLoopDependency() const { return dependency; }
void setMinIterations(unsigned int v) { minIterations = v; }
unsigned int getMinIterations() const { return minIterations; }
void setMaxIterations(unsigned int v) { maxIterations = v; }
unsigned int getMaxIterations() const { return maxIterations; }
void setIterationMultiple(unsigned int v) { iterationMultiple = v; }
unsigned int getIterationMultiple() const { return iterationMultiple; }
void setPeelCount(unsigned int v) {
peelCount = v;
dontUnroll = false;
}
unsigned int getPeelCount() const { return peelCount; }
void setPartialCount(unsigned int v) {
partialCount = v;
dontUnroll = false;
}
unsigned int getPartialCount() const { return partialCount; }
protected:
TIntermNode* body; // code to loop over
TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops
......@@ -1144,6 +1171,11 @@ protected:
bool unroll; // true if unroll requested
bool dontUnroll; // true if request to not unroll
unsigned int dependency; // loop dependency hint; 0 means not set or unknown
unsigned int minIterations; // as per the SPIR-V specification
unsigned int maxIterations; // as per the SPIR-V specification
unsigned int iterationMultiple; // as per the SPIR-V specification
unsigned int peelCount; // as per the SPIR-V specification
unsigned int partialCount; // as per the SPIR-V specification
};
//
......
// This header is generated by the make-revision script.
#define GLSLANG_PATCH_LEVEL 3216
#define GLSLANG_PATCH_LEVEL 3226
......@@ -52,6 +52,7 @@ bool TAttributeArgs::getInt(int& value, int argNum) const
return true;
}
// extract strings out of attribute arguments stored in attribute aggregate.
// convert to lower case if converToLower is true (for case-insensitive compare convenience)
bool TAttributeArgs::getString(TString& value, int argNum, bool convertToLower) const
......@@ -110,6 +111,16 @@ TAttributeType TParseContext::attributeFromName(const TString& name) const
return EatDependencyInfinite;
else if (name == "dependency_length")
return EatDependencyLength;
else if (name == "min_iterations")
return EatMinIterations;
else if (name == "max_iterations")
return EatMaxIterations;
else if (name == "iteration_multiple")
return EatIterationMultiple;
else if (name == "peel_count")
return EatPeelCount;
else if (name == "partial_count")
return EatPartialCount;
else
return EatNone;
}
......@@ -225,29 +236,101 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN
}
for (auto it = attributes.begin(); it != attributes.end(); ++it) {
if (it->name != EatDependencyLength && it->size() > 0) {
warn(node->getLoc(), "attribute with arguments not recognized, skipping", "", "");
continue;
}
int value;
const auto noArgument = [&](const char* feature) {
if (it->size() > 0) {
warn(node->getLoc(), "expected no arguments", feature, "");
return false;
}
return true;
};
const auto positiveSignedArgument = [&](const char* feature, int& value) {
if (it->size() == 1 && it->getInt(value)) {
if (value <= 0) {
error(node->getLoc(), "must be positive", feature, "");
return false;
}
} else {
warn(node->getLoc(), "expected a single integer argument", feature, "");
return false;
}
return true;
};
const auto unsignedArgument = [&](const char* feature, unsigned int& uiValue) {
int value;
if (!(it->size() == 1 && it->getInt(value))) {
warn(node->getLoc(), "expected a single integer argument", feature, "");
return false;
}
uiValue = (unsigned int)value;
return true;
};
const auto positiveUnsignedArgument = [&](const char* feature, unsigned int& uiValue) {
int value;
if (it->size() == 1 && it->getInt(value)) {
if (value == 0) {
error(node->getLoc(), "must be greater than or equal to 1", feature, "");
return false;
}
} else {
warn(node->getLoc(), "expected a single integer argument", feature, "");
return false;
}
uiValue = (unsigned int)value;
return true;
};
const auto spirv14 = [&](const char* feature) {
if (spvVersion.spv > 0 && spvVersion.spv < EShTargetSpv_1_4)
warn(node->getLoc(), "attribute requires a SPIR-V 1.4 target-env", feature, "");
};
int value = 0;
unsigned uiValue = 0;
switch (it->name) {
case EatUnroll:
loop->setUnroll();
if (noArgument("unroll"))
loop->setUnroll();
break;
case EatLoop:
loop->setDontUnroll();
if (noArgument("dont_unroll"))
loop->setDontUnroll();
break;
case EatDependencyInfinite:
loop->setLoopDependency(TIntermLoop::dependencyInfinite);
if (noArgument("dependency_infinite"))
loop->setLoopDependency(TIntermLoop::dependencyInfinite);
break;
case EatDependencyLength:
if (it->size() == 1 && it->getInt(value)) {
if (value <= 0)
error(node->getLoc(), "must be positive", "dependency_length", "");
if (positiveSignedArgument("dependency_length", value))
loop->setLoopDependency(value);
} else
warn(node->getLoc(), "expected a single integer argument", "dependency_length", "");
break;
case EatMinIterations:
spirv14("min_iterations");
if (unsignedArgument("min_iterations", uiValue))
loop->setMinIterations(uiValue);
break;
case EatMaxIterations:
spirv14("max_iterations");
if (unsignedArgument("max_iterations", uiValue))
loop->setMaxIterations(uiValue);
break;
case EatIterationMultiple:
spirv14("iteration_multiple");
if (positiveUnsignedArgument("iteration_multiple", uiValue))
loop->setIterationMultiple(uiValue);
break;
case EatPeelCount:
spirv14("peel_count");
if (unsignedArgument("peel_count", uiValue))
loop->setPeelCount(uiValue);
break;
case EatPartialCount:
spirv14("partial_count");
if (unsignedArgument("partial_count", uiValue))
loop->setPartialCount(uiValue);
break;
default:
warn(node->getLoc(), "attribute does not apply to a loop", "", "");
......
......@@ -71,7 +71,12 @@ namespace glslang {
EatPushConstant,
EatConstantId,
EatDependencyInfinite,
EatDependencyLength
EatDependencyLength,
EatMinIterations,
EatMaxIterations,
EatIterationMultiple,
EatPeelCount,
EatPartialCount
};
class TIntermAggregate;
......
......@@ -68,7 +68,7 @@
// This should always increase, as some paths to do not consume
// a more major number.
// It should increment by one when new functionality is added.
#define GLSLANG_MINOR_VERSION 11
#define GLSLANG_MINOR_VERSION 12
//
// Call before doing any other compiler/linker operations.
......
......@@ -48,7 +48,7 @@ using CompileToAstTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
TEST_P(CompileToAstTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::AST);
}
......@@ -57,7 +57,7 @@ TEST_P(CompileToAstTest, FromFile)
TEST_P(CompileToAstTestNV, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::AST);
}
#endif
......
......@@ -70,14 +70,14 @@ using HlslLegalDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPoi
TEST_P(HlslCompileTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::BothASTAndSpv, true, GetParam().entryPoint);
}
TEST_P(HlslVulkan1_1CompileTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
Target::BothASTAndSpv, true, GetParam().entryPoint);
}
......@@ -93,7 +93,7 @@ TEST_P(HlslCompileAndFlattenTest, FromFile)
TEST_P(HlslLegalizeTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv, true, GetParam().entryPoint,
"/baseLegalResults/", true);
}
......@@ -103,7 +103,7 @@ TEST_P(HlslLegalizeTest, FromFile)
TEST_P(HlslDebugTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv, true, GetParam().entryPoint,
"/baseResults/", false, true);
}
......@@ -111,7 +111,8 @@ TEST_P(HlslDebugTest, FromFile)
TEST_P(HlslDX9CompatibleTest, FromFile)
{
loadFileCompileAndCheckWithOptions(GlobalTestSettings.testRoot, GetParam().fileName, Source::HLSL,
Semantics::Vulkan, glslang::EShTargetVulkan_1_0, Target::BothASTAndSpv, true,
Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::BothASTAndSpv, true,
GetParam().entryPoint, "/baseResults/",
EShMessages::EShMsgHlslDX9Compatible);
}
......@@ -122,7 +123,7 @@ TEST_P(HlslDX9CompatibleTest, FromFile)
TEST_P(HlslLegalDebugTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv, true, GetParam().entryPoint,
"/baseResults/", true, true);
}
......
......@@ -65,6 +65,7 @@ std::string FileNameAsCustomTestSuffixIoMap(
using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
......@@ -84,7 +85,7 @@ using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::t
TEST_P(CompileVulkanToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv);
}
......@@ -94,7 +95,7 @@ TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan,
glslang::EShTargetVulkan_1_0,
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv, true, "",
"/baseResults/", false, true);
}
......@@ -102,7 +103,14 @@ TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1,
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_3,
Target::Spv);
}
TEST_P(CompileToSpirv14Test, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, glslang::EShTargetSpv_1_4,
Target::Spv);
}
......@@ -111,7 +119,7 @@ TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
TEST_P(CompileOpenGLToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv);
}
......@@ -120,7 +128,7 @@ TEST_P(CompileOpenGLToSpirvTest, FromFile)
TEST_P(VulkanSemantics, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv, false);
}
......@@ -129,7 +137,7 @@ TEST_P(VulkanSemantics, FromFile)
TEST_P(OpenGLSemantics, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv, false);
}
......@@ -137,7 +145,7 @@ TEST_P(OpenGLSemantics, FromFile)
TEST_P(VulkanAstSemantics, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::AST);
}
......@@ -177,7 +185,7 @@ TEST_P(GlslIoMap, FromFile)
TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv);
}
#endif
......@@ -188,7 +196,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
TEST_P(CompileVulkanToSpirvTestNV, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv);
}
#endif
......@@ -455,6 +463,24 @@ INSTANTIATE_TEST_CASE_P(
// clang-format off
INSTANTIATE_TEST_CASE_P(
Glsl, CompileToSpirv14Test,
::testing::ValuesIn(std::vector<std::string>({
"spv.1.4.LoopControl.frag",
"spv.1.4.NonWritable.frag",
"spv.1.4.OpEntryPoint.frag",
"spv.1.4.OpSelect.frag",
"spv.1.4.OpCopyLogical.comp",
"spv.1.4.OpCopyLogicalBool.comp",
"spv.1.4.OpCopyLogical.funcall.frag",
"spv.1.4.image.frag",
"spv.1.4.sparseTexture.frag",
"spv.1.4.texture.frag",
})),
FileNameAsCustomTestSuffix
);
// clang-format off
INSTANTIATE_TEST_CASE_P(
Hlsl, HlslIoMap,
::testing::ValuesIn(std::vector<IoMapData>{
{ "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
......
......@@ -212,6 +212,7 @@ public:
const std::string& shaderName, const std::string& code,
const std::string& entryPointName, EShMessages controls,
glslang::EShTargetClientVersion clientTargetVersion,
glslang::EShTargetLanguageVersion targetLanguageVersion,
bool flattenUniformArrays = false,
EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
bool enableOptimizer = false,
......@@ -234,9 +235,7 @@ public:
: glslang::EShSourceGlsl,
stage, glslang::EShClientVulkan, 100);
shader.setEnvClient(glslang::EShClientVulkan, clientTargetVersion);
shader.setEnvTarget(glslang::EShTargetSpv,
clientTargetVersion == glslang::EShTargetVulkan_1_1 ? glslang::EShTargetSpv_1_3
: glslang::EShTargetSpv_1_0);
shader.setEnvTarget(glslang::EShTargetSpv, targetLanguageVersion);
} else {
shader.setEnvInput((controls & EShMsgReadHlsl) ? glslang::EShSourceHlsl
: glslang::EShSourceGlsl,
......@@ -429,6 +428,7 @@ public:
Source source,
Semantics semantics,
glslang::EShTargetClientVersion clientTargetVersion,
glslang::EShTargetLanguageVersion targetLanguageVersion,
Target target,
bool automap = true,
const std::string& entryPointName="",
......@@ -449,8 +449,8 @@ public:
controls = static_cast<EShMessages>(controls & ~EShMsgHlslLegalization);
if (enableDebug)
controls = static_cast<EShMessages>(controls | EShMsgDebugInfo);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion, false,
EShTexSampTransKeep, enableOptimizer, enableDebug, automap);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion,
targetLanguageVersion, false, EShTexSampTransKeep, enableOptimizer, enableDebug, automap);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;
......@@ -460,11 +460,12 @@ public:
expectedOutputFname, result.spirvWarningsErrors);
}
void loadFileCompileAndCheckWithOptions(const std::string &testDir,
const std::string &testName,
Source source,
Semantics semantics,
glslang::EShTargetClientVersion clientTargetVersion,
void loadFileCompileAndCheckWithOptions(const std::string &testDir,
const std::string &testName,
Source source,
Semantics semantics,
glslang::EShTargetClientVersion clientTargetVersion,
glslang::EShTargetLanguageVersion targetLanguageVersion,
Target target, bool automap = true, const std::string &entryPointName = "",
const std::string &baseDir = "/baseResults/",
const EShMessages additionalOptions = EShMessages::EShMsgDefault)
......@@ -478,15 +479,15 @@ public:
EShMessages controls = DeriveOptions(source, semantics, target);
controls = static_cast<EShMessages>(controls | additionalOptions);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion, false,
EShTexSampTransKeep, false, automap);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion,
targetLanguageVersion, false, EShTexSampTransKeep, false, automap);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;
outputResultToStream(&stream, result, controls);
checkEqAndUpdateIfRequested(expectedOutput, stream.str(), expectedOutputFname);
}
}
void loadFileCompileFlattenUniformsAndCheck(const std::string& testDir,
const std::string& testName,
......@@ -505,7 +506,7 @@ public:
const EShMessages controls = DeriveOptions(source, semantics, target);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls,
glslang::EShTargetVulkan_1_0, true);
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, true);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;
......@@ -675,7 +676,7 @@ public:
const EShMessages controls = DeriveOptions(source, semantics, target);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls,
glslang::EShTargetVulkan_1_0, false,
glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, false,
EShTexSampTransUpgradeTextureRemoveSampler);
// Generate the hybrid output in the way of glslangValidator.
......
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