Cleanup.
This commit is contained in:
parent
d5f6a34a78
commit
40d7c6e98f
46
src/bgfx.cpp
46
src/bgfx.cpp
@ -3359,7 +3359,7 @@ namespace bgfx
|
||||
resolve = _resolve;
|
||||
}
|
||||
|
||||
bool init(const Init& _init)
|
||||
bool init(const Init& _userInit)
|
||||
{
|
||||
if (NULL != s_ctx)
|
||||
{
|
||||
@ -3367,12 +3367,10 @@ namespace bgfx
|
||||
return false;
|
||||
}
|
||||
|
||||
if (1 > _init.limits.maxEncoders
|
||||
|| 128 < _init.limits.maxEncoders)
|
||||
{
|
||||
BX_TRACE("init.limits.maxEncoders must be between 1 and 128.");
|
||||
return false;
|
||||
}
|
||||
Init init = _userInit;
|
||||
|
||||
init.limits.maxEncoders = bx::clamp<uint16_t>(init.limits.maxEncoders, 1, 128);
|
||||
init.limits.minResourceCbSize = bx::min<uint32_t>(init.limits.minResourceCbSize, BGFX_CONFIG_MIN_RESOURCE_COMMAND_BUFFER_SIZE);
|
||||
|
||||
struct ErrorState
|
||||
{
|
||||
@ -3385,9 +3383,9 @@ namespace bgfx
|
||||
|
||||
ErrorState::Enum errorState = ErrorState::Default;
|
||||
|
||||
if (NULL != _init.allocator)
|
||||
if (NULL != init.allocator)
|
||||
{
|
||||
g_allocator = _init.allocator;
|
||||
g_allocator = init.allocator;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3396,9 +3394,9 @@ namespace bgfx
|
||||
s_allocatorStub = BX_NEW(&allocator, AllocatorStub);
|
||||
}
|
||||
|
||||
if (NULL != _init.callback)
|
||||
if (NULL != init.callback)
|
||||
{
|
||||
g_callback = _init.callback;
|
||||
g_callback = init.callback;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3408,12 +3406,12 @@ namespace bgfx
|
||||
|
||||
if (true
|
||||
&& !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_PS4)
|
||||
&& RendererType::Noop != _init.type
|
||||
&& NULL == _init.platformData.ndt
|
||||
&& NULL == _init.platformData.nwh
|
||||
&& NULL == _init.platformData.context
|
||||
&& NULL == _init.platformData.backBuffer
|
||||
&& NULL == _init.platformData.backBufferDS
|
||||
&& RendererType::Noop != init.type
|
||||
&& NULL == init.platformData.ndt
|
||||
&& NULL == init.platformData.nwh
|
||||
&& NULL == init.platformData.context
|
||||
&& NULL == init.platformData.backBuffer
|
||||
&& NULL == init.platformData.backBufferDS
|
||||
)
|
||||
{
|
||||
BX_TRACE("bgfx platform data like window handle or backbuffer is not set, creating headless device.");
|
||||
@ -3440,13 +3438,13 @@ namespace bgfx
|
||||
g_caps.limits.maxUniforms = BGFX_CONFIG_MAX_UNIFORMS;
|
||||
g_caps.limits.maxOcclusionQueries = BGFX_CONFIG_MAX_OCCLUSION_QUERIES;
|
||||
g_caps.limits.maxFBAttachments = 1;
|
||||
g_caps.limits.maxEncoders = (0 != BGFX_CONFIG_MULTITHREADED) ? _init.limits.maxEncoders : 1;
|
||||
g_caps.limits.minResourceCbSize = _init.limits.minResourceCbSize;
|
||||
g_caps.limits.transientVbSize = _init.limits.transientVbSize;
|
||||
g_caps.limits.transientIbSize = _init.limits.transientIbSize;
|
||||
g_caps.limits.maxEncoders = (0 != BGFX_CONFIG_MULTITHREADED) ? init.limits.maxEncoders : 0;
|
||||
g_caps.limits.minResourceCbSize = init.limits.minResourceCbSize;
|
||||
g_caps.limits.transientVbSize = init.limits.transientVbSize;
|
||||
g_caps.limits.transientIbSize = init.limits.transientIbSize;
|
||||
|
||||
g_caps.vendorId = _init.vendorId;
|
||||
g_caps.deviceId = _init.deviceId;
|
||||
g_caps.vendorId = init.vendorId;
|
||||
g_caps.deviceId = init.deviceId;
|
||||
|
||||
BX_TRACE("Init...");
|
||||
|
||||
@ -3460,7 +3458,7 @@ namespace bgfx
|
||||
errorState = ErrorState::ContextAllocated;
|
||||
|
||||
s_ctx = BX_ALIGNED_NEW(g_allocator, Context, Context::kAlignment);
|
||||
if (s_ctx->init(_init) )
|
||||
if (s_ctx->init(init) )
|
||||
{
|
||||
BX_TRACE("Init complete.");
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user