mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
mesa: push row stride adjustment down into _mesa_decompress_image()
There's a mismatch in row strides for compressed textures between what Driver.MapTextureImage() returns and what the software fetch-texel functions use. Move it down a layer. The next step would be to fix this in the fetch-texel functions.
This commit is contained in:
parent
9d9111108e
commit
07459ba509
2 changed files with 11 additions and 12 deletions
|
|
@ -465,6 +465,8 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
|
|||
|
||||
/**
|
||||
* Decompress a compressed texture image, returning a GL_RGBA/GL_FLOAT image.
|
||||
* \param srcRowStride stride in bytes between rows of blocks in the
|
||||
* compressed source image.
|
||||
*/
|
||||
void
|
||||
_mesa_decompress_image(gl_format format, GLuint width, GLuint height,
|
||||
|
|
@ -475,11 +477,19 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
|
|||
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||
struct swrast_texture_image texImage; /* dummy teximage */
|
||||
GLuint i, j;
|
||||
GLuint bytes, bw, bh;
|
||||
|
||||
bytes = _mesa_get_format_bytes(format);
|
||||
_mesa_get_format_block_size(format, &bw, &bh);
|
||||
|
||||
/* setup dummy texture image info */
|
||||
memset(&texImage, 0, sizeof(texImage));
|
||||
texImage.Map = (void *) src;
|
||||
texImage.RowStride = srcRowStride;
|
||||
|
||||
/* XXX This line is a bit of a hack to adapt to the row stride
|
||||
* convention used by the texture decompression functions.
|
||||
*/
|
||||
texImage.RowStride = srcRowStride * bh / bytes;
|
||||
|
||||
switch (format) {
|
||||
/* DXT formats */
|
||||
|
|
|
|||
|
|
@ -246,23 +246,12 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
|
|||
{
|
||||
GLubyte *srcMap;
|
||||
GLint srcRowStride;
|
||||
GLuint bytes, bw, bh;
|
||||
|
||||
bytes = _mesa_get_format_bytes(texFormat);
|
||||
_mesa_get_format_block_size(texFormat, &bw, &bh);
|
||||
|
||||
ctx->Driver.MapTextureImage(ctx, texImage, 0,
|
||||
0, 0, width, height,
|
||||
GL_MAP_READ_BIT,
|
||||
&srcMap, &srcRowStride);
|
||||
if (srcMap) {
|
||||
/* XXX This line is a bit of a hack to work around the
|
||||
* mismatch of compressed row strides as returned by
|
||||
* MapTextureImage() vs. what the texture decompression code
|
||||
* uses. This will be fixed in the future.
|
||||
*/
|
||||
srcRowStride = srcRowStride * bh / bytes;
|
||||
|
||||
_mesa_decompress_image(texFormat, width, height,
|
||||
srcMap, srcRowStride, tempImage);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue