GL: Added vendorId identification. Issue #922.

This commit is contained in:
Branimir Karadžić 2016-09-22 23:17:18 -07:00
parent 33057ea86c
commit 6ebdf2e0c0

View File

@ -1381,6 +1381,19 @@ namespace bgfx { namespace gl
};
#endif // BGFX_CONFIG_USE_OVR
struct VendorId
{
const char* name;
uint16_t id;
};
static const VendorId s_vendorIds[] =
{
{ "NVIDIA Corporation", BGFX_PCI_ID_NVIDIA },
{ "Advanced Micro Devices, Inc.", BGFX_PCI_ID_AMD },
{ "Intel", BGFX_PCI_ID_INTEL },
};
struct RendererContextGL : public RendererContextI
{
RendererContextGL()
@ -1441,6 +1454,15 @@ namespace bgfx { namespace gl
m_version = getGLString(GL_VERSION);
m_glslVersion = getGLString(GL_SHADING_LANGUAGE_VERSION);
for (uint32_t ii = 0; ii < BX_COUNTOF(s_vendorIds); ++ii)
{
const VendorId& vendorId = s_vendorIds[ii];
if (0 == strncmp(vendorId.name, m_vendor, strlen(vendorId.name) ) )
{
g_caps.vendorId = vendorId.id;
}
}
GLint numCmpFormats = 0;
GL_CHECK(glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCmpFormats) );
BX_TRACE("GL_NUM_COMPRESSED_TEXTURE_FORMATS %d", numCmpFormats);