diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index c32e233e..01479f0e 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -36,8 +36,6 @@ #include "shader/resolve_msaa_depth_8x.hlsl.dxil.h" #include "shader/resolve_msaa_depth_8x.hlsl.spirv.h" -//#define ASYNC_PSO_DEBUG - extern "C" { __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; @@ -2737,7 +2735,8 @@ static RenderPipeline* CreateGraphicsPipelineInRenderThread(PipelineState pipeli #ifdef ASYNC_PSO_DEBUG ++g_pipelinesCreatedInRenderThread; - pipeline->setName(std::format("Render Thread Pipeline {:X}", hash)); + pipeline->setName(std::format("{} {} {:X}", + pipelineState.vertexShader->name, pipelineState.pixelShader != nullptr ? pipelineState.pixelShader->name : "", hash)); #endif } @@ -4296,7 +4295,7 @@ static void CreateGraphicsPipelineInPipelineThread(const PipelineState& pipeline if (shouldCompile) { auto pipeline = CreateGraphicsPipeline(pipelineState); - pipeline->setName(std::format("Async Pipeline {} {:X}", name, hash)); + pipeline->setName(std::format("ASYNC {} {:X}", name, hash)); // Will get dropped in render thread if a different thread already managed to compile this. RenderCommand cmd; @@ -4721,6 +4720,26 @@ static void ModelConsumerThread() static std::thread g_modelConsumerThread(ModelConsumerThread); +#ifdef ASYNC_PSO_DEBUG + +PPC_FUNC_IMPL(__imp__sub_82E33330); +PPC_FUNC(sub_82E33330) +{ + auto vertexShaderCode = reinterpret_cast(g_memory.Translate(ctx.r4.u32)); + __imp__sub_82E33330(ctx, base); + reinterpret_cast(vertexShaderCode->m_pD3DVertexShader.get())->name = vertexShaderCode->m_TypeAndName.c_str() + 3; +} + +PPC_FUNC_IMPL(__imp__sub_82E328D8); +PPC_FUNC(sub_82E328D8) +{ + auto pixelShaderCode = reinterpret_cast(g_memory.Translate(ctx.r4.u32)); + __imp__sub_82E328D8(ctx, base); + reinterpret_cast(pixelShaderCode->m_pD3DPixelShader.get())->name = pixelShaderCode->m_TypeAndName.c_str() + 2; +} + +#endif + GUEST_FUNCTION_HOOK(sub_82BD99B0, CreateDevice); GUEST_FUNCTION_HOOK(sub_82BE6230, DestructResource); diff --git a/UnleashedRecomp/gpu/video.h b/UnleashedRecomp/gpu/video.h index 73730f51..37f7f190 100644 --- a/UnleashedRecomp/gpu/video.h +++ b/UnleashedRecomp/gpu/video.h @@ -1,5 +1,7 @@ #pragma once +//#define ASYNC_PSO_DEBUG + #include "rhi/rt64_render_interface.h" #define D3DCLEAR_TARGET 0x1 @@ -246,6 +248,9 @@ struct GuestShader : GuestResource ankerl::unordered_dense::map> linkedShaders; std::vector> shaderBlobs; ComPtr libraryBlob; +#ifdef ASYNC_PSO_DEBUG + const char* name = ""; +#endif }; struct GuestViewport