Robert Phillips | cb2e235 | 2017-08-30 16:44:40 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "GrGLGpuCommandBuffer.h" |
| 9 | |
| 10 | #include "GrFixedClip.h" |
| 11 | #include "GrRenderTargetPriv.h" |
| 12 | |
| 13 | void GrGLGpuRTCommandBuffer::begin() { |
| 14 | if (GrLoadOp::kClear == fColorLoadAndStoreInfo.fLoadOp) { |
| 15 | fGpu->clear(GrFixedClip::Disabled(), fColorLoadAndStoreInfo.fClearColor, |
| 16 | fRenderTarget, fOrigin); |
| 17 | } |
| 18 | if (GrLoadOp::kClear == fStencilLoadAndStoreInfo.fLoadOp) { |
| 19 | GrStencilAttachment* sb = fRenderTarget->renderTargetPriv().getStencilAttachment(); |
| 20 | if (sb && (sb->isDirty() || fRenderTarget->alwaysClearStencil())) { |
| 21 | fGpu->clearStencil(fRenderTarget, 0x0); |
| 22 | } |
| 23 | } |
| 24 | } |
Robert Phillips | 5b5d84c | 2018-08-09 15:12:18 -0400 | [diff] [blame^] | 25 | |
| 26 | void GrGLGpuRTCommandBuffer::set(GrRenderTarget* rt, GrSurfaceOrigin origin, |
| 27 | const GrGpuRTCommandBuffer::LoadAndStoreInfo& colorInfo, |
| 28 | const GrGpuRTCommandBuffer::StencilLoadAndStoreInfo& stencilInfo) { |
| 29 | SkASSERT(fGpu); |
| 30 | SkASSERT(!fRenderTarget); |
| 31 | SkASSERT(fGpu == rt->getContext()->contextPriv().getGpu()); |
| 32 | |
| 33 | this->INHERITED::set(rt, origin); |
| 34 | fColorLoadAndStoreInfo = colorInfo; |
| 35 | fStencilLoadAndStoreInfo = stencilInfo; |
| 36 | } |