Refactor remaining cases of memset(this, ...)
Use Memset<T> as the first base class of cache key types to ensure they
get initialized before any other base classes or members get
constructed.
Bug: b/134932616
Change-Id: I8f28252696d6e017db11da068180d2425cdf1d57
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33249
Tested-by: Nicolas Capens <nicolascapens@google.com>
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Device/SetupProcessor.hpp b/src/Device/SetupProcessor.hpp
index f3dac16..f5adc42 100644
--- a/src/Device/SetupProcessor.hpp
+++ b/src/Device/SetupProcessor.hpp
@@ -32,9 +32,11 @@
class SetupProcessor
{
public:
- struct States
+ struct States : Memset<States>
{
- unsigned int computeHash();
+ States() : Memset(this, 0) {}
+
+ uint32_t computeHash();
bool isDrawPoint : 1;
bool isDrawLine : 1;
@@ -53,11 +55,9 @@
struct State : States
{
- State(int i = 0);
-
bool operator==(const State &states) const;
- unsigned int hash;
+ uint32_t hash;
};
typedef bool (*RoutinePointer)(Primitive *primitive, const Triangle *triangle, const Polygon *polygon, const DrawData *draw);