mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-22 23:55:02 +00:00
Allow forcing Metal renderer on or off via VT_FORCE_METAL=1 and VT_FORCE_METAL=0 respectively
This commit is contained in:
parent
654e386263
commit
fe6562e31c
1 changed files with 15 additions and 2 deletions
|
@ -587,6 +587,12 @@ public:
|
|||
}
|
||||
|
||||
id<MTLDevice> getMetalDevice() {
|
||||
if (qgetenv("VT_FORCE_METAL") == "0") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Avoiding Metal renderer due to VT_FORCE_METAL=0 override.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (@available(macOS 11.0, *)) {
|
||||
NSArray<id<MTLDevice>> *devices = [MTLCopyAllDevices() autorelease];
|
||||
if (devices.count == 0) {
|
||||
|
@ -601,8 +607,15 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Avoiding Metal renderer due to use of dGPU/eGPU");
|
||||
if (qgetenv("VT_FORCE_METAL") == "1") {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using Metal renderer due to VT_FORCE_METAL=1 override.");
|
||||
return MTLCreateSystemDefaultDevice();
|
||||
}
|
||||
else {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Avoiding Metal renderer due to use of dGPU/eGPU. Use VT_FORCE_METAL=1 to override.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
|
|
Loading…
Reference in a new issue