aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrDrawOp.cpp
blob: f778601abaf891237b06d26f4f156d282ed51781 (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
28
29
30
31
32
33
34
35
36
37
/*
 * 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 "GrDrawOp.h"

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

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

void GrDrawOp::initPipelineAnalysis(GrPipelineAnalysis* analysis) const {
    GrPipelineInput color;
    GrPipelineInput coverage;
    GrPipelineAnalysisDrawOpInput input(&color, &coverage);
    this->getPipelineAnalysisInput(&input);
    analysis->fColorPOI.initFromPipelineInput(color);
    analysis->fCoveragePOI.initFromPipelineInput(coverage);
    analysis->fUsesPLSDstRead = input.usesPLSDstRead();
}

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