[Mesa-dev] [PATCH 30/64] anv, isl: Lower storage image formats in anv

Jason Ekstrand jason at jlekstrand.net
Sat Jun 11 16:02:45 UTC 2016


ISL was being a bit too clever for its own good and lowering the format for
us.  This is all well and good *if* we always want to lower it.  However,
the GL driver selectively lowers the format depending on whether the
surface is write-only or not.
---
 src/intel/isl/isl_surface_state.c | 8 +-------
 src/intel/vulkan/anv_image.c      | 3 +++
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index 4c6563a..fb3fd99 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -190,13 +190,7 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
    struct GENX(RENDER_SURFACE_STATE) s = { 0 };
 
    s.SurfaceType = get_surftype(info->surf->dim, info->view->usage);
-
-   if (info->view->usage & ISL_SURF_USAGE_STORAGE_BIT) {
-      s.SurfaceFormat =
-         isl_lower_storage_image_format(dev->info, info->view->format);
-   } else {
-      s.SurfaceFormat = info->view->format;
-   }
+   s.SurfaceFormat = info->view->format;
 
 #if GEN_IS_HASWELL
    s.IntegerSurfaceFormat = isl_format_has_int_channel(s.SurfaceFormat);
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 208e377..77d9931 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -537,12 +537,15 @@ anv_image_view_init(struct anv_image_view *iview,
       iview->color_rt_surface_state.alloc_size = 0;
    }
 
+   /* NOTE: This one needs to go last since it may stomp isl_view.format */
    if (image->usage & usage_mask & VK_IMAGE_USAGE_STORAGE_BIT) {
       iview->storage_surface_state = alloc_surface_state(device, cmd_buffer);
 
       if (isl_has_matching_typed_storage_image_format(&device->info,
                                                       format.isl_format)) {
          isl_view.usage = cube_usage | ISL_SURF_USAGE_STORAGE_BIT;
+         isl_view.format = isl_lower_storage_image_format(&device->info,
+                                                          isl_view.format);
          isl_surf_fill_state(&device->isl_dev,
                              iview->storage_surface_state.map,
                              .surf = &surface->isl,
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list