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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 bool GrXferProcessor::willNeedXferBarrier(const GrRenderTarget* rt, | 35 bool GrXferProcessor::willNeedXferBarrier(const GrRenderTarget* rt, |
36 const GrDrawTargetCaps& caps, | 36 const GrDrawTargetCaps& caps, |
37 GrXferBarrierType* outBarrierType) con
st { | 37 GrXferBarrierType* outBarrierType) con
st { |
38 if (static_cast<const GrSurface*>(rt) == this->getDstCopyTexture()) { | 38 if (static_cast<const GrSurface*>(rt) == this->getDstCopyTexture()) { |
39 // Texture barriers are required when a shader reads and renders to the
same texture. | 39 // Texture barriers are required when a shader reads and renders to the
same texture. |
40 SkASSERT(rt); | 40 SkASSERT(rt); |
41 SkASSERT(caps.textureBarrierSupport()); | 41 SkASSERT(caps.textureBarrierSupport()); |
42 *outBarrierType = kTexture_GrXferBarrierType; | 42 *outBarrierType = kTexture_GrXferBarrierType; |
43 return true; | 43 return true; |
44 } | 44 } |
45 return false; | 45 return this->onWillNeedXferBarrier(rt, caps, outBarrierType); |
46 } | 46 } |
47 | 47 |
48 /////////////////////////////////////////////////////////////////////////////// | 48 /////////////////////////////////////////////////////////////////////////////// |
49 | 49 |
50 GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI, | 50 GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI, |
51 const GrProcOptInfo& coverageP
OI, | 51 const GrProcOptInfo& coverageP
OI, |
52 const GrDeviceCoordTexture* ds
tCopy, | 52 const GrDeviceCoordTexture* ds
tCopy, |
53 const GrDrawTargetCaps& caps)
const { | 53 const GrDrawTargetCaps& caps)
const { |
54 #ifdef SK_DEBUG | 54 #ifdef SK_DEBUG |
55 if (this->willReadDstColor(caps, colorPOI, coveragePOI)) { | 55 if (this->willReadDstColor(caps, colorPOI, coveragePOI)) { |
56 if (!caps.shaderCaps()->dstReadInShaderSupport()) { | 56 if (!caps.shaderCaps()->dstReadInShaderSupport()) { |
57 SkASSERT(dstCopy && dstCopy->texture()); | 57 SkASSERT(dstCopy && dstCopy->texture()); |
58 } else { | 58 } else { |
59 SkASSERT(!dstCopy || !dstCopy->texture()); | 59 SkASSERT(!dstCopy || !dstCopy->texture()); |
60 } | 60 } |
61 } else { | 61 } else { |
62 SkASSERT(!dstCopy || !dstCopy->texture()); | 62 SkASSERT(!dstCopy || !dstCopy->texture()); |
63 } | 63 } |
64 #endif | 64 #endif |
65 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); | 65 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); |
66 } | 66 } |
67 | 67 |
68 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI
nfo& colorPOI, | 68 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI
nfo& colorPOI, |
69 const GrProcOptInfo& coveragePOI) const { | 69 const GrProcOptInfo& coveragePOI) const { |
70 return (this->willReadDstColor(caps, colorPOI, coveragePOI) | 70 return (this->willReadDstColor(caps, colorPOI, coveragePOI) |
71 && !caps.shaderCaps()->dstReadInShaderSupport()); | 71 && !caps.shaderCaps()->dstReadInShaderSupport()); |
72 } | 72 } |
73 | 73 |
OLD | NEW |