Desktop Duplication on Hybrid Graphics Systems

The Desktop Duplication API allows applications to access frame-by-frame updates to the desktop image associated with a particular DXGI output as a DXGI surface. For hybrid graphics systems, there is a well-known issue that occurs when an application is run on one GPU but attempts to duplicate output from another GPU that is merely acting as a shim for the first. In the case of hybrid graphics laptops, this corresponds to the application being run on the discrete GPU and duplicating the laptop display which is generally connected to an integrated GPU. IDXGIOutput1::DuplicateOutput will fail with DXGI_ERROR_UNSUPPORTED.

Microsoft’s recommended fix for this error is to run the application on the appropriate GPU; in the case of hybrid laptops, this will usually correspond to the integrated (low-power) GPU. Fortunately for application developers, there are programmatic ways of forcing an executable to run on a certain GPU. For NVIDIA Optimus systems, you can use NVAPI to create an application profile and set the relevant flag. For AMD PowerXpress systems, the situation is murkier. Finally, in Windows 10 Build 17093, Microsoft introduced an abstraction that overrides any vendor-specific GPU preference. This abstraction is configurable by programmatically setting a registry value.

Continue reading

Custom Icons in Unreal Engine 4

Custom icons in Unreal Engine 4.

It’s the little things that matter.

If you’re building your own custom actors and components in Unreal Engine 4, then at some point you’ll want to give them a nice icon instead of the default generic one. It’s actually pretty easy to do, but it took me quite a bit of digging since I couldn’t find a ready-made guide. It boils down to the following:

  • Create a SlateStyleSet
  • Set its ContentRoot and CoreContentRoot properly
  • Register SlateImageBrushes for your actor or component
  • Register your SlateStyleSet
  • Register your SlateStyleSet as an icon source

Continue reading