Hello,
Im currently hashing states like the code sample below, is there a more elegant way of doing this? or should i just cache the hash in the struct and default 0 as being "null" and hope i dont get a collision where one eventrually resolves to 0.
struct RASTERIZER_DESC
{
FILL_MODE m_FillMode = FILL_SOLID;
CULL_MODE m_CullMode = CULL_BACK;
VERTEX_WIND_ORDER m_VertexWind = WIND_FRONT_CLOCKWISE;
int m_DepthBias = 0;
float m_DepthBiasClamp = 0.0f;
float m_SlopeScaledDepthBias = 0.0f;
bool m_DepthClipEnable = true;
bool m_MultisampleEnable = false;
bool m_AntialiasedLineEnable = false;
Uint32 GetHash()const
{
Uint32 hash = 23;
hash = hash * 31 + (Uint32)m_FillMode;
hash = hash * 31 + (Uint32)m_CullMode;
hash = hash * 31 + (Uint32)m_VertexWind;
hash = hash * 31 + (Uint32)m_DepthBias;
hash = hash * 31 + (Uint32)m_DepthBiasClamp;
hash = hash * 31 + (Uint32)m_SlopeScaledDepthBias;
hash = hash * 31 + (Uint32)m_DepthClipEnable;
hash = hash * 31 + (Uint32)m_MultisampleEnable;
hash = hash * 31 + (Uint32)m_AntialiasedLineEnable;
return hash;
}
};