Mesa (main): microsoft/compiler: Remove de-duplication of arbitrary semantic names

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 24 20:25:10 UTC 2021


Module: Mesa
Branch: main
Commit: b8e2374950345f2b7b9a899d5a4c1ba40997f033
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8e2374950345f2b7b9a899d5a4c1ba40997f033

Author: Enrico Galli <enrico.galli at intel.com>
Date:   Wed Jun 23 19:25:14 2021 -0700

microsoft/compiler: Remove de-duplication of arbitrary semantic names

Since DXC doesn't perform de-duplication for arbitrary semantic names,
and the DXIL validator checks against this behavior. We need to remove
the de-duplication.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

---

 src/microsoft/compiler/dxil_container.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/microsoft/compiler/dxil_container.c b/src/microsoft/compiler/dxil_container.c
index 94a1d49da41..e8373fb93ab 100644
--- a/src/microsoft/compiler/dxil_container.c
+++ b/src/microsoft/compiler/dxil_container.c
@@ -91,16 +91,20 @@ static uint32_t
 get_semantic_name_offset(name_offset_cache_t *cache, const char *name,
                          struct _mesa_string_buffer *buf, uint32_t buf_offset)
 {
-   /* consider replacing this with a binary search using rb_tree */
-   for (unsigned i = 0; i < cache->num_entries; ++i) {
-      if (!strcmp(name, cache->entries[i].name))
-         return cache->entries[i].offset;
-   }
-
    uint32_t offset = buf->length + buf_offset;
-   cache->entries[cache->num_entries].name = name;
-   cache->entries[cache->num_entries].offset = offset;
-   ++cache->num_entries;
+
+   // DXC doesn't de-duplicate arbitrary semantic names, only SVs.
+   if (strncmp(name, "SV_", 3) == 0) {
+      /* consider replacing this with a binary search using rb_tree */
+      for (unsigned i = 0; i < cache->num_entries; ++i) {
+         if (!strcmp(name, cache->entries[i].name))
+            return cache->entries[i].offset;
+      }
+
+      cache->entries[cache->num_entries].name = name;
+      cache->entries[cache->num_entries].offset = offset;
+      ++cache->num_entries;
+   }
    _mesa_string_buffer_append_len(buf, name, strlen(name) + 1);
 
    return offset;



More information about the mesa-commit mailing list