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

153 lines
5.8 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 %lv "lv"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %_ ""
OpName %gv "gv"
OpName %gl_FragCoord "gl_FragCoord"
OpName %GLF_live5r "GLF_live5r"
OpName %GLF_live5_looplimiter6 "GLF_live5_looplimiter6"
OpName %_GLF_color "_GLF_color"
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %gl_FragCoord BuiltIn FragCoord
OpDecorate %GLF_live5r RelaxedPrecision
OpDecorate %GLF_live5_looplimiter6 RelaxedPrecision
OpDecorate %11 RelaxedPrecision
OpDecorate %12 RelaxedPrecision
OpDecorate %13 RelaxedPrecision
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%15 = OpTypeFunction %void
%float = OpTypeFloat 32
%_ptr_Function_float = OpTypePointer Function %float
%float_1 = OpConstant %float 1
%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_1 = OpConstant %uint 1
%_ptr_Uniform_float = OpTypePointer Uniform %float
%bool = OpTypeBool
%_ptr_Private_float = OpTypePointer Private %float
%gv = OpVariable %_ptr_Private_float Private
%float_260 = OpConstant %float 260
%int_250 = OpConstant %int 250
%int_180 = OpConstant %int 180
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
%_ptr_Input_float = OpTypePointer Input %float
%float_0 = OpConstant %float 0
%int_210 = OpConstant %int 210
%true = OpConstantTrue %bool
%_ptr_Function_int = OpTypePointer Function %int
%int_6 = OpConstant %int 6
%int_1 = OpConstant %int 1
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%41 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%main = OpFunction %void None %15
%42 = OpLabel
%lv = OpVariable %_ptr_Function_float Function
%43 = OpVariable %_ptr_Function_float Function
%GLF_live5r = OpVariable %_ptr_Function_int Function
%GLF_live5_looplimiter6 = OpVariable %_ptr_Function_int Function
%44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1
%45 = OpLoad %float %44
%46 = OpFOrdGreaterThan %bool %float_1 %45
OpSelectionMerge %47 None
OpBranchConditional %46 %48 %49
%48 = OpLabel
%50 = OpLoad %float %gv
%51 = OpExtInst %float %1 FAbs %50
OpStore %43 %51
OpBranch %47
%49 = OpLabel
OpStore %43 %float_260
OpBranch %47
%47 = OpLabel
%52 = OpLoad %float %43
OpStore %lv %52
%53 = OpLoad %float %lv
%54 = OpConvertFToS %int %53
%55 = OpSLessThan %bool %54 %int_250
OpSelectionMerge %56 None
OpBranchConditional %55 %57 %56
%57 = OpLabel
%58 = OpLoad %float %lv
%59 = OpConvertFToS %int %58
%60 = OpSLessThan %bool %59 %int_180
OpSelectionMerge %61 None
OpBranchConditional %60 %62 %63
%62 = OpLabel
%64 = OpLoad %float %lv
%65 = OpExtInst %float %1 FClamp %64 %float_1 %float_1
OpBranch %61
%63 = OpLabel
%66 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
%67 = OpLoad %float %66
%68 = OpFOrdLessThan %bool %67 %float_0
OpSelectionMerge %69 None
OpBranchConditional %68 %70 %69
%70 = OpLabel
%71 = OpLoad %float %lv
%72 = OpConvertFToS %int %71
%73 = OpSLessThan %bool %72 %int_210
OpSelectionMerge %74 None
OpBranchConditional %73 %75 %74
%75 = OpLabel
OpBranch %76
%76 = OpLabel
OpLoopMerge %77 %78 None
OpBranch %79
%79 = OpLabel
OpBranch %78
%78 = OpLabel
OpBranchConditional %true %76 %77
%77 = OpLabel
OpBranch %74
%74 = OpLabel
OpStore %GLF_live5r %int_0
OpBranch %80
%80 = OpLabel
OpLoopMerge %81 %82 None
OpBranch %83
%83 = OpLabel
OpBranchConditional %true %84 %81
%84 = OpLabel
%11 = OpLoad %int %GLF_live5_looplimiter6
%85 = OpSGreaterThanEqual %bool %11 %int_6
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %86
%87 = OpLabel
OpBranch %81
%86 = OpLabel
%12 = OpLoad %int %GLF_live5_looplimiter6
%13 = OpIAdd %int %12 %int_1
OpStore %GLF_live5_looplimiter6 %13
OpBranch %82
%82 = OpLabel
OpBranch %80
%81 = OpLabel
OpBranch %69
%69 = OpLabel
OpBranch %61
%61 = OpLabel
OpBranch %56
%56 = OpLabel
OpStore %_GLF_color %41
OpReturn
OpFunctionEnd