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

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 1407063011: Revert of Fix mixed samples stencil clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/GrDrawTarget.h ('k') | src/gpu/GrPipeline.h » ('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 2010 Google Inc. 3 * Copyright 2010 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 "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 fFlushState.reset(); 214 fFlushState.reset();
215 } 215 }
216 216
217 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat ch* batch) { 217 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat ch* batch) {
218 // Setup clip 218 // Setup clip
219 GrPipelineBuilder::AutoRestoreStencil ars; 219 GrPipelineBuilder::AutoRestoreStencil ars;
220 GrAppliedClip clip; 220 GrAppliedClip clip;
221 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds() , &clip)) { 221 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds() , &clip)) {
222 return; 222 return;
223 } 223 }
224 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
225 if (clip.clipCoverageFragmentProcessor()) {
226 arfps.set(&pipelineBuilder);
227 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor()) ;
228 }
224 229
225 GrPipeline::CreateArgs args; 230 GrPipeline::CreateArgs args;
226 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip, batch)) { 231 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState() , batch)) {
227 return; 232 return;
228 } 233 }
229 234
230 #ifdef ENABLE_MDB 235 #ifdef ENABLE_MDB
231 SkASSERT(fRenderTarget); 236 SkASSERT(fRenderTarget);
232 batch->pipeline()->addDependenciesTo(fRenderTarget); 237 batch->pipeline()->addDependenciesTo(fRenderTarget);
233 #endif 238 #endif
234 239
235 this->recordBatch(batch); 240 this->recordBatch(batch);
236 } 241 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // after setting up clipping but before onDrawBatch(). TODO: Figure out a be tter model for 344 // after setting up clipping but before onDrawBatch(). TODO: Figure out a be tter model for
340 // handling stencil settings WRT interactions between pipeline(builder), cli pmaskmanager, and 345 // handling stencil settings WRT interactions between pipeline(builder), cli pmaskmanager, and
341 // batches. 346 // batches.
342 347
343 GrPipelineBuilder::AutoRestoreStencil ars; 348 GrPipelineBuilder::AutoRestoreStencil ars;
344 GrAppliedClip clip; 349 GrAppliedClip clip;
345 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds() , &clip)) { 350 if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds() , &clip)) {
346 return; 351 return;
347 } 352 }
348 353
354 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
355 if (clip.clipCoverageFragmentProcessor()) {
356 arfps.set(&pipelineBuilder);
357 arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor()) ;
358 }
359
349 // Ensure the render target has a stencil buffer and get the stencil setting s. 360 // Ensure the render target has a stencil buffer and get the stencil setting s.
350 GrStencilSettings stencilSettings; 361 GrStencilSettings stencilSettings;
351 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); 362 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
352 GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt); 363 GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt);
353 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); 364 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
354 batch->setStencilSettings(stencilSettings); 365 batch->setStencilSettings(stencilSettings);
355 366
356 GrPipeline::CreateArgs args; 367 GrPipeline::CreateArgs args;
357 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip, batch)) { 368 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState() , batch)) {
358 return; 369 return;
359 } 370 }
360 371
361 this->recordBatch(batch); 372 this->recordBatch(batch);
362 } 373 }
363 374
364 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, 375 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder,
365 GrColor color, 376 GrColor color,
366 const SkMatrix& viewMatrix, 377 const SkMatrix& viewMatrix,
367 const SkRect& rect) { 378 const SkRect& rect) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState); 538 fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState);
528 } 539 }
529 if (fOptions.fImmediateMode) { 540 if (fOptions.fImmediateMode) {
530 this->flush(); 541 this->flush();
531 } 542 }
532 } 543 }
533 544
534 /////////////////////////////////////////////////////////////////////////////// 545 ///////////////////////////////////////////////////////////////////////////////
535 546
536 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB uilder, 547 bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB uilder,
537 const GrAppliedClip* clip, GrDrawB atch* batch) { 548 const GrScissorState* scissor,
538 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; 549 GrDrawBatch* batch) {
539 if (clip->clipCoverageFragmentProcessor()) {
540 arfps.set(pipelineBuilder);
541 arfps.addCoverageFragmentProcessor(clip->clipCoverageFragmentProcessor() );
542 }
543
544 GrPipeline::CreateArgs args; 550 GrPipeline::CreateArgs args;
545 args.fPipelineBuilder = pipelineBuilder; 551 args.fPipelineBuilder = pipelineBuilder;
546 args.fCaps = this->caps(); 552 args.fCaps = this->caps();
553 args.fScissor = scissor;
547 args.fColorPOI = pipelineBuilder->colorProcInfo(batch); 554 args.fColorPOI = pipelineBuilder->colorProcInfo(batch);
548 args.fCoveragePOI = pipelineBuilder->coverageProcInfo(batch); 555 args.fCoveragePOI = pipelineBuilder->coverageProcInfo(batch);
549 args.fClip = clip;
550 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fColorPOI, 556 if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fColorPOI,
551 args.fCoveragePOI, &args.fDstTexture, 557 args.fCoveragePOI, &args.fDstTexture,
552 batch->bounds())) { 558 batch->bounds())) {
553 return false; 559 return false;
554 } 560 }
555 561
556 if (!batch->installPipeline(args)) { 562 if (!batch->installPipeline(args)) {
557 return false; 563 return false;
558 } 564 }
559 565
560 return true; 566 return true;
561 } 567 }
562 568
563 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 569 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
564 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 570 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
565 this->recordBatch(batch); 571 this->recordBatch(batch);
566 batch->unref(); 572 batch->unref();
567 } 573 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698