mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-29 14:26:53 +01:00
graphics: count DCC/CMASK metadata readbacks in the performance overlay
This commit is contained in:
@@ -29,6 +29,8 @@ enum class Counter {
|
|||||||
TextureUploadBytes,
|
TextureUploadBytes,
|
||||||
TextureDownloadBytes,
|
TextureDownloadBytes,
|
||||||
TextureEvictions,
|
TextureEvictions,
|
||||||
|
ColorMetadataReadbacks, // CPU blocked reading back GPU-written DCC/CMASK metadata.
|
||||||
|
ColorMetadataReadbackNs,
|
||||||
BufferUploadBytes,
|
BufferUploadBytes,
|
||||||
BufferDownloadBytes,
|
BufferDownloadBytes,
|
||||||
BufferEvictions,
|
BufferEvictions,
|
||||||
|
|||||||
@@ -1070,6 +1070,9 @@ void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc,
|
|||||||
// Finish native metadata writes before reading backing bytes. This can submit the scheduler,
|
// Finish native metadata writes before reading backing bytes. This can submit the scheduler,
|
||||||
// so discovery runs before final draw uploads and never holds the texture lock across it.
|
// so discovery runs before final draw uploads and never holds the texture lock across it.
|
||||||
if (m_buffer_cache.IsRegionGpuModified(range.address, range.size)) {
|
if (m_buffer_cache.IsRegionGpuModified(range.address, range.size)) {
|
||||||
|
Common::DebugCounters::ScopedTimer timer(
|
||||||
|
Common::DebugCounters::Counter::ColorMetadataReadbacks,
|
||||||
|
Common::DebugCounters::Counter::ColorMetadataReadbackNs);
|
||||||
m_buffer_cache.ReadMemory(range.address, range.size, false);
|
m_buffer_cache.ReadMemory(range.address, range.size, false);
|
||||||
}
|
}
|
||||||
const auto slice_size = range.size / layers;
|
const auto slice_size = range.size / layers;
|
||||||
|
|||||||
@@ -310,6 +310,9 @@ void GpuActivityRows(const Snapshot& shown) {
|
|||||||
Row("CPU waiting on GPU",
|
Row("CPU waiting on GPU",
|
||||||
Fmt("%.0f ms/s (%.0f waits/s)", Rate(shown, Counter::GpuWaitNs) / 1e6,
|
Fmt("%.0f ms/s (%.0f waits/s)", Rate(shown, Counter::GpuWaitNs) / 1e6,
|
||||||
Rate(shown, Counter::GpuWaits)));
|
Rate(shown, Counter::GpuWaits)));
|
||||||
|
Row("DCC/CMASK readbacks",
|
||||||
|
Fmt("%.0f ms/s (%.0f/s)", Rate(shown, Counter::ColorMetadataReadbackNs) / 1e6,
|
||||||
|
Rate(shown, Counter::ColorMetadataReadbacks)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilationRows(const Snapshot& shown) {
|
void CompilationRows(const Snapshot& shown) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#define SPV_ENABLE_UTILITY_CODE
|
#define SPV_ENABLE_UTILITY_CODE
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/debugCounters.h"
|
||||||
#include "common/emulatorConfig.h"
|
#include "common/emulatorConfig.h"
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "common/hostException.h"
|
#include "common/hostException.h"
|
||||||
@@ -12266,7 +12267,15 @@ public:
|
|||||||
Require(name, "already GPU-owned metadata stays ordered",
|
Require(name, "already GPU-owned metadata stays ordered",
|
||||||
resources.GetBufferCache().HasGpuDirtyBytes(dcc_address, metadata_size),
|
resources.GetBufferCache().HasGpuDirtyBytes(dcc_address, metadata_size),
|
||||||
"a fill discarded pending native writes to its metadata pages");
|
"a fill discarded pending native writes to its metadata pages");
|
||||||
|
Common::DebugCounters::SetEnabled(true);
|
||||||
|
const auto readbacks =
|
||||||
|
Common::DebugCounters::Get(Common::DebugCounters::Counter::ColorMetadataReadbacks);
|
||||||
bind();
|
bind();
|
||||||
|
Common::DebugCounters::SetEnabled(false);
|
||||||
|
Require(name, "metadata readback counter",
|
||||||
|
Common::DebugCounters::Get(
|
||||||
|
Common::DebugCounters::Counter::ColorMetadataReadbacks) == readbacks + 1,
|
||||||
|
"binding GPU-written metadata did not count exactly one readback");
|
||||||
Require(name, "same-value raw native re-clear",
|
Require(name, "same-value raw native re-clear",
|
||||||
read_texel() == expected,
|
read_texel() == expected,
|
||||||
"a repeated metadata fill did not clear an already drawn target");
|
"a repeated metadata fill did not clear an already drawn target");
|
||||||
|
|||||||
Reference in New Issue
Block a user