[Mesa-dev] [PATCH 10/13] i965/fs_surface_builder: Take a GL format enum instead of mesa_format

Jason Ekstrand jason at jlekstrand.net
Sat Apr 16 19:45:18 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp             | 8 +++-----
 src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp | 7 +++++--
 src/mesa/drivers/dri/i965/brw_fs_surface_builder.h   | 4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index e775049..aa1d39b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -22,7 +22,6 @@
  */
 
 #include "compiler/glsl/ir.h"
-#include "main/shaderimage.h"
 #include "brw_fs.h"
 #include "brw_fs_surface_builder.h"
 #include "brw_nir.h"
@@ -2545,9 +2544,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
       const nir_intrinsic_info *info = &nir_intrinsic_infos[instr->intrinsic];
       const unsigned arr_dims = type->sampler_array ? 1 : 0;
       const unsigned surf_dims = type->coordinate_components() - arr_dims;
-      const mesa_format format =
-         (var->data.image.write_only ? MESA_FORMAT_NONE :
-          _mesa_get_shader_image_format(var->data.image.format));
+      const unsigned format = var->data.image.format;
 
       /* Get the arguments of the image intrinsic. */
       const fs_reg image = get_nir_image_deref(instr->variables[0]);
@@ -2566,7 +2563,8 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
          tmp = emit_image_load(bld, image, addr, surf_dims, arr_dims, format);
 
       else if (instr->intrinsic == nir_intrinsic_image_store)
-         emit_image_store(bld, image, addr, src0, surf_dims, arr_dims, format);
+         emit_image_store(bld, image, addr, src0, surf_dims, arr_dims,
+                          var->data.image.write_only ? GL_NONE : format);
 
       else
          tmp = emit_image_atomic(bld, image, addr, src0, src1,
diff --git a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
index 96731ff..04d1cd2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
@@ -21,6 +21,7 @@
  * IN THE SOFTWARE.
  */
 
+#include "main/shaderimage.h"
 #include "brw_fs_surface_builder.h"
 #include "brw_fs.h"
 
@@ -911,7 +912,7 @@ namespace brw {
       emit_image_load(const fs_builder &bld,
                       const fs_reg &image, const fs_reg &addr,
                       unsigned surf_dims, unsigned arr_dims,
-                      mesa_format format)
+                      unsigned gl_format)
       {
          using namespace image_format_info;
          using namespace image_format_conversion;
@@ -919,6 +920,7 @@ namespace brw {
          using namespace image_coordinates;
          using namespace surface_access;
          const brw_device_info *devinfo = bld.shader->devinfo;
+         const mesa_format format = _mesa_get_shader_image_format(gl_format);
          const mesa_format lower_format =
             brw_lower_mesa_image_format(devinfo, format);
          fs_reg tmp;
@@ -1019,13 +1021,14 @@ namespace brw {
       emit_image_store(const fs_builder &bld, const fs_reg &image,
                        const fs_reg &addr, const fs_reg &src,
                        unsigned surf_dims, unsigned arr_dims,
-                       mesa_format format)
+                       unsigned gl_format)
       {
          using namespace image_format_info;
          using namespace image_format_conversion;
          using namespace image_validity;
          using namespace image_coordinates;
          using namespace surface_access;
+         const mesa_format format = _mesa_get_shader_image_format(gl_format);
          const brw_device_info *devinfo = bld.shader->devinfo;
 
          /* Transform the image coordinates into actual surface coordinates. */
diff --git a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.h b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.h
index a3dd839..4186cbe 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.h
+++ b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.h
@@ -71,13 +71,13 @@ namespace brw {
       emit_image_load(const fs_builder &bld,
                       const fs_reg &image, const fs_reg &addr,
                       unsigned surf_dims, unsigned arr_dims,
-                      mesa_format format);
+                      unsigned format);
 
       void
       emit_image_store(const fs_builder &bld, const fs_reg &image,
                        const fs_reg &addr, const fs_reg &src,
                        unsigned surf_dims, unsigned arr_dims,
-                       mesa_format format);
+                       unsigned format);
       fs_reg
       emit_image_atomic(const fs_builder &bld,
                         const fs_reg &image, const fs_reg &addr,
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list