Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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 | |
Robert Phillips | 06273bc | 2021-08-11 15:43:50 -0400 | [diff] [blame] | 8 | #include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h" |
| 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "src/gpu/GrAppliedClip.h" |
| 11 | #include "src/gpu/GrProcessorSet.h" |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 12 | #include "src/gpu/GrProgramInfo.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "src/gpu/GrUserStencilSettings.h" |
| 14 | #include "src/gpu/SkGr.h" |
Michael Ludwig | 663afe5 | 2019-06-03 16:46:19 -0400 | [diff] [blame] | 15 | #include "src/gpu/geometry/GrRect.h" |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 16 | |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 17 | GrSimpleMeshDrawOpHelper::GrSimpleMeshDrawOpHelper(GrProcessorSet* processorSet, |
Robert Phillips | 360ec18 | 2020-03-26 13:29:50 -0400 | [diff] [blame] | 18 | GrAAType aaType, |
Chris Dalton | baa1b35 | 2019-04-03 12:03:00 -0600 | [diff] [blame] | 19 | InputFlags inputFlags) |
Herb Derby | c76d409 | 2020-10-07 16:46:15 -0400 | [diff] [blame] | 20 | : fProcessors(processorSet) |
Chris Dalton | baa1b35 | 2019-04-03 12:03:00 -0600 | [diff] [blame] | 21 | , fPipelineFlags((GrPipeline::InputFlags)inputFlags) |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 22 | , fAAType((int)aaType) |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 23 | , fUsesLocalCoords(false) |
Brian Osman | 605c6d5 | 2019-03-15 12:10:35 -0400 | [diff] [blame] | 24 | , fCompatibleWithCoverageAsAlpha(false) { |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 25 | SkDEBUGCODE(fDidAnalysis = false); |
Brian Salomon | bfd18cd | 2017-08-09 16:27:09 -0400 | [diff] [blame] | 26 | SkDEBUGCODE(fMadePipeline = false); |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | GrSimpleMeshDrawOpHelper::~GrSimpleMeshDrawOpHelper() { |
| 30 | if (fProcessors) { |
| 31 | fProcessors->~GrProcessorSet(); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | GrDrawOp::FixedFunctionFlags GrSimpleMeshDrawOpHelper::fixedFunctionFlags() const { |
Robert Phillips | 360ec18 | 2020-03-26 13:29:50 -0400 | [diff] [blame] | 36 | return GrAATypeIsHW(this->aaType()) ? GrDrawOp::FixedFunctionFlags::kUsesHWAA |
| 37 | : GrDrawOp::FixedFunctionFlags::kNone; |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | bool GrSimpleMeshDrawOpHelper::isCompatible(const GrSimpleMeshDrawOpHelper& that, |
| 41 | const GrCaps& caps, const SkRect& thisBounds, |
Robert Phillips | b69001f | 2019-10-29 12:16:35 -0400 | [diff] [blame] | 42 | const SkRect& thatBounds, bool ignoreAAType) const { |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 43 | if (SkToBool(fProcessors) != SkToBool(that.fProcessors)) { |
| 44 | return false; |
| 45 | } |
| 46 | if (fProcessors) { |
| 47 | if (*fProcessors != *that.fProcessors) { |
| 48 | return false; |
| 49 | } |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 50 | } |
Robert Phillips | b69001f | 2019-10-29 12:16:35 -0400 | [diff] [blame] | 51 | |
| 52 | #ifdef SK_DEBUG |
| 53 | if (ignoreAAType) { |
| 54 | // If we're ignoring AA it should be bc we already know they are the same or that |
| 55 | // the are different but are compatible (i.e., one is AA and the other is None) |
Robert Phillips | bbd459d | 2019-10-29 14:40:03 -0400 | [diff] [blame] | 56 | SkASSERT(fAAType == that.fAAType || |
| 57 | GrMeshDrawOp::CanUpgradeAAOnMerge(this->aaType(), that.aaType())); |
Robert Phillips | b69001f | 2019-10-29 12:16:35 -0400 | [diff] [blame] | 58 | } |
| 59 | #endif |
| 60 | |
| 61 | bool result = fPipelineFlags == that.fPipelineFlags && |
| 62 | (ignoreAAType || fAAType == that.fAAType); |
Brian Osman | 605c6d5 | 2019-03-15 12:10:35 -0400 | [diff] [blame] | 63 | SkASSERT(!result || fCompatibleWithCoverageAsAlpha == that.fCompatibleWithCoverageAsAlpha); |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 64 | SkASSERT(!result || fUsesLocalCoords == that.fUsesLocalCoords); |
| 65 | return result; |
| 66 | } |
| 67 | |
Chris Dalton | 4b62aed | 2019-01-15 11:53:00 -0700 | [diff] [blame] | 68 | GrProcessorSet::Analysis GrSimpleMeshDrawOpHelper::finalizeProcessors( |
Chris Dalton | 57ab06c | 2021-04-22 12:57:28 -0600 | [diff] [blame] | 69 | const GrCaps& caps, const GrAppliedClip* clip, GrClampType clampType, |
| 70 | GrProcessorAnalysisCoverage geometryCoverage, SkPMColor4f* geometryColor, bool* wideColor) { |
Chris Dalton | b8fff0d | 2019-03-05 10:11:58 -0700 | [diff] [blame] | 71 | GrProcessorAnalysisColor color = *geometryColor; |
Chris Dalton | 57ab06c | 2021-04-22 12:57:28 -0600 | [diff] [blame] | 72 | auto result = this->finalizeProcessors(caps, clip, clampType, geometryCoverage, &color); |
Chris Dalton | b8fff0d | 2019-03-05 10:11:58 -0700 | [diff] [blame] | 73 | color.isConstant(geometryColor); |
Brian Osman | 8fa7ab4 | 2019-03-18 10:22:42 -0400 | [diff] [blame] | 74 | if (wideColor) { |
Brian Osman | 2715bf5 | 2019-12-06 14:38:47 -0500 | [diff] [blame] | 75 | *wideColor = !geometryColor->fitsInBytes(); |
Brian Osman | 8fa7ab4 | 2019-03-18 10:22:42 -0400 | [diff] [blame] | 76 | } |
Chris Dalton | b8fff0d | 2019-03-05 10:11:58 -0700 | [diff] [blame] | 77 | return result; |
| 78 | } |
| 79 | |
| 80 | GrProcessorSet::Analysis GrSimpleMeshDrawOpHelper::finalizeProcessors( |
| 81 | const GrCaps& caps, const GrAppliedClip* clip, const GrUserStencilSettings* userStencil, |
Chris Dalton | 57ab06c | 2021-04-22 12:57:28 -0600 | [diff] [blame] | 82 | GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage, |
| 83 | GrProcessorAnalysisColor* geometryColor) { |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 84 | SkDEBUGCODE(fDidAnalysis = true); |
| 85 | GrProcessorSet::Analysis analysis; |
| 86 | if (fProcessors) { |
| 87 | GrProcessorAnalysisCoverage coverage = geometryCoverage; |
| 88 | if (GrProcessorAnalysisCoverage::kNone == coverage) { |
Chris Dalton | 83420eb | 2021-06-23 18:47:09 -0600 | [diff] [blame] | 89 | coverage = (clip && clip->hasCoverageFragmentProcessor()) |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 90 | ? GrProcessorAnalysisCoverage::kSingleChannel |
| 91 | : GrProcessorAnalysisCoverage::kNone; |
| 92 | } |
Brian Osman | cf86085 | 2018-10-31 14:04:39 -0400 | [diff] [blame] | 93 | SkPMColor4f overrideColor; |
Chris Dalton | 57ab06c | 2021-04-22 12:57:28 -0600 | [diff] [blame] | 94 | analysis = fProcessors->finalize(*geometryColor, coverage, clip, userStencil, caps, |
| 95 | clampType, &overrideColor); |
Brian Salomon | 0088f94 | 2017-07-12 11:51:27 -0400 | [diff] [blame] | 96 | if (analysis.inputColorIsOverridden()) { |
| 97 | *geometryColor = overrideColor; |
| 98 | } |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 99 | } else { |
| 100 | analysis = GrProcessorSet::EmptySetAnalysis(); |
| 101 | } |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 102 | fUsesLocalCoords = analysis.usesLocalCoords(); |
Brian Osman | 605c6d5 | 2019-03-15 12:10:35 -0400 | [diff] [blame] | 103 | fCompatibleWithCoverageAsAlpha = analysis.isCompatibleWithCoverageAsAlpha(); |
Chris Dalton | 4b62aed | 2019-01-15 11:53:00 -0700 | [diff] [blame] | 104 | return analysis; |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 105 | } |
| 106 | |
Robert Phillips | 3968fcb | 2019-12-05 16:40:31 -0500 | [diff] [blame] | 107 | const GrPipeline* GrSimpleMeshDrawOpHelper::CreatePipeline( |
Robert Phillips | 6c59fe4 | 2020-02-27 09:30:37 -0500 | [diff] [blame] | 108 | const GrCaps* caps, |
| 109 | SkArenaAlloc* arena, |
Brian Salomon | 8afde5f | 2020-04-01 16:22:00 -0400 | [diff] [blame] | 110 | GrSwizzle writeViewSwizzle, |
Robert Phillips | 6c59fe4 | 2020-02-27 09:30:37 -0500 | [diff] [blame] | 111 | GrAppliedClip&& appliedClip, |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 112 | const GrDstProxyView& dstProxyView, |
Robert Phillips | 6c59fe4 | 2020-02-27 09:30:37 -0500 | [diff] [blame] | 113 | GrProcessorSet&& processorSet, |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 114 | GrPipeline::InputFlags pipelineFlags) { |
Robert Phillips | 3968fcb | 2019-12-05 16:40:31 -0500 | [diff] [blame] | 115 | GrPipeline::InitArgs pipelineArgs; |
| 116 | |
| 117 | pipelineArgs.fInputFlags = pipelineFlags; |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 118 | pipelineArgs.fCaps = caps; |
| 119 | pipelineArgs.fDstProxyView = dstProxyView; |
Brian Salomon | 8afde5f | 2020-04-01 16:22:00 -0400 | [diff] [blame] | 120 | pipelineArgs.fWriteSwizzle = writeViewSwizzle; |
Robert Phillips | 3968fcb | 2019-12-05 16:40:31 -0500 | [diff] [blame] | 121 | |
Robert Phillips | 6c59fe4 | 2020-02-27 09:30:37 -0500 | [diff] [blame] | 122 | return arena->make<GrPipeline>(pipelineArgs, |
| 123 | std::move(processorSet), |
| 124 | std::move(appliedClip)); |
| 125 | } |
| 126 | |
| 127 | const GrPipeline* GrSimpleMeshDrawOpHelper::CreatePipeline( |
| 128 | GrOpFlushState* flushState, |
| 129 | GrProcessorSet&& processorSet, |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 130 | GrPipeline::InputFlags pipelineFlags) { |
Robert Phillips | 6c59fe4 | 2020-02-27 09:30:37 -0500 | [diff] [blame] | 131 | return CreatePipeline(&flushState->caps(), |
| 132 | flushState->allocator(), |
Adlai Holler | e2296f7 | 2020-11-19 13:41:26 -0500 | [diff] [blame] | 133 | flushState->writeView().swizzle(), |
Robert Phillips | 6c59fe4 | 2020-02-27 09:30:37 -0500 | [diff] [blame] | 134 | flushState->detachAppliedClip(), |
| 135 | flushState->dstProxyView(), |
| 136 | std::move(processorSet), |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 137 | pipelineFlags); |
Robert Phillips | 6c59fe4 | 2020-02-27 09:30:37 -0500 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | const GrPipeline* GrSimpleMeshDrawOpHelper::createPipeline(GrOpFlushState* flushState) { |
| 141 | return CreatePipeline(&flushState->caps(), |
| 142 | flushState->allocator(), |
Adlai Holler | e2296f7 | 2020-11-19 13:41:26 -0500 | [diff] [blame] | 143 | flushState->writeView().swizzle(), |
Robert Phillips | 6c59fe4 | 2020-02-27 09:30:37 -0500 | [diff] [blame] | 144 | flushState->detachAppliedClip(), |
| 145 | flushState->dstProxyView(), |
| 146 | this->detachProcessorSet(), |
| 147 | this->pipelineFlags()); |
Chris Dalton | 07cdcfc9 | 2019-02-26 11:13:22 -0700 | [diff] [blame] | 148 | } |
| 149 | |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 150 | const GrPipeline* GrSimpleMeshDrawOpHelper::createPipeline( |
| 151 | const GrCaps* caps, |
| 152 | SkArenaAlloc* arena, |
| 153 | GrSwizzle writeViewSwizzle, |
| 154 | GrAppliedClip&& appliedClip, |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 155 | const GrDstProxyView& dstProxyView) { |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 156 | return GrSimpleMeshDrawOpHelper::CreatePipeline(caps, |
| 157 | arena, |
| 158 | writeViewSwizzle, |
| 159 | std::move(appliedClip), |
| 160 | dstProxyView, |
| 161 | this->detachProcessorSet(), |
| 162 | this->pipelineFlags()); |
| 163 | } |
| 164 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 165 | GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo( |
| 166 | const GrCaps* caps, |
| 167 | SkArenaAlloc* arena, |
Adlai Holler | e2296f7 | 2020-11-19 13:41:26 -0500 | [diff] [blame] | 168 | const GrSurfaceProxyView& writeView, |
Chris Dalton | 2a26c50 | 2021-08-26 10:05:11 -0600 | [diff] [blame] | 169 | bool usesMSAASurface, |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 170 | GrAppliedClip&& appliedClip, |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 171 | const GrDstProxyView& dstProxyView, |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 172 | GrGeometryProcessor* geometryProcessor, |
| 173 | GrProcessorSet&& processorSet, |
Robert Phillips | ac6156c | 2020-02-28 16:02:40 -0500 | [diff] [blame] | 174 | GrPrimitiveType primitiveType, |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 175 | GrXferBarrierFlags renderPassXferBarriers, |
Greg Daniel | 42dbca5 | 2020-11-20 10:22:43 -0500 | [diff] [blame] | 176 | GrLoadOp colorLoadOp, |
Robert Phillips | ac6156c | 2020-02-28 16:02:40 -0500 | [diff] [blame] | 177 | GrPipeline::InputFlags pipelineFlags, |
Robert Phillips | 709e240 | 2020-03-23 18:29:16 +0000 | [diff] [blame] | 178 | const GrUserStencilSettings* stencilSettings) { |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 179 | auto pipeline = CreatePipeline(caps, |
| 180 | arena, |
Adlai Holler | e2296f7 | 2020-11-19 13:41:26 -0500 | [diff] [blame] | 181 | writeView.swizzle(), |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 182 | std::move(appliedClip), |
| 183 | dstProxyView, |
| 184 | std::move(processorSet), |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 185 | pipelineFlags); |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 186 | |
Chris Dalton | 2a26c50 | 2021-08-26 10:05:11 -0600 | [diff] [blame] | 187 | return CreateProgramInfo(caps, arena, pipeline, writeView, usesMSAASurface, geometryProcessor, |
| 188 | primitiveType, renderPassXferBarriers, colorLoadOp, stencilSettings); |
Robert Phillips | 4f93c57 | 2020-03-18 08:13:53 -0400 | [diff] [blame] | 189 | } |
| 190 | |
Chris Dalton | 2a26c50 | 2021-08-26 10:05:11 -0600 | [diff] [blame] | 191 | GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo(const GrCaps* caps, |
| 192 | SkArenaAlloc* arena, |
Robert Phillips | 4f93c57 | 2020-03-18 08:13:53 -0400 | [diff] [blame] | 193 | const GrPipeline* pipeline, |
Adlai Holler | e2296f7 | 2020-11-19 13:41:26 -0500 | [diff] [blame] | 194 | const GrSurfaceProxyView& writeView, |
Chris Dalton | 2a26c50 | 2021-08-26 10:05:11 -0600 | [diff] [blame] | 195 | bool usesMSAASurface, |
Robert Phillips | 4f93c57 | 2020-03-18 08:13:53 -0400 | [diff] [blame] | 196 | GrGeometryProcessor* geometryProcessor, |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 197 | GrPrimitiveType primitiveType, |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 198 | GrXferBarrierFlags xferBarrierFlags, |
Greg Daniel | 42dbca5 | 2020-11-20 10:22:43 -0500 | [diff] [blame] | 199 | GrLoadOp colorLoadOp, |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 200 | const GrUserStencilSettings* stencilSettings) { |
Chris Dalton | 2a26c50 | 2021-08-26 10:05:11 -0600 | [diff] [blame] | 201 | auto tmp = arena->make<GrProgramInfo>(*caps, |
| 202 | writeView, |
| 203 | usesMSAASurface, |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 204 | pipeline, |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 205 | stencilSettings, |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 206 | geometryProcessor, |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 207 | primitiveType, |
| 208 | 0, |
Greg Daniel | 42dbca5 | 2020-11-20 10:22:43 -0500 | [diff] [blame] | 209 | xferBarrierFlags, |
| 210 | colorLoadOp); |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 211 | return tmp; |
| 212 | } |
| 213 | |
Robert Phillips | b58098f | 2020-03-02 16:25:29 -0500 | [diff] [blame] | 214 | GrProgramInfo* GrSimpleMeshDrawOpHelper::createProgramInfo( |
| 215 | const GrCaps* caps, |
| 216 | SkArenaAlloc* arena, |
Adlai Holler | e2296f7 | 2020-11-19 13:41:26 -0500 | [diff] [blame] | 217 | const GrSurfaceProxyView& writeView, |
Chris Dalton | 2a26c50 | 2021-08-26 10:05:11 -0600 | [diff] [blame] | 218 | bool usesMSAASurface, |
Robert Phillips | b58098f | 2020-03-02 16:25:29 -0500 | [diff] [blame] | 219 | GrAppliedClip&& appliedClip, |
John Stiles | 52cb1d0 | 2021-06-02 11:58:05 -0400 | [diff] [blame] | 220 | const GrDstProxyView& dstProxyView, |
Robert Phillips | b58098f | 2020-03-02 16:25:29 -0500 | [diff] [blame] | 221 | GrGeometryProcessor* gp, |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 222 | GrPrimitiveType primType, |
Greg Daniel | 42dbca5 | 2020-11-20 10:22:43 -0500 | [diff] [blame] | 223 | GrXferBarrierFlags renderPassXferBarriers, |
| 224 | GrLoadOp colorLoadOp) { |
Robert Phillips | b58098f | 2020-03-02 16:25:29 -0500 | [diff] [blame] | 225 | return CreateProgramInfo(caps, |
| 226 | arena, |
Brian Salomon | 8afde5f | 2020-04-01 16:22:00 -0400 | [diff] [blame] | 227 | writeView, |
Chris Dalton | 2a26c50 | 2021-08-26 10:05:11 -0600 | [diff] [blame] | 228 | usesMSAASurface, |
Robert Phillips | b58098f | 2020-03-02 16:25:29 -0500 | [diff] [blame] | 229 | std::move(appliedClip), |
| 230 | dstProxyView, |
| 231 | gp, |
| 232 | this->detachProcessorSet(), |
| 233 | primType, |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 234 | renderPassXferBarriers, |
Greg Daniel | 42dbca5 | 2020-11-20 10:22:43 -0500 | [diff] [blame] | 235 | colorLoadOp, |
Robert Phillips | b58098f | 2020-03-02 16:25:29 -0500 | [diff] [blame] | 236 | this->pipelineFlags()); |
| 237 | } |
| 238 | |
John Stiles | 8d9bf64 | 2020-08-12 15:07:45 -0400 | [diff] [blame] | 239 | #if GR_TEST_UTILS |
Chris Dalton | baa1b35 | 2019-04-03 12:03:00 -0600 | [diff] [blame] | 240 | static void dump_pipeline_flags(GrPipeline::InputFlags flags, SkString* result) { |
| 241 | if (GrPipeline::InputFlags::kNone != flags) { |
| 242 | if (flags & GrPipeline::InputFlags::kSnapVerticesToPixelCenters) { |
| 243 | result->append("Snap vertices to pixel center.\n"); |
| 244 | } |
Chris Dalton | 1b6a43c | 2020-09-25 12:21:18 -0600 | [diff] [blame] | 245 | if (flags & GrPipeline::InputFlags::kWireframe) { |
| 246 | result->append("Wireframe enabled.\n"); |
| 247 | } |
| 248 | if (flags & GrPipeline::InputFlags::kConservativeRaster) { |
| 249 | result->append("Conservative raster enabled.\n"); |
| 250 | } |
Chris Dalton | baa1b35 | 2019-04-03 12:03:00 -0600 | [diff] [blame] | 251 | return; |
| 252 | } |
| 253 | result->append("No pipeline flags\n"); |
| 254 | } |
| 255 | |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 256 | SkString GrSimpleMeshDrawOpHelper::dumpInfo() const { |
Brian Salomon | 91326c3 | 2017-08-09 16:02:19 -0400 | [diff] [blame] | 257 | const GrProcessorSet& processors = fProcessors ? *fProcessors : GrProcessorSet::EmptySet(); |
| 258 | SkString result = processors.dumpProcessors(); |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 259 | result.append("AA Type: "); |
| 260 | switch (this->aaType()) { |
| 261 | case GrAAType::kNone: |
| 262 | result.append(" none\n"); |
| 263 | break; |
| 264 | case GrAAType::kCoverage: |
| 265 | result.append(" coverage\n"); |
| 266 | break; |
| 267 | case GrAAType::kMSAA: |
| 268 | result.append(" msaa\n"); |
| 269 | break; |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 270 | } |
Chris Dalton | baa1b35 | 2019-04-03 12:03:00 -0600 | [diff] [blame] | 271 | dump_pipeline_flags(fPipelineFlags, &result); |
Brian Salomon | b4d6106 | 2017-07-12 11:24:41 -0400 | [diff] [blame] | 272 | return result; |
| 273 | } |
Brian Osman | 9a390ac | 2018-11-12 09:47:48 -0500 | [diff] [blame] | 274 | #endif |