From 71158b94ed033c61d47b5ca03d4210cd05f0a20b Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Wed, 4 Jan 2023 06:43:37 +0100 Subject: [PATCH] early-access version 3279 --- README.md | 2 +- src/video_core/engines/maxwell_3d.h | 2 - src/video_core/macro/macro_hle.cpp | 83 +++++++++---------- src/video_core/texture_cache/texture_cache.h | 20 ----- .../texture_cache/texture_cache_base.h | 2 - 5 files changed, 39 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 172f2e6c3..ecce678a8 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3277. +This is the source code for early-access 3279. ## Legal Notice diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index ef8fb9b48..4eada1d91 100755 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -3087,8 +3087,6 @@ public: std::unique_ptr draw_manager; friend class DrawManager; - std::vector inline_index_draw_indexes; - GPUVAddr GetMacroAddress(size_t index) const { return macro_addresses[index]; } diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 740ebee64..c273168b4 100755 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -50,25 +50,11 @@ protected: Engines::Maxwell3D& maxwell3d; }; -class HLE_771BB18C62444DA0 final : public HLEMacroImpl { -public: - explicit HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} - - void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { - maxwell3d.RefreshParameters(); - const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B); - maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.draw_manager->DrawIndex( - static_cast(parameters[0] & - 0x3ffffff), - parameters[4], parameters[1], parameters[3], parameters[5], instance_count); - } -}; - +template class HLE_DrawArraysIndirect final : public HLEMacroImpl { public: - explicit HLE_DrawArraysIndirect(Engines::Maxwell3D& maxwell3d_, bool extended_ = false) - : HLEMacroImpl(maxwell3d_), extended(extended_) {} + explicit HLE_DrawArraysIndirect(Engines::Maxwell3D& maxwell3d_) + : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { auto topology = static_cast(parameters[0]); @@ -86,7 +72,7 @@ public: params.max_draw_counts = 1; params.stride = 0; - if (extended) { + if constexpr (extended) { maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; maxwell3d.SetHLEReplacementAttributeType( 0, 0x640, Maxwell::HLEReplacementAttributeType::BaseInstance); @@ -94,7 +80,7 @@ public: maxwell3d.draw_manager->DrawArrayIndirect(topology); - if (extended) { + if constexpr (extended) { maxwell3d.engine_state = Maxwell::EngineHint::None; maxwell3d.replace_table.clear(); } @@ -123,7 +109,7 @@ private: } const u32 base_instance = parameters[4]; - if (extended) { + if constexpr (extended) { maxwell3d.regs.global_base_instance_index = base_instance; maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; maxwell3d.SetHLEReplacementAttributeType( @@ -133,16 +119,15 @@ private: maxwell3d.draw_manager->DrawArray(topology, vertex_first, vertex_count, base_instance, instance_count); - if (extended) { + if constexpr (extended) { maxwell3d.regs.global_base_instance_index = 0; maxwell3d.engine_state = Maxwell::EngineHint::None; maxwell3d.replace_table.clear(); } } - - bool extended; }; +template class HLE_DrawIndexedIndirect final : public HLEMacroImpl { public: explicit HLE_DrawIndexedIndirect(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} @@ -161,11 +146,13 @@ public: maxwell3d.regs.global_base_vertex_index = element_base; maxwell3d.regs.global_base_instance_index = base_instance; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; - maxwell3d.SetHLEReplacementAttributeType(0, 0x640, - Maxwell::HLEReplacementAttributeType::BaseVertex); - maxwell3d.SetHLEReplacementAttributeType( - 0, 0x644, Maxwell::HLEReplacementAttributeType::BaseInstance); + if constexpr (extended) { + maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x640, Maxwell::HLEReplacementAttributeType::BaseVertex); + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x644, Maxwell::HLEReplacementAttributeType::BaseInstance); + } auto& params = maxwell3d.draw_manager->GetIndirectParams(); params.is_indexed = true; params.include_count = false; @@ -176,11 +163,13 @@ public: params.stride = 0; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate); - maxwell3d.engine_state = Maxwell::EngineHint::None; - maxwell3d.replace_table.clear(); maxwell3d.regs.vertex_id_base = 0x0; maxwell3d.regs.global_base_vertex_index = 0x0; maxwell3d.regs.global_base_instance_index = 0x0; + if constexpr (extended) { + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); + } } private: @@ -193,11 +182,13 @@ private: maxwell3d.regs.global_base_vertex_index = element_base; maxwell3d.regs.global_base_instance_index = base_instance; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; - maxwell3d.SetHLEReplacementAttributeType(0, 0x640, - Maxwell::HLEReplacementAttributeType::BaseVertex); - maxwell3d.SetHLEReplacementAttributeType( - 0, 0x644, Maxwell::HLEReplacementAttributeType::BaseInstance); + if constexpr (extended) { + maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x640, Maxwell::HLEReplacementAttributeType::BaseVertex); + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x644, Maxwell::HLEReplacementAttributeType::BaseInstance); + } maxwell3d.draw_manager->DrawIndex( static_cast(parameters[0]), @@ -206,8 +197,10 @@ private: maxwell3d.regs.vertex_id_base = 0x0; maxwell3d.regs.global_base_vertex_index = 0x0; maxwell3d.regs.global_base_instance_index = 0x0; - maxwell3d.engine_state = Maxwell::EngineHint::None; - maxwell3d.replace_table.clear(); + if constexpr (extended) { + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); + } } }; @@ -397,25 +390,25 @@ public: } // Anonymous namespace HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { - builders.emplace(0x771BB18C62444DA0ULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__); - })); builders.emplace(0x0D61FC9FAAC9FCADULL, std::function(Engines::Maxwell3D&)>( [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__); + return std::make_unique>(maxwell3d__); })); builders.emplace(0x8A4D173EB99A8603ULL, std::function(Engines::Maxwell3D&)>( [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__, true); + return std::make_unique>(maxwell3d__); + })); + builders.emplace(0x771BB18C62444DA0ULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique>(maxwell3d__); })); builders.emplace(0x0217920100488FF7ULL, std::function(Engines::Maxwell3D&)>( [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__); + return std::make_unique>(maxwell3d__); })); builders.emplace(0x3F5E74B9C9A50164ULL, std::function(Engines::Maxwell3D&)>( diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index c82d4fab9..51eddf285 100755 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -1517,25 +1517,6 @@ void TextureCache

