mesa, i965: prepare for more than 8 texture targets
authorChia-I Wu <olv@lunarg.com>
Sun, 23 Oct 2011 10:29:17 +0000 (18:29 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Thu, 3 Nov 2011 07:09:44 +0000 (15:09 +0800)
3-bit fields are used store texture target in several places.  That will fail
when TEXTURE_EXTERNAL_INDEX, which happends to be the 9th texture target, is
added.  Make them 4-bit fields.

Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Jakob Bornecrantz <jakob@vmware.com>
src/mesa/drivers/dri/i965/brw_wm.h
src/mesa/main/ff_fragment_shader.cpp
src/mesa/program/prog_instruction.h
src/mesa/program/program.c

index 76cf4533b56de11ea59d1613c9a64683b3d11490..056934a274b4937e7f4cd723d4821b9017ed9be7 100644 (file)
@@ -156,7 +156,7 @@ struct brw_wm_instruction {
    GLuint saturate:1;
    GLuint writemask:4;
    GLuint tex_unit:4;   /* texture unit for TEX, TXD, TXP instructions */
-   GLuint tex_idx:3;    /* TEXTURE_1D,2D,3D,CUBE,RECT_INDEX source target */
+   GLuint tex_idx:4;    /* TEXTURE_1D,2D,3D,CUBE,RECT_INDEX source target */
    GLuint tex_shadow:1; /* do shadow comparison? */
    GLuint eot:1;       /* End of thread indicator for FB_WRITE*/
    GLuint target:10;    /* target binding table index for FB_WRITE*/
index b5500714b57ddf3cab7b249858287d362182eca6..f612325192de9a1a6fcdae553cc58f7f0e58f00f 100644 (file)
@@ -108,7 +108,7 @@ struct state_key {
    /* NOTE: This array of structs must be last! (see "keySize" below) */
    struct {
       GLuint enabled:1;
-      GLuint source_index:3;   /**< TEXTURE_x_INDEX */
+      GLuint source_index:4;   /**< TEXTURE_x_INDEX */
       GLuint shadow:1;
       GLuint ScaleShiftRGB:2;
       GLuint ScaleShiftA:2;
index db2b594e75322430f1c4eae92af387cc57598db0..09659ce9c7cacd8a18f6e43dca1eb508d023483f 100644 (file)
@@ -392,7 +392,7 @@ struct prog_instruction
    GLuint TexSrcUnit:5;
 
    /** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */
-   GLuint TexSrcTarget:3;
+   GLuint TexSrcTarget:4;
 
    /** True if tex instruction should do shadow comparison */
    GLuint TexShadow:1;
index 7366525294aa75ef39a6583e42d370a69743f666..582cbccf8fa758c2d82100cf819c20e3da9047aa 100644 (file)
@@ -78,7 +78,7 @@ _mesa_init_program(struct gl_context *ctx)
    ASSERT(MAX_TEXTURE_UNITS <= (1 << 5));
 
    /* If this fails, increase prog_instruction::TexSrcTarget size */
-   ASSERT(NUM_TEXTURE_TARGETS <= (1 << 3));
+   ASSERT(NUM_TEXTURE_TARGETS <= (1 << 4));
 
    ctx->Program.ErrorPos = -1;
    ctx->Program.ErrorString = _mesa_strdup("");