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>
This commit is contained in:
Brian Paul 2011-11-03 17:40:56 -06:00
parent 58ea42b7db
commit 022e270b1b
3 changed files with 12 additions and 0 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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,