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

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

Issue 735363003: dstCopy on optdrawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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/GrOptDrawState.h ('k') | src/gpu/GrTest.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrOptDrawState.h" 8 #include "GrOptDrawState.h"
9 9
10 #include "GrDefaultGeoProcFactory.h" 10 #include "GrDefaultGeoProcFactory.h"
(...skipping 14 matching lines...) Expand all
25 fScissorState = scissorState; 25 fScissorState = scissorState;
26 fViewMatrix = drawState.getViewMatrix(); 26 fViewMatrix = drawState.getViewMatrix();
27 fBlendConstant = drawState.getBlendConstant(); 27 fBlendConstant = drawState.getBlendConstant();
28 fVAPtr = drawState.getVertexAttribs(); 28 fVAPtr = drawState.getVertexAttribs();
29 fVACount = drawState.getVertexAttribCount(); 29 fVACount = drawState.getVertexAttribCount();
30 fVAStride = drawState.getVertexStride(); 30 fVAStride = drawState.getVertexStride();
31 fStencilSettings = drawState.getStencil(); 31 fStencilSettings = drawState.getStencil();
32 fDrawFace = drawState.getDrawFace(); 32 fDrawFace = drawState.getDrawFace();
33 fSrcBlend = optSrcCoeff; 33 fSrcBlend = optSrcCoeff;
34 fDstBlend = optDstCoeff; 34 fDstBlend = optDstCoeff;
35
36 // TODO move this out of optDrawState
37 if (dstCopy) {
38 fDstCopy = *dstCopy;
39 }
40
35 GrProgramDesc::DescInfo descInfo; 41 GrProgramDesc::DescInfo descInfo;
36 42
37 fFlags = 0; 43 fFlags = 0;
38 if (drawState.isHWAntialias()) { 44 if (drawState.isHWAntialias()) {
39 fFlags |= kHWAA_Flag; 45 fFlags |= kHWAA_Flag;
40 } 46 }
41 if (drawState.isColorWriteDisabled()) { 47 if (drawState.isColorWriteDisabled()) {
42 fFlags |= kDisableColorWrite_Flag; 48 fFlags |= kDisableColorWrite_Flag;
43 } 49 }
44 if (drawState.isDither()) { 50 if (drawState.isDither()) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 fNumColorStages = fFragmentStages.count(); 96 fNumColorStages = fFragmentStages.count();
91 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i) { 97 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i) {
92 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, 98 SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
93 GrPendingFragmentStage, 99 GrPendingFragmentStage,
94 (drawState.fCoverageStages[i], explicitLocalCoord s)); 100 (drawState.fCoverageStages[i], explicitLocalCoord s));
95 } 101 }
96 102
97 this->setOutputStateInfo(drawState, blendOpt, *gpu->caps(), &descInfo); 103 this->setOutputStateInfo(drawState, blendOpt, *gpu->caps(), &descInfo);
98 104
99 // now create a key 105 // now create a key
100 gpu->buildProgramDesc(*this, descInfo, drawType, dstCopy, &fDesc); 106 gpu->buildProgramDesc(*this, descInfo, drawType, &fDesc);
101 }; 107 };
102 108
103 GrOptDrawState* GrOptDrawState::Create(const GrDrawState& drawState, 109 GrOptDrawState* GrOptDrawState::Create(const GrDrawState& drawState,
104 GrGpu* gpu, 110 GrGpu* gpu,
105 const ScissorState& scissorState, 111 const ScissorState& scissorState,
106 const GrDeviceCoordTexture* dstCopy, 112 const GrDeviceCoordTexture* dstCopy,
107 GrGpu::DrawType drawType) { 113 GrGpu::DrawType drawType) {
108 GrBlendCoeff srcCoeff; 114 GrBlendCoeff srcCoeff;
109 GrBlendCoeff dstCoeff; 115 GrBlendCoeff dstCoeff;
110 GrDrawState::BlendOpt blendOpt = drawState.getBlendOpt(false, &srcCoeff, &ds tCoeff); 116 GrDrawState::BlendOpt blendOpt = drawState.getBlendOpt(false, &srcCoeff, &ds tCoeff);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 this->fScissorState != that.fScissorState || 277 this->fScissorState != that.fScissorState ||
272 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || 278 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) ||
273 this->fSrcBlend != that.fSrcBlend || 279 this->fSrcBlend != that.fSrcBlend ||
274 this->fDstBlend != that.fDstBlend || 280 this->fDstBlend != that.fDstBlend ||
275 this->fBlendConstant != that.fBlendConstant || 281 this->fBlendConstant != that.fBlendConstant ||
276 this->fFlags != that.fFlags || 282 this->fFlags != that.fFlags ||
277 this->fVACount != that.fVACount || 283 this->fVACount != that.fVACount ||
278 this->fVAStride != that.fVAStride || 284 this->fVAStride != that.fVAStride ||
279 memcmp(this->fVAPtr, that.fVAPtr, this->fVACount * sizeof(GrVertexAttrib )) || 285 memcmp(this->fVAPtr, that.fVAPtr, this->fVACount * sizeof(GrVertexAttrib )) ||
280 this->fStencilSettings != that.fStencilSettings || 286 this->fStencilSettings != that.fStencilSettings ||
281 this->fDrawFace != that.fDrawFace) { 287 this->fDrawFace != that.fDrawFace ||
288 this->fDstCopy.texture() != that.fDstCopy.texture()) {
282 return false; 289 return false;
283 } 290 }
284 291
285 bool usingVertexCoverage = this->fDesc.header().fCoverageAttributeIndex != - 1; 292 bool usingVertexCoverage = this->fDesc.header().fCoverageAttributeIndex != - 1;
286 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { 293 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) {
287 return false; 294 return false;
288 } 295 }
289 296
290 if (this->hasGeometryProcessor()) { 297 if (this->hasGeometryProcessor()) {
291 if (!that.hasGeometryProcessor()) { 298 if (!that.hasGeometryProcessor()) {
292 return false; 299 return false;
293 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce ssor())) { 300 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce ssor())) {
294 return false; 301 return false;
295 } 302 }
296 } else if (that.hasGeometryProcessor()) { 303 } else if (that.hasGeometryProcessor()) {
297 return false; 304 return false;
298 } 305 }
299 306
300 // The program desc comparison should have already assured that the stage co unts match. 307 // The program desc comparison should have already assured that the stage co unts match.
301 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); 308 SkASSERT(this->numFragmentStages() == that.numFragmentStages());
302 for (int i = 0; i < this->numFragmentStages(); i++) { 309 for (int i = 0; i < this->numFragmentStages(); i++) {
303 310
304 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { 311 if (this->getFragmentStage(i) != that.getFragmentStage(i)) {
305 return false; 312 return false;
306 } 313 }
307 } 314 }
308 return true; 315 return true;
309 } 316 }
310 317
OLDNEW
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698