mirror of
https://github.com/encounter/aurora.git
synced 2026-07-09 18:19:33 -07:00
Fix draw call count & dirty on currentPnMtx change
This commit is contained in:
+8
-3
@@ -123,6 +123,8 @@ wgpu::BindGroup g_uniformBindGroup;
|
||||
|
||||
// for imgui debug
|
||||
AuroraStats g_stats{};
|
||||
uint32_t g_drawCallCount = 0;
|
||||
uint32_t g_mergedDrawCallCount = 0;
|
||||
|
||||
using CommandList = std::vector<Command>;
|
||||
struct RenderPass {
|
||||
@@ -214,7 +216,7 @@ gx::DrawData* get_last_draw_command() {
|
||||
|
||||
static void push_draw_command(ShaderDrawCommand data) {
|
||||
push_command(CommandType::Draw, Command::Data{.draw = data});
|
||||
++g_stats.drawCallCount;
|
||||
++g_drawCallCount;
|
||||
}
|
||||
|
||||
Vec2<uint32_t> get_render_target_size() noexcept {
|
||||
@@ -669,8 +671,8 @@ bool begin_frame() {
|
||||
mapBuffer(g_textureUpload, TextureUploadSize);
|
||||
}
|
||||
|
||||
g_stats.drawCallCount = 0;
|
||||
g_stats.mergedDrawCallCount = 0;
|
||||
g_drawCallCount = 0;
|
||||
g_mergedDrawCallCount = 0;
|
||||
g_suspendedEfbPass.reset();
|
||||
|
||||
g_renderPasses.emplace_back();
|
||||
@@ -703,6 +705,8 @@ void end_frame(const wgpu::CommandEncoder& cmd) {
|
||||
};
|
||||
g_stagingBuffers[currentStagingBuffer].Unmap();
|
||||
s_mappingState.store(BufferMapState::Unmapped, std::memory_order_release);
|
||||
g_stats.drawCallCount = g_drawCallCount;
|
||||
g_stats.mergedDrawCallCount = g_mergedDrawCallCount;
|
||||
g_stats.lastVertSize = writeBuffer(g_verts, g_vertexBuffer, VertexBufferSize, "Vertex");
|
||||
g_stats.lastUniformSize = writeBuffer(g_uniforms, g_uniformBuffer, UniformBufferSize, "Uniform");
|
||||
g_stats.lastIndexSize = writeBuffer(g_indices, g_indexBuffer, IndexBufferSize, "Index");
|
||||
@@ -744,6 +748,7 @@ static void expire_cached_bind_groups() {
|
||||
return;
|
||||
}
|
||||
|
||||
ZoneScoped;
|
||||
for (auto it = g_cachedBindGroups.begin(); it != g_cachedBindGroups.end();) {
|
||||
if (g_frameIndex - it->second.lastUsedFrame > BindGroupCacheRetainFrames) {
|
||||
g_cachedBindGroups.erase(it++);
|
||||
|
||||
@@ -178,6 +178,8 @@ inline constexpr uint64_t StorageBufferSize = 8388608; // 8mb
|
||||
inline constexpr uint64_t TextureUploadSize = 25165824; // 24mb
|
||||
|
||||
extern AuroraStats g_stats;
|
||||
extern uint32_t g_drawCallCount;
|
||||
extern uint32_t g_mergedDrawCallCount;
|
||||
extern wgpu::Buffer g_vertexBuffer;
|
||||
extern wgpu::Buffer g_uniformBuffer;
|
||||
extern wgpu::Buffer g_indexBuffer;
|
||||
|
||||
@@ -491,7 +491,6 @@ inline static u32 bp_get(u32 reg, u32 size, u32 shift) { return reg >> shift & (
|
||||
|
||||
// BP register handler - decodes BP (RAS/pixel engine) register writes and updates g_gxState
|
||||
static void handle_bp(u32 value, bool bigEndian) {
|
||||
ZoneScoped;
|
||||
u32 regId = (value >> 24) & 0xFF;
|
||||
// Mask off the register ID from the value for field extraction
|
||||
// (the regId is stored in bits 24-31, data is in bits 0-23)
|
||||
@@ -1123,7 +1122,6 @@ static void handle_bp(u32 value, bool bigEndian) {
|
||||
|
||||
// CP register handler - decodes CP register writes and updates g_gxState
|
||||
static void handle_cp(u8 addr, u32 value, bool bigEndian) {
|
||||
ZoneScoped;
|
||||
switch (addr) {
|
||||
// VCD low (0x50)
|
||||
case 0x50: {
|
||||
@@ -1165,6 +1163,7 @@ static void handle_cp(u8 addr, u32 value, bool bigEndian) {
|
||||
// Matrix index A (0x30)
|
||||
case 0x30: {
|
||||
g_gxState.currentPnMtx = bp_get(value, 6, 0) / 3;
|
||||
g_gxState.stateDirty = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1260,7 +1259,6 @@ static void handle_cp(u8 addr, u32 value, bool bigEndian) {
|
||||
|
||||
// XF register handler - decodes XF (transform unit) register writes and updates g_gxState
|
||||
static void handle_xf(const u8* data, u32& pos, u32 size, bool bigEndian) {
|
||||
ZoneScoped;
|
||||
CHECK(pos + 4 <= size, "XF header read overrun");
|
||||
u32 header = read_u32(data + pos, bigEndian);
|
||||
pos += 4;
|
||||
@@ -1583,7 +1581,7 @@ static void handle_draw(u8 cmd, const u8* data, u32& pos, u32 size, bool bigEndi
|
||||
lastDraw->idxRange.size += idxRange.size;
|
||||
lastDraw->vtxCount += vtxCount;
|
||||
lastDraw->indexCount += numIndices;
|
||||
++gfx::g_stats.mergedDrawCallCount;
|
||||
++gfx::g_mergedDrawCallCount;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <RmlUi/Core.h>
|
||||
#include <RmlUi_Backend.h>
|
||||
#include <RmlUi_Platform_SDL.h>
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
#include "window.hpp"
|
||||
#include "internal.hpp"
|
||||
@@ -361,6 +362,7 @@ RenderOutput render(const wgpu::CommandEncoder& encoder, const webgpu::Viewport&
|
||||
return {};
|
||||
}
|
||||
|
||||
ZoneScoped;
|
||||
const Rml::Vector2i dim = dimensions_from_viewport(presentViewport);
|
||||
ensure_render_target(dim);
|
||||
if (!s_renderTarget.view) {
|
||||
|
||||
Reference in New Issue
Block a user