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

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

Issue 1001503002: Implement support for mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@mix1
Patch Set: Undo modification in GrPipelineBuilder Created 5 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrPipeline.h" 8 #include "GrPipeline.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 11 matching lines...) Expand all
22 const GrDeviceCoordTexture* dstCopy) { 22 const GrDeviceCoordTexture* dstCopy) {
23 // Create XferProcessor from DS's XPFactory 23 // Create XferProcessor from DS's XPFactory
24 SkAutoTUnref<GrXferProcessor> xferProcessor( 24 SkAutoTUnref<GrXferProcessor> xferProcessor(
25 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO I, dstCopy, caps)); 25 pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePO I, dstCopy, caps));
26 26
27 GrColor overrideColor = GrColor_ILLEGAL; 27 GrColor overrideColor = GrColor_ILLEGAL;
28 if (colorPOI.firstEffectiveStageIndex() != 0) { 28 if (colorPOI.firstEffectiveStageIndex() != 0) {
29 overrideColor = colorPOI.inputColorToEffectiveStage(); 29 overrideColor = colorPOI.inputColorToEffectiveStage();
30 } 30 }
31 31
32 fRenderTarget.reset(pipelineBuilder.fRenderTarget.get());
33 SkASSERT(fRenderTarget);
34
35 fFlags = 0;
36 if (pipelineBuilder.isHWAntialias()) {
37 fFlags |= kHWAA_Flag;
38 }
39 if (pipelineBuilder.isDither()) {
40 fFlags |= kDither_Flag;
41 }
42
32 GrXferProcessor::OptFlags optFlags; 43 GrXferProcessor::OptFlags optFlags;
33 if (xferProcessor) { 44 if (xferProcessor) {
34 fXferProcessor.reset(xferProcessor.get()); 45 fXferProcessor.reset(xferProcessor.get());
35 46
36 optFlags = xferProcessor->getOptimizations(colorPOI, 47 GrProcOptInfo localColorPOI = colorPOI;
48 // Optimizations will try to turn off blending which is required by mixe d
49 // sampled modes.
50 bool isMixedSampledTarget =
51 (this->getRenderTarget()->sampleConfig() == kStencil_GrSampleConfig) ;
52 localColorPOI.setNeedsCoverageModulation(this->isHWAntialiasState() &&
53 isMixedSampledTarget);
54
55 optFlags = xferProcessor->getOptimizations(localColorPOI,
Mark Kilgard 2015/03/24 14:05:08 For Google: enabling/disabling GL_BLEND when usin
37 coveragePOI, 56 coveragePOI,
38 pipelineBuilder.getStencil(). doesWrite(), 57 pipelineBuilder.getStencil(). doesWrite(),
39 &overrideColor, 58 &overrideColor,
40 caps); 59 caps);
41 } 60 }
42 61
43 // When path rendering the stencil settings are not always set on the GrPipe lineBuilder 62 // When path rendering the stencil settings are not always set on the GrPipe lineBuilder
44 // so we must check the draw type. In cases where we will skip drawing we si mply return a 63 // so we must check the draw type. In cases where we will skip drawing we si mply return a
45 // null GrPipeline. 64 // null GrPipeline.
46 if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) { 65 if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) {
47 // Set the fields that don't default init and return. The lack of a rend er target will 66 // Set the fields that don't default init and return. The lack of a rend er target will
48 // indicate that this can be skipped. 67 // indicate that this can be skipped.
49 fFlags = 0; 68 fFlags = 0;
50 fDrawFace = GrPipelineBuilder::kInvalid_DrawFace; 69 fDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
51 return; 70 return;
52 } 71 }
53 72
54 fRenderTarget.reset(pipelineBuilder.fRenderTarget.get());
55 SkASSERT(fRenderTarget);
56 fScissorState = scissorState; 73 fScissorState = scissorState;
57 fStencilSettings = pipelineBuilder.getStencil(); 74 fStencilSettings = pipelineBuilder.getStencil();
58 fDrawFace = pipelineBuilder.getDrawFace(); 75 fDrawFace = pipelineBuilder.getDrawFace();
59 76
60 fFlags = 0;
61 if (pipelineBuilder.isHWAntialias()) {
62 fFlags |= kHWAA_Flag;
63 }
64 if (pipelineBuilder.isDither()) {
65 fFlags |= kDither_Flag;
66 }
67
68 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); 77 int firstColorStageIdx = colorPOI.firstEffectiveStageIndex();
69 78
70 // TODO: Once we can handle single or four channel input into coverage stage s then we can use 79 // TODO: Once we can handle single or four channel input into coverage stage s then we can use
71 // GrPipelineBuilder's coverageProcInfo (like color above) to set this initi al information. 80 // GrPipelineBuilder's coverageProcInfo (like color above) to set this initi al information.
72 int firstCoverageStageIdx = 0; 81 int firstCoverageStageIdx = 0;
73 82
74 GrXferProcessor::BlendInfo blendInfo; 83 GrXferProcessor::BlendInfo blendInfo;
75 fXferProcessor->getBlendInfo(&blendInfo); 84 fXferProcessor->getBlendInfo(&blendInfo);
76 85
77 this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, co veragePOI, 86 this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, co veragePOI,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); 160 SkASSERT(this->numFragmentStages() == that.numFragmentStages());
152 for (int i = 0; i < this->numFragmentStages(); i++) { 161 for (int i = 0; i < this->numFragmentStages(); i++) {
153 162
154 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { 163 if (this->getFragmentStage(i) != that.getFragmentStage(i)) {
155 return false; 164 return false;
156 } 165 }
157 } 166 }
158 return true; 167 return true;
159 } 168 }
160 169
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrProcOptInfo.h » ('j') | src/gpu/GrProcOptInfo.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698