diff --git a/host/platform/Windows/src/platform.c b/host/platform/Windows/src/platform.c index e7e93842..10b86a9d 100644 --- a/host/platform/Windows/src/platform.c +++ b/host/platform/Windows/src/platform.c @@ -504,33 +504,25 @@ finish: return result; } +typedef enum _D3DKMT_SCHEDULINGPRIORITYCLASS +{ + D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE = 0, + D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL = 1, + D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL = 2, + D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL = 3, + D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH = 4, + D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME = 5, +} +D3DKMT_SCHEDULINGPRIORITYCLASS; + +NTSTATUS APIENTRY D3DKMTSetProcessSchedulingPriorityClass( + _In_ HANDLE, _In_ D3DKMT_SCHEDULINGPRIORITYCLASS +); + void boostPriority(void) { - typedef enum _D3DKMT_SCHEDULINGPRIORITYCLASS - { - D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE, - D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL, - D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL, - D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL, - D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH, - D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME - } - D3DKMT_SCHEDULINGPRIORITYCLASS; - typedef NTSTATUS WINAPI (*PD3DKMTSetProcessSchedulingPriorityClass) - (HANDLE, D3DKMT_SCHEDULINGPRIORITYCLASS); - - HMODULE gdi32 = GetModuleHandleA("GDI32"); - if (!gdi32) - return; - - PD3DKMTSetProcessSchedulingPriorityClass fn = - (PD3DKMTSetProcessSchedulingPriorityClass) - GetProcAddress(gdi32, "D3DKMTSetProcessSchedulingPriorityClass"); - - if (!fn) - return; - - if (FAILED(fn(GetCurrentProcess(), D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME))) + if (FAILED(D3DKMTSetProcessSchedulingPriorityClass(GetCurrentProcess(), + D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME))) { DEBUG_WARN("Failed to set realtime GPU priority."); DEBUG_INFO("This is not a failure, please do not report this as an issue.");