diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 5b667cd259..36108bc20e 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -929,10 +929,16 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value) size_t depthRowPitch = clip_w; depthRowPitch = (depthRowPitch + 255) & ~255; - 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()); + u32 m_context_dma_color_a = rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_A]; + u32 m_context_dma_color_b = rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_B]; + u32 m_context_dma_color_c = rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_C]; + u32 m_context_dma_color_d = rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_D]; + u32 m_context_dma_z = rsx::method_registers[NV4097_SET_CONTEXT_DMA_ZETA]; - if (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue()) + bool needTransfer = (m_context_dma_z && Ini.GSDumpDepthBuffer.GetValue()) || + ((m_context_dma_color_a || m_context_dma_color_b || m_context_dma_color_c || m_context_dma_color_d) && Ini.GSDumpColorBuffers.GetValue()); + + if (m_context_dma_z && Ini.GSDumpDepthBuffer.GetValue()) { size_t sizeInByte = clip_w * clip_h * 2; assert(m_UAVHeap.canAlloc(sizeInByte)); @@ -1068,7 +1074,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value) WaitForSingleObject(handle, INFINITE); CloseHandle(handle); - if (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue()) + if (m_context_dma_z && Ini.GSDumpDepthBuffer.GetValue()) { u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET], m_context_dma_z - 0xfeed0000); auto ptr = vm::get_ptr(address); diff --git a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp index 3184561aef..80de73e65d 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp @@ -45,12 +45,18 @@ void D3D12GSRender::PrepareRenderTargets(ID3D12GraphicsCommandList *copycmdlist) m_previous_address_d = rsx::method_registers[NV4097_SET_SURFACE_COLOR_DOFFSET]; m_previous_address_z = rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET]; + u32 m_context_dma_color_a = rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_A]; + u32 m_context_dma_color_b = rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_B]; + u32 m_context_dma_color_c = rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_C]; + u32 m_context_dma_color_d = rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_D]; + u32 m_context_dma_z = rsx::method_registers[NV4097_SET_CONTEXT_DMA_ZETA]; + // FBO location has changed, previous data might be copied - u32 address_a = m_set_context_dma_color_a ? rsx::get_address(m_previous_address_a, m_context_dma_color_a - 0xfeed0000) : 0; - u32 address_b = m_set_context_dma_color_b ? rsx::get_address(m_previous_address_b, m_context_dma_color_b - 0xfeed0000) : 0; - u32 address_c = m_set_context_dma_color_c ? rsx::get_address(m_previous_address_c, m_context_dma_color_c - 0xfeed0000) : 0; - u32 address_d = m_set_context_dma_color_d ? rsx::get_address(m_previous_address_d, m_context_dma_color_d - 0xfeed0000) : 0; - u32 address_z = m_set_context_dma_z ? rsx::get_address(m_previous_address_z, m_context_dma_z - 0xfeed0000) : 0; + u32 address_a = m_context_dma_color_a ? rsx::get_address(m_previous_address_a, m_context_dma_color_a - 0xfeed0000) : 0; + u32 address_b = m_context_dma_color_b ? rsx::get_address(m_previous_address_b, m_context_dma_color_b - 0xfeed0000) : 0; + u32 address_c = m_context_dma_color_c ? rsx::get_address(m_previous_address_c, m_context_dma_color_c - 0xfeed0000) : 0; + u32 address_d = m_context_dma_color_d ? rsx::get_address(m_previous_address_d, m_context_dma_color_d - 0xfeed0000) : 0; + u32 address_z = m_context_dma_z ? rsx::get_address(m_previous_address_z, m_context_dma_z - 0xfeed0000) : 0; // Make previous RTTs sampleable for (unsigned i = 0; i < 4; i++) diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index d05c0ff65d..d8c1cf13d1 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1150,7 +1150,7 @@ void GLGSRender::WriteBuffers() void GLGSRender::WriteDepthBuffer() { - if (!m_set_context_dma_z) +/* if (!m_set_context_dma_z) { return; } @@ -1177,12 +1177,12 @@ void GLGSRender::WriteDepthBuffer() glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, RSXThread::m_width, RSXThread::m_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, ptr); checkForGlError("WriteDepthBuffer(): glTexImage2D"); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ptr); - checkForGlError("WriteDepthBuffer(): glGetTexImage"); + checkForGlError("WriteDepthBuffer(): glGetTexImage");*/ } void GLGSRender::WriteColorBufferA() { - if (!m_set_context_dma_color_a) + /*if (!m_set_context_dma_color_a) { return; } @@ -1203,12 +1203,12 @@ void GLGSRender::WriteColorBufferA() checkForGlError("WriteColorBufferA(): glUnmapBuffer"); } - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);*/ } void GLGSRender::WriteColorBufferB() { - if (!m_set_context_dma_color_b) +/* if (!m_set_context_dma_color_b) { return; } @@ -1229,12 +1229,12 @@ void GLGSRender::WriteColorBufferB() checkForGlError("WriteColorBufferB(): glUnmapBuffer"); } - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);*/ } void GLGSRender::WriteColorBufferC() { - if (!m_set_context_dma_color_c) +/* if (!m_set_context_dma_color_c) { return; } @@ -1255,12 +1255,12 @@ void GLGSRender::WriteColorBufferC() checkForGlError("WriteColorBufferC(): glUnmapBuffer"); } - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);*/ } void GLGSRender::WriteColorBufferD() { - if (!m_set_context_dma_color_d) +/* if (!m_set_context_dma_color_d) { return; } @@ -1281,7 +1281,7 @@ void GLGSRender::WriteColorBufferD() checkForGlError("WriteColorBufferD(): glUnmapBuffer"); } - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);*/ } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index f85f2d0e77..0368aad7e0 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1282,53 +1282,19 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const break; case NV4097_SET_CONTEXT_DMA_COLOR_A: - { - m_set_context_dma_color_a = true; - m_context_dma_color_a = ARGS(0); - - if (count != 1) - { - LOG_ERROR(RSX, "NV4097_SET_CONTEXT_DMA_COLOR_A: Bad count (%d)", count); - break; - } break; - } case NV4097_SET_CONTEXT_DMA_COLOR_B: - { - m_set_context_dma_color_b = true; - m_context_dma_color_b = ARGS(0); break; - } case NV4097_SET_CONTEXT_DMA_COLOR_C: - { - m_set_context_dma_color_c = true; - m_context_dma_color_c = ARGS(0); - - if (count > 1) - { - m_set_context_dma_color_d = true; - m_context_dma_color_d = ARGS(1); - } break; - } case NV4097_SET_CONTEXT_DMA_COLOR_D: - { - if (ARGS(0)) - { - LOG_WARNING(RSX, "TODO: NV4097_SET_CONTEXT_DMA_COLOR_D: 0x%x", ARGS(0)); - } break; - } case NV4097_SET_CONTEXT_DMA_ZETA: - { - m_set_context_dma_z = true; - m_context_dma_z = ARGS(0); break; - } case NV4097_SET_CONTEXT_DMA_SEMAPHORE: { diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 7a8d50270f..0789f87273 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -301,16 +301,6 @@ public: bool m_set_surface_clip_vertical; // DMA context - bool m_set_context_dma_color_a; - u32 m_context_dma_color_a; - bool m_set_context_dma_color_b; - u32 m_context_dma_color_b; - bool m_set_context_dma_color_c; - u32 m_context_dma_color_c; - bool m_set_context_dma_color_d; - u32 m_context_dma_color_d; - bool m_set_context_dma_z; - u32 m_context_dma_z; u32 m_context_surface; u32 m_context_dma_img_src; u32 m_context_dma_img_dst; @@ -457,11 +447,6 @@ protected: m_set_fog_mode = false; m_set_fog_params = false; m_set_clip_plane = false; - m_set_context_dma_color_a = false; - m_set_context_dma_color_b = false; - m_set_context_dma_color_c = false; - m_set_context_dma_color_d = false; - m_set_context_dma_z = false; rsx::method_registers[NV4097_SET_CULL_FACE_ENABLE] = false; rsx::method_registers[NV4097_SET_ALPHA_TEST_ENABLE] = false; rsx::method_registers[NV4097_SET_ALPHA_FUNC] = false; diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index 6ebd7c0e8c..9e82fe5133 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -606,11 +606,11 @@ void RSXDebugger::GetSettings() (rsx::method_registers[NV4097_SET_COLOR_MASK] >> 8) & 0xff, (rsx::method_registers[NV4097_SET_COLOR_MASK]) & 0xff, (rsx::method_registers[NV4097_SET_COLOR_MASK] >> 24) & 0xff)); - LIST_SETTINGS_ADD("Context DMA Color A", wxString::Format("0x%x", render.m_context_dma_color_a)); - LIST_SETTINGS_ADD("Context DMA Color B", wxString::Format("0x%x", render.m_context_dma_color_b)); - LIST_SETTINGS_ADD("Context DMA Color C", wxString::Format("0x%x", render.m_context_dma_color_c)); - LIST_SETTINGS_ADD("Context DMA Color D", wxString::Format("0x%x", render.m_context_dma_color_d)); - LIST_SETTINGS_ADD("Context DMA Zeta", wxString::Format("0x%x", render.m_context_dma_z)); + LIST_SETTINGS_ADD("Context DMA Color A", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_A])); + LIST_SETTINGS_ADD("Context DMA Color B", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_B])); + LIST_SETTINGS_ADD("Context DMA Color C", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_C])); + LIST_SETTINGS_ADD("Context DMA Color D", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_D])); + LIST_SETTINGS_ADD("Context DMA Zeta", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_CONTEXT_DMA_ZETA])); LIST_SETTINGS_ADD("Depth bounds", wxString::Format("Min:%f, Max:%f", render.m_depth_bounds_min, render.m_depth_bounds_max)); // LIST_SETTINGS_ADD("Depth func", !(render.m_set_depth_func) ? "(none)" : wxString::Format("0x%x (%s)", // render.m_depth_func,