To indicate that your SharpDX application prefers to use the dedicated graphics card (like an NVIDIA RTX) instead of the integrated graphics card, you can use a few methods:
1. Set Preferred Graphics Processor in the NVIDIA Control Panel (User Configuration):
Go to the NVIDIA Control Panel → "Manage 3D settings."
Under "Program Settings," add your SharpDX application and set it to use the "High-performance NVIDIA processor."
This allows users to choose their preferred GPU, but it doesn't enforce the choice programmatically from within the application.
2. Use DXGI to Specify High-Performance GPU in Code (Programmatic Approach):
Since Windows 10 (version 1803), Microsoft provides an API that allows applications to request the high-performance GPU.
Here’s how you can do it programmatically using the DXGI interface in SharpDX:
using SharpDX.DXGI;
// Create a factory to enumerate adapters
using (var factory = new Factory4())
{
Adapter1 adapter = null;
// Iterate through all adapters
for (int i = 0; i < factory.Adapters1.Length; i++)
{
var tmpAdapter = factory.GetAdapter1(i);
var desc = tmpAdapter.Description1;
// Check if the adapter is the high-performance GPU
if ((desc.Flags & AdapterFlags.Software) == 0 && tmpAdapter.Description1.DeviceId != 0)
{
adapter = tmpAdapter;
break;
}
}
// Create the device using the high-performance adapter
if (adapter != null)
{
var device = new SharpDX.Direct3D11.Device(adapter);
}
else
{
throw new Exception("No high-performance GPU found.");
}
}
3. Directly Specify GPU for Windows (DX12):
For more control, especially in DirectX 12, you can query available GPUs and select the high-performance one based on its hardware type (discrete vs. integrated). However, SharpDX mostly works with DirectX 11, and the method above works for DX11 applications.
4. High Performance GPU via app.manifest:
You can also indicate GPU preference at the manifest level for Windows:
The choice of the graphics cards appears to be random and nontransparent:
https://uc7b04bcb73b8b6abddf797fedb7.dl.dropboxusercontent.com/cd/0/inline/CbNDCbYz6bQK-f7aenAYId7Pcr-KyAEznr0ZDcJ9atzjw-Hq_H_OhRwQFyk8mcprWNz1IQjQvV7S9Erpr1sxYJHutUJQ0cwXuLy3Xmzhn1qkvVcqbfZcFkwHiCWu_TZBjT8/file#
ChatGPT suggests these solutions:
To indicate that your SharpDX application prefers to use the dedicated graphics card (like an NVIDIA RTX) instead of the integrated graphics card, you can use a few methods:
1. Set Preferred Graphics Processor in the NVIDIA Control Panel (User Configuration):
This allows users to choose their preferred GPU, but it doesn't enforce the choice programmatically from within the application.
2. Use DXGI to Specify High-Performance GPU in Code (Programmatic Approach):
Since Windows 10 (version 1803), Microsoft provides an API that allows applications to request the high-performance GPU.
Here’s how you can do it programmatically using the
DXGI
interface in SharpDX:3. Directly Specify GPU for Windows (DX12):
For more control, especially in DirectX 12, you can query available GPUs and select the high-performance one based on its hardware type (discrete vs. integrated). However, SharpDX mostly works with DirectX 11, and the method above works for DX11 applications.
4. High Performance GPU via
app.manifest
:You can also indicate GPU preference at the manifest level for Windows:
This will tell the system to prefer the high-performance GPU.
By combining these approaches, your application can better target dedicated GPUs without requiring manual user configuration.