mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
Fix compressed texture loads for non-minimal pitches
The current glCompressedTexImage support in the state tracker assumes that compressed textures have minimal pitch. However, in some cases this is not true, such as for mipmaps of non-POT compressed textures on nVidia hardware. This patch adds a check and does a memcpy for each line instead of the whole image in that case. Signed-off-by: Keith Whitwell <keithw@vmware.com> Tweaks for C90 compilation.
This commit is contained in:
parent
bfcafbe15d
commit
eea6a7639f
1 changed files with 16 additions and 1 deletions
|
|
@ -680,7 +680,22 @@ st_TexImage(GLcontext * ctx,
|
|||
* conversion and copy:
|
||||
*/
|
||||
if (compressed_src) {
|
||||
memcpy(texImage->Data, pixels, imageSize);
|
||||
const GLuint srcImageStride = _mesa_format_row_stride(texImage->TexFormat, width);
|
||||
if(dstRowStride == srcImageStride)
|
||||
memcpy(texImage->Data, pixels, imageSize);
|
||||
else
|
||||
{
|
||||
char *dst = texImage->Data;
|
||||
const char *src = pixels;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < height; ++i)
|
||||
{
|
||||
memcpy(dst, src, srcImageStride);
|
||||
dst += dstRowStride;
|
||||
src += srcImageStride;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const GLuint srcImageStride =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue