From b6d45022491c1f92b3d8092b855cc1f4fb368b92 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 12 May 2022 01:14:06 +0200 Subject: [PATCH] early-access version 2725 --- README.md | 2 +- src/video_core/engines/maxwell_3d.cpp | 2 ++ src/video_core/engines/maxwell_dma.cpp | 9 ++++++--- src/video_core/macro/macro.cpp | 5 +++++ src/video_core/macro/macro.h | 3 +++ src/video_core/renderer_vulkan/vk_rasterizer.cpp | 4 ++-- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6abb5d3c5..21b2370a9 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2724. +This is the source code for early-access 2725. ## Legal Notice diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index d4652b167..7d0cb8fce 100755 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -173,6 +173,8 @@ void Maxwell3D::ProcessMethodCall(u32 method, u32 argument, u32 nonshadow_argume case MAXWELL3D_REG_INDEX(shadow_ram_control): shadow_state.shadow_ram_control = static_cast(nonshadow_argument); return; + case MAXWELL3D_REG_INDEX(macros.upload_address): + return macro_engine->ClearCode(regs.macros.upload_address); case MAXWELL3D_REG_INDEX(macros.data): return macro_engine->AddCode(regs.macros.upload_address, argument); case MAXWELL3D_REG_INDEX(macros.bind): diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 3eb7cc596..a7302f7c1 100755 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp @@ -134,7 +134,8 @@ void MaxwellDMA::CopyBlockLinearToPitch() { // Deswizzle the input and copy it over. UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0); - const u32 bytes_per_pixel = 1; + const u32 bytes_per_pixel = + regs.launch_dma.remap_enable ? regs.pitch_out / regs.line_length_in : 1; const Parameters& src_params = regs.src_params; const u32 width = src_params.width; const u32 height = src_params.height; @@ -166,7 +167,8 @@ void MaxwellDMA::CopyPitchToBlockLinear() { UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0); const auto& dst_params = regs.dst_params; - const u32 bytes_per_pixel = 1; + const u32 bytes_per_pixel = + regs.launch_dma.remap_enable ? regs.pitch_in / regs.line_length_in : 1; const u32 width = dst_params.width; const u32 height = dst_params.height; const u32 depth = dst_params.depth; @@ -210,7 +212,8 @@ void MaxwellDMA::CopyPitchToBlockLinear() { } void MaxwellDMA::FastCopyBlockLinearToPitch() { - const u32 bytes_per_pixel = 1; + const u32 bytes_per_pixel = + regs.launch_dma.remap_enable ? regs.pitch_out / regs.line_length_in : 1; const size_t src_size = GOB_SIZE; const size_t dst_size = static_cast(regs.pitch_out) * regs.line_count; u32 pos_x = regs.src_params.origin.x; diff --git a/src/video_core/macro/macro.cpp b/src/video_core/macro/macro.cpp index 86393c49c..e7279efcd 100755 --- a/src/video_core/macro/macro.cpp +++ b/src/video_core/macro/macro.cpp @@ -45,6 +45,11 @@ void MacroEngine::AddCode(u32 method, u32 data) { uploaded_macro_code[method].push_back(data); } +void MacroEngine::ClearCode(u32 method) { + macro_cache.erase(method); + uploaded_macro_code.erase(method); +} + void MacroEngine::Execute(u32 method, const std::vector& parameters) { auto compiled_macro = macro_cache.find(method); if (compiled_macro != macro_cache.end()) { diff --git a/src/video_core/macro/macro.h b/src/video_core/macro/macro.h index 7e12c16dc..07d97ba39 100755 --- a/src/video_core/macro/macro.h +++ b/src/video_core/macro/macro.h @@ -117,6 +117,9 @@ public: // Store the uploaded macro code to compile them when they're called. void AddCode(u32 method, u32 data); + // Clear the code associated with a method. + void ClearCode(u32 method); + // Compiles the macro if its not in the cache, and executes the compiled macro void Execute(u32 method, const std::vector& parameters); diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index fd27581ce..ce6c853c1 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -784,8 +784,8 @@ void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs) }); } else { // Front face defines both faces - scheduler.Record([ref = regs.stencil_back_func_ref, write_mask = regs.stencil_back_mask, - test_mask = regs.stencil_back_func_mask](vk::CommandBuffer cmdbuf) { + scheduler.Record([ref = regs.stencil_front_func_ref, write_mask = regs.stencil_front_mask, + test_mask = regs.stencil_front_func_mask](vk::CommandBuffer cmdbuf) { cmdbuf.SetStencilReference(VK_STENCIL_FACE_FRONT_AND_BACK, ref); cmdbuf.SetStencilWriteMask(VK_STENCIL_FACE_FRONT_AND_BACK, write_mask); cmdbuf.SetStencilCompareMask(VK_STENCIL_FACE_FRONT_AND_BACK, test_mask);