diff --git a/CMakeLists.txt b/CMakeLists.txt index e7d84d6..8a22f68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -413,7 +413,6 @@ include_directories( "${PROJECT_SOURCE_DIR}/src/contrib/plume" "${PROJECT_SOURCE_DIR}/src/contrib/volk" "${PROJECT_SOURCE_DIR}/src/contrib/D3D12MemoryAllocator/include" - "${PROJECT_SOURCE_DIR}/src/contrib/D3D12MemoryAllocator/src" "${PROJECT_SOURCE_DIR}/src/contrib/imgui" "${PROJECT_SOURCE_DIR}/src/contrib/hlslpp/include" "${PROJECT_SOURCE_DIR}/src/contrib/Vulkan-Headers/include" @@ -464,6 +463,7 @@ if (WIN32) "${PROJECT_SOURCE_DIR}/src/contrib/plume/plume_d3d12.cpp" "${PROJECT_SOURCE_DIR}/src/contrib/imgui/backends/imgui_impl_dx12.cpp" "${PROJECT_SOURCE_DIR}/src/contrib/imgui/backends/imgui_impl_win32.cpp" + "${PROJECT_SOURCE_DIR}/src/contrib/D3D12MemoryAllocator/src/D3D12MemAlloc.cpp" ) target_link_libraries(rt64 delayimp.lib @@ -553,7 +553,7 @@ build_pixel_shader( rt64 "src/shaders/PostProcessPS.hlsl") target_include_directories(rt64 PRIVATE ${CMAKE_BINARY_DIR}/src) if (RT64_BUILD_EXAMPLES) - add_executable(rhi_test "examples/rt64_render_interface.cpp" "examples/rhi_test.cpp") + add_executable(rhi_test "examples/plume_render_interface.cpp" "examples/rhi_test.cpp") target_link_libraries(rhi_test rt64) build_pixel_shader( rhi_test "examples/shaders/RenderInterfaceTestSpecPS.hlsl") diff --git a/examples/rt64_render_interface.cpp b/examples/plume_render_interface.cpp similarity index 99% rename from examples/rt64_render_interface.cpp rename to examples/plume_render_interface.cpp index 5f37c6e..a406daa 100644 --- a/examples/rt64_render_interface.cpp +++ b/examples/plume_render_interface.cpp @@ -1,8 +1,8 @@ // -// RT64 +// plume // -#include "rhi/rt64_render_interface.h" +#include "plume_render_interface.h" #include #include @@ -53,7 +53,7 @@ #include "shaders/RenderInterfaceTestSpecPS.hlsl.metal.h" #endif -namespace RT64 { +namespace plume { static const uint32_t BufferCount = 2; static const RenderFormat SwapchainFormat = RenderFormat::B8G8R8A8_UNORM; static const uint32_t MSAACount = 4; @@ -365,7 +365,7 @@ namespace RT64 { break; case ShaderType::TEXTURE_BINDFUL_PIXEL: data.blob = RenderInterfaceTestTextureBindfulPSBlobDXIL; - data.size = sizeof(RenderInterfaceTestTextureindfulPSBlobDXIL); + data.size = sizeof(RenderInterfaceTestTextureBindfulPSBlobDXIL); break; case ShaderType::TEXTURE_BINDLESS_PIXEL: data.blob = RenderInterfaceTestTextureBindlessPSBlobDXIL; @@ -505,11 +505,11 @@ namespace RT64 { ctx.window = window; ctx.device = renderInterface->createDevice(); ctx.commandQueue = ctx.device->createCommandQueue(RenderCommandListType::DIRECT); - ctx.commandList = ctx.commandQueue->createCommandList(RenderCommandListType::DIRECT); + ctx.commandList = ctx.commandQueue->createCommandList(); ctx.acquireSemaphore = ctx.device->createCommandSemaphore(); ctx.drawSemaphore = ctx.device->createCommandSemaphore(); ctx.commandFence = ctx.device->createCommandFence(); - ctx.swapChain = ctx.commandQueue->createSwapChain(window, BufferCount, SwapchainFormat); + ctx.swapChain = ctx.commandQueue->createSwapChain(window, BufferCount, SwapchainFormat, 2); ctx.linearSampler = ctx.device->createSampler(RenderSamplerDesc()); } @@ -1293,7 +1293,7 @@ namespace RT64 { void initialize(TestContext &ctx) override { device = ctx.device.get(); asyncCommandQueue = ctx.device->createCommandQueue(RenderCommandListType::COMPUTE); - asyncCommandList = asyncCommandQueue->createCommandList(RenderCommandListType::COMPUTE); + asyncCommandList = asyncCommandQueue->createCommandList(); asyncCommandFence = ctx.device->createCommandFence(); // Update descriptor set builder to include two structured buffer views diff --git a/examples/rhi_test.cpp b/examples/rhi_test.cpp index 724fee0..4f6e088 100644 --- a/examples/rhi_test.cpp +++ b/examples/rhi_test.cpp @@ -1,33 +1,33 @@ -#include "rhi/rt64_render_interface.h" +#include "plume_render_interface.h" -namespace RT64 { +namespace plume { extern std::unique_ptr CreateD3D12Interface(); extern std::unique_ptr CreateVulkanInterface(); extern std::unique_ptr CreateMetalInterface(); } -std::unique_ptr CreateRenderInterface() { +std::unique_ptr CreateRenderInterface() { #if defined(_WIN32) - const bool useVulkan = true; // Or derive this from configuration or runtime check. + const bool useVulkan = false; // Or derive this from configuration or runtime check. if (!useVulkan) { - return RT64::CreateD3D12Interface(); + return plume::CreateD3D12Interface(); } // Fallback to Vulkan if D3D12 is not chosen or available. - return RT64::CreateVulkanInterface(); + return plume::CreateVulkanInterface(); #elif defined(__APPLE__) const bool useMVK = false; // Or derive this from configuration or runtime check. if (useMVK) { - return RT64::CreateVulkanInterface(); + return plume::CreateVulkanInterface(); } - return RT64::CreateMetalInterface(); + return plume::CreateMetalInterface(); #else - return RT64::CreateVulkanInterface(); + return plume::CreateVulkanInterface(); #endif } int main(int argc, char** argv) { auto renderInterface = CreateRenderInterface(); // Execute a blocking test that creates a window and draws some geometry to test the render interface. - RT64::RenderInterfaceTest(renderInterface.get()); + plume::RenderInterfaceTest(renderInterface.get()); } diff --git a/examples/shaders/RenderInterfaceTestSpecPS.hlsl b/examples/shaders/RenderInterfaceTestSpecPS.hlsl index e93dcae..291317a 100644 --- a/examples/shaders/RenderInterfaceTestSpecPS.hlsl +++ b/examples/shaders/RenderInterfaceTestSpecPS.hlsl @@ -1,3 +1,6 @@ +// +// RT64 +// [[vk::constant_id(0)]] const uint useRed = 0; diff --git a/src/contrib/plume b/src/contrib/plume index 7c89c80..20368b8 160000 --- a/src/contrib/plume +++ b/src/contrib/plume @@ -1 +1 @@ -Subproject commit 7c89c8084382d9aec21e0f3dea4828055dfdaba4 +Subproject commit 20368b866423d0b48a505fa3e4b770b05d08fe9d diff --git a/src/gui/rt64_inspector.cpp b/src/gui/rt64_inspector.cpp index cd7dd2c..6ceb97f 100644 --- a/src/gui/rt64_inspector.cpp +++ b/src/gui/rt64_inspector.cpp @@ -25,7 +25,7 @@ #endif #if defined(_WIN32) -# include "d3d12/rt64_d3d12.h" +# include "plume_d3d12.h" #endif static std::string IniFilenameUTF8; @@ -95,9 +95,9 @@ namespace RT64 { D3D12DescriptorSet *interfaceDescriptorSet = static_cast(descriptorSet.get()); const D3D12SwapChain *interfaceSwapChain = static_cast(swapChain); - const D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle = interfaceDevice->viewHeapAllocator->getShaderCPUHandleAt(interfaceDescriptorSet->viewAllocation.offset); - const D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle = interfaceDevice->viewHeapAllocator->getShaderGPUHandleAt(interfaceDescriptorSet->viewAllocation.offset); - ImGui_ImplDX12_Init(interfaceDevice->d3d, 2, interfaceSwapChain->nativeFormat, interfaceDevice->viewHeapAllocator->shaderHeap, cpuHandle, gpuHandle); + const D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle = interfaceDevice->viewHeapAllocator->getCPUHandleAt(interfaceDescriptorSet->viewAllocation.offset); + const D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle = interfaceDevice->viewHeapAllocator->getGPUHandleAt(interfaceDescriptorSet->viewAllocation.offset); + ImGui_ImplDX12_Init(interfaceDevice->d3d, 2, interfaceSwapChain->nativeFormat, interfaceDevice->viewHeapAllocator->heap, cpuHandle, gpuHandle); # else assert(false && "Unsupported Graphics API."); return; diff --git a/src/render/rt64_shader_compiler.h b/src/render/rt64_shader_compiler.h index f546614..453bf13 100644 --- a/src/render/rt64_shader_compiler.h +++ b/src/render/rt64_shader_compiler.h @@ -11,7 +11,9 @@ #include -#include "rhi/rt64_render_interface.h" +#include "plume_render_interface.h" + +using namespace plume; namespace RT64 { struct ShaderCompiler {