pb: fix numDelayed accounting
[mesa.git] / src / gallium / drivers / nvfx / nvfx_state.h
1 #ifndef __NVFX_STATE_H__
2 #define __NVFX_STATE_H__
3
4 #include "pipe/p_state.h"
5 #include "tgsi/tgsi_scan.h"
6 #include "nouveau/nouveau_statebuf.h"
7 #include "util/u_dynarray.h"
8 #include "util/u_linkage.h"
9
10 struct nvfx_vertex_program_exec {
11 uint32_t data[4];
12 };
13
14 struct nvfx_vertex_program_data {
15 int index; /* immediates == -1 */
16 float value[4];
17 };
18
19 struct nvfx_vertex_program {
20 unsigned long long id;
21
22 struct nvfx_vertex_program_exec *insns;
23 unsigned nr_insns;
24 struct nvfx_vertex_program_data *consts;
25 unsigned nr_consts;
26
27 char generic_to_fp_input[256];
28 int sprite_fp_input;
29
30 struct nouveau_resource *exec;
31 unsigned exec_start;
32 struct nouveau_resource *data;
33 unsigned data_start;
34 unsigned data_start_min;
35
36 uint32_t ir;
37 uint32_t or;
38 int clip_nr;
39
40 struct util_dynarray branch_relocs;
41 struct util_dynarray const_relocs;
42 };
43
44 #define NVFX_VP_FAILED ((struct nvfx_vertex_program*)-1)
45
46 struct nvfx_pipe_vertex_program {
47 struct pipe_shader_state pipe;
48 struct tgsi_shader_info info;
49
50 unsigned draw_elements;
51 boolean draw_no_elements;
52 struct draw_vertex_shader *draw_vs;
53 struct nvfx_vertex_program* draw_vp;
54
55 struct nvfx_vertex_program* vp;
56 };
57
58 struct nvfx_fragment_program_data {
59 unsigned offset;
60 unsigned index;
61 };
62
63 struct nvfx_fragment_program_bo {
64 struct nvfx_fragment_program_bo* next;
65 struct nouveau_bo* bo;
66 unsigned char* slots;
67 char insn[] __attribute__((aligned(16)));
68 };
69
70 struct nvfx_fragment_program {
71 unsigned samplers;
72 unsigned point_sprite_control;
73 unsigned or;
74 unsigned coord_conventions;
75
76 uint32_t *insn;
77 int insn_len;
78
79 struct nvfx_fragment_program_data *consts;
80 unsigned nr_consts;
81
82 /* the slot at num_slots is for the sprite coordinate, if any */
83 unsigned num_slots; /* how many input semantics? */
84 unsigned char slot_to_generic[10]; /* semantics */
85 unsigned char slot_to_fp_input[11]; /* current assignment of slots for each used semantic */
86 struct util_dynarray slot_relocations[11];
87
88 /* This is reset to progs on any relocation update, and decreases every time we
89 * move to a new prog due to a constant update
90 * When this is the same as progs, applying relocations is no longer necessary.
91 */
92 unsigned progs_left_with_obsolete_slot_assignments;
93
94 unsigned long long last_vp_id;
95 unsigned last_sprite_coord_enable;
96
97 uint32_t fp_control;
98
99 unsigned bo_prog_idx;
100 unsigned prog_size;
101 unsigned progs_per_bo;
102 unsigned progs;
103
104 struct nvfx_fragment_program_bo* fpbo;
105 };
106
107 struct nvfx_pipe_fragment_program {
108 struct pipe_shader_state pipe;
109 struct tgsi_shader_info info;
110
111 struct nvfx_fragment_program* fps[2];
112 };
113
114 #endif