Completly unclean way to track texture modification between frames

This commit is contained in:
vlj 2015-06-21 00:51:38 +02:00 committed by Vincent Lejeune
parent 03a84cb208
commit 8cc9642b96
3 changed files with 23 additions and 0 deletions

View file

@ -392,9 +392,26 @@ void D3D12GSRender::Shader::Release()
m_samplerDescriptorHeap->Release();
}
extern std::function<bool(u32 addr)> gfxHandler;
D3D12GSRender::D3D12GSRender()
: GSRender(), m_PSO(nullptr)
{
gfxHandler = [this](u32 addr) {
LOG_ERROR(RSX, "CATCH SEGFAULT %x", addr);
for (auto tmp : texaddrs)
{
if (addr - tmp.first < tmp.second)
{
LOG_ERROR(RSX, "Modified %x range, starting again", tmp.first);
vm::page_protect(tmp.first, tmp.second, 0, vm::page_writable, 0);
return true;
}
}
return false;
};
loadD3D12FunctionPointers();
if (Ini.GSDebugOutputEnable.GetValue())
{

View file

@ -202,6 +202,7 @@ struct GarbageCollectionThread
class D3D12GSRender : public GSRender
{
private:
std::vector <std::pair<u32, u32> > texaddrs; // Address, size
GarbageCollectionThread m_GC;
// Copy of RTT to be used as texture
std::unordered_map<u32, ID3D12Resource* > m_texturesRTTs;

View file

@ -636,6 +636,11 @@ size_t D3D12GSRender::UploadTextures()
m_commandQueueGraphic->ExecuteCommandLists(1, (ID3D12CommandList**)&commandList);
getCurrentResourceStorage().m_inflightCommandList.push_back(commandList);
m_texturesCache[texaddr] = vramTexture;
size_t s = powerOf2Align(w * h * 4, 4096);
LOG_ERROR(RSX, "PROTECTING %x of size %d", powerOf2Align(texaddr, 4096), s);
texaddrs.push_back(std::make_pair(texaddr & ~0xfff, s));
vm::page_protect(texaddr & ~0xfff, s, 0, 0, vm::page_writable);
}
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};