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