1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef __NVC0_STATEOBJ_H__
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define __NVC0_STATEOBJ_H__
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_state.h"
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SB_BEGIN_3D(so, m, s)                                                  \
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   (so)->state[(so)->size++] = NVC0_FIFO_PKHDR_SQ(NVC0_3D(m), s)
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SB_IMMED_3D(so, m, d)                                                  \
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   (so)->state[(so)->size++] = NVC0_FIFO_PKHDR_IL(NVC0_3D(m), d)
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SB_DATA(so, u) (so)->state[(so)->size++] = (u)
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "nv50/nv50_stateobj_tex.h"
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct nvc0_blend_stateobj {
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_blend_state pipe;
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int size;
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t state[72];
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct nvc0_rasterizer_stateobj {
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_rasterizer_state pipe;
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int size;
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t state[43];
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct nvc0_zsa_stateobj {
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_depth_stencil_alpha_state pipe;
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int size;
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t state[26];
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct nvc0_constbuf {
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union {
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      struct pipe_resource *buf;
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      const void *data;
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   } u;
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t size;
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint16_t offset;
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   boolean user; /* should only be TRUE if u.data is valid and non-NULL */
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct nvc0_vertex_element {
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_vertex_element pipe;
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t state;
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t state_alt; /* buffer 0 and with source offset (for translate) */
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct nvc0_vertex_stateobj {
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t min_instance_div[PIPE_MAX_ATTRIBS];
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint16_t vb_access_size[PIPE_MAX_ATTRIBS];
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct translate *translate;
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned num_elements;
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t instance_elts;
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint32_t instance_bufs;
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   boolean shared_slots;
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   boolean need_conversion; /* e.g. VFETCH cannot convert f64 to f32 */
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned size; /* size of vertex in bytes (when packed) */
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct nvc0_vertex_element element[0];
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct nvc0_so_target {
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_stream_output_target pipe;
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_query *pq;
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned stride;
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   boolean clean;
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE struct nvc0_so_target *
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnvc0_so_target(struct pipe_stream_output_target *ptarg)
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return (struct nvc0_so_target *)ptarg;
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif
78