Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 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 GrSimpleMeshDrawOpHelperWithStencil_DEFINED |
| 9 | #define GrSimpleMeshDrawOpHelperWithStencil_DEFINED |
| 10 | |
| 11 | #include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h" |
| 12 | |
| 13 | /** |
| 14 | * This class extends GrSimpleMeshDrawOpHelper to support an optional GrUserStencilSettings. This |
| 15 | * uses private inheritance because it non-virtually overrides methods in the base class and should |
| 16 | * never be used with a GrSimpleMeshDrawOpHelper pointer or reference. |
| 17 | */ |
| 18 | class GrSimpleMeshDrawOpHelperWithStencil : private GrSimpleMeshDrawOpHelper { |
| 19 | public: |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 20 | using InputFlags = GrSimpleMeshDrawOpHelper::InputFlags; |
| 21 | |
| 22 | using GrSimpleMeshDrawOpHelper::visitProxies; |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 23 | using GrSimpleMeshDrawOpHelper::createPipeline; |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 24 | |
Robert Phillips | 50d7d6f | 2020-03-04 11:12:24 -0500 | [diff] [blame] | 25 | GrProgramInfo* createProgramInfoWithStencil(const GrCaps*, |
| 26 | SkArenaAlloc*, |
Chris Dalton | 2a26c50 | 2021-08-26 10:05:11 -0600 | [diff] [blame] | 27 | const GrSurfaceProxyView& writeView, |
| 28 | bool usesMSAASurface, |
Robert Phillips | 50d7d6f | 2020-03-04 11:12:24 -0500 | [diff] [blame] | 29 | GrAppliedClip&&, |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 30 | const GrDstProxyView&, |
Robert Phillips | 50d7d6f | 2020-03-04 11:12:24 -0500 | [diff] [blame] | 31 | GrGeometryProcessor*, |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 32 | GrPrimitiveType, |
Greg Daniel | 42dbca5 | 2020-11-20 10:22:43 -0500 | [diff] [blame] | 33 | GrXferBarrierFlags renderPassXferBarriers, |
| 34 | GrLoadOp colorLoadOp); |
Robert Phillips | 50d7d6f | 2020-03-04 11:12:24 -0500 | [diff] [blame] | 35 | |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 36 | // using declarations can't be templated, so this is a pass through function instead. |
| 37 | template <typename Op, typename... OpArgs> |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 38 | static GrOp::Owner FactoryHelper(GrRecordingContext* context, GrPaint&& paint, |
| 39 | OpArgs... opArgs) { |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 40 | return GrSimpleMeshDrawOpHelper::FactoryHelper<Op, OpArgs...>( |
| 41 | context, std::move(paint), std::forward<OpArgs>(opArgs)...); |
| 42 | } |
| 43 | |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 44 | GrSimpleMeshDrawOpHelperWithStencil(GrProcessorSet*, GrAAType, const GrUserStencilSettings*, |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 45 | InputFlags = InputFlags::kNone); |
| 46 | |
| 47 | GrDrawOp::FixedFunctionFlags fixedFunctionFlags() const; |
| 48 | |
Chris Dalton | 57ab06c | 2021-04-22 12:57:28 -0600 | [diff] [blame] | 49 | GrProcessorSet::Analysis finalizeProcessors(const GrCaps& caps, const GrAppliedClip* clip, |
| 50 | GrClampType clampType, |
| 51 | GrProcessorAnalysisCoverage geometryCoverage, |
| 52 | GrProcessorAnalysisColor* geometryColor) { |
| 53 | return this->INHERITED::finalizeProcessors(caps, clip, fStencilSettings, clampType, |
| 54 | geometryCoverage, geometryColor); |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 55 | } |
| 56 | |
Chris Dalton | 57ab06c | 2021-04-22 12:57:28 -0600 | [diff] [blame] | 57 | GrProcessorSet::Analysis finalizeProcessors(const GrCaps&, const GrAppliedClip*, GrClampType, |
| 58 | GrProcessorAnalysisCoverage geometryCoverage, |
| 59 | SkPMColor4f* geometryColor, bool* wideColor); |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 60 | |
| 61 | using GrSimpleMeshDrawOpHelper::aaType; |
| 62 | using GrSimpleMeshDrawOpHelper::setAAType; |
| 63 | using GrSimpleMeshDrawOpHelper::isTrivial; |
| 64 | using GrSimpleMeshDrawOpHelper::usesLocalCoords; |
| 65 | using GrSimpleMeshDrawOpHelper::compatibleWithCoverageAsAlpha; |
| 66 | using GrSimpleMeshDrawOpHelper::detachProcessorSet; |
| 67 | using GrSimpleMeshDrawOpHelper::pipelineFlags; |
| 68 | |
| 69 | bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps&, |
| 70 | const SkRect& thisBounds, const SkRect& thatBounds, |
| 71 | bool ignoreAAType = false) const; |
| 72 | |
John Stiles | 8d9bf64 | 2020-08-12 15:07:45 -0400 | [diff] [blame] | 73 | #if GR_TEST_UTILS |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 74 | SkString dumpInfo() const; |
| 75 | #endif |
| 76 | |
| 77 | const GrUserStencilSettings* stencilSettings() const { return fStencilSettings; } |
| 78 | |
| 79 | private: |
| 80 | const GrUserStencilSettings* fStencilSettings; |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 81 | using INHERITED = GrSimpleMeshDrawOpHelper; |
Robert Phillips | 55f681f | 2020-02-28 08:58:15 -0500 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | #endif |