blob: 4f08b83fbd7e5683d0ec3bb5afb2efb56c1eb215 [file] [log] [blame]
Robert Phillipscb2e2352017-08-30 16:44:40 -04001/*
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
13void 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}