From a7e997cfc5d909eebbc16ba5b0362e9778f01561 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 1 Oct 2007 06:25:23 -0400 Subject: Get rid of ST_NEW_SHADER flag and the dependency on _NEW_PROGRAM which is being hit all the time. Done by Keith really. --- src/mesa/state_tracker/st_atom_shader.c | 4 ++-- src/mesa/state_tracker/st_cb_program.c | 26 ++++++++++++++++---------- src/mesa/state_tracker/st_context.h | 1 - 3 files changed, 18 insertions(+), 13 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index dc6210cd6c..919461bcb8 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -306,8 +306,8 @@ update_linkage( struct st_context *st ) const struct st_tracked_state st_update_shader = { .name = "st_update_shader", .dirty = { - .mesa = _NEW_PROGRAM, - .st = ST_NEW_SHADER + .mesa = 0, + .st = ST_NEW_VERTEX_PROGRAM | ST_NEW_FRAGMENT_PROGRAM }, .update = update_linkage }; diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 8df8b263d3..1902c8d7d6 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -43,7 +43,6 @@ #include "st_program.h" #include "st_atom_shader.h" -#include "tnl/tnl.h" #include "pipe/tgsi/mesa/tgsi_mesa.h" @@ -57,7 +56,14 @@ static void st_bind_program( GLcontext *ctx, { struct st_context *st = st_context(ctx); - st->dirty.st |= ST_NEW_SHADER; + switch (target) { + case GL_VERTEX_PROGRAM_ARB: + st->dirty.st |= ST_NEW_VERTEX_PROGRAM; + break; + case GL_FRAGMENT_PROGRAM_ARB: + st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM; + break; + } } @@ -70,7 +76,8 @@ static void st_use_program( GLcontext *ctx, { struct st_context *st = st_context(ctx); - st->dirty.st |= ST_NEW_SHADER; + st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM; + st->dirty.st |= ST_NEW_VERTEX_PROGRAM; _mesa_use_program(ctx, program); } @@ -114,8 +121,6 @@ static struct gl_program *st_new_program( GLcontext *ctx, default: return _mesa_new_program(ctx, target, id); } - - st->dirty.st |= ST_NEW_SHADER; } @@ -175,6 +180,9 @@ static void st_program_string_notify( GLcontext *ctx, } stfp->param_state = stfp->Base.Base.Parameters->StateFlags; + + if (st->fp == stfp) + st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM; } else if (target == GL_VERTEX_PROGRAM_ARB) { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; @@ -189,12 +197,10 @@ static void st_program_string_notify( GLcontext *ctx, stvp->param_state = stvp->Base.Base.Parameters->StateFlags; - /* Also tell tnl about it: - */ - _tnl_program_string(ctx, target, prog); - } + if (st->vp == stvp) + st->dirty.st |= ST_NEW_VERTEX_PROGRAM; - st->dirty.st |= ST_NEW_SHADER; + } } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index da4fd0d4e4..b4ae041d36 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -45,7 +45,6 @@ struct cso_blend; #define ST_NEW_MESA 0x1 /* Mesa state has changed */ #define ST_NEW_FRAGMENT_PROGRAM 0x2 #define ST_NEW_VERTEX_PROGRAM 0x4 -#define ST_NEW_SHADER 0x8 struct st_state_flags { -- cgit v1.2.3