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

115 lines
5.2 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 320
OpName %main "main"
OpName %gl_FragCoord "gl_FragCoord"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "resolution"
OpName %_ ""
OpName %_GLF_color "_GLF_color"
OpName %indexable "indexable"
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
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%int_3 = OpConstant %int 3
%int_2 = OpConstant %int 2
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%float_8 = OpConstant %float 8
%uint = OpTypeInt 32 0
%int_8 = OpConstant %int 8
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%uint_16 = OpConstant %uint 16
%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%float_0_5 = OpConstant %float 0.5
%32 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1
%33 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1
%34 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1
%35 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1
%36 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1
%37 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1
%38 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1
%39 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%40 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
%41 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1
%42 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1
%43 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1
%44 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1
%45 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%46 = OpConstantComposite %_arr_v4float_uint_16 %30 %32 %33 %34 %35 %36 %37 %38 %30 %39 %40 %41 %42 %43 %44 %45
%int_16 = OpConstant %int 16
%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16
%_ptr_Function_v4float = OpTypePointer Function %v4float
%main = OpFunction %void None %9
%50 = OpLabel
%indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function
%51 = OpLoad %v4float %gl_FragCoord
%52 = OpVectorShuffle %v2float %51 %51 0 1
%53 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0
%54 = OpLoad %v2float %53
%55 = OpFDiv %v2float %52 %54
%56 = OpVectorTimesScalar %v2float %55 %float_8
%57 = OpExtInst %v2float %1 Floor %56
%58 = OpCompositeExtract %float %57 0
%59 = OpConvertFToS %int %58
%60 = OpIMul %int %59 %int_8
%61 = OpCompositeExtract %float %57 1
%62 = OpConvertFToS %int %61
%63 = OpIAdd %int %60 %62
OpBranch %64
%64 = OpLabel
%65 = OpPhi %int %int_0 %50 %66 %67
%68 = OpPhi %int %63 %50 %69 %67
%70 = OpSGreaterThan %bool %68 %int_1
OpLoopMerge %71 %67 None
OpBranchConditional %70 %72 %71
%72 = OpLabel
%73 = OpBitwiseAnd %int %68 %int_1
%74 = OpIEqual %bool %73 %int_1
OpSelectionMerge %75 None
OpBranchConditional %74 %76 %77
%76 = OpLabel
%78 = OpIMul %int %int_3 %68
%79 = OpIAdd %int %78 %int_1
OpBranch %75
%77 = OpLabel
%80 = OpSDiv %int %68 %int_2
OpBranch %75
%75 = OpLabel
%69 = OpPhi %int %79 %76 %80 %77
%66 = OpIAdd %int %65 %int_1
OpBranch %67
%67 = OpLabel
OpBranch %64
%71 = OpLabel
%81 = OpSMod %int %65 %int_16
OpStore %indexable %46
%82 = OpAccessChain %_ptr_Function_v4float %indexable %81
%83 = OpLoad %v4float %82
OpStore %_GLF_color %83
OpReturn
OpFunctionEnd