summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2008-11-28 16:18:36 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2008-11-28 16:18:36 +0000
commit5b714723895d321db753f896576de5e2c27778c3 (patch)
tree9737208dbb6fc7ff63dfd899a3d36383da5ef5d3
parent823aac36d5580ea46f76ccec3fd31c91f168274e (diff)
parent158a5f75d8436facfe8163845a942979899213fe (diff)
Merge commit 'origin/gallium-0.1' into gallium-0.2
Conflicts: src/gallium/auxiliary/tgsi/tgsi_sse2.c
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c24
-rw-r--r--src/mesa/state_tracker/st_context.h2
2 files changed, 19 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 3d508227e..aa68aa9e3 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -219,11 +219,6 @@ combined_bitmap_fragment_program(GLcontext *ctx)
st_translate_fragment_program(st, stfp->bitmap_program, NULL);
}
- /* Ideally we'd have updated the pipe constants during the normal
- * st/atom mechanism. But we can't since this is specific to glBitmap.
- */
- st_upload_constants(st, stfp->Base.Base.Parameters, PIPE_SHADER_FRAGMENT);
-
return stfp->bitmap_program;
}
@@ -442,6 +437,22 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
stfp = combined_bitmap_fragment_program(ctx);
+ /* As an optimization, Mesa's fragment programs will sometimes get the
+ * primary color from a statevar/constant rather than a varying variable.
+ * when that's the case, we need to ensure that we use the 'color'
+ * parameter and not the current attribute color (which may have changed
+ * through glRasterPos and state validation.
+ * So, we force the proper color here. Not elegant, but it works.
+ */
+ {
+ GLfloat colorSave[4];
+ COPY_4V(colorSave, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color);
+ st_upload_constants(st, stfp->Base.Base.Parameters, PIPE_SHADER_FRAGMENT);
+ COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], colorSave);
+ }
+
+
/* limit checks */
/* XXX if the bitmap is larger than the max texture size, break
* it up into chunks.
@@ -476,7 +487,8 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
samplers[i] = &st->state.samplers[i];
}
samplers[stfp->bitmap_sampler] = &st->bitmap.sampler;
- cso_set_samplers(cso, num, (const struct pipe_sampler_state **) samplers); }
+ cso_set_samplers(cso, num, (const struct pipe_sampler_state **) samplers);
+ }
/* user textures, plus the bitmap texture */
{
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 1d1aca311..5bcb87ce2 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -102,7 +102,7 @@ struct st_context
} state;
struct {
- struct st_tracked_state tracked_state[2];
+ struct st_tracked_state tracked_state[PIPE_SHADER_TYPES];
} constants;
/* XXX unused: */