mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[host] windows: directly link D3DKMTSetProcessSchedulingPriorityClass
This function is available since Windows Vista and can therefore be used directly without going through GetProcAddress. Unfortunately, MinGW does not have d3dkmthk.h, but we can declare the prototype ourselves and link against gdi32.dll.
This commit is contained in:
parent
323d321a77
commit
f5ad14b109
@ -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.");
|
||||
|
Loading…
Reference in New Issue
Block a user