summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
diff options
context:
space:
mode:
authorTopi Pohjolainen <topi.pohjolainen@intel.com>2016-02-08 18:13:17 +0200
committerTopi Pohjolainen <topi.pohjolainen@intel.com>2016-05-12 19:49:22 +0300
commita6e0f1cc7fff4009ea204c75d3f8a2f1e26e42ef (patch)
tree2120c9d77f21f9c04bd90f10807ee61ff9920116 /src/mesa/drivers/dri/i965/intel_mipmap_tree.c
parent874c5f05dbc8eca2d14a14f32fdd964808c53b7e (diff)
downloadexternal_mesa3d-a6e0f1cc7fff4009ea204c75d3f8a2f1e26e42ef.zip
external_mesa3d-a6e0f1cc7fff4009ea204c75d3f8a2f1e26e42ef.tar.gz
external_mesa3d-a6e0f1cc7fff4009ea204c75d3f8a2f1e26e42ef.tar.bz2
i965: Add helper for lossless compression support
v2: Check explicitly against base type of GL_FLOAT instead of using _mesa_is_format_integer_color(). Otherwise we miss GL_UNSIGNED_NORMALIZED. v3 (Ben): Also call intel_miptree_supports_non_msrt_fast_clear() in order to really check everything. Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_mipmap_tree.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 1ead43f..86fe07d 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -294,6 +294,32 @@ intel_miptree_is_lossless_compressed(const struct brw_context *brw,
return mt->num_samples <= 1;
}
+bool
+intel_miptree_supports_lossless_compressed(struct brw_context *brw,
+ const struct intel_mipmap_tree *mt)
+{
+ /* For now compression is only enabled for integer formats even though
+ * there exist supported floating point formats also. This is a heuristic
+ * decision based on current public benchmarks. In none of the cases these
+ * formats provided any improvement but a few cases were seen to regress.
+ * Hence these are left to to be enabled in the future when they are known
+ * to improve things.
+ */
+ if (_mesa_get_format_datatype(mt->format) == GL_FLOAT)
+ return false;
+
+ /* Fast clear mechanism and lossless compression go hand in hand. */
+ if (!intel_miptree_supports_non_msrt_fast_clear(brw, mt))
+ return false;
+
+ /* Fast clear can be also used to clear srgb surfaces by using equivalent
+ * linear format. This trick, however, can't be extended to be used with
+ * lossless compression and therefore a check is needed to see if the format
+ * really is linear.
+ */
+ return _mesa_get_srgb_format_linear(mt->format) == mt->format;
+}
+
/**
* Determine depth format corresponding to a depth+stencil format,
* for separate stencil.