diff options
author | marha <marha@users.sourceforge.net> | 2011-07-22 08:25:25 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-07-22 08:25:25 +0200 |
commit | c70e21be1fe5f9b47bce020ffd8d69c6012b21fc (patch) | |
tree | 2ae24d451df0e12093fd82c2cd466e05dfe1aaa0 /mesalib/src/mesa/main/teximage.c | |
parent | 556198b74eecf7e9f7105a792a33bf699cff6507 (diff) | |
parent | 91e91b72f07f4e61db17ee86c6933a7217f0e25c (diff) | |
download | vcxsrv-c70e21be1fe5f9b47bce020ffd8d69c6012b21fc.tar.gz vcxsrv-c70e21be1fe5f9b47bce020ffd8d69c6012b21fc.tar.bz2 vcxsrv-c70e21be1fe5f9b47bce020ffd8d69c6012b21fc.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c
mesalib/src/glsl/ast_function.cpp
mesalib/src/glsl/ast_to_hir.cpp
mesalib/src/glsl/glsl_types.cpp
mesalib/src/glsl/ir.cpp
mesalib/src/glsl/ir.h
mesalib/src/glsl/linker.cpp
mesalib/src/glsl/s_expression.cpp
mesalib/src/mesa/drivers/common/driverfuncs.c
mesalib/src/mesa/main/dd.h
mesalib/src/mesa/main/fbobject.c
mesalib/src/mesa/main/teximage.c
mesalib/src/mesa/state_tracker/st_cb_texture.c
Diffstat (limited to 'mesalib/src/mesa/main/teximage.c')
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 7493cd65b..7141efba1 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -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 );
- }
+ /* choose actual hw format */
+ gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
+ target, level,
+ internalFormat,
+ GL_NONE, GL_NONE);
- ASSERT(texImage->Data == NULL);
+ if (legal_texture_size(ctx, texFormat, width, height, 1)) {
+ GLint srcX = x, srcY = y, dstX = 0, dstY = 0;
- texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
- internalFormat, GL_NONE,
- GL_NONE);
+ /* Free old texture image */
+ ctx->Driver.FreeTexImageData(ctx, texImage);
- if (legal_texture_size(ctx, texFormat, width, height, 1)) {
_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);
}
}
|