summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-04-16 13:25:24 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-04-21 20:44:27 -0700
commit541e6c05000b87cee02d5f8e1adc7973c2a2deea (patch)
tree1e7cb661c9248a66b03ba5ab313cd6c9754308f7 /src/mesa/drivers/dri/i965/brw_wm_surface_state.c
parente53cabe730ca5d4491a34fd1d385face3100f5bb (diff)
downloadexternal_mesa3d-541e6c05000b87cee02d5f8e1adc7973c2a2deea.zip
external_mesa3d-541e6c05000b87cee02d5f8e1adc7973c2a2deea.tar.gz
external_mesa3d-541e6c05000b87cee02d5f8e1adc7973c2a2deea.tar.bz2
i965/surface_state: Use libisl functions for image format lowering
This lets us delete some redundant code and keep all of the image_load_store format lowering logic in one place: libisl. Reviewed-by: Chad Versace <chad.versace@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm_surface_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 218afab..f88c43b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -39,6 +39,8 @@
#include "program/prog_instruction.h"
#include "main/framebuffer.h"
+#include "isl/isl.h"
+
#include "intel_mipmap_tree.h"
#include "intel_batchbuffer.h"
#include "intel_tex.h"
@@ -1168,20 +1170,21 @@ const struct brw_tracked_state brw_cs_image_surfaces = {
static uint32_t
get_image_format(struct brw_context *brw, mesa_format format, GLenum access)
{
+ const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
+ uint32_t hw_format = brw_format_for_mesa_format(format);
if (access == GL_WRITE_ONLY) {
- return brw_format_for_mesa_format(format);
- } else {
+ return hw_format;
+ } else if (isl_has_matching_typed_storage_image_format(devinfo, hw_format)) {
/* Typed surface reads support a very limited subset of the shader
* image formats. Translate it into the closest format the
* hardware supports.
*/
- if ((_mesa_get_format_bytes(format) >= 16 && brw->gen <= 8) ||
- (_mesa_get_format_bytes(format) >= 8 &&
- (brw->gen == 7 && !brw->is_haswell)))
- return BRW_SURFACEFORMAT_RAW;
- else
- return brw_format_for_mesa_format(
- brw_lower_mesa_image_format(brw->intelScreen->devinfo, format));
+ return isl_lower_storage_image_format(devinfo, hw_format);
+ } else {
+ /* The hardware doesn't actually support a typed format that we can use
+ * so we have to fall back to untyped read/write messages.
+ */
+ return BRW_SURFACEFORMAT_RAW;
}
}