X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Fdraw%2Fdraw_context.c;h=7bd4a2e22185601fa116d41a6366ef6572212ac0;hb=8abc860bd46a6cd584f9a64cb4613be76f82db06;hp=678c70e478247180f082a2542045d4a6266d3ea4;hpb=01de2293d5449ab6ca1d99b007c9ea4f0037fef5;p=mesa.git diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 678c70e4782..7bd4a2e2218 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -31,7 +31,8 @@ */ -#include "pipe/p_util.h" +#include "util/u_memory.h" +#include "util/u_math.h" #include "draw_context.h" #include "draw_vbuf.h" #include "draw_vs.h" @@ -63,10 +64,8 @@ struct draw_context *draw_create( void ) if (!draw_pt_init( draw )) goto fail; -#ifdef PIPE_ARCH_X86 if (!draw_vs_init( draw )) goto fail; -#endif return draw; @@ -104,6 +103,18 @@ void draw_flush( struct draw_context *draw ) } +/** + * Specify the Minimum Resolvable Depth factor for polygon offset. + * This factor potentially depends on the number of Z buffer bits, + * the rasterization algorithm and the arithmetic performed on Z + * values between vertex shading and rasterization. It will vary + * from one driver to another. + */ +void draw_set_mrd(struct draw_context *draw, double mrd) +{ + draw->mrd = mrd; +} + /** * Register new primitive rasterization/rendering state. @@ -273,6 +284,14 @@ draw_enable_point_sprites(struct draw_context *draw, boolean enable) } +void +draw_set_force_passthrough( struct draw_context *draw, boolean enable ) +{ + draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw->force_passthrough = enable; +} + + /** * Ask the draw module for the location/slot of the given vertex attribute in * a post-transformed vertex. @@ -289,7 +308,7 @@ draw_enable_point_sprites(struct draw_context *draw, boolean enable) * work for the drivers. */ int -draw_find_vs_output(struct draw_context *draw, +draw_find_vs_output(const struct draw_context *draw, uint semantic_name, uint semantic_index) { const struct draw_vertex_shader *vs = draw->vs.vertex_shader; @@ -315,7 +334,7 @@ draw_find_vs_output(struct draw_context *draw, * Return number of vertex shader outputs. */ uint -draw_num_vs_outputs(struct draw_context *draw) +draw_num_vs_outputs(const struct draw_context *draw) { uint count = draw->vs.vertex_shader->info.num_outputs; if (draw->extra_vp_outputs.slot > 0) @@ -324,6 +343,21 @@ draw_num_vs_outputs(struct draw_context *draw) } +/** + * Provide TGSI sampler objects for vertex shaders that use texture fetches. + * This might only be used by software drivers for the time being. + */ +void +draw_texture_samplers(struct draw_context *draw, + uint num_samplers, + struct tgsi_sampler **samplers) +{ + draw->vs.num_samplers = num_samplers; + draw->vs.samplers = samplers; +} + + + void draw_set_render( struct draw_context *draw, struct vbuf_render *render ) @@ -355,7 +389,7 @@ draw_set_mapped_element_buffer_range( struct draw_context *draw, unsigned eltSize, unsigned min_index, unsigned max_index, - void *elements ) + const void *elements ) { draw->pt.user.elts = elements; draw->pt.user.eltSize = eltSize; @@ -367,7 +401,7 @@ draw_set_mapped_element_buffer_range( struct draw_context *draw, void draw_set_mapped_element_buffer( struct draw_context *draw, unsigned eltSize, - void *elements ) + const void *elements ) { draw->pt.user.elts = elements; draw->pt.user.eltSize = eltSize;