1f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
2f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller#ifndef __NV50_STATEOBJ_H__
3f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller#define __NV50_STATEOBJ_H__
4f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
5f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller#include "pipe/p_state.h"
6f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
7f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller#define NV50_SCISSORS_CLIPPING
8f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
96d1cdec3ba151168bfc3aef222fba6265dfb41fbChristoph Bumiller#define SB_BEGIN_3D(so, m, s) \
106d1cdec3ba151168bfc3aef222fba6265dfb41fbChristoph Bumiller   (so)->state[(so)->size++] = NV50_FIFO_PKHDR(NV50_3D(m), s)
11f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
126d1cdec3ba151168bfc3aef222fba6265dfb41fbChristoph Bumiller#define SB_BEGIN_3D_(so, m, s) \
136d1cdec3ba151168bfc3aef222fba6265dfb41fbChristoph Bumiller   (so)->state[(so)->size++] = NV50_FIFO_PKHDR(SUBC_3D(m), s)
14ddcb90248fb491a3a9e2ada8c595f94b0bd95515Christoph Bumiller
15f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller#define SB_DATA(so, u) (so)->state[(so)->size++] = (u)
16f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
171f5d6fc59bd899e211c70026eb74cd2219858008Christoph Bumiller#include "nv50_stateobj_tex.h"
181f5d6fc59bd899e211c70026eb74cd2219858008Christoph Bumiller
19f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumillerstruct nv50_blend_stateobj {
20f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   struct pipe_blend_state pipe;
21f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   int size;
22b2dcf880e8bcd61be59602f5a2d18c77a5fc60c1Christoph Bumiller   uint32_t state[84]; // TODO: allocate less if !independent_blend_enable
23f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller};
24f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
25f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumillerstruct nv50_rasterizer_stateobj {
26f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   struct pipe_rasterizer_state pipe;
27f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   int size;
28dc4c821f0817a3db716f965692fb701079f66340Marek Olšák   uint32_t state[48];
29f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller};
30f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
31f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumillerstruct nv50_zsa_stateobj {
32f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   struct pipe_depth_stencil_alpha_state pipe;
33f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   int size;
34f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   uint32_t state[29];
35f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller};
36f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
37fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumillerstruct nv50_constbuf {
38fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller   union {
39fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller      struct pipe_resource *buf;
40fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller      const uint8_t *data;
41fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller   } u;
42fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller   uint32_t size; /* max 65536 */
43fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller   uint16_t offset;
44fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller   boolean user; /* should only be TRUE if u.data is valid and non-NULL */
45fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller};
46fcb28682101dfa127486373411043d5d97a0ff8fChristoph Bumiller
47f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumillerstruct nv50_vertex_element {
48f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   struct pipe_vertex_element pipe;
49f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   uint32_t state;
50f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller};
51f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
52f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumillerstruct nv50_vertex_stateobj {
53e6caafd9d7fbfcb5906d22be9d6a3c1714e078acChristoph Bumiller   uint32_t min_instance_div[PIPE_MAX_ATTRIBS];
54e6caafd9d7fbfcb5906d22be9d6a3c1714e078acChristoph Bumiller   uint16_t vb_access_size[PIPE_MAX_ATTRIBS];
55f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   struct translate *translate;
56f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   unsigned num_elements;
57f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   uint32_t instance_elts;
58f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   uint32_t instance_bufs;
59f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   boolean need_conversion;
60f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   unsigned vertex_size;
61f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller   unsigned packet_vertex_limit;
62c448a556e9f97dd059de99048b75ebf6d51e1d7cChristoph Bumiller   struct nv50_vertex_element element[0];
63f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller};
64f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller
6502fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumillerstruct nv50_so_target {
6602fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller   struct pipe_stream_output_target pipe;
6702fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller   struct pipe_query *pq;
6802fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller   unsigned stride;
6902fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller   boolean clean;
7002fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller};
7102fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller
7202fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumillerstatic INLINE struct nv50_so_target *
7302fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumillernv50_so_target(struct pipe_stream_output_target *ptarg)
7402fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller{
7502fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller   return (struct nv50_so_target *)ptarg;
7602fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller}
7702fac2930581b9bea9f6d221eb6d6b471fc3b9c6Christoph Bumiller
78f80c03e1875fe96ff2f4c022e3cb76357828140dChristoph Bumiller#endif
79