summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_pixeltransfer.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-30 16:13:37 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-30 16:13:37 -0600
commitd6a739f6b0658414a81715bf690159f7cfdb4961 (patch)
tree018a879a8a638972bf660d660a1762bd7f885bfb /src/mesa/state_tracker/st_atom_pixeltransfer.c
parentee70c02b62f7692de6293045928c47168652bd1c (diff)
Use program serial numbers to avoid re-generating fragment programs for glDrawPixels.
Diffstat (limited to 'src/mesa/state_tracker/st_atom_pixeltransfer.c')
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index b190c39343..8cf340e685 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -42,6 +42,7 @@
#include "shader/prog_print.h"
#include "st_context.h"
+#include "st_program.h"
@@ -79,8 +80,6 @@ is_identity(const GLfloat m[16])
static void
make_state_key(GLcontext *ctx, struct state_key *key)
{
- /*GLuint i, j;*/
-
memset(key, 0, sizeof(*key));
if (ctx->Pixel.RedBias != 0.0 || ctx->Pixel.RedScale != 1.0 ||
@@ -189,6 +188,8 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
inst[ic].SrcReg[0].Index = FRAG_RESULT_COLR;
ic++;
+ /* XXX reimplement in terms of MUL/MAD (see t_vp_build.c) */
+
/* DP4 result.color.x, tmp0, matrow0; */
_mesa_init_instructions(inst + ic, 1);
inst[ic].Opcode = OPCODE_DP4;
@@ -268,6 +269,9 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
+/**
+ * Update st->pixel_xfer.program in response to new pixel-transfer state.
+ */
static void
update_pixel_transfer(struct st_context *st)
{
@@ -277,14 +281,14 @@ update_pixel_transfer(struct st_context *st)
make_state_key(st->ctx, &key);
fp = (struct gl_fragment_program *)
- _mesa_search_program_cache(st->pixel_transfer_cache, &key, sizeof(key));
+ _mesa_search_program_cache(st->pixel_xfer.cache, &key, sizeof(key));
if (!fp) {
fp = get_pixel_transfer_program(st->ctx, &key);
- _mesa_program_cache_insert(st->ctx, st->pixel_transfer_cache,
+ _mesa_program_cache_insert(st->ctx, st->pixel_xfer.cache,
&key, sizeof(key), &fp->Base);
}
- st->pixel_transfer_program = fp;
+ st->pixel_xfer.program = (struct st_fragment_program *) fp;
}