From 4ef955a12a526dcad388133b6dc8426a51054cdd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 20 Jan 2011 13:32:35 -0700 Subject: graw: fix logic error in pixel format selection The loop to choose a pixel format for the window was incrementing 'i' after we succeeded in creating the window so if we chose format[0] for graw_create_window_and_screen() we were putting format[1] in the pipe_resource template for creating the render target. This only worked because of the order of the elements in the formats[] array. The graw_xlib.c code now properly compares the requested gallium pixel format against the visual's color layout. Update all the graw demos to fix the off-by-one-i error. --- src/gallium/tests/graw/fs-test.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/gallium/tests/graw/fs-test.c') diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index 37be2d0830..d21eb44e11 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -433,15 +433,18 @@ static void init( void ) * Also, no easy way of querying supported formats if the screen * cannot be created first. */ - for (i = 0; - window == NULL && formats[i] != PIPE_FORMAT_NONE; - i++) { - - screen = graw_create_window_and_screen(0,0,WIDTH,HEIGHT, + for (i = 0; formats[i] != PIPE_FORMAT_NONE; i++) { + screen = graw_create_window_and_screen(0, 0, 300, 300, formats[i], &window); + if (window && screen) + break; } - + if (!screen || !window) { + fprintf(stderr, "Unable to create window\n"); + exit(1); + } + ctx = screen->context_create(screen, NULL); if (ctx == NULL) exit(3); -- cgit v1.2.3