From 006e1b25e6eef75a2e5912b69df254738c344a34 Mon Sep 17 00:00:00 2001
From: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Date: Sat, 30 Dec 2017 15:30:31 +0100
Subject: [PATCH] [d3d11] Fixed shader semantic name comparison

---
 src/dxbc/dxbc_chunk_isgn.cpp | 19 +++++++++++++++++--
 src/dxbc/dxbc_chunk_isgn.h   |  4 ++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/dxbc/dxbc_chunk_isgn.cpp b/src/dxbc/dxbc_chunk_isgn.cpp
index 8b26099d..f2d23a06 100644
--- a/src/dxbc/dxbc_chunk_isgn.cpp
+++ b/src/dxbc/dxbc_chunk_isgn.cpp
@@ -34,12 +34,27 @@ namespace dxvk {
     const std::string& semanticName,
           uint32_t     semanticIndex) const {
     for (auto e = this->begin(); e != this->end(); e++) {
-      if (e->semanticName  == semanticName
-       && e->semanticIndex == semanticIndex)
+      // TODO case-insensitive compare
+      if (e->semanticIndex == semanticIndex
+       && compareSemanticNames(semanticName, e->semanticName))
         return &(*e);
     }
     
     return nullptr;
   }
   
+  
+  bool DxbcIsgn::compareSemanticNames(
+    const std::string& a, const std::string& b) const {
+    if (a.size() != b.size())
+      return false;
+    
+    for (size_t i = 0; i < a.size(); i++) {
+      if (std::toupper(a[i]) != std::toupper(b[i]))
+        return false;
+    }
+    
+    return true;
+  }
+  
 }
\ No newline at end of file
diff --git a/src/dxbc/dxbc_chunk_isgn.h b/src/dxbc/dxbc_chunk_isgn.h
index 13b680f4..a6b9636c 100644
--- a/src/dxbc/dxbc_chunk_isgn.h
+++ b/src/dxbc/dxbc_chunk_isgn.h
@@ -46,6 +46,10 @@ namespace dxvk {
     
     std::vector<DxbcSgnEntry> m_entries;
     
+    bool compareSemanticNames(
+      const std::string& a,
+      const std::string& b) const;
+    
   };
   
 }
\ No newline at end of file