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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->onGetGLProcessorKey(caps, b); |
94 } | 94 } |
95 | 95 |
96 bool GrXferProcessor::willNeedXferBarrier(const GrRenderTarget* rt, | 96 GrXferBarrierType GrXferProcessor::xferBarrierType(const GrRenderTarget* rt, |
97 const GrCaps& caps, | 97 const GrCaps& caps) const { |
98 GrXferBarrierType* outBarrierType) con
st { | 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(rt); | |
102 SkASSERT(caps.textureBarrierSupport()); | 101 SkASSERT(caps.textureBarrierSupport()); |
103 *outBarrierType = kTexture_GrXferBarrierType; | 102 return kTexture_GrXferBarrierType; |
104 return true; | |
105 } | 103 } |
106 return this->onWillNeedXferBarrier(rt, caps, outBarrierType); | 104 return this->onXferBarrier(rt, caps); |
107 } | 105 } |
108 | 106 |
109 #ifdef SK_DEBUG | 107 #ifdef SK_DEBUG |
110 static const char* equation_string(GrBlendEquation eq) { | 108 static const char* equation_string(GrBlendEquation eq) { |
111 switch (eq) { | 109 switch (eq) { |
112 case kAdd_GrBlendEquation: | 110 case kAdd_GrBlendEquation: |
113 return "add"; | 111 return "add"; |
114 case kSubtract_GrBlendEquation: | 112 case kSubtract_GrBlendEquation: |
115 return "subtract"; | 113 return "subtract"; |
116 case kReverseSubtract_GrBlendEquation: | 114 case kReverseSubtract_GrBlendEquation: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, hasMixedSamp
les, dstTexture); | 220 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, hasMixedSamp
les, dstTexture); |
223 } | 221 } |
224 | 222 |
225 bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, | 223 bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, |
226 const GrProcOptInfo& colorPOI, | 224 const GrProcOptInfo& colorPOI, |
227 const GrProcOptInfo& coveragePOI, | 225 const GrProcOptInfo& coveragePOI, |
228 bool hasMixedSamples) const { | 226 bool hasMixedSamples) const { |
229 return (this->willReadDstColor(caps, colorPOI, coveragePOI, hasMixedSamples)
&& | 227 return (this->willReadDstColor(caps, colorPOI, coveragePOI, hasMixedSamples)
&& |
230 !caps.shaderCaps()->dstReadInShaderSupport()); | 228 !caps.shaderCaps()->dstReadInShaderSupport()); |
231 } | 229 } |
OLD | NEW |