Skip to content

Commit

Permalink
Add BackBufferRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Nov 11, 2024
1 parent 3e8c47d commit 5abf3c5
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 12 deletions.
26 changes: 26 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2226,6 +2226,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -2276,6 +2277,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -2433,6 +2435,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -2483,6 +2486,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -4305,6 +4309,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -4355,6 +4360,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -4512,6 +4518,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -4562,6 +4569,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -4719,6 +4727,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -4769,6 +4778,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -7425,6 +7435,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -7475,6 +7486,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -7632,6 +7644,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -7682,6 +7695,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -8673,6 +8687,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -8723,6 +8738,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -9712,6 +9728,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -9762,6 +9779,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -10753,6 +10771,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -10803,6 +10822,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -11794,6 +11814,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -11844,6 +11865,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -12835,6 +12857,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -12885,6 +12908,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down Expand Up @@ -13876,6 +13900,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowsMessageHook.cpp"
"src/cimgui/cimgui.cpp"
"src/mods/APIProxy.cpp"
"src/mods/BackBufferRenderer.cpp"
"src/mods/Camera.cpp"
"src/mods/DeveloperTools.cpp"
"src/mods/FirstPerson.cpp"
Expand Down Expand Up @@ -13926,6 +13951,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
"src/WindowFilter.hpp"
"src/WindowsMessageHook.hpp"
"src/mods/APIProxy.hpp"
"src/mods/BackBufferRenderer.hpp"
"src/mods/Camera.hpp"
"src/mods/DeveloperTools.hpp"
"src/mods/FirstPerson.hpp"
Expand Down
2 changes: 2 additions & 0 deletions src/Mods.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <spdlog/spdlog.h>

#include "mods/BackBufferRenderer.hpp"
#include "mods/APIProxy.hpp"
#include "mods/Camera.hpp"
#include "mods/Graphics.hpp"
Expand All @@ -20,6 +21,7 @@
#include "Mods.hpp"

Mods::Mods() {
m_mods.emplace_back(BackBufferRenderer::get());
m_mods.emplace_back(REFrameworkConfig::get());

#if defined(REENGINE_AT)
Expand Down
14 changes: 14 additions & 0 deletions src/REFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,13 @@ void REFramework::on_post_present_d3d12() {

return;
}

if (m_d3d12.graphics_memory != nullptr) {
auto& hook = get_d3d12_hook();
auto command_queue = hook->get_command_queue();

m_d3d12.graphics_memory->Commit(command_queue);
}

for (auto& mod : m_mods->get_mods()) {
mod->on_post_present();
Expand Down Expand Up @@ -2165,6 +2172,13 @@ bool REFramework::init_d3d12() {

auto device = m_d3d12_hook->get_device();

spdlog::info("[D3D12] Creating DXTK graphics memory...");

// Realistically we only have one device. If not, then... IDK
if (m_d3d12.graphics_memory == nullptr) {
m_d3d12.graphics_memory = std::make_unique<DirectX::DX12::GraphicsMemory>(device);
}

spdlog::info("[D3D12] Creating command allocator...");

m_d3d12.cmd_ctxs.clear();
Expand Down
2 changes: 2 additions & 0 deletions src/REFramework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <imgui.h>
#include <utility/Patch.hpp>

#include <../../directxtk12-src/Inc/GraphicsMemory.h>
#include "mods/vr/d3d12/CommandContext.hpp"

class Mods;
Expand Down Expand Up @@ -315,6 +316,7 @@ class REFramework {
uint32_t rt_height{};

std::array<void*, 2> imgui_backend_datas{};
std::unique_ptr<DirectX::DX12::GraphicsMemory> graphics_memory{}; // for use in several places around REF
} m_d3d12{};

public:
Expand Down
Loading

0 comments on commit 5abf3c5

Please sign in to comment.