OLD | NEW |
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() : fWillReadDstColor(false), fDstCopyTextureOf
fset() { | 11 GrXferProcessor::GrXferProcessor() |
| 12 : fWillReadDstColor(false), fReadsCoverage(true), fDstCopyTextureOffset() { |
12 } | 13 } |
13 | 14 |
14 GrXferProcessor::GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willR
eadDstColor) | 15 GrXferProcessor::GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willR
eadDstColor) |
15 : fWillReadDstColor(willReadDstColor) | 16 : fWillReadDstColor(willReadDstColor) |
| 17 , fReadsCoverage(true) |
16 , fDstCopyTextureOffset() { | 18 , fDstCopyTextureOffset() { |
17 if (dstCopy && dstCopy->texture()) { | 19 if (dstCopy && dstCopy->texture()) { |
18 fDstCopy.reset(dstCopy->texture()); | 20 fDstCopy.reset(dstCopy->texture()); |
19 fDstCopyTextureOffset = dstCopy->offset(); | 21 fDstCopyTextureOffset = dstCopy->offset(); |
20 this->addTextureAccess(&fDstCopy); | 22 this->addTextureAccess(&fDstCopy); |
21 this->setWillReadFragmentPosition(); | 23 this->setWillReadFragmentPosition(); |
22 } | 24 } |
23 } | 25 } |
24 | 26 |
| 27 GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrProcOptInfo&
colorPOI, |
| 28 const GrProcOptInfo&
coveragePOI, |
| 29 bool doesStencilWrit
e, |
| 30 GrColor* overrideCol
or, |
| 31 const GrDrawTargetCa
ps& caps) { |
| 32 GrXferProcessor::OptFlags flags = this->onGetOptimizations(colorPOI, |
| 33 coveragePOI, |
| 34 doesStencilWrite, |
| 35 overrideColor, |
| 36 caps); |
| 37 |
| 38 if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) { |
| 39 fReadsCoverage = false; |
| 40 } |
| 41 return flags; |
| 42 } |
| 43 |
25 void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBu
ilder* b) const { | 44 void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBu
ilder* b) const { |
26 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; | 45 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; |
27 if (this->getDstCopyTexture() && | 46 if (this->getDstCopyTexture() && |
28 kTopLeft_GrSurfaceOrigin == this->getDstCopyTexture()->origin()) { | 47 kTopLeft_GrSurfaceOrigin == this->getDstCopyTexture()->origin()) { |
29 key |= 0x2; | 48 key |= 0x2; |
30 } | 49 } |
31 b->add32(key); | 50 b->add32(key); |
32 this->onGetGLProcessorKey(caps, b); | 51 this->onGetGLProcessorKey(caps, b); |
33 } | 52 } |
34 | 53 |
(...skipping 29 matching lines...) Expand all Loading... |
64 #endif | 83 #endif |
65 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); | 84 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); |
66 } | 85 } |
67 | 86 |
68 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI
nfo& colorPOI, | 87 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI
nfo& colorPOI, |
69 const GrProcOptInfo& coveragePOI) const { | 88 const GrProcOptInfo& coveragePOI) const { |
70 return (this->willReadDstColor(caps, colorPOI, coveragePOI) | 89 return (this->willReadDstColor(caps, colorPOI, coveragePOI) |
71 && !caps.shaderCaps()->dstReadInShaderSupport()); | 90 && !caps.shaderCaps()->dstReadInShaderSupport()); |
72 } | 91 } |
73 | 92 |
OLD | NEW |