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

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

Issue 1158453004: Revert of Move DstCoordTexture to GrXP, rename and remove the word "copy" from dstcopytexture names. (Closed) Base URL: https://skia.googlesource.com/skia.git@copy
Patch Set: Created 5 years, 7 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/GrPipelineBuilder.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.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 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 "GrXferProcessor.h" 8 #include "GrXferProcessor.h"
9 #include "gl/GrGLCaps.h" 9 #include "gl/GrGLCaps.h"
10 10
11 GrXferProcessor::GrXferProcessor() 11 GrXferProcessor::GrXferProcessor()
12 : fWillReadDstColor(false), fReadsCoverage(true), fDstTextureOffset() { 12 : fWillReadDstColor(false), fReadsCoverage(true), fDstCopyTextureOffset() {
13 } 13 }
14 14
15 GrXferProcessor::GrXferProcessor(const DstTexture* dstTexture, bool willReadDstC olor) 15 GrXferProcessor::GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willR eadDstColor)
16 : fWillReadDstColor(willReadDstColor) 16 : fWillReadDstColor(willReadDstColor)
17 , fReadsCoverage(true) 17 , fReadsCoverage(true)
18 , fDstTextureOffset() { 18 , fDstCopyTextureOffset() {
19 if (dstTexture && dstTexture->texture()) { 19 if (dstCopy && dstCopy->texture()) {
20 fDstTexture.reset(dstTexture->texture()); 20 fDstCopy.reset(dstCopy->texture());
21 fDstTextureOffset = dstTexture->offset(); 21 fDstCopyTextureOffset = dstCopy->offset();
22 this->addTextureAccess(&fDstTexture); 22 this->addTextureAccess(&fDstCopy);
23 this->setWillReadFragmentPosition(); 23 this->setWillReadFragmentPosition();
24 } 24 }
25 } 25 }
26 26
27 GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI, 27 GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
28 const GrProcOptInfo& coveragePOI, 28 const GrProcOptInfo& coveragePOI,
29 bool doesStencilWrit e, 29 bool doesStencilWrit e,
30 GrColor* overrideCol or, 30 GrColor* overrideCol or,
31 const GrCaps& caps) { 31 const GrCaps& caps) {
32 GrXferProcessor::OptFlags flags = this->onGetOptimizations(colorPOI, 32 GrXferProcessor::OptFlags flags = this->onGetOptimizations(colorPOI,
33 coveragePOI, 33 coveragePOI,
34 doesStencilWrite, 34 doesStencilWrite,
35 overrideColor, 35 overrideColor,
36 caps); 36 caps);
37 37
38 if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) { 38 if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
39 fReadsCoverage = false; 39 fReadsCoverage = false;
40 } 40 }
41 return flags; 41 return flags;
42 } 42 }
43 43
44 void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBu ilder* b) const { 44 void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBu ilder* b) const {
45 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; 45 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0;
46 if (this->getDstTexture() && 46 if (this->getDstCopyTexture() &&
47 kTopLeft_GrSurfaceOrigin == this->getDstTexture()->origin()) { 47 kTopLeft_GrSurfaceOrigin == this->getDstCopyTexture()->origin()) {
48 key |= 0x2; 48 key |= 0x2;
49 } 49 }
50 b->add32(key); 50 b->add32(key);
51 this->onGetGLProcessorKey(caps, b); 51 this->onGetGLProcessorKey(caps, b);
52 } 52 }
53 53
54 bool GrXferProcessor::willNeedXferBarrier(const GrRenderTarget* rt, 54 bool GrXferProcessor::willNeedXferBarrier(const GrRenderTarget* rt,
55 const GrCaps& caps, 55 const GrCaps& caps,
56 GrXferBarrierType* outBarrierType) con st { 56 GrXferBarrierType* outBarrierType) con st {
57 if (static_cast<const GrSurface*>(rt) == this->getDstTexture()) { 57 if (static_cast<const GrSurface*>(rt) == this->getDstCopyTexture()) {
58 // Texture barriers are required when a shader reads and renders to the same texture. 58 // Texture barriers are required when a shader reads and renders to the same texture.
59 SkASSERT(rt); 59 SkASSERT(rt);
60 SkASSERT(caps.textureBarrierSupport()); 60 SkASSERT(caps.textureBarrierSupport());
61 *outBarrierType = kTexture_GrXferBarrierType; 61 *outBarrierType = kTexture_GrXferBarrierType;
62 return true; 62 return true;
63 } 63 }
64 return this->onWillNeedXferBarrier(rt, caps, outBarrierType); 64 return this->onWillNeedXferBarrier(rt, caps, outBarrierType);
65 } 65 }
66 66
67 #ifdef SK_DEBUG 67 #ifdef SK_DEBUG
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 fWriteColor, equation_string(fEquation), coeff_string(fSrcBlend), 155 fWriteColor, equation_string(fEquation), coeff_string(fSrcBlend),
156 coeff_string(fDstBlend), fBlendConstant); 156 coeff_string(fDstBlend), fBlendConstant);
157 return out; 157 return out;
158 } 158 }
159 #endif 159 #endif
160 160
161 /////////////////////////////////////////////////////////////////////////////// 161 ///////////////////////////////////////////////////////////////////////////////
162 162
163 GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI, 163 GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
164 const GrProcOptInfo& coverageP OI, 164 const GrProcOptInfo& coverageP OI,
165 const DstTexture* dstTexture, 165 const GrDeviceCoordTexture* ds tCopy,
166 const GrCaps& caps) const { 166 const GrCaps& caps) const {
167 #ifdef SK_DEBUG 167 #ifdef SK_DEBUG
168 if (this->willReadDstColor(caps, colorPOI, coveragePOI)) { 168 if (this->willReadDstColor(caps, colorPOI, coveragePOI)) {
169 if (!caps.shaderCaps()->dstReadInShaderSupport()) { 169 if (!caps.shaderCaps()->dstReadInShaderSupport()) {
170 SkASSERT(dstTexture && dstTexture->texture()); 170 SkASSERT(dstCopy && dstCopy->texture());
171 } else { 171 } else {
172 SkASSERT(!dstTexture || !dstTexture->texture()); 172 SkASSERT(!dstCopy || !dstCopy->texture());
173 } 173 }
174 } else { 174 } else {
175 SkASSERT(!dstTexture || !dstTexture->texture()); 175 SkASSERT(!dstCopy || !dstCopy->texture());
176 } 176 }
177 #endif 177 #endif
178 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstTexture); 178 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy);
179 } 179 }
180 180
181 bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, const GrProcOptInfo& co lorPOI, 181 bool GrXPFactory::willNeedDstCopy(const GrCaps& caps, const GrProcOptInfo& color POI,
182 const GrProcOptInfo& coveragePOI) const { 182 const GrProcOptInfo& coveragePOI) const {
183 return (this->willReadDstColor(caps, colorPOI, coveragePOI) 183 return (this->willReadDstColor(caps, colorPOI, coveragePOI)
184 && !caps.shaderCaps()->dstReadInShaderSupport()); 184 && !caps.shaderCaps()->dstReadInShaderSupport());
185 } 185 }
186
OLDNEW
« no previous file with comments | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698