Skip to content

Commit

Permalink
pica: Switch to dirty flags
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelthegreat committed Jul 20, 2024
1 parent 518f723 commit 964d1b8
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 483 deletions.
3 changes: 1 addition & 2 deletions src/video_core/debug_utils/debug_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,10 @@ void StartPicaTracing() {
}

void OnPicaRegWrite(u16 cmd_id, u16 mask, u32 value) {
std::lock_guard lock(pica_trace_mutex);

if (!g_is_pica_tracing)
return;

std::lock_guard lock(pica_trace_mutex);
pica_trace->writes.push_back(PicaTrace::Write{cmd_id, mask, value});
}

Expand Down
6 changes: 3 additions & 3 deletions src/video_core/pica/pica_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ void PicaCore::WriteInternalReg(u32 id, u32 value, u32 mask) {

lighting.luts[lut_config.type][lut_config.index].raw = value;
lut_config.index.Assign(lut_config.index + 1);
rasterizer->MarkLightLutDirty();
break;
}

Expand All @@ -387,7 +388,6 @@ void PicaCore::WriteInternalReg(u32 id, u32 value, u32 mask) {
case PICA_REG_INDEX(texturing.proctex_lut_data[6]):
case PICA_REG_INDEX(texturing.proctex_lut_data[7]): {
auto& index = regs.internal.texturing.proctex_lut_config.index;

switch (regs.internal.texturing.proctex_lut_config.ref_table.Value()) {
case TexturingRegs::ProcTexLutTable::Noise:
proctex.noise_table[index % proctex.noise_table.size()].raw = value;
Expand All @@ -412,8 +412,8 @@ void PicaCore::WriteInternalReg(u32 id, u32 value, u32 mask) {
break;
}

// Notify the rasterizer an internal register was updated.
rasterizer->NotifyPicaRegisterChanged(id);
// Mark register as dirty
dirty_flags.set(id);
}

void PicaCore::SubmitImmediate(u32 value) {
Expand Down
4 changes: 4 additions & 0 deletions src/video_core/pica/pica_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <bitset>
#include "core/hle/service/gsp/gsp_interrupt.h"
#include "video_core/pica/geometry_pipeline.h"
#include "video_core/pica/packed_attribute.h"
Expand Down Expand Up @@ -240,8 +241,11 @@ class PicaCore {
}
};

using DirtyFlags = std::bitset<RegsInternal::NUM_REGS>;

RegsLcd regs_lcd{};
Regs regs{};
DirtyFlags dirty_flags{};
// TODO: Move these to a separate shader scheduler class
GeometryShaderUnit gs_unit;
ShaderSetup vs_setup;
Expand Down
Loading

0 comments on commit 964d1b8

Please sign in to comment.