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

104 lines
3.6 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 %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %_ ""
OpName %_GLF_color "_GLF_color"
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%7 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%float_0 = OpConstant %float 0
%bool = OpTypeBool
%float_1 = OpConstant %float 1
%20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%true = OpConstantTrue %bool
%uint_1 = OpConstant %uint 1
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%false = OpConstantFalse %bool
%main = OpFunction %void None %7
%25 = OpLabel
OpBranch %26
%26 = OpLabel
OpLoopMerge %27 %28 None
OpBranch %29
%29 = OpLabel
%30 = OpPhi %bool %false %26 %31 %32
OpLoopMerge %33 %32 None
OpBranch %34
%34 = OpLabel
%35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1
%36 = OpLoad %float %35
%37 = OpFOrdGreaterThan %bool %36 %float_0
OpLoopMerge %38 %39 None
OpBranchConditional %37 %40 %38
%40 = OpLabel
OpBranch %41
%41 = OpLabel
OpLoopMerge %42 %43 None
OpBranch %44
%44 = OpLabel
%45 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0
%46 = OpLoad %float %45
%47 = OpFOrdGreaterThan %bool %46 %float_0
OpSelectionMerge %48 None
OpBranchConditional %47 %49 %48
%49 = OpLabel
%50 = OpFunctionCall %void %51
%52 = OpUndef %v4float
OpBranch %42
%48 = OpLabel
%53 = OpCompositeConstruct %v4float %46 %46 %46 %46
%54 = OpFAdd %v4float %20 %53
OpBranch %42
%43 = OpLabel
OpBranch %41
%42 = OpLabel
%55 = OpPhi %v4float %52 %49 %54 %48
OpStore %_GLF_color %55
OpBranch %38
%39 = OpLabel
OpBranch %34
%38 = OpLabel
%31 = OpPhi %bool %30 %34 %true %42
OpSelectionMerge %56 None
OpBranchConditional %31 %33 %32
%56 = OpLabel
OpBranch %32
%32 = OpLabel
OpBranch %29
%33 = OpLabel
OpSelectionMerge %57 None
OpBranchConditional %31 %27 %57
%57 = OpLabel
OpBranch %27
%28 = OpLabel
OpBranch %26
%27 = OpLabel
OpReturn
OpFunctionEnd
%51 = OpFunction %void None %7
%58 = OpLabel
OpKill
OpFunctionEnd