mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 06:50:11 +01:00
mesa: stop using ctx->Driver.CopyTexImage1D/2D() hooks
This commit is contained in:
parent
d84791a72b
commit
5874890c26
1 changed files with 33 additions and 18 deletions
|
|
@ -2797,29 +2797,43 @@ copyteximage(struct gl_context *ctx, GLuint dims,
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gl_format texFormat;
|
/* choose actual hw format */
|
||||||
|
gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
|
||||||
if (texImage->Data) {
|
target, level,
|
||||||
ctx->Driver.FreeTexImageData( ctx, texImage );
|
internalFormat,
|
||||||
}
|
GL_NONE, GL_NONE);
|
||||||
|
|
||||||
ASSERT(texImage->Data == NULL);
|
|
||||||
|
|
||||||
texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
|
|
||||||
internalFormat, GL_NONE,
|
|
||||||
GL_NONE);
|
|
||||||
|
|
||||||
if (legal_texture_size(ctx, texFormat, width, height, 1)) {
|
if (legal_texture_size(ctx, texFormat, width, height, 1)) {
|
||||||
|
GLint srcX = x, srcY = y, dstX = 0, dstY = 0;
|
||||||
|
|
||||||
|
/* Free old texture image */
|
||||||
|
ctx->Driver.FreeTexImageData(ctx, texImage);
|
||||||
|
|
||||||
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
|
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
|
||||||
border, internalFormat, texFormat);
|
border, internalFormat, texFormat);
|
||||||
|
|
||||||
ASSERT(ctx->Driver.CopyTexImage2D);
|
/* Allocate texture memory (no pixel data yet) */
|
||||||
|
if (dims == 1) {
|
||||||
|
ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
|
||||||
|
width, border, GL_NONE, GL_NONE, NULL,
|
||||||
|
&ctx->Unpack, texObj, texImage);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
|
||||||
|
width, height, border, GL_NONE, GL_NONE,
|
||||||
|
NULL, &ctx->Unpack, texObj, texImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
|
||||||
|
&width, &height)) {
|
||||||
if (dims == 1)
|
if (dims == 1)
|
||||||
ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
|
ctx->Driver.CopyTexSubImage1D(ctx, target, level, dstX,
|
||||||
x, y, width, border);
|
srcX, srcY, width);
|
||||||
|
|
||||||
else
|
else
|
||||||
ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
|
ctx->Driver.CopyTexSubImage2D(ctx, target, level, dstX, dstY,
|
||||||
x, y, width, height, border);
|
srcX, srcY, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
check_gen_mipmap(ctx, target, texObj, level);
|
check_gen_mipmap(ctx, target, texObj, level);
|
||||||
|
|
||||||
|
|
@ -2830,6 +2844,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* probably too large of image */
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue