mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 06:30:55 +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:
@@ -587,6 +587,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
id<MTLDevice> getMetalDevice() {
|
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, *)) {
|
if (@available(macOS 11.0, *)) {
|
||||||
NSArray<id<MTLDevice>> *devices = [MTLCopyAllDevices() autorelease];
|
NSArray<id<MTLDevice>> *devices = [MTLCopyAllDevices() autorelease];
|
||||||
if (devices.count == 0) {
|
if (devices.count == 0) {
|
||||||
@@ -601,8 +607,15 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
if (qgetenv("VT_FORCE_METAL") == "1") {
|
||||||
"Avoiding Metal renderer due to use of dGPU/eGPU");
|
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 {
|
else {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
|||||||
Reference in New Issue
Block a user