From 9fd0fcd737f1369e89fb3aa8b2e62bad57ac46c6 Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Tue, 13 Feb 2024 13:45:26 +0000 Subject: [PATCH] Add GL_EXT_expect_assume support Signed-off-by: Sven van Haastregt --- SPIRV/GLSL.ext.KHR.h | 1 + SPIRV/GlslangToSpv.cpp | 15 + SPIRV/doc.cpp | 2 + .../spv.expect_assume.assumeEXT.comp.out | 47 ++ .../spv.expect_assume.expectEXT.comp.out | 276 +++++++ ....expect_assume.expectEXT.exttypes.comp.out | 689 ++++++++++++++++++ Test/spv.expect_assume.assumeEXT.comp | 13 + Test/spv.expect_assume.expectEXT.comp | 43 ++ .../spv.expect_assume.expectEXT.exttypes.comp | 101 +++ glslang/Include/intermediate.h | 4 + glslang/MachineIndependent/Initialize.cpp | 63 ++ glslang/MachineIndependent/Versions.cpp | 1 + glslang/MachineIndependent/Versions.h | 1 + gtests/Spv.FromFile.cpp | 3 + 14 files changed, 1259 insertions(+) create mode 100644 Test/baseResults/spv.expect_assume.assumeEXT.comp.out create mode 100644 Test/baseResults/spv.expect_assume.expectEXT.comp.out create mode 100644 Test/baseResults/spv.expect_assume.expectEXT.exttypes.comp.out create mode 100644 Test/spv.expect_assume.assumeEXT.comp create mode 100644 Test/spv.expect_assume.expectEXT.comp create mode 100644 Test/spv.expect_assume.expectEXT.exttypes.comp diff --git a/SPIRV/GLSL.ext.KHR.h b/SPIRV/GLSL.ext.KHR.h index b72aeaf9c..1d3af1403 100644 --- a/SPIRV/GLSL.ext.KHR.h +++ b/SPIRV/GLSL.ext.KHR.h @@ -60,5 +60,6 @@ static const char* const E_SPV_KHR_ray_tracing_position_fetch = "SPV_KHR_ray_t static const char* const E_SPV_KHR_cooperative_matrix = "SPV_KHR_cooperative_matrix"; static const char* const E_SPV_KHR_maximal_reconvergence = "SPV_KHR_maximal_reconvergence"; static const char* const E_SPV_KHR_subgroup_rotate = "SPV_KHR_subgroup_rotate"; +static const char* const E_SPV_KHR_expect_assume = "SPV_KHR_expect_assume"; #endif // #ifndef GLSLextKHR_H diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 309b4079f..1d375ef25 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -2785,6 +2785,11 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI return false; + case glslang::EOpAssumeEXT: + builder.addCapability(spv::CapabilityExpectAssumeKHR); + builder.addExtension(spv::E_SPV_KHR_expect_assume); + builder.createNoResultOp(spv::OpAssumeTrueKHR, operand); + return false; case glslang::EOpEmitStreamVertex: builder.createNoResultOp(spv::OpEmitStreamVertex, operand); return false; @@ -3246,6 +3251,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt binOp = node->getOp(); break; + case glslang::EOpExpectEXT: + builder.addCapability(spv::CapabilityExpectAssumeKHR); + builder.addExtension(spv::E_SPV_KHR_expect_assume); + binOp = node->getOp(); + break; + case glslang::EOpIgnoreIntersectionNV: case glslang::EOpTerminateRayNV: case glslang::EOpTraceNV: @@ -6591,6 +6602,10 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD binOp = isUnsigned ? spv::OpUMul32x16INTEL : spv::OpIMul32x16INTEL; break; + case glslang::EOpExpectEXT: + binOp = spv::OpExpectKHR; + break; + case glslang::EOpLessThan: case glslang::EOpGreaterThan: case glslang::EOpLessThanEqual: diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index da9db9423..5839a9995 100755 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -1043,6 +1043,8 @@ const char* CapabilityString(int info) case CapabilityIntegerFunctions2INTEL: return "CapabilityIntegerFunctions2INTEL"; + case CapabilityExpectAssumeKHR: return "ExpectAssumeKHR"; + case CapabilityAtomicFloat16AddEXT: return "AtomicFloat16AddEXT"; case CapabilityAtomicFloat32AddEXT: return "AtomicFloat32AddEXT"; case CapabilityAtomicFloat64AddEXT: return "AtomicFloat64AddEXT"; diff --git a/Test/baseResults/spv.expect_assume.assumeEXT.comp.out b/Test/baseResults/spv.expect_assume.assumeEXT.comp.out new file mode 100644 index 000000000..517103f08 --- /dev/null +++ b/Test/baseResults/spv.expect_assume.assumeEXT.comp.out @@ -0,0 +1,47 @@ +spv.expect_assume.assumeEXT.comp +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 22 + + Capability Shader + Capability ExpectAssumeKHR + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 8 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_expect_assume" + Name 4 "main" + Name 7 "roblock" + MemberName 7(roblock) 0 "i" + Name 9 "ro" + MemberDecorate 7(roblock) 0 NonWritable + MemberDecorate 7(roblock) 0 Offset 0 + Decorate 7(roblock) BufferBlock + Decorate 9(ro) DescriptorSet 0 + Decorate 9(ro) Binding 0 + Decorate 21 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7(roblock): TypeStruct 6(int) + 8: TypePointer Uniform 7(roblock) + 9(ro): 8(ptr) Variable Uniform + 10: 6(int) Constant 0 + 11: TypePointer Uniform 6(int) + 14: 6(int) Constant 42 + 15: TypeBool + 17: TypeInt 32 0 + 18: TypeVector 17(int) 3 + 19: 17(int) Constant 8 + 20: 17(int) Constant 1 + 21: 18(ivec3) ConstantComposite 19 20 20 + 4(main): 2 Function None 3 + 5: Label + 12: 11(ptr) AccessChain 9(ro) 10 + 13: 6(int) Load 12 + 16: 15(bool) SGreaterThan 13 14 + AssumeTrueKHR 16 + Return + FunctionEnd diff --git a/Test/baseResults/spv.expect_assume.expectEXT.comp.out b/Test/baseResults/spv.expect_assume.expectEXT.comp.out new file mode 100644 index 000000000..ee4fdf618 --- /dev/null +++ b/Test/baseResults/spv.expect_assume.expectEXT.comp.out @@ -0,0 +1,276 @@ +spv.expect_assume.expectEXT.comp +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 178 + + Capability Shader + Capability ExpectAssumeKHR + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 8 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_expect_assume" + Name 4 "main" + Name 8 "x" + Name 18 "roblock" + MemberName 18(roblock) 0 "b" + MemberName 18(roblock) 1 "bv2" + MemberName 18(roblock) 2 "bv3" + MemberName 18(roblock) 3 "bv4" + MemberName 18(roblock) 4 "i" + MemberName 18(roblock) 5 "iv2" + MemberName 18(roblock) 6 "iv3" + MemberName 18(roblock) 7 "iv4" + MemberName 18(roblock) 8 "ui" + MemberName 18(roblock) 9 "uv2" + MemberName 18(roblock) 10 "uv3" + MemberName 18(roblock) 11 "uv4" + Name 20 "ro" + MemberDecorate 18(roblock) 0 NonWritable + MemberDecorate 18(roblock) 0 Offset 0 + MemberDecorate 18(roblock) 1 NonWritable + MemberDecorate 18(roblock) 1 Offset 8 + MemberDecorate 18(roblock) 2 NonWritable + MemberDecorate 18(roblock) 2 Offset 16 + MemberDecorate 18(roblock) 3 NonWritable + MemberDecorate 18(roblock) 3 Offset 32 + MemberDecorate 18(roblock) 4 NonWritable + MemberDecorate 18(roblock) 4 Offset 48 + MemberDecorate 18(roblock) 5 NonWritable + MemberDecorate 18(roblock) 5 Offset 56 + MemberDecorate 18(roblock) 6 NonWritable + MemberDecorate 18(roblock) 6 Offset 64 + MemberDecorate 18(roblock) 7 NonWritable + MemberDecorate 18(roblock) 7 Offset 80 + MemberDecorate 18(roblock) 8 NonWritable + MemberDecorate 18(roblock) 8 Offset 96 + MemberDecorate 18(roblock) 9 NonWritable + MemberDecorate 18(roblock) 9 Offset 104 + MemberDecorate 18(roblock) 10 NonWritable + MemberDecorate 18(roblock) 10 Offset 112 + MemberDecorate 18(roblock) 11 NonWritable + MemberDecorate 18(roblock) 11 Offset 128 + Decorate 18(roblock) BufferBlock + Decorate 20(ro) DescriptorSet 0 + Decorate 20(ro) Binding 0 + Decorate 177 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Function 6(int) + 9: 6(int) Constant 0 + 10: TypeBool + 11: TypeInt 32 0 + 12: TypeVector 11(int) 2 + 13: TypeVector 11(int) 3 + 14: TypeVector 11(int) 4 + 15: TypeVector 6(int) 2 + 16: TypeVector 6(int) 3 + 17: TypeVector 6(int) 4 + 18(roblock): TypeStruct 11(int) 12(ivec2) 13(ivec3) 14(ivec4) 6(int) 15(ivec2) 16(ivec3) 17(ivec4) 11(int) 12(ivec2) 13(ivec3) 14(ivec4) + 19: TypePointer Uniform 18(roblock) + 20(ro): 19(ptr) Variable Uniform + 21: TypePointer Uniform 11(int) + 24: 11(int) Constant 0 + 26: 10(bool) ConstantTrue + 32: 6(int) Constant 1 + 33: TypePointer Uniform 12(ivec2) + 36: TypeVector 10(bool) 2 + 37: 12(ivec2) ConstantComposite 24 24 + 39: 10(bool) ConstantFalse + 40: 36(bvec2) ConstantComposite 26 39 + 48: 6(int) Constant 2 + 49: TypePointer Uniform 13(ivec3) + 52: TypeVector 10(bool) 3 + 53: 13(ivec3) ConstantComposite 24 24 24 + 55: 52(bvec3) ConstantComposite 26 39 26 + 63: 6(int) Constant 3 + 64: TypePointer Uniform 14(ivec4) + 67: TypeVector 10(bool) 4 + 68: 14(ivec4) ConstantComposite 24 24 24 24 + 70: 67(bvec4) ConstantComposite 39 26 39 26 + 79: 6(int) Constant 4 + 80: TypePointer Uniform 6(int) + 83: 6(int) Constant 10 + 89: 6(int) Constant 5 + 90: TypePointer Uniform 15(ivec2) + 93: 6(int) Constant 11 + 94: 6(int) Constant 4294967274 + 95: 15(ivec2) ConstantComposite 93 94 + 103: 6(int) Constant 6 + 104: TypePointer Uniform 16(ivec3) + 107: 6(int) Constant 33 + 108: 16(ivec3) ConstantComposite 93 94 107 + 116: 6(int) Constant 7 + 117: TypePointer Uniform 17(ivec4) + 120: 6(int) Constant 44 + 121: 17(ivec4) ConstantComposite 93 94 107 120 + 130: 6(int) Constant 8 + 133: 11(int) Constant 10 + 139: 6(int) Constant 9 + 142: 11(int) Constant 11 + 143: 11(int) Constant 22 + 144: 12(ivec2) ConstantComposite 142 143 + 154: 11(int) Constant 33 + 155: 13(ivec3) ConstantComposite 142 143 154 + 165: 11(int) Constant 44 + 166: 14(ivec4) ConstantComposite 142 143 154 165 + 175: 11(int) Constant 8 + 176: 11(int) Constant 1 + 177: 13(ivec3) ConstantComposite 175 176 176 + 4(main): 2 Function None 3 + 5: Label + 8(x): 7(ptr) Variable Function + Store 8(x) 9 + 22: 21(ptr) AccessChain 20(ro) 9 + 23: 11(int) Load 22 + 25: 10(bool) INotEqual 23 24 + 27: 10(bool) ExpectKHR 25 26 + 28: 10(bool) LogicalEqual 27 26 + 29: 10(bool) LogicalNot 28 + SelectionMerge 31 None + BranchConditional 29 30 31 + 30: Label + 34: 33(ptr) AccessChain 20(ro) 32 + 35: 12(ivec2) Load 34 + 38: 36(bvec2) INotEqual 35 37 + 41: 36(bvec2) ExpectKHR 38 40 + 42: 36(bvec2) LogicalEqual 41 40 + 43: 10(bool) All 42 + Branch 31 + 31: Label + 44: 10(bool) Phi 28 5 43 30 + 45: 10(bool) LogicalNot 44 + SelectionMerge 47 None + BranchConditional 45 46 47 + 46: Label + 50: 49(ptr) AccessChain 20(ro) 48 + 51: 13(ivec3) Load 50 + 54: 52(bvec3) INotEqual 51 53 + 56: 52(bvec3) ExpectKHR 54 55 + 57: 52(bvec3) LogicalEqual 56 55 + 58: 10(bool) All 57 + Branch 47 + 47: Label + 59: 10(bool) Phi 44 31 58 46 + 60: 10(bool) LogicalNot 59 + SelectionMerge 62 None + BranchConditional 60 61 62 + 61: Label + 65: 64(ptr) AccessChain 20(ro) 63 + 66: 14(ivec4) Load 65 + 69: 67(bvec4) INotEqual 66 68 + 71: 67(bvec4) ExpectKHR 69 70 + 72: 67(bvec4) LogicalEqual 71 70 + 73: 10(bool) All 72 + Branch 62 + 62: Label + 74: 10(bool) Phi 59 47 73 61 + SelectionMerge 76 None + BranchConditional 74 75 76 + 75: Label + 77: 6(int) Load 8(x) + 78: 6(int) IAdd 77 32 + Store 8(x) 78 + Branch 76 + 76: Label + 81: 80(ptr) AccessChain 20(ro) 79 + 82: 6(int) Load 81 + 84: 6(int) ExpectKHR 82 83 + 85: 10(bool) IEqual 84 83 + 86: 10(bool) LogicalNot 85 + SelectionMerge 88 None + BranchConditional 86 87 88 + 87: Label + 91: 90(ptr) AccessChain 20(ro) 89 + 92: 15(ivec2) Load 91 + 96: 15(ivec2) ExpectKHR 92 95 + 97: 36(bvec2) IEqual 96 95 + 98: 10(bool) All 97 + Branch 88 + 88: Label + 99: 10(bool) Phi 85 76 98 87 + 100: 10(bool) LogicalNot 99 + SelectionMerge 102 None + BranchConditional 100 101 102 + 101: Label + 105: 104(ptr) AccessChain 20(ro) 103 + 106: 16(ivec3) Load 105 + 109: 16(ivec3) ExpectKHR 106 108 + 110: 52(bvec3) IEqual 109 108 + 111: 10(bool) All 110 + Branch 102 + 102: Label + 112: 10(bool) Phi 99 88 111 101 + 113: 10(bool) LogicalNot 112 + SelectionMerge 115 None + BranchConditional 113 114 115 + 114: Label + 118: 117(ptr) AccessChain 20(ro) 116 + 119: 17(ivec4) Load 118 + 122: 17(ivec4) ExpectKHR 119 121 + 123: 67(bvec4) IEqual 122 121 + 124: 10(bool) All 123 + Branch 115 + 115: Label + 125: 10(bool) Phi 112 102 124 114 + SelectionMerge 127 None + BranchConditional 125 126 127 + 126: Label + 128: 6(int) Load 8(x) + 129: 6(int) IAdd 128 32 + Store 8(x) 129 + Branch 127 + 127: Label + 131: 21(ptr) AccessChain 20(ro) 130 + 132: 11(int) Load 131 + 134: 11(int) ExpectKHR 132 133 + 135: 10(bool) IEqual 134 133 + 136: 10(bool) LogicalNot 135 + SelectionMerge 138 None + BranchConditional 136 137 138 + 137: Label + 140: 33(ptr) AccessChain 20(ro) 139 + 141: 12(ivec2) Load 140 + 145: 12(ivec2) ExpectKHR 141 144 + 146: 36(bvec2) IEqual 145 144 + 147: 10(bool) All 146 + Branch 138 + 138: Label + 148: 10(bool) Phi 135 127 147 137 + 149: 10(bool) LogicalNot 148 + SelectionMerge 151 None + BranchConditional 149 150 151 + 150: Label + 152: 49(ptr) AccessChain 20(ro) 83 + 153: 13(ivec3) Load 152 + 156: 13(ivec3) ExpectKHR 153 155 + 157: 52(bvec3) IEqual 156 155 + 158: 10(bool) All 157 + Branch 151 + 151: Label + 159: 10(bool) Phi 148 138 158 150 + 160: 10(bool) LogicalNot 159 + SelectionMerge 162 None + BranchConditional 160 161 162 + 161: Label + 163: 64(ptr) AccessChain 20(ro) 93 + 164: 14(ivec4) Load 163 + 167: 14(ivec4) ExpectKHR 164 166 + 168: 67(bvec4) IEqual 167 166 + 169: 10(bool) All 168 + Branch 162 + 162: Label + 170: 10(bool) Phi 159 151 169 161 + SelectionMerge 172 None + BranchConditional 170 171 172 + 171: Label + 173: 6(int) Load 8(x) + 174: 6(int) IAdd 173 32 + Store 8(x) 174 + Branch 172 + 172: Label + Return + FunctionEnd diff --git a/Test/baseResults/spv.expect_assume.expectEXT.exttypes.comp.out b/Test/baseResults/spv.expect_assume.expectEXT.exttypes.comp.out new file mode 100644 index 000000000..6647f0c6a --- /dev/null +++ b/Test/baseResults/spv.expect_assume.expectEXT.exttypes.comp.out @@ -0,0 +1,689 @@ +spv.expect_assume.expectEXT.exttypes.comp +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 458 + + Capability Shader + Capability Int64 + Capability Int16 + Capability Int8 + Capability StorageUniformBufferBlock16 + Capability UniformAndStorageBuffer8BitAccess + Capability ExpectAssumeKHR + Extension "SPV_KHR_16bit_storage" + Extension "SPV_KHR_8bit_storage" + Extension "SPV_KHR_expect_assume" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 8 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_expect_assume" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + Name 4 "main" + Name 8 "x" + Name 42 "roblock" + MemberName 42(roblock) 0 "i8" + MemberName 42(roblock) 1 "i8v2" + MemberName 42(roblock) 2 "i8v3" + MemberName 42(roblock) 3 "i8v4" + MemberName 42(roblock) 4 "u8" + MemberName 42(roblock) 5 "u8v2" + MemberName 42(roblock) 6 "u8v3" + MemberName 42(roblock) 7 "u8v4" + MemberName 42(roblock) 8 "i16" + MemberName 42(roblock) 9 "i16v2" + MemberName 42(roblock) 10 "i16v3" + MemberName 42(roblock) 11 "i16v4" + MemberName 42(roblock) 12 "u16" + MemberName 42(roblock) 13 "u16v2" + MemberName 42(roblock) 14 "u16v3" + MemberName 42(roblock) 15 "u16v4" + MemberName 42(roblock) 16 "i32" + MemberName 42(roblock) 17 "i32v2" + MemberName 42(roblock) 18 "i32v3" + MemberName 42(roblock) 19 "i32v4" + MemberName 42(roblock) 20 "u32" + MemberName 42(roblock) 21 "u32v2" + MemberName 42(roblock) 22 "u32v3" + MemberName 42(roblock) 23 "u32v4" + MemberName 42(roblock) 24 "i64" + MemberName 42(roblock) 25 "i64v2" + MemberName 42(roblock) 26 "i64v3" + MemberName 42(roblock) 27 "i64v4" + MemberName 42(roblock) 28 "u64" + MemberName 42(roblock) 29 "u64v2" + MemberName 42(roblock) 30 "u64v3" + MemberName 42(roblock) 31 "u64v4" + Name 44 "ro" + MemberDecorate 42(roblock) 0 NonWritable + MemberDecorate 42(roblock) 0 Offset 0 + MemberDecorate 42(roblock) 1 NonWritable + MemberDecorate 42(roblock) 1 Offset 2 + MemberDecorate 42(roblock) 2 NonWritable + MemberDecorate 42(roblock) 2 Offset 4 + MemberDecorate 42(roblock) 3 NonWritable + MemberDecorate 42(roblock) 3 Offset 8 + MemberDecorate 42(roblock) 4 NonWritable + MemberDecorate 42(roblock) 4 Offset 12 + MemberDecorate 42(roblock) 5 NonWritable + MemberDecorate 42(roblock) 5 Offset 14 + MemberDecorate 42(roblock) 6 NonWritable + MemberDecorate 42(roblock) 6 Offset 16 + MemberDecorate 42(roblock) 7 NonWritable + MemberDecorate 42(roblock) 7 Offset 20 + MemberDecorate 42(roblock) 8 NonWritable + MemberDecorate 42(roblock) 8 Offset 24 + MemberDecorate 42(roblock) 9 NonWritable + MemberDecorate 42(roblock) 9 Offset 28 + MemberDecorate 42(roblock) 10 NonWritable + MemberDecorate 42(roblock) 10 Offset 32 + MemberDecorate 42(roblock) 11 NonWritable + MemberDecorate 42(roblock) 11 Offset 40 + MemberDecorate 42(roblock) 12 NonWritable + MemberDecorate 42(roblock) 12 Offset 48 + MemberDecorate 42(roblock) 13 NonWritable + MemberDecorate 42(roblock) 13 Offset 52 + MemberDecorate 42(roblock) 14 NonWritable + MemberDecorate 42(roblock) 14 Offset 56 + MemberDecorate 42(roblock) 15 NonWritable + MemberDecorate 42(roblock) 15 Offset 64 + MemberDecorate 42(roblock) 16 NonWritable + MemberDecorate 42(roblock) 16 Offset 72 + MemberDecorate 42(roblock) 17 NonWritable + MemberDecorate 42(roblock) 17 Offset 80 + MemberDecorate 42(roblock) 18 NonWritable + MemberDecorate 42(roblock) 18 Offset 96 + MemberDecorate 42(roblock) 19 NonWritable + MemberDecorate 42(roblock) 19 Offset 112 + MemberDecorate 42(roblock) 20 NonWritable + MemberDecorate 42(roblock) 20 Offset 128 + MemberDecorate 42(roblock) 21 NonWritable + MemberDecorate 42(roblock) 21 Offset 136 + MemberDecorate 42(roblock) 22 NonWritable + MemberDecorate 42(roblock) 22 Offset 144 + MemberDecorate 42(roblock) 23 NonWritable + MemberDecorate 42(roblock) 23 Offset 160 + MemberDecorate 42(roblock) 24 NonWritable + MemberDecorate 42(roblock) 24 Offset 176 + MemberDecorate 42(roblock) 25 NonWritable + MemberDecorate 42(roblock) 25 Offset 192 + MemberDecorate 42(roblock) 26 NonWritable + MemberDecorate 42(roblock) 26 Offset 224 + MemberDecorate 42(roblock) 27 NonWritable + MemberDecorate 42(roblock) 27 Offset 256 + MemberDecorate 42(roblock) 28 NonWritable + MemberDecorate 42(roblock) 28 Offset 288 + MemberDecorate 42(roblock) 29 NonWritable + MemberDecorate 42(roblock) 29 Offset 304 + MemberDecorate 42(roblock) 30 NonWritable + MemberDecorate 42(roblock) 30 Offset 320 + MemberDecorate 42(roblock) 31 NonWritable + MemberDecorate 42(roblock) 31 Offset 352 + Decorate 42(roblock) BufferBlock + Decorate 44(ro) DescriptorSet 0 + Decorate 44(ro) Binding 0 + Decorate 457 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Function 6(int) + 9: 6(int) Constant 0 + 10: TypeBool + 11: TypeInt 8 1 + 12: TypeVector 11(int8_t) 2 + 13: TypeVector 11(int8_t) 3 + 14: TypeVector 11(int8_t) 4 + 15: TypeInt 8 0 + 16: TypeVector 15(int8_t) 2 + 17: TypeVector 15(int8_t) 3 + 18: TypeVector 15(int8_t) 4 + 19: TypeInt 16 1 + 20: TypeVector 19(int16_t) 2 + 21: TypeVector 19(int16_t) 3 + 22: TypeVector 19(int16_t) 4 + 23: TypeInt 16 0 + 24: TypeVector 23(int16_t) 2 + 25: TypeVector 23(int16_t) 3 + 26: TypeVector 23(int16_t) 4 + 27: TypeVector 6(int) 2 + 28: TypeVector 6(int) 3 + 29: TypeVector 6(int) 4 + 30: TypeInt 32 0 + 31: TypeVector 30(int) 2 + 32: TypeVector 30(int) 3 + 33: TypeVector 30(int) 4 + 34: TypeInt 64 1 + 35: TypeVector 34(int64_t) 2 + 36: TypeVector 34(int64_t) 3 + 37: TypeVector 34(int64_t) 4 + 38: TypeInt 64 0 + 39: TypeVector 38(int64_t) 2 + 40: TypeVector 38(int64_t) 3 + 41: TypeVector 38(int64_t) 4 + 42(roblock): TypeStruct 11(int8_t) 12(i8vec2) 13(i8vec3) 14(i8vec4) 15(int8_t) 16(i8vec2) 17(i8vec3) 18(i8vec4) 19(int16_t) 20(i16vec2) 21(i16vec3) 22(i16vec4) 23(int16_t) 24(i16vec2) 25(i16vec3) 26(i16vec4) 6(int) 27(ivec2) 28(ivec3) 29(ivec4) 30(int) 31(ivec2) 32(ivec3) 33(ivec4) 34(int64_t) 35(i64vec2) 36(i64vec3) 37(i64vec4) 38(int64_t) 39(i64vec2) 40(i64vec3) 41(i64vec4) + 43: TypePointer Uniform 42(roblock) + 44(ro): 43(ptr) Variable Uniform + 45: TypePointer Uniform 11(int8_t) + 49: 6(int) Constant 10 + 55: 6(int) Constant 1 + 56: TypePointer Uniform 12(i8vec2) + 59: 11(int8_t) Constant 11 + 60: 11(int8_t) Constant 4294967274 + 61: 12(i8vec2) ConstantComposite 59 60 + 63: TypeVector 10(bool) 2 + 70: 6(int) Constant 2 + 71: TypePointer Uniform 13(i8vec3) + 74: 11(int8_t) Constant 33 + 75: 13(i8vec3) ConstantComposite 59 60 74 + 77: TypeVector 10(bool) 3 + 84: 6(int) Constant 3 + 85: TypePointer Uniform 14(i8vec4) + 88: 11(int8_t) Constant 44 + 89: 14(i8vec4) ConstantComposite 59 60 74 88 + 91: TypeVector 10(bool) 4 + 99: 6(int) Constant 4 + 100: TypePointer Uniform 15(int8_t) + 110: 6(int) Constant 5 + 111: TypePointer Uniform 16(i8vec2) + 114: 15(int8_t) Constant 11 + 115: 15(int8_t) Constant 22 + 116: 16(i8vec2) ConstantComposite 114 115 + 124: 6(int) Constant 6 + 125: TypePointer Uniform 17(i8vec3) + 128: 15(int8_t) Constant 33 + 129: 17(i8vec3) ConstantComposite 114 115 128 + 137: 6(int) Constant 7 + 138: TypePointer Uniform 18(i8vec4) + 141: 15(int8_t) Constant 44 + 142: 18(i8vec4) ConstantComposite 114 115 128 141 + 151: 6(int) Constant 8 + 152: TypePointer Uniform 19(int16_t) + 161: 6(int) Constant 9 + 162: TypePointer Uniform 20(i16vec2) + 165: 19(int16_t) Constant 11 + 166: 19(int16_t) Constant 4294967274 + 167: 20(i16vec2) ConstantComposite 165 166 + 175: TypePointer Uniform 21(i16vec3) + 178: 19(int16_t) Constant 33 + 179: 21(i16vec3) ConstantComposite 165 166 178 + 187: 6(int) Constant 11 + 188: TypePointer Uniform 22(i16vec4) + 191: 19(int16_t) Constant 44 + 192: 22(i16vec4) ConstantComposite 165 166 178 191 + 201: 6(int) Constant 12 + 202: TypePointer Uniform 23(int16_t) + 212: 6(int) Constant 13 + 213: TypePointer Uniform 24(i16vec2) + 216: 23(int16_t) Constant 11 + 217: 23(int16_t) Constant 22 + 218: 24(i16vec2) ConstantComposite 216 217 + 226: 6(int) Constant 14 + 227: TypePointer Uniform 25(i16vec3) + 230: 23(int16_t) Constant 33 + 231: 25(i16vec3) ConstantComposite 216 217 230 + 239: 6(int) Constant 15 + 240: TypePointer Uniform 26(i16vec4) + 243: 23(int16_t) Constant 44 + 244: 26(i16vec4) ConstantComposite 216 217 230 243 + 253: 6(int) Constant 16 + 254: TypePointer Uniform 6(int) + 262: 6(int) Constant 17 + 263: TypePointer Uniform 27(ivec2) + 266: 6(int) Constant 4294967274 + 267: 27(ivec2) ConstantComposite 187 266 + 275: 6(int) Constant 18 + 276: TypePointer Uniform 28(ivec3) + 279: 6(int) Constant 33 + 280: 28(ivec3) ConstantComposite 187 266 279 + 288: 6(int) Constant 19 + 289: TypePointer Uniform 29(ivec4) + 292: 6(int) Constant 44 + 293: 29(ivec4) ConstantComposite 187 266 279 292 + 302: 6(int) Constant 20 + 303: TypePointer Uniform 30(int) + 306: 30(int) Constant 10 + 312: 6(int) Constant 21 + 313: TypePointer Uniform 31(ivec2) + 316: 30(int) Constant 11 + 317: 30(int) Constant 22 + 318: 31(ivec2) ConstantComposite 316 317 + 326: 6(int) Constant 22 + 327: TypePointer Uniform 32(ivec3) + 330: 30(int) Constant 33 + 331: 32(ivec3) ConstantComposite 316 317 330 + 339: 6(int) Constant 23 + 340: TypePointer Uniform 33(ivec4) + 343: 30(int) Constant 44 + 344: 33(ivec4) ConstantComposite 316 317 330 343 + 353: 6(int) Constant 24 + 354: TypePointer Uniform 34(int64_t) + 357: 34(int64_t) Constant 10 0 + 363: 6(int) Constant 25 + 364: TypePointer Uniform 35(i64vec2) + 367: 34(int64_t) Constant 11 0 + 368: 34(int64_t) Constant 4294967274 4294967295 + 369: 35(i64vec2) ConstantComposite 367 368 + 377: 6(int) Constant 26 + 378: TypePointer Uniform 36(i64vec3) + 381: 34(int64_t) Constant 33 0 + 382: 36(i64vec3) ConstantComposite 367 368 381 + 390: 6(int) Constant 27 + 391: TypePointer Uniform 37(i64vec4) + 394: 34(int64_t) Constant 44 0 + 395: 37(i64vec4) ConstantComposite 367 368 381 394 + 404: 6(int) Constant 28 + 405: TypePointer Uniform 38(int64_t) + 408: 38(int64_t) Constant 10 0 + 414: 6(int) Constant 29 + 415: TypePointer Uniform 39(i64vec2) + 418: 38(int64_t) Constant 11 0 + 419: 38(int64_t) Constant 22 0 + 420: 39(i64vec2) ConstantComposite 418 419 + 428: 6(int) Constant 30 + 429: TypePointer Uniform 40(i64vec3) + 432: 38(int64_t) Constant 33 0 + 433: 40(i64vec3) ConstantComposite 418 419 432 + 441: 6(int) Constant 31 + 442: TypePointer Uniform 41(i64vec4) + 445: 38(int64_t) Constant 44 0 + 446: 41(i64vec4) ConstantComposite 418 419 432 445 + 455: 30(int) Constant 8 + 456: 30(int) Constant 1 + 457: 32(ivec3) ConstantComposite 455 456 456 + 4(main): 2 Function None 3 + 5: Label + 8(x): 7(ptr) Variable Function + Store 8(x) 9 + 46: 45(ptr) AccessChain 44(ro) 9 + 47: 11(int8_t) Load 46 + 48: 6(int) SConvert 47 + 50: 6(int) ExpectKHR 48 49 + 51: 10(bool) IEqual 50 49 + 52: 10(bool) LogicalNot 51 + SelectionMerge 54 None + BranchConditional 52 53 54 + 53: Label + 57: 56(ptr) AccessChain 44(ro) 55 + 58: 12(i8vec2) Load 57 + 62: 12(i8vec2) ExpectKHR 58 61 + 64: 63(bvec2) IEqual 62 61 + 65: 10(bool) All 64 + Branch 54 + 54: Label + 66: 10(bool) Phi 51 5 65 53 + 67: 10(bool) LogicalNot 66 + SelectionMerge 69 None + BranchConditional 67 68 69 + 68: Label + 72: 71(ptr) AccessChain 44(ro) 70 + 73: 13(i8vec3) Load 72 + 76: 13(i8vec3) ExpectKHR 73 75 + 78: 77(bvec3) IEqual 76 75 + 79: 10(bool) All 78 + Branch 69 + 69: Label + 80: 10(bool) Phi 66 54 79 68 + 81: 10(bool) LogicalNot 80 + SelectionMerge 83 None + BranchConditional 81 82 83 + 82: Label + 86: 85(ptr) AccessChain 44(ro) 84 + 87: 14(i8vec4) Load 86 + 90: 14(i8vec4) ExpectKHR 87 89 + 92: 91(bvec4) IEqual 90 89 + 93: 10(bool) All 92 + Branch 83 + 83: Label + 94: 10(bool) Phi 80 69 93 82 + SelectionMerge 96 None + BranchConditional 94 95 96 + 95: Label + 97: 6(int) Load 8(x) + 98: 6(int) IAdd 97 55 + Store 8(x) 98 + Branch 96 + 96: Label + 101: 100(ptr) AccessChain 44(ro) 99 + 102: 15(int8_t) Load 101 + 103: 30(int) UConvert 102 + 104: 6(int) Bitcast 103 + 105: 6(int) ExpectKHR 104 49 + 106: 10(bool) IEqual 105 49 + 107: 10(bool) LogicalNot 106 + SelectionMerge 109 None + BranchConditional 107 108 109 + 108: Label + 112: 111(ptr) AccessChain 44(ro) 110 + 113: 16(i8vec2) Load 112 + 117: 16(i8vec2) ExpectKHR 113 116 + 118: 63(bvec2) IEqual 117 116 + 119: 10(bool) All 118 + Branch 109 + 109: Label + 120: 10(bool) Phi 106 96 119 108 + 121: 10(bool) LogicalNot 120 + SelectionMerge 123 None + BranchConditional 121 122 123 + 122: Label + 126: 125(ptr) AccessChain 44(ro) 124 + 127: 17(i8vec3) Load 126 + 130: 17(i8vec3) ExpectKHR 127 129 + 131: 77(bvec3) IEqual 130 129 + 132: 10(bool) All 131 + Branch 123 + 123: Label + 133: 10(bool) Phi 120 109 132 122 + 134: 10(bool) LogicalNot 133 + SelectionMerge 136 None + BranchConditional 134 135 136 + 135: Label + 139: 138(ptr) AccessChain 44(ro) 137 + 140: 18(i8vec4) Load 139 + 143: 18(i8vec4) ExpectKHR 140 142 + 144: 91(bvec4) IEqual 143 142 + 145: 10(bool) All 144 + Branch 136 + 136: Label + 146: 10(bool) Phi 133 123 145 135 + SelectionMerge 148 None + BranchConditional 146 147 148 + 147: Label + 149: 6(int) Load 8(x) + 150: 6(int) IAdd 149 55 + Store 8(x) 150 + Branch 148 + 148: Label + 153: 152(ptr) AccessChain 44(ro) 151 + 154: 19(int16_t) Load 153 + 155: 6(int) SConvert 154 + 156: 6(int) ExpectKHR 155 49 + 157: 10(bool) IEqual 156 49 + 158: 10(bool) LogicalNot 157 + SelectionMerge 160 None + BranchConditional 158 159 160 + 159: Label + 163: 162(ptr) AccessChain 44(ro) 161 + 164: 20(i16vec2) Load 163 + 168: 20(i16vec2) ExpectKHR 164 167 + 169: 63(bvec2) IEqual 168 167 + 170: 10(bool) All 169 + Branch 160 + 160: Label + 171: 10(bool) Phi 157 148 170 159 + 172: 10(bool) LogicalNot 171 + SelectionMerge 174 None + BranchConditional 172 173 174 + 173: Label + 176: 175(ptr) AccessChain 44(ro) 49 + 177: 21(i16vec3) Load 176 + 180: 21(i16vec3) ExpectKHR 177 179 + 181: 77(bvec3) IEqual 180 179 + 182: 10(bool) All 181 + Branch 174 + 174: Label + 183: 10(bool) Phi 171 160 182 173 + 184: 10(bool) LogicalNot 183 + SelectionMerge 186 None + BranchConditional 184 185 186 + 185: Label + 189: 188(ptr) AccessChain 44(ro) 187 + 190: 22(i16vec4) Load 189 + 193: 22(i16vec4) ExpectKHR 190 192 + 194: 91(bvec4) IEqual 193 192 + 195: 10(bool) All 194 + Branch 186 + 186: Label + 196: 10(bool) Phi 183 174 195 185 + SelectionMerge 198 None + BranchConditional 196 197 198 + 197: Label + 199: 6(int) Load 8(x) + 200: 6(int) IAdd 199 55 + Store 8(x) 200 + Branch 198 + 198: Label + 203: 202(ptr) AccessChain 44(ro) 201 + 204: 23(int16_t) Load 203 + 205: 30(int) UConvert 204 + 206: 6(int) Bitcast 205 + 207: 6(int) ExpectKHR 206 49 + 208: 10(bool) IEqual 207 49 + 209: 10(bool) LogicalNot 208 + SelectionMerge 211 None + BranchConditional 209 210 211 + 210: Label + 214: 213(ptr) AccessChain 44(ro) 212 + 215: 24(i16vec2) Load 214 + 219: 24(i16vec2) ExpectKHR 215 218 + 220: 63(bvec2) IEqual 219 218 + 221: 10(bool) All 220 + Branch 211 + 211: Label + 222: 10(bool) Phi 208 198 221 210 + 223: 10(bool) LogicalNot 222 + SelectionMerge 225 None + BranchConditional 223 224 225 + 224: Label + 228: 227(ptr) AccessChain 44(ro) 226 + 229: 25(i16vec3) Load 228 + 232: 25(i16vec3) ExpectKHR 229 231 + 233: 77(bvec3) IEqual 232 231 + 234: 10(bool) All 233 + Branch 225 + 225: Label + 235: 10(bool) Phi 222 211 234 224 + 236: 10(bool) LogicalNot 235 + SelectionMerge 238 None + BranchConditional 236 237 238 + 237: Label + 241: 240(ptr) AccessChain 44(ro) 239 + 242: 26(i16vec4) Load 241 + 245: 26(i16vec4) ExpectKHR 242 244 + 246: 91(bvec4) IEqual 245 244 + 247: 10(bool) All 246 + Branch 238 + 238: Label + 248: 10(bool) Phi 235 225 247 237 + SelectionMerge 250 None + BranchConditional 248 249 250 + 249: Label + 251: 6(int) Load 8(x) + 252: 6(int) IAdd 251 55 + Store 8(x) 252 + Branch 250 + 250: Label + 255: 254(ptr) AccessChain 44(ro) 253 + 256: 6(int) Load 255 + 257: 6(int) ExpectKHR 256 49 + 258: 10(bool) IEqual 257 49 + 259: 10(bool) LogicalNot 258 + SelectionMerge 261 None + BranchConditional 259 260 261 + 260: Label + 264: 263(ptr) AccessChain 44(ro) 262 + 265: 27(ivec2) Load 264 + 268: 27(ivec2) ExpectKHR 265 267 + 269: 63(bvec2) IEqual 268 267 + 270: 10(bool) All 269 + Branch 261 + 261: Label + 271: 10(bool) Phi 258 250 270 260 + 272: 10(bool) LogicalNot 271 + SelectionMerge 274 None + BranchConditional 272 273 274 + 273: Label + 277: 276(ptr) AccessChain 44(ro) 275 + 278: 28(ivec3) Load 277 + 281: 28(ivec3) ExpectKHR 278 280 + 282: 77(bvec3) IEqual 281 280 + 283: 10(bool) All 282 + Branch 274 + 274: Label + 284: 10(bool) Phi 271 261 283 273 + 285: 10(bool) LogicalNot 284 + SelectionMerge 287 None + BranchConditional 285 286 287 + 286: Label + 290: 289(ptr) AccessChain 44(ro) 288 + 291: 29(ivec4) Load 290 + 294: 29(ivec4) ExpectKHR 291 293 + 295: 91(bvec4) IEqual 294 293 + 296: 10(bool) All 295 + Branch 287 + 287: Label + 297: 10(bool) Phi 284 274 296 286 + SelectionMerge 299 None + BranchConditional 297 298 299 + 298: Label + 300: 6(int) Load 8(x) + 301: 6(int) IAdd 300 55 + Store 8(x) 301 + Branch 299 + 299: Label + 304: 303(ptr) AccessChain 44(ro) 302 + 305: 30(int) Load 304 + 307: 30(int) ExpectKHR 305 306 + 308: 10(bool) IEqual 307 306 + 309: 10(bool) LogicalNot 308 + SelectionMerge 311 None + BranchConditional 309 310 311 + 310: Label + 314: 313(ptr) AccessChain 44(ro) 312 + 315: 31(ivec2) Load 314 + 319: 31(ivec2) ExpectKHR 315 318 + 320: 63(bvec2) IEqual 319 318 + 321: 10(bool) All 320 + Branch 311 + 311: Label + 322: 10(bool) Phi 308 299 321 310 + 323: 10(bool) LogicalNot 322 + SelectionMerge 325 None + BranchConditional 323 324 325 + 324: Label + 328: 327(ptr) AccessChain 44(ro) 326 + 329: 32(ivec3) Load 328 + 332: 32(ivec3) ExpectKHR 329 331 + 333: 77(bvec3) IEqual 332 331 + 334: 10(bool) All 333 + Branch 325 + 325: Label + 335: 10(bool) Phi 322 311 334 324 + 336: 10(bool) LogicalNot 335 + SelectionMerge 338 None + BranchConditional 336 337 338 + 337: Label + 341: 340(ptr) AccessChain 44(ro) 339 + 342: 33(ivec4) Load 341 + 345: 33(ivec4) ExpectKHR 342 344 + 346: 91(bvec4) IEqual 345 344 + 347: 10(bool) All 346 + Branch 338 + 338: Label + 348: 10(bool) Phi 335 325 347 337 + SelectionMerge 350 None + BranchConditional 348 349 350 + 349: Label + 351: 6(int) Load 8(x) + 352: 6(int) IAdd 351 55 + Store 8(x) 352 + Branch 350 + 350: Label + 355: 354(ptr) AccessChain 44(ro) 353 + 356: 34(int64_t) Load 355 + 358: 34(int64_t) ExpectKHR 356 357 + 359: 10(bool) IEqual 358 357 + 360: 10(bool) LogicalNot 359 + SelectionMerge 362 None + BranchConditional 360 361 362 + 361: Label + 365: 364(ptr) AccessChain 44(ro) 363 + 366: 35(i64vec2) Load 365 + 370: 35(i64vec2) ExpectKHR 366 369 + 371: 63(bvec2) IEqual 370 369 + 372: 10(bool) All 371 + Branch 362 + 362: Label + 373: 10(bool) Phi 359 350 372 361 + 374: 10(bool) LogicalNot 373 + SelectionMerge 376 None + BranchConditional 374 375 376 + 375: Label + 379: 378(ptr) AccessChain 44(ro) 377 + 380: 36(i64vec3) Load 379 + 383: 36(i64vec3) ExpectKHR 380 382 + 384: 77(bvec3) IEqual 383 382 + 385: 10(bool) All 384 + Branch 376 + 376: Label + 386: 10(bool) Phi 373 362 385 375 + 387: 10(bool) LogicalNot 386 + SelectionMerge 389 None + BranchConditional 387 388 389 + 388: Label + 392: 391(ptr) AccessChain 44(ro) 390 + 393: 37(i64vec4) Load 392 + 396: 37(i64vec4) ExpectKHR 393 395 + 397: 91(bvec4) IEqual 396 395 + 398: 10(bool) All 397 + Branch 389 + 389: Label + 399: 10(bool) Phi 386 376 398 388 + SelectionMerge 401 None + BranchConditional 399 400 401 + 400: Label + 402: 6(int) Load 8(x) + 403: 6(int) IAdd 402 55 + Store 8(x) 403 + Branch 401 + 401: Label + 406: 405(ptr) AccessChain 44(ro) 404 + 407: 38(int64_t) Load 406 + 409: 38(int64_t) ExpectKHR 407 408 + 410: 10(bool) IEqual 409 408 + 411: 10(bool) LogicalNot 410 + SelectionMerge 413 None + BranchConditional 411 412 413 + 412: Label + 416: 415(ptr) AccessChain 44(ro) 414 + 417: 39(i64vec2) Load 416 + 421: 39(i64vec2) ExpectKHR 417 420 + 422: 63(bvec2) IEqual 421 420 + 423: 10(bool) All 422 + Branch 413 + 413: Label + 424: 10(bool) Phi 410 401 423 412 + 425: 10(bool) LogicalNot 424 + SelectionMerge 427 None + BranchConditional 425 426 427 + 426: Label + 430: 429(ptr) AccessChain 44(ro) 428 + 431: 40(i64vec3) Load 430 + 434: 40(i64vec3) ExpectKHR 431 433 + 435: 77(bvec3) IEqual 434 433 + 436: 10(bool) All 435 + Branch 427 + 427: Label + 437: 10(bool) Phi 424 413 436 426 + 438: 10(bool) LogicalNot 437 + SelectionMerge 440 None + BranchConditional 438 439 440 + 439: Label + 443: 442(ptr) AccessChain 44(ro) 441 + 444: 41(i64vec4) Load 443 + 447: 41(i64vec4) ExpectKHR 444 446 + 448: 91(bvec4) IEqual 447 446 + 449: 10(bool) All 448 + Branch 440 + 440: Label + 450: 10(bool) Phi 437 427 449 439 + SelectionMerge 452 None + BranchConditional 450 451 452 + 451: Label + 453: 6(int) Load 8(x) + 454: 6(int) IAdd 453 55 + Store 8(x) 454 + Branch 452 + 452: Label + Return + FunctionEnd diff --git a/Test/spv.expect_assume.assumeEXT.comp b/Test/spv.expect_assume.assumeEXT.comp new file mode 100644 index 000000000..165debcf9 --- /dev/null +++ b/Test/spv.expect_assume.assumeEXT.comp @@ -0,0 +1,13 @@ +#version 450 + +#extension GL_EXT_expect_assume: enable + +layout (local_size_x = 8) in; + +readonly buffer roblock { + int i; +} ro; + +void main() { + assumeEXT(ro.i > 42); +} diff --git a/Test/spv.expect_assume.expectEXT.comp b/Test/spv.expect_assume.expectEXT.comp new file mode 100644 index 000000000..a157a5fe2 --- /dev/null +++ b/Test/spv.expect_assume.expectEXT.comp @@ -0,0 +1,43 @@ +#version 450 + +#extension GL_EXT_expect_assume: enable + +layout (local_size_x = 8) in; + +readonly buffer roblock { + bool b; + bvec2 bv2; + bvec3 bv3; + bvec4 bv4; + int i; + ivec2 iv2; + ivec3 iv3; + ivec4 iv4; + uint ui; + uvec2 uv2; + uvec3 uv3; + uvec4 uv4; +} ro; + +void main() { + int x = 0; + + if (expectEXT(ro.b, true) == true || + expectEXT(ro.bv2, bvec2(true, false)) == bvec2(true, false) || + expectEXT(ro.bv3, bvec3(true, false, true)) == bvec3(true, false, true) || + expectEXT(ro.bv4, bvec4(false, true, false, true)) == bvec4(false, true, false, true)) { + x++; + } + if (expectEXT(ro.i, 10) == 10 || + expectEXT(ro.iv2, ivec2(11, -22)) == ivec2(11, -22) || + expectEXT(ro.iv3, ivec3(11, -22, 33)) == ivec3(11, -22, 33) || + expectEXT(ro.iv4, ivec4(11, -22, 33, 44)) == ivec4(11, -22, 33, 44)) { + x++; + } + if (expectEXT(ro.ui, 10) == 10 || + expectEXT(ro.uv2, uvec2(11, 22)) == uvec2(11, 22) || + expectEXT(ro.uv3, uvec3(11, 22, 33)) == uvec3(11, 22, 33) || + expectEXT(ro.uv4, uvec4(11, 22, 33, 44)) == uvec4(11, 22, 33, 44)) { + x++; + } +} diff --git a/Test/spv.expect_assume.expectEXT.exttypes.comp b/Test/spv.expect_assume.expectEXT.exttypes.comp new file mode 100644 index 000000000..d637fb739 --- /dev/null +++ b/Test/spv.expect_assume.expectEXT.exttypes.comp @@ -0,0 +1,101 @@ +#version 450 + +#extension GL_EXT_expect_assume: enable +#extension GL_EXT_shader_explicit_arithmetic_types: enable + +layout (local_size_x = 8) in; + +readonly buffer roblock { + int8_t i8; + i8vec2 i8v2; + i8vec3 i8v3; + i8vec4 i8v4; + uint8_t u8; + u8vec2 u8v2; + u8vec3 u8v3; + u8vec4 u8v4; + int16_t i16; + i16vec2 i16v2; + i16vec3 i16v3; + i16vec4 i16v4; + uint16_t u16; + u16vec2 u16v2; + u16vec3 u16v3; + u16vec4 u16v4; + int32_t i32; + i32vec2 i32v2; + i32vec3 i32v3; + i32vec4 i32v4; + uint32_t u32; + u32vec2 u32v2; + u32vec3 u32v3; + u32vec4 u32v4; + int64_t i64; + i64vec2 i64v2; + i64vec3 i64v3; + i64vec4 i64v4; + uint64_t u64; + u64vec2 u64v2; + u64vec3 u64v3; + u64vec4 u64v4; +} ro; + +void main() { + int x = 0; + + // 8-bit + if (expectEXT(ro.i8, 10) == 10 || + expectEXT(ro.i8v2, i8vec2(11, -22)) == i8vec2(11, -22) || + expectEXT(ro.i8v3, i8vec3(11, -22, 33)) == i8vec3(11, -22, 33) || + expectEXT(ro.i8v4, i8vec4(11, -22, 33, 44)) == i8vec4(11, -22, 33, 44)) { + x++; + } + if (expectEXT(ro.u8, 10) == 10 || + expectEXT(ro.u8v2, u8vec2(11, 22)) == u8vec2(11, 22) || + expectEXT(ro.u8v3, u8vec3(11, 22, 33)) == u8vec3(11, 22, 33) || + expectEXT(ro.u8v4, u8vec4(11, 22, 33, 44)) == u8vec4(11, 22, 33, 44)) { + x++; + } + + // 16-bit + if (expectEXT(ro.i16, 10) == 10 || + expectEXT(ro.i16v2, i16vec2(11, -22)) == i16vec2(11, -22) || + expectEXT(ro.i16v3, i16vec3(11, -22, 33)) == i16vec3(11, -22, 33) || + expectEXT(ro.i16v4, i16vec4(11, -22, 33, 44)) == i16vec4(11, -22, 33, 44)) { + x++; + } + if (expectEXT(ro.u16, 10) == 10 || + expectEXT(ro.u16v2, u16vec2(11, 22)) == u16vec2(11, 22) || + expectEXT(ro.u16v3, u16vec3(11, 22, 33)) == u16vec3(11, 22, 33) || + expectEXT(ro.u16v4, u16vec4(11, 22, 33, 44)) == u16vec4(11, 22, 33, 44)) { + x++; + } + + // 32-bit + if (expectEXT(ro.i32, 10) == 10 || + expectEXT(ro.i32v2, i32vec2(11, -22)) == i32vec2(11, -22) || + expectEXT(ro.i32v3, i32vec3(11, -22, 33)) == i32vec3(11, -22, 33) || + expectEXT(ro.i32v4, i32vec4(11, -22, 33, 44)) == i32vec4(11, -22, 33, 44)) { + x++; + } + if (expectEXT(ro.u32, 10) == 10 || + expectEXT(ro.u32v2, u32vec2(11, 22)) == u32vec2(11, 22) || + expectEXT(ro.u32v3, u32vec3(11, 22, 33)) == u32vec3(11, 22, 33) || + expectEXT(ro.u32v4, u32vec4(11, 22, 33, 44)) == u32vec4(11, 22, 33, 44)) { + x++; + } + + // 64-bit + if (expectEXT(ro.i64, 10) == 10 || + expectEXT(ro.i64v2, i64vec2(11, -22)) == i64vec2(11, -22) || + expectEXT(ro.i64v3, i64vec3(11, -22, 33)) == i64vec3(11, -22, 33) || + expectEXT(ro.i64v4, i64vec4(11, -22, 33, 44)) == i64vec4(11, -22, 33, 44)) { + x++; + } + if (expectEXT(ro.u64, 10) == 10 || + expectEXT(ro.u64v2, u64vec2(11, 22)) == u64vec2(11, 22) || + expectEXT(ro.u64v3, u64vec3(11, 22, 33)) == u64vec3(11, 22, 33) || + expectEXT(ro.u64v4, u64vec4(11, 22, 33, 44)) == u64vec4(11, 22, 33, 44)) { + x++; + } +} diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index 6b190d4d8..c7640ec37 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -1091,6 +1091,10 @@ enum TOperator { EOpWaveActiveCountBits, // Will decompose to subgroupBallotBitCount(subgroupBallot()). EOpWavePrefixCountBits, // Will decompose to subgroupBallotInclusiveBitCount(subgroupBallot()). + // GL_EXT_expect_assume + EOpAssumeEXT, + EOpExpectEXT, + // Shader Clock Ops EOpReadClockSubgroupKHR, EOpReadClockDeviceKHR, diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 8ae434637..e74f9e7f7 100755 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -4118,6 +4118,37 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "u16vec4 unpack16(uint64_t);" "i32vec2 unpack32(int64_t);" "u32vec2 unpack32(uint64_t);" + + // GL_EXT_expect_assume + "int8_t expectEXT(int8_t, int8_t);" + "i8vec2 expectEXT(i8vec2, i8vec2);" + "i8vec3 expectEXT(i8vec3, i8vec3);" + "i8vec4 expectEXT(i8vec4, i8vec4);" + + "uint8_t expectEXT(uint8_t, uint8_t);" + "u8vec2 expectEXT(u8vec2, u8vec2);" + "u8vec3 expectEXT(u8vec3, u8vec3);" + "u8vec4 expectEXT(u8vec4, u8vec4);" + + "int16_t expectEXT(int16_t, int16_t);" + "i16vec2 expectEXT(i16vec2, i16vec2);" + "i16vec3 expectEXT(i16vec3, i16vec3);" + "i16vec4 expectEXT(i16vec4, i16vec4);" + + "uint16_t expectEXT(uint16_t, uint16_t);" + "u16vec2 expectEXT(u16vec2, u16vec2);" + "u16vec3 expectEXT(u16vec3, u16vec3);" + "u16vec4 expectEXT(u16vec4, u16vec4);" + + "int64_t expectEXT(int64_t, int64_t);" + "i64vec2 expectEXT(i64vec2, i64vec2);" + "i64vec3 expectEXT(i64vec3, i64vec3);" + "i64vec4 expectEXT(i64vec4, i64vec4);" + + "uint64_t expectEXT(uint64_t, uint64_t);" + "u64vec2 expectEXT(u64vec2, u64vec2);" + "u64vec3 expectEXT(u64vec3, u64vec3);" + "u64vec4 expectEXT(u64vec4, u64vec4);" "\n"); } @@ -4156,6 +4187,29 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } + // GL_EXT_expect_assume + if ((profile == EEsProfile && version >= 310) || + ((profile != EEsProfile && version >= 140))) { + commonBuiltins.append( + "void assumeEXT(bool);" + + "bool expectEXT(bool, bool);" + "bvec2 expectEXT(bvec2, bvec2);" + "bvec3 expectEXT(bvec3, bvec3);" + "bvec4 expectEXT(bvec4, bvec4);" + + "int expectEXT(int, int);" + "ivec2 expectEXT(ivec2, ivec2);" + "ivec3 expectEXT(ivec3, ivec3);" + "ivec4 expectEXT(ivec4, ivec4);" + + "uint expectEXT(uint, uint);" + "uvec2 expectEXT(uvec2, uvec2);" + "uvec3 expectEXT(uvec3, uvec3);" + "uvec4 expectEXT(uvec4, uvec4);" + "\n"); + } + // QCOM_image_processing if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 140)) { @@ -8631,6 +8685,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); } + // GL_EXT_expect_assume + if ((profile == EEsProfile && version >= 310) || + (profile != EEsProfile && version >= 140)) { + symbolTable.setFunctionExtensions("assumeEXT", 1, &E_GL_EXT_expect_assume); + symbolTable.setFunctionExtensions("expectEXT", 1, &E_GL_EXT_expect_assume); + } + // GL_KHR_shader_subgroup if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 140)) { @@ -9732,6 +9793,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("averageRounded", EOpAverageRounded); symbolTable.relateToOperator("multiply32x16", EOpMul32x16); symbolTable.relateToOperator("debugPrintfEXT", EOpDebugPrintf); + symbolTable.relateToOperator("assumeEXT", EOpAssumeEXT); + symbolTable.relateToOperator("expectEXT", EOpExpectEXT); if (PureOperatorBuiltins) { diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index b0b901ac4..37d46ed6f 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -262,6 +262,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_maximal_reconvergence] = EBhDisable; extensionBehavior[E_GL_EXT_fragment_shader_barycentric] = EBhDisable; + extensionBehavior[E_GL_EXT_expect_assume] = EBhDisable; extensionBehavior[E_GL_KHR_cooperative_matrix] = EBhDisable; diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 380c6f10b..2e420b5ab 100755 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -220,6 +220,7 @@ const char* const E_GL_EXT_shader_quad_control = "GL_EXT_shader_qua const char* const E_GL_EXT_draw_instanced = "GL_EXT_draw_instanced"; const char* const E_GL_EXT_texture_array = "GL_EXT_texture_array"; const char* const E_GL_EXT_maximal_reconvergence = "GL_EXT_maximal_reconvergence"; +const char* const E_GL_EXT_expect_assume = "GL_EXT_expect_assume"; // Arrays of extensions for the above viewportEXTs duplications diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index cbdc46a2d..4754f659f 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -384,6 +384,9 @@ INSTANTIATE_TEST_SUITE_P( "spv.discard-dce.frag", "spv.doWhileLoop.frag", "spv.earlyReturnDiscard.frag", + "spv.expect_assume.assumeEXT.comp", + "spv.expect_assume.expectEXT.comp", + "spv.expect_assume.expectEXT.exttypes.comp", "spv.ext.ShaderTileImage.color.frag", "spv.ext.ShaderTileImage.depth_stencil.frag", "spv.ext.ShaderTileImage.subpassinput.frag",