From 0b91087a1ea44a5c49714870a512745a766f07f7 Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Fri, 26 Apr 2019 01:09:29 -0300
Subject: [PATCH 1/3] shader_ir/texture: Fix sampler const buffer key shift

---
 src/video_core/shader/decode/texture.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp
index fa65ac9a9..819cc6131 100644
--- a/src/video_core/shader/decode/texture.cpp
+++ b/src/video_core/shader/decode/texture.cpp
@@ -296,7 +296,7 @@ const Sampler& ShaderIR::GetBindlessSampler(const Tegra::Shader::Register& reg,
     ASSERT(cbuf_offset_imm != nullptr);
     const auto cbuf_offset = cbuf_offset_imm->GetValue();
     const auto cbuf_index = cbuf->GetIndex();
-    const u64 cbuf_key = (cbuf_index << 32) | cbuf_offset;
+    const auto cbuf_key = (static_cast<u64>(cbuf_index) << 32) | static_cast<u64>(cbuf_offset);
 
     // If this sampler has already been used, return the existing mapping.
     const auto itr =

From b77b4b76bb41eb4824a3af0ccd118f29e4dd47a9 Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Fri, 26 Apr 2019 01:11:24 -0300
Subject: [PATCH 2/3] shader_ir: Add missing entry to Sampler operand<
 comparison

---
 src/video_core/shader/shader_ir.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index 81278fb33..026181cae 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -251,8 +251,9 @@ public:
     }
 
     bool operator<(const Sampler& rhs) const {
-        return std::tie(offset, index, type, is_array, is_shadow) <
-               std::tie(rhs.offset, rhs.index, rhs.type, rhs.is_array, rhs.is_shadow);
+        return std::tie(offset, index, type, is_array, is_shadow, is_bindless) <
+               std::tie(rhs.offset, rhs.index, rhs.type, rhs.is_array, rhs.is_shadow,
+                        rhs.is_bindless);
     }
 
 private:

From 2156e520149d17ae22e9e52f864231a093e5da34 Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Fri, 26 Apr 2019 01:13:05 -0300
Subject: [PATCH 3/3] shader_ir: Move Sampler index entry in operand< to sort
 declarations

---
 src/video_core/shader/shader_ir.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index 026181cae..65f1e1de9 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -251,8 +251,8 @@ public:
     }
 
     bool operator<(const Sampler& rhs) const {
-        return std::tie(offset, index, type, is_array, is_shadow, is_bindless) <
-               std::tie(rhs.offset, rhs.index, rhs.type, rhs.is_array, rhs.is_shadow,
+        return std::tie(index, offset, type, is_array, is_shadow, is_bindless) <
+               std::tie(rhs.index, rhs.offset, rhs.type, rhs.is_array, rhs.is_shadow,
                         rhs.is_bindless);
     }