From: Brian Paul Date: Thu, 3 Nov 2011 23:40:56 +0000 (-0600) Subject: svga: pass fragment shader to draw module X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=022e270b1b972b6d04890f1ac1fc2a4a4ed03ff7;p=mesa.git svga: pass fragment shader to draw module If we use the draw-module for wide point/line/etc drawing we'll need a fragment shader too (like we pass in the vertex shader). This fixes sprite point rendering when forcing the swtnl path. Reviewed-by: José Fonseca --- diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 86e5f23ffa3..8a6a717d438 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -45,6 +45,7 @@ #define SVGA_MAX_POINTSIZE 80.0 struct draw_vertex_shader; +struct draw_fragment_shader; struct svga_shader_result; struct SVGACmdMemory; struct util_bitmask; @@ -68,6 +69,8 @@ struct svga_fragment_shader { struct svga_shader base; + struct draw_fragment_shader *draw_shader; + /** Mask of which generic varying variables are read by this shader */ unsigned generic_inputs; /** Table mapping original TGSI generic indexes to low integers */ diff --git a/src/gallium/drivers/svga/svga_pipe_fs.c b/src/gallium/drivers/svga/svga_pipe_fs.c index 1eb28617b6a..9aac546581e 100644 --- a/src/gallium/drivers/svga/svga_pipe_fs.c +++ b/src/gallium/drivers/svga/svga_pipe_fs.c @@ -28,6 +28,7 @@ #include "util/u_memory.h" #include "util/u_bitmask.h" #include "tgsi/tgsi_parse.h" +#include "draw/draw_context.h" #include "svga_context.h" #include "svga_tgsi.h" @@ -63,6 +64,8 @@ svga_create_fs_state(struct pipe_context *pipe, svga_remap_generics(fs->generic_inputs, fs->generic_remap_table); + fs->draw_shader = draw_create_fragment_shader(svga->swtnl.draw, templ); + if (SVGA_DEBUG & DEBUG_TGSI || 0) { debug_printf("%s id: %u, inputs: %u, outputs: %u\n", __FUNCTION__, fs->base.id, @@ -92,6 +95,8 @@ void svga_delete_fs_state(struct pipe_context *pipe, void *shader) svga_hwtnl_flush_retry( svga ); + draw_delete_fragment_shader(svga->swtnl.draw, fs->draw_shader); + for (result = fs->base.results; result; result = tmp ) { tmp = result->next; diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c index ade5ab9f999..d7fa1aaa0dc 100644 --- a/src/gallium/drivers/svga/svga_swtnl_state.c +++ b/src/gallium/drivers/svga/svga_swtnl_state.c @@ -93,6 +93,10 @@ update_swtnl_draw( struct svga_context *svga, draw_bind_vertex_shader(svga->swtnl.draw, svga->curr.vs->draw_shader); + if (dirty & SVGA_NEW_FS) + draw_bind_fragment_shader(svga->swtnl.draw, + svga->curr.fs->draw_shader); + if (dirty & SVGA_NEW_VBUFFER) draw_set_vertex_buffers(svga->swtnl.draw, svga->curr.num_vertex_buffers,