From 6ebdf2e0c0cda31c816b433d86861f7e75ac0ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 22 Sep 2016 23:17:18 -0700 Subject: [PATCH] GL: Added vendorId identification. Issue #922. --- src/renderer_gl.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 2be925dea..b7ad0187a 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -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);