X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexstate.h;h=52fe60275c23095d273c9aeb2d9a4659062fe1d9;hb=4807a83da0e0f5e3272e85504ee3b2213ef1910a;hp=018bc5f3fdb175f65f6539d0a2906baed911bf62;hpb=dd404bc94f78a1766527becee03f8ef6ae3a799b;p=mesa.git diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index 018bc5f3fdb..52fe60275c2 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -5,7 +5,6 @@ /* * Mesa 3-D graphics library - * Version: 7.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -22,9 +21,10 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ @@ -33,9 +33,18 @@ #include "compiler.h" +#include "enums.h" +#include "macros.h" #include "mtypes.h" +static inline struct gl_texture_unit * +_mesa_get_tex_unit(struct gl_context *ctx, GLuint unit) +{ + assert(unit < ARRAY_SIZE(ctx->Texture.Unit)); + return &(ctx->Texture.Unit[unit]); +} + /** * Return pointer to current texture unit. * This the texture unit set by glActiveTexture(), not glClientActiveTexture(). @@ -43,8 +52,15 @@ static inline struct gl_texture_unit * _mesa_get_current_tex_unit(struct gl_context *ctx) { - ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->Texture.Unit)); - return &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]); + return _mesa_get_tex_unit(ctx, ctx->Texture.CurrentUnit); +} + +static inline GLuint +_mesa_max_tex_unit(struct gl_context *ctx) +{ + /* See OpenGL spec for glActiveTexture: */ + return MAX2(ctx->Const.MaxCombinedTextureImageUnits, + ctx->Const.MaxTextureCoordUnits); }