diff --git a/rpcs3/Emu/RSX/GL/GLDMA.cpp b/rpcs3/Emu/RSX/GL/GLDMA.cpp index 9bce9f4210..6f1e7f7fbe 100644 --- a/rpcs3/Emu/RSX/GL/GLDMA.cpp +++ b/rpcs3/Emu/RSX/GL/GLDMA.cpp @@ -36,7 +36,7 @@ namespace gl void dma_block::resize(u32 new_length) { - if (new_length < length()) + if (new_length <= length()) { return; } diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index ac3179fcba..6f7edcd52c 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -7,6 +7,7 @@ #include "Emu/Memory/vm_locking.h" #include "Emu/RSX/rsx_methods.h" +#include "Emu/RSX/Host/RSXDMAWriter.h" #include "Emu/RSX/NV47/HW/context_accessors.define.h" [[noreturn]] extern void report_fatal_error(std::string_view _text, bool is_html = false, bool include_help_text = true); diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index c90b8a2079..1225c7f2f2 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1,10 +1,6 @@ #include "stdafx.h" #include "RSXThread.h" -#include "Emu/Cell/PPUCallback.h" -#include "Emu/Cell/SPUThread.h" -#include "Emu/Cell/timers.hpp" - #include "Capture/rsx_capture.h" #include "Common/BufferUtils.h" #include "Common/buffer_stream.hpp" @@ -13,9 +9,17 @@ #include "Common/time.hpp" #include "Core/RSXReservationLock.hpp" #include "Core/RSXEngLock.hpp" +#include "Host/RSXDMAWriter.h" +#include "NV47/HW/context.h" +#include "Program/GLSLCommon.h" #include "rsx_methods.h" + #include "gcm_printing.h" #include "RSXDisAsm.h" + +#include "Emu/Cell/PPUCallback.h" +#include "Emu/Cell/SPUThread.h" +#include "Emu/Cell/timers.hpp" #include "Emu/Cell/lv2/sys_event.h" #include "Emu/Cell/lv2/sys_time.h" #include "Emu/Cell/Modules/cellGcmSys.h" @@ -23,11 +27,10 @@ #include "Overlays/overlay_perf_metrics.h" #include "Overlays/overlay_debug_overlay.h" #include "Overlays/overlay_message.h" -#include "Program/GLSLCommon.h" + #include "Utilities/date_time.h" #include "Utilities/StrUtil.h" #include "Crypto/unzip.h" -#include "NV47/HW/context.h" #include "util/asm.hpp" diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 514d5f69bb..d0c6c99f3c 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -35,8 +35,6 @@ #include "NV47/FW/GRAPH_backend.h" -#include "Host/RSXDMAWriter.h" - extern atomic_t g_user_asked_for_frame_capture; extern atomic_t g_disable_frame_limit; extern rsx::frame_trace_data frame_debug; @@ -44,6 +42,8 @@ extern rsx::frame_capture_data frame_capture; namespace rsx { + class RSXDMAWriter; + struct context; namespace overlays diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index dd2df46dc2..c436efe672 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -15,6 +15,7 @@ #include "vkutils/scratch.h" #include "Emu/RSX/rsx_methods.h" +#include "Emu/RSX/Host/RSXDMAWriter.h" #include "Emu/RSX/NV47/HW/context_accessors.define.h" #include "Emu/Memory/vm_locking.h" @@ -1846,6 +1847,19 @@ bool VKGSRender::release_GCM_label(u32 address, u32 args) return true; } +void VKGSRender::on_guest_texture_read(const vk::command_buffer& cmd) +{ + if (!backend_config.supports_host_gpu_labels) + { + return; + } + + // Queue a sync update on the CB doing the load + auto host_ctx = ensure(m_host_dma_ctrl->host_ctx()); + const auto event_id = host_ctx->on_texture_load_acquire(); + vkCmdUpdateBuffer(cmd, m_host_object_data->value, ::offset32(&vk::host_data_t::texture_load_complete_event), sizeof(u64), &event_id); +} + void VKGSRender::sync_hint(rsx::FIFO::interrupt_hint hint, rsx::reports::sync_hint_payload_t payload) { rsx::thread::sync_hint(hint, payload); diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.h b/rpcs3/Emu/RSX/VK/VKGSRender.h index 92627b99ef..f99886c9dd 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.h +++ b/rpcs3/Emu/RSX/VK/VKGSRender.h @@ -280,6 +280,7 @@ public: // Host sync object std::pair map_host_object_data() const; + void on_guest_texture_read(const vk::command_buffer& cmd); // GRAPH backend void patch_transform_constants(rsx::context* ctx, u32 index, u32 count) override; diff --git a/rpcs3/Emu/RSX/VK/VKGSRenderTypes.hpp b/rpcs3/Emu/RSX/VK/VKGSRenderTypes.hpp index b4d999e07c..27113bd25e 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRenderTypes.hpp +++ b/rpcs3/Emu/RSX/VK/VKGSRenderTypes.hpp @@ -11,6 +11,7 @@ #include "util/asm.hpp" #include +#include // Initial heap allocation values. The heaps are growable and will automatically increase in size to accomodate demands #define VK_ATTRIB_RING_BUFFER_SIZE_M 64 diff --git a/rpcs3/Emu/RSX/VK/VKTexture.cpp b/rpcs3/Emu/RSX/VK/VKTexture.cpp index 80630656c0..c44df5764d 100644 --- a/rpcs3/Emu/RSX/VK/VKTexture.cpp +++ b/rpcs3/Emu/RSX/VK/VKTexture.cpp @@ -1240,15 +1240,9 @@ namespace vk dst_image->queue_release(cmd2, cmd.get_queue_family(), dst_image->current_layout); } - if (auto rsxthr = rsx::get_current_renderer(); - rsxthr->get_backend_config().supports_host_gpu_labels) + if (auto rsxthr = static_cast(rsx::get_current_renderer())) { - // Queue a sync update on the CB doing the load - auto [host_data, host_buffer] = static_cast(rsxthr)->map_host_object_data(); - ensure(host_data); - - const auto event_id = host_data->on_texture_load_acquire(); - vkCmdUpdateBuffer(cmd2, host_buffer, ::offset32(&vk::host_data_t::texture_load_complete_event), sizeof(u64), &event_id); + rsxthr->on_guest_texture_read(cmd2); } }