diff options
author | Brian Paul <[email protected]> | 2009-01-02 16:32:26 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-01-02 16:32:26 -0700 |
commit | 0815ebccfc0a12d8f3e831928f1c4210b7f75ad8 (patch) | |
tree | 1e7db7e1d44e741215e5b4b11d33df91fe5b39a0 /src/mesa/main/texenvprogram.c | |
parent | eb9bbc5265562cb6f93688fc027ea76f91601e37 (diff) | |
parent | 1fad6ccb756ae33ca3115f59c99ca8abbeb0321e (diff) |
Merge commit 'origin/master' into gallium-0.2
Conflicts:
src/mesa/main/ffvertex_prog.c
src/mesa/main/texenvprogram.c
Diffstat (limited to 'src/mesa/main/texenvprogram.c')
-rw-r--r-- | src/mesa/main/texenvprogram.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index bd33cb4e055..48abf51d890 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -38,6 +38,21 @@ #include "texenvprogram.h" +/* + * Note on texture units: + * + * The number of texture units supported by fixed-function fragment + * processing is MAX_TEXTURE_COORD_UNITS, not MAX_TEXTURE_IMAGE_UNITS. + * That's because there's a one-to-one correspondence between texture + * coordinates and samplers in fixed-function processing. + * + * Since fixed-function vertex processing is limited to MAX_TEXTURE_COORD_UNITS + * sets of texcoords, so is fixed-function fragment processing. + * + * We can safely use ctx->Const.MaxTextureUnits for loop bounds. + */ + + struct texenvprog_cache_item { GLuint hash; @@ -50,7 +65,7 @@ struct texenvprog_cache_item /** * Up to nine instructions per tex unit, plus fog, specular color. */ -#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 9) + 12) +#define MAX_INSTRUCTIONS ((MAX_TEXTURE_COORD_UNITS * 9) + 12) #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) @@ -313,7 +328,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) memset(key, 0, sizeof(*key)); - for (i=0;i<MAX_TEXTURE_UNITS;i++) { + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; GLenum format; @@ -416,7 +431,7 @@ struct texenv_fragment_program { GLbitfield temp_in_use; /**< Tracks temporary regs which are in use. */ GLboolean error; - struct ureg src_texture[MAX_TEXTURE_UNITS]; + struct ureg src_texture[MAX_TEXTURE_COORD_UNITS]; /* Reg containing each texture unit's sampled texture color, * else undef. */ @@ -1201,7 +1216,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, p.program->Base.InputsRead = 0; p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLR; - for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) p.src_texture[unit] = undef; p.src_previous = undef; |