diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 504945c6984..cf4e2a5ef3f 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -1442,6 +1442,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate) img->level = image->level; img->layer = image->layer; img->dri_format = image->dri_format; + img->internal_format = image->internal_format; /* This should be 0 for sub images, but dup is also used for base images. */ img->dri_components = image->dri_components; img->use = image->use; diff --git a/src/gallium/frontends/dri/dri_helpers.c b/src/gallium/frontends/dri/dri_helpers.c index b158808c792..a399d7bf805 100644 --- a/src/gallium/frontends/dri/dri_helpers.c +++ b/src/gallium/frontends/dri/dri_helpers.c @@ -312,6 +312,7 @@ dri2_create_image_from_renderbuffer2(__DRIcontext *context, } img->dri_format = driGLFormatToImageFormat(rb->Format); + img->internal_format = rb->InternalFormat; img->loader_private = loaderPrivate; img->sPriv = context->driScreenPriv; img->in_fence_fd = -1; @@ -416,6 +417,7 @@ dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture, img->layer = depth; img->in_fence_fd = -1; img->dri_format = driGLFormatToImageFormat(obj->Image[face][level]->TexFormat); + img->internal_format = obj->Image[face][level]->InternalFormat; img->loader_private = loaderPrivate; img->sPriv = context->driScreenPriv; diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c index ffc5a50adeb..fe232baad70 100644 --- a/src/gallium/frontends/dri/dri_screen.c +++ b/src/gallium/frontends/dri/dri_screen.c @@ -745,6 +745,8 @@ dri_get_egl_image(struct st_manager *smapi, */ mesa_format mesa_format = driImageFormatToGLFormat(map->dri_format); stimg->internalformat = driGLFormatToSizedInternalGLFormat(mesa_format); + } else { + stimg->internalformat = img->internal_format; } stimg->yuv_color_space = img->yuv_color_space; diff --git a/src/gallium/frontends/dri/dri_screen.h b/src/gallium/frontends/dri/dri_screen.h index e01eb3d7960..36b135fc114 100644 --- a/src/gallium/frontends/dri/dri_screen.h +++ b/src/gallium/frontends/dri/dri_screen.h @@ -117,6 +117,10 @@ struct __DRIimageRec { uint32_t dri_format; uint32_t dri_fourcc; uint32_t dri_components; + /* Provided by eglCreateImageKHR if creating from a + * texture or a renderbuffer. 0 otherwise. + */ + uint32_t internal_format; unsigned use; unsigned plane;