* buffer's content to the main buffer nor for invalidating the aux buffer's
* content.
*/
- irb->mt = intel_miptree_create_for_dri_image(brw, image, GL_TEXTURE_2D);
+ irb->mt = intel_miptree_create_for_dri_image(brw, image, GL_TEXTURE_2D,
+ ISL_COLORSPACE_NONE);
if (!irb->mt)
return;
struct intel_mipmap_tree *
intel_miptree_create_for_dri_image(struct brw_context *brw,
- __DRIimage *image, GLenum target)
+ __DRIimage *image, GLenum target,
+ enum isl_colorspace colorspace)
{
- if (image->planar_format && image->planar_format->nplanes > 0)
+ if (image->planar_format && image->planar_format->nplanes > 0) {
+ assert(colorspace == ISL_COLORSPACE_NONE ||
+ colorspace == ISL_COLORSPACE_YUV);
return miptree_create_for_planar_image(brw, image, target);
+ }
mesa_format format = image->format;
+ switch (colorspace) {
+ case ISL_COLORSPACE_NONE:
+ /* Keep the image format unmodified */
+ break;
+
+ case ISL_COLORSPACE_LINEAR:
+ format =_mesa_get_srgb_format_linear(format);
+ break;
+
+ case ISL_COLORSPACE_SRGB:
+ format =_mesa_get_linear_format_srgb(format);
+ break;
+
+ default:
+ unreachable("Inalid colorspace for non-planar image");
+ }
if (!brw->ctx.TextureFormatSupported[format]) {
/* The texture storage paths in core Mesa detect if the driver does not
struct intel_mipmap_tree *
intel_miptree_create_for_dri_image(struct brw_context *brw,
__DRIimage *image,
- GLenum target);
+ GLenum target,
+ enum isl_colorspace colorspace);
bool
intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,