summaryrefslogtreecommitdiff
path: root/src/intel/isl/isl_format.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-08-06 09:11:10 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-08-08 11:13:44 -0700
commit21d5c1be6a334b924ac3dcedbdc35285e0c1ba16 (patch)
tree99e195f7a6e6ccba89d8ac92f028141b0e42773f /src/intel/isl/isl_format.c
parentce980541d5dc9b114c3aa69b3560fcb6023ccf32 (diff)
isl: Add a helper for getting a depth format from an isl_format
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/intel/isl/isl_format.c')
-rw-r--r--src/intel/isl/isl_format.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
index e0b91bb05c0..ef1324c370a 100644
--- a/src/intel/isl/isl_format.c
+++ b/src/intel/isl/isl_format.c
@@ -476,6 +476,30 @@ isl_format_get_num_channels(enum isl_format fmt)
(fmtl->channels.i.bits > 0);
}
+uint32_t
+isl_format_get_depth_format(enum isl_format fmt, bool has_stencil)
+{
+ switch (fmt) {
+ default:
+ unreachable("bad isl depth format");
+ case ISL_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ assert(has_stencil);
+ return 0; /* D32_FLOAT_S8X24_UINT */
+ case ISL_FORMAT_R32_FLOAT:
+ assert(!has_stencil);
+ return 1; /* D32_FLOAT */
+ case ISL_FORMAT_R24_UNORM_X8_TYPELESS:
+ if (has_stencil) {
+ return 2; /* D24_UNORM_S8_UINT */
+ } else {
+ return 3; /* D24_UNORM_X8_UINT */
+ }
+ case ISL_FORMAT_R16_UNORM:
+ assert(!has_stencil);
+ return 5; /* D16_UNORM */
+ }
+}
+
enum isl_format
isl_format_rgb_to_rgba(enum isl_format rgb)
{