[gtk+/wip/otte/shader: 31/44] gskspvwriter: Add optimization for access chain
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 31/44] gskspvwriter: Add optimization for access chain
- Date: Thu, 12 Oct 2017 01:00:07 +0000 (UTC)
commit 4e1a29e9038c0e6dd70d6eec5ada1d1df051e95f
Author: Benjamin Otte <otte redhat com>
Date: Tue Oct 10 03:55:45 2017 +0200
gskspvwriter: Add optimization for access chain
A single swizzle can be reduced to an access chain lookup. This is
especially useful during assignments, because it means we don't need to
load the whole vector and OpVectorShuffle it.
gsk/gskspvwriter.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskspvwriter.c b/gsk/gskspvwriter.c
index b971d64..fb1459b 100644
--- a/gsk/gskspvwriter.c
+++ b/gsk/gskspvwriter.c
@@ -749,6 +749,27 @@ gsk_spv_access_chain_swizzle (GskSpvAccessChain *chain,
guint tmp[4];
guint i;
+ if (length == 1)
+ {
+ GskSlValue *value;
+ guint32 new_index;
+
+ if (chain->swizzle_length != 0)
+ new_index = chain->swizzle[indexes[0]];
+ else
+ new_index = indexes[0];
+ chain->swizzle_length = 0;
+
+ value = gsk_sl_value_new_for_data (gsk_sl_type_get_scalar (GSK_SL_UINT),
+ &new_index,
+ NULL, NULL);
+ gsk_spv_access_chain_add_index (chain,
+ gsk_sl_type_get_index_type (chain->type),
+ gsk_spv_writer_get_id_for_value (chain->writer, value));
+ gsk_sl_value_free (value);
+ return;
+ }
+
if (chain->swizzle_length != 0)
{
g_assert (length <= chain->swizzle_length);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]