xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 
2 #ifndef __NV50_STATEOBJ_H__
3 #define __NV50_STATEOBJ_H__
4 
5 #include "pipe/p_state.h"
6 
7 #define NV50_SCISSORS_CLIPPING
8 
9 #define SB_BEGIN_3D(so, m, s) \
10    (so)->state[(so)->size++] = NV50_FIFO_PKHDR(NV50_3D(m), s)
11 
12 #define SB_BEGIN_3D_(so, m, s) \
13    (so)->state[(so)->size++] = NV50_FIFO_PKHDR(SUBC_3D(m), s)
14 
15 #define SB_DATA(so, u) (so)->state[(so)->size++] = (u)
16 
17 #include "nv50/nv50_stateobj_tex.h"
18 
19 struct nv50_blend_stateobj {
20    struct pipe_blend_state pipe;
21    int size;
22    uint32_t state[84]; // TODO: allocate less if !independent_blend_enable
23 };
24 
25 struct nv50_rasterizer_stateobj {
26    struct pipe_rasterizer_state pipe;
27    int size;
28    uint32_t state[49];
29 };
30 
31 struct nv50_zsa_stateobj {
32    struct pipe_depth_stencil_alpha_state pipe;
33    int size;
34    uint32_t state[38];
35 };
36 
37 struct nv50_constbuf {
38    union {
39       struct pipe_resource *buf;
40       const uint8_t *data;
41    } u;
42    uint32_t size; /* max 65536 */
43    uint32_t offset;
44    bool user; /* should only be true if u.data is valid and non-NULL */
45 };
46 
47 struct nv50_vertex_element {
48    struct pipe_vertex_element pipe;
49    uint32_t state;
50 };
51 
52 struct nv50_vertex_stateobj {
53    uint32_t min_instance_div[PIPE_MAX_ATTRIBS];
54    uint16_t vb_access_size[PIPE_MAX_ATTRIBS];
55    uint16_t strides[PIPE_MAX_ATTRIBS];
56    struct translate *translate;
57    unsigned num_elements;
58    uint32_t instance_elts;
59    uint32_t instance_bufs;
60    uint32_t vbo_constant;
61    bool need_conversion;
62    unsigned vertex_size;
63    unsigned packet_vertex_limit;
64    struct nv50_vertex_element element[0];
65 };
66 
67 struct nv50_window_rect_stateobj {
68    bool inclusive;
69    unsigned rects;
70    struct pipe_scissor_state rect[PIPE_MAX_WINDOW_RECTANGLES];
71 };
72 
73 struct nv50_so_target {
74    struct pipe_stream_output_target pipe;
75    struct pipe_query *pq;
76    unsigned stride;
77    bool clean;
78 };
79 
80 static inline struct nv50_so_target *
nv50_so_target(struct pipe_stream_output_target * ptarg)81 nv50_so_target(struct pipe_stream_output_target *ptarg)
82 {
83    return (struct nv50_so_target *)ptarg;
84 }
85 
86 #endif
87