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 "GrPipeline.h" | 9 #include "GrPipeline.h" |
10 #include "GrProcOptInfo.h" | 10 #include "GrProcOptInfo.h" |
11 #include "gl/GrGLCaps.h" | 11 #include "gl/GrGLCaps.h" |
12 | 12 |
13 GrXferProcessor::GrXferProcessor() | 13 GrXferProcessor::GrXferProcessor() |
14 : fWillReadDstColor(false) | 14 : fWillReadDstColor(false) |
15 , fDstReadUsesMixedSamples(false) | 15 , fDstReadUsesMixedSamples(false) |
16 , fDstTextureOffset() { | 16 , fDstTextureOffset() { |
17 } | 17 } |
18 | 18 |
19 GrXferProcessor::GrXferProcessor(const DstTexture* dstTexture, | 19 GrXferProcessor::GrXferProcessor(const DstTexture* dstTexture, |
20 bool willReadDstColor, | 20 bool willReadDstColor, |
21 bool hasMixedSamples) | 21 bool hasMixedSamples) |
22 : fWillReadDstColor(willReadDstColor) | 22 : fWillReadDstColor(willReadDstColor) |
23 , fDstReadUsesMixedSamples(willReadDstColor && hasMixedSamples) | 23 , fDstReadUsesMixedSamples(willReadDstColor && hasMixedSamples) |
24 , fDstTextureOffset() { | 24 , fDstTextureOffset() { |
25 if (dstTexture && dstTexture->texture()) { | 25 if (dstTexture && dstTexture->texture()) { |
26 SkASSERT(willReadDstColor); | 26 SkASSERT(willReadDstColor); |
27 fDstTexture.reset(dstTexture->texture()); | 27 fDstTexture.reset(dstTexture->texture(), nullptr); |
28 fDstTextureOffset = dstTexture->offset(); | 28 fDstTextureOffset = dstTexture->offset(); |
29 this->addTextureAccess(&fDstTexture); | 29 this->addTextureAccess(&fDstTexture); |
30 this->setWillReadFragmentPosition(); | 30 this->setWillReadFragmentPosition(); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 GrXferProcessor::OptFlags GrXferProcessor::getOptimizations( | 34 GrXferProcessor::OptFlags GrXferProcessor::getOptimizations( |
35 const GrPipelineOptimizat
ions& optimizations, | 35 const GrPipelineOptimizat
ions& optimizations, |
36 bool doesStencilWrite, | 36 bool doesStencilWrite, |
37 GrColor* overrideColor, | 37 GrColor* overrideColor, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, | 213 bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, |
214 const GrPipelineOptimizations& optimization
s) const { | 214 const GrPipelineOptimizations& optimization
s) const { |
215 return (this->willReadDstColor(caps, optimizations) && | 215 return (this->willReadDstColor(caps, optimizations) && |
216 !caps.shaderCaps()->dstReadInShaderSupport()); | 216 !caps.shaderCaps()->dstReadInShaderSupport()); |
217 } | 217 } |
218 | 218 |
219 bool GrXPFactory::willReadDstColor(const GrCaps& caps, | 219 bool GrXPFactory::willReadDstColor(const GrCaps& caps, |
220 const GrPipelineOptimizations& optimizations)
const { | 220 const GrPipelineOptimizations& optimizations)
const { |
221 return optimizations.fOverrides.fUsePLSDstRead || this->onWillReadDstColor(c
aps, optimizations); | 221 return optimizations.fOverrides.fUsePLSDstRead || this->onWillReadDstColor(c
aps, optimizations); |
222 } | 222 } |
OLD | NEW |