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() : fWillReadDstColor(false), fDstCopyTextureOf fset() { |
12 } | 12 } |
13 | 13 |
14 GrXferProcessor::GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willR eadDstColor) | 14 GrXferProcessor::GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willR eadDstColor) |
15 : fWillReadDstColor(willReadDstColor) | 15 : fWillReadDstColor(willReadDstColor) |
16 , fDstCopyTextureOffset() { | 16 , fDstCopyTextureOffset() { |
17 if (dstCopy && dstCopy->texture()) { | 17 if (dstCopy && dstCopy->texture()) { |
18 fDstCopy.reset(dstCopy->texture()); | 18 fDstCopy.reset(dstCopy->texture()); |
19 fDstCopyTextureOffset = dstCopy->offset(); | 19 fDstCopyTextureOffset = dstCopy->offset(); |
20 this->addTextureAccess(&fDstCopy); | 20 this->addTextureAccess(&fDstCopy); |
robertphillips
2015/04/07 14:12:58
So we always read the frag position?
egdaniel
2015/04/07 14:18:11
if we have made an actual dstCopy then we will alw
bsalomon
2015/04/07 14:18:40
If we're reading a dst copy, we use the fragment p
| |
21 this->setWillReadFragmentPosition(); | |
21 } | 22 } |
22 } | 23 } |
23 | 24 |
24 void GrXferProcessor::getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuil der* b) const { | 25 void GrXferProcessor::getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuil der* b) const { |
25 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; | 26 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; |
26 if (this->getDstCopyTexture() && | 27 if (this->getDstCopyTexture() && |
27 kTopLeft_GrSurfaceOrigin == this->getDstCopyTexture()->origin()) { | 28 kTopLeft_GrSurfaceOrigin == this->getDstCopyTexture()->origin()) { |
28 key |= 0x2; | 29 key |= 0x2; |
29 } | 30 } |
30 b->add32(key); | 31 b->add32(key); |
(...skipping 18 matching lines...) Expand all Loading... | |
49 } | 50 } |
50 #endif | 51 #endif |
51 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); | 52 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); |
52 } | 53 } |
53 | 54 |
54 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI nfo& colorPOI, | 55 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI nfo& colorPOI, |
55 const GrProcOptInfo& coveragePOI) const { | 56 const GrProcOptInfo& coveragePOI) const { |
56 return (this->willReadDstColor(caps, colorPOI, coveragePOI) && !caps.dstRead InShaderSupport()); | 57 return (this->willReadDstColor(caps, colorPOI, coveragePOI) && !caps.dstRead InShaderSupport()); |
57 } | 58 } |
58 | 59 |
OLD | NEW |