[Mesa-dev] [PATCH 6/7] i965/fs_surface_builder: Work in terms of native formats
Jason Ekstrand
jason at jlekstrand.net
Wed Nov 4 17:03:55 PST 2015
---
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 7 ++++---
src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp | 14 ++++++--------
src/mesa/drivers/dri/i965/brw_fs_surface_builder.h | 4 ++--
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 24ff5af..95e003c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -31,6 +31,7 @@
#include "brw_nir.h"
#include "brw_fs_surface_builder.h"
#include "brw_vec4_gs_visitor.h"
+#include "brw_image_load_store.h"
using namespace brw;
using namespace brw::surface_access;
@@ -1290,9 +1291,9 @@ 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 uint32_t format =
+ (var->data.image.write_only ? BRW_SURFACEFORMAT_RAW :
+ brw_image_format_for_gl_format(var->data.image.format));
/* Get the arguments of the image intrinsic. */
const fs_reg image = get_nir_image_deref(instr->variables[0]);
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 d841ffe..27af607 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
@@ -463,7 +463,7 @@ namespace {
* reads want the array index to be at the Z component.
*/
const bool array_index_at_z =
- format != MESA_FORMAT_NONE &&
+ brw_format != BRW_SURFACEFORMAT_RAW &&
!image_format_info::has_matching_typed_format(
bld.shader->devinfo, brw_format);
const unsigned zero_dims =
@@ -947,7 +947,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 mformat)
+ uint32_t format)
{
using namespace image_format_info;
using namespace image_format_conversion;
@@ -955,7 +955,6 @@ namespace brw {
using namespace image_coordinates;
using namespace surface_access;
const brw_device_info *devinfo = bld.shader->devinfo;
- const uint32_t format = brw_format_for_mesa_format(mformat);
const uint32_t lower_format = brw_lower_image_format(devinfo, format);
fs_reg tmp;
@@ -1055,7 +1054,7 @@ 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 mformat)
+ uint32_t format)
{
using namespace image_format_info;
using namespace image_format_conversion;
@@ -1063,7 +1062,6 @@ namespace brw {
using namespace image_coordinates;
using namespace surface_access;
const brw_device_info *devinfo = bld.shader->devinfo;
- uint32_t format = brw_format_for_mesa_format(mformat);
/* Transform the image coordinates into actual surface coordinates. */
const fs_reg saddr =
@@ -1071,7 +1069,7 @@ namespace brw {
const unsigned dims =
num_image_coordinates(bld, surf_dims, arr_dims, format);
- if (format == MESA_FORMAT_NONE) {
+ if (format == BRW_SURFACEFORMAT_RAW) {
/* We don't know what the format is, but that's fine because it
* implies write-only access, and typed surface writes are always
* able to take care of type conversion and packing for us.
@@ -1167,10 +1165,10 @@ namespace brw {
/* Transform the image coordinates into actual surface coordinates. */
const fs_reg saddr =
emit_image_coordinates(bld, addr, surf_dims, arr_dims,
- MESA_FORMAT_R_UINT32);
+ BRW_SURFACEFORMAT_R32_UINT);
const unsigned dims =
num_image_coordinates(bld, surf_dims, arr_dims,
- MESA_FORMAT_R_UINT32);
+ BRW_SURFACEFORMAT_R32_UINT);
/* Thankfully we can do without untyped atomics here. */
const fs_reg tmp = emit_typed_atomic(bld, image, saddr, src0, src1,
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..7f5c69b 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);
+ uint32_t brw_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);
+ uint32_t brw_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