Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
AttributeDescriptor.cpp
Go to the documentation of this file.
1
2
4
5namespace Divide
6{
7 [[nodiscard]] size_t GetHash( const AttributeDescriptor& descriptor )
8 {
9 if ( descriptor._dataType == GFXDataFormat::COUNT )
10 {
11 return 0u;
12 }
13
14 size_t hash = 1337;
15 Util::Hash_combine( hash, descriptor._strideInBytes, descriptor._vertexBindingIndex,
16 descriptor._componentsPerElement,
17 descriptor._dataType, descriptor._normalized );
18
19 return hash;
20 }
21
22 [[nodiscard]] size_t GetHash( const VertexBinding& vertexBinding )
23 {
24 size_t hash = 1337;
25 Util::Hash_combine( hash, vertexBinding._strideInBytes, vertexBinding._bufferBindIndex, vertexBinding._perVertexInputRate);
26 return hash;
27 }
28
29 [[nodiscard]] size_t GetHash( const AttributeMap& attributes )
30 {
31 size_t vertexFormatHash = 1337;
32 for ( const AttributeDescriptor& attrDescriptor : attributes._attributes )
33 {
34 if ( attrDescriptor._dataType != GFXDataFormat::COUNT )
35 {
36 Util::Hash_combine( vertexFormatHash, GetHash( attrDescriptor ) );
37 }
38 }
39 for ( const VertexBinding& vertBinding : attributes._vertexBindings )
40 {
41 Util::Hash_combine( vertexFormatHash, GetHash( vertBinding ) );
42 }
43
44 return vertexFormatHash;
45 }
46
47}; //namespace Divide
void Hash_combine(size_t &seed, const T &v, const Rest &... rest) noexcept
a la Boost
Definition: MathHelper.inl:799
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition: Resource.inl:40
VertexBindings _vertexBindings