Skip to content

Commit

Permalink
dx11on12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Nov 29, 2024
1 parent a588e7a commit bca23d7
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 15 deletions.
2 changes: 1 addition & 1 deletion external/FusionDxHook
2 changes: 1 addition & 1 deletion external/sire
Submodule sire updated 1 files
+370 −103 sire.h
53 changes: 49 additions & 4 deletions source/PCSX2F.XboxRainDroplets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,13 @@ extern "C" __declspec(dllexport) void InitializeASI()
#if FUSIONDXHOOK_INCLUDE_D3D11
FusionDxHook::D3D11::onPresentEvent += [](IDXGISwapChain* pSwapChain)
{
Sire::Init(Sire::SIRE_RENDERER_DX11, pSwapChain);

RenderDroplets();
#ifdef SIRE_INCLUDE_DX11ON12
if (!d3d11on12::isD3D11on12)
#endif
{
Sire::Init(Sire::SIRE_RENDERER_DX11, pSwapChain);
RenderDroplets();
}
};

FusionDxHook::D3D11::onAfterResizeEvent += [](IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
Expand All @@ -247,11 +251,52 @@ extern "C" __declspec(dllexport) void InitializeASI()
};

FusionDxHook::D3D11::onShutdownEvent += []()
{
#ifdef SIRE_INCLUDE_DX11ON12
if (!d3d11on12::isD3D11on12)
#endif
{
WaterDrops::Shutdown();
Sire::Shutdown();
}
};
#endif // FUSIONDXHOOK_INCLUDE_D3D11

// D3D11on12
#if FUSIONDXHOOK_INCLUDE_D3D12
FusionDxHook::D3D12::onPresentEvent += [](IDXGISwapChain* pSwapChain)
{
Sire::Init(Sire::SIRE_RENDERER_DX11, pSwapChain);
RenderDroplets();
};

#ifdef SIRE_INCLUDE_DX11ON12
FusionDxHook::D3D12::onExecuteCommandListsEvent += [](ID3D12CommandQueue* pCommandQueue, UINT NumCommandLists, const ID3D12CommandList** ppCommandLists)
{
if (pCommandQueue->GetDesc().Type == D3D12_COMMAND_LIST_TYPE_DIRECT)
{
Sire::SetCommandQueue(pCommandQueue);
}
};
#endif

FusionDxHook::D3D12::onBeforeResizeEvent += [](IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
{
WaterDrops::Reset();
Sire::Shutdown();
};

FusionDxHook::D3D12::onAfterResizeEvent += [](IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
{

};

FusionDxHook::D3D12::onShutdownEvent += []()
{
WaterDrops::Shutdown();
Sire::Shutdown();
};
#endif // FUSIONDXHOOK_INCLUDE_D3D11
#endif // FUSIONDXHOOK_INCLUDE_D3D12

#if FUSIONDXHOOK_INCLUDE_OPENGL
FusionDxHook::OPENGL::onSwapBuffersEvent += [](HDC hDC)
Expand Down
50 changes: 41 additions & 9 deletions source/XboxRainDropletsWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define FUSIONDXHOOK_INCLUDE_OPENGL 1
#define FUSIONDXHOOK_INCLUDE_VULKAN 1
#define FUSIONDXHOOK_USE_SAFETYHOOK 1
#define DELAYED_BIND 2000ms
#define DELAYED_BIND 10000ms
#include "FusionDxHook.h"

extern "C" __declspec(dllexport) void InitializeASI()
Expand Down Expand Up @@ -100,15 +100,26 @@ extern "C" __declspec(dllexport) void InitializeASI()
#if FUSIONDXHOOK_INCLUDE_D3D11
FusionDxHook::D3D11::onPresentEvent += [](IDXGISwapChain* pSwapChain)
{
Sire::Init(Sire::SIRE_RENDERER_DX11, pSwapChain);

WaterDrops::Process();
WaterDrops::Render();
#ifdef SIRE_INCLUDE_DX11ON12
if (!d3d11on12::isD3D11on12)
#endif
{
Sire::Init(Sire::SIRE_RENDERER_DX11, pSwapChain);

WaterDrops::Process();
WaterDrops::Render();
}
};

FusionDxHook::D3D11::onAfterResizeEvent += [](IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
FusionDxHook::D3D11::onBeforeResizeEvent += [](IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
{

#ifdef SIRE_INCLUDE_DX11ON12
if (!d3d11on12::isD3D11on12)
#endif
{
WaterDrops::Reset();
Sire::Shutdown();
}
};

FusionDxHook::D3D11::onShutdownEvent += []()
Expand All @@ -118,21 +129,42 @@ extern "C" __declspec(dllexport) void InitializeASI()
};
#endif // FUSIONDXHOOK_INCLUDE_D3D11

// D3D11on12
#if FUSIONDXHOOK_INCLUDE_D3D12
FusionDxHook::D3D12::onPresentEvent += [](IDXGISwapChain*)
FusionDxHook::D3D12::onPresentEvent += [](IDXGISwapChain* pSwapChain)
{
Sire::Init(Sire::SIRE_RENDERER_DX11, pSwapChain);

WaterDrops::Process();
WaterDrops::Render();
};

FusionDxHook::D3D12::onBeforeResizeEvent += [](IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
#ifdef SIRE_INCLUDE_DX11ON12
FusionDxHook::D3D12::onExecuteCommandListsEvent += [](ID3D12CommandQueue* pCommandQueue, UINT NumCommandLists, const ID3D12CommandList** ppCommandLists)
{
if (pCommandQueue->GetDesc().Type == D3D12_COMMAND_LIST_TYPE_DIRECT)
{
Sire::SetCommandQueue(pCommandQueue);
}
};
#endif

FusionDxHook::D3D12::onBeforeResizeEvent += [](IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
{
WaterDrops::Reset();
Sire::Shutdown();
};

FusionDxHook::D3D12::onAfterResizeEvent += [](IDXGISwapChain* pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
{

};

FusionDxHook::D3D12::onShutdownEvent += []()
{
WaterDrops::Shutdown();
Sire::Shutdown();
};
#endif // FUSIONDXHOOK_INCLUDE_D3D12

#if FUSIONDXHOOK_INCLUDE_OPENGL
Expand Down

0 comments on commit bca23d7

Please sign in to comment.