summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2011-11-03 17:40:56 -0600
committerBrian Paul <brianp@vmware.com>2011-11-03 17:41:08 -0600
commit022e270b1b972b6d04890f1ac1fc2a4a4ed03ff7 (patch)
tree7058c683f199c4179e7ffe8d58b50f2cbc35b428 /src/gallium/drivers/svga
parent58ea42b7db72586563914dea6fed9656caaf7678 (diff)
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 <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_context.h3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_fs.c5
-rw-r--r--src/gallium/drivers/svga/svga_swtnl_state.c4
3 files changed, 12 insertions, 0 deletions
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,