aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrDrawBatch.cpp
blob: 43ef2ec64bb107372794d7d0efa6623e2be9debc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "GrDrawBatch.h"

GrDrawBatch::GrDrawBatch(uint32_t classID) : INHERITED(classID), fPipelineInstalled(false) { }

GrDrawBatch::~GrDrawBatch() {
    if (fPipelineInstalled) {
        this->pipeline()->~GrPipeline();
    }
}

bool GrDrawBatch::installPipeline(const GrPipeline::CreateArgs& args) {
    GrPipelineOptimizations opts;
    void* location = fPipelineStorage.get();
    if (!GrPipeline::CreateAt(location, args, &opts)) {
        return false;
    }
    this->initBatchTracker(opts);
    fPipelineInstalled = true;
    return true;
}