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