aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPipelineInput.h
blob: 43d88d028822d25beb0017aa1cde2f2442f0d5c9 (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
38
39
40
41
42
43
44
45
46
47
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrPipelineInput_DEFINED
#define GrPipelineInput_DEFINED

#include "GrColor.h"

/**
 * This describes the color or coverage input that will be seen by the first color or coverage stage
 * of a GrPipeline. This is also the GrPrimitiveProcessor color or coverage *output*.
 */
struct GrPipelineInput {
    GrPipelineInput()
            : fValidFlags(kNone_GrColorComponentFlags), fColor(0), fIsLCDCoverage(false) {}

    void setKnownFourComponents(GrColor color) {
        fColor = color;
        fValidFlags = kRGBA_GrColorComponentFlags;
    }

    void setUnknownFourComponents() { fValidFlags = kNone_GrColorComponentFlags; }

    void setUnknownOpaqueFourComponents() {
        fColor = 0xffU << GrColor_SHIFT_A;
        fValidFlags = kA_GrColorComponentFlag;
    }

    void setKnownSingleComponent(uint8_t alpha) {
        fColor = GrColorPackRGBA(alpha, alpha, alpha, alpha);
        fValidFlags = kRGBA_GrColorComponentFlags;
    }

    void setUnknownSingleComponent() { fValidFlags = kNone_GrColorComponentFlags; }

    void setUsingLCDCoverage() { fIsLCDCoverage = true; }

    GrColorComponentFlags fValidFlags;
    GrColor fColor;
    bool fIsLCDCoverage;
};

#endif