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

90 lines
3.8 KiB
Plaintext

OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %_GLF_color
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 310
OpName %main "main"
OpName %BST "BST"
OpMemberName %BST 0 "data"
OpMemberName %BST 1 "leftIndex"
OpMemberName %BST 2 "rightIndex"
OpName %makeTreeNode_struct_BST_i1_i1_i11_ "makeTreeNode(struct-BST-i1-i1-i11;"
OpName %tree "tree"
OpName %tree_0 "tree"
OpName %param "param"
OpName %_GLF_color "_GLF_color"
OpMemberDecorate %BST 0 RelaxedPrecision
OpMemberDecorate %BST 1 RelaxedPrecision
OpMemberDecorate %BST 2 RelaxedPrecision
OpDecorate %9 RelaxedPrecision
OpDecorate %_GLF_color Location 0
OpDecorate %10 RelaxedPrecision
OpDecorate %11 RelaxedPrecision
OpDecorate %12 RelaxedPrecision
%void = OpTypeVoid
%14 = OpTypeFunction %void
%int = OpTypeInt 32 1
%BST = OpTypeStruct %int %int %int
%_ptr_Function_BST = OpTypePointer Function %BST
%17 = OpTypeFunction %void %_ptr_Function_BST
%int_2 = OpConstant %int 2
%int_1 = OpConstant %int 1
%_ptr_Function_int = OpTypePointer Function %int
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_BST_uint_10 = OpTypeArray %BST %uint_10
%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10
%int_0 = OpConstant %int 0
%_ptr_Private_BST = OpTypePointer Private %BST
%_ptr_Private_int = OpTypePointer Private %int
%bool = OpTypeBool
%true = OpConstantTrue %bool
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10
%main = OpFunction %void None %14
%36 = OpLabel
%tree_0 = OpVariable %_ptr_Function__arr_BST_uint_10 Function
%param = OpVariable %_ptr_Function_BST Function
%37 = OpLoad %_arr_BST_uint_10 %tree_0
%38 = OpCompositeExtract %BST %37 0
OpStore %param %38
%39 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_ %param
%40 = OpLoad %BST %param
%41 = OpLoad %_arr_BST_uint_10 %tree_0
%42 = OpCompositeInsert %_arr_BST_uint_10 %40 %41 0
OpStore %tree_0 %42
%43 = OpAccessChain %_ptr_Function_int %tree_0 %int_0 %int_2
%11 = OpLoad %_arr_BST_uint_10 %tree_0
%9 = OpCompositeExtract %int %11 0 2
%44 = OpIEqual %bool %9 %int_0
OpSelectionMerge %45 None
OpBranchConditional %44 %46 %45
%46 = OpLabel
OpBranch %47
%47 = OpLabel
OpLoopMerge %48 %47 None
OpBranch %47
%48 = OpLabel
OpUnreachable
%45 = OpLabel
%12 = OpLoad %_arr_BST_uint_10 %tree_0
%10 = OpCompositeExtract %int %12 0 2
%49 = OpConvertSToF %float %10
%50 = OpCompositeConstruct %v4float %49 %float_0 %float_0 %float_1
OpStore %_GLF_color %50
OpReturn
OpFunctionEnd
%makeTreeNode_struct_BST_i1_i1_i11_ = OpFunction %void None %17
%tree = OpFunctionParameter %_ptr_Function_BST
%51 = OpLabel
%52 = OpAccessChain %_ptr_Function_int %tree %int_2
OpStore %52 %int_1
OpReturn
OpFunctionEnd