SpirvShader: Add a single-entry, last-used sampler cache
This complements the const-cache in 34348.
Timings for the Glass demo running on a i7-4930K:
this change: 24.25 FPS
this change without 34528: 23.02 FPS
parent change (inc 34528): 22.46 FPS
Bug: b/137649247
Change-Id: I206cdaabfaf63da7f67e3cd5f6823f3343b823c8
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/34528
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp
index 5add9cd..20cf3b0 100644
--- a/src/Reactor/Reactor.hpp
+++ b/src/Reactor/Reactor.hpp
@@ -2356,6 +2356,12 @@
RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<Int> offset);
RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<UInt> offset);
+ template <typename T>
+ RValue<Bool> operator==(const Pointer<T> &lhs, const Pointer<T> &rhs)
+ {
+ return RValue<Bool>(Nucleus::createPtrEQ(lhs.loadValue(), rhs.loadValue()));
+ }
+
template<typename T>
RValue<T> Load(RValue<Pointer<T>> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder)
{