mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
d3d12: Fix crash with write color/depth buffer enabled
This commit is contained in:
parent
428d66598d
commit
6f0c74cf76
2 changed files with 38 additions and 24 deletions
|
@ -149,11 +149,8 @@ void D3D12GSRender::Shader::Release()
|
||||||
|
|
||||||
extern std::function<bool(u32 addr)> gfxHandler;
|
extern std::function<bool(u32 addr)> gfxHandler;
|
||||||
|
|
||||||
D3D12GSRender::D3D12GSRender()
|
bool D3D12GSRender::invalidateTexture(u32 addr)
|
||||||
: GSRender(), m_PSO(nullptr)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
gfxHandler = [this](u32 addr) {
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
auto It = m_protectedTextures.begin(), E = m_protectedTextures.end();
|
auto It = m_protectedTextures.begin(), E = m_protectedTextures.end();
|
||||||
for (; It != E;)
|
for (; It != E;)
|
||||||
|
@ -166,7 +163,6 @@ D3D12GSRender::D3D12GSRender()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mut);
|
std::lock_guard<std::mutex> lock(mut);
|
||||||
u32 texadrr = std::get<0>(protectedTexture);
|
u32 texadrr = std::get<0>(protectedTexture);
|
||||||
LOG_WARNING(RSX, "Modified %x, starting again", texadrr);
|
|
||||||
ID3D12Resource *texToErase = m_texturesCache[texadrr];
|
ID3D12Resource *texToErase = m_texturesCache[texadrr];
|
||||||
m_texturesCache.erase(texadrr);
|
m_texturesCache.erase(texadrr);
|
||||||
m_texToClean.push_back(texToErase);
|
m_texToClean.push_back(texToErase);
|
||||||
|
@ -177,6 +173,16 @@ D3D12GSRender::D3D12GSRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
D3D12GSRender::D3D12GSRender()
|
||||||
|
: GSRender(), m_PSO(nullptr)
|
||||||
|
{
|
||||||
|
gfxHandler = [this](u32 addr) {
|
||||||
|
bool result = invalidateTexture(addr);
|
||||||
|
if (result)
|
||||||
|
LOG_WARNING(RSX, "Reporting Cell writing to %x", addr);
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
loadD3D12FunctionPointers();
|
loadD3D12FunctionPointers();
|
||||||
if (Ini.GSDebugOutputEnable.GetValue())
|
if (Ini.GSDebugOutputEnable.GetValue())
|
||||||
|
@ -1072,6 +1078,8 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||||
dst.PlacedFootprint.Footprint.Width = m_surface_clip_w;
|
dst.PlacedFootprint.Footprint.Width = m_surface_clip_w;
|
||||||
dst.PlacedFootprint.Footprint.RowPitch = (UINT)depthRowPitch;
|
dst.PlacedFootprint.Footprint.RowPitch = (UINT)depthRowPitch;
|
||||||
downloadCommandList->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr);
|
downloadCommandList->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr);
|
||||||
|
|
||||||
|
invalidateTexture(GetAddress(m_surface_offset_z, m_context_dma_z - 0xfeed0000));
|
||||||
}
|
}
|
||||||
|
|
||||||
ID3D12Resource *rtt0, *rtt1, *rtt2, *rtt3;
|
ID3D12Resource *rtt0, *rtt1, *rtt2, *rtt3;
|
||||||
|
@ -1108,6 +1116,11 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||||
if (m_context_dma_color_d) rtt3 = writeColorBuffer(m_rtts.m_currentlyBoundRenderTargets[3], downloadCommandList);
|
if (m_context_dma_color_d) rtt3 = writeColorBuffer(m_rtts.m_currentlyBoundRenderTargets[3], downloadCommandList);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invalidateTexture(GetAddress(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000));
|
||||||
|
invalidateTexture(GetAddress(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000));
|
||||||
|
invalidateTexture(GetAddress(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000));
|
||||||
|
invalidateTexture(GetAddress(m_surface_offset_d, m_context_dma_color_d - 0xfeed0000));
|
||||||
}
|
}
|
||||||
if (needTransfer)
|
if (needTransfer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -237,6 +237,7 @@ private:
|
||||||
std::mutex mut;
|
std::mutex mut;
|
||||||
std::list <std::tuple<u32, u32, u32> > m_protectedTextures; // Texaddress, start of protected range, size of protected range
|
std::list <std::tuple<u32, u32, u32> > m_protectedTextures; // Texaddress, start of protected range, size of protected range
|
||||||
std::vector<ID3D12Resource *> m_texToClean;
|
std::vector<ID3D12Resource *> m_texToClean;
|
||||||
|
bool invalidateTexture(u32 addr);
|
||||||
|
|
||||||
GarbageCollectionThread m_GC;
|
GarbageCollectionThread m_GC;
|
||||||
// Copy of RTT to be used as texture
|
// Copy of RTT to be used as texture
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue