diff options
author | Marek Olšák <[email protected]> | 2017-11-15 22:10:43 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-02-13 01:00:45 +0100 |
commit | 78043a75f6c05c470da97d1f18615821d69177c0 (patch) | |
tree | 041ebf7ab6e8faf5c406913f22fd51533018c8a5 /src/mesa/main/enable.c | |
parent | 07c10cc59c164ddd0109e061dac8edf47437d8ca (diff) |
mesa: decrease the array size of ctx->Texture.FixedFuncUnit to 8
GL allows doing glTexEnv on 192 texture units, while in reality,
only MaxTextureCoordUnits units are used by fixed-func shaders.
There is a piglit patch that adjusts piglits/texunits to check only
MaxTextureCoordUnits units.
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r-- | src/mesa/main/enable.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 4c5f9dce5e4..f23673a6cdc 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -209,6 +209,8 @@ enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit) { struct gl_fixedfunc_texture_unit *texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + if (!texUnit) + return GL_FALSE; const GLbitfield newenabled = state ? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit); @@ -1293,6 +1295,9 @@ is_texture_enabled(struct gl_context *ctx, GLbitfield bit) const struct gl_fixedfunc_texture_unit *const texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + if (!texUnit) + return GL_FALSE; + return (texUnit->Enabled & bit) ? GL_TRUE : GL_FALSE; } |