2

For a executable file or static lib, I know it can use

extern "C"
  {
    __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
  }

to select the high performance GPU, but how to use it in C# or dynamic link library?

Is there any other way to change the power saving mode setting?

Tsai. Mark
  • 23
  • 2

1 Answers1

0

NvPatch & EditBinPE & IL ASSEMBLY & C#

To enable AmdPowerXpressRequestHighPerformance you must use one of two applications, nvpatch and EditBinPE. Since so far it is not possible to export symbols in pure C# itself, it is only possible to do so directly in the IL assembly ...

EditBinPE

EditBinPE command: editbinpe --enable-gpu filename.exe or editbinpe --enable filename.exe AmdPowerXpressRequestHighPerformance

NvPatch

nvpatch command: nvpatch --enable filename.exe

IL Assembly

.class public WindowsApplication1.ForceDedicatedGraphicCard
{
    .method public static uint32 AmdPowerXpressRequestHighPerformance() cil managed
    {
        .export [2]
        ldc.i4.1
        ret
    }
}

END

To check if it has been qualified use dumpbin:

dumpbin.exe /exports your_project.exe

Edit: this question looks like a duplicate of this one: Forcing hardware accelerated rendering