bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrFragmentProcessor_DEFINED |
| 9 | #define GrFragmentProcessor_DEFINED |
| 10 | |
John Stiles | f08a82b | 2020-06-16 16:34:12 -0400 | [diff] [blame] | 11 | #include <tuple> |
| 12 | |
Brian Osman | 1298bc4 | 2020-06-30 13:39:35 -0400 | [diff] [blame] | 13 | #include "include/private/SkSLSampleUsage.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 14 | #include "src/gpu/GrProcessor.h" |
Chris Dalton | 7eb5c0f | 2019-05-23 15:15:47 -0600 | [diff] [blame] | 15 | #include "src/gpu/ops/GrOp.h" |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 16 | |
egdaniel | 64c4728 | 2015-11-13 06:54:19 -0800 | [diff] [blame] | 17 | class GrGLSLFragmentProcessor; |
Chris Dalton | 1c54894 | 2018-05-22 13:09:48 -0600 | [diff] [blame] | 18 | class GrPaint; |
bsalomon | a624bf3 | 2016-09-20 09:12:47 -0700 | [diff] [blame] | 19 | class GrPipeline; |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame] | 20 | class GrProcessorKeyBuilder; |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 21 | class GrShaderCaps; |
Brian Osman | ce42551 | 2017-03-22 14:37:50 -0400 | [diff] [blame] | 22 | class GrSwizzle; |
Brian Salomon | d90b3d3 | 2020-07-09 12:04:31 -0400 | [diff] [blame] | 23 | class GrTextureEffect; |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 24 | |
Brian Salomon | 354147a | 2021-04-14 11:15:05 -0400 | [diff] [blame] | 25 | /** Provides custom fragment shader code. Fragment processors receive an input position and |
| 26 | produce an output color. They may contain uniforms and may have children fragment processors |
| 27 | that are sampled. |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 28 | */ |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 29 | class GrFragmentProcessor : public GrProcessor { |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 30 | public: |
Brian Salomon | 354147a | 2021-04-14 11:15:05 -0400 | [diff] [blame] | 31 | /** Always returns 'color'. */ |
| 32 | static std::unique_ptr<GrFragmentProcessor> MakeColor(SkPMColor4f color); |
| 33 | |
bsalomon | 87ba62e | 2015-09-22 06:41:59 -0700 | [diff] [blame] | 34 | /** |
| 35 | * In many instances (e.g. SkShader::asFragmentProcessor() implementations) it is desirable to |
| 36 | * only consider the input color's alpha. However, there is a competing desire to have reusable |
| 37 | * GrFragmentProcessor subclasses that can be used in other scenarios where the entire input |
| 38 | * color is considered. This function exists to filter the input color and pass it to a FP. It |
| 39 | * does so by returning a parent FP that multiplies the passed in FPs output by the parent's |
| 40 | * input alpha. The passed in FP will not receive an input color. |
| 41 | */ |
Mike Reed | 28eaed2 | 2018-02-01 11:24:53 -0500 | [diff] [blame] | 42 | static std::unique_ptr<GrFragmentProcessor> MulChildByInputAlpha( |
| 43 | std::unique_ptr<GrFragmentProcessor> child); |
| 44 | |
| 45 | /** |
| 46 | * Like MulChildByInputAlpha(), but reverses the sense of src and dst. In this case, return |
| 47 | * the input modulated by the child's alpha. The passed in FP will not receive an input color. |
| 48 | * |
| 49 | * output = input * child.a |
| 50 | */ |
| 51 | static std::unique_ptr<GrFragmentProcessor> MulInputByChildAlpha( |
| 52 | std::unique_ptr<GrFragmentProcessor> child); |
bsalomon | f1b7a1d | 2015-09-28 06:26:28 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
John Stiles | 7bf2600 | 2020-07-13 11:30:12 -0400 | [diff] [blame] | 55 | * Returns a fragment processor that generates the passed-in color, modulated by the child's |
John Stiles | da85888 | 2020-08-19 16:18:47 -0400 | [diff] [blame] | 56 | * alpha channel. (Pass a null FP to use the alpha from fInputColor instead of a child FP.) |
John Stiles | 7bf2600 | 2020-07-13 11:30:12 -0400 | [diff] [blame] | 57 | */ |
| 58 | static std::unique_ptr<GrFragmentProcessor> ModulateAlpha( |
| 59 | std::unique_ptr<GrFragmentProcessor> child, const SkPMColor4f& color); |
| 60 | |
| 61 | /** |
John Stiles | 8589430 | 2020-07-13 11:39:52 -0400 | [diff] [blame] | 62 | * Returns a fragment processor that generates the passed-in color, modulated by the child's |
John Stiles | da85888 | 2020-08-19 16:18:47 -0400 | [diff] [blame] | 63 | * RGBA color. (Pass a null FP to use the color from fInputColor instead of a child FP.) |
John Stiles | 8589430 | 2020-07-13 11:39:52 -0400 | [diff] [blame] | 64 | */ |
| 65 | static std::unique_ptr<GrFragmentProcessor> ModulateRGBA( |
| 66 | std::unique_ptr<GrFragmentProcessor> child, const SkPMColor4f& color); |
| 67 | |
| 68 | /** |
Brian Salomon | 22af73f | 2017-01-26 11:25:12 -0500 | [diff] [blame] | 69 | * This assumes that the input color to the returned processor will be unpremul and that the |
| 70 | * passed processor (which becomes the returned processor's child) produces a premul output. |
| 71 | * The result of the returned processor is a premul of its input color modulated by the child |
| 72 | * processor's premul output. |
bsalomon | f1b7a1d | 2015-09-28 06:26:28 -0700 | [diff] [blame] | 73 | */ |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 74 | static std::unique_ptr<GrFragmentProcessor> MakeInputPremulAndMulByOutput( |
| 75 | std::unique_ptr<GrFragmentProcessor>); |
bsalomon | f1b7a1d | 2015-09-28 06:26:28 -0700 | [diff] [blame] | 76 | |
| 77 | /** |
bsalomon | e25eea4 | 2015-09-29 06:38:55 -0700 | [diff] [blame] | 78 | * Returns a parent fragment processor that adopts the passed fragment processor as a child. |
| 79 | * The parent will ignore its input color and instead feed the passed in color as input to the |
| 80 | * child. |
bsalomon | f1b7a1d | 2015-09-28 06:26:28 -0700 | [diff] [blame] | 81 | */ |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 82 | static std::unique_ptr<GrFragmentProcessor> OverrideInput(std::unique_ptr<GrFragmentProcessor>, |
Brian Salomon | c0d79e5 | 2019-04-10 15:02:11 -0400 | [diff] [blame] | 83 | const SkPMColor4f&, |
| 84 | bool useUniform = true); |
bsalomon | 87ba62e | 2015-09-22 06:41:59 -0700 | [diff] [blame] | 85 | |
bsalomon | e25eea4 | 2015-09-29 06:38:55 -0700 | [diff] [blame] | 86 | /** |
dvonbeck | c526da9 | 2016-07-20 11:20:30 -0700 | [diff] [blame] | 87 | * Returns a fragment processor that premuls the input before calling the passed in fragment |
| 88 | * processor. |
| 89 | */ |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 90 | static std::unique_ptr<GrFragmentProcessor> PremulInput(std::unique_ptr<GrFragmentProcessor>); |
dvonbeck | c526da9 | 2016-07-20 11:20:30 -0700 | [diff] [blame] | 91 | |
| 92 | /** |
Brian Osman | ce42551 | 2017-03-22 14:37:50 -0400 | [diff] [blame] | 93 | * Returns a fragment processor that calls the passed in fragment processor, and then swizzles |
| 94 | * the output. |
| 95 | */ |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 96 | static std::unique_ptr<GrFragmentProcessor> SwizzleOutput(std::unique_ptr<GrFragmentProcessor>, |
| 97 | const GrSwizzle&); |
Brian Osman | ce42551 | 2017-03-22 14:37:50 -0400 | [diff] [blame] | 98 | |
| 99 | /** |
Brian Osman | 6f5e940 | 2020-01-22 10:39:31 -0500 | [diff] [blame] | 100 | * Returns a fragment processor that calls the passed in fragment processor, and then ensures |
| 101 | * the output is a valid premul color by clamping RGB to [0, A]. |
| 102 | */ |
| 103 | static std::unique_ptr<GrFragmentProcessor> ClampPremulOutput( |
| 104 | std::unique_ptr<GrFragmentProcessor>); |
| 105 | |
| 106 | /** |
John Stiles | 024d745 | 2020-07-22 19:07:15 -0400 | [diff] [blame] | 107 | * Returns a fragment processor that composes two fragment processors `f` and `g` into f(g(x)). |
Brian Osman | c5422d0 | 2021-03-12 16:06:35 -0500 | [diff] [blame] | 108 | * This is equivalent to running them in series (`g`, then `f`). This is not the same as |
| 109 | * transfer-mode composition; there is no blending step. |
John Stiles | 024d745 | 2020-07-22 19:07:15 -0400 | [diff] [blame] | 110 | */ |
| 111 | static std::unique_ptr<GrFragmentProcessor> Compose(std::unique_ptr<GrFragmentProcessor> f, |
| 112 | std::unique_ptr<GrFragmentProcessor> g); |
| 113 | |
| 114 | /** |
John Stiles | bb04e3d | 2021-06-04 12:09:11 -0400 | [diff] [blame] | 115 | * Returns a fragment processor that reads back the destination color; that is, sampling will |
| 116 | * return the color of the sample that is currently being painted over. |
| 117 | */ |
| 118 | static std::unique_ptr<GrFragmentProcessor> DestColor(); |
| 119 | |
| 120 | /** |
Brian Salomon | 0e05a82 | 2017-07-25 09:43:22 -0400 | [diff] [blame] | 121 | * Makes a copy of this fragment processor that draws equivalently to the original. |
Brian Salomon | 96271cd | 2017-07-31 16:27:23 -0400 | [diff] [blame] | 122 | * If the processor has child processors they are cloned as well. |
Brian Salomon | 0e05a82 | 2017-07-25 09:43:22 -0400 | [diff] [blame] | 123 | */ |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 124 | virtual std::unique_ptr<GrFragmentProcessor> clone() const = 0; |
Brian Salomon | 0e05a82 | 2017-07-25 09:43:22 -0400 | [diff] [blame] | 125 | |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 126 | // The FP this was registered with as a child function. This will be null if this is a root. |
| 127 | const GrFragmentProcessor* parent() const { return fParent; } |
| 128 | |
Brian Salomon | 18ab203 | 2021-02-23 10:07:05 -0500 | [diff] [blame] | 129 | std::unique_ptr<GrGLSLFragmentProcessor> makeProgramImpl() const; |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame] | 130 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 131 | void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { |
egdaniel | 57d3b03 | 2015-11-13 11:57:27 -0800 | [diff] [blame] | 132 | this->onGetGLSLProcessorKey(caps, b); |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 133 | for (const auto& child : fChildProcessors) { |
| 134 | if (child) { |
| 135 | child->getGLSLProcessorKey(caps, b); |
| 136 | } |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 137 | } |
| 138 | } |
| 139 | |
Brian Osman | 9cf98dc | 2020-07-01 17:21:27 -0400 | [diff] [blame] | 140 | int numVaryingCoordsUsed() const { return this->usesVaryingCoordsDirectly() ? 1 : 0; } |
joshualitt | abb52a1 | 2015-01-13 15:02:10 -0800 | [diff] [blame] | 141 | |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 142 | int numChildProcessors() const { return fChildProcessors.count(); } |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 143 | int numNonNullChildProcessors() const; |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 144 | |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 145 | GrFragmentProcessor* childProcessor(int index) { return fChildProcessors[index].get(); } |
| 146 | const GrFragmentProcessor* childProcessor(int index) const { |
| 147 | return fChildProcessors[index].get(); |
| 148 | } |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 149 | |
Robert Phillips | 82774f8 | 2019-06-20 14:38:27 -0400 | [diff] [blame] | 150 | SkDEBUGCODE(bool isInstantiated() const;) |
Robert Phillips | 9bee2e5 | 2017-05-29 12:37:20 -0400 | [diff] [blame] | 151 | |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 152 | /** |
Brian Osman | 9cf98dc | 2020-07-01 17:21:27 -0400 | [diff] [blame] | 153 | * Does this FP require local coordinates to be produced by the primitive processor? This only |
| 154 | * returns true if this FP will directly read those local coordinates. FPs that are sampled |
| 155 | * explicitly do not require primitive-generated local coordinates (because the sample |
| 156 | * coordinates are supplied by the parent FP). |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 157 | * |
| 158 | * If the root of an FP tree does not provide explicit coordinates, the geometry processor |
| 159 | * provides the original local coordinates to start. This may be implicit as part of vertex |
| 160 | * shader-lifted varyings, or by providing the base local coordinate to the fragment shader. |
| 161 | */ |
Brian Osman | 9cf98dc | 2020-07-01 17:21:27 -0400 | [diff] [blame] | 162 | bool usesVaryingCoordsDirectly() const { |
| 163 | return SkToBool(fFlags & kUsesSampleCoordsDirectly_Flag) && |
| 164 | !SkToBool(fFlags & kSampledWithExplicitCoords_Flag); |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Do any of the FPs in this tree require local coordinates to be produced by the primitive |
| 169 | * processor? This can return true even if this FP does not refer to sample coordinates, but |
| 170 | * true if a descendant FP uses them. |
| 171 | */ |
| 172 | bool usesVaryingCoords() const { |
Michael Ludwig | fbe2859 | 2020-06-26 16:02:15 -0400 | [diff] [blame] | 173 | return (SkToBool(fFlags & kUsesSampleCoordsDirectly_Flag) || |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 174 | SkToBool(fFlags & kUsesSampleCoordsIndirectly_Flag)) && |
| 175 | !SkToBool(fFlags & kSampledWithExplicitCoords_Flag); |
Ethan Nicholas | d4efe68 | 2019-08-29 16:10:13 -0400 | [diff] [blame] | 176 | } |
| 177 | |
John Stiles | e69f25f | 2021-06-03 12:23:33 -0400 | [diff] [blame] | 178 | /** Do any of the FPs in this tree read back the color from the destination surface? */ |
| 179 | bool willReadDstColor() const { |
| 180 | return SkToBool(fFlags & kWillReadDstColor_Flag); |
| 181 | } |
| 182 | |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 183 | /** |
| 184 | * True if this FP refers directly to the sample coordinate parameter of its function |
| 185 | * (e.g. uses EmitArgs::fSampleCoord in emitCode()). This also returns true if the |
| 186 | * coordinate reference comes from autogenerated code invoking 'sample(matrix)' expressions. |
| 187 | * |
Brian Osman | 9cf98dc | 2020-07-01 17:21:27 -0400 | [diff] [blame] | 188 | * Unlike usesVaryingCoords(), this can return true whether or not the FP is explicitly |
| 189 | * sampled, and does not change based on how the FP is composed. This property is specific to |
| 190 | * the FP's function and not the entire program. |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 191 | */ |
| 192 | bool referencesSampleCoords() const { |
Michael Ludwig | fbe2859 | 2020-06-26 16:02:15 -0400 | [diff] [blame] | 193 | return SkToBool(fFlags & kUsesSampleCoordsDirectly_Flag); |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | // True if this FP's parent invokes it with 'sample(float2)' or a variable 'sample(matrix)' |
Brian Salomon | b10a662 | 2020-02-20 13:36:01 -0500 | [diff] [blame] | 197 | bool isSampledWithExplicitCoords() const { |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 198 | return SkToBool(fFlags & kSampledWithExplicitCoords_Flag); |
Brian Salomon | 7d8b397 | 2019-11-26 22:34:44 -0500 | [diff] [blame] | 199 | } |
| 200 | |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 201 | // True if the transform chain from root to this FP introduces perspective into the local |
| 202 | // coordinate expression. |
| 203 | bool hasPerspectiveTransform() const { |
| 204 | return SkToBool(fFlags & kNetTransformHasPerspective_Flag); |
| 205 | } |
| 206 | |
Brian Osman | 1298bc4 | 2020-06-30 13:39:35 -0400 | [diff] [blame] | 207 | // The SampleUsage describing how this FP is invoked by its parent using 'sample(matrix)' |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 208 | // This only reflects the immediate sampling from parent to this FP |
Brian Osman | 1298bc4 | 2020-06-30 13:39:35 -0400 | [diff] [blame] | 209 | const SkSL::SampleUsage& sampleUsage() const { |
| 210 | return fUsage; |
Ethan Nicholas | 5843012 | 2020-04-14 09:54:02 -0400 | [diff] [blame] | 211 | } |
| 212 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 213 | /** |
Brian Salomon | f3b995b | 2017-02-15 10:22:23 -0500 | [diff] [blame] | 214 | * A GrDrawOp may premultiply its antialiasing coverage into its GrGeometryProcessor's color |
| 215 | * output under the following scenario: |
| 216 | * * all the color fragment processors report true to this query, |
| 217 | * * all the coverage fragment processors report true to this query, |
| 218 | * * the blend mode arithmetic allows for it it. |
| 219 | * To be compatible a fragment processor's output must be a modulation of its input color or |
| 220 | * alpha with a computed premultiplied color or alpha that is in 0..1 range. The computed color |
| 221 | * or alpha that is modulated against the input cannot depend on the input's alpha. The computed |
| 222 | * value cannot depend on the input's color channels unless it unpremultiplies the input color |
| 223 | * channels by the input alpha. |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 224 | */ |
Brian Salomon | f3b995b | 2017-02-15 10:22:23 -0500 | [diff] [blame] | 225 | bool compatibleWithCoverageAsAlpha() const { |
| 226 | return SkToBool(fFlags & kCompatibleWithCoverageAsAlpha_OptimizationFlag); |
| 227 | } |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 228 | |
| 229 | /** |
| 230 | * If this is true then all opaque input colors to the processor produce opaque output colors. |
| 231 | */ |
| 232 | bool preservesOpaqueInput() const { |
| 233 | return SkToBool(fFlags & kPreservesOpaqueInput_OptimizationFlag); |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Tests whether given a constant input color the processor produces a constant output color |
| 238 | * (for all fragments). If true outputColor will contain the constant color produces for |
| 239 | * inputColor. |
| 240 | */ |
Brian Osman | 1d5b598 | 2018-10-01 13:41:39 -0400 | [diff] [blame] | 241 | bool hasConstantOutputForConstantInput(SkPMColor4f inputColor, SkPMColor4f* outputColor) const { |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 242 | if (fFlags & kConstantOutputForConstantInput_OptimizationFlag) { |
| 243 | *outputColor = this->constantOutputForConstantInput(inputColor); |
| 244 | return true; |
| 245 | } |
| 246 | return false; |
| 247 | } |
| 248 | bool hasConstantOutputForConstantInput() const { |
| 249 | return SkToBool(fFlags & kConstantOutputForConstantInput_OptimizationFlag); |
| 250 | } |
dvonbeck | 9b03e7b | 2016-08-01 11:01:56 -0700 | [diff] [blame] | 251 | |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame] | 252 | /** Returns true if this and other processor conservatively draw identically. It can only return |
| 253 | true when the two processor are of the same subclass (i.e. they return the same object from |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 254 | from getFactory()). |
| 255 | |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame] | 256 | A return value of true from isEqual() should not be used to test whether the processor would |
egdaniel | 57d3b03 | 2015-11-13 11:57:27 -0800 | [diff] [blame] | 257 | generate the same shader code. To test for identical code generation use getGLSLProcessorKey |
| 258 | */ |
bsalomon | 7312ff8 | 2016-09-12 08:55:38 -0700 | [diff] [blame] | 259 | bool isEqual(const GrFragmentProcessor& that) const; |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 260 | |
Brian Salomon | d90b3d3 | 2020-07-09 12:04:31 -0400 | [diff] [blame] | 261 | void visitProxies(const GrOp::VisitProxyFunc& func) const; |
| 262 | |
| 263 | void visitTextureEffects(const std::function<void(const GrTextureEffect&)>&) const; |
| 264 | |
| 265 | GrTextureEffect* asTextureEffect(); |
| 266 | const GrTextureEffect* asTextureEffect() const; |
bsalomon | a624bf3 | 2016-09-20 09:12:47 -0700 | [diff] [blame] | 267 | |
John Stiles | 8d9bf64 | 2020-08-12 15:07:45 -0400 | [diff] [blame] | 268 | #if GR_TEST_UTILS |
John Stiles | ba1879d | 2020-08-11 13:58:32 -0400 | [diff] [blame] | 269 | // Generates debug info for this processor tree by recursively calling dumpInfo() on this |
| 270 | // processor and its children. |
| 271 | SkString dumpTreeInfo() const; |
John Stiles | ba1879d | 2020-08-11 13:58:32 -0400 | [diff] [blame] | 272 | #endif |
| 273 | |
Brian Salomon | c241b58 | 2019-11-27 08:57:17 -0500 | [diff] [blame] | 274 | // A pre-order traversal iterator over a hierarchy of FPs. It can also iterate over all the FP |
| 275 | // hierarchies rooted in a GrPaint, GrProcessorSet, or GrPipeline. For these collections it |
| 276 | // iterates the tree rooted at each color FP and then each coverage FP. |
| 277 | // |
| 278 | // An iterator is constructed from one of the srcs and used like this: |
| 279 | // for (GrFragmentProcessor::Iter iter(pipeline); iter; ++iter) { |
Brian Salomon | 7eabfe8 | 2019-12-02 14:20:20 -0500 | [diff] [blame] | 280 | // GrFragmentProcessor& fp = *iter; |
Brian Salomon | c241b58 | 2019-11-27 08:57:17 -0500 | [diff] [blame] | 281 | // } |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 282 | // The exit test for the loop is using CIter's operator bool(). |
Brian Salomon | 7eabfe8 | 2019-12-02 14:20:20 -0500 | [diff] [blame] | 283 | // To use a range-for loop instead see CIterRange below. |
Brian Salomon | 7eabfe8 | 2019-12-02 14:20:20 -0500 | [diff] [blame] | 284 | class CIter; |
bsalomon | a624bf3 | 2016-09-20 09:12:47 -0700 | [diff] [blame] | 285 | |
Brian Salomon | 7eabfe8 | 2019-12-02 14:20:20 -0500 | [diff] [blame] | 286 | // Used to implement a range-for loop using CIter. Src is one of GrFragmentProcessor, |
| 287 | // GrPaint, GrProcessorSet, or GrPipeline. Type aliases for these defined below. |
Brian Salomon | c241b58 | 2019-11-27 08:57:17 -0500 | [diff] [blame] | 288 | // Example usage: |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 289 | // for (const auto& fp : GrFragmentProcessor::PaintRange(paint)) { |
Brian Salomon | c241b58 | 2019-11-27 08:57:17 -0500 | [diff] [blame] | 290 | // if (fp.usesLocalCoords()) { |
| 291 | // ... |
| 292 | // } |
| 293 | // } |
Brian Salomon | 7eabfe8 | 2019-12-02 14:20:20 -0500 | [diff] [blame] | 294 | template <typename Src> class CIterRange; |
Brian Salomon | d90b3d3 | 2020-07-09 12:04:31 -0400 | [diff] [blame] | 295 | |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 296 | // We would use template deduction guides for CIter but for: |
Brian Salomon | c241b58 | 2019-11-27 08:57:17 -0500 | [diff] [blame] | 297 | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79501 |
| 298 | // Instead we use these specialized type aliases to make it prettier |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 299 | // to construct CIters for particular sources of FPs. |
| 300 | using FPRange = CIterRange<GrFragmentProcessor>; |
| 301 | using PaintRange = CIterRange<GrPaint>; |
bsalomon | a624bf3 | 2016-09-20 09:12:47 -0700 | [diff] [blame] | 302 | |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 303 | // Sentinel type for range-for using CIter. |
| 304 | class EndCIter {}; |
Robert Phillips | b493eeb | 2017-09-13 13:10:52 -0400 | [diff] [blame] | 305 | |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 306 | protected: |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 307 | enum OptimizationFlags : uint32_t { |
| 308 | kNone_OptimizationFlags, |
Brian Salomon | f3b995b | 2017-02-15 10:22:23 -0500 | [diff] [blame] | 309 | kCompatibleWithCoverageAsAlpha_OptimizationFlag = 0x1, |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 310 | kPreservesOpaqueInput_OptimizationFlag = 0x2, |
| 311 | kConstantOutputForConstantInput_OptimizationFlag = 0x4, |
Brian Salomon | f3b995b | 2017-02-15 10:22:23 -0500 | [diff] [blame] | 312 | kAll_OptimizationFlags = kCompatibleWithCoverageAsAlpha_OptimizationFlag | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 313 | kPreservesOpaqueInput_OptimizationFlag | |
| 314 | kConstantOutputForConstantInput_OptimizationFlag |
| 315 | }; |
| 316 | GR_DECL_BITFIELD_OPS_FRIENDS(OptimizationFlags) |
| 317 | |
Brian Salomon | 6cd51b5 | 2017-07-26 19:07:15 -0400 | [diff] [blame] | 318 | /** |
| 319 | * Can be used as a helper to decide which fragment processor OptimizationFlags should be set. |
| 320 | * This assumes that the subclass output color will be a modulation of the input color with a |
Greg Daniel | c594e62 | 2019-10-15 14:01:49 -0400 | [diff] [blame] | 321 | * value read from a texture of the passed color type and that the texture contains |
| 322 | * premultiplied color or alpha values that are in range. |
Michael Ludwig | 257a03d | 2018-12-13 14:07:07 -0500 | [diff] [blame] | 323 | * |
| 324 | * Since there are multiple ways in which a sampler may have its coordinates clamped or wrapped, |
| 325 | * callers must determine on their own if the sampling uses a decal strategy in any way, in |
Greg Daniel | c594e62 | 2019-10-15 14:01:49 -0400 | [diff] [blame] | 326 | * which case the texture may become transparent regardless of the color type. |
Brian Salomon | 6cd51b5 | 2017-07-26 19:07:15 -0400 | [diff] [blame] | 327 | */ |
Brian Salomon | fc11844 | 2019-11-22 19:09:27 -0500 | [diff] [blame] | 328 | static OptimizationFlags ModulateForSamplerOptFlags(SkAlphaType alphaType, bool samplingDecal) { |
Michael Ludwig | 257a03d | 2018-12-13 14:07:07 -0500 | [diff] [blame] | 329 | if (samplingDecal) { |
| 330 | return kCompatibleWithCoverageAsAlpha_OptimizationFlag; |
| 331 | } else { |
Brian Salomon | fc11844 | 2019-11-22 19:09:27 -0500 | [diff] [blame] | 332 | return ModulateForClampedSamplerOptFlags(alphaType); |
Michael Ludwig | 257a03d | 2018-12-13 14:07:07 -0500 | [diff] [blame] | 333 | } |
| 334 | } |
| 335 | |
| 336 | // As above, but callers should somehow ensure or assert their sampler still uses clamping |
Brian Salomon | fc11844 | 2019-11-22 19:09:27 -0500 | [diff] [blame] | 337 | static OptimizationFlags ModulateForClampedSamplerOptFlags(SkAlphaType alphaType) { |
| 338 | if (alphaType == kOpaque_SkAlphaType) { |
Brian Salomon | 6cd51b5 | 2017-07-26 19:07:15 -0400 | [diff] [blame] | 339 | return kCompatibleWithCoverageAsAlpha_OptimizationFlag | |
| 340 | kPreservesOpaqueInput_OptimizationFlag; |
| 341 | } else { |
| 342 | return kCompatibleWithCoverageAsAlpha_OptimizationFlag; |
| 343 | } |
| 344 | } |
| 345 | |
Ethan Nicholas | abff956 | 2017-10-09 10:54:08 -0400 | [diff] [blame] | 346 | GrFragmentProcessor(ClassID classID, OptimizationFlags optimizationFlags) |
Brian Salomon | b10a662 | 2020-02-20 13:36:01 -0500 | [diff] [blame] | 347 | : INHERITED(classID), fFlags(optimizationFlags) { |
Ethan Nicholas | d4efe68 | 2019-08-29 16:10:13 -0400 | [diff] [blame] | 348 | SkASSERT((optimizationFlags & ~kAll_OptimizationFlags) == 0); |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 349 | } |
| 350 | |
| 351 | OptimizationFlags optimizationFlags() const { |
| 352 | return static_cast<OptimizationFlags>(kAll_OptimizationFlags & fFlags); |
| 353 | } |
| 354 | |
Brian Salomon | c0d79e5 | 2019-04-10 15:02:11 -0400 | [diff] [blame] | 355 | /** Useful when you can't call fp->optimizationFlags() on a base class object from a subclass.*/ |
| 356 | static OptimizationFlags ProcessorOptimizationFlags(const GrFragmentProcessor* fp) { |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 357 | return fp ? fp->optimizationFlags() : kAll_OptimizationFlags; |
Brian Salomon | c0d79e5 | 2019-04-10 15:02:11 -0400 | [diff] [blame] | 358 | } |
| 359 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 360 | /** |
| 361 | * This allows one subclass to access another subclass's implementation of |
| 362 | * constantOutputForConstantInput. It must only be called when |
| 363 | * hasConstantOutputForConstantInput() is known to be true. |
| 364 | */ |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 365 | static SkPMColor4f ConstantOutputForConstantInput(const GrFragmentProcessor* fp, |
Brian Osman | 1d5b598 | 2018-10-01 13:41:39 -0400 | [diff] [blame] | 366 | const SkPMColor4f& input) { |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 367 | if (fp) { |
| 368 | SkASSERT(fp->hasConstantOutputForConstantInput()); |
| 369 | return fp->constantOutputForConstantInput(input); |
| 370 | } else { |
| 371 | return input; |
| 372 | } |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 373 | } |
| 374 | |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 375 | /** |
wangyix | 58d890b | 2015-08-12 09:40:47 -0700 | [diff] [blame] | 376 | * FragmentProcessor subclasses call this from their constructor to register any child |
wangyix | 93ab254 | 2015-08-19 08:23:12 -0700 | [diff] [blame] | 377 | * FragmentProcessors they have. This must be called AFTER all texture accesses and coord |
| 378 | * transforms have been added. |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 379 | * This is for processors whose shader code will be composed of nested processors whose output |
Brian Osman | 1298bc4 | 2020-06-30 13:39:35 -0400 | [diff] [blame] | 380 | * colors will be combined somehow to produce its output color. Registering these child |
wangyix | 58d890b | 2015-08-12 09:40:47 -0700 | [diff] [blame] | 381 | * processors will allow the ProgramBuilder to automatically handle their transformed coords and |
| 382 | * texture accesses and mangle their uniform and output color names. |
Michael Ludwig | 9aba625 | 2020-06-22 14:46:36 -0400 | [diff] [blame] | 383 | * |
Brian Osman | 1298bc4 | 2020-06-30 13:39:35 -0400 | [diff] [blame] | 384 | * The SampleUsage parameter describes all of the ways that the child is sampled by the parent. |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 385 | */ |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 386 | void registerChild(std::unique_ptr<GrFragmentProcessor> child, |
| 387 | SkSL::SampleUsage sampleUsage = SkSL::SampleUsage::PassThrough()); |
John Stiles | 3779f44 | 2020-06-15 10:48:49 -0400 | [diff] [blame] | 388 | |
John Stiles | 9ec6b05 | 2020-06-15 12:06:10 -0400 | [diff] [blame] | 389 | /** |
| 390 | * This method takes an existing fragment processor, clones all of its children, and registers |
| 391 | * the clones as children of this fragment processor. |
| 392 | */ |
| 393 | void cloneAndRegisterAllChildProcessors(const GrFragmentProcessor& src); |
| 394 | |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 395 | // FP implementations must call this function if their matching GrGLSLFragmentProcessor's |
| 396 | // emitCode() function uses the EmitArgs::fSampleCoord variable in generated SkSL. |
| 397 | void setUsesSampleCoordsDirectly() { |
| 398 | fFlags |= kUsesSampleCoordsDirectly_Flag; |
| 399 | } |
| 400 | |
John Stiles | bc4bc5f | 2021-06-11 16:43:15 -0400 | [diff] [blame^] | 401 | // FP implementations must set this flag if their GrGLSLFragmentProcessor's emitCode() function |
| 402 | // calls dstColor() to read back the framebuffer. |
| 403 | void setWillReadDstColor() { |
| 404 | fFlags |= kWillReadDstColor_Flag; |
| 405 | } |
| 406 | |
Brian Osman | c18a645 | 2021-03-22 11:44:03 -0400 | [diff] [blame] | 407 | void mergeOptimizationFlags(OptimizationFlags flags) { |
| 408 | SkASSERT((flags & ~kAll_OptimizationFlags) == 0); |
| 409 | fFlags &= (flags | ~kAll_OptimizationFlags); |
| 410 | } |
| 411 | |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 412 | private: |
Brian Osman | 1d5b598 | 2018-10-01 13:41:39 -0400 | [diff] [blame] | 413 | virtual SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& /* inputColor */) const { |
Ben Wagner | b4aab9a | 2017-08-16 10:53:04 -0400 | [diff] [blame] | 414 | SK_ABORT("Subclass must override this if advertising this optimization."); |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 415 | } |
| 416 | |
wangyix | b1daa86 | 2015-08-18 11:29:31 -0700 | [diff] [blame] | 417 | /** Returns a new instance of the appropriate *GL* implementation class |
| 418 | for the given GrFragmentProcessor; caller is responsible for deleting |
| 419 | the object. */ |
Brian Salomon | 18ab203 | 2021-02-23 10:07:05 -0500 | [diff] [blame] | 420 | virtual std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const = 0; |
wangyix | b1daa86 | 2015-08-18 11:29:31 -0700 | [diff] [blame] | 421 | |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 422 | /** Implemented using GLFragmentProcessor::GenKey as described in this class's comment. */ |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 423 | virtual void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0; |
wangyix | 4b3050b | 2015-08-04 07:59:37 -0700 | [diff] [blame] | 424 | |
bsalomon | de258cd | 2014-10-15 19:06:21 -0700 | [diff] [blame] | 425 | /** |
| 426 | * Subclass implements this to support isEqual(). It will only be called if it is known that |
| 427 | * the two processors are of the same subclass (i.e. they return the same object from |
Brian Osman | 9cf98dc | 2020-07-01 17:21:27 -0400 | [diff] [blame] | 428 | * getFactory()). |
bsalomon | de258cd | 2014-10-15 19:06:21 -0700 | [diff] [blame] | 429 | */ |
| 430 | virtual bool onIsEqual(const GrFragmentProcessor&) const = 0; |
| 431 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 432 | enum PrivateFlags { |
| 433 | kFirstPrivateFlag = kAll_OptimizationFlags + 1, |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 434 | |
John Stiles | e69f25f | 2021-06-03 12:23:33 -0400 | [diff] [blame] | 435 | // Propagates up the FP tree to the root |
Michael Ludwig | fbe2859 | 2020-06-26 16:02:15 -0400 | [diff] [blame] | 436 | kUsesSampleCoordsIndirectly_Flag = kFirstPrivateFlag, |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 437 | |
| 438 | // Does not propagate at all |
Michael Ludwig | fbe2859 | 2020-06-26 16:02:15 -0400 | [diff] [blame] | 439 | kUsesSampleCoordsDirectly_Flag = kFirstPrivateFlag << 1, |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 440 | |
| 441 | // Propagates down the FP to all its leaves |
Michael Ludwig | fbe2859 | 2020-06-26 16:02:15 -0400 | [diff] [blame] | 442 | kSampledWithExplicitCoords_Flag = kFirstPrivateFlag << 2, |
| 443 | kNetTransformHasPerspective_Flag = kFirstPrivateFlag << 3, |
John Stiles | e69f25f | 2021-06-03 12:23:33 -0400 | [diff] [blame] | 444 | |
| 445 | // Propagates up the FP tree to the root |
| 446 | kWillReadDstColor_Flag = kFirstPrivateFlag << 4, |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 447 | }; |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 448 | void addAndPushFlagToChildren(PrivateFlags flag); |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 449 | |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 450 | SkSTArray<1, std::unique_ptr<GrFragmentProcessor>, true> fChildProcessors; |
Michael Ludwig | e88320b | 2020-06-24 09:04:56 -0400 | [diff] [blame] | 451 | const GrFragmentProcessor* fParent = nullptr; |
Brian Salomon | d90b3d3 | 2020-07-09 12:04:31 -0400 | [diff] [blame] | 452 | uint32_t fFlags = 0; |
Brian Osman | 1298bc4 | 2020-06-30 13:39:35 -0400 | [diff] [blame] | 453 | SkSL::SampleUsage fUsage; |
Ethan Nicholas | 5843012 | 2020-04-14 09:54:02 -0400 | [diff] [blame] | 454 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 455 | using INHERITED = GrProcessor; |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 456 | }; |
| 457 | |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 458 | ////////////////////////////////////////////////////////////////////////////// |
| 459 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 460 | GR_MAKE_BITFIELD_OPS(GrFragmentProcessor::OptimizationFlags) |
| 461 | |
Brian Salomon | c241b58 | 2019-11-27 08:57:17 -0500 | [diff] [blame] | 462 | ////////////////////////////////////////////////////////////////////////////// |
| 463 | |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 464 | class GrFragmentProcessor::CIter { |
Brian Salomon | c241b58 | 2019-11-27 08:57:17 -0500 | [diff] [blame] | 465 | public: |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 466 | explicit CIter(const GrFragmentProcessor& fp) { fFPStack.push_back(&fp); } |
Brian Salomon | 7eabfe8 | 2019-12-02 14:20:20 -0500 | [diff] [blame] | 467 | explicit CIter(const GrPaint&); |
Brian Salomon | 7eabfe8 | 2019-12-02 14:20:20 -0500 | [diff] [blame] | 468 | explicit CIter(const GrPipeline&); |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 469 | |
| 470 | const GrFragmentProcessor& operator*() const { return *fFPStack.back(); } |
| 471 | const GrFragmentProcessor* operator->() const { return fFPStack.back(); } |
| 472 | |
| 473 | CIter& operator++(); |
| 474 | |
| 475 | operator bool() const { return !fFPStack.empty(); } |
| 476 | |
| 477 | bool operator!=(const EndCIter&) { return (bool)*this; } |
| 478 | |
| 479 | // Hopefully this does not actually get called because of RVO. |
| 480 | CIter(const CIter&) = default; |
| 481 | |
| 482 | // Because each iterator carries a stack we want to avoid copies. |
| 483 | CIter& operator=(const CIter&) = delete; |
| 484 | |
| 485 | protected: |
| 486 | CIter() = delete; |
| 487 | |
| 488 | SkSTArray<4, const GrFragmentProcessor*, true> fFPStack; |
Brian Salomon | 7eabfe8 | 2019-12-02 14:20:20 -0500 | [diff] [blame] | 489 | }; |
| 490 | |
| 491 | ////////////////////////////////////////////////////////////////////////////// |
| 492 | |
| 493 | template <typename Src> class GrFragmentProcessor::CIterRange { |
| 494 | public: |
| 495 | explicit CIterRange(const Src& t) : fT(t) {} |
| 496 | CIter begin() const { return CIter(fT); } |
Brian Salomon | 87f4d29 | 2020-07-09 12:48:38 -0400 | [diff] [blame] | 497 | EndCIter end() const { return EndCIter(); } |
Brian Salomon | c241b58 | 2019-11-27 08:57:17 -0500 | [diff] [blame] | 498 | |
| 499 | private: |
| 500 | const Src& fT; |
| 501 | }; |
| 502 | |
John Stiles | 72e5764 | 2020-06-24 10:42:35 -0400 | [diff] [blame] | 503 | /** |
| 504 | * Some fragment-processor creation methods have preconditions that might not be satisfied by the |
| 505 | * calling code. Those methods can return a `GrFPResult` from their factory methods. If creation |
| 506 | * succeeds, the new fragment processor is created and `success` is true. If a precondition is not |
| 507 | * met, `success` is set to false and the input FP is returned unchanged. |
| 508 | */ |
| 509 | using GrFPResult = std::tuple<bool /*success*/, std::unique_ptr<GrFragmentProcessor>>; |
| 510 | static inline GrFPResult GrFPFailure(std::unique_ptr<GrFragmentProcessor> fp) { |
| 511 | return {false, std::move(fp)}; |
| 512 | } |
| 513 | static inline GrFPResult GrFPSuccess(std::unique_ptr<GrFragmentProcessor> fp) { |
Brian Salomon | 066f411 | 2021-02-23 10:55:22 -0500 | [diff] [blame] | 514 | SkASSERT(fp); |
John Stiles | 72e5764 | 2020-06-24 10:42:35 -0400 | [diff] [blame] | 515 | return {true, std::move(fp)}; |
| 516 | } |
| 517 | |
bsalomon | 6251d17 | 2014-10-15 10:50:36 -0700 | [diff] [blame] | 518 | #endif |