::ForEachSparseSegment(ImageBase& image, Func&& func) { } } -template -void TextureCache

::BubbleUpImages(VAddr cpu_addr, size_t size) { - ForEachCPUPage(cpu_addr, size, [this](u64 page) { - const auto it = page_table.find(page); - if (it == page_table.end()) { - return; - } - std::vector& map_vector = it->second; - for (size_t i = 1; i < map_vector.size(); i++) { - ImageMapView& bottom_map = slot_map_views[map_vector[i - 1]]; - ImageMapView& top_map = slot_map_views[map_vector[i]]; - if (slot_images[bottom_map.image_id].modification_tick < - slot_images[top_map.image_id].modification_tick) { - std::swap(map_vector[i - 1], map_vector[i]); - } - } - }); -} - template ImageViewId TextureCache

::FindOrEmplaceImageView(ImageId image_id, const ImageViewInfo& info) { Image& image = slot_images[image_id]; @@ -1849,7 +1830,6 @@ template void TextureCache

::MarkModification(ImageBase& image) noexcept { image.flags |= ImageFlagBits::GpuModified; image.modification_tick = ++modification_tick; - BubbleUpImages(image.cpu_addr, image.guest_size_bytes); } template diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index bceacfc35..cf4730748 100755 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -319,8 +319,6 @@ private: template void ForEachSparseSegment(ImageBase& image, Func&& func); - void BubbleUpImages(VAddr cpu_addr, size_t size); - /// Find or create an image view in the given image with the passed parameters [[nodiscard]] ImageViewId FindOrEmplaceImageView(ImageId image_id, const ImageViewInfo& info);