http://bugs.freedesktop.org/show_bug.cgi?id=10491
Summary: swizzle from rgba8888 to rgba8888_rev leads to corrupt
texture
Product: Mesa
Version: 6.5
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: medium
Component: Drivers/DRI/Radeon
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
I've been debugging this all day, so I hope I can make things understood /
clear.
Basicly my problem was I had a clanlib - http://www.clanlib.org/ - using
application: methane - http://methane.sourceforge.net/ . Which suffered from a
corrupted display after a mesa 6.5.1 to 6.5.2 upgrade. The patch causing the
corrupted display is this one:
http://gitweb.freedesktop.org/?p=mesa/mesa.git;a=commitdiff_plain;h=62d4dfbfe3f7c452f3c182bfdb9270a2f20e3f2d;hp=46c3bd29be4970a8b0c1c358aae0f1d7c05bc9f4
But AFAIK (after a day of debugging) this patch is fine, it does however expose
another problem.
In this case ClanLib basicly (stupidly) does the following to create and then
upload a texture:
glTexImage2D(
GL_TEXTURE_2D, // target
0, // level
GL_RGBA, // internalformat
width, // width
height, // height
0, // border
GL_RGBA, // format
0); // texels (0 to avoid uploading)
// upload
glTexSubImage2D(
GL_TEXTURE_2D, // target
0, // level
0, 0, // xoffset, yoffset
src_rect.get_width(), // width
src_rect.get_height(), // height
GL_ABGR_EXT, // format
GL_UNSIGNED_BYTE, // type
data); // texels
Notice how the texture is initially created with a format of GL_RGBA, and then
uploaded with a format of GL_ABGR_EXT.
The patch exposing the problem with the swizzle code:
http://gitweb.freedesktop.org/?p=mesa/mesa.git;a=commitdiff_plain;h=62d4dfbfe3f7c452f3c182bfdb9270a2f20e3f2d;hp=46c3bd29be4970a8b0c1c358aae0f1d7c05bc9f4
Causes mesa to choice rgba8888_rev as internal format for the created texture,
perfectly matching GL_RGBA on little endian. Without this patch / in the past
mesa / the r300 driver chose rgba8888
However the upload happens in GL_ABGR_EXT matching the default rgba8888 choice
mesa used to make. So prior to this patch, _mesa_texstore_rgba8888 from
src/mesa/main/texstore.c could use a straight memcpy.
However with the (perfectly fine) patch the texture is represented internally
as
rgba8888_rev, which makes _mesa_texstore_rgba8888 from src/mesa/main/texstore.c
enter the swizzle path. In the swizzle path the texture should get "swizzled"
from rgba8888 to rgba8888_rev, as its uploaded in rgba8888, but internally
represented in rgba8888_rev. however this somehow goes wrong, as I end up with
a corrupted display. I've managed to reproduce this corrupted display problem
on 3 different machines: x86_64 r300 / radeon 9800 pro, i386
r200 / radeon 9250, i386 r100 / radeon M6
Phew, I hope thats understandable if not please ask. For now I've fixed ClanLib
to not be so stupid, but the swizzle code needs to be fixed too.
--
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel