*
* Unfortunately, renderbuffer setup happens before a context is created. So
* in intel_screen.c we always set up sRGB, and here, if you're a GLES2/3
- * context (without an sRGB visual, though we don't have sRGB visuals exposed
- * yet), we go turn that back off before anyone finds out.
+ * context (without an sRGB visual), we go turn that back off before anyone
+ * finds out.
*/
static void
intel_gles3_srgb_workaround(struct brw_context *brw,
if (_mesa_is_desktop_gl(ctx) || !fb->Visual.sRGBCapable)
return;
- /* Some day when we support the sRGB capable bit on visuals available for
- * GLES, we'll need to respect that and not disable things here.
- */
- fb->Visual.sRGBCapable = false;
for (int i = 0; i < BUFFER_COUNT; i++) {
struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
+
+ /* Check if sRGB was specifically asked for. */
+ struct intel_renderbuffer *irb = intel_get_renderbuffer(fb, i);
+ if (irb && irb->need_srgb)
+ return;
+
if (rb)
rb->Format = _mesa_get_srgb_format_linear(rb->Format);
}
+ /* Disable sRGB from framebuffers that are not compatible. */
+ fb->Visual.sRGBCapable = false;
}
GLboolean
0, BRW_CONTEXT_MEDIUM_PRIORITY) == 0)
value[0] |= __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_MEDIUM;
return 0;
+ case __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB:
+ value[0] = 1;
+ return 0;
default:
return driQueryRendererIntegerCommon(dri_screen, param, value);
}
fb->Visual.sRGBCapable = true;
}
+ /* mesaVis->sRGBCapable was set, user is asking for sRGB */
+ bool srgb_cap_set = mesaVis->redBits >= 8 && mesaVis->sRGBCapable;
+
/* setup the hardware-based renderbuffers */
rb = intel_create_winsys_renderbuffer(screen, rgbFormat, num_samples);
_mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
+ rb->need_srgb = srgb_cap_set;
if (mesaVis->doubleBufferMode) {
rb = intel_create_winsys_renderbuffer(screen, rgbFormat, num_samples);
_mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
+ rb->need_srgb = srgb_cap_set;
}
/*
MESA_FORMAT_B8G8R8A8_UNORM,
MESA_FORMAT_B8G8R8X8_UNORM,
+ MESA_FORMAT_B8G8R8A8_SRGB,
+
/* The 32-bit RGBA format must not precede the 32-bit BGRA format.
* Likewise for RGBX and BGRX. Otherwise, the GLX client and the GLX
* server may disagree on which format the GLXFBConfig represents,
if (intel_loader_get_cap(dri_screen, DRI_LOADER_CAP_RGBA_ORDERING))
num_formats = ARRAY_SIZE(formats);
else
- num_formats = 3;
+ num_formats = ARRAY_SIZE(formats) - 2; /* all - RGBA_ORDERING formats */
/* Generate singlesample configs without accumulation buffer. */
for (unsigned i = 0; i < num_formats; i++) {