Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2021-06-28 12:10:55 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2021-06-28 13:23:44 +0300
commit8216e87f02d010bc0e0233addf01541e6332b126 (patch)
tree81412a5c4a3e5cebe042834f413276b189fbf8aa /shaders-msl-no-opt
parent9cdeefb5e322fc26b5fed70795fe79725648df1f (diff)
Handle SPIR-V 1.4 selection constructs.
Fix bug in to_trivial_mix_op, where we made a pre-1.4 assumption that component count of selector is equal to value component count.
Diffstat (limited to 'shaders-msl-no-opt')
-rw-r--r--shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag62
1 files changed, 62 insertions, 0 deletions
diff --git a/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag b/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag
new file mode 100644
index 00000000..07450ee8
--- /dev/null
+++ b/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag
@@ -0,0 +1,62 @@
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %FragColor
+ OpExecutionMode %main OriginUpperLeft
+ OpSource GLSL 450
+ OpName %main "main"
+ OpName %FragColor "FragColor"
+ OpDecorate %FragColor Location 0
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %true = OpConstantTrue %bool
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %s = OpTypeStruct %float
+ %arr = OpTypeArray %float %uint_2
+%_ptr_Function_s = OpTypePointer Function %s
+%_ptr_Function_arr = OpTypePointer Function %arr
+ %FragColor = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %float_1 = OpConstant %float 1
+ %17 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1
+ %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
+ %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+ %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+ %s0 = OpConstantComposite %s %float_0
+ %s1 = OpConstantComposite %s %float_1
+ %v4bool = OpTypeVector %bool 4
+ %b4 = OpConstantComposite %v4bool %false %true %false %true
+ %arr1 = OpConstantComposite %arr %float_0 %float_1
+ %arr2 = OpConstantComposite %arr %float_1 %float_0
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %ss = OpVariable %_ptr_Function_s Function
+ %arrvar = OpVariable %_ptr_Function_arr Function
+ ; Not trivial
+ %21 = OpSelect %v4float %false %17 %18
+ OpStore %FragColor %21
+ ; Trivial
+ %22 = OpSelect %v4float %false %19 %20
+ OpStore %FragColor %22
+ ; Vector not trivial
+ %23 = OpSelect %v4float %b4 %17 %18
+ OpStore %FragColor %23
+ ; Vector trivial
+ %24 = OpSelect %v4float %b4 %19 %20
+ OpStore %FragColor %24
+ ; Struct selection
+ %sout = OpSelect %s %false %s0 %s1
+ OpStore %ss %sout
+ ; Array selection
+ %arrout = OpSelect %arr %true %arr1 %arr2
+ OpStore %arrvar %arrout
+
+ OpReturn
+ OpFunctionEnd