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

@@ -272,6 +272,15 @@ typedef struct bgfx_texture_info
} bgfx_texture_info_t;
/**
*/
typedef struct bgfx_caps_gpu
{
uint16_t vendorId;
uint16_t deviceId;
} bgfx_caps_gpu_t;
/**
* Renderer capabilities.
*/
@@ -293,6 +302,11 @@ typedef struct bgfx_caps
uint16_t maxViews; /* < Maximum views. */
uint16_t maxDrawCalls; /* < Maximum draw calls. */
uint8_t maxFBAttachments; /* < Maximum frame buffer attachments. */
uint8_t numGPUs; /* < */
uint16_t vendorId; /* < */
uint16_t deviceId; /* < */
bgfx_caps_gpu_t gpu[4]; /* < */
/**
* Supported texture formats.

View File

@@ -315,6 +315,18 @@ namespace bgfx
uint16_t maxViews; ///< Maximum views.
uint16_t maxDrawCalls; ///< Maximum draw calls.
uint8_t maxFBAttachments; ///< Maximum frame buffer attachments.
uint8_t numGPUs; ///<
uint16_t vendorId; ///<
uint16_t deviceId; ///<
struct GPU
{
uint16_t vendorId;
uint16_t deviceId;
};
GPU gpu[4]; ///<
/// Supported texture formats.
/// - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - not supported
@@ -517,7 +529,7 @@ namespace bgfx
///
/// @attention C99 equivalent is `bgfx_init`.
///
void init(RendererType::Enum _type = RendererType::Count, CallbackI* _callback = NULL, bx::ReallocatorI* _reallocator = NULL);
void init(RendererType::Enum _type = RendererType::Count, uint16_t _vendorId = BGFX_PCI_ID_NONE, uint16_t _deviceId = 0, CallbackI* _callback = NULL, bx::ReallocatorI* _reallocator = NULL);
/// Shutdown bgfx library.
///

View File

@@ -333,4 +333,10 @@
#define BGFX_SUBMIT_EYE_MASK UINT8_C(0x03)
#define BGFX_SUBMIT_EYE_FIRST BGFX_SUBMIT_EYE_LEFT
///
#define BGFX_PCI_ID_NONE UINT16_C(0x0000)
#define BGFX_PCI_ID_AMD UINT16_C(0x1002)
#define BGFX_PCI_ID_INTEL UINT16_C(0x8086)
#define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de)
#endif // BGFX_DEFINES_H_HEADER_GUARD