Mesa (master): mesa/st: support l8 as well as i8 in bitmap code
Keith Whitwell
keithw at kemper.freedesktop.org
Tue Feb 24 12:15:25 UTC 2009
Module: Mesa
Branch: master
Commit: 93d101f0c3b2b7b6909d6f98a0d04b978b4ae29a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=93d101f0c3b2b7b6909d6f98a0d04b978b4ae29a
Author: Keith Whitwell <keithw at vmware.com>
Date: Tue Feb 24 11:58:58 2009 +0000
mesa/st: support l8 as well as i8 in bitmap code
Also don't send the partial program fragment down to hardware -- the
program will never be used in that form.
---
src/mesa/state_tracker/st_cb_bitmap.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 66d7cbf..f55a5e7 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -142,6 +142,10 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex)
/* KIL if -tmp0 < 0 # texel=0 -> keep / texel=0 -> discard */
p->Instructions[ic].Opcode = OPCODE_KIL;
p->Instructions[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
+
+ if (ctx->st->bitmap.tex_format == PIPE_FORMAT_L8_UNORM)
+ p->Instructions[ic].SrcReg[0].Swizzle = SWIZZLE_XXXX;
+
p->Instructions[ic].SrcReg[0].Index = 0;
p->Instructions[ic].SrcReg[0].NegateBase = NEGATE_XYZW;
ic++;
@@ -157,7 +161,11 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex)
stfp = (struct st_fragment_program *) p;
stfp->Base.UsesKill = GL_TRUE;
- st_translate_fragment_program(ctx->st, stfp, NULL);
+
+ /* No need to send this incomplete program down to hardware:
+ *
+ * st_translate_fragment_program(ctx->st, stfp, NULL);
+ */
return stfp;
}
@@ -786,6 +794,10 @@ st_init_bitmap(struct st_context *st)
PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
}
+ else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+ st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
+ }
else {
/* XXX support more formats */
assert(0);
More information about the mesa-commit
mailing list