mesa: Fix glCompressedTexImage when dstRowStride != srcRowStride.
Since the MapTextureImage changes on Intel, nwn had corruption in the scrollbar at the load game menu, and corrupted ground textures in the starting zone. Heroes of Newerth's intro screen was also thoroughly garbled. A new piglit test "compressedteximage" was created to regression test this. The issue was this code now seeing dstRowStride aligned to hardware requirements instead of a temporary buffer that gets uploaded to hardware later. The existing code was just trying to memcpy srcRowStride * height / bh, while the glCompressedTexSubImage2D() storage code nearby did the correct walking by blockheight rows at a time. Just reuse the subimage upload instead of duplicating that logic. v2: Update comment at the top of the function (suggestion by Joel Forsberg) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41451 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
This commit is contained in:
parent
27e77cb902
commit
bda361e0d4
|
@ -5017,11 +5017,9 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx,
|
||||||
struct gl_texture_object *texObj,
|
struct gl_texture_object *texObj,
|
||||||
struct gl_texture_image *texImage)
|
struct gl_texture_image *texImage)
|
||||||
{
|
{
|
||||||
GLubyte *dstMap;
|
/* This is pretty simple, because unlike the general texstore path we don't
|
||||||
GLint dstRowStride;
|
* have to worry about the usual image unpacking or image transfer
|
||||||
|
* operations.
|
||||||
/* This is pretty simple, basically just do a memcpy without worrying
|
|
||||||
* about the usual image unpacking or image transfer operations.
|
|
||||||
*/
|
*/
|
||||||
ASSERT(texObj);
|
ASSERT(texObj);
|
||||||
ASSERT(texImage);
|
ASSERT(texImage);
|
||||||
|
@ -5036,29 +5034,12 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data,
|
_mesa_store_compressed_texsubimage2d(ctx, target, level,
|
||||||
&ctx->Unpack,
|
0, 0,
|
||||||
"glCompressedTexImage2D");
|
width, height,
|
||||||
if (!data)
|
texImage->TexFormat,
|
||||||
return;
|
imageSize, data,
|
||||||
|
texObj, texImage);
|
||||||
|
|
||||||
/* Map dest texture buffer (write to whole region) */
|
|
||||||
ctx->Driver.MapTextureImage(ctx, texImage, 0,
|
|
||||||
0, 0, width, height,
|
|
||||||
GL_MAP_WRITE_BIT,
|
|
||||||
&dstMap, &dstRowStride);
|
|
||||||
if (dstMap) {
|
|
||||||
/* copy the data */
|
|
||||||
memcpy(dstMap, data, imageSize);
|
|
||||||
|
|
||||||
ctx->Driver.UnmapTextureImage(ctx, texImage, 0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
|
|
||||||
}
|
|
||||||
|
|
||||||
_mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue