Skip to content
Permalink
Browse files
Merge pull request #8350 from phire/fix-tmem
Extend Minimal TMEM cache implementation.
  • Loading branch information
JMC47 committed Oct 12, 2021
2 parents 3bfb3fa + edb66da commit 6987ea0
Show file tree
Hide file tree
Showing 11 changed files with 390 additions and 36 deletions.
@@ -73,7 +73,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;

// Don't forget to increase this after doing changes on the savestate system
constexpr u32 STATE_VERSION = 138; // Last changed in PR 9670
constexpr u32 STATE_VERSION = 139; // Last changed in PR 8350

// Maps savestate versions to Dolphin versions.
// Versions after 42 don't need to be added to this list,
@@ -650,6 +650,7 @@
<ClInclude Include="VideoCommon\TextureDecoder_Util.h" />
<ClInclude Include="VideoCommon\TextureDecoder.h" />
<ClInclude Include="VideoCommon\TextureInfo.h" />
<ClInclude Include="VideoCommon\TMEM.h" />
<ClInclude Include="VideoCommon\UberShaderCommon.h" />
<ClInclude Include="VideoCommon\UberShaderPixel.h" />
<ClInclude Include="VideoCommon\UberShaderVertex.h" />
@@ -1209,6 +1210,7 @@
<ClCompile Include="VideoCommon\TextureConverterShaderGen.cpp" />
<ClCompile Include="VideoCommon\TextureDecoder_Common.cpp" />
<ClCompile Include="VideoCommon\TextureInfo.cpp" />
<ClCompile Include="VideoCommon\TMEM.cpp" />
<ClCompile Include="VideoCommon\UberShaderCommon.cpp" />
<ClCompile Include="VideoCommon\UberShaderPixel.cpp" />
<ClCompile Include="VideoCommon\UberShaderVertex.cpp" />
@@ -32,6 +32,7 @@
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/TMEM.h"
#include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/TextureDecoder.h"
#include "VideoCommon/VertexShaderManager.h"
@@ -353,7 +354,7 @@ static void BPWritten(const BPCmd& bp)
if (OpcodeDecoder::g_record_fifo_data)
FifoRecorder::GetInstance().UseMemory(addr, tlutXferCount, MemoryUpdate::TMEM);

TextureCacheBase::InvalidateAllBindPoints();
TMEM::InvalidateAll();

return;
}
@@ -459,8 +460,7 @@ static void BPWritten(const BPCmd& bp)
}
return;
case BPMEM_TEXINVALIDATE:
// TODO: Needs some restructuring in TextureCacheBase.
TextureCacheBase::InvalidateAllBindPoints();
TMEM::Invalidate(bp.newvalue);
return;

case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
@@ -568,7 +568,7 @@ static void BPWritten(const BPCmd& bp)
if (OpcodeDecoder::g_record_fifo_data)
FifoRecorder::GetInstance().UseMemory(src_addr, bytes_read, MemoryUpdate::TMEM);

TextureCacheBase::InvalidateAllBindPoints();
TMEM::InvalidateAll();
}
return;

@@ -661,7 +661,7 @@ static void BPWritten(const BPCmd& bp)
// ------------------------
case TexUnitAddress::Register::SETMODE0:
case TexUnitAddress::Register::SETMODE1:
TextureCacheBase::InvalidateAllBindPoints();
TMEM::ConfigurationChanged(tex_address, bp.newvalue);
return;

// --------------------------------------------
@@ -675,15 +675,15 @@ static void BPWritten(const BPCmd& bp)
case TexUnitAddress::Register::SETIMAGE1:
case TexUnitAddress::Register::SETIMAGE2:
case TexUnitAddress::Register::SETIMAGE3:
TextureCacheBase::InvalidateAllBindPoints();
TMEM::ConfigurationChanged(tex_address, bp.newvalue);
return;

// -------------------------------
// Set a TLUT
// BPMEM_TX_SETTLUT - Format, TMEM Offset (offset of TLUT from start of TMEM high bank > > 5)
// -------------------------------
case TexUnitAddress::Register::SETTLUT:
TextureCacheBase::InvalidateAllBindPoints();
TMEM::ConfigurationChanged(tex_address, bp.newvalue);
return;
case TexUnitAddress::Register::UNKNOWN:
break; // Not handled
@@ -90,6 +90,8 @@ add_library(videocommon
TextureDecoder_Util.h
TextureInfo.cpp
TextureInfo.h
TMEM.cpp
TMEM.h
UberShaderCommon.cpp
UberShaderCommon.h
UberShaderPixel.cpp
@@ -170,12 +172,12 @@ if(FFmpeg_FOUND)
FFmpeg::swresample
FFmpeg::swscale
)
if(APPLE)
if(APPLE)
target_link_libraries(videocommon PRIVATE
${COREMEDIA_LIBRARY}
${VIDEOTOOLBOX_LIBRARY}
${COREVIDEO_LIBRARY}
${AUDIOTOOLBOX_LIBRARY}
${AUDIOTOOLBOX_LIBRARY}
)
endif()
endif()

0 comments on commit 6987ea0

Please sign in to comment.