From: Zhiyi Zhang Subject: Re: [PATCH] dlls/dxgi: Implement IDXGIFactory5::CheckFeatureSupport. Message-Id: <0c1ed357-9432-1f52-3c65-34a36838412c@codeweavers.com> Date: Wed, 1 Apr 2020 23:13:49 +0800 In-Reply-To: <20200331111941.15956-1-post@arntzen-software.no> References: <20200331111941.15956-1-post@arntzen-software.no> On 3/31/20 7:19 PM, Hans-Kristian Arntzen wrote: > Enables certain D3D12 games to use sync off, since they gate their use > of swap_interval == 0 on this feature being present. > > Signed-off-by: Hans-Kristian Arntzen > --- > dlls/dxgi/factory.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c > index 3f41df9e36..62148adf20 100644 > --- a/dlls/dxgi/factory.c > +++ b/dlls/dxgi/factory.c > @@ -445,10 +445,21 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumWarpAdapter(IWineDXGIFactory * > static HRESULT STDMETHODCALLTYPE dxgi_factory_CheckFeatureSupport(IWineDXGIFactory *iface, > DXGI_FEATURE feature, void *feature_data, UINT data_size) > { > - FIXME("iface %p, feature %#x, feature_data %p, data_size %u stub!\n", > + TRACE("iface %p, feature %#x, feature_data %p, data_size %u.\n", > iface, feature, feature_data, data_size); > Hi, It looks good generally. It's would be better to use a switch statement rather than a if because there are other features. You can add some basic validity checks for other parameters as well. And adding a test should be easy. Thanks, Zhiyi > - return E_NOTIMPL; > + if (feature == DXGI_FEATURE_PRESENT_ALLOW_TEARING) > + { > + if (data_size == sizeof(BOOL)) > + { > + *(BOOL *)feature_data = TRUE; > + return S_OK; > + } > + else > + return DXGI_ERROR_INVALID_CALL; Here I prefer checking data_size != sizeof(BOOL) and return early. > + } > + else > + return DXGI_ERROR_UNSUPPORTED; > } > > static const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl =