forked from aly/qstbak
muffin v7.5.5
This commit is contained in:
parent
a8f2c1df37
commit
6266f9e6b7
110 changed files with 14907 additions and 6073 deletions
49
Auspex/Auspex.Rendering.Direct3D/FrameRenderContext.cs
Normal file
49
Auspex/Auspex.Rendering.Direct3D/FrameRenderContext.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using TerraFX.Interop.DirectX;
|
||||
|
||||
namespace Auspex.Rendering.Direct3D;
|
||||
|
||||
internal sealed class FrameRenderContext : IDisposable
|
||||
{
|
||||
public unsafe ID3D11Device* Device { get; private set; }
|
||||
|
||||
public unsafe ID3D11DeviceContext* Context { get; private set; }
|
||||
|
||||
public unsafe FrameRenderContext()
|
||||
{
|
||||
Device = (ID3D11Device*)FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.Device.Instance()->D3D11Forwarder;
|
||||
Device->AddRef();
|
||||
ID3D11DeviceContext* context = default(ID3D11DeviceContext*);
|
||||
Marshal.ThrowExceptionForHR(Device->CreateDeferredContext(0u, &context));
|
||||
Context = context;
|
||||
}
|
||||
|
||||
public unsafe void Dispose()
|
||||
{
|
||||
if (Context != null)
|
||||
{
|
||||
Context->Release();
|
||||
Context = null;
|
||||
}
|
||||
if (Device != null)
|
||||
{
|
||||
Device->Release();
|
||||
Device = null;
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public unsafe void Execute()
|
||||
{
|
||||
ID3D11CommandList* ptr = default(ID3D11CommandList*);
|
||||
Marshal.ThrowExceptionForHR(Context->FinishCommandList(false, &ptr));
|
||||
ID3D11DeviceContext* ptr2 = default(ID3D11DeviceContext*);
|
||||
Device->GetImmediateContext(&ptr2);
|
||||
ptr2->ExecuteCommandList(ptr, true);
|
||||
ptr2->Release();
|
||||
ptr->Release();
|
||||
Context->ClearState();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue