[Mesa-dev] [PATCH 29/31] i965: Define brw_int_type() helper.
Francisco Jerez
currojerez at riseup.net
Sat May 21 05:48:04 UTC 2016
Intended as a (partial) inverse of type_sz(). Will be useful in the
next commit and some other SIMD32 generator changes I have queued up.
---
src/mesa/drivers/dri/i965/brw_reg.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
index 71e1024..1ed0f4f 100644
--- a/src/mesa/drivers/dri/i965/brw_reg.h
+++ b/src/mesa/drivers/dri/i965/brw_reg.h
@@ -304,6 +304,26 @@ type_sz(unsigned type)
}
/**
+ * Return an integer type of the requested size and signedness.
+ */
+static inline enum brw_reg_type
+brw_int_type(unsigned sz, bool is_signed)
+{
+ switch (sz) {
+ case 1:
+ return (is_signed ? BRW_REGISTER_TYPE_B : BRW_REGISTER_TYPE_UB);
+ case 2:
+ return (is_signed ? BRW_REGISTER_TYPE_W : BRW_REGISTER_TYPE_UW);
+ case 4:
+ return (is_signed ? BRW_REGISTER_TYPE_D : BRW_REGISTER_TYPE_UD);
+ case 8:
+ return (is_signed ? BRW_REGISTER_TYPE_Q : BRW_REGISTER_TYPE_UQ);
+ default:
+ unreachable("Not reached.");
+ }
+}
+
+/**
* Construct a brw_reg.
* \param file one of the BRW_x_REGISTER_FILE values
* \param nr register number/index
--
2.7.3
More information about the mesa-dev
mailing list