summaryrefslogtreecommitdiff
path: root/hw
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>2016-11-17 13:15:44 +0000
commitdf04e6bef49c464cf192e49a6acaa32d077f6913 (patch)
tree8ad650fc4f4ce04242502132fd5475d631632a0c /hw
parent57639bf77dc2621d8a43c9e01b84b5ea8b3e3a7a (diff)
hw/xwin/glx: Add GLX_ARB_framebuffer_sRGB extension
Diffstat (limited to 'hw')
-rw-r--r--hw/xwin/glx/indirect.c29
-rw-r--r--hw/xwin/glx/indirect.h1
2 files changed, 24 insertions, 6 deletions
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 0f00b8658..d5af44b97 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -304,11 +304,11 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects)
return;
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;
@@ -328,7 +328,8 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects)
" %s %s %s "
" %s "
" %s "
- " %d %s"
+ " %d %s "
+ " %s"
"\n",
i, c->visualID, c->fbconfigID,
visual_class_name(c->visualType),
@@ -350,7 +351,8 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects)
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;
}
@@ -703,6 +705,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 },
};
//
@@ -737,6 +740,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;
@@ -1870,6 +1877,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 */
@@ -2234,6 +2244,11 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen, PixelFormatRejectStats *
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];
@@ -2517,7 +2532,9 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen, PixelFormatRejectStats *
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 */
+ c->base.sRGBCapable = ATTR_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, 0);
n++;
diff --git a/hw/xwin/glx/indirect.h b/hw/xwin/glx/indirect.h
index 8a66121ac..1653896a8 100644
--- a/hw/xwin/glx/indirect.h
+++ b/hw/xwin/glx/indirect.h
@@ -72,6 +72,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;