aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r--src/mesa/main/get.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 516e8d174ce..218801791e2 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1390,7 +1390,6 @@ static const struct value_desc *
find_value(const char *func, GLenum pname, void **p, union value *v)
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *unit;
int mask, hash;
const struct value_desc *d;
int api;
@@ -1445,8 +1444,10 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
*p = ((char *) ctx->Array.VAO + d->offset);
return d;
case LOC_TEXUNIT:
- unit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- *p = ((char *) unit + d->offset);
+ if (ctx->Texture.CurrentUnit < ARRAY_SIZE(ctx->Texture.FixedFuncUnit)) {
+ unsigned index = ctx->Texture.CurrentUnit;
+ *p = ((char *)&ctx->Texture.FixedFuncUnit[index] + d->offset);
+ }
return d;
case LOC_CUSTOM:
find_custom_value(ctx, d, v);