diff options
-rw-r--r-- | src/mesa/main/teximage.c | 61 | ||||
-rw-r--r-- | src/mesa/main/teximage.h | 3 |
2 files changed, 33 insertions, 31 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 69ef2cca5e..b10076875b 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -583,6 +583,17 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, /** + * Return pointer to texture object for given target on current texture unit. + */ +struct gl_texture_object * +_mesa_get_current_tex_object(GLcontext *ctx, GLenum target) +{ + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); + return _mesa_select_tex_object(ctx, texUnit, target); +} + + +/** * Get a texture image pointer from a texture object, given a texture * target and mipmap level. The target and level parameters should * have already been error-checked. @@ -964,18 +975,6 @@ _mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage) /** - * Return pointer to texture object for given target on current texture unit. - */ -static struct gl_texture_object * -get_current_tex_object(GLcontext *ctx, GLenum target) -{ - struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); - return _mesa_select_tex_object(ctx, texUnit, target); -} - - - -/** * This is the fallback for Driver.TestProxyTexImage(). Test the texture * level, width, height and depth against the ctx->Const limits for textures. * @@ -2128,7 +2127,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2249,7 +2248,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2365,7 +2364,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2457,7 +2456,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, { GLsizei postConvWidth = width; struct gl_texture_object *texObj; - struct gl_texture_image *texImage = NULL; + struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -2483,7 +2482,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); assert(texObj); _mesa_lock_texture(ctx, texObj); @@ -2549,7 +2548,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level, return; /* error was detected */ } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2607,7 +2606,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level, return; /* error was detected */ } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2674,7 +2673,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, postConvWidth, 1, border)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2753,7 +2752,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, postConvWidth, postConvHeight, border)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2825,7 +2824,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 1, target, level)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2885,7 +2884,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 2, target, level)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2948,7 +2947,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 3, target, level)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3282,7 +3281,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, return; } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3344,7 +3343,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3392,7 +3391,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, return; } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3456,7 +3455,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3500,7 +3499,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, return; } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3564,7 +3563,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3606,7 +3605,7 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, return; } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 094177da79..97c9018319 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -86,6 +86,9 @@ extern struct gl_texture_object * _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target); +extern struct gl_texture_object * +_mesa_get_current_tex_object(GLcontext *ctx, GLenum target); + extern struct gl_texture_image * _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj, |