(D3D) Cleanups

This commit is contained in:
libretroadmin 2022-05-17 23:28:18 +02:00
parent 5a5c65d9b9
commit c527bce8e3
3 changed files with 36 additions and 75 deletions

View File

@ -48,18 +48,12 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain(
static PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN fp;
if (!d3d10_dll)
d3d10_dll = dylib_load("d3d10.dll");
if (!d3d10_dll)
return TYPE_E_CANTLOADLIBRARY;
if (!(d3d10_dll = dylib_load("d3d10.dll")))
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN)dylib_proc(
d3d10_dll, "D3D10CreateDeviceAndSwapChain");
if (!fp)
return TYPE_E_DLLFUNCTIONNOTFOUND;
if (!(fp = (PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN)dylib_proc(
d3d10_dll, "D3D10CreateDeviceAndSwapChain")))
return TYPE_E_DLLFUNCTIONNOTFOUND;
return fp(
pAdapter, DriverType, Software, Flags, SDKVersion,
pSwapChainDesc, ppSwapChain, ppDevice);

View File

@ -39,18 +39,12 @@ HRESULT WINAPI D3D11CreateDevice(
static PFN_D3D11_CREATE_DEVICE fp;
if (!d3d11_dll)
d3d11_dll = dylib_load("d3d11.dll");
if (!d3d11_dll)
return TYPE_E_CANTLOADLIBRARY;
if (!(d3d11_dll = dylib_load("d3d11.dll")))
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D11_CREATE_DEVICE)dylib_proc(
d3d11_dll, "D3D11CreateDevice");
if (!fp)
return TYPE_E_DLLFUNCTIONNOTFOUND;
if (!(fp = (PFN_D3D11_CREATE_DEVICE)dylib_proc(
d3d11_dll, "D3D11CreateDevice")))
return TYPE_E_DLLFUNCTIONNOTFOUND;
return fp(
pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion,
ppDevice, pFeatureLevel, ppImmediateContext);
@ -74,18 +68,12 @@ HRESULT WINAPI D3D11CreateDeviceAndSwapChain(
static PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN fp;
if (!d3d11_dll)
d3d11_dll = dylib_load("d3d11.dll");
if (!d3d11_dll)
return TYPE_E_CANTLOADLIBRARY;
if (!(d3d11_dll = dylib_load("d3d11.dll")))
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)dylib_proc(
d3d11_dll, "D3D11CreateDeviceAndSwapChain");
if (!fp)
return TYPE_E_DLLFUNCTIONNOTFOUND;
if (!(fp = (PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)dylib_proc(
d3d11_dll, "D3D11CreateDeviceAndSwapChain")))
return TYPE_E_DLLFUNCTIONNOTFOUND;
return fp(
pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion,
pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext);
@ -117,7 +105,7 @@ void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture)
while (width && height)
{
width >>= 1;
width >>= 1;
height >>= 1;
texture->desc.MipLevels++;
}

View File

@ -84,17 +84,12 @@ HRESULT WINAPI D3D12CreateDevice(
{
static PFN_D3D12_CREATE_DEVICE fp;
if (!d3d12_dll)
d3d12_dll = dylib_load(d3d12_dll_name);
if (!d3d12_dll)
return TYPE_E_CANTLOADLIBRARY;
if (!(d3d12_dll = dylib_load(d3d12_dll_name)))
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D12_CREATE_DEVICE)dylib_proc(d3d12_dll, "D3D12CreateDevice");
if (!fp)
return TYPE_E_DLLFUNCTIONNOTFOUND;
if (!(fp = (PFN_D3D12_CREATE_DEVICE)dylib_proc(d3d12_dll,
"D3D12CreateDevice")))
return TYPE_E_DLLFUNCTIONNOTFOUND;
return fp(pAdapter, MinimumFeatureLevel, riid, ppDevice);
}
@ -102,17 +97,12 @@ HRESULT WINAPI D3D12GetDebugInterface(REFIID riid, void** ppvDebug)
{
static PFN_D3D12_GET_DEBUG_INTERFACE fp;
if (!d3d12_dll)
d3d12_dll = dylib_load(d3d12_dll_name);
if (!d3d12_dll)
return TYPE_E_CANTLOADLIBRARY;
if (!(d3d12_dll = dylib_load(d3d12_dll_name)))
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D12_GET_DEBUG_INTERFACE)dylib_proc(d3d12_dll, "D3D12GetDebugInterface");
if (!fp)
return TYPE_E_DLLFUNCTIONNOTFOUND;
if (!(fp = (PFN_D3D12_GET_DEBUG_INTERFACE)dylib_proc(d3d12_dll,
"D3D12GetDebugInterface")))
return TYPE_E_DLLFUNCTIONNOTFOUND;
return fp(riid, ppvDebug);
}
@ -124,17 +114,12 @@ HRESULT WINAPI D3D12SerializeRootSignature(
{
static PFN_D3D12_SERIALIZE_ROOT_SIGNATURE fp;
if (!d3d12_dll)
d3d12_dll = dylib_load(d3d12_dll_name);
if (!d3d12_dll)
return TYPE_E_CANTLOADLIBRARY;
if (!(d3d12_dll = dylib_load(d3d12_dll_name)))
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)dylib_proc(d3d12_dll, "D3D12SerializeRootSignature");
if (!fp)
return TYPE_E_DLLFUNCTIONNOTFOUND;
if (!(fp = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)dylib_proc(d3d12_dll,
"D3D12SerializeRootSignature")))
return TYPE_E_DLLFUNCTIONNOTFOUND;
return fp(pRootSignature, Version, ppBlob, ppErrorBlob);
}
@ -145,18 +130,12 @@ HRESULT WINAPI D3D12SerializeVersionedRootSignature(
{
static PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE fp;
if (!d3d12_dll)
d3d12_dll = dylib_load(d3d12_dll_name);
if (!d3d12_dll)
return TYPE_E_CANTLOADLIBRARY;
if (!(d3d12_dll = dylib_load(d3d12_dll_name)))
return TYPE_E_CANTLOADLIBRARY;
if (!fp)
fp = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)dylib_proc(
d3d12_dll, "D3D12SerializeRootSignature");
if (!fp)
return TYPE_E_DLLFUNCTIONNOTFOUND;
if (!(fp = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)dylib_proc(
d3d12_dll, "D3D12SerializeRootSignature")))
return TYPE_E_DLLFUNCTIONNOTFOUND;
return fp(pRootSignature, ppBlob, ppErrorBlob);
}
#endif