aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/GrInstancedPipelineInfo.h
blob: 6f9c779d74dba71e66737eb2fab734b3e7be2c06 (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
48
49
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrGrInstancedPipelineInfo_DEFINED
#define GrGrInstancedPipelineInfo_DEFINED

#include "GrRenderTargetProxy.h"

/**
 * Provides info about the pipeline that GrInstancedRendering needs in order to select appropriate
 * drawing algorithms.
 */
struct GrInstancedPipelineInfo {
    GrInstancedPipelineInfo(const GrRenderTargetProxy* rtp)
        : fIsMultisampled(rtp->isStencilBufferMultisampled())
        , fIsMixedSampled(rtp->isMixedSampled())
        , fIsRenderingToFloat(GrPixelConfigIsFloatingPoint(rtp->desc().fConfig))
        , fColorDisabled(false)
        , fDrawingShapeToStencil(false)
        , fCanDiscard(false) {
    }

    bool canUseCoverageAA() const {
        return !fIsMultisampled || (fIsMixedSampled && !fDrawingShapeToStencil);
    }

    bool fIsMultisampled         : 1;
    bool fIsMixedSampled         : 1;
    bool fIsRenderingToFloat     : 1;
    bool fColorDisabled          : 1;
    /**
     * Indicates that the instanced renderer should take extra precautions to ensure the shape gets
     * drawn correctly to the stencil buffer (e.g. no coverage AA). NOTE: this does not mean a
     * stencil test is or is not active.
     */
    bool fDrawingShapeToStencil  : 1;
    /**
     * Indicates that the instanced renderer can use processors with discard instructions. This
     * should not be set if the shader will use derivatives, automatic mipmap LOD, or other features
     * that depend on neighboring pixels. Some draws will fail to create if this is not set.
     */
    bool fCanDiscard             : 1;
};

#endif