summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-12-07 08:24:56 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-12-07 08:24:56 -0700
commit0d1669f5303e37980170169687e1dfa5f74c4c00 (patch)
treefdf6d3dde15ee1234f2ea8d334615d72e1dddd59
parent9772bb7f71cf114f463e4a9383202846da071363 (diff)
byteswapping fixes in choose_pixel_format()
-rw-r--r--src/mesa/pipe/xlib/xm_api.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/mesa/pipe/xlib/xm_api.c b/src/mesa/pipe/xlib/xm_api.c
index ce7e3cb6c2..5cb9ca0d36 100644
--- a/src/mesa/pipe/xlib/xm_api.c
+++ b/src/mesa/pipe/xlib/xm_api.c
@@ -400,23 +400,25 @@ choose_pixel_format(XMesaVisual v)
if ( GET_REDMASK(v) == 0x0000ff
&& GET_GREENMASK(v) == 0x00ff00
&& GET_BLUEMASK(v) == 0xff0000
- && CHECK_BYTE_ORDER(v)
&& v->BitsPerPixel == 32) {
- /* common 32 bpp config used on SGI, Sun */
- assert(0);
- return 0 /* PIXEL_FORMAT_U_A8_B8_G8_A8 */;
+ if (CHECK_BYTE_ORDER(v)) {
+ /* no byteswapping needed */
+ return 0 /* PIXEL_FORMAT_U_A8_B8_G8_R8 */;
+ }
+ else {
+ return PIPE_FORMAT_U_R8_G8_B8_A8;
+ }
}
else if ( GET_REDMASK(v) == 0xff0000
&& GET_GREENMASK(v) == 0x00ff00
&& GET_BLUEMASK(v) == 0x0000ff
- && CHECK_BYTE_ORDER(v)) {
- if (v->BitsPerPixel == 32) {
+ && v->BitsPerPixel == 32) {
+ if (CHECK_BYTE_ORDER(v)) {
+ /* no byteswapping needed */
return PIPE_FORMAT_U_A8_R8_G8_B8;
}
- else if (v->BitsPerPixel == 24) {
- /* not supported yet */
- abort();
- return 0;
+ else {
+ return PIPE_FORMAT_U_B8_G8_R8_A8;
}
}
else if ( GET_REDMASK(v) == 0xf800
@@ -734,6 +736,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
return NULL;
pf = choose_pixel_format(v);
+ assert(pf);
pipe = xmesa_create_pipe_context( c, pf );