Replaced macros with C++17 attributes.

This commit is contained in:
Бранимир Караџић
2023-12-02 20:16:56 -08:00
parent 837803454a
commit e9e2e224ee
9 changed files with 90 additions and 90 deletions

View File

@@ -72,11 +72,11 @@ static char* cpToUTF8(int cp, char* str)
switch (n)
{
case 6: str[5] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x4000000; BX_FALLTHROUGH;
case 5: str[4] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x200000; BX_FALLTHROUGH;
case 4: str[3] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x10000; BX_FALLTHROUGH;
case 3: str[2] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x800; BX_FALLTHROUGH;
case 2: str[1] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0xc0; BX_FALLTHROUGH;
case 6: str[5] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x4000000; [[fallthrough]];
case 5: str[4] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x200000; [[fallthrough]];
case 4: str[3] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x10000; [[fallthrough]];
case 3: str[2] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0x800; [[fallthrough]];
case 2: str[1] = 0x80 | (cp & 0x3f); cp = cp >> 6; cp |= 0xc0; [[fallthrough]];
case 1: str[0] = char(cp); break;
}

View File

@@ -2855,7 +2855,7 @@ namespace bgfx
m_exit = true;
}
BX_FALLTHROUGH;
[[fallthrough]];
case CommandBuffer::End:
end = true;
@@ -3572,7 +3572,7 @@ namespace bgfx
case ErrorState::ContextAllocated:
bx::deleteObject(g_allocator, s_ctx, Context::kAlignment);
s_ctx = NULL;
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::Default:
if (NULL != s_callbackStub)

View File

@@ -1635,13 +1635,13 @@ namespace bgfx { namespace d3d11
#endif // USE_D3D11_DYNAMIC_LIB
m_dxgi.shutdown();
BX_FALLTHROUGH;
[[fallthrough]];
#if USE_D3D11_DYNAMIC_LIB
case ErrorState::LoadedD3D11:
bx::dlclose(m_d3d11Dll);
m_d3d11Dll = NULL;
BX_FALLTHROUGH;
[[fallthrough]];
#endif // USE_D3D11_DYNAMIC_LIB
case ErrorState::Default:

View File

@@ -1581,24 +1581,24 @@ namespace bgfx { namespace d3d12
case ErrorState::CreatedCommandQueue:
m_device->SetPrivateDataInterface(IID_ID3D12CommandQueue, NULL);
m_cmd.shutdown();
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::CreatedDXGIFactory:
DX_RELEASE(m_device, 0);
#if !BX_PLATFORM_LINUX
m_dxgi.shutdown();
#endif // !BX_PLATFORM_LINUX
BX_FALLTHROUGH;
[[fallthrough]];
#if USE_D3D12_DYNAMIC_LIB
case ErrorState::LoadedDXGI:
case ErrorState::LoadedD3D12:
bx::dlclose(m_d3d12Dll);
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::LoadedKernel32:
bx::dlclose(m_kernel32Dll);
BX_FALLTHROUGH;
[[fallthrough]];
#endif // USE_D3D12_DYNAMIC_LIB
case ErrorState::Default:

View File

@@ -1979,7 +1979,7 @@ namespace bgfx { namespace gl
{
return true;
}
BX_FALLTHROUGH;
[[fallthrough]];
case TextureFormat::RGBA32F:
if (_writeOnly)

View File

@@ -2047,7 +2047,7 @@ VK_IMPORT_DEVICE
{
m_gpuTimer.shutdown();
}
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::DescriptorCreated:
for (uint32_t ii = 0; ii < m_numFramesInFlight; ++ii)
@@ -2056,19 +2056,19 @@ VK_IMPORT_DEVICE
}
vkDestroy(m_pipelineCache);
vkDestroy(m_descriptorPool);
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::SwapChainCreated:
m_backBuffer.destroy();
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::CommandQueueCreated:
m_cmd.shutdown();
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::DeviceCreated:
vkDestroyDevice(m_device, m_allocatorCb);
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::InstanceCreated:
if (VK_NULL_HANDLE != m_debugReportCallback)
@@ -2077,14 +2077,14 @@ VK_IMPORT_DEVICE
}
vkDestroyInstance(m_instance, m_allocatorCb);
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::LoadedVulkan1:
bx::dlclose(m_vulkan1Dll);
m_vulkan1Dll = NULL;
m_allocatorCb = NULL;
unloadRenderDoc(m_renderDocDll);
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::Default:
break;
@@ -6604,15 +6604,15 @@ VK_DESTROY
{
case ErrorState::AttachmentsCreated:
releaseAttachments();
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::SwapChainCreated:
releaseSwapChain();
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::SurfaceCreated:
releaseSurface();
BX_FALLTHROUGH;
[[fallthrough]];
case ErrorState::Default:
break;
@@ -7418,7 +7418,7 @@ VK_DESTROY
case VK_ERROR_SURFACE_LOST_KHR:
m_needToRecreateSurface = true;
BX_FALLTHROUGH;
[[fallthrough]];
case VK_ERROR_OUT_OF_DATE_KHR:
case VK_SUBOPTIMAL_KHR:
@@ -7469,7 +7469,7 @@ VK_DESTROY
{
case VK_ERROR_SURFACE_LOST_KHR:
m_needToRecreateSurface = true;
BX_FALLTHROUGH;
[[fallthrough]];
case VK_ERROR_OUT_OF_DATE_KHR:
case VK_SUBOPTIMAL_KHR:

View File

@@ -1230,7 +1230,7 @@ namespace bgfx
_instruction.primitiveTopology = DxbcPrimitiveTopology::Enum( (token & UINT32_C(0x0001f800) ) >> 11);
break;
case DxbcOpcode::DCL_INPUT_PS: BX_FALLTHROUGH;
case DxbcOpcode::DCL_INPUT_PS: [[fallthrough]];
case DxbcOpcode::DCL_INPUT_PS_SIV:
// 0 1 2 3
// 76543210765432107654321076543210
@@ -1395,12 +1395,12 @@ namespace bgfx
_instruction.numOperands = info.numOperands;
switch (info.numOperands)
{
case 6: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 5: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 4: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 3: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 2: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 1: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH;
case 6: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 5: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 4: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 3: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 2: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 1: size += read(_reader, _instruction.operand[currOp++], _err); [[fallthrough]];
case 0:
if (0 < info.numValues)
{
@@ -1471,7 +1471,7 @@ namespace bgfx
token |= (_instruction.primitiveTopology << 11) & UINT32_C(0x0001f800);
break;
case DxbcOpcode::DCL_INPUT_PS: BX_FALLTHROUGH;
case DxbcOpcode::DCL_INPUT_PS: [[fallthrough]];
case DxbcOpcode::DCL_INPUT_PS_SIV:
token |= (_instruction.interpolation << 11) & UINT32_C(0x0000f800);
break;
@@ -1991,7 +1991,7 @@ namespace bgfx
{
case DXBC_CHUNK_SHADER_EX:
_dxbc.shader.shex = true;
BX_FALLTHROUGH;
[[fallthrough]];
case DXBC_CHUNK_SHADER:
size += read(_reader, _dxbc.shader, _err);

View File

@@ -371,9 +371,9 @@ namespace bgfx
{
switch (num)
{
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;
default: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); [[fallthrough]];
case 3: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); [[fallthrough]];
case 2: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); [[fallthrough]];
case 1: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
}
}
@@ -381,9 +381,9 @@ namespace bgfx
{
switch (num)
{
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;
default: *packed++ = uint8_t(*_input++ * 255.0f); [[fallthrough]];
case 3: *packed++ = uint8_t(*_input++ * 255.0f); [[fallthrough]];
case 2: *packed++ = uint8_t(*_input++ * 255.0f); [[fallthrough]];
case 1: *packed++ = uint8_t(*_input++ * 255.0f);
}
}
@@ -392,9 +392,9 @@ namespace bgfx
{
switch (num)
{
default: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH;
case 3: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH;
case 2: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH;
default: *packed++ = uint8_t(*_input++); [[fallthrough]];
case 3: *packed++ = uint8_t(*_input++); [[fallthrough]];
case 2: *packed++ = uint8_t(*_input++); [[fallthrough]];
case 1: *packed++ = uint8_t(*_input++);
}
}
@@ -410,9 +410,9 @@ namespace bgfx
{
switch (num)
{
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;
default: [[fallthrough]];
case 3: packed |= uint32_t(*_input++ * 511.0f + 512.0f); [[fallthrough]];
case 2: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f); [[fallthrough]];
case 1: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f);
}
}
@@ -420,9 +420,9 @@ namespace bgfx
{
switch (num)
{
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;
default: [[fallthrough]];
case 3: packed |= uint32_t(*_input++ * 1023.0f); [[fallthrough]];
case 2: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f); [[fallthrough]];
case 1: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f);
}
}
@@ -431,9 +431,9 @@ namespace bgfx
{
switch (num)
{
default: BX_FALLTHROUGH;
case 3: packed |= uint32_t(*_input++); BX_FALLTHROUGH;
case 2: packed <<= 10; packed |= uint32_t(*_input++); BX_FALLTHROUGH;
default: [[fallthrough]];
case 3: packed |= uint32_t(*_input++); [[fallthrough]];
case 2: packed <<= 10; packed |= uint32_t(*_input++); [[fallthrough]];
case 1: packed <<= 10; packed |= uint32_t(*_input++);
}
}
@@ -450,9 +450,9 @@ namespace bgfx
{
switch (num)
{
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;
default: *packed++ = int16_t(*_input++ * 32767.0f); [[fallthrough]];
case 3: *packed++ = int16_t(*_input++ * 32767.0f); [[fallthrough]];
case 2: *packed++ = int16_t(*_input++ * 32767.0f); [[fallthrough]];
case 1: *packed++ = int16_t(*_input++ * 32767.0f);
}
}
@@ -460,9 +460,9 @@ namespace bgfx
{
switch (num)
{
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;
default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); [[fallthrough]];
case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); [[fallthrough]];
case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); [[fallthrough]];
case 1: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
}
}
@@ -471,9 +471,9 @@ namespace bgfx
{
switch (num)
{
default: *packed++ = int16_t(*_input++); BX_FALLTHROUGH;
case 3: *packed++ = int16_t(*_input++); BX_FALLTHROUGH;
case 2: *packed++ = int16_t(*_input++); BX_FALLTHROUGH;
default: *packed++ = int16_t(*_input++); [[fallthrough]];
case 3: *packed++ = int16_t(*_input++); [[fallthrough]];
case 2: *packed++ = int16_t(*_input++); [[fallthrough]];
case 1: *packed++ = int16_t(*_input++);
}
}
@@ -485,9 +485,9 @@ namespace bgfx
uint16_t* packed = (uint16_t*)data;
switch (num)
{
default: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH;
case 3: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH;
case 2: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH;
default: *packed++ = bx::halfFromFloat(*_input++); [[fallthrough]];
case 3: *packed++ = bx::halfFromFloat(*_input++); [[fallthrough]];
case 2: *packed++ = bx::halfFromFloat(*_input++); [[fallthrough]];
case 1: *packed++ = bx::halfFromFloat(*_input++);
}
}
@@ -526,9 +526,9 @@ namespace bgfx
{
switch (num)
{
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;
default: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; [[fallthrough]];
case 3: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; [[fallthrough]];
case 2: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; [[fallthrough]];
case 1: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
}
}
@@ -536,9 +536,9 @@ namespace bgfx
{
switch (num)
{
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;
default: *_output++ = float(*packed++)*1.0f/255.0f; [[fallthrough]];
case 3: *_output++ = float(*packed++)*1.0f/255.0f; [[fallthrough]];
case 2: *_output++ = float(*packed++)*1.0f/255.0f; [[fallthrough]];
case 1: *_output++ = float(*packed++)*1.0f/255.0f;
}
}
@@ -552,9 +552,9 @@ namespace bgfx
{
switch (num)
{
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;
default: [[fallthrough]];
case 3: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; [[fallthrough]];
case 2: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; [[fallthrough]];
case 1: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f;
}
}
@@ -562,9 +562,9 @@ namespace bgfx
{
switch (num)
{
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;
default: [[fallthrough]];
case 3: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; [[fallthrough]];
case 2: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; [[fallthrough]];
case 1: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f;
}
}
@@ -578,9 +578,9 @@ namespace bgfx
{
switch (num)
{
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;
default: *_output++ = float(*packed++)*1.0f/32767.0f; [[fallthrough]];
case 3: *_output++ = float(*packed++)*1.0f/32767.0f; [[fallthrough]];
case 2: *_output++ = float(*packed++)*1.0f/32767.0f; [[fallthrough]];
case 1: *_output++ = float(*packed++)*1.0f/32767.0f;
}
}
@@ -588,9 +588,9 @@ namespace bgfx
{
switch (num)
{
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;
default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; [[fallthrough]];
case 3: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; [[fallthrough]];
case 2: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; [[fallthrough]];
case 1: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
}
}
@@ -602,9 +602,9 @@ namespace bgfx
uint16_t* packed = (uint16_t*)data;
switch (num)
{
default: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH;
case 3: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH;
case 2: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH;
default: *_output++ = bx::halfToFloat(*packed++); [[fallthrough]];
case 3: *_output++ = bx::halfToFloat(*packed++); [[fallthrough]];
case 2: *_output++ = bx::halfToFloat(*packed++); [[fallthrough]];
case 1: *_output++ = bx::halfToFloat(*packed++);
}
}
@@ -618,9 +618,9 @@ namespace bgfx
switch (num)
{
case 1: *_output++ = 0.0f; BX_FALLTHROUGH;
case 2: *_output++ = 0.0f; BX_FALLTHROUGH;
case 3: *_output++ = 0.0f; BX_FALLTHROUGH;
case 1: *_output++ = 0.0f; [[fallthrough]];
case 2: *_output++ = 0.0f; [[fallthrough]];
case 3: *_output++ = 0.0f; [[fallthrough]];
default: break;
}
}

View File

@@ -653,7 +653,7 @@ void parseObj(char* _data, uint32_t _size, Mesh* _mesh, bool _hasBc)
{
case 4:
bx::fromString(&texcoord.z, argv[3]);
BX_FALLTHROUGH;
[[fallthrough]];
case 3:
bx::fromString(&texcoord.y, argv[2]);