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_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[48];
29 };
30 
31 struct nv50_zsa_stateobj {
32    struct pipe_depth_stencil_alpha_state pipe;
33    int size;
34    uint32_t state[29];
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    uint16_t offset;
44    boolean 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    boolean need_conversion;
60    unsigned vertex_size;
61    unsigned packet_vertex_limit;
62    struct nv50_vertex_element element[0];
63 };
64 
65 struct nv50_so_target {
66    struct pipe_stream_output_target pipe;
67    struct pipe_query *pq;
68    unsigned stride;
69    boolean clean;
70 };
71 
72 static INLINE struct nv50_so_target *
nv50_so_target(struct pipe_stream_output_target * ptarg)73 nv50_so_target(struct pipe_stream_output_target *ptarg)
74 {
75    return (struct nv50_so_target *)ptarg;
76 }
77 
78 #endif
79