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

124 lines
4.7 KiB
Plaintext

OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 310
OpName %main "main"
OpName %func_f1_ "func(f1;"
OpName %x "x"
OpName %gl_FragCoord "gl_FragCoord"
OpName %f "f"
OpName %i "i"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "five"
OpName %_ ""
OpName %param "param"
OpName %_GLF_color "_GLF_color"
OpDecorate %gl_FragCoord BuiltIn FragCoord
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%13 = OpTypeFunction %void
%float = OpTypeFloat 32
%_ptr_Function_float = OpTypePointer Function %float
%16 = OpTypeFunction %float %_ptr_Function_float
%float_5 = OpConstant %float 5
%bool = OpTypeBool
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Input_float = OpTypePointer Input %float
%float_0_5 = OpConstant %float 0.5
%uint_1 = OpConstant %uint 1
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%int_0 = OpConstant %int 0
%buf0 = OpTypeStruct %int
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_1 = OpConstant %int 1
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%35 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%36 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%main = OpFunction %void None %13
%37 = OpLabel
%f = OpVariable %_ptr_Function_float Function
%i = OpVariable %_ptr_Function_int Function
%param = OpVariable %_ptr_Function_float Function
OpStore %f %float_0
OpStore %i %int_0
OpBranch %38
%38 = OpLabel
%39 = OpLoad %int %i
%40 = OpAccessChain %_ptr_Uniform_int %_ %int_0
%41 = OpLoad %int %40
%42 = OpSLessThan %bool %39 %41
OpLoopMerge %43 %44 None
OpBranchConditional %42 %44 %43
%44 = OpLabel
%45 = OpLoad %int %i
%46 = OpConvertSToF %float %45
OpStore %param %46
%47 = OpFunctionCall %float %func_f1_ %param
OpStore %f %47
%48 = OpLoad %int %i
%49 = OpIAdd %int %48 %int_1
OpStore %i %49
OpBranch %38
%43 = OpLabel
%50 = OpLoad %float %f
%51 = OpFOrdEqual %bool %50 %float_5
OpSelectionMerge %52 None
OpBranchConditional %51 %53 %54
%53 = OpLabel
OpStore %_GLF_color %35
OpBranch %52
%54 = OpLabel
OpStore %_GLF_color %36
OpBranch %52
%52 = OpLabel
OpReturn
OpFunctionEnd
%func_f1_ = OpFunction %float None %16
%x = OpFunctionParameter %_ptr_Function_float
%55 = OpLabel
%56 = OpLoad %float %x
%57 = OpFOrdGreaterThan %bool %56 %float_5
OpSelectionMerge %58 None
OpBranchConditional %57 %59 %58
%59 = OpLabel
%60 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0
%61 = OpLoad %float %60
%62 = OpFOrdLessThan %bool %61 %float_0_5
OpSelectionMerge %63 None
OpBranchConditional %62 %64 %65
%64 = OpLabel
OpKill
%65 = OpLabel
%66 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
%67 = OpLoad %float %66
%68 = OpFOrdLessThan %bool %67 %float_0_5
OpSelectionMerge %69 None
OpBranchConditional %68 %70 %69
%70 = OpLabel
OpKill
%69 = OpLabel
OpBranch %63
%63 = OpLabel
OpBranch %58
%58 = OpLabel
%71 = OpLoad %float %x
%72 = OpFAdd %float %71 %float_1
OpReturnValue %72
OpFunctionEnd