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    struct translate *translate;
56    unsigned num_elements;
57    uint32_t instance_elts;
58    uint32_t instance_bufs;
59    bool need_conversion;
60    unsigned vertex_size;
61    unsigned packet_vertex_limit;
62    struct nv50_vertex_element element[0];
63 };
64 
65 struct nv50_window_rect_stateobj {
66    bool inclusive;
67    unsigned rects;
68    struct pipe_scissor_state rect[PIPE_MAX_WINDOW_RECTANGLES];
69 };
70 
71 struct nv50_so_target {
72    struct pipe_stream_output_target pipe;
73    struct pipe_query *pq;
74    unsigned stride;
75    bool clean;
76 };
77 
78 static inline struct nv50_so_target *
nv50_so_target(struct pipe_stream_output_target * ptarg)79 nv50_so_target(struct pipe_stream_output_target *ptarg)
80 {
81    return (struct nv50_so_target *)ptarg;
82 }
83 
84 #endif
85