1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[dxgi] Implement IDXGIFactory6

This commit is contained in:
Philip Rebohle 2020-10-23 12:15:19 +02:00
parent f81395c742
commit a7de355646
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 34 additions and 1 deletions

View File

@ -223,6 +223,33 @@ namespace dxvk {
} }
HRESULT STDMETHODCALLTYPE DxgiFactory::EnumAdapterByGpuPreference(
UINT Adapter,
DXGI_GPU_PREFERENCE GpuPreference,
REFIID riid,
void** ppvAdapter) {
InitReturnPtr(ppvAdapter);
uint32_t adapterCount = m_instance->adapterCount();
if (Adapter >= adapterCount)
return DXGI_ERROR_NOT_FOUND;
// We know that the backend lists dedicated GPUs before
// any integrated ones, so just list adapters in reverse
// order. We have no other way to estimate performance.
if (GpuPreference == DXGI_GPU_PREFERENCE_MINIMUM_POWER)
Adapter = adapterCount - Adapter - 1;
Com<IDXGIAdapter> adapter;
HRESULT hr = this->EnumAdapters(Adapter, &adapter);
if (FAILED(hr))
return hr;
return adapter->QueryInterface(riid, ppvAdapter);
}
HRESULT STDMETHODCALLTYPE DxgiFactory::EnumWarpAdapter( HRESULT STDMETHODCALLTYPE DxgiFactory::EnumWarpAdapter(
REFIID riid, REFIID riid,
void** ppvAdapter) { void** ppvAdapter) {

View File

@ -10,7 +10,7 @@
namespace dxvk { namespace dxvk {
class DxgiFactory : public DxgiObject<IDXGIFactory5> { class DxgiFactory : public DxgiObject<IDXGIFactory6> {
public: public:
@ -70,6 +70,12 @@ namespace dxvk {
REFIID riid, REFIID riid,
void** ppvAdapter) final; void** ppvAdapter) final;
HRESULT STDMETHODCALLTYPE EnumAdapterByGpuPreference(
UINT Adapter,
DXGI_GPU_PREFERENCE GpuPreference,
REFIID riid,
void** ppvAdapter);
HRESULT STDMETHODCALLTYPE EnumWarpAdapter( HRESULT STDMETHODCALLTYPE EnumWarpAdapter(
REFIID riid, REFIID riid,
void** ppvAdapter) final; void** ppvAdapter) final;