Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: src/gpu/effects/GrCoverageSetOpXP.cpp

Issue 1541903002: added support for PLS path rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix for ASAN failure Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrTestBatch.h ('k') | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "effects/GrCoverageSetOpXP.h" 9 #include "effects/GrCoverageSetOpXP.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
11 #include "GrColor.h" 11 #include "GrColor.h"
12 #include "GrPipeline.h"
12 #include "GrProcessor.h" 13 #include "GrProcessor.h"
13 #include "GrProcOptInfo.h" 14 #include "GrProcOptInfo.h"
14 #include "glsl/GrGLSLBlend.h" 15 #include "glsl/GrGLSLBlend.h"
15 #include "glsl/GrGLSLFragmentShaderBuilder.h" 16 #include "glsl/GrGLSLFragmentShaderBuilder.h"
16 #include "glsl/GrGLSLUniformHandler.h" 17 #include "glsl/GrGLSLUniformHandler.h"
17 #include "glsl/GrGLSLXferProcessor.h" 18 #include "glsl/GrGLSLXferProcessor.h"
18 19
19 class CoverageSetOpXP : public GrXferProcessor { 20 class CoverageSetOpXP : public GrXferProcessor {
20 public: 21 public:
21 static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage) { 22 static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 145 }
145 blendInfo->fBlendConstant = 0; 146 blendInfo->fBlendConstant = 0;
146 } 147 }
147 148
148 /////////////////////////////////////////////////////////////////////////////// 149 ///////////////////////////////////////////////////////////////////////////////
149 150
150 class ShaderCSOXferProcessor : public GrXferProcessor { 151 class ShaderCSOXferProcessor : public GrXferProcessor {
151 public: 152 public:
152 ShaderCSOXferProcessor(const DstTexture* dstTexture, 153 ShaderCSOXferProcessor(const DstTexture* dstTexture,
153 bool hasMixedSamples, 154 bool hasMixedSamples,
154 SkXfermode::Mode xfermode,
155 SkRegion::Op regionOp, 155 SkRegion::Op regionOp,
156 bool invertCoverage) 156 bool invertCoverage)
157 : INHERITED(dstTexture, true, hasMixedSamples) 157 : INHERITED(dstTexture, true, hasMixedSamples)
158 , fRegionOp(regionOp) 158 , fRegionOp(regionOp)
159 , fInvertCoverage(invertCoverage) { 159 , fInvertCoverage(invertCoverage) {
160 this->initClassID<ShaderCSOXferProcessor>(); 160 this->initClassID<ShaderCSOXferProcessor>();
161 } 161 }
162 162
163 const char* name() const override { return "Coverage Set Op Shader"; } 163 const char* name() const override { return "Coverage Set Op Shader"; }
164 164
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 bool hasMixedSamples, 316 bool hasMixedSamples,
317 const DstTexture* dst) const { 317 const DstTexture* dst) const {
318 // We don't support inverting coverage with mixed samples. We don't expect t o ever want this in 318 // We don't support inverting coverage with mixed samples. We don't expect t o ever want this in
319 // the future, however we could at some point make this work using an invert ed coverage 319 // the future, however we could at some point make this work using an invert ed coverage
320 // modulation table. Note that an inverted table still won't work if there a re coverage procs. 320 // modulation table. Note that an inverted table still won't work if there a re coverage procs.
321 if (fInvertCoverage && hasMixedSamples) { 321 if (fInvertCoverage && hasMixedSamples) {
322 SkASSERT(false); 322 SkASSERT(false);
323 return nullptr; 323 return nullptr;
324 } 324 }
325 325
326 if (optimizations.fOverrides.fUsePLSDstRead) {
327 return new ShaderCSOXferProcessor(dst, hasMixedSamples, fRegionOp, fInve rtCoverage);
328 }
326 return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage); 329 return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage);
327 } 330 }
328 331
329 void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& col orPOI, 332 void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& col orPOI,
330 InvariantBlendedColor* b lendedColor) const { 333 InvariantBlendedColor* b lendedColor) const {
331 blendedColor->fWillBlendWithDst = SkRegion::kReplace_Op != fRegionOp; 334 blendedColor->fWillBlendWithDst = SkRegion::kReplace_Op != fRegionOp;
332 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; 335 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
333 } 336 }
334 337
335 GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); 338 GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory);
336 339
337 const GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d) { 340 const GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d) {
338 SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLa stOp + 1)); 341 SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLa stOp + 1));
339 bool invertCoverage = !d->fRenderTarget->hasMixedSamples() && d->fRandom->ne xtBool(); 342 bool invertCoverage = !d->fRenderTarget->hasMixedSamples() && d->fRandom->ne xtBool();
340 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); 343 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage);
341 } 344 }
342 345
OLDNEW
« no previous file with comments | « src/gpu/batches/GrTestBatch.h ('k') | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698