i965/fs_surface_builder: Take a GL format enum instead of mesa_format
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 15 Apr 2016 23:36:59 +0000 (16:36 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 22 Apr 2016 03:44:27 +0000 (20:44 -0700)
Reviewed-by: Chad Versace <chad.versace@intel.com>
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
src/mesa/drivers/dri/i965/brw_fs_surface_builder.h

index cf4f782aa2887860169d2b158e33b91c527bde54..7ef3062a247804a74633eeb70f46fe351f228ee8 100644 (file)
@@ -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"
@@ -2559,9 +2558,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]);
@@ -2580,7 +2577,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,
index 96731ffac7f52b790be2534bac628e59e45a63c4..04d1cd220cf416814ae5eab27be19886146b9ae6 100644 (file)
@@ -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. */
index a3dd839955bb84dd82567f778e7ca19c41dc545d..17318ce2afff55b0647238dc5f170c7cf91acf60 100644 (file)
@@ -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 gl_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 gl_format);
       fs_reg
       emit_image_atomic(const fs_builder &bld,
                         const fs_reg &image, const fs_reg &addr,