summaryrefslogtreecommitdiff
path: root/hw/xwin
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2016-07-15 15:15:18 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2018-09-25 16:02:09 +0100
commite3398d921be74df9c5d23408f39e70548df896d8 (patch)
tree7430dc8f02a2882129185718f440499d7a17e66c /hw/xwin
parent1fc240c6877e44fc9e6d85837dc2d27e26193291 (diff)
hw/xwin/glx: Add GLX_ARB_framebuffer_sRGB extension
v2: Fix a bogus warning about a missing pixelformat attribute issued for every pixelformat when WGL_ARB_framebuffer_sRGB isn't available 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.c32
-rw-r--r--hw/xwin/glx/indirect.h1
2 files changed, 27 insertions, 6 deletions
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index e9fb3becd..d84713a0d 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -293,11 +293,11 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
return;
ErrorF("%d fbConfigs\n", n);
ErrorF
- ("pxf vis fb render Ste aux accum MS drawable Group/\n");
+ ("pxf vis fb render Ste aux accum MS drawable Group/ sRGB\n");
ErrorF
- ("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat\n");
+ ("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat cap \n");
ErrorF
- ("-----------------------------------------------------------------------------------------------------------------------------\n");
+ ("----------------------------------------------------------------------------------------------------------------------------------\n");
while (c != NULL) {
unsigned int i = ((GLXWinConfig *) c)->pixelFormatIndex;
@@ -317,7 +317,8 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
" %s %s %s "
" %s "
" %s "
- " %d %s"
+ " %d %s "
+ " %s"
"\n",
i, c->visualID, c->fbconfigID,
visual_class_name(c->visualType),
@@ -339,7 +340,8 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
float_col,
(c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
c->visualSelectGroup,
- (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
+ (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ",
+ c->sRGBCapable ? "y" : ".");
c = c->next;
}
@@ -599,6 +601,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
{ "WGL_ARB_create_context_profile", "GLX_ARB_create_context_profile", 0 },
{ "WGL_ARB_create_context_robustness", "GLX_ARB_create_context_robustness", 0 },
{ "WGL_EXT_create_context_es2_profile", "GLX_EXT_create_context_es2_profile", 0 },
+ { "WGL_ARB_framebuffer_sRGB", "GLX_ARB_framebuffer_sRGB", 0 },
};
//
@@ -633,6 +636,10 @@ glxWinScreenProbe(ScreenPtr pScreen)
if (strstr(wgl_extensions, "WGL_ARB_multisample"))
screen->has_WGL_ARB_multisample = TRUE;
+ if (strstr(wgl_extensions, "WGL_ARB_framebuffer_sRGB")) {
+ screen->has_WGL_ARB_framebuffer_sRGB = TRUE;
+ }
+
screen->base.destroy = glxWinScreenDestroy;
screen->base.createContext = glxWinCreateContext;
screen->base.createDrawable = glxWinCreateDrawable;
@@ -1753,6 +1760,9 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
}
+ if (winScreen->has_WGL_ARB_framebuffer_sRGB)
+ SET_ATTR_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, TRUE);
+
SET_ATTR_VALUE(0, 0); // terminator
/* choose the first match */
@@ -2114,6 +2124,11 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB);
}
+ if (screen->has_WGL_ARB_framebuffer_sRGB) {
+ // we may not query these attrs if WGL_ARB_framebuffer_sRGB is not offered
+ ADD_ATTR(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
+ }
+
/* fill in configs */
for (i = 0; i < numConfigs; i++) {
int values[num_attrs];
@@ -2376,7 +2391,12 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
GLX_TEXTURE_RECTANGLE_BIT_EXT;
c->base.yInverted = -1;
- c->base.sRGBCapable = 0;
+
+ /* WGL_ARB_framebuffer_sRGB */
+ if (screen->has_WGL_ARB_framebuffer_sRGB)
+ c->base.sRGBCapable = ATTR_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, 0);
+ else
+ c->base.sRGBCapable = 0;
n++;
diff --git a/hw/xwin/glx/indirect.h b/hw/xwin/glx/indirect.h
index bcdef153a..c32ce7894 100644
--- a/hw/xwin/glx/indirect.h
+++ b/hw/xwin/glx/indirect.h
@@ -69,6 +69,7 @@ struct __GLXWinScreen {
Bool has_WGL_ARB_pbuffer;
Bool has_WGL_ARB_render_texture;
Bool has_WGL_ARB_make_current_read;
+ Bool has_WGL_ARB_framebuffer_sRGB;
/* wrapped screen functions */
RealizeWindowProcPtr RealizeWindow;