[Mesa-dev] [PATCH 13/30] i965/miptree: Add an explicit format parameter to create_for_dri_image

Jason Ekstrand jason at jlekstrand.net
Fri Jun 16 22:41:35 UTC 2017


---
 src/mesa/drivers/dri/i965/intel_fbo.c         | 3 ++-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 7 ++++---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 3 ++-
 src/mesa/drivers/dri/i965/intel_tex_image.c   | 3 ++-
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index f1a997b..130eab1 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -362,7 +362,8 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
     * 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,
+                                                image->format);
    if (!irb->mt)
       return;
 
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 08c13fc..7b4d431 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -900,12 +900,13 @@ miptree_create_for_planar_image(struct brw_context *brw,
 
 struct intel_mipmap_tree *
 intel_miptree_create_for_dri_image(struct brw_context *brw,
-                                   __DRIimage *image, GLenum target)
+                                   __DRIimage *image, GLenum target,
+                                   mesa_format format)
 {
    if (image->planar_format && image->planar_format->nplanes > 0)
       return miptree_create_for_planar_image(brw, image, target);
 
-   if (!brw->ctx.TextureFormatSupported[image->format])
+   if (!brw->ctx.TextureFormatSupported[format])
       return NULL;
 
    /* Disable creation of the texture's aux buffers because the driver exposes
@@ -914,7 +915,7 @@ intel_miptree_create_for_dri_image(struct brw_context *brw,
     * content.
     */
    struct intel_mipmap_tree *mt =
-      intel_miptree_create_for_bo(brw, image->bo, image->format,
+      intel_miptree_create_for_bo(brw, image->bo, format,
                                   image->offset, image->width, image->height, 1,
                                   image->pitch,
                                   MIPTREE_LAYOUT_DISABLE_AUX);
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 7b702a3..8044a1b 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -699,7 +699,8 @@ intel_miptree_create_for_bo(struct brw_context *brw,
 struct intel_mipmap_tree *
 intel_miptree_create_for_dri_image(struct brw_context *brw,
                                    __DRIimage *image,
-                                   GLenum target);
+                                   GLenum target,
+                                   mesa_format format);
 
 bool
 intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index 580e3b2..76a6e13 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -343,7 +343,8 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
       return;
    }
 
-   mt = intel_miptree_create_for_dri_image(brw, image, target);
+   mt = intel_miptree_create_for_dri_image(brw, image, target,
+                                           image->format);
    if (mt == NULL)
       return;
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list