mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 12:30:11 +01:00
Merge branch 'remove-copyteximage-hook'
This commit is contained in:
commit
ecc6a26a3d
15 changed files with 36 additions and 412 deletions
|
|
@ -95,8 +95,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
driver->TexSubImage2D = _mesa_store_texsubimage2d;
|
||||
driver->TexSubImage3D = _mesa_store_texsubimage3d;
|
||||
driver->GetTexImage = _mesa_get_teximage;
|
||||
driver->CopyTexImage1D = _mesa_meta_CopyTexImage1D;
|
||||
driver->CopyTexImage2D = _mesa_meta_CopyTexImage2D;
|
||||
driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
|
||||
driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
|
||||
driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D;
|
||||
|
|
|
|||
|
|
@ -2835,119 +2835,6 @@ get_temp_image_type(struct gl_context *ctx, GLenum baseFormat)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper for _mesa_meta_CopyTexImage1/2D() functions.
|
||||
* Have to be careful with locking and meta state for pixel transfer.
|
||||
*/
|
||||
static void
|
||||
copy_tex_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height, GLint border)
|
||||
{
|
||||
struct gl_texture_object *texObj;
|
||||
struct gl_texture_image *texImage;
|
||||
GLenum format, type;
|
||||
GLint bpp;
|
||||
void *buf;
|
||||
struct gl_renderbuffer *read_rb = ctx->ReadBuffer->_ColorReadBuffer;
|
||||
|
||||
texObj = _mesa_get_current_tex_object(ctx, target);
|
||||
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
|
||||
|
||||
/* Choose format/type for temporary image buffer */
|
||||
format = _mesa_base_tex_format(ctx, internalFormat);
|
||||
|
||||
if (format == GL_LUMINANCE &&
|
||||
_mesa_get_format_base_format(read_rb->Format) != GL_LUMINANCE) {
|
||||
/* The glReadPixels() path will convert RGB to luminance by
|
||||
* summing R+G+B. glCopyTexImage() is supposed to behave as
|
||||
* glCopyPixels, which doesn't do that change, and instead
|
||||
* leaves it up to glTexImage which converts RGB to luminance by
|
||||
* just taking the R channel. To avoid glReadPixels() trashing
|
||||
* our data, use RGBA for our temporary image.
|
||||
*/
|
||||
format = GL_RGBA;
|
||||
}
|
||||
|
||||
type = get_temp_image_type(ctx, format);
|
||||
bpp = _mesa_bytes_per_pixel(format, type);
|
||||
if (bpp <= 0) {
|
||||
_mesa_problem(ctx, "Bad bpp in meta copy_tex_image()");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Alloc image buffer (XXX could use a PBO)
|
||||
*/
|
||||
buf = malloc(width * height * bpp);
|
||||
if (!buf) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
|
||||
return;
|
||||
}
|
||||
|
||||
_mesa_unlock_texture(ctx, texObj); /* need to unlock first */
|
||||
|
||||
/*
|
||||
* Read image from framebuffer (disable pixel transfer ops)
|
||||
*/
|
||||
_mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
|
||||
ctx->Driver.ReadPixels(ctx, x, y, width, height,
|
||||
format, type, &ctx->Pack, buf);
|
||||
_mesa_meta_end(ctx);
|
||||
|
||||
if (texImage->Data) {
|
||||
ctx->Driver.FreeTexImageData(ctx, texImage);
|
||||
}
|
||||
|
||||
/* The texture's format was already chosen in _mesa_CopyTexImage() */
|
||||
ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
|
||||
|
||||
/*
|
||||
* Store texture data (with pixel transfer ops)
|
||||
*/
|
||||
_mesa_meta_begin(ctx, META_PIXEL_STORE);
|
||||
|
||||
_mesa_update_state(ctx); /* to update pixel transfer state */
|
||||
|
||||
if (target == GL_TEXTURE_1D) {
|
||||
ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
|
||||
width, border, format, type,
|
||||
buf, &ctx->Unpack, texObj, texImage);
|
||||
}
|
||||
else {
|
||||
ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
|
||||
width, height, border, format, type,
|
||||
buf, &ctx->Unpack, texObj, texImage);
|
||||
}
|
||||
_mesa_meta_end(ctx);
|
||||
|
||||
_mesa_lock_texture(ctx, texObj); /* re-lock */
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLint border)
|
||||
{
|
||||
copy_tex_image(ctx, 1, target, level, internalFormat, x, y,
|
||||
width, 1, border);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height, GLint border)
|
||||
{
|
||||
copy_tex_image(ctx, 2, target, level, internalFormat, x, y,
|
||||
width, height, border);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions.
|
||||
* Have to be careful with locking and meta state for pixel transfer.
|
||||
|
|
|
|||
|
|
@ -71,16 +71,6 @@ extern void
|
|||
_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
|
||||
struct gl_texture_object *texObj);
|
||||
|
||||
extern void
|
||||
_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLint border);
|
||||
|
||||
extern void
|
||||
_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height, GLint border);
|
||||
|
||||
extern void
|
||||
_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLint xoffset,
|
||||
|
|
|
|||
|
|
@ -163,101 +163,6 @@ intel_copy_texsubimage(struct intel_context *intel,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
intelCopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLint border)
|
||||
{
|
||||
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
|
||||
struct gl_texture_object *texObj =
|
||||
_mesa_select_tex_object(ctx, texUnit, target);
|
||||
struct gl_texture_image *texImage =
|
||||
_mesa_select_tex_image(ctx, texObj, target, level);
|
||||
int srcx, srcy, dstx, dsty, height;
|
||||
|
||||
if (border)
|
||||
goto fail;
|
||||
|
||||
/* Setup or redefine the texture object, mipmap tree and texture
|
||||
* image. Don't populate yet.
|
||||
*/
|
||||
ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
|
||||
width, border,
|
||||
GL_RGBA, CHAN_TYPE, NULL,
|
||||
&ctx->DefaultPacking, texObj, texImage);
|
||||
srcx = x;
|
||||
srcy = y;
|
||||
dstx = 0;
|
||||
dsty = 0;
|
||||
height = 1;
|
||||
if (!_mesa_clip_copytexsubimage(ctx,
|
||||
&dstx, &dsty,
|
||||
&srcx, &srcy,
|
||||
&width, &height))
|
||||
return;
|
||||
|
||||
if (!intel_copy_texsubimage(intel_context(ctx), target,
|
||||
intel_texture_image(texImage),
|
||||
internalFormat, 0, 0, x, y, width, height))
|
||||
goto fail;
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
fallback_debug("%s - fallback to swrast\n", __FUNCTION__);
|
||||
_mesa_meta_CopyTexImage1D(ctx, target, level, internalFormat, x, y,
|
||||
width, border);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
intelCopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLint border)
|
||||
{
|
||||
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
|
||||
struct gl_texture_object *texObj =
|
||||
_mesa_select_tex_object(ctx, texUnit, target);
|
||||
struct gl_texture_image *texImage =
|
||||
_mesa_select_tex_image(ctx, texObj, target, level);
|
||||
int srcx, srcy, dstx, dsty;
|
||||
|
||||
if (border)
|
||||
goto fail;
|
||||
|
||||
/* Setup or redefine the texture object, mipmap tree and texture
|
||||
* image. Don't populate yet.
|
||||
*/
|
||||
ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
|
||||
width, height, border,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL,
|
||||
&ctx->DefaultPacking, texObj, texImage);
|
||||
|
||||
srcx = x;
|
||||
srcy = y;
|
||||
dstx = 0;
|
||||
dsty = 0;
|
||||
if (!_mesa_clip_copytexsubimage(ctx,
|
||||
&dstx, &dsty,
|
||||
&srcx, &srcy,
|
||||
&width, &height))
|
||||
return;
|
||||
|
||||
if (!intel_copy_texsubimage(intel_context(ctx), target,
|
||||
intel_texture_image(texImage),
|
||||
internalFormat, 0, 0, x, y, width, height))
|
||||
goto fail;
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
fallback_debug("%s - fallback to swrast\n", __FUNCTION__);
|
||||
_mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y,
|
||||
width, height, border);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
intelCopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint x, GLint y, GLsizei width)
|
||||
|
|
@ -312,8 +217,6 @@ intelCopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
|
|||
void
|
||||
intelInitTextureCopyImageFuncs(struct dd_function_table *functions)
|
||||
{
|
||||
functions->CopyTexImage1D = intelCopyTexImage1D;
|
||||
functions->CopyTexImage2D = intelCopyTexImage2D;
|
||||
functions->CopyTexSubImage1D = intelCopyTexSubImage1D;
|
||||
functions->CopyTexSubImage2D = intelCopyTexSubImage2D;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -527,7 +527,6 @@ void r200InitTextureFuncs( radeonContextPtr radeon, struct dd_function_table *fu
|
|||
functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D;
|
||||
|
||||
if (radeon->radeonScreen->kernel_mm) {
|
||||
functions->CopyTexImage2D = radeonCopyTexImage2D;
|
||||
functions->CopyTexSubImage2D = radeonCopyTexSubImage2D;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -379,7 +379,6 @@ void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *fun
|
|||
functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D;
|
||||
|
||||
if (radeon->radeonScreen->kernel_mm) {
|
||||
functions->CopyTexImage2D = radeonCopyTexImage2D;
|
||||
functions->CopyTexSubImage2D = radeonCopyTexSubImage2D;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1688,7 +1688,6 @@ void evergreenInitTextureFuncs(radeonContextPtr radeon, struct dd_function_table
|
|||
functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D;
|
||||
|
||||
if (radeon->radeonScreen->kernel_mm) {
|
||||
functions->CopyTexImage2D = radeonCopyTexImage2D;
|
||||
functions->CopyTexSubImage2D = radeonCopyTexSubImage2D;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -470,7 +470,6 @@ void r600InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *fun
|
|||
functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D;
|
||||
|
||||
if (radeon->radeonScreen->kernel_mm) {
|
||||
functions->CopyTexImage2D = radeonCopyTexImage2D;
|
||||
functions->CopyTexSubImage2D = radeonCopyTexSubImage2D;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -455,7 +455,6 @@ void radeonInitTextureFuncs( radeonContextPtr radeon, struct dd_function_table *
|
|||
functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D;
|
||||
|
||||
if (radeon->radeonScreen->kernel_mm) {
|
||||
functions->CopyTexImage2D = radeonCopyTexImage2D;
|
||||
functions->CopyTexSubImage2D = radeonCopyTexSubImage2D;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,61 +140,6 @@ do_copy_texsubimage(struct gl_context *ctx,
|
|||
dstx, dsty, width, height, flip_y);
|
||||
}
|
||||
|
||||
void
|
||||
radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLint border)
|
||||
{
|
||||
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
|
||||
struct gl_texture_object *texObj =
|
||||
_mesa_select_tex_object(ctx, texUnit, target);
|
||||
struct gl_texture_image *texImage =
|
||||
_mesa_select_tex_image(ctx, texObj, target, level);
|
||||
int srcx, srcy, dstx, dsty;
|
||||
|
||||
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
|
||||
radeon_prepare_render(radeon);
|
||||
|
||||
if (border)
|
||||
goto fail;
|
||||
|
||||
/* Setup or redefine the texture object, mipmap tree and texture
|
||||
* image. Don't populate yet.
|
||||
*/
|
||||
ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
|
||||
width, height, border,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL,
|
||||
&ctx->DefaultPacking, texObj, texImage);
|
||||
|
||||
srcx = x;
|
||||
srcy = y;
|
||||
dstx = 0;
|
||||
dsty = 0;
|
||||
if (!_mesa_clip_copytexsubimage(ctx,
|
||||
&dstx, &dsty,
|
||||
&srcx, &srcy,
|
||||
&width, &height)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!do_copy_texsubimage(ctx, target, level,
|
||||
radeon_tex_obj(texObj), (radeon_texture_image *)texImage,
|
||||
0, 0, x, y, width, height)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
radeon_print(RADEON_FALLBACKS, RADEON_NORMAL,
|
||||
"Falling back to sw for glCopyTexImage2D (internalFormat %s, border %d)\n",
|
||||
_mesa_lookup_enum_by_nr(internalFormat), border);
|
||||
|
||||
_mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y,
|
||||
width, height, border);
|
||||
}
|
||||
|
||||
void
|
||||
radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
|
|
|
|||
|
|
@ -126,11 +126,6 @@ void radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint le
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage);
|
||||
|
||||
void radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLint border);
|
||||
|
||||
void radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLint x, GLint y,
|
||||
|
|
|
|||
|
|
@ -289,24 +289,6 @@ struct dd_function_table {
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
|
||||
/**
|
||||
* Called by glCopyTexImage1D().
|
||||
*
|
||||
* Drivers should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
void (*CopyTexImage1D)( struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLint border );
|
||||
|
||||
/**
|
||||
* Called by glCopyTexImage2D().
|
||||
*
|
||||
* Drivers should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
void (*CopyTexImage2D)( struct gl_context *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height, GLint border );
|
||||
|
||||
/**
|
||||
* Called by glCopyTexSubImage1D().
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2797,29 +2797,43 @@ copyteximage(struct gl_context *ctx, GLuint dims,
|
|||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
|
||||
}
|
||||
else {
|
||||
gl_format texFormat;
|
||||
|
||||
if (texImage->Data) {
|
||||
ctx->Driver.FreeTexImageData( ctx, texImage );
|
||||
}
|
||||
|
||||
ASSERT(texImage->Data == NULL);
|
||||
|
||||
texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
|
||||
internalFormat, GL_NONE,
|
||||
GL_NONE);
|
||||
/* choose actual hw format */
|
||||
gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
|
||||
target, level,
|
||||
internalFormat,
|
||||
GL_NONE, GL_NONE);
|
||||
|
||||
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,
|
||||
border, internalFormat, texFormat);
|
||||
|
||||
ASSERT(ctx->Driver.CopyTexImage2D);
|
||||
if (dims == 1)
|
||||
ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
|
||||
x, y, width, border);
|
||||
else
|
||||
ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
|
||||
x, y, width, height, border);
|
||||
/* 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)
|
||||
ctx->Driver.CopyTexSubImage1D(ctx, target, level, dstX,
|
||||
srcX, srcY, width);
|
||||
|
||||
else
|
||||
ctx->Driver.CopyTexSubImage2D(ctx, target, level, dstX, dstY,
|
||||
srcX, srcY, width, height);
|
||||
}
|
||||
|
||||
check_gen_mipmap(ctx, target, texObj, level);
|
||||
|
||||
|
|
@ -2830,6 +2844,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,
|
|||
ctx->NewState |= _NEW_TEXTURE;
|
||||
}
|
||||
else {
|
||||
/* probably too large of image */
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4577,8 +4577,7 @@ texture_row_stride(const struct gl_texture_image *texImage)
|
|||
|
||||
|
||||
/**
|
||||
* This is the software fallback for Driver.TexImage1D()
|
||||
* and Driver.CopyTexImage1D().
|
||||
* This is the software fallback for Driver.TexImage1D().
|
||||
* \sa _mesa_store_teximage2d()
|
||||
*/
|
||||
void
|
||||
|
|
@ -4629,8 +4628,7 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
|
|||
|
||||
|
||||
/**
|
||||
* This is the software fallback for Driver.TexImage2D()
|
||||
* and Driver.CopyTexImage2D().
|
||||
* This is the software fallback for Driver.TexImage2D().
|
||||
*
|
||||
* This function is oriented toward storing images in main memory, rather
|
||||
* than VRAM. Device driver's can easily plug in their own replacement.
|
||||
|
|
@ -4684,8 +4682,7 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
|
|||
|
||||
|
||||
/**
|
||||
* This is the software fallback for Driver.TexImage3D()
|
||||
* and Driver.CopyTexImage3D().
|
||||
* This is the software fallback for Driver.TexImage3D().
|
||||
* \sa _mesa_store_teximage2d()
|
||||
*/
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1466,34 +1466,6 @@ st_copy_texsubimage(struct gl_context *ctx,
|
|||
depth/stencil samples per pixel? Need some transfer clarifications. */
|
||||
assert(sample_count < 2);
|
||||
|
||||
if (srcX < 0) {
|
||||
width -= -srcX;
|
||||
destX += -srcX;
|
||||
srcX = 0;
|
||||
}
|
||||
|
||||
if (srcY < 0) {
|
||||
height -= -srcY;
|
||||
destY += -srcY;
|
||||
srcY = 0;
|
||||
}
|
||||
|
||||
if (destX < 0) {
|
||||
width -= -destX;
|
||||
srcX += -destX;
|
||||
destX = 0;
|
||||
}
|
||||
|
||||
if (destY < 0) {
|
||||
height -= -destY;
|
||||
srcY += -destY;
|
||||
destY = 0;
|
||||
}
|
||||
|
||||
if (width < 0 || height < 0)
|
||||
return;
|
||||
|
||||
|
||||
assert(strb);
|
||||
assert(strb->surface);
|
||||
assert(stImage->pt);
|
||||
|
|
@ -1609,59 +1581,6 @@ st_copy_texsubimage(struct gl_context *ctx,
|
|||
|
||||
|
||||
|
||||
static void
|
||||
st_CopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLint border)
|
||||
{
|
||||
struct gl_texture_unit *texUnit =
|
||||
&ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
struct gl_texture_object *texObj =
|
||||
_mesa_select_tex_object(ctx, texUnit, target);
|
||||
struct gl_texture_image *texImage =
|
||||
_mesa_select_tex_image(ctx, texObj, target, level);
|
||||
|
||||
/* Setup or redefine the texture object, texture and texture
|
||||
* image. Don't populate yet.
|
||||
*/
|
||||
ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
|
||||
width, border,
|
||||
GL_RGBA, CHAN_TYPE, NULL,
|
||||
&ctx->DefaultPacking, texObj, texImage);
|
||||
|
||||
st_copy_texsubimage(ctx, target, level,
|
||||
0, 0, 0, /* destX,Y,Z */
|
||||
x, y, width, 1); /* src X, Y, size */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
st_CopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLint border)
|
||||
{
|
||||
struct gl_texture_unit *texUnit =
|
||||
&ctx->Texture.Unit[ctx->Texture.CurrentUnit];
|
||||
struct gl_texture_object *texObj =
|
||||
_mesa_select_tex_object(ctx, texUnit, target);
|
||||
struct gl_texture_image *texImage =
|
||||
_mesa_select_tex_image(ctx, texObj, target, level);
|
||||
|
||||
/* Setup or redefine the texture object, texture and texture
|
||||
* image. Don't populate yet.
|
||||
*/
|
||||
ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
|
||||
width, height, border,
|
||||
GL_RGBA, CHAN_TYPE, NULL,
|
||||
&ctx->DefaultPacking, texObj, texImage);
|
||||
|
||||
st_copy_texsubimage(ctx, target, level,
|
||||
0, 0, 0, /* destX,Y,Z */
|
||||
x, y, width, height); /* src X, Y, size */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
st_CopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint x, GLint y, GLsizei width)
|
||||
|
|
@ -1947,8 +1866,6 @@ st_init_texture_functions(struct dd_function_table *functions)
|
|||
functions->CompressedTexSubImage1D = st_CompressedTexSubImage1D;
|
||||
functions->CompressedTexSubImage2D = st_CompressedTexSubImage2D;
|
||||
functions->CompressedTexSubImage3D = st_CompressedTexSubImage3D;
|
||||
functions->CopyTexImage1D = st_CopyTexImage1D;
|
||||
functions->CopyTexImage2D = st_CopyTexImage2D;
|
||||
functions->CopyTexSubImage1D = st_CopyTexSubImage1D;
|
||||
functions->CopyTexSubImage2D = st_CopyTexSubImage2D;
|
||||
functions->CopyTexSubImage3D = st_CopyTexSubImage3D;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue