From 9af443f5976ab3987e4ee9d397391e82206676b4 Mon Sep 17 00:00:00 2001 From: Alexander Gottwald Date: Sat, 9 Apr 2005 19:20:03 +0000 Subject: [PATCH] Fix passing of non-RGB visuals. The old code did not initialize the structure properly which lead to a crash in 8bpp mode --- GL/windows/ChangeLog | 6 ++++++ GL/windows/indirect.c | 26 ++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/GL/windows/ChangeLog b/GL/windows/ChangeLog index e5a2e4cc7..0d58b2637 100644 --- a/GL/windows/ChangeLog +++ b/GL/windows/ChangeLog @@ -1,3 +1,9 @@ +2005-04-09 Alexander Gottwald + + * indirect.c: + Fix passing of non-RGB visuals. The old code did not initialize the + structure properly which lead to a crash in 8bpp mode + 2005-03-01 Alexander Gottwald * indirect.c: diff --git a/GL/windows/indirect.c b/GL/windows/indirect.c index df6040d9a..4c46ec960 100755 --- a/GL/windows/indirect.c +++ b/GL/windows/indirect.c @@ -995,6 +995,26 @@ static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { } }; +static __GLXvisualConfig NullConfig = { + -1, /* vid */ + -1, /* class */ + False, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + False, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ +}; + static inline int count_bits(uint32_t x) { x = x - ((x >> 1) & 0x55555555); @@ -1137,7 +1157,6 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, int is_rgb = (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor); -#if 0 if (!is_rgb) { /* We don't support non-rgb visuals for GL. But we don't @@ -1157,14 +1176,13 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, orig_vid[j] = pVisual[i].vid; /* Initialize the glXVisual */ - glXVisualPtr[j] = NullConfig; - glXVisualPriv[j] = NULL; + _gl_copy_visual_to_context_mode( modes, & NullConfig ); + modes->visualID = pVisualNew[j].vid; j++; continue; } -#endif for (k = 0; k < numNewConfigs; k++) { if (pNewVisualConfigs[k].rgba != is_rgb)