[gtk+/wip/otte/shader: 259/269] gsksl: Add a special case for vector-to-vector casts
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 259/269] gsksl: Add a special case for vector-to-vector casts
- Date: Tue, 24 Oct 2017 06:12:24 +0000 (UTC)
commit cad3271a4f94a186b4c67d1c7f09c21f93bd5e63
Author: Benjamin Otte <otte redhat com>
Date: Sun Oct 22 18:20:14 2017 +0200
gsksl: Add a special case for vector-to-vector casts
We don't have to extract all components and fold them back together if
the vectors already have the same size. Just cast them.
gsk/gskslexpression.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskslexpression.c b/gsk/gskslexpression.c
index dfb15ec..c99f8f4 100644
--- a/gsk/gskslexpression.c
+++ b/gsk/gskslexpression.c
@@ -978,6 +978,12 @@ gsk_sl_expression_constructor_write_spv (const GskSlExpression *expression,
}
return gsk_spv_writer_composite_construct (writer, type, ids, cols);
}
+ else if (constructor->n_arguments == 1 && gsk_sl_type_is_vector (type) && gsk_sl_type_is_vector
(value_type)
+ && gsk_sl_type_get_length (type) == gsk_sl_type_get_length (value_type))
+ {
+ value_id = gsk_sl_expression_write_spv (constructor->arguments[0], writer);
+ return gsk_spv_writer_convert (writer, value_id, value_type, type);
+ }
else
{
gsize n_components = gsk_sl_type_get_n_components (type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]