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/texenv.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/texenv.c')
-rw-r--r-- | src/mesa/main/texenv.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 9018ce9bc4c..22fc8da1cab 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -400,6 +400,15 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) struct gl_fixedfunc_texture_unit *texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + /* The GL spec says that we should report an error if the unit is greater + * than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only + * fixed-function units are usable. This is probably a spec bug. + * Ignore glTexEnv(GL_TEXTURE_ENV) calls for non-fixed-func units, + * because we don't want to process calls that have no effect. + */ + if (!texUnit) + return; + switch (pname) { case GL_TEXTURE_ENV_MODE: set_env_mode(ctx, texUnit, (GLenum) iparam0); @@ -649,6 +658,15 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) struct gl_fixedfunc_texture_unit *texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + /* The GL spec says that we should report an error if the unit is greater + * than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only + * fixed-function units are usable. This is probably a spec bug. + * Ignore calls for non-fixed-func units, because we don't process + * glTexEnv for them either. + */ + if (!texUnit) + return; + if (pname == GL_TEXTURE_ENV_COLOR) { if(ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP)) _mesa_update_state(ctx); @@ -717,6 +735,15 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) struct gl_fixedfunc_texture_unit *texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + /* The GL spec says that we should report an error if the unit is greater + * than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only + * fixed-function units are usable. This is probably a spec bug. + * Ignore calls for non-fixed-func units, because we don't process + * glTexEnv for them either. + */ + if (!texUnit) + return; + if (pname == GL_TEXTURE_ENV_COLOR) { params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] ); params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] ); |