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

126 lines
6.0 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
%float_0_0 = OpConstant %float 0
%51 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0
%52 = OpConstantComposite %_arr_v4float_uint_16 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51
%main = OpFunction %void None %9
%53 = OpLabel
%indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function
%54 = OpLoad %v4float %gl_FragCoord
%55 = OpVectorShuffle %v2float %54 %54 0 1
%56 = OpCompositeConstruct %v4float %float_0 %float_8 %55
%57 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0
%58 = OpLoad %v2float %57
%59 = OpCompositeConstruct %_arr_v4float_uint_16 %35 %43 %37 %44 %45 %37 %37 %36 %41 %54 %35 %34 %33 %32 %40 %39
%60 = OpFDiv %v2float %55 %58
%61 = OpVectorTimesScalar %v2float %60 %float_8
%62 = OpExtInst %v2float %1 Floor %61
%63 = OpCompositeConstruct %v4float %61 %float_0_5 %float_1
%64 = OpCompositeExtract %float %62 0
%65 = OpConvertFToS %int %64
%66 = OpIMul %int %65 %int_8
%67 = OpCompositeExtract %float %62 1
%68 = OpConvertFToS %int %67
%69 = OpIAdd %int %66 %68
OpBranch %70
%70 = OpLabel
%71 = OpPhi %int %int_0 %53 %72 %73
%74 = OpPhi %int %69 %53 %75 %73
%76 = OpSGreaterThan %bool %74 %int_1
OpLoopMerge %77 %73 None
OpBranchConditional %76 %78 %77
%78 = OpLabel
%79 = OpBitwiseAnd %int %74 %int_1
%80 = OpIEqual %bool %79 %int_1
OpSelectionMerge %81 None
OpBranchConditional %80 %82 %83
%82 = OpLabel
%84 = OpIMul %int %int_3 %74
%85 = OpIAdd %int %84 %int_1
OpBranch %81
%83 = OpLabel
%86 = OpSDiv %int %74 %int_2
OpBranch %81
%81 = OpLabel
%75 = OpPhi %int %85 %82 %86 %83
%72 = OpIAdd %int %71 %int_1
OpBranch %73
%73 = OpLabel
OpBranch %70
%77 = OpLabel
%87 = OpSMod %int %71 %int_16
OpStore %indexable %46
%88 = OpLoad %_arr_v4float_uint_16 %indexable
OpStore %indexable %52
OpStore %indexable %88
%89 = OpCompositeExtract %v4float %59 1
%90 = OpCompositeConstruct %_arr_v4float_uint_16 %36 %36 %40 %30 %36 %38 %43 %30 %40 %56 %35 %37 %36 %41 %43 %63
%91 = OpAccessChain %_ptr_Function_v4float %indexable %87
%92 = OpLoad %v4float %91
OpStore %_GLF_color %92
OpReturn
OpFunctionEnd