mesa: remove some gotos
This will make some subsequent changes easier...
This commit is contained in:
@@ -2161,36 +2161,34 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
|
|||||||
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
|
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
|
||||||
if (!texImage) {
|
if (!texImage) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (texImage->Data) {
|
||||||
|
ctx->Driver.FreeTexImageData( ctx, texImage );
|
||||||
|
}
|
||||||
|
|
||||||
if (texImage->Data) {
|
ASSERT(texImage->Data == NULL);
|
||||||
ctx->Driver.FreeTexImageData( ctx, texImage );
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(texImage->Data == NULL);
|
clear_teximage_fields(texImage); /* not really needed, but helpful */
|
||||||
|
_mesa_init_teximage_fields(ctx, target, texImage,
|
||||||
|
postConvWidth, 1, 1,
|
||||||
|
border, internalFormat);
|
||||||
|
|
||||||
clear_teximage_fields(texImage); /* not really needed, but helpful */
|
/* Give the texture to the driver. <pixels> may be null. */
|
||||||
_mesa_init_teximage_fields(ctx, target, texImage,
|
ASSERT(ctx->Driver.TexImage1D);
|
||||||
postConvWidth, 1, 1,
|
ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
|
||||||
border, internalFormat);
|
width, border, format, type, pixels,
|
||||||
|
&ctx->Unpack, texObj, texImage);
|
||||||
|
|
||||||
ASSERT(ctx->Driver.TexImage1D);
|
ASSERT(texImage->TexFormat);
|
||||||
|
|
||||||
/* Give the texture to the driver! <pixels> may be null! */
|
update_fbo_texture(ctx, texObj, face, level);
|
||||||
(*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat,
|
|
||||||
width, border, format, type, pixels,
|
|
||||||
&ctx->Unpack, texObj, texImage);
|
|
||||||
|
|
||||||
ASSERT(texImage->TexFormat);
|
/* state update */
|
||||||
|
texObj->_Complete = GL_FALSE;
|
||||||
update_fbo_texture(ctx, texObj, face, level);
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
|
}
|
||||||
/* state update */
|
|
||||||
texObj->_Complete = GL_FALSE;
|
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
_mesa_unlock_texture(ctx, texObj);
|
_mesa_unlock_texture(ctx, texObj);
|
||||||
}
|
}
|
||||||
else if (target == GL_PROXY_TEXTURE_1D) {
|
else if (target == GL_PROXY_TEXTURE_1D) {
|
||||||
@@ -2269,35 +2267,33 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
|
|||||||
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
|
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
|
||||||
if (!texImage) {
|
if (!texImage) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (texImage->Data) {
|
||||||
|
ctx->Driver.FreeTexImageData( ctx, texImage );
|
||||||
|
}
|
||||||
|
|
||||||
if (texImage->Data) {
|
ASSERT(texImage->Data == NULL);
|
||||||
ctx->Driver.FreeTexImageData( ctx, texImage );
|
clear_teximage_fields(texImage); /* not really needed, but helpful */
|
||||||
}
|
_mesa_init_teximage_fields(ctx, target, texImage,
|
||||||
|
postConvWidth, postConvHeight, 1,
|
||||||
|
border, internalFormat);
|
||||||
|
|
||||||
ASSERT(texImage->Data == NULL);
|
/* Give the texture to the driver. <pixels> may be null. */
|
||||||
clear_teximage_fields(texImage); /* not really needed, but helpful */
|
ASSERT(ctx->Driver.TexImage2D);
|
||||||
_mesa_init_teximage_fields(ctx, target, texImage,
|
ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
|
||||||
postConvWidth, postConvHeight, 1,
|
width, height, border, format, type,
|
||||||
border, internalFormat);
|
pixels, &ctx->Unpack, texObj, texImage);
|
||||||
|
|
||||||
ASSERT(ctx->Driver.TexImage2D);
|
ASSERT(texImage->TexFormat);
|
||||||
|
|
||||||
/* Give the texture to the driver! <pixels> may be null! */
|
update_fbo_texture(ctx, texObj, face, level);
|
||||||
(*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat,
|
|
||||||
width, height, border, format, type, pixels,
|
|
||||||
&ctx->Unpack, texObj, texImage);
|
|
||||||
|
|
||||||
ASSERT(texImage->TexFormat);
|
/* state update */
|
||||||
|
texObj->_Complete = GL_FALSE;
|
||||||
update_fbo_texture(ctx, texObj, face, level);
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
|
}
|
||||||
/* state update */
|
|
||||||
texObj->_Complete = GL_FALSE;
|
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
_mesa_unlock_texture(ctx, texObj);
|
_mesa_unlock_texture(ctx, texObj);
|
||||||
}
|
}
|
||||||
else if (target == GL_PROXY_TEXTURE_2D ||
|
else if (target == GL_PROXY_TEXTURE_2D ||
|
||||||
@@ -2372,35 +2368,33 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
|
|||||||
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
|
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
|
||||||
if (!texImage) {
|
if (!texImage) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (texImage->Data) {
|
||||||
|
ctx->Driver.FreeTexImageData( ctx, texImage );
|
||||||
|
}
|
||||||
|
|
||||||
if (texImage->Data) {
|
ASSERT(texImage->Data == NULL);
|
||||||
ctx->Driver.FreeTexImageData( ctx, texImage );
|
clear_teximage_fields(texImage); /* not really needed, but helpful */
|
||||||
}
|
_mesa_init_teximage_fields(ctx, target, texImage,
|
||||||
|
width, height, depth,
|
||||||
|
border, internalFormat);
|
||||||
|
|
||||||
ASSERT(texImage->Data == NULL);
|
/* Give the texture to the driver. <pixels> may be null. */
|
||||||
clear_teximage_fields(texImage); /* not really needed, but helpful */
|
ASSERT(ctx->Driver.TexImage3D);
|
||||||
_mesa_init_teximage_fields(ctx, target, texImage,
|
ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
|
||||||
width, height, depth,
|
width, height, depth, border, format, type,
|
||||||
border, internalFormat);
|
pixels, &ctx->Unpack, texObj, texImage);
|
||||||
|
|
||||||
ASSERT(ctx->Driver.TexImage3D);
|
ASSERT(texImage->TexFormat);
|
||||||
|
|
||||||
/* Give the texture to the driver! <pixels> may be null! */
|
update_fbo_texture(ctx, texObj, face, level);
|
||||||
(*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat,
|
|
||||||
width, height, depth, border, format, type,
|
|
||||||
pixels, &ctx->Unpack, texObj, texImage);
|
|
||||||
|
|
||||||
ASSERT(texImage->TexFormat);
|
/* state update */
|
||||||
|
texObj->_Complete = GL_FALSE;
|
||||||
update_fbo_texture(ctx, texObj, face, level);
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
|
}
|
||||||
/* state update */
|
|
||||||
texObj->_Complete = GL_FALSE;
|
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
_mesa_unlock_texture(ctx, texObj);
|
_mesa_unlock_texture(ctx, texObj);
|
||||||
}
|
}
|
||||||
else if (target == GL_PROXY_TEXTURE_3D ||
|
else if (target == GL_PROXY_TEXTURE_3D ||
|
||||||
@@ -2484,17 +2478,16 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
|
|||||||
goto out; /* error was detected */
|
goto out; /* error was detected */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width == 0)
|
if (width > 0) {
|
||||||
goto out; /* no-op, not an error */
|
/* If we have a border, xoffset=-1 is legal. Bias by border width */
|
||||||
|
xoffset += texImage->Border;
|
||||||
|
|
||||||
/* If we have a border, xoffset=-1 is legal. Bias by border width */
|
ASSERT(ctx->Driver.TexSubImage1D);
|
||||||
xoffset += texImage->Border;
|
ctx->Driver.TexSubImage1D(ctx, target, level, xoffset, width,
|
||||||
|
format, type, pixels, &ctx->Unpack,
|
||||||
ASSERT(ctx->Driver.TexSubImage1D);
|
texObj, texImage);
|
||||||
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
format, type, pixels, &ctx->Unpack,
|
}
|
||||||
texObj, texImage);
|
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
_mesa_unlock_texture(ctx, texObj);
|
_mesa_unlock_texture(ctx, texObj);
|
||||||
@@ -2543,18 +2536,17 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
|
|||||||
goto out; /* error was detected */
|
goto out; /* error was detected */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width == 0 || height == 0)
|
if (width > 0 && height >= 0) {
|
||||||
goto out; /* no-op, not an error */
|
/* If we have a border, xoffset=-1 is legal. Bias by border width */
|
||||||
|
xoffset += texImage->Border;
|
||||||
|
yoffset += texImage->Border;
|
||||||
|
|
||||||
/* If we have a border, xoffset=-1 is legal. Bias by border width */
|
ASSERT(ctx->Driver.TexSubImage2D);
|
||||||
xoffset += texImage->Border;
|
ctx->Driver.TexSubImage2D(ctx, target, level, xoffset, yoffset,
|
||||||
yoffset += texImage->Border;
|
width, height, format, type, pixels,
|
||||||
|
&ctx->Unpack, texObj, texImage);
|
||||||
ASSERT(ctx->Driver.TexSubImage2D);
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
(*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset,
|
}
|
||||||
width, height, format, type, pixels,
|
|
||||||
&ctx->Unpack, texObj, texImage);
|
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
_mesa_unlock_texture(ctx, texObj);
|
_mesa_unlock_texture(ctx, texObj);
|
||||||
@@ -2595,21 +2587,20 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
|
|||||||
goto out; /* error was detected */
|
goto out; /* error was detected */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width == 0 || height == 0 || height == 0)
|
if (width > 0 && height > 0 && height > 0) {
|
||||||
goto out; /* no-op, not an error */
|
/* If we have a border, xoffset=-1 is legal. Bias by border width */
|
||||||
|
xoffset += texImage->Border;
|
||||||
|
yoffset += texImage->Border;
|
||||||
|
zoffset += texImage->Border;
|
||||||
|
|
||||||
/* If we have a border, xoffset=-1 is legal. Bias by border width */
|
ASSERT(ctx->Driver.TexSubImage3D);
|
||||||
xoffset += texImage->Border;
|
ctx->Driver.TexSubImage3D(ctx, target, level,
|
||||||
yoffset += texImage->Border;
|
xoffset, yoffset, zoffset,
|
||||||
zoffset += texImage->Border;
|
width, height, depth,
|
||||||
|
format, type, pixels,
|
||||||
ASSERT(ctx->Driver.TexSubImage3D);
|
&ctx->Unpack, texObj, texImage );
|
||||||
(*ctx->Driver.TexSubImage3D)(ctx, target, level,
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
xoffset, yoffset, zoffset,
|
}
|
||||||
width, height, depth,
|
|
||||||
format, type, pixels,
|
|
||||||
&ctx->Unpack, texObj, texImage );
|
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
_mesa_unlock_texture(ctx, texObj);
|
_mesa_unlock_texture(ctx, texObj);
|
||||||
|
Reference in New Issue
Block a user