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 "GrPipelineBuilder.h" | 9 #include "GrPipelineBuilder.h" |
10 #include "GrProcOptInfo.h" | 10 #include "GrProcOptInfo.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 void GrXferProcessor::getBlendInfo(BlendInfo* blendInfo) const { | 67 void GrXferProcessor::getBlendInfo(BlendInfo* blendInfo) const { |
68 blendInfo->reset(); | 68 blendInfo->reset(); |
69 if (!this->willReadDstColor()) { | 69 if (!this->willReadDstColor()) { |
70 this->onGetBlendInfo(blendInfo); | 70 this->onGetBlendInfo(blendInfo); |
71 } else if (this->dstReadUsesMixedSamples()) { | 71 } else if (this->dstReadUsesMixedSamples()) { |
72 blendInfo->fDstBlend = kIS2A_GrBlendCoeff; | 72 blendInfo->fDstBlend = kIS2A_GrBlendCoeff; |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBu
ilder* b) const { | 76 void GrXferProcessor::getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKey
Builder* b) const { |
77 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; | 77 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; |
78 if (key) { | 78 if (key) { |
79 if (const GrTexture* dstTexture = this->getDstTexture()) { | 79 if (const GrTexture* dstTexture = this->getDstTexture()) { |
80 key |= 0x2; | 80 key |= 0x2; |
81 if (kTopLeft_GrSurfaceOrigin == dstTexture->origin()) { | 81 if (kTopLeft_GrSurfaceOrigin == dstTexture->origin()) { |
82 key |= 0x4; | 82 key |= 0x4; |
83 } | 83 } |
84 } | 84 } |
85 if (this->readsCoverage()) { | 85 if (this->readsCoverage()) { |
86 key |= 0x8; | 86 key |= 0x8; |
87 } | 87 } |
88 if (this->dstReadUsesMixedSamples()) { | 88 if (this->dstReadUsesMixedSamples()) { |
89 key |= 0x10; | 89 key |= 0x10; |
90 } | 90 } |
91 } | 91 } |
92 b->add32(key); | 92 b->add32(key); |
93 this->onGetGLProcessorKey(caps, b); | 93 this->onGetGLSLProcessorKey(caps, b); |
94 } | 94 } |
95 | 95 |
96 GrXferBarrierType GrXferProcessor::xferBarrierType(const GrRenderTarget* rt, | 96 GrXferBarrierType GrXferProcessor::xferBarrierType(const GrRenderTarget* rt, |
97 const GrCaps& caps) const { | 97 const GrCaps& caps) const { |
98 SkASSERT(rt); | 98 SkASSERT(rt); |
99 if (static_cast<const GrSurface*>(rt) == this->getDstTexture()) { | 99 if (static_cast<const GrSurface*>(rt) == this->getDstTexture()) { |
100 // Texture barriers are required when a shader reads and renders to the
same texture. | 100 // Texture barriers are required when a shader reads and renders to the
same texture. |
101 SkASSERT(caps.textureBarrierSupport()); | 101 SkASSERT(caps.textureBarrierSupport()); |
102 return kTexture_GrXferBarrierType; | 102 return kTexture_GrXferBarrierType; |
103 } | 103 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, hasMixedSamp
les, dstTexture); | 220 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, hasMixedSamp
les, dstTexture); |
221 } | 221 } |
222 | 222 |
223 bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, | 223 bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, |
224 const GrProcOptInfo& colorPOI, | 224 const GrProcOptInfo& colorPOI, |
225 const GrProcOptInfo& coveragePOI, | 225 const GrProcOptInfo& coveragePOI, |
226 bool hasMixedSamples) const { | 226 bool hasMixedSamples) const { |
227 return (this->willReadDstColor(caps, colorPOI, coveragePOI, hasMixedSamples)
&& | 227 return (this->willReadDstColor(caps, colorPOI, coveragePOI, hasMixedSamples)
&& |
228 !caps.shaderCaps()->dstReadInShaderSupport()); | 228 !caps.shaderCaps()->dstReadInShaderSupport()); |
229 } | 229 } |
OLD | NEW |