Refactor GLES routine cache keys to use Memset<T>

This ports the Vulkan side change to OpenGL ES and silences the GCC 8
class-memaccess warning/error, while ensuring proper key initialization.

Defines a Memset<T> class to be used as the first base class of cache
key types, which makes it explicit that their underlying memory will be
fully initialized before any member constructors are run.

In particular this fixes Blitter::Options state having uninitialized
bits after the bitfield, and Blitter::State having uninitialized padding
bytes after Options so 'sourceFormat' is 32-bit aligned.

Also adds is_memcmparable<T> for checking if memcmp() can be used to
implement operator==() for cache keys. It's equivalent to
std::is_trivially_copyable except it provides a fallback for STL
implementations that don't support it.

Also fix class-memset violations in LLVM 7.0 with their solution from
a later version.

Bug: b/135744933
Change-Id: Ic1e5c2c6b944a5133fc55840c0508bc2cdd1d66a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33488
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Renderer/PixelProcessor.cpp b/src/Renderer/PixelProcessor.cpp
index 0b80727..c927d5d 100644
--- a/src/Renderer/PixelProcessor.cpp
+++ b/src/Renderer/PixelProcessor.cpp
@@ -22,7 +22,7 @@
 #include "Shader/Constants.hpp"
 #include "Common/Debug.hpp"
 
-#include <string.h>
+#include <cstring>
 
 namespace sw
 {
@@ -32,12 +32,12 @@
 
 	bool precachePixel = false;
 
-	unsigned int PixelProcessor::States::computeHash()
+	uint32_t PixelProcessor::States::computeHash()
 	{
-		unsigned int *state = (unsigned int*)this;
-		unsigned int hash = 0;
+		uint32_t *state = reinterpret_cast<uint32_t*>(this);
+		uint32_t hash = 0;
 
-		for(unsigned int i = 0; i < sizeof(States) / 4; i++)
+		for(unsigned int i = 0; i < sizeof(States) / sizeof(uint32_t); i++)
 		{
 			hash ^= state[i];
 		}
@@ -45,11 +45,6 @@
 		return hash;
 	}
 
-	PixelProcessor::State::State()
-	{
-		memset(this, 0, sizeof(State));
-	}
-
 	bool PixelProcessor::State::operator==(const State &state) const
 	{
 		if(hash != state.hash)
@@ -57,6 +52,7 @@
 			return false;
 		}
 
+		static_assert(is_memcmparable<State>::value, "Cannot memcmp State");
 		return memcmp(static_cast<const States*>(this), static_cast<const States*>(&state), sizeof(States)) == 0;
 	}
 
@@ -79,7 +75,7 @@
 	PixelProcessor::~PixelProcessor()
 	{
 		delete routineCache;
-		routineCache = 0;
+		routineCache = nullptr;
 	}
 
 	void PixelProcessor::setFloatConstant(unsigned int index, const float value[4])