| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 #include "GrRenderTarget.h" | 9 #include "GrRenderTarget.h" |
| 10 | 10 |
| 11 #include "GrContext.h" | 11 #include "GrContext.h" |
| 12 #include "GrContextPriv.h" | 12 #include "GrContextPriv.h" |
| 13 #include "GrRenderTargetContext.h" | 13 #include "GrRenderTargetContext.h" |
| 14 #include "GrGpu.h" | 14 #include "GrGpu.h" |
| 15 #include "GrRenderTargetOpList.h" | 15 #include "GrRenderTargetOpList.h" |
| 16 #include "GrRenderTargetPriv.h" | 16 #include "GrRenderTargetPriv.h" |
| 17 #include "GrStencilAttachment.h" | 17 #include "GrStencilAttachment.h" |
| 18 #include "GrStencilSettings.h" |
| 18 | 19 |
| 19 GrRenderTarget::GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc, Flags flag
s, | 20 GrRenderTarget::GrRenderTarget(GrGpu* gpu, const GrSurfaceDesc& desc, Flags flag
s, |
| 20 GrStencilAttachment* stencil) | 21 GrStencilAttachment* stencil) |
| 21 : INHERITED(gpu, desc) | 22 : INHERITED(gpu, desc) |
| 22 , fStencilAttachment(stencil) | 23 , fStencilAttachment(stencil) |
| 23 , fMultisampleSpecsID(0) | 24 , fMultisampleSpecsID(0) |
| 24 , fFlags(flags) { | 25 , fFlags(flags) { |
| 25 SkASSERT(!(fFlags & Flags::kMixedSampled) || fDesc.fSampleCnt > 0); | 26 SkASSERT(!(fFlags & Flags::kMixedSampled) || fDesc.fSampleCnt > 0); |
| 26 SkASSERT(!(fFlags & Flags::kWindowRectsSupport) || gpu->caps()->maxWindowRec
tangles() > 0); | 27 SkASSERT(!(fFlags & Flags::kWindowRectsSupport) || gpu->caps()->maxWindowRec
tangles() > 0); |
| 27 fResolveRect.setLargestInverted(); | 28 fResolveRect.setLargestInverted(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 94 } |
| 94 fRenderTarget->fStencilAttachment = stencil; | 95 fRenderTarget->fStencilAttachment = stencil; |
| 95 if (!fRenderTarget->completeStencilAttachment()) { | 96 if (!fRenderTarget->completeStencilAttachment()) { |
| 96 SkSafeSetNull(fRenderTarget->fStencilAttachment); | 97 SkSafeSetNull(fRenderTarget->fStencilAttachment); |
| 97 return false; | 98 return false; |
| 98 } | 99 } |
| 99 return true; | 100 return true; |
| 100 } | 101 } |
| 101 | 102 |
| 102 int GrRenderTargetPriv::numStencilBits() const { | 103 int GrRenderTargetPriv::numStencilBits() const { |
| 103 return fRenderTarget->fStencilAttachment ? fRenderTarget->fStencilAttachment
->bits() : 0; | 104 SkASSERT(this->getStencilAttachment()); |
| 105 return this->getStencilAttachment()->bits(); |
| 104 } | 106 } |
| 105 | 107 |
| 106 const GrGpu::MultisampleSpecs& | 108 const GrGpu::MultisampleSpecs& |
| 107 GrRenderTargetPriv::getMultisampleSpecs(const GrStencilSettings& stencil) const
{ | 109 GrRenderTargetPriv::getMultisampleSpecs(const GrPipeline& pipeline) const { |
| 110 SkASSERT(fRenderTarget == pipeline.getRenderTarget()); // TODO: remove RT fr
om pipeline. |
| 108 GrGpu* gpu = fRenderTarget->getGpu(); | 111 GrGpu* gpu = fRenderTarget->getGpu(); |
| 109 if (auto id = fRenderTarget->fMultisampleSpecsID) { | 112 if (auto id = fRenderTarget->fMultisampleSpecsID) { |
| 110 SkASSERT(gpu->queryMultisampleSpecs(fRenderTarget, stencil).fUniqueID ==
id); | 113 SkASSERT(gpu->queryMultisampleSpecs(pipeline).fUniqueID == id); |
| 111 return gpu->getMultisampleSpecs(id); | 114 return gpu->getMultisampleSpecs(id); |
| 112 } | 115 } |
| 113 const GrGpu::MultisampleSpecs& specs = gpu->queryMultisampleSpecs(fRenderTar
get, stencil); | 116 const GrGpu::MultisampleSpecs& specs = gpu->queryMultisampleSpecs(pipeline); |
| 114 fRenderTarget->fMultisampleSpecsID = specs.fUniqueID; | 117 fRenderTarget->fMultisampleSpecsID = specs.fUniqueID; |
| 115 return specs; | 118 return specs; |
| 116 } | 119 } |
| 117 | 120 |
| 118 int GrRenderTargetPriv::maxWindowRectangles() const { | 121 int GrRenderTargetPriv::maxWindowRectangles() const { |
| 119 return (this->flags() & Flags::kWindowRectsSupport) ? | 122 return (this->flags() & Flags::kWindowRectsSupport) ? |
| 120 fRenderTarget->getGpu()->caps()->maxWindowRectangles() : 0; | 123 fRenderTarget->getGpu()->caps()->maxWindowRectangles() : 0; |
| 121 } | 124 } |
| OLD | NEW |