Flutter Engine
The Flutter Engine
GrProgramInfo.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 Google LLC
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#ifndef GrProgramInfo_DEFINED
9#define GrProgramInfo_DEFINED
10
11#include "include/gpu/GrTypes.h"
14
16
18public:
19 GrProgramInfo(const GrCaps& caps,
20 const GrSurfaceProxyView& targetView,
21 bool usesMSAASurface,
22 const GrPipeline* pipeline,
26 GrXferBarrierFlags renderPassXferBarriers,
28
29 int numSamples() const { return fNumSamples; }
30 int needsStencil() const { return fNeedsStencil; }
31 bool isStencilEnabled() const {
32 return fUserStencilSettings != &GrUserStencilSettings::kUnused ||
33 fPipeline->hasStencilClip();
34 }
35 const GrUserStencilSettings* userStencilSettings() const { return fUserStencilSettings; }
36 // The backend format of the destination render target [proxy]
37 const GrBackendFormat& backendFormat() const { return fBackendFormat; }
38 GrSurfaceOrigin origin() const { return fOrigin; }
39 const GrPipeline& pipeline() const { return *fPipeline; }
40 const GrGeometryProcessor& geomProc() const { return *fGeomProc; }
41
42 GrPrimitiveType primitiveType() const { return fPrimitiveType; }
43
45 return fTargetHasVkResolveAttachmentWithInput;
46 }
47
48 int targetsNumSamples() const { return fTargetsNumSamples; }
49
50 GrXferBarrierFlags renderPassBarriers() const { return fRenderPassXferBarriers; }
51
52 GrLoadOp colorLoadOp() const { return fColorLoadOp; }
53
54 uint16_t primitiveTypeKey() const {
55 return (uint16_t) fPrimitiveType;
56 }
57
58 // For Dawn, Metal and Vulkan the number of stencil bits is known a priori so we can
59 // create the stencil settings here.
61
62 // Invokes the visitor function on all FP proxies in the pipeline. The caller is responsible
63 // to call the visitor on its own primProc proxies.
64 void visitFPProxies(const GrVisitProxyFunc& func) const { fPipeline->visitProxies(func); }
65
66#ifdef SK_DEBUG
67 void validate(bool flushTime) const;
68 void checkAllInstantiated() const;
69 void checkMSAAAndMIPSAreResolved() const;
70#endif
71
72private:
73 int fNumSamples;
74 bool fNeedsStencil;
75 GrBackendFormat fBackendFormat;
76 GrSurfaceOrigin fOrigin;
77 bool fTargetHasVkResolveAttachmentWithInput;
78 int fTargetsNumSamples;
79 const GrPipeline* fPipeline;
80 const GrUserStencilSettings* fUserStencilSettings;
81 const GrGeometryProcessor* fGeomProc;
82 GrPrimitiveType fPrimitiveType;
83 GrXferBarrierFlags fRenderPassXferBarriers;
84 GrLoadOp fColorLoadOp;
85};
86
87#endif
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
Definition: GrTypesPriv.h:943
GrPrimitiveType
Definition: GrTypesPriv.h:43
GrLoadOp
Definition: GrTypesPriv.h:155
GrSurfaceOrigin
Definition: GrTypes.h:147
GrXferBarrierFlags
Definition: GrCaps.h:57
bool hasStencilClip() const
Definition: GrPipeline.h:174
void visitProxies(const GrVisitProxyFunc &) const
Definition: GrPipeline.cpp:105
uint16_t primitiveTypeKey() const
Definition: GrProgramInfo.h:54
int numSamples() const
Definition: GrProgramInfo.h:29
int targetsNumSamples() const
Definition: GrProgramInfo.h:48
GrSurfaceOrigin origin() const
Definition: GrProgramInfo.h:38
GrPrimitiveType primitiveType() const
Definition: GrProgramInfo.h:42
const GrPipeline & pipeline() const
Definition: GrProgramInfo.h:39
const GrGeometryProcessor & geomProc() const
Definition: GrProgramInfo.h:40
const GrUserStencilSettings * userStencilSettings() const
Definition: GrProgramInfo.h:35
bool targetHasVkResolveAttachmentWithInput() const
Definition: GrProgramInfo.h:44
void visitFPProxies(const GrVisitProxyFunc &func) const
Definition: GrProgramInfo.h:64
GrProgramInfo(const GrCaps &caps, const GrSurfaceProxyView &targetView, bool usesMSAASurface, const GrPipeline *pipeline, const GrUserStencilSettings *userStencilSettings, const GrGeometryProcessor *geomProc, GrPrimitiveType primitiveType, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)
bool isStencilEnabled() const
Definition: GrProgramInfo.h:31
GrLoadOp colorLoadOp() const
Definition: GrProgramInfo.h:52
int needsStencil() const
Definition: GrProgramInfo.h:30
const GrBackendFormat & backendFormat() const
Definition: GrProgramInfo.h:37
GrStencilSettings nonGLStencilSettings() const
GrXferBarrierFlags renderPassBarriers() const
Definition: GrProgramInfo.h:50
static const GrUserStencilSettings & kUnused