d3d12: Disable depth/color buffer write if not requested

Doesnt really increase performance...
This commit is contained in:
vlj 2015-06-05 23:58:25 +02:00 committed by Vincent Lejeune
parent d564c25241
commit c73d19161b
1 changed files with 87 additions and 83 deletions

View File

@ -1162,9 +1162,6 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
// Except when a semaphore is written by RSX // Except when a semaphore is written by RSX
/* if (!Ini.GSDumpDepthBuffer.GetValue())
return;*/
ID3D12Fence *fence; ID3D12Fence *fence;
check( check(
m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence)) m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence))
@ -1178,9 +1175,10 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
size_t depthRowPitch = RSXThread::m_width; size_t depthRowPitch = RSXThread::m_width;
depthRowPitch = (depthRowPitch + 255) & ~255; depthRowPitch = (depthRowPitch + 255) & ~255;
bool needTransfer = m_set_context_dma_z || m_set_context_dma_color_a || m_set_context_dma_color_b || m_set_context_dma_color_c || m_set_context_dma_color_d; bool needTransfer = (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue()) ||
((m_set_context_dma_color_a || m_set_context_dma_color_b || m_set_context_dma_color_c || m_set_context_dma_color_d) && Ini.GSDumpColorBuffers.GetValue());
if (m_set_context_dma_z) if (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue())
{ {
D3D12_HEAP_PROPERTIES heapProp = {}; D3D12_HEAP_PROPERTIES heapProp = {};
heapProp.Type = D3D12_HEAP_TYPE_DEFAULT; heapProp.Type = D3D12_HEAP_TYPE_DEFAULT;
@ -1296,7 +1294,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
); );
} }
if (m_set_context_dma_z) if (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue())
{ {
// Copy // Copy
D3D12_TEXTURE_COPY_LOCATION dst = {}, src = {}; D3D12_TEXTURE_COPY_LOCATION dst = {}, src = {};
@ -1314,6 +1312,8 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
} }
ID3D12Resource *rtt0, *rtt1, *rtt2, *rtt3; ID3D12Resource *rtt0, *rtt1, *rtt2, *rtt3;
if (Ini.GSDumpColorBuffers.GetValue())
{
switch (m_surface_color_target) switch (m_surface_color_target)
{ {
case CELL_GCM_SURFACE_TARGET_NONE: case CELL_GCM_SURFACE_TARGET_NONE:
@ -1345,6 +1345,7 @@ 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;
} }
}
if (needTransfer) if (needTransfer)
{ {
downloadCommandList->Close(); downloadCommandList->Close();
@ -1359,7 +1360,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
CloseHandle(handle); CloseHandle(handle);
fence->Release(); fence->Release();
if (m_set_context_dma_z) if (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue())
{ {
u32 address = GetAddress(m_surface_offset_z, m_context_dma_z - 0xfeed0000); u32 address = GetAddress(m_surface_offset_z, m_context_dma_z - 0xfeed0000);
auto ptr = vm::get_ptr<void>(address); auto ptr = vm::get_ptr<void>(address);
@ -1387,6 +1388,8 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
size_t colorRowPitch = RSXThread::m_width * 4; size_t colorRowPitch = RSXThread::m_width * 4;
colorRowPitch = (colorRowPitch + 255) & ~255; colorRowPitch = (colorRowPitch + 255) & ~255;
if (Ini.GSDumpColorBuffers.GetValue())
{
switch (m_surface_color_target) switch (m_surface_color_target)
{ {
case CELL_GCM_SURFACE_TARGET_NONE: case CELL_GCM_SURFACE_TARGET_NONE:
@ -1450,6 +1453,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
} }
break; break;
} }
}
if (needTransfer) if (needTransfer)
downloadCommandList->Release(); downloadCommandList->Release();