X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Fdraw%2Fdraw_private.h;h=8af885908e3860408f2a5371f7708093d4a35eec;hb=959a458ea01d5fa4274bdd439da114b42d3b86d3;hp=e49041556bd5d1c386e5f78448b19e5f306aad30;hpb=89d8577fb3036547ef0b47498cc8dc5c77f886e0;p=mesa.git diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index e49041556bd..8af885908e3 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -46,10 +46,13 @@ #include "tgsi/tgsi_scan.h" +#ifdef HAVE_LLVM +#include +struct draw_llvm; +#endif + struct pipe_context; -struct gallivm_prog; -struct gallivm_cpu_engine; struct draw_vertex_shader; struct draw_context; struct draw_stage; @@ -79,11 +82,16 @@ struct vertex_header { #define UNDEFINED_VERTEX_ID 0xffff +/* maximum number of shader variants we can cache */ +#define DRAW_MAX_SHADER_VARIANTS 1024 + /** * Private context for the drawing module. */ struct draw_context { + struct pipe_context *pipe; + /** Drawing/primitive pipeline stages */ struct { struct draw_stage *first; /**< one of the following */ @@ -107,6 +115,7 @@ struct draw_context float wide_point_threshold; /**< convert pnts to tris if larger than this */ float wide_line_threshold; /**< convert lines to tris if wider than this */ + boolean wide_point_sprites; /**< convert points to tris for sprite mode */ boolean line_stipple; /**< do line stipple? */ boolean point_sprite; /**< convert points to quads for sprites? */ @@ -127,6 +136,7 @@ struct draw_context struct draw_pt_middle_end *fetch_emit; struct draw_pt_middle_end *fetch_shade_emit; struct draw_pt_middle_end *general; + struct draw_pt_middle_end *llvm; } middle; struct { @@ -146,6 +156,7 @@ struct draw_context const void *elts; /** bytes per index (0, 1, 2 or 4) */ unsigned eltSize; + int eltBias; unsigned min_index; unsigned max_index; @@ -153,8 +164,8 @@ struct draw_context const void *vbuffer[PIPE_MAX_ATTRIBS]; /** constant buffer (for vertex/geometry shader) */ - const void *vs_constants; - const void *gs_constants; + const void *vs_constants[PIPE_MAX_CONSTANT_BUFFERS]; + const void *gs_constants[PIPE_MAX_CONSTANT_BUFFERS]; } user; boolean test_fse; /* enable FSE even though its not correct (eg for softpipe) */ @@ -172,10 +183,18 @@ struct draw_context boolean force_passthrough; /**< never clip or shade */ + boolean dump_vs; + double mrd; /**< minimum resolvable depth value, for polygon offset */ - /* pipe state that we need: */ + /** Current rasterizer state given to us by the driver */ const struct pipe_rasterizer_state *rasterizer; + /** Driver CSO handle for the current rasterizer state */ + void *rast_handle; + + /** Rasterizer CSOs without culling/stipple/etc */ + void *rasterizer_no_cull[2][2]; + struct pipe_viewport_state viewport; boolean identity_viewport; @@ -191,19 +210,15 @@ struct draw_context uint num_samplers; struct tgsi_sampler **samplers; - /* This (and the tgsi_exec_machine struct) probably need to be moved somewhere private. - */ - struct gallivm_cpu_engine *engine; - /* Here's another one: */ struct aos_machine *aos_machine; - const float (*aligned_constants)[4]; + const void *aligned_constants[PIPE_MAX_CONSTANT_BUFFERS]; - const float (*aligned_constant_storage)[4]; - unsigned const_storage_size; + const void *aligned_constant_storage[PIPE_MAX_CONSTANT_BUFFERS]; + unsigned const_storage_size[PIPE_MAX_CONSTANT_BUFFERS]; struct translate *fetch; @@ -224,6 +239,12 @@ struct draw_context struct tgsi_sampler **samplers; } gs; + struct { + struct pipe_stream_output_state state; + void *buffers[PIPE_MAX_SO_BUFFERS]; + uint num_buffers; + } so; + /* Clip derived state: */ float plane[12][4]; @@ -239,10 +260,54 @@ struct draw_context unsigned reduced_prim; + unsigned instance_id; + +#ifdef HAVE_LLVM + struct draw_llvm *llvm; + LLVMExecutionEngineRef engine; +#endif + + struct pipe_sampler_view *sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned num_sampler_views; + const struct pipe_sampler_state *samplers[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned num_samplers; + void *driver_private; }; +struct draw_fetch_info { + boolean linear; + unsigned start; + const unsigned *elts; + unsigned count; +}; + +struct draw_vertex_info { + struct vertex_header *verts; + unsigned vertex_size; + unsigned stride; + unsigned count; +}; + +struct draw_prim_info { + boolean linear; + unsigned start; + + const ushort *elts; + unsigned count; + + unsigned prim; + unsigned *primitive_lengths; + unsigned primitive_count; +}; + + +/******************************************************************************* + * Draw common initialization code + */ +boolean draw_init(struct draw_context *draw); + /******************************************************************************* * Vertex shader code: */ @@ -252,9 +317,11 @@ void draw_vs_destroy( struct draw_context *draw ); void draw_vs_set_viewport( struct draw_context *, const struct pipe_viewport_state * ); -void draw_vs_set_constants( struct draw_context *, - const float (*constants)[4], - unsigned size ); +void +draw_vs_set_constants(struct draw_context *, + unsigned slot, + const void *constants, + unsigned size); @@ -262,15 +329,20 @@ void draw_vs_set_constants( struct draw_context *, * Geometry shading code: */ boolean draw_gs_init( struct draw_context *draw ); -void draw_gs_set_constants( struct draw_context *, - const float (*constants)[4], - unsigned size ); + +void +draw_gs_set_constants(struct draw_context *, + unsigned slot, + const void *constants, + unsigned size); + +void draw_gs_destroy( struct draw_context *draw ); /******************************************************************************* * Common shading code: */ -int draw_current_shader_outputs(struct draw_context *draw); -int draw_current_shader_position_output(struct draw_context *draw); +uint draw_current_shader_outputs(const struct draw_context *draw); +uint draw_current_shader_position_output(const struct draw_context *draw); /******************************************************************************* * Vertex processing (was passthrough) code: @@ -308,18 +380,13 @@ void draw_pipeline_destroy( struct draw_context *draw ); #define DRAW_PIPE_FLAG_MASK (0xf<<12) void draw_pipeline_run( struct draw_context *draw, - unsigned prim, - struct vertex_header *vertices, - unsigned vertex_count, - unsigned stride, - const ushort *elts, - unsigned count ); + const struct draw_vertex_info *vert, + const struct draw_prim_info *prim); void draw_pipeline_run_linear( struct draw_context *draw, - unsigned prim, - struct vertex_header *vertices, - unsigned count, - unsigned stride ); + const struct draw_vertex_info *vert, + const struct draw_prim_info *prim); + @@ -340,5 +407,10 @@ void draw_do_flush( struct draw_context *draw, unsigned flags ); +void * +draw_get_rasterizer_no_cull( struct draw_context *draw, + boolean scissor, + boolean flatshade ); + #endif /* DRAW_PRIVATE_H */