Debian Codegraph @

src/gallium/drivers/freedreno/a6xx/fd6_zsa.h

raw symbols SCIP
1 /*
2 * Copyright © 2016 Rob Clark <[email protected]>
3 * Copyright © 2018 Google, Inc.
4 * SPDX-License-Identifier: MIT
5 *
6 * Authors:
7 * Rob Clark <[email protected]>
8 */
9
10 #ifndef FD6_ZSA_H_
11 #define FD6_ZSA_H_
12
13 #include "pipe/p_context.h"
14 #include "pipe/p_state.h"
15
16 #include "freedreno_util.h"
17
18 #include "fd6_context.h"
19
20 #define FD6_ZSA_NO_ALPHA (1 << 0)
21 #define FD6_ZSA_DEPTH_CLAMP (1 << 1)
22
23 struct fd6_zsa_stateobj {
24 struct pipe_depth_stencil_alpha_state base;
25
26 struct fd6_lrz_state lrz;
27 bool writes_zs : 1; /* writes depth and/or stencil */
28 bool writes_z : 1; /* writes depth */
29 bool invalidate_lrz : 1;
30 bool alpha_test : 1;
31
32 /* Track whether we've alread generated perf warns so that
33 * we don't flood the user with LRZ disable warns which can
34 * only be detected at draw time.
35 */
36 bool perf_warn_blend : 1;
37 bool perf_warn_zdir : 1;
38
39 struct fd_ringbuffer *stateobj[4];
40 };
41
42 static inline struct fd6_zsa_stateobj *
43 fd6_zsa_stateobj(struct pipe_depth_stencil_alpha_state *zsa)
44 {
45 return (struct fd6_zsa_stateobj *)zsa;
46 }
47
48 static inline struct fd_ringbuffer *
49 fd6_zsa_state(struct fd_context *ctx, bool no_alpha, bool depth_clamp) assert_dt
50 {
51 int variant = 0;
52 if (no_alpha)
53 variant |= FD6_ZSA_NO_ALPHA;
54 if (depth_clamp)
55 variant |= FD6_ZSA_DEPTH_CLAMP;
56 return fd6_zsa_stateobj(ctx->zsa)->stateobj[variant];
57 }
58
59 template <chip CHIP>
60 void *fd6_zsa_state_create(struct pipe_context *pctx,
61 const struct pipe_depth_stencil_alpha_state *cso);
62
63 void fd6_zsa_state_delete(struct pipe_context *pctx, void *hwcso);
64
65 #endif /* FD6_ZSA_H_ */