Skip to content

Commit 17d55ef

Browse files
committed
DetectGLVendors: detect Apple hardware and driver
1 parent fd20ad9 commit 17d55ef

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/engine/renderer/DetectGLVendors.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ std::string GetGLHardwareVendorName( glHardwareVendor_t hardwareVendor )
4040
"Unknown",
4141
"Software rasterizer",
4242
"API Translator",
43+
"Apple",
4344
"Arm",
4445
"AMD/ATI",
4546
"Broadcom",
@@ -65,6 +66,7 @@ std::string GetGLDriverVendorName( glDriverVendor_t driverVendor )
6566
{
6667
static const std::string driverVendorNames[] = {
6768
"Unknown",
69+
"Apple",
6870
"AMD/ATI",
6971
"Intel",
7072
"Mesa",
@@ -129,6 +131,33 @@ void DetectGLVendors(
129131
return;
130132
}
131133

134+
static const std::string appleVendors[] = {
135+
"Apple",
136+
"Apple Inc.",
137+
"Apple Computer, Inc.",
138+
};
139+
140+
for ( auto& s : appleVendors )
141+
{
142+
if ( vendorString == s )
143+
{
144+
driverVendor = glDriverVendor_t::APPLE;
145+
break;
146+
}
147+
}
148+
149+
if ( driverVendor == glDriverVendor_t::APPLE )
150+
{
151+
if ( rendererString == "Apple Software Renderer" )
152+
{
153+
hardwareVendor = glHardwareVendor_t::SOFTWARE;
154+
return;
155+
}
156+
157+
hardwareVendor = glHardwareVendor_t::APPLE;
158+
return;
159+
}
160+
132161
// This vendor string is used by at least two different Intel drivers.
133162
if ( vendorString == "Intel Corporation" )
134163
{
@@ -225,6 +254,7 @@ void DetectGLVendors(
225254
/* Those substrings at the beginning of a renderer string are assumed to be unambiguous about
226255
the hardware or underlying technology. */
227256
static const std::pair<std::string, glHardwareVendor_t> rendererStartStringHardware[] = {
257+
{ "Apple ", glHardwareVendor_t::APPLE },
228258
{ "ATI ", glHardwareVendor_t::ATI },
229259
{ "AMD ", glHardwareVendor_t::ATI },
230260
{ "i915 ", glHardwareVendor_t::INTEL },

src/engine/renderer/DetectGLVendors.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ enum class glHardwareVendor_t
5050
driver, or an OpenGL virtualization driver sending commands to an hypervisor. */
5151
TRANSLATION,
5252
// Assumed to be fast (running on GPU directly).
53+
APPLE,
5354
ARM,
5455
ATI,
5556
BROADCOM,
@@ -61,6 +62,7 @@ enum class glHardwareVendor_t
6162
enum class glDriverVendor_t
6263
{
6364
UNKNOWN,
65+
APPLE,
6466
ATI,
6567
INTEL,
6668
MESA,

0 commit comments

Comments
 (0)