[gtk+/wip/otte/shader: 32/44] gskslexpression: Add spv writing optimization



commit 050ae326335a79d0ea7893f69574634a52c155b6
Author: Benjamin Otte <otte redhat com>
Date:   Tue Oct 10 04:02:08 2017 +0200

    gskslexpression: Add spv writing optimization
    
    For assignable expressions, we can always use an access chain to query
    the value. Access chains are not just faster, they also contain lots of
    optimizations for merging swizzles and whatnot.

 gsk/gskslexpression.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskslexpression.c b/gsk/gskslexpression.c
index a876616..8d33d6e 100644
--- a/gsk/gskslexpression.c
+++ b/gsk/gskslexpression.c
@@ -2650,5 +2650,16 @@ guint32
 gsk_sl_expression_write_spv (const GskSlExpression *expression,
                              GskSpvWriter          *writer)
 {
+  if (gsk_sl_expression_is_assignable (expression, NULL))
+    {
+      GskSpvAccessChain *chain;
+      guint result_id;
+      
+      chain = gsk_sl_expression_get_spv_access_chain (expression, writer);
+      result_id = gsk_spv_access_chain_load (chain);
+      gsk_spv_access_chain_free (chain);
+      return result_id;
+    }
+
   return expression->class->write_spv (expression, writer);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]