Skip to content

Commit 4a0ee9d

Browse files
pica: Replace register notifies with state sync
* It's cheaper to do it at draw time instead
1 parent 518f723 commit 4a0ee9d

File tree

7 files changed

+18
-3
lines changed

7 files changed

+18
-3
lines changed

Diff for: src/video_core/debug_utils/debug_utils.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,10 @@ void StartPicaTracing() {
272272
}
273273

274274
void OnPicaRegWrite(u16 cmd_id, u16 mask, u32 value) {
275-
std::lock_guard lock(pica_trace_mutex);
276-
277275
if (!g_is_pica_tracing)
278276
return;
279277

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

Diff for: src/video_core/pica/pica_core.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ void PicaCore::WriteInternalReg(u32 id, u32 value, u32 mask) {
362362

363363
lighting.luts[lut_config.type][lut_config.index].raw = value;
364364
lut_config.index.Assign(lut_config.index + 1);
365+
rasterizer->MarkLightLutDirty();
365366
break;
366367
}
367368

@@ -413,7 +414,7 @@ void PicaCore::WriteInternalReg(u32 id, u32 value, u32 mask) {
413414
}
414415

415416
// Notify the rasterizer an internal register was updated.
416-
rasterizer->NotifyPicaRegisterChanged(id);
417+
//rasterizer->NotifyPicaRegisterChanged(id);
417418
}
418419

419420
void PicaCore::SubmitImmediate(u32 value) {

Diff for: src/video_core/rasterizer_accelerated.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ void RasterizerAccelerated::SyncEntireState() {
152152
SyncLightPosition(light_index);
153153
SyncLightDistanceAttenuationBias(light_index);
154154
SyncLightDistanceAttenuationScale(light_index);
155+
SyncLightSpotDirection(light_index);
155156
}
156157

157158
SyncFogColor();

Diff for: src/video_core/rasterizer_accelerated.h

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class RasterizerAccelerated : public RasterizerInterface {
2727
void AddTriangle(const Pica::OutputVertex& v0, const Pica::OutputVertex& v1,
2828
const Pica::OutputVertex& v2) override;
2929

30+
void MarkLightLutDirty() override {
31+
const auto& lut_config = regs.lighting.lut_config;
32+
fs_uniform_block_data.lighting_lut_dirty[lut_config.type] = true;
33+
fs_uniform_block_data.lighting_lut_dirty_any = true;
34+
}
35+
3036
void NotifyPicaRegisterChanged(u32 id) override;
3137

3238
void SyncEntireState() override;

Diff for: src/video_core/rasterizer_interface.h

+2
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,7 @@ class RasterizerInterface {
8282
[[maybe_unused]] const DiskResourceLoadCallback& callback) {}
8383

8484
virtual void SyncEntireState() {}
85+
86+
virtual void MarkLightLutDirty() {}
8587
};
8688
} // namespace VideoCore

Diff for: src/video_core/renderer_opengl/gl_rasterizer.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ void RasterizerOpenGL::DrawTriangles() {
371371
bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
372372
MICROPROFILE_SCOPE(OpenGL_Drawing);
373373

374+
shader_dirty = true;
375+
SyncEntireState();
376+
374377
const bool shadow_rendering = regs.framebuffer.IsShadowRendering();
375378
const bool has_stencil = regs.framebuffer.HasStencil();
376379

Diff for: src/video_core/renderer_vulkan/vk_rasterizer.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ void RasterizerVulkan::DrawTriangles() {
467467
bool RasterizerVulkan::Draw(bool accelerate, bool is_indexed) {
468468
MICROPROFILE_SCOPE(Vulkan_Drawing);
469469

470+
shader_dirty = true;
471+
SyncEntireState();
472+
470473
const bool shadow_rendering = regs.framebuffer.IsShadowRendering();
471474
const bool has_stencil = regs.framebuffer.HasStencil();
472475

0 commit comments

Comments
 (0)