diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2016-07-15 14:06:32 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-09-25 16:02:09 +0100 |
commit | 67b47d50dfb5f7a994ae44708d1b1ef1c42537b5 (patch) | |
tree | d535aec58be85c5e21d62fd7193c2af3f1f87e59 /hw/xwin | |
parent | 6be9681eb9eb6645b19c09f7b3b6d5b5bef8866d (diff) |
hw/xwin/glx: Add support for float format fbconfig GLX extensions
v2:
Set renderType more correctly
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Diffstat (limited to 'hw/xwin')
-rw-r--r-- | hw/xwin/glx/indirect.c | 96 |
1 files changed, 63 insertions, 33 deletions
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 59257362a..1ab326b46 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -302,6 +302,10 @@ fbConfigsDump(unsigned int n, __GLXconfig * c) while (c != NULL) { unsigned int i = ((GLXWinConfig *) c)->pixelFormatIndex; + const char *float_col = "."; + if (c->renderType & GLX_RGBA_FLOAT_BIT_ARB) float_col = "s"; + if (c->renderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT) float_col = "u"; + ErrorF("%3d %3x %3x " "%-11s" " %3d %3d %s %s %s %s %s " @@ -332,8 +336,7 @@ fbConfigsDump(unsigned int n, __GLXconfig * c) (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".", (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".", (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", - (c->renderType & (GLX_RGBA_FLOAT_BIT_ARB | - GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) ? "y" : ".", + float_col, (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".", c->visualSelectGroup, (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " "); @@ -590,6 +593,8 @@ glxWinScreenProbe(ScreenPtr pScreen) { "WGL_ARB_pbuffer", "GLX_SGIX_pbuffer", 1 }, { "WGL_ARB_multisample", "GLX_ARB_multisample", 1 }, { "WGL_ARB_multisample", "GLX_SGIS_multisample", 0 }, + { "WGL_ARB_pixel_format_float", "GLX_ARB_fbconfig_float", 0 }, + { "WGL_EXT_pixel_format_packed_float", "GLX_EXT_fbconfig_packed_float", 0 }, }; // @@ -1664,13 +1669,34 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode, int attribList[60]; SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE); - SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, - (mode->visualType == - GLX_TRUE_COLOR) ? WGL_TYPE_RGBA_ARB : - WGL_TYPE_COLORINDEX_ARB); - SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, - (mode->visualType == - GLX_TRUE_COLOR) ? mode->rgbBits : mode->indexBits); + + switch (mode->renderType) + { + case GLX_COLOR_INDEX_BIT: + case GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT: + SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, WGL_TYPE_COLORINDEX_ARB); + SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, mode->indexBits); + break; + + default: + ErrorF("unexpected renderType %x\n", mode->renderType); + /* fall-through */ + case GLX_RGBA_BIT: + SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB); + SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, mode->rgbBits); + break; + + case GLX_RGBA_FLOAT_BIT_ARB: + SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_FLOAT_ARB); + SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, mode->rgbBits); + break; + + case GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT: + SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT); + SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, mode->rgbBits); + break; + } + SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits); SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits); SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits); @@ -2138,23 +2164,42 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen) c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); c->base.rgbBits = 0; c->base.visualType = GLX_STATIC_COLOR; + c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT; + + /* + Assume RGBA rendering is available on all single-channel visuals + (it is specified to render to red component in single-channel + visuals, if supported, but there doesn't seem to be any mechanism + to check if it is supported) + + Color index rendering is only supported on single-channel visuals + */ + + break; + + case WGL_TYPE_RGBA_ARB: + c->base.indexBits = 0; + c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); + c->base.visualType = GLX_TRUE_COLOR; + c->base.renderType = GLX_RGBA_BIT; break; case WGL_TYPE_RGBA_FLOAT_ARB: - GLWIN_DEBUG_MSG - ("pixelFormat %d is WGL_TYPE_RGBA_FLOAT_ARB, skipping", i + 1); - continue; + c->base.indexBits = 0; + c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); + c->base.visualType = GLX_TRUE_COLOR; + c->base.renderType = GLX_RGBA_FLOAT_BIT_ARB; + // assert pbuffer drawable + // assert WGL_ARB_pixel_format_float + break; case WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT: - GLWIN_DEBUG_MSG - ("pixelFormat %d is WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT, skipping", - i + 1); - continue; - - case WGL_TYPE_RGBA_ARB: c->base.indexBits = 0; c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); c->base.visualType = GLX_TRUE_COLOR; + c->base.renderType = GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT; + // assert pbuffer drawable + // assert WGL_EXT_pixel_format_packed_float break; default: @@ -2252,21 +2297,6 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen) | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0) | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0)); - /* - Assume OpenGL RGBA rendering is available on all visuals - (it is specified to render to red component in single-channel visuals, - if supported, but there doesn't seem to be any mechanism to check if it - is supported) - - Color index rendering is only supported on single-channel visuals - */ - if (c->base.visualType == GLX_STATIC_COLOR) { - c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT; - } - else { - c->base.renderType = GLX_RGBA_BIT; - } - c->base.fbconfigID = -1; // will be set by __glXScreenInit() /* SGIX_pbuffer / GLX 1.3 */ |