diff --git a/UnleashedRecomp/CMakeLists.txt b/UnleashedRecomp/CMakeLists.txt index df5c1cd6..0b1673f3 100644 --- a/UnleashedRecomp/CMakeLists.txt +++ b/UnleashedRecomp/CMakeLists.txt @@ -122,6 +122,7 @@ find_package(zstd CONFIG REQUIRED) find_package(Stb REQUIRED) find_package(unofficial-concurrentqueue REQUIRED) find_package(imgui CONFIG REQUIRED) +find_path(CONJURE_ENUM_INCLUDE_DIRS "conjure_enum.hpp") file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/D3D12) add_custom_command(TARGET UnleashedRecomp POST_BUILD @@ -164,6 +165,7 @@ target_include_directories(UnleashedRecomp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/api ${SWA_THIRDPARTY_ROOT}/ddspp ${Stb_INCLUDE_DIR} + ${CONJURE_ENUM_INCLUDE_DIRS} ) target_precompile_headers(UnleashedRecomp PUBLIC ${SWA_PRECOMPILED_HEADERS}) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index 01479f0e..0a521bf6 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -239,6 +239,8 @@ static xxHashMap> g_pipelines; static std::atomic g_pipelinesCreatedInRenderThread; static std::atomic g_pipelinesCreatedAsynchronously; static std::atomic g_pipelinesDropped; +static std::string g_pipelineDebugText; +static Mutex g_debugMutex; #endif static std::atomic g_compilingModelCount; @@ -1680,6 +1682,9 @@ static void DrawImGui() ImGui::Text("Pipelines Dropped: %d", g_pipelinesDropped.load()); ImGui::Text("Compiling Model Count: %d", g_compilingModelCount.load()); ImGui::Text("Pending Model Count: %d", g_pendingModelCount.load()); + + std::lock_guard lock(g_debugMutex); + ImGui::TextUnformatted(g_pipelineDebugText.c_str()); } ImGui::End(); #endif @@ -2737,6 +2742,71 @@ static RenderPipeline* CreateGraphicsPipelineInRenderThread(PipelineState pipeli ++g_pipelinesCreatedInRenderThread; pipeline->setName(std::format("{} {} {:X}", pipelineState.vertexShader->name, pipelineState.pixelShader != nullptr ? pipelineState.pixelShader->name : "", hash)); + + auto enumToString = [](T value) + { + return FIX8::conjure_enum::enum_to_string(value); + }; + + std::lock_guard lock(g_debugMutex); + g_pipelineDebugText = std::format( + "PipelineState {:X}:\n" + " vertexShader: {}\n" + " pixelShader: {}\n" + " instancing: {}\n" + " zEnable: {}\n" + " zWriteEnable: {}\n" + " srcBlend: {}\n" + " destBlend: {}\n" + " cullMode: {}\n" + " zFunc: {}\n" + " alphaBlendEnable: {}\n" + " blendOp: {}\n" + " slopeScaledDepthBias: {}\n" + " depthBias: {}\n" + " srcBlendAlpha: {}\n" + " destBlendAlpha: {}\n" + " blendOpAlpha: {}\n" + " colorWriteEnable: {:X}\n" + " primitiveTopology: {}\n" + " vertexStrides[0]: {}\n" + " vertexStrides[1]: {}\n" + " vertexStrides[2]: {}\n" + " vertexStrides[3]: {}\n" + " renderTargetFormat: {}\n" + " depthStencilFormat: {}\n" + " sampleCount: {}\n" + " enableAlphaToCoverage: {}\n" + " specConstants: {:X}\n", + hash, + pipelineState.vertexShader->name, + pipelineState.pixelShader != nullptr ? pipelineState.pixelShader->name : "", + pipelineState.instancing, + pipelineState.zEnable, + pipelineState.zWriteEnable, + enumToString(pipelineState.srcBlend), + enumToString(pipelineState.destBlend), + enumToString(pipelineState.cullMode), + enumToString(pipelineState.zFunc), + pipelineState.alphaBlendEnable, + enumToString(pipelineState.blendOp), + pipelineState.slopeScaledDepthBias, + pipelineState.depthBias, + enumToString(pipelineState.srcBlendAlpha), + enumToString(pipelineState.destBlendAlpha), + enumToString(pipelineState.blendOpAlpha), + pipelineState.colorWriteEnable, + enumToString(pipelineState.primitiveTopology), + pipelineState.vertexStrides[0], + pipelineState.vertexStrides[1], + pipelineState.vertexStrides[2], + pipelineState.vertexStrides[3], + enumToString(pipelineState.renderTargetFormat), + enumToString(pipelineState.depthStencilFormat), + pipelineState.sampleCount, + pipelineState.enableAlphaToCoverage, + pipelineState.specConstants) + + g_pipelineDebugText; #endif } diff --git a/UnleashedRecomp/stdafx.h b/UnleashedRecomp/stdafx.h index a4fc08f1..b244781b 100644 --- a/UnleashedRecomp/stdafx.h +++ b/UnleashedRecomp/stdafx.h @@ -30,6 +30,7 @@ #include #include #include +#include using Microsoft::WRL::ComPtr; diff --git a/vcpkg.json b/vcpkg.json index 46ee79ad..6cd72992 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -19,6 +19,7 @@ { "name": "imgui", "features": [ "sdl2-binding" ] - } + }, + "conjure-enum" ] }