}
+/**
+ * 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.
if (target == GL_TEXTURE_1D) {
/* non-proxy target */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
const GLuint face = _mesa_tex_target_to_face(target);
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
(ctx->Extensions.MESA_texture_array &&
target == GL_TEXTURE_1D_ARRAY_EXT)) {
/* non-proxy target */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
const GLuint face = _mesa_tex_target_to_face(target);
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
(ctx->Extensions.MESA_texture_array &&
target == GL_TEXTURE_2D_ARRAY_EXT)) {
/* non-proxy target */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
const GLuint face = _mesa_tex_target_to_face(target);
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
const GLvoid *pixels )
{
GLsizei postConvWidth = width;
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage = NULL;
GET_CURRENT_CONTEXT(ctx);
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
assert(texObj);
_mesa_lock_texture(ctx, texObj);
const GLvoid *pixels )
{
GLsizei postConvWidth = width, postConvHeight = height;
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
return; /* error was detected */
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
GLenum format, GLenum type,
const GLvoid *pixels )
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
return; /* error was detected */
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
GLint x, GLint y,
GLsizei width, GLint border )
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width;
postConvWidth, 1, border))
return;
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border )
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width, postConvHeight = height;
postConvWidth, postConvHeight, border))
return;
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
_mesa_CopyTexSubImage1D( GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width )
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width;
if (copytexsubimage_error_check1(ctx, 1, target, level))
return;
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width, postConvHeight = height;
if (copytexsubimage_error_check1(ctx, 2, target, level))
return;
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width, postConvHeight = height;
if (copytexsubimage_error_check1(ctx, 3, target, level))
return;
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
if (target == GL_TEXTURE_1D) {
/* non-proxy target */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLenum error = compressed_texture_error_check(ctx, 1, target, level,
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
}
else {
/* store the teximage parameters */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
/* non-proxy target */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
+
GLenum error = compressed_texture_error_check(ctx, 2, target, level,
internalFormat, width, height, 1, border, imageSize);
if (error) {
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
}
else {
/* store the teximage parameters */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
if (target == GL_TEXTURE_3D) {
/* non-proxy target */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLenum error = compressed_texture_error_check(ctx, 3, target, level,
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
+
_mesa_lock_texture(ctx, texObj);
{
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
}
else {
/* store the teximage parameters */
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+
+ texObj = get_current_tex_object(ctx, target);
+
_mesa_lock_texture(ctx, texObj);
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
GLsizei width, GLenum format,
GLsizei imageSize, const GLvoid *data)
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLenum error;
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
GLenum format, GLsizei imageSize,
const GLvoid *data)
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLenum error;
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{
GLsizei height, GLsizei depth, GLenum format,
GLsizei imageSize, const GLvoid *data)
{
- struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLenum error;
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texObj = get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
{