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

143 lines
5.5 KiB
Plaintext

; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 82
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_color "x_GLF_color"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
OpName %x_5 "x_5"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
OpName %x_8 "x_8"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
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 %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_int_uint_2 ArrayStride 16
OpDecorate %x_5 NonWritable
OpDecorate %x_5 DescriptorSet 0
OpDecorate %x_5 Binding 1
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_float_uint_2 ArrayStride 16
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%buf1 = OpTypeStruct %_arr_int_uint_2
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_5 = OpVariable %_ptr_Uniform_buf1 Uniform
%_arr_float_uint_2 = OpTypeArray %float %uint_2
%buf0 = OpTypeStruct %_arr_float_uint_2
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5
%void = OpTypeVoid
%19 = OpTypeFunction %void
%_ptr_Function_int = OpTypePointer Function %int
%25 = OpConstantNull %int
%uint_0 = OpConstant %uint 0
%int_0 = OpConstant %int 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%_ptr_Uniform_float = OpTypePointer Uniform %float
%main_out = OpTypeStruct %v4float
%70 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %19
%22 = OpLabel
%i = OpVariable %_ptr_Function_int Function %25
%29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
%30 = OpLoad %int %29
%31 = OpConvertSToF %float %30
%32 = OpCompositeConstruct %v4float %31 %31 %31 %31
OpStore %x_GLF_color %32
%33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
%34 = OpLoad %int %33
OpStore %i %34
OpBranch %35
%35 = OpLabel
OpLoopMerge %36 %37 None
OpBranch %38
%38 = OpLabel
%39 = OpLoad %int %i
%41 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
%42 = OpLoad %int %41
%43 = OpSLessThan %bool %39 %42
OpSelectionMerge %45 None
OpBranchConditional %43 %46 %47
%46 = OpLabel
OpBranch %45
%47 = OpLabel
OpBranch %36
%45 = OpLabel
%49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1
%50 = OpLoad %float %49
%51 = OpLoad %int %i
%53 = OpConvertSToF %float %51
%54 = OpFOrdLessThanEqual %bool %50 %53
%52 = OpLogicalNot %bool %54
OpSelectionMerge %55 None
OpBranchConditional %52 %56 %55
%56 = OpLabel
%57 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
%58 = OpLoad %float %57
%59 = OpLoad %int %i
%60 = OpLoad %int %i
%61 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
%62 = OpLoad %float %61
%63 = OpLoad %v4float %x_GLF_color
%64 = OpConvertSToF %float %59
%65 = OpConvertSToF %float %60
%66 = OpCompositeConstruct %v4float %58 %64 %65 %62
%67 = OpFAdd %v4float %63 %66
OpStore %x_GLF_color %67
OpBranch %55
%55 = OpLabel
OpBranch %37
%37 = OpLabel
%68 = OpLoad %int %i
%69 = OpIAdd %int %68 %int_1
OpStore %i %69
OpBranch %35
%36 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %70
%tint_symbol = OpFunctionParameter %main_out
%74 = OpLabel
%75 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %75
OpReturn
OpFunctionEnd
%main = OpFunction %void None %19
%77 = OpLabel
%78 = OpFunctionCall %void %main_1
%80 = OpLoad %v4float %x_GLF_color
%81 = OpCompositeConstruct %main_out %80
%79 = OpFunctionCall %void %tint_symbol_2 %81
OpReturn
OpFunctionEnd