Do minor cleanups with D3D11 handling
This commit is contained in:
parent
2dd9284b76
commit
ddf9a70bcf
|
@ -58,7 +58,7 @@ namespace BizHawk.Bizware.Graphics
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// note: Silk.NET's WGL.IsExtensionPresent function seemed to be bugged and just result in NREs...
|
// note: Silk.NET's WGL.IsExtensionPresent function seems to be bugged and just results in NREs...
|
||||||
NVDXInterop = new(new LamdaNativeContext(SDL2OpenGLContext.GetGLProcAddress));
|
NVDXInterop = new(new LamdaNativeContext(SDL2OpenGLContext.GetGLProcAddress));
|
||||||
if (NVDXInterop.CurrentVTable.Load("wglDXOpenDeviceNV") == IntPtr.Zero
|
if (NVDXInterop.CurrentVTable.Load("wglDXOpenDeviceNV") == IntPtr.Zero
|
||||||
|| NVDXInterop.CurrentVTable.Load("wglDXCloseDeviceNV") == IntPtr.Zero
|
|| NVDXInterop.CurrentVTable.Load("wglDXCloseDeviceNV") == IntPtr.Zero
|
||||||
|
@ -122,6 +122,7 @@ namespace BizHawk.Bizware.Graphics
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly D3D11Resources _resources;
|
private readonly D3D11Resources _resources;
|
||||||
|
private ID3D11Device Device => _resources.Device;
|
||||||
|
|
||||||
private IntPtr _dxInteropDevice;
|
private IntPtr _dxInteropDevice;
|
||||||
private IntPtr _lastGLContext;
|
private IntPtr _lastGLContext;
|
||||||
|
@ -131,18 +132,15 @@ namespace BizHawk.Bizware.Graphics
|
||||||
|
|
||||||
public D3D11GLInterop(D3D11Resources resources)
|
public D3D11GLInterop(D3D11Resources resources)
|
||||||
{
|
{
|
||||||
using (new SavedOpenGLContext())
|
_resources = resources;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_resources = resources;
|
OpenInteropDevice();
|
||||||
try
|
}
|
||||||
{
|
catch
|
||||||
OpenInteropDevice();
|
{
|
||||||
}
|
Dispose();
|
||||||
catch
|
throw;
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +148,7 @@ namespace BizHawk.Bizware.Graphics
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
_dxInteropDevice = NVDXInterop.DxopenDevice((void*)_resources.Device.NativePointer);
|
_dxInteropDevice = NVDXInterop.DxopenDevice((void*)Device.NativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_dxInteropDevice == IntPtr.Zero)
|
if (_dxInteropDevice == IntPtr.Zero)
|
||||||
|
|
|
@ -20,10 +20,10 @@ namespace BizHawk.Bizware.Graphics
|
||||||
// these might need to be thrown out and recreated if the device is lost
|
// these might need to be thrown out and recreated if the device is lost
|
||||||
private readonly D3D11Resources _resources;
|
private readonly D3D11Resources _resources;
|
||||||
|
|
||||||
private IDXGIFactory1 Factory1 => _resources.Factory1;
|
|
||||||
private IDXGIFactory2 Factory2 => _resources.Factory2;
|
|
||||||
private ID3D11Device Device => _resources.Device;
|
private ID3D11Device Device => _resources.Device;
|
||||||
private ID3D11DeviceContext Context => _resources.Context;
|
private ID3D11DeviceContext Context => _resources.Context;
|
||||||
|
private IDXGIFactory1 Factory1 => _resources.Factory1;
|
||||||
|
private IDXGIFactory2 Factory2 => _resources.Factory2;
|
||||||
private ID3D11BlendState BlendEnableState => _resources.BlendEnableState;
|
private ID3D11BlendState BlendEnableState => _resources.BlendEnableState;
|
||||||
private ID3D11BlendState BlendDisableState => _resources.BlendDisableState;
|
private ID3D11BlendState BlendDisableState => _resources.BlendDisableState;
|
||||||
private ID3D11RasterizerState RasterizerState => _resources.RasterizerState;
|
private ID3D11RasterizerState RasterizerState => _resources.RasterizerState;
|
||||||
|
|
Loading…
Reference in New Issue