Alastair Donaldson f7e73d4ee3 Add tests derived from VK-GL-CTS
This adds SPIR-V assembly and WGSL tests derived from VK-GL-CTS commit
571256871c2e2f03995373e1e4a02958d8cd8cf5. The following procedure was
followed:

- Those .amber files in VK-GL-CTS wholly owned by Google were
  identified

- All GLSL and SPIR-V shaders were extracted from the Amber files and
  converted into SPIR-V binaries

- The compact-ids pass of spirv-opt was applied to each binary

- Duplicate binaries were removed

- spirv-opt -O was used to obtain an optimized version of each remaining
  binary, with duplicates discarded

- Binaries that failed validation using spirv-val with target
  environment SPIR-V 1.3 were discarded

- Those binaries that tint could not successfully convert into WGSL were
  put aside for further investigation

- SPIR-V assembly versions of the remaining binaries are included in
  this CL

- test-runner with -generate-expected and -generate-skip was used to
  generate expected .spvasm, .msl, .hlsl and .wgsl outputs for these
  SPIR-V assembly tests

- Each successfully-generated .expected.wgsl is included in this CL
  again, as a WGLSL test

- test-runner with -generate-expected and -generate-skip was used again,
  to generate expected outputs for these WGSL tests

Change-Id: Ibe9baf2729cf97e0b633db9a426f53362a5de540
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58842
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-23 13:10:12 +00:00

188 lines
7.3 KiB
Plaintext

; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 122
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_7 "x_7"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %arr "arr"
OpName %a "a"
OpName %i "i"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_int_uint_3 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_10 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_3 = OpConstant %uint 3
%_arr_int_uint_3 = OpTypeArray %int %uint_3
%buf0 = OpTypeStruct %_arr_int_uint_3
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_7 = OpVariable %_ptr_Uniform_buf0 Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%12 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
%void = OpTypeVoid
%15 = OpTypeFunction %void
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
%23 = OpConstantNull %_arr_int_uint_10
%_ptr_Function_int = OpTypePointer Function %int
%26 = OpConstantNull %int
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%int_5 = OpConstant %int 5
%int_6 = OpConstant %int 6
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%int_9 = OpConstant %int 9
%int_10 = OpConstant %int 10
%38 = OpConstantComposite %_arr_int_uint_10 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8 %int_9 %int_10
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%bool = OpTypeBool
%int_n1 = OpConstant %int -1
%v2int = OpTypeVector %int 2
%main_out = OpTypeStruct %v4float
%110 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %15
%18 = OpLabel
%arr = OpVariable %_ptr_Function__arr_int_uint_10 Function %23
%a = OpVariable %_ptr_Function_int Function %26
%i = OpVariable %_ptr_Function_int Function %26
OpStore %arr %38
OpStore %a %int_0
%42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%43 = OpLoad %int %42
%44 = OpAccessChain %_ptr_Function_int %arr %43
%45 = OpLoad %int %44
%46 = OpIEqual %bool %45 %int_2
OpSelectionMerge %48 None
OpBranchConditional %46 %49 %48
%49 = OpLabel
%50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%51 = OpLoad %int %50
OpStore %i %51
OpBranch %52
%52 = OpLabel
OpLoopMerge %53 %54 None
OpBranch %55
%55 = OpLabel
%56 = OpLoad %int %i
%57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0
%58 = OpLoad %int %57
%59 = OpSLessThan %bool %56 %58
OpSelectionMerge %60 None
OpBranchConditional %59 %61 %62
%61 = OpLabel
OpBranch %60
%62 = OpLabel
OpBranch %53
%60 = OpLabel
OpBranch %54
%54 = OpLabel
%63 = OpLoad %int %i
%64 = OpIAdd %int %63 %int_1
OpStore %i %64
OpBranch %52
%53 = OpLabel
%65 = OpLoad %int %a
%66 = OpIAdd %int %65 %int_1
OpStore %a %66
OpBranch %48
%48 = OpLabel
%67 = OpLoad %int %a
%68 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%69 = OpLoad %int %68
%71 = OpSMod %int %int_n1 %67
%72 = OpIEqual %bool %71 %69
OpSelectionMerge %73 None
OpBranchConditional %72 %74 %73
%74 = OpLabel
%75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%76 = OpLoad %int %75
%77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%78 = OpLoad %int %77
%80 = OpCompositeConstruct %v2int %76 %76
%81 = OpCompositeExtract %int %80 1
%82 = OpAccessChain %_ptr_Function_int %arr %81
OpStore %82 %78
OpBranch %73
%73 = OpLabel
%83 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%84 = OpLoad %int %83
%85 = OpAccessChain %_ptr_Function_int %arr %84
%86 = OpLoad %int %85
%87 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%88 = OpLoad %int %87
%89 = OpIEqual %bool %86 %88
OpSelectionMerge %90 None
OpBranchConditional %89 %91 %92
%91 = OpLabel
%93 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%94 = OpLoad %int %93
%95 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%96 = OpLoad %int %95
%97 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%98 = OpLoad %int %97
%99 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%100 = OpLoad %int %99
%101 = OpConvertSToF %float %94
%102 = OpConvertSToF %float %96
%103 = OpConvertSToF %float %98
%104 = OpConvertSToF %float %100
%105 = OpCompositeConstruct %v4float %101 %102 %103 %104
OpStore %x_GLF_color %105
OpBranch %90
%92 = OpLabel
%106 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%107 = OpLoad %int %106
%108 = OpConvertSToF %float %107
%109 = OpCompositeConstruct %v4float %108 %108 %108 %108
OpStore %x_GLF_color %109
OpBranch %90
%90 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %110
%tint_symbol = OpFunctionParameter %main_out
%114 = OpLabel
%115 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %115
OpReturn
OpFunctionEnd
%main = OpFunction %void None %15
%117 = OpLabel
%118 = OpFunctionCall %void %main_1
%120 = OpLoad %v4float %x_GLF_color
%121 = OpCompositeConstruct %main_out %120
%119 = OpFunctionCall %void %tint_symbol_2 %121
OpReturn
OpFunctionEnd