[Mesa-dev] [PATCH 2/3] st/mesa: move fragment shader tgsi tokens into st_fp_variant
Marek Olšák
maraeo at gmail.com
Mon Jan 23 04:32:28 PST 2012
The TGSI code may vary depending on the clamp_color bit.
---
src/mesa/state_tracker/st_cb_program.c | 10 ----------
src/mesa/state_tracker/st_debug.c | 2 +-
src/mesa/state_tracker/st_program.c | 9 +++++----
src/mesa/state_tracker/st_program.h | 4 ++--
4 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 2abb4d8..617e7ce 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -160,11 +160,6 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
if (stfp->glsl_to_tgsi)
free_glsl_to_tgsi_visitor(stfp->glsl_to_tgsi);
-
- if (stfp->tgsi.tokens) {
- st_free_tokens(stfp->tgsi.tokens);
- stfp->tgsi.tokens = NULL;
- }
}
break;
default:
@@ -205,11 +200,6 @@ st_program_string_notify( struct gl_context *ctx,
st_release_fp_variants(st, stfp);
- if (stfp->tgsi.tokens) {
- st_free_tokens(stfp->tgsi.tokens);
- stfp->tgsi.tokens = NULL;
- }
-
if (st->fp == stfp)
st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
}
diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
index e1e373d..850fab9 100644
--- a/src/mesa/state_tracker/st_debug.c
+++ b/src/mesa/state_tracker/st_debug.c
@@ -94,7 +94,7 @@ st_print_current(void)
if (st->vp->Base.Base.Parameters)
_mesa_print_parameter_list(st->vp->Base.Base.Parameters);
- tgsi_dump( st->fp->tgsi.tokens, 0 );
+ tgsi_dump( st->fp->variants[0].tgsi.tokens, 0 );
if (st->fp->Base.Base.Parameters)
_mesa_print_parameter_list(st->fp->Base.Base.Parameters);
}
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3ae79dd..978de88 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -110,7 +110,8 @@ delete_fp_variant(struct st_context *st, struct st_fp_variant *fpv)
cso_delete_fragment_shader(st->cso_context, fpv->driver_shader);
if (fpv->parameters)
_mesa_free_parameter_list(fpv->parameters);
-
+ if (fpv->tgsi.tokens)
+ st_free_tokens(fpv->tgsi.tokens);
FREE(fpv);
}
@@ -741,16 +742,16 @@ st_translate_fragment_program(struct st_context *st,
fs_output_semantic_index, FALSE,
key->clamp_color);
- stfp->tgsi.tokens = ureg_get_tokens( ureg, NULL );
+ variant->tgsi.tokens = ureg_get_tokens( ureg, NULL );
ureg_destroy( ureg );
}
/* fill in variant */
- variant->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi);
+ variant->driver_shader = pipe->create_fs_state(pipe, &variant->tgsi);
variant->key = *key;
if (ST_DEBUG & DEBUG_TGSI) {
- tgsi_dump( stfp->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ );
+ tgsi_dump( variant->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ );
debug_printf("\n");
}
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 0ae3420..6c4b4f6 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -69,6 +69,8 @@ struct st_fp_variant
/** Parameters which generated this version of fragment program */
struct st_fp_variant_key key;
+ struct pipe_shader_state tgsi;
+
/** Driver's compiled shader */
void *driver_shader;
@@ -89,8 +91,6 @@ struct st_fragment_program
struct gl_fragment_program Base;
struct glsl_to_tgsi_visitor* glsl_to_tgsi;
- struct pipe_shader_state tgsi;
-
struct st_fp_variant *variants;
};
--
1.7.5.4
More information about the mesa-dev
mailing list