xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/freedreno/freedreno_state.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2012 Rob Clark <[email protected]>
3  * SPDX-License-Identifier: MIT
4  *
5  * Authors:
6  *    Rob Clark <[email protected]>
7  */
8 
9 #ifndef FREEDRENO_STATE_H_
10 #define FREEDRENO_STATE_H_
11 
12 #include "pipe/p_context.h"
13 #include "freedreno_context.h"
14 
15 BEGINC;
16 
17 static inline bool
fd_depth_enabled(struct fd_context * ctx)18 fd_depth_enabled(struct fd_context *ctx) assert_dt
19 {
20    return ctx->zsa && ctx->zsa->depth_enabled;
21 }
22 
23 static inline bool
fd_depth_write_enabled(struct fd_context * ctx)24 fd_depth_write_enabled(struct fd_context *ctx) assert_dt
25 {
26    return ctx->zsa && ctx->zsa->depth_writemask;
27 }
28 
29 static inline bool
fd_stencil_enabled(struct fd_context * ctx)30 fd_stencil_enabled(struct fd_context *ctx) assert_dt
31 {
32    return ctx->zsa && ctx->zsa->stencil[0].enabled;
33 }
34 
35 static inline bool
fd_blend_enabled(struct fd_context * ctx,unsigned n)36 fd_blend_enabled(struct fd_context *ctx, unsigned n) assert_dt
37 {
38    return ctx->blend && ctx->blend->rt[n].blend_enable;
39 }
40 
41 static inline bool
fd_rast_depth_clamp_enabled(const struct pipe_rasterizer_state * cso)42 fd_rast_depth_clamp_enabled(const struct pipe_rasterizer_state *cso)
43 {
44    return !(cso->depth_clip_near && cso->depth_clip_far);
45 }
46 
47 static inline bool
fd_depth_clamp_enabled(struct fd_context * ctx)48 fd_depth_clamp_enabled(struct fd_context *ctx) assert_dt
49 {
50    return fd_rast_depth_clamp_enabled(ctx->rasterizer);
51 }
52 
53 void fd_set_shader_buffers(struct pipe_context *pctx,
54                            enum pipe_shader_type shader,
55                            unsigned start, unsigned count,
56                            const struct pipe_shader_buffer *buffers,
57                            unsigned writable_bitmask) in_dt;
58 
59 void fd_set_shader_images(struct pipe_context *pctx,
60                           enum pipe_shader_type shader, unsigned start,
61                           unsigned count, unsigned unbind_num_trailing_slots,
62                           const struct pipe_image_view *images) in_dt;
63 
64 void fd_set_framebuffer_state(struct pipe_context *pctx,
65                          const struct pipe_framebuffer_state *framebuffer) in_dt;
66 
67 void fd_state_init(struct pipe_context *pctx);
68 
69 ENDC;
70 
71 #endif /* FREEDRENO_STATE_H_ */
72