added tnl state atom

This commit is contained in:
Brian 2007-08-18 16:04:49 +01:00
parent 7274e14d4a
commit b3f067e859
3 changed files with 32 additions and 1 deletions

View File

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

View File

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

View File

@ -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 <keith@tungstengraphics.com>
* 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
};