[gtk+/wip/otte/shader: 84/98] gsksl: Allow an optional access qualifier of -1



commit 60a4f1918a23c0aa17278965e595a16824398139
Author: Benjamin Otte <otte redhat com>
Date:   Wed Oct 18 05:37:53 2017 +0200

    gsksl: Allow an optional access qualifier of -1
    
    Use this to mark optional access qualifiers as "do not write". For now
    this is a good enough way to not write out access qualifiers, which is
    disallowed in GLSL shaders.

 gsk/gskspvwritergeneratedprivate.h |    3 ++-
 gsk/spirv.js                       |    2 ++
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gsk/gskspvwritergeneratedprivate.h b/gsk/gskspvwritergeneratedprivate.h
index 469ba56..bad2cae 100644
--- a/gsk/gskspvwritergeneratedprivate.h
+++ b/gsk/gskspvwritergeneratedprivate.h
@@ -411,7 +411,8 @@ gsk_spv_writer_type_image (GskSpvWriter *writer,
   g_array_append_val (bytes, ms);
   g_array_append_val (bytes, sampled);
   g_array_append_val (bytes, (guint32) { image_format });
-  g_array_append_val (bytes, (guint32) { opt_access_qualifier });
+  if (opt_access_qualifier != -1)
+    g_array_append_val (bytes, (guint32) { opt_access_qualifier });
   g_array_index (bytes, guint32, start_index) = (bytes->len - start_index) << 16 | GSK_SPV_OP_TYPE_IMAGE;
 
   return result_id;
diff --git a/gsk/spirv.js b/gsk/spirv.js
index acef648..a6eb89b 100644
--- a/gsk/spirv.js
+++ b/gsk/spirv.js
@@ -475,6 +475,8 @@ for (let kind in spirv.operand_kinds)
                                 append_one: "g_array_append_val ({0}, (guint32) { {1} })" };
         if (kind.category == "BitEnum")
           Operands[kind.kind].optional_unset = "0";
+        if (kind.kind == "AccessQualifier")
+          Operands[kind.kind].optional_unset = "-1";
       }
   }
 


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