summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-05-20 15:41:20 -0700
committerJason Ekstrand <[email protected]>2016-05-23 19:12:34 -0700
commit35a514e6ff9a33fd5a4a172c7dfa98520e465d36 (patch)
tree6825553cc9745373dc95871851ee77c0a68ebcc2
parent75d10dff0bda6de2a31e26eb8e950adc5fd3994e (diff)
isl: Add support for quering the string name of a format
-rw-r--r--src/intel/isl/isl.h7
-rwxr-xr-xsrc/intel/isl/isl_format_layout_gen.bash3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 71f297174f5..f55fb51c254 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -628,6 +628,7 @@ struct isl_channel_layout {
*/
struct isl_format_layout {
enum isl_format format;
+ const char *name;
uint8_t bs; /**< Block size, in bytes, rounded towards 0 */
uint8_t bw; /**< Block width, in pixels */
@@ -855,6 +856,12 @@ isl_format_get_layout(enum isl_format fmt)
return &isl_format_layouts[fmt];
}
+static inline const char * ATTRIBUTE_CONST
+isl_format_get_name(enum isl_format fmt)
+{
+ return isl_format_layouts[fmt].name;
+}
+
bool isl_format_has_unorm_channel(enum isl_format fmt) ATTRIBUTE_CONST;
bool isl_format_has_snorm_channel(enum isl_format fmt) ATTRIBUTE_CONST;
bool isl_format_has_ufloat_channel(enum isl_format fmt) ATTRIBUTE_CONST;
diff --git a/src/intel/isl/isl_format_layout_gen.bash b/src/intel/isl/isl_format_layout_gen.bash
index 31830815453..e20da5523cd 100755
--- a/src/intel/isl/isl_format_layout_gen.bash
+++ b/src/intel/isl/isl_format_layout_gen.bash
@@ -98,7 +98,8 @@ do
cat <<EOF
[$format] = {
- $format,
+ .format = $format,
+ .name = "$format",
.bs = $((bpb/8)),
.bw = $bw, .bh = $bh, .bd = $bd,
.channels = {