Merge branch 'master' of github.com:bkaradzic/bgfx

This commit is contained in:
Branimir Karadžić 2018-01-30 08:47:19 -08:00
commit fed203f1b3
8 changed files with 55 additions and 7 deletions

View File

@ -2844,6 +2844,7 @@ error:
case ErrorState::ContextAllocated:
BX_ALIGNED_DELETE(g_allocator, s_ctx, 64);
s_ctx = NULL;
BX_FALLTHROUGH;
case ErrorState::Default:
if (NULL != s_callbackStub)

View File

@ -1870,6 +1870,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
DX_RELEASE(m_deviceCtx, 0);
DX_RELEASE(m_device, 0);
DX_RELEASE(m_factory, 0);
BX_FALLTHROUGH;
#if USE_D3D11_DYNAMIC_LIB
case ErrorState::LoadedDXGI:
@ -1887,10 +1888,13 @@ BX_PRAGMA_DIAGNOSTIC_POP();
bx::dlclose(m_dxgidll);
m_dxgidll = NULL;
BX_FALLTHROUGH;
case ErrorState::LoadedD3D11:
bx::dlclose(m_d3d11dll);
m_d3d11dll = NULL;
BX_FALLTHROUGH;
#endif // USE_D3D11_DYNAMIC_LIB
case ErrorState::Default:

View File

@ -1448,17 +1448,27 @@ namespace bgfx { namespace d3d12
{
case ErrorState::CreatedCommandQueue:
m_cmd.shutdown();
BX_FALLTHROUGH;
case ErrorState::CreatedDXGIFactory:
DX_RELEASE(m_device, 0);
DX_RELEASE(m_adapter, 0);
DX_RELEASE(m_factory, 0);
BX_FALLTHROUGH;
#if USE_D3D12_DYNAMIC_LIB
case ErrorState::LoadedDXGI:
bx::dlclose(m_dxgidll);
BX_FALLTHROUGH;
case ErrorState::LoadedD3D12:
bx::dlclose(m_d3d12dll);
BX_FALLTHROUGH;
case ErrorState::LoadedKernel32:
bx::dlclose(m_kernel32dll);
BX_FALLTHROUGH;
#endif // USE_D3D12_DYNAMIC_LIB
case ErrorState::Default:
default:

View File

@ -869,6 +869,7 @@ namespace bgfx { namespace d3d9
{
DX_RELEASE(m_device, 0);
}
BX_FALLTHROUGH;
case ErrorState::CreatedD3D9:
if (NULL != m_d3d9ex)
@ -880,10 +881,12 @@ namespace bgfx { namespace d3d9
{
DX_RELEASE(m_d3d9, 0);
}
BX_FALLTHROUGH;
case ErrorState::LoadedD3D9:
m_nvapi.shutdown();
bx::dlclose(m_d3d9dll);
BX_FALLTHROUGH;
case ErrorState::Default:
break;

View File

@ -240,7 +240,7 @@ namespace bgfx { namespace d3d9
switch (m_type)
{
case 0: DX_RELEASE(m_vertexShader, 0);
case 0: DX_RELEASE(m_vertexShader, 0); BX_FALLTHROUGH;
default: DX_RELEASE(m_pixelShader, 0);
}
}

View File

@ -1766,11 +1766,13 @@ VK_IMPORT_DEVICE
vkDestroy(m_pipelineLayout);
vkDestroy(m_descriptorSetLayout);
vkDestroy(m_descriptorPool);
BX_FALLTHROUGH;
case ErrorState::CommandBuffersCreated:
vkFreeCommandBuffers(m_device, m_commandPool, BX_COUNTOF(m_commandBuffers), m_commandBuffers);
vkDestroy(m_commandPool);
vkDestroy(m_fence);
BX_FALLTHROUGH;
case ErrorState::SwapchainCreated:
for (uint32_t ii = 0; ii < BX_COUNTOF(m_backBufferColorImageView); ++ii)
@ -1791,15 +1793,19 @@ VK_IMPORT_DEVICE
}
}
vkDestroy(m_swapchain);
BX_FALLTHROUGH;
case ErrorState::SurfaceCreated:
vkDestroySurfaceKHR(m_instance, m_surface, m_allocatorCb);
BX_FALLTHROUGH;
case ErrorState::RenderPassCreated:
vkDestroy(m_renderPass);
BX_FALLTHROUGH;
case ErrorState::DeviceCreated:
vkDestroyDevice(m_device, m_allocatorCb);
BX_FALLTHROUGH;
case ErrorState::InstanceCreated:
if (VK_NULL_HANDLE != m_debugReportCallback)
@ -1808,12 +1814,14 @@ VK_IMPORT_DEVICE
}
vkDestroyInstance(m_instance, m_allocatorCb);
BX_FALLTHROUGH;
case ErrorState::LoadedVulkan1:
bx::dlclose(m_vulkan1dll);
m_vulkan1dll = NULL;
m_allocatorCb = NULL;
unloadRenderDoc(m_renderdocdll);
BX_FALLTHROUGH;
case ErrorState::Default:
break;

View File

@ -1912,6 +1912,8 @@ namespace bgfx
bx::MemoryBlock mb(g_allocator);
bx::MemoryWriter writer(&mb);
int32_t total = 0;
for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;)
{
DxbcInstruction instruction;
@ -1920,15 +1922,14 @@ namespace bgfx
_fn(instruction, _userData);
write(&writer, instruction, _err);
total += write(&writer, instruction, _err);
token += instruction.length;
}
uint8_t* data = (uint8_t*)mb.more();
uint32_t size = uint32_t(bx::getSize(&writer) );
_dst.byteCode.reserve(size);
bx::memCopy(_dst.byteCode.data(), data, size);
_dst.byteCode.resize(total);
bx::memCopy(_dst.byteCode.data(), data, total);
}
} // namespace bgfx

View File

@ -450,7 +450,16 @@ namespace bgfx
struct DxbcSubOperand
{
DxbcSubOperand() { /* not pod */ }
DxbcSubOperand()
: type(DxbcOperandType::Temp)
, mode(0)
, modeBits(0)
, num(0)
, numAddrModes(0)
, addrMode(0)
, regIndex(0)
{
}
DxbcOperandType::Enum type;
uint8_t mode;
@ -463,7 +472,19 @@ namespace bgfx
struct DxbcOperand
{
DxbcOperand() { /* not pod */ }
DxbcOperand()
: type(DxbcOperandType::Temp)
, mode(DxbcOperandMode::Mask)
, modeBits(0)
, num(0)
, extended(false)
, extBits(0)
, numAddrModes(0)
{
bx::memSet(addrMode, 0, sizeof(addrMode) );
bx::memSet(regIndex, 0, sizeof(regIndex) );
bx::memSet(un.imm64, 0, sizeof(un.imm64) );
}
DxbcOperandType::Enum type;
DxbcOperandMode::Enum mode;