From dacea56aaa9cbf3c2513b8b2af3997c5ad3edb62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 10 Nov 2026 22:19:47 +0100 Subject: [PATCH] SoftGPU: Remove the frame profiler scopes A sampling profiler shows its costs better. Some were per pixel, and two in one scope kept USE_PROFILER builds from compiling. Co-Authored-By: Claude Opus 5.5 --- GPU/Software/BinManager.cpp | 6 ------ GPU/Software/Clipper.cpp | 1 - GPU/Software/Rasterizer.cpp | 10 ---------- GPU/Software/RasterizerRectangle.cpp | 1 - GPU/Software/SoftGpu.cpp | 4 ---- GPU/Software/TransformUnit.cpp | 4 ---- 6 files changed, 26 deletions(-) diff --git a/GPU/Software/BinManager.cpp b/GPU/Software/BinManager.cpp index 5fe2b88991..803c348814 100644 --- a/GPU/Software/BinManager.cpp +++ b/GPU/Software/BinManager.cpp @@ -21,7 +21,6 @@ #include #include "Common/BitSet.h" -#include "Common/Profiler/Profiler.h" #include "Common/Thread/ParallelLoop.h" #include "Common/Thread/ThreadManager.h" #include "Common/Data/Text/StringWriter.h" @@ -244,7 +243,6 @@ void BinManager::DeswizzleMirrorTextures(RasterizerState &state) { } void BinManager::UpdateState() { - PROFILE_THIS_SCOPE("bin_state"); if (HasDirty(SoftDirty::PIXEL_ALL | SoftDirty::SAMPLER_ALL | SoftDirty::RAST_ALL)) { PushState(); ClearDirty(SoftDirty::PIXEL_ALL | SoftDirty::SAMPLER_ALL | SoftDirty::RAST_ALL); @@ -487,7 +485,6 @@ inline void BinDirtyRange::Expand(uint32_t newBase, uint32_t bpp, uint32_t strid } void BinManager::UpdateClut(const void *src) { - PROFILE_THIS_SCOPE("bin_clut"); if (cluts_.Full()) Flush("cluts"); BinClut &clut = cluts_.PeekPush(); @@ -617,8 +614,6 @@ void BinManager::AddPoint(const VertexData &v0) { } void BinManager::Drain() { - PROFILE_THIS_SCOPE("bin_drain"); - // Also when switching to one thread: what's left goes to the tiles, which hold the earlier items. if (maxTasks_ > 1 || activeCount_ != 0) { DistributeItems(); @@ -634,7 +629,6 @@ void BinManager::Drain() { OptimizePendingStates(pendingStateIndex_, stateIndex_); pendingStateIndex_ = stateIndex_; - PROFILE_THIS_SCOPE("bin_drain_single"); // Anything (transfers, the CPU) may have written memory since the last drain. selfTexValid_ = false; while (!queue_.Empty()) { diff --git a/GPU/Software/Clipper.cpp b/GPU/Software/Clipper.cpp index 360b44fce8..cb6077e9ba 100644 --- a/GPU/Software/Clipper.cpp +++ b/GPU/Software/Clipper.cpp @@ -23,7 +23,6 @@ #include "GPU/Software/RasterizerRectangle.h" #include "GPU/Software/TransformUnit.h" -#include "Common/Profiler/Profiler.h" namespace Clipper { diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index de1b7269fe..45650bc58d 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -23,7 +23,6 @@ #include "Common/Common.h" #include "Common/CPUDetect.h" #include "Common/Data/Convert/ColorConv.h" -#include "Common/Profiler/Profiler.h" #include "Common/StringUtils.h" #include "Core/Config.h" #include "Core/Debugger/MemBlockInfo.h" @@ -726,7 +725,6 @@ static inline void ApplyTexturing(const RasterizerState &state, int *colors, int perPixel = false; } - PROFILE_THIS_SCOPE("sampler"); if (state.linearQuad) { // All four at once, when they're all bilinear. int levels[4], fracs[4], active = 0; @@ -1928,7 +1926,6 @@ void DrawTriangleSlice( fog[i] = std::clamp((int)fogWalk.At(i), 0, 255); } - PROFILE_THIS_SCOPE("draw_tri_px"); #if !defined(SOFTGPU_MEMORY_TAGGING_DETAILED) if (state.drawSpan) { alignas(16) int lanes[16]; @@ -1976,8 +1973,6 @@ void DrawTriangleSlice( // Draws triangle, vertices specified in counter-clockwise direction void DrawTriangle(const VertexData &v0, const VertexData &v1, const VertexData &v2, const BinCoords &range, const RasterizerState &state) { - PROFILE_THIS_SCOPE("draw_tri"); - auto drawSlice = cpu_info.bSSE4_1 ? (state.pixelID.clearMode ? &DrawTriangleSlice : &DrawTriangleSlice) : (state.pixelID.clearMode ? &DrawTriangleSlice : &DrawTriangleSlice); @@ -2187,7 +2182,6 @@ void DrawRectangle(const VertexData &v0, const VertexData &v1, const BinCoords & (Vec4S32::Load(prim_color + c * 4) + Vec4S32::Splat(sec_color[c])).Store(prim_color + c * 4); } - PROFILE_THIS_SCOPE("draw_rect_px"); #if !defined(SOFTGPU_MEMORY_TAGGING_DETAILED) if (state.drawSpan) { Vec4 fogs = fog, zs = z; @@ -2277,7 +2271,6 @@ void DrawPoint(const VertexData &v0, const BinCoords &range, const RasterizerSta int texLevelFrac; bool bilinear; CalculateSamplingParams(0.0f, 0.0f, 1.0f / v0.clipw, state, texLevel, texLevelFrac, bilinear); - PROFILE_THIS_SCOPE("sampler"); prim_color = ApplyTexturingSingle(s, t, ToVec4IntArg(prim_color), texLevel, texLevelFrac, bilinear, state); } @@ -2291,7 +2284,6 @@ void DrawPoint(const VertexData &v0, const BinCoords &range, const RasterizerSta fog = ClampFogDepth(v0.fogdepth); } - PROFILE_THIS_SCOPE("draw_px"); state.drawPixel(p.x, p.y, z, fog, ToVec4IntArg(prim_color), pixelID); #if defined(SOFTGPU_MEMORY_TAGGING_DETAILED) || defined(SOFTGPU_MEMORY_TAGGING_BASIC) @@ -2823,14 +2815,12 @@ void DrawLine(const VertexData &v0, const VertexData &v1, const BinCoords &range texBilinear = true; } - PROFILE_THIS_SCOPE("sampler"); prim_color = ApplyTexturingSingle(s, t, ToVec4IntArg(prim_color), texLevel, texLevelFrac, texBilinear, state); } if (!pixelID.clearMode) prim_color += Vec4(sec_color, 0); - PROFILE_THIS_SCOPE("draw_px"); state.drawPixel(p.x, p.y, z, fog, ToVec4IntArg(prim_color), pixelID); #if defined(SOFTGPU_MEMORY_TAGGING_DETAILED) || defined(SOFTGPU_MEMORY_TAGGING_BASIC) diff --git a/GPU/Software/RasterizerRectangle.cpp b/GPU/Software/RasterizerRectangle.cpp index 15ea18dcf3..8ad3d11696 100644 --- a/GPU/Software/RasterizerRectangle.cpp +++ b/GPU/Software/RasterizerRectangle.cpp @@ -5,7 +5,6 @@ #include "Common/Common.h" #include "Common/Data/Convert/ColorConv.h" -#include "Common/Profiler/Profiler.h" #include "Core/Debugger/MemBlockInfo.h" #include "Core/System.h" diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index f7c35b86a1..2f3fa1d239 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -35,7 +35,6 @@ #include "Core/MemMap.h" #include "Core/MIPS/MIPS.h" #include "Core/Util/PPGeDraw.h" -#include "Common/Profiler/Profiler.h" #include "Common/GPU/thin3d.h" #include "GPU/GPUCommon.h" @@ -823,7 +822,6 @@ void SoftGPU::CheckConfigChanged(const DisplayLayoutConfig &config) { } void SoftGPU::FastRunLoop(DisplayList &list) { - PROFILE_THIS_SCOPE("soft_runloop"); const auto *cmdInfo = softgpuCmdInfo; int dc = downcount; SoftDirty dirty = dirtyFlags_; @@ -1428,8 +1426,6 @@ void SoftGPU::Execute_ImmVertexAlphaPrim(u32 op, u32 diff) { } void SoftGPU::Execute_Call(u32 op, u32 diff) { - PROFILE_THIS_SCOPE("gpu_call"); - const u32 target = gstate_c.getRelativeAddress(op & 0x00FFFFFC); if (!Memory::IsValidAddress(target)) { ERROR_LOG(Log::G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index 3dde1aee1e..f4cb5c4d32 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -29,7 +29,6 @@ #include "Common/Data/Convert/ColorConv.h" #include "Common/Math/math_util.h" #include "Common/MemoryUtil.h" -#include "Common/Profiler/Profiler.h" #include "Common/Thread/ThreadManager.h" #include "Common/TimeUtil.h" #include "GPU/GPUState.h" @@ -681,8 +680,6 @@ static bool PreparePositions4(const Vec4F32 pos[4], const TransformState &state, // Writes straight into the destination: building the vertex in a temporary and copying it reloads its // fields with wider loads than they were stored with, which stalls. void TransformUnit::ReadVertex(const VertexReader &vreader, const TransformState &state, VertexCarry &carry, ClipVertexData &vertex, const PreparedPosition *prepared) { - PROFILE_THIS_SCOPE("read_vert"); - // (x, y, z, 1), the left operands of the transform's rows. Vec4F32 pos = vreader.ReadPosOne(); @@ -821,7 +818,6 @@ void TransformUnit::ReadVertex(const VertexReader &vreader, const TransformState Lighting::GenerateLightST(vertex.v, pos, worldnormal, normalRsqrt, state.lightingState.viewDir); } - PROFILE_THIS_SCOPE("light"); if (state.enableLighting) Lighting::Process(vertex.v, pos, worldnormal, normalRsqrt, state.lightingState); } else {