1 #ifndef __NV30_STATE_H__ 2 #define __NV30_STATE_H__ 3 4 #include "pipe/p_state.h" 5 #include "tgsi/tgsi_scan.h" 6 #include "util/u_dynarray.h" 7 8 #define NV30_QUERY_ZCULL_0 (PIPE_QUERY_TYPES + 0) 9 #define NV30_QUERY_ZCULL_1 (PIPE_QUERY_TYPES + 1) 10 #define NV30_QUERY_ZCULL_2 (PIPE_QUERY_TYPES + 2) 11 #define NV30_QUERY_ZCULL_3 (PIPE_QUERY_TYPES + 3) 12 13 #define SB_DATA(so, u) (so)->data[(so)->size++] = (u) 14 #define SB_MTHD30(so, mthd, size) \ 15 SB_DATA((so), ((size) << 18) | (7 << 13) | NV30_3D_##mthd) 16 #define SB_MTHD35(so, mthd, size) \ 17 SB_DATA((so), ((size) << 18) | (7 << 13) | NV35_3D_##mthd) 18 #define SB_MTHD40(so, mthd, size) \ 19 SB_DATA((so), ((size) << 18) | (7 << 13) | NV40_3D_##mthd) 20 21 struct nv30_blend_stateobj { 22 struct pipe_blend_state pipe; 23 unsigned data[16]; 24 unsigned size; 25 }; 26 27 struct nv30_rasterizer_stateobj { 28 struct pipe_rasterizer_state pipe; 29 unsigned data[32]; 30 unsigned size; 31 }; 32 33 struct nv30_zsa_stateobj { 34 struct pipe_depth_stencil_alpha_state pipe; 35 unsigned data[36]; 36 unsigned size; 37 }; 38 39 struct nv30_sampler_state { 40 struct pipe_sampler_state pipe; 41 unsigned fmt; 42 unsigned wrap; 43 unsigned en; 44 unsigned filt; 45 unsigned bcol; 46 /* 4.8 */ 47 unsigned min_lod; 48 unsigned max_lod; 49 }; 50 51 struct nv30_sampler_view { 52 struct pipe_sampler_view pipe; 53 unsigned fmt; 54 unsigned swz; 55 unsigned filt; 56 unsigned filt_mask; 57 unsigned wrap; 58 unsigned wrap_mask; 59 unsigned npot_size0; 60 unsigned npot_size1; 61 /* 4.8 */ 62 unsigned base_lod; 63 unsigned high_lod; 64 }; 65 66 struct nv30_shader_reloc { 67 unsigned location; 68 int target; 69 }; 70 71 struct nv30_vertprog_exec { 72 uint32_t data[4]; 73 }; 74 75 struct nv30_vertprog_data { 76 int index; /* immediates == -1 */ 77 float value[4]; 78 }; 79 80 struct nv30_vertprog { 81 struct pipe_shader_state pipe; 82 struct tgsi_shader_info info; 83 84 struct draw_vertex_shader *draw; 85 bool translated; 86 unsigned enabled_ucps; 87 uint16_t texcoord[10]; 88 89 struct util_dynarray branch_relocs; 90 struct nv30_vertprog_exec *insns; 91 unsigned nr_insns; 92 93 struct util_dynarray const_relocs; 94 struct nv30_vertprog_data *consts; 95 unsigned nr_consts; 96 97 struct nouveau_heap *exec; 98 struct nouveau_heap *data; 99 uint32_t ir; 100 uint32_t or; 101 void *nvfx; 102 }; 103 104 struct nv30_fragprog_data { 105 unsigned offset; 106 unsigned index; 107 }; 108 109 struct nv30_fragprog { 110 struct pipe_shader_state pipe; 111 struct tgsi_shader_info info; 112 113 struct draw_fragment_shader *draw; 114 bool translated; 115 116 uint32_t *insn; 117 unsigned insn_len; 118 119 uint16_t texcoord[10]; 120 struct nv30_fragprog_data *consts; 121 unsigned nr_consts; 122 123 struct pipe_resource *buffer; 124 uint32_t vp_or; /* appended to VP_RESULT_EN */ 125 uint32_t fp_control; 126 uint32_t point_sprite_control; 127 uint32_t coord_conventions; 128 uint32_t texcoords; 129 uint32_t rt_enable; 130 }; 131 132 struct nv30_vertex_element { 133 unsigned state; 134 }; 135 136 struct nv30_vertex_stateobj { 137 struct pipe_vertex_element pipe[PIPE_MAX_ATTRIBS]; 138 struct translate *translate; 139 bool need_conversion; 140 unsigned num_elements; 141 unsigned vtx_size; 142 unsigned vtx_per_packet_max; 143 struct nv30_vertex_element element[]; 144 }; 145 146 #endif 147