Added ability to select GPU.

This commit is contained in:
Branimir Karadžić
2015-03-26 15:01:47 -07:00
parent a4bf237b05
commit eeb491883d
6 changed files with 88 additions and 17 deletions

View File

@@ -1977,7 +1977,7 @@ again:
return s_rendererCreator[_type].name;
}
void init(RendererType::Enum _type, CallbackI* _callback, bx::ReallocatorI* _allocator)
void init(RendererType::Enum _type, uint16_t _vendorId, uint16_t _deviceId, CallbackI* _callback, bx::ReallocatorI* _allocator)
{
BX_CHECK(NULL == s_ctx, "bgfx is already initialized.");
BX_TRACE("Init...");
@@ -1989,6 +1989,8 @@ again:
g_caps.maxViews = BGFX_CONFIG_MAX_VIEWS;
g_caps.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
g_caps.maxFBAttachments = 1;
g_caps.vendorId = _vendorId;
g_caps.deviceId = _deviceId;
if (NULL != _allocator)
{
@@ -3015,6 +3017,8 @@ BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type)
BGFX_C_API void bgfx_init(bgfx_renderer_type_t _type, struct bgfx_callback_interface* _callback, struct bgfx_reallocator_interface* _allocator)
{
return bgfx::init(bgfx::RendererType::Enum(_type)
, BGFX_PCI_ID_NONE
, 0
, reinterpret_cast<bgfx::CallbackI*>(_callback)
, reinterpret_cast<bx::ReallocatorI*>(_allocator)
);