Skip to content

Commit

Permalink
GPU: Add hardware texture cache
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jul 6, 2024
1 parent d372609 commit 92d308d
Show file tree
Hide file tree
Showing 28 changed files with 3,943 additions and 357 deletions.
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ add_library(core
gpu_hw.h
gpu_hw_shadergen.cpp
gpu_hw_shadergen.h
gpu_hw_texture_cache.cpp
gpu_hw_texture_cache.h
gpu_shadergen.cpp
gpu_shadergen.h
gpu_sw.cpp
Expand Down
2 changes: 2 additions & 0 deletions src/core/core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<ClCompile Include="gpu_backend.cpp" />
<ClCompile Include="gpu_commands.cpp" />
<ClCompile Include="gpu_hw_shadergen.cpp" />
<ClCompile Include="gpu_hw_texture_cache.cpp" />
<ClCompile Include="gpu_shadergen.cpp" />
<ClCompile Include="gpu_sw.cpp" />
<ClCompile Include="gpu_sw_backend.cpp" />
Expand Down Expand Up @@ -125,6 +126,7 @@
<ClInclude Include="gdb_server.h" />
<ClInclude Include="gpu_backend.h" />
<ClInclude Include="gpu_hw_shadergen.h" />
<ClInclude Include="gpu_hw_texture_cache.h" />
<ClInclude Include="gpu_shadergen.h" />
<ClInclude Include="gpu_sw.h" />
<ClInclude Include="gpu_sw_backend.h" />
Expand Down
2 changes: 2 additions & 0 deletions src/core/core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<ClCompile Include="justifier.cpp" />
<ClCompile Include="pine_server.cpp" />
<ClCompile Include="gdb_server.cpp" />
<ClCompile Include="gpu_hw_texture_cache.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="types.h" />
Expand Down Expand Up @@ -142,5 +143,6 @@
<ClInclude Include="justifier.h" />
<ClInclude Include="pine_server.h" />
<ClInclude Include="gdb_server.h" />
<ClInclude Include="gpu_hw_texture_cache.h" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/core/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1657,8 +1657,8 @@ void GPU::SetDrawMode(u16 value)
if (new_mode_reg.bits == m_draw_mode.mode_reg.bits)
return;

m_draw_mode.texture_page_changed |= ((new_mode_reg.bits & GPUDrawModeReg::TEXTURE_PAGE_MASK) !=
(m_draw_mode.mode_reg.bits & GPUDrawModeReg::TEXTURE_PAGE_MASK));
m_draw_mode.texture_page_changed |= ((new_mode_reg.bits & GPUDrawModeReg::TEXTURE_MODE_AND_PAGE_MASK) !=
(m_draw_mode.mode_reg.bits & GPUDrawModeReg::TEXTURE_MODE_AND_PAGE_MASK));
m_draw_mode.mode_reg.bits = new_mode_reg.bits;

if (m_GPUSTAT.draw_to_displayed_field != new_mode_reg.draw_to_displayed_field)
Expand Down
2 changes: 1 addition & 1 deletion src/core/gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class GPU
bool texture_page_changed;
bool texture_window_changed;

ALWAYS_INLINE bool IsTexturePageChanged() const { return texture_page_changed; }
ALWAYS_INLINE bool IsTexturePageChanged() const { return texture_page_changed; }// TODO: Remove this?
ALWAYS_INLINE void SetTexturePageChanged() { texture_page_changed = true; }
ALWAYS_INLINE void ClearTexturePageChangedFlag() { texture_page_changed = false; }

Expand Down
2 changes: 1 addition & 1 deletion src/core/gpu_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ void GPU::FinishVRAMWrite()
m_vram_transfer.height, sizeof(u16) * m_vram_transfer.width, m_blit_buffer.data(), true);
}

if (g_settings.texture_replacements.ShouldDumpVRAMWrite(m_vram_transfer.width, m_vram_transfer.height))
if (TextureReplacements::ShouldDumpVRAMWrite(m_vram_transfer.width, m_vram_transfer.height))
{
TextureReplacements::DumpVRAMWrite(m_vram_transfer.width, m_vram_transfer.height,
reinterpret_cast<const u16*>(m_blit_buffer.data()));
Expand Down
Loading

0 comments on commit 92d308d

Please sign in to comment.