From: Brian Date: Sat, 18 Aug 2007 15:04:49 +0000 (+0100) Subject: added tnl state atom X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b3f067e8593b9fda0474041f32479b20cd64e728;p=mesa.git added tnl state atom --- diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 32b8b8f277b..d67291e50bb 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -46,6 +46,7 @@ static const struct st_tracked_state *atoms[] = &st_update_clear_color, &st_update_depth, &st_update_clip, + &st_update_tnl, &st_update_vs, &st_update_fs, &st_update_setup, diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index 2f628206cae..51da489f6db 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -48,6 +48,7 @@ const struct st_tracked_state st_update_framebuffer; const struct st_tracked_state st_update_clip; const struct st_tracked_state st_update_clear_color; const struct st_tracked_state st_update_depth; +const struct st_tracked_state st_update_tnl; const struct st_tracked_state st_update_fs; const struct st_tracked_state st_update_vs; const struct st_tracked_state st_update_setup; diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c index cef6e38d566..c8bd805e022 100644 --- a/src/mesa/state_tracker/st_atom_vs.c +++ b/src/mesa/state_tracker/st_atom_vs.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -27,9 +27,11 @@ /* * Authors: * Keith Whitwell + * Brian Paul */ #include "shader/prog_parameter.h" +#include "tnl/t_vp_build.h" #include "pipe/p_context.h" #include "pipe/tgsi/mesa/mesa_to_tgsi.h" @@ -39,6 +41,7 @@ #include "st_atom.h" #include "st_program.h" + #define TGSI_DEBUG 0 static void compile_vs( struct st_context *st, @@ -59,8 +62,10 @@ static void update_vs( struct st_context *st ) struct st_vertex_program *vp = NULL; struct gl_program_parameter_list *params = NULL; +#if 0 if (st->ctx->VertexProgram._MaintainTnlProgram) _tnl_UpdateFixedFunctionProgram( st->ctx ); +#endif if (st->ctx->Shader.CurrentProgram && st->ctx->Shader.CurrentProgram->LinkStatus && @@ -83,6 +88,7 @@ static void update_vs( struct st_context *st ) if (vp && params) { /* load program's constants array */ + /* XXX this should probably be done elsewhere/separately */ _mesa_load_state_parameters(st->ctx, params); vp->constants.nr_constants = params->NumParameters; @@ -117,3 +123,26 @@ const struct st_tracked_state st_update_vs = { }, .update = update_vs }; + + + + + +/** + * When TnL state has changed, need to generate new vertex program. + * This should be done before updating the vertes shader (vs) state. + */ +static void update_tnl( struct st_context *st ) +{ + if (st->ctx->VertexProgram._MaintainTnlProgram) + _tnl_UpdateFixedFunctionProgram( st->ctx ); +} + + +const struct st_tracked_state st_update_tnl = { + .dirty = { + .mesa = _NEW_PROGRAM | _NEW_LIGHT | _NEW_TEXTURE, /* XXX more? */ + .st = ST_NEW_MESA, /* XXX correct? */ + }, + .update = update_tnl +};