From: Connor McAdams Subject: [PATCH 2/3] Add format change before upload for non-volume textures Message-Id: <1529613160-21090-3-git-send-email-conmanx360@gmail.com> Date: Thu, 21 Jun 2018 16:32:39 -0400 In-Reply-To: <1529613160-21090-1-git-send-email-conmanx360@gmail.com> References: <1529613160-21090-1-git-send-email-conmanx360@gmail.com> This patch keeps non-volume DXTn textures from being converted to b8g8r8a8. I have tested it and it does work converting them all, but the GPU can handle them normally. Volume textures are the only ones the GPU handles incorrectly. --- dlls/wined3d/texture.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index c316906..a998b9c 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1948,6 +1948,32 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s bo.addr += src_box->left * format->byte_count; } + if (format->id == WINED3DFMT_DXT5 || format->id == WINED3DFMT_DXT4 || + format->id == WINED3DFMT_DXT3 || format->id == WINED3DFMT_DXT2 || + format->id == WINED3DFMT_DXT1) + { + if (target == GL_TEXTURE_3D) + { + struct wined3d_format temp; + + f = *format; + temp.upload = f.upload; + format = &f; + format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM, WINED3DUSAGE_TEXTURE); + f = *format; + f.upload = temp.upload; + f.conv_byte_count = 4; + format = &f; + texture->resource.format_flags &= ~WINED3DFMT_FLAG_BLOCKS; + } + else + { + f = *format; + f.upload = NULL; + format = &f; + } + } + if (format->upload) { unsigned int dst_row_pitch, dst_slice_pitch; -- 2.7.4