skia2/tests/sksl/blend/BlendOverlay.asm.frag
Ethan Nicholas a9c187e5cc Revert "Refactored SPIR-V RelaxedPrecision handling"
This reverts commit 9e476b798f.

Reason for revert: Angry Vulkan bots

Original change's description:
> Refactored SPIR-V RelaxedPrecision handling
>
> The RelaxedPrecision decoration is now handled by nextId(), to make it
> easier to see all spots where a RelaxedPrecision decoration might be
> necessary. The goal of this initial refactor is not to actually fix the
> issues with RelaxedPrecision decorations, but rather to lay the
> groundwork for doing so in followup CLs.
>
> The initial intent of this change was to not affect the SPIR-V at all,
> saving modifications for followups, but there ended up being three kinds
> of changes to the output:
>
> 1. Doing things at nextId() time rather than later means some
> decorations move to an earlier spot in the output. This results in
> diffs, but should not cause any behavioral changes.
> 2. We were incorrectly tagging bools as RelaxedPrecision in some
> situations. By funneling things through fewer code paths, the refactor
> would have caused this to happen in even more situations, and the code
> responsible for the bug was being rewritten in this CL anyway, so it
> seemed worth just fixing the issue as part of this change.
> 3. Funneling things through fewer code paths ended up adding
> (correct) RelaxedPrecision modifiers to binary operations that had
> previously been missing them. It seemed better to just let it happen
> than to try to maintain bug-for-bug compatibility with the previous
> approach.
>
> Change-Id: Ia9654d6b5754e2c797e02226660cb618c9189b36
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384318
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I9ada728e5fd5798bc1179640560c2e6045b7efd1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385158
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-03-15 21:24:47 +00:00

219 lines
7.1 KiB
JavaScript

### Compilation failed:
error: SPIR-V validation error: Variable must be decorated with a location
%src = OpVariable %_ptr_Input_v4float Input
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %sk_FragColor %sk_Clockwise %src %dst
OpExecutionMode %main OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %src "src"
OpName %dst "dst"
OpName %_blend_overlay_component "_blend_overlay_component"
OpName %blend_overlay "blend_overlay"
OpName %result "result"
OpName %main "main"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise RelaxedPrecision
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpDecorate %src RelaxedPrecision
OpDecorate %dst RelaxedPrecision
OpDecorate %22 RelaxedPrecision
OpDecorate %24 RelaxedPrecision
OpDecorate %25 RelaxedPrecision
OpDecorate %33 RelaxedPrecision
OpDecorate %35 RelaxedPrecision
OpDecorate %36 RelaxedPrecision
OpDecorate %38 RelaxedPrecision
OpDecorate %39 RelaxedPrecision
OpDecorate %41 RelaxedPrecision
OpDecorate %43 RelaxedPrecision
OpDecorate %44 RelaxedPrecision
OpDecorate %46 RelaxedPrecision
OpDecorate %48 RelaxedPrecision
OpDecorate %49 RelaxedPrecision
OpDecorate %50 RelaxedPrecision
OpDecorate %52 RelaxedPrecision
OpDecorate %54 RelaxedPrecision
OpDecorate %55 RelaxedPrecision
OpDecorate %56 RelaxedPrecision
OpDecorate %57 RelaxedPrecision
OpDecorate %64 RelaxedPrecision
OpDecorate %67 RelaxedPrecision
OpDecorate %71 RelaxedPrecision
OpDecorate %74 RelaxedPrecision
OpDecorate %78 RelaxedPrecision
OpDecorate %81 RelaxedPrecision
OpDecorate %85 RelaxedPrecision
OpDecorate %88 RelaxedPrecision
OpDecorate %90 RelaxedPrecision
OpDecorate %91 RelaxedPrecision
OpDecorate %93 RelaxedPrecision
OpDecorate %94 RelaxedPrecision
OpDecorate %96 RelaxedPrecision
OpDecorate %97 RelaxedPrecision
OpDecorate %99 RelaxedPrecision
OpDecorate %101 RelaxedPrecision
OpDecorate %103 RelaxedPrecision
OpDecorate %105 RelaxedPrecision
OpDecorate %107 RelaxedPrecision
OpDecorate %109 RelaxedPrecision
OpDecorate %111 RelaxedPrecision
OpDecorate %112 RelaxedPrecision
OpDecorate %114 RelaxedPrecision
OpDecorate %115 RelaxedPrecision
OpDecorate %119 RelaxedPrecision
OpDecorate %121 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_ptr_Input_v4float = OpTypePointer Input %v4float
%src = OpVariable %_ptr_Input_v4float Input
%dst = OpVariable %_ptr_Input_v4float Input
%v2float = OpTypeVector %float 2
%_ptr_Function_v2float = OpTypePointer Function %v2float
%16 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float
%float_2 = OpConstant %float 2
%_ptr_Function_float = OpTypePointer Function %float
%_ptr_Function_v4float = OpTypePointer Function %v4float
%58 = OpTypeFunction %v4float %_ptr_Function_v4float %_ptr_Function_v4float
%float_1 = OpConstant %float 1
%v3float = OpTypeVector %float 3
%void = OpTypeVoid
%117 = OpTypeFunction %void
%_blend_overlay_component = OpFunction %float None %16
%18 = OpFunctionParameter %_ptr_Function_v2float
%19 = OpFunctionParameter %_ptr_Function_v2float
%20 = OpLabel
%28 = OpVariable %_ptr_Function_float Function
%22 = OpLoad %v2float %19
%23 = OpCompositeExtract %float %22 0
%24 = OpFMul %float %float_2 %23
%25 = OpLoad %v2float %19
%26 = OpCompositeExtract %float %25 1
%27 = OpFOrdLessThanEqual %bool %24 %26
OpSelectionMerge %32 None
OpBranchConditional %27 %30 %31
%30 = OpLabel
%33 = OpLoad %v2float %18
%34 = OpCompositeExtract %float %33 0
%35 = OpFMul %float %float_2 %34
%36 = OpLoad %v2float %19
%37 = OpCompositeExtract %float %36 0
%38 = OpFMul %float %35 %37
OpStore %28 %38
OpBranch %32
%31 = OpLabel
%39 = OpLoad %v2float %18
%40 = OpCompositeExtract %float %39 1
%41 = OpLoad %v2float %19
%42 = OpCompositeExtract %float %41 1
%43 = OpFMul %float %40 %42
%44 = OpLoad %v2float %19
%45 = OpCompositeExtract %float %44 1
%46 = OpLoad %v2float %19
%47 = OpCompositeExtract %float %46 0
%48 = OpFSub %float %45 %47
%49 = OpFMul %float %float_2 %48
%50 = OpLoad %v2float %18
%51 = OpCompositeExtract %float %50 1
%52 = OpLoad %v2float %18
%53 = OpCompositeExtract %float %52 0
%54 = OpFSub %float %51 %53
%55 = OpFMul %float %49 %54
%56 = OpFSub %float %43 %55
OpStore %28 %56
OpBranch %32
%32 = OpLabel
%57 = OpLoad %float %28
OpReturnValue %57
OpFunctionEnd
%blend_overlay = OpFunction %v4float None %58
%60 = OpFunctionParameter %_ptr_Function_v4float
%61 = OpFunctionParameter %_ptr_Function_v4float
%62 = OpLabel
%result = OpVariable %_ptr_Function_v4float Function
%66 = OpVariable %_ptr_Function_v2float Function
%69 = OpVariable %_ptr_Function_v2float Function
%73 = OpVariable %_ptr_Function_v2float Function
%76 = OpVariable %_ptr_Function_v2float Function
%80 = OpVariable %_ptr_Function_v2float Function
%83 = OpVariable %_ptr_Function_v2float Function
%64 = OpLoad %v4float %60
%65 = OpVectorShuffle %v2float %64 %64 0 3
OpStore %66 %65
%67 = OpLoad %v4float %61
%68 = OpVectorShuffle %v2float %67 %67 0 3
OpStore %69 %68
%70 = OpFunctionCall %float %_blend_overlay_component %66 %69
%71 = OpLoad %v4float %60
%72 = OpVectorShuffle %v2float %71 %71 1 3
OpStore %73 %72
%74 = OpLoad %v4float %61
%75 = OpVectorShuffle %v2float %74 %74 1 3
OpStore %76 %75
%77 = OpFunctionCall %float %_blend_overlay_component %73 %76
%78 = OpLoad %v4float %60
%79 = OpVectorShuffle %v2float %78 %78 2 3
OpStore %80 %79
%81 = OpLoad %v4float %61
%82 = OpVectorShuffle %v2float %81 %81 2 3
OpStore %83 %82
%84 = OpFunctionCall %float %_blend_overlay_component %80 %83
%85 = OpLoad %v4float %60
%86 = OpCompositeExtract %float %85 3
%88 = OpLoad %v4float %60
%89 = OpCompositeExtract %float %88 3
%90 = OpFSub %float %float_1 %89
%91 = OpLoad %v4float %61
%92 = OpCompositeExtract %float %91 3
%93 = OpFMul %float %90 %92
%94 = OpFAdd %float %86 %93
%95 = OpCompositeConstruct %v4float %70 %77 %84 %94
OpStore %result %95
%96 = OpLoad %v4float %result
%97 = OpVectorShuffle %v3float %96 %96 0 1 2
%99 = OpLoad %v4float %61
%100 = OpVectorShuffle %v3float %99 %99 0 1 2
%101 = OpLoad %v4float %60
%102 = OpCompositeExtract %float %101 3
%103 = OpFSub %float %float_1 %102
%104 = OpVectorTimesScalar %v3float %100 %103
%105 = OpLoad %v4float %60
%106 = OpVectorShuffle %v3float %105 %105 0 1 2
%107 = OpLoad %v4float %61
%108 = OpCompositeExtract %float %107 3
%109 = OpFSub %float %float_1 %108
%110 = OpVectorTimesScalar %v3float %106 %109
%111 = OpFAdd %v3float %104 %110
%112 = OpFAdd %v3float %97 %111
%113 = OpLoad %v4float %result
%114 = OpVectorShuffle %v4float %113 %112 4 5 6 3
OpStore %result %114
%115 = OpLoad %v4float %result
OpReturnValue %115
OpFunctionEnd
%main = OpFunction %void None %117
%118 = OpLabel
%120 = OpVariable %_ptr_Function_v4float Function
%122 = OpVariable %_ptr_Function_v4float Function
%119 = OpLoad %v4float %src
OpStore %120 %119
%121 = OpLoad %v4float %dst
OpStore %122 %121
%123 = OpFunctionCall %v4float %blend_overlay %120 %122
OpStore %sk_FragColor %123
OpReturn
OpFunctionEnd
1 error