From: Jason Ekstrand Date: Fri, 15 Apr 2016 23:36:59 +0000 (-0700) Subject: i965/fs_surface_builder: Take a GL format enum instead of mesa_format X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f310c02b94fba0a0a5ea7f5573f906de823cc5fe;p=mesa.git i965/fs_surface_builder: Take a GL format enum instead of mesa_format Reviewed-by: Chad Versace --- diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index cf4f782aa28..7ef3062a247 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" @@ -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, 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 96731ffac7f..04d1cd220cf 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 a3dd839955b..17318ce2aff 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 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,