00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00040 #ifndef DRAW_PRIVATE_H
00041 #define DRAW_PRIVATE_H
00042
00043
00044 #include "pipe/p_state.h"
00045 #include "pipe/p_defines.h"
00046
00047 #include "tgsi/tgsi_exec.h"
00048 #include "tgsi/tgsi_scan.h"
00049
00050
00051 struct pipe_context;
00052 struct gallivm_prog;
00053 struct gallivm_cpu_engine;
00054 struct draw_vertex_shader;
00055 struct draw_context;
00056 struct draw_stage;
00057 struct vbuf_render;
00058
00059
00064 struct vertex_header {
00065 unsigned clipmask:12;
00066 unsigned edgeflag:1;
00067 unsigned pad:3;
00068 unsigned vertex_id:16;
00069
00070 float clip[4];
00071
00072
00073
00074 float data[][4];
00075 };
00076
00077
00078 #define UNDEFINED_VERTEX_ID 0xffff
00079
00080
00084 struct draw_context
00085 {
00087 struct {
00088 struct draw_stage *first;
00090 struct draw_stage *validate;
00091
00092
00093 struct draw_stage *flatshade;
00094 struct draw_stage *clip;
00095 struct draw_stage *cull;
00096 struct draw_stage *twoside;
00097 struct draw_stage *offset;
00098 struct draw_stage *unfilled;
00099 struct draw_stage *stipple;
00100 struct draw_stage *aapoint;
00101 struct draw_stage *aaline;
00102 struct draw_stage *pstipple;
00103 struct draw_stage *wide_line;
00104 struct draw_stage *wide_point;
00105 struct draw_stage *rasterize;
00106
00107 float wide_point_threshold;
00108 float wide_line_threshold;
00109 boolean line_stipple;
00110 boolean point_sprite;
00112
00113
00114 char *verts;
00115 unsigned vertex_stride;
00116 unsigned vertex_count;
00117 } pipeline;
00118
00119
00120 struct vbuf_render *render;
00121
00122
00123
00124 struct {
00125 struct {
00126 struct draw_pt_middle_end *fetch_emit;
00127 struct draw_pt_middle_end *fetch_shade_emit;
00128 struct draw_pt_middle_end *general;
00129 } middle;
00130
00131 struct {
00132 struct draw_pt_front_end *vcache;
00133 struct draw_pt_front_end *varray;
00134 } front;
00135
00136 struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
00137 unsigned nr_vertex_buffers;
00138
00139 struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
00140 unsigned nr_vertex_elements;
00141
00142
00143 struct {
00144 const unsigned *edgeflag;
00145
00147 const void *elts;
00149 unsigned eltSize;
00150 unsigned min_index;
00151 unsigned max_index;
00152
00154 const void *vbuffer[PIPE_MAX_ATTRIBS];
00155
00157 const void *constants;
00158 } user;
00159
00160 boolean test_fse;
00161 boolean no_fse;
00162 } pt;
00163
00164 struct {
00165 boolean bypass_clipping;
00166 boolean bypass_vs;
00167 } driver;
00168
00169 boolean flushing;
00170 boolean suspend_flushing;
00171 boolean bypass_clipping;
00173 boolean force_passthrough;
00175 double mrd;
00177
00178 const struct pipe_rasterizer_state *rasterizer;
00179 struct pipe_viewport_state viewport;
00180 boolean identity_viewport;
00181
00182 struct {
00183 struct draw_vertex_shader *vertex_shader;
00184 uint num_vs_outputs;
00185 uint position_output;
00186
00188 struct tgsi_exec_machine machine;
00189
00190
00191
00192 struct gallivm_cpu_engine *engine;
00193
00194
00195
00196 struct aos_machine *aos_machine;
00197
00198
00199 const float (*aligned_constants)[4];
00200
00201 float (*aligned_constant_storage)[4];
00202 unsigned const_storage_size;
00203
00204
00205 struct translate *fetch;
00206 struct translate_cache *fetch_cache;
00207 struct translate *emit;
00208 struct translate_cache *emit_cache;
00209 } vs;
00210
00211
00212
00213 float plane[12][4];
00214 unsigned nr_planes;
00215
00216
00217
00218 struct {
00219 uint semantic_name;
00220 uint semantic_index;
00221 int slot;
00222 } extra_vp_outputs;
00223
00224 unsigned reduced_prim;
00225
00226 void *driver_private;
00227 };
00228
00229
00230
00231
00232
00233 boolean draw_vs_init( struct draw_context *draw );
00234 void draw_vs_destroy( struct draw_context *draw );
00235
00236 void draw_vs_set_viewport( struct draw_context *,
00237 const struct pipe_viewport_state * );
00238
00239 void draw_vs_set_constants( struct draw_context *,
00240 const float (*constants)[4],
00241 unsigned size );
00242
00243
00244
00245
00246
00247
00248
00249 boolean draw_pt_init( struct draw_context *draw );
00250 void draw_pt_destroy( struct draw_context *draw );
00251 void draw_pt_reset_vertex_ids( struct draw_context *draw );
00252
00253
00254
00255
00256
00257
00258 boolean draw_pipeline_init( struct draw_context *draw );
00259 void draw_pipeline_destroy( struct draw_context *draw );
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273 #define DRAW_PIPE_MAX_VERTICES (0x1<<12)
00274 #define DRAW_PIPE_EDGE_FLAG_0 (0x1<<12)
00275 #define DRAW_PIPE_EDGE_FLAG_1 (0x2<<12)
00276 #define DRAW_PIPE_EDGE_FLAG_2 (0x4<<12)
00277 #define DRAW_PIPE_EDGE_FLAG_ALL (0x7<<12)
00278 #define DRAW_PIPE_RESET_STIPPLE (0x8<<12)
00279 #define DRAW_PIPE_FLAG_MASK (0xf<<12)
00280
00281 void draw_pipeline_run( struct draw_context *draw,
00282 unsigned prim,
00283 struct vertex_header *vertices,
00284 unsigned vertex_count,
00285 unsigned stride,
00286 const ushort *elts,
00287 unsigned count );
00288
00289 void draw_pipeline_run_linear( struct draw_context *draw,
00290 unsigned prim,
00291 struct vertex_header *vertices,
00292 unsigned count,
00293 unsigned stride );
00294
00295
00296
00297 void draw_pipeline_flush( struct draw_context *draw,
00298 unsigned flags );
00299
00300
00301
00302
00303
00304
00305
00306 #define DRAW_FLUSH_STATE_CHANGE 0x8
00307 #define DRAW_FLUSH_BACKEND 0x10
00308
00309
00310 void draw_do_flush( struct draw_context *draw, unsigned flags );
00311
00312
00313
00314
00315 #endif