summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_bld_type.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_type.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_type.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_type.c b/src/gallium/drivers/llvmpipe/lp_bld_type.c
index e8cf7256c0..8270cd057f 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_type.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_type.c
@@ -161,7 +161,7 @@ lp_build_int_vec_type(struct lp_type type)
* Build int32[4] vector type
*/
LLVMTypeRef
-lp_build_int32_vec4_type()
+lp_build_int32_vec4_type(void)
{
struct lp_type t;
LLVMTypeRef type;
@@ -181,12 +181,31 @@ lp_build_int32_vec4_type()
struct lp_type
lp_int_type(struct lp_type type)
{
- struct lp_type int_type;
+ struct lp_type res_type;
- memset(&int_type, 0, sizeof int_type);
- int_type.width = type.width;
- int_type.length = type.length;
- return int_type;
+ memset(&res_type, 0, sizeof res_type);
+ res_type.width = type.width;
+ res_type.length = type.length;
+
+ return res_type;
+}
+
+
+/**
+ * Return the type with twice the bit width (hence half the number of elements).
+ */
+struct lp_type
+lp_wider_type(struct lp_type type)
+{
+ struct lp_type res_type;
+
+ memcpy(&res_type, &type, sizeof res_type);
+ res_type.width *= 2;
+ res_type.length /= 2;
+
+ assert(res_type.length);
+
+ return res_type;
}