summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/src/vertexdecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/src/vertexdecl.cpp')
-rw-r--r--3rdparty/bgfx/src/vertexdecl.cpp117
1 files changed, 61 insertions, 56 deletions
diff --git a/3rdparty/bgfx/src/vertexdecl.cpp b/3rdparty/bgfx/src/vertexdecl.cpp
index a2d88a4ff84..ba00480dcd3 100644
--- a/3rdparty/bgfx/src/vertexdecl.cpp
+++ b/3rdparty/bgfx/src/vertexdecl.cpp
@@ -64,6 +64,7 @@ namespace bgfx
}
VertexDecl::VertexDecl()
+ : m_stride(0)
{
// BK - struct need to have ctor to qualify as non-POD data.
// Need this to catch programming errors when serializing struct.
@@ -127,6 +128,8 @@ namespace bgfx
"Attrib::Bitangent",
"Attrib::Color0",
"Attrib::Color1",
+ "Attrib::Color2",
+ "Attrib::Color3",
"Attrib::Indices",
"Attrib::Weights",
"Attrib::TexCoord0",
@@ -151,7 +154,7 @@ namespace bgfx
{
bx::debugPrintf("vertexdecl %08x (%08x), stride %d\n"
, _decl.m_hash
- , bx::hashMurmur2A(_decl.m_attributes)
+ , bx::hash<bx::HashMurmur2A>(_decl.m_attributes)
, _decl.m_stride
);
@@ -196,6 +199,8 @@ namespace bgfx
{ Attrib::Bitangent, 0x0004 },
{ Attrib::Color0, 0x0005 },
{ Attrib::Color1, 0x0006 },
+ { Attrib::Color2, 0x0018 },
+ { Attrib::Color3, 0x0019 },
{ Attrib::Indices, 0x000e },
{ Attrib::Weight, 0x000f },
{ Attrib::TexCoord0, 0x0010 },
@@ -389,9 +394,9 @@ namespace bgfx
{
switch (num)
{
- default: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
- case 3: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
- case 2: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
+ default: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH;
+ case 3: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH;
+ case 2: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH;
case 1: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
}
}
@@ -399,9 +404,9 @@ namespace bgfx
{
switch (num)
{
- default: *packed++ = uint8_t(*_input++ * 255.0f);
- case 3: *packed++ = uint8_t(*_input++ * 255.0f);
- case 2: *packed++ = uint8_t(*_input++ * 255.0f);
+ default: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH;
+ case 3: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH;
+ case 2: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH;
case 1: *packed++ = uint8_t(*_input++ * 255.0f);
}
}
@@ -410,9 +415,9 @@ namespace bgfx
{
switch (num)
{
- default: *packed++ = uint8_t(*_input++);
- case 3: *packed++ = uint8_t(*_input++);
- case 2: *packed++ = uint8_t(*_input++);
+ default: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH;
+ case 3: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH;
+ case 2: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH;
case 1: *packed++ = uint8_t(*_input++);
}
}
@@ -428,9 +433,9 @@ namespace bgfx
{
switch (num)
{
- default:
- case 3: packed |= uint32_t(*_input++ * 511.0f + 512.0f);
- case 2: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f);
+ default: BX_FALLTHROUGH;
+ case 3: packed |= uint32_t(*_input++ * 511.0f + 512.0f); BX_FALLTHROUGH;
+ case 2: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f); BX_FALLTHROUGH;
case 1: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f);
}
}
@@ -438,9 +443,9 @@ namespace bgfx
{
switch (num)
{
- default:
- case 3: packed |= uint32_t(*_input++ * 1023.0f);
- case 2: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f);
+ default: BX_FALLTHROUGH;
+ case 3: packed |= uint32_t(*_input++ * 1023.0f); BX_FALLTHROUGH;
+ case 2: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f); BX_FALLTHROUGH;
case 1: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f);
}
}
@@ -449,9 +454,9 @@ namespace bgfx
{
switch (num)
{
- default:
- case 3: packed |= uint32_t(*_input++);
- case 2: packed <<= 10; packed |= uint32_t(*_input++);
+ default: BX_FALLTHROUGH;
+ case 3: packed |= uint32_t(*_input++); BX_FALLTHROUGH;
+ case 2: packed <<= 10; packed |= uint32_t(*_input++); BX_FALLTHROUGH;
case 1: packed <<= 10; packed |= uint32_t(*_input++);
}
}
@@ -468,9 +473,9 @@ namespace bgfx
{
switch (num)
{
- default: *packed++ = int16_t(*_input++ * 32767.0f);
- case 3: *packed++ = int16_t(*_input++ * 32767.0f);
- case 2: *packed++ = int16_t(*_input++ * 32767.0f);
+ default: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH;
+ case 3: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH;
+ case 2: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH;
case 1: *packed++ = int16_t(*_input++ * 32767.0f);
}
}
@@ -478,9 +483,9 @@ namespace bgfx
{
switch (num)
{
- default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
- case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
- case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
+ default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH;
+ case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH;
+ case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH;
case 1: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
}
}
@@ -489,9 +494,9 @@ namespace bgfx
{
switch (num)
{
- default: *packed++ = int16_t(*_input++);
- case 3: *packed++ = int16_t(*_input++);
- case 2: *packed++ = int16_t(*_input++);
+ default: *packed++ = int16_t(*_input++); BX_FALLTHROUGH;
+ case 3: *packed++ = int16_t(*_input++); BX_FALLTHROUGH;
+ case 2: *packed++ = int16_t(*_input++); BX_FALLTHROUGH;
case 1: *packed++ = int16_t(*_input++);
}
}
@@ -503,9 +508,9 @@ namespace bgfx
uint16_t* packed = (uint16_t*)data;
switch (num)
{
- default: *packed++ = bx::halfFromFloat(*_input++);
- case 3: *packed++ = bx::halfFromFloat(*_input++);
- case 2: *packed++ = bx::halfFromFloat(*_input++);
+ default: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH;
+ case 3: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH;
+ case 2: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH;
case 1: *packed++ = bx::halfFromFloat(*_input++);
}
}
@@ -544,9 +549,9 @@ namespace bgfx
{
switch (num)
{
- default: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
- case 3: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
- case 2: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
+ default: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH;
+ case 3: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH;
+ case 2: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH;
case 1: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
}
}
@@ -554,9 +559,9 @@ namespace bgfx
{
switch (num)
{
- default: *_output++ = float(*packed++)*1.0f/255.0f;
- case 3: *_output++ = float(*packed++)*1.0f/255.0f;
- case 2: *_output++ = float(*packed++)*1.0f/255.0f;
+ default: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH;
+ case 3: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH;
+ case 2: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH;
case 1: *_output++ = float(*packed++)*1.0f/255.0f;
}
}
@@ -570,9 +575,9 @@ namespace bgfx
{
switch (num)
{
- default:
- case 3: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10;
- case 2: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10;
+ default: BX_FALLTHROUGH;
+ case 3: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; BX_FALLTHROUGH;
+ case 2: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; BX_FALLTHROUGH;
case 1: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f;
}
}
@@ -580,9 +585,9 @@ namespace bgfx
{
switch (num)
{
- default:
- case 3: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10;
- case 2: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10;
+ default: BX_FALLTHROUGH;
+ case 3: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; BX_FALLTHROUGH;
+ case 2: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; BX_FALLTHROUGH;
case 1: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f;
}
}
@@ -596,9 +601,9 @@ namespace bgfx
{
switch (num)
{
- default: *_output++ = float(*packed++)*1.0f/32767.0f;
- case 3: *_output++ = float(*packed++)*1.0f/32767.0f;
- case 2: *_output++ = float(*packed++)*1.0f/32767.0f;
+ default: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH;
+ case 3: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH;
+ case 2: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH;
case 1: *_output++ = float(*packed++)*1.0f/32767.0f;
}
}
@@ -606,9 +611,9 @@ namespace bgfx
{
switch (num)
{
- default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
- case 3: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
- case 2: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
+ default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH;
+ case 3: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH;
+ case 2: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH;
case 1: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
}
}
@@ -620,9 +625,9 @@ namespace bgfx
uint16_t* packed = (uint16_t*)data;
switch (num)
{
- default: *_output++ = bx::halfToFloat(*packed++);
- case 3: *_output++ = bx::halfToFloat(*packed++);
- case 2: *_output++ = bx::halfToFloat(*packed++);
+ default: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH;
+ case 3: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH;
+ case 2: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH;
case 1: *_output++ = bx::halfToFloat(*packed++);
}
}
@@ -636,9 +641,9 @@ namespace bgfx
switch (num)
{
- case 1: *_output++ = 0.0f;
- case 2: *_output++ = 0.0f;
- case 3: *_output++ = 0.0f;
+ case 1: *_output++ = 0.0f; BX_FALLTHROUGH;
+ case 2: *_output++ = 0.0f; BX_FALLTHROUGH;
+ case 3: *_output++ = 0.0f; BX_FALLTHROUGH;
default: break;
}
}
@@ -807,7 +812,7 @@ namespace bgfx
{
float pos[4];
vertexUnpack(pos, Attrib::Position, _decl, _data, ii);
- uint32_t hashValue = bx::hashMurmur2A(pos, 3*sizeof(float) ) & hashMask;
+ uint32_t hashValue = bx::hash<bx::HashMurmur2A>(pos, 3*sizeof(float) ) & hashMask;
uint16_t offset = hashTable[hashValue];
for (; UINT16_MAX != offset; offset = next[offset])