nir: support lowering clipdist to arrays
[mesa.git] / src / mesa / main / texstate.h
index cf3f7e5a216feaddf4fd7a69b1cb471b71b0a555..f2e55f1a4af3fcf5742fe08caebf8f44cf1d8ac5 100644 (file)
@@ -61,9 +61,10 @@ _mesa_get_current_tex_unit(struct gl_context *ctx)
  * \return NULL if the current unit is not a fixed-func texture unit
  */
 static inline struct gl_fixedfunc_texture_unit *
-_mesa_get_current_fixedfunc_tex_unit(struct gl_context *ctx)
+_mesa_get_fixedfunc_tex_unit(struct gl_context *ctx, GLuint unit)
 {
-   unsigned unit = ctx->Texture.CurrentUnit;
+   if (unit >= ARRAY_SIZE(ctx->Texture.FixedFuncUnit))
+      return NULL;
 
    return &ctx->Texture.FixedFuncUnit[unit];
 }