From f55e560ac5f3724d869963addbc823366059b5f8 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 18 Oct 2025 01:54:43 +0200 Subject: [PATCH] [compat] Debian stable gcc12/clang14 compilation fixes (#2763) Mainly because - while we can just give out an AppImage and call it a day - building natively should be an option for all major distros. And "base" stable debian doesn't provide a new enough g++/clang++ so... we need to make some "fixups". Signed-off-by: lizzie Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2763 Reviewed-by: crueter Reviewed-by: MaranBr Co-authored-by: lizzie Co-committed-by: lizzie --- src/audio_core/in/audio_in_system.cpp | 22 +++++++++++-- src/audio_core/out/audio_out_system.cpp | 22 +++++++++++-- src/common/slot_vector.h | 3 ++ src/core/debugger/debugger.cpp | 3 +- .../service/nvnflinger/hardware_composer.cpp | 4 +++ src/core/hle/service/nvnflinger/parcel.h | 7 ++++ src/input_common/drivers/udp_client.cpp | 1 + .../calibration_configuration_job.cpp | 4 +++ src/video_core/buffer_cache/buffer_cache.h | 3 +- src/video_core/dma_pusher.cpp | 3 +- src/video_core/memory_manager.cpp | 4 ++- .../renderer_vulkan/vk_buffer_cache.cpp | 5 +-- .../renderer_vulkan/vk_texture_cache.cpp | 6 ++-- src/video_core/shader_cache.cpp | 23 +++++++------ src/video_core/shader_cache.h | 6 ---- src/video_core/texture_cache/texture_cache.h | 33 ++++++++----------- src/video_core/texture_cache/util.h | 24 ++++++++++++++ 17 files changed, 122 insertions(+), 51 deletions(-) diff --git a/src/audio_core/in/audio_in_system.cpp b/src/audio_core/in/audio_in_system.cpp index b2dd3ef9f7..44fd5ce7b6 100644 --- a/src/audio_core/in/audio_in_system.cpp +++ b/src/audio_core/in/audio_in_system.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,6 +14,21 @@ #include "core/core_timing.h" #include "core/hle/kernel/k_event.h" +// See texture_cache/util.h +template +#if BOOST_VERSION >= 108100 || __GNUC__ > 12 +[[nodiscard]] boost::container::static_vector FixStaticVectorADL(const boost::container::static_vector& v) { + return v; +} +#else +[[nodiscard]] std::vector FixStaticVectorADL(const boost::container::static_vector& v) { + std::vector u; + for (auto const& e : v) + u.push_back(e); + return u; +} +#endif + namespace AudioCore::AudioIn { System::System(Core::System& system_, Kernel::KEvent* event_, const size_t session_id_) @@ -92,7 +110,7 @@ Result System::Start() { boost::container::static_vector buffers_to_flush{}; buffers.RegisterBuffers(buffers_to_flush); - session->AppendBuffers(buffers_to_flush); + session->AppendBuffers(FixStaticVectorADL(buffers_to_flush)); session->SetRingSize(static_cast(buffers_to_flush.size())); return ResultSuccess; @@ -137,7 +155,7 @@ void System::RegisterBuffers() { if (state == State::Started) { boost::container::static_vector registered_buffers{}; buffers.RegisterBuffers(registered_buffers); - session->AppendBuffers(registered_buffers); + session->AppendBuffers(FixStaticVectorADL(registered_buffers)); } } diff --git a/src/audio_core/out/audio_out_system.cpp b/src/audio_core/out/audio_out_system.cpp index 7b3ff4e881..d65f445b6a 100644 --- a/src/audio_core/out/audio_out_system.cpp +++ b/src/audio_core/out/audio_out_system.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -11,6 +14,21 @@ #include "core/core_timing.h" #include "core/hle/kernel/k_event.h" +// See texture_cache/util.h +template +#if BOOST_VERSION >= 108100 || __GNUC__ > 12 +[[nodiscard]] boost::container::static_vector FixStaticVectorADL(const boost::container::static_vector& v) { + return v; +} +#else +[[nodiscard]] std::vector FixStaticVectorADL(const boost::container::static_vector& v) { + std::vector u; + for (auto const& e : v) + u.push_back(e); + return u; +} +#endif + namespace AudioCore::AudioOut { System::System(Core::System& system_, Kernel::KEvent* event_, size_t session_id_) @@ -91,7 +109,7 @@ Result System::Start() { boost::container::static_vector buffers_to_flush{}; buffers.RegisterBuffers(buffers_to_flush); - session->AppendBuffers(buffers_to_flush); + session->AppendBuffers(FixStaticVectorADL(buffers_to_flush)); session->SetRingSize(static_cast(buffers_to_flush.size())); return ResultSuccess; @@ -136,7 +154,7 @@ void System::RegisterBuffers() { if (state == State::Started) { boost::container::static_vector registered_buffers{}; buffers.RegisterBuffers(registered_buffers); - session->AppendBuffers(registered_buffers); + session->AppendBuffers(FixStaticVectorADL(registered_buffers)); } } diff --git a/src/common/slot_vector.h b/src/common/slot_vector.h index 01c65306c8..e464d3d948 100644 --- a/src/common/slot_vector.h +++ b/src/common/slot_vector.h @@ -32,7 +32,10 @@ struct SlotId { }; template +// TODO: More "stable" debian fixes... wohoo +#if __GNUC__ > 12 requires std::is_nothrow_move_assignable_v && std::is_nothrow_move_constructible_v +#endif class SlotVector { public: class Iterator { diff --git a/src/core/debugger/debugger.cpp b/src/core/debugger/debugger.cpp index 1c86b38bf5..1aada09e29 100644 --- a/src/core/debugger/debugger.cpp +++ b/src/core/debugger/debugger.cpp @@ -5,8 +5,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include - - +#include #include #include diff --git a/src/core/hle/service/nvnflinger/hardware_composer.cpp b/src/core/hle/service/nvnflinger/hardware_composer.cpp index 5c0515d473..85634b591b 100644 --- a/src/core/hle/service/nvnflinger/hardware_composer.cpp +++ b/src/core/hle/service/nvnflinger/hardware_composer.cpp @@ -48,7 +48,11 @@ HardwareComposer::~HardwareComposer() = default; u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, Display& display, Nvidia::Devices::nvdisp_disp0& nvdisp) { +#if BOOST_VERSION >= 108100 || __GNUC__ > 12 boost::container::small_vector composition_stack; +#else //TODO: debian stable + std::vector composition_stack; +#endif // Set default speed limit to 100%. *out_speed_scale = 1.0f; diff --git a/src/core/hle/service/nvnflinger/parcel.h b/src/core/hle/service/nvnflinger/parcel.h index e2c9bbd50f..4567942016 100644 --- a/src/core/hle/service/nvnflinger/parcel.h +++ b/src/core/hle/service/nvnflinger/parcel.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -180,7 +183,11 @@ private: private: boost::container::small_vector m_data_buffer; boost::container::small_vector m_object_buffer; +#if BOOST_VERSION >= 108100 || __GNUC__ > 12 boost::container::small_vector m_output_buffer; +#else //TODO: debian stable + std::vector m_output_buffer; +#endif }; } // namespace Service::android diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index fea33335ae..9e29d56cba 100644 --- a/src/input_common/drivers/udp_client.cpp +++ b/src/input_common/drivers/udp_client.cpp @@ -5,6 +5,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include #include #include diff --git a/src/tests/input_common/calibration_configuration_job.cpp b/src/tests/input_common/calibration_configuration_job.cpp index 8f5466253c..d67d1cbbb4 100644 --- a/src/tests/input_common/calibration_configuration_job.cpp +++ b/src/tests/input_common/calibration_configuration_job.cpp @@ -1,9 +1,13 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include #include #include +#include #include #include #include diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 9eaa322c9c..39c56fb33f 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -14,6 +14,7 @@ #include "video_core/buffer_cache/buffer_cache_base.h" #include "video_core/guest_memory.h" #include "video_core/host1x/gpu_device_memory_manager.h" +#include "video_core/texture_cache/util.h" namespace VideoCommon { @@ -1373,7 +1374,7 @@ void BufferCache

::JoinOverlap(BufferId new_buffer_id, BufferId overlap_id, .size = overlap.SizeBytes(), }); new_buffer.MarkUsage(copies[0].dst_offset, copies[0].size); - runtime.CopyBuffer(new_buffer, overlap, copies, true); + runtime.CopyBuffer(new_buffer, overlap, FixSmallVectorADL(copies), true); #ifdef YUZU_LEGACY if (immediately_free) runtime.Finish(); diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index a9bcd150e6..7c3776f44d 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp @@ -12,6 +12,7 @@ #include "video_core/guest_memory.h" #include "video_core/memory_manager.h" #include "video_core/rasterizer_interface.h" +#include "video_core/texture_cache/util.h" namespace Tegra { @@ -59,7 +60,7 @@ bool DmaPusher::Step() { if (command_list.prefetch_command_list.size()) { // Prefetched command list from nvdrv, used for things like synchronization - ProcessCommands(command_list.prefetch_command_list); + ProcessCommands(VideoCommon::FixSmallVectorADL(command_list.prefetch_command_list)); dma_pushbuffer.pop(); } else { const CommandListHeader command_list_header{ diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 94448fe0d7..be97f5ab05 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -12,12 +12,14 @@ #include "core/core.h" #include "core/hle/kernel/k_page_table.h" #include "core/hle/kernel/k_process.h" +#include "memory_manager.h" #include "video_core/guest_memory.h" #include "video_core/host1x/host1x.h" #include "video_core/invalidation_accumulator.h" #include "video_core/memory_manager.h" #include "video_core/rasterizer_interface.h" #include "video_core/renderer_base.h" +#include "video_core/texture_cache/util.h" namespace Tegra { using Tegra::Memory::GuestMemoryFlags; @@ -760,7 +762,7 @@ void MemoryManager::FlushCaching() { accumulator->Callback([this](GPUVAddr addr, size_t size) { GetSubmappedRangeImpl(addr, size, page_stash2); }); - rasterizer->InnerInvalidation(page_stash2); + rasterizer->InnerInvalidation(VideoCommon::FixSmallVectorADL(page_stash2)); page_stash2.clear(); accumulator->Clear(); } diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index 4f07cfd0f8..00f2decba4 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp @@ -19,6 +19,7 @@ #include "video_core/vulkan_common/vulkan_device.h" #include "video_core/vulkan_common/vulkan_memory_allocator.h" #include "video_core/vulkan_common/vulkan_wrapper.h" +#include "video_core/texture_cache/util.h" namespace Vulkan { namespace { @@ -459,7 +460,7 @@ void BufferCacheRuntime::CopyBuffer(VkBuffer dst_buffer, VkBuffer src_buffer, if (src_buffer == staging_pool.StreamBuf() && can_reorder_upload) { scheduler.RecordWithUploadBuffer([src_buffer, dst_buffer, vk_copies]( vk::CommandBuffer, vk::CommandBuffer upload_cmdbuf) { - upload_cmdbuf.CopyBuffer(src_buffer, dst_buffer, vk_copies); + upload_cmdbuf.CopyBuffer(src_buffer, dst_buffer, VideoCommon::FixSmallVectorADL(vk_copies)); }); return; } @@ -470,7 +471,7 @@ void BufferCacheRuntime::CopyBuffer(VkBuffer dst_buffer, VkBuffer src_buffer, cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, READ_BARRIER); } - cmdbuf.CopyBuffer(src_buffer, dst_buffer, vk_copies); + cmdbuf.CopyBuffer(src_buffer, dst_buffer, VideoCommon::FixSmallVectorADL(vk_copies)); if (barrier) { cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, WRITE_BARRIER); diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 7a7d0fe179..9b6d1704c3 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -1473,7 +1473,7 @@ void TextureCacheRuntime::CopyImage(Image& dst, Image& src, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, nullptr, nullptr, pre_barriers); cmdbuf.CopyImage(src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, vk_copies); + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VideoCommon::FixSmallVectorADL(vk_copies)); cmdbuf.PipelineBarrier( VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | @@ -1602,7 +1602,7 @@ void Image::UploadMemory(VkBuffer buffer, VkDeviceSize offset, scheduler->Record([src_buffer, temp_vk_image, vk_aspect_mask, vk_copies, keep = temp_wrapper](vk::CommandBuffer cmdbuf) { - CopyBufferToImage(cmdbuf, src_buffer, temp_vk_image, vk_aspect_mask, false, vk_copies); + CopyBufferToImage(cmdbuf, src_buffer, temp_vk_image, vk_aspect_mask, false, VideoCommon::FixSmallVectorADL(vk_copies)); }); // Use MSAACopyPass to convert from non-MSAA to MSAA @@ -1641,7 +1641,7 @@ void Image::UploadMemory(VkBuffer buffer, VkDeviceSize offset, scheduler->Record([src_buffer, vk_image, vk_aspect_mask, was_initialized, vk_copies](vk::CommandBuffer cmdbuf) { - CopyBufferToImage(cmdbuf, src_buffer, vk_image, vk_aspect_mask, was_initialized, vk_copies); + CopyBufferToImage(cmdbuf, src_buffer, vk_image, vk_aspect_mask, was_initialized, VideoCommon::FixSmallVectorADL(vk_copies)); }); if (is_rescaled) { diff --git a/src/video_core/shader_cache.cpp b/src/video_core/shader_cache.cpp index 2af32c8f25..8a349bfe2a 100644 --- a/src/video_core/shader_cache.cpp +++ b/src/video_core/shader_cache.cpp @@ -1,9 +1,13 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include #include #include +#include #include "common/assert.h" #include "shader_recompiler/frontend/maxwell/control_flow.h" @@ -16,6 +20,7 @@ #include "video_core/memory_manager.h" #include "video_core/shader_cache.h" #include "video_core/shader_environment.h" +#include "video_core/texture_cache/util.h" namespace VideoCommon { @@ -157,21 +162,22 @@ void ShaderCache::RemovePendingShaders() { std::ranges::sort(marked_for_removal); marked_for_removal.erase(std::unique(marked_for_removal.begin(), marked_for_removal.end()), marked_for_removal.end()); - + // Linear growth anyways - maybe consider static_vector instead? boost::container::small_vector removed_shaders; - std::scoped_lock lock{lookup_mutex}; for (Entry* const entry : marked_for_removal) { removed_shaders.push_back(entry->data); - - const auto it = lookup_cache.find(entry->addr_start); + auto const it = lookup_cache.find(entry->addr_start); ASSERT(it != lookup_cache.end()); lookup_cache.erase(it); } marked_for_removal.clear(); if (!removed_shaders.empty()) { - RemoveShadersFromStorage(removed_shaders); + // Remove the given shaders from the cache + std::erase_if(storage, [&removed_shaders](const std::unique_ptr& shader) { + return std::ranges::find(removed_shaders, shader.get()) != removed_shaders.end(); + }); } } @@ -214,13 +220,6 @@ void ShaderCache::UnmarkMemory(Entry* entry) { device_memory.UpdatePagesCachedCount(addr, size, -1); } -void ShaderCache::RemoveShadersFromStorage(std::span removed_shaders) { - // Remove them from the cache - std::erase_if(storage, [&removed_shaders](const std::unique_ptr& shader) { - return std::ranges::find(removed_shaders, shader.get()) != removed_shaders.end(); - }); -} - ShaderCache::Entry* ShaderCache::NewEntry(VAddr addr, VAddr addr_end, ShaderInfo* data) { auto entry = std::make_unique(Entry{addr, addr_end, data}); Entry* const entry_pointer = entry.get(); diff --git a/src/video_core/shader_cache.h b/src/video_core/shader_cache.h index 18b5df3bbc..244146fe52 100644 --- a/src/video_core/shader_cache.h +++ b/src/video_core/shader_cache.h @@ -136,12 +136,6 @@ private: /// @param entry Entry to unmark from memory void UnmarkMemory(Entry* entry); - /// @brief Removes a vector of shaders from a list - /// @param removed_shaders Shaders to be removed from the storage - /// @pre invalidation_mutex is locked - /// @pre lookup_mutex is locked - void RemoveShadersFromStorage(std::span removed_shaders); - /// @brief Creates a new entry in the lookup cache and returns its pointer /// @pre lookup_mutex is locked Entry* NewEntry(VAddr addr, VAddr addr_end, ShaderInfo* data); diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index e5d559b591..2a44a5e8b2 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -108,7 +108,7 @@ void TextureCache

::RunGarbageCollector() { } if (must_download) { auto map = runtime.DownloadStagingBuffer(image.unswizzled_size_bytes); - const auto copies = FullDownloadCopies(image.info); + const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); image.DownloadMemory(map, copies); runtime.Finish(); SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span, @@ -564,7 +564,7 @@ void TextureCache

::DownloadMemory(DAddr cpu_addr, size_t size) { for (const ImageId image_id : images) { Image& image = slot_images[image_id]; auto map = runtime.DownloadStagingBuffer(image.unswizzled_size_bytes); - const auto copies = FullDownloadCopies(image.info); + const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); image.DownloadMemory(map, copies); runtime.Finish(); SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span, @@ -829,7 +829,7 @@ void TextureCache

::CommitAsyncFlushes() { for (const PendingDownload& download_info : download_ids) { if (download_info.is_swizzle) { Image& image = slot_images[download_info.object_id]; - const auto copies = FullDownloadCopies(image.info); + const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); image.DownloadMemory(download_map, copies); download_map.offset += Common::AlignUp(image.unswizzled_size_bytes, 64); } @@ -862,12 +862,11 @@ void TextureCache

::PopAsyncFlushes() { auto& download_buffer = download_map[download_info.async_buffer_id]; if (download_info.is_swizzle) { const ImageBase& image = slot_images[download_info.object_id]; - const auto copies = FullDownloadCopies(image.info); + const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); download_buffer.offset -= Common::AlignUp(image.unswizzled_size_bytes, 64); std::span download_span = download_buffer.mapped_span.subspan(download_buffer.offset); - SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span, - swizzle_data_buffer); + SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span, swizzle_data_buffer); } else { const BufferDownload& buffer_info = slot_buffer_downloads[download_info.object_id]; std::span download_span = @@ -901,7 +900,7 @@ void TextureCache

::PopAsyncFlushes() { continue; } Image& image = slot_images[download_info.object_id]; - const auto copies = FullDownloadCopies(image.info); + const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); image.DownloadMemory(download_map, copies); download_map.offset += image.unswizzled_size_bytes; } @@ -914,9 +913,8 @@ void TextureCache

::PopAsyncFlushes() { continue; } const ImageBase& image = slot_images[download_info.object_id]; - const auto copies = FullDownloadCopies(image.info); - SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span, - swizzle_data_buffer); + const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info)); + SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span, swizzle_data_buffer); download_map.offset += image.unswizzled_size_bytes; download_span = download_span.subspan(image.unswizzled_size_bytes); } @@ -1082,22 +1080,19 @@ void TextureCache

::UploadImageContents(Image& image, StagingBuffer& staging) gpu_memory->ReadBlock(gpu_addr, mapped_span.data(), mapped_span.size_bytes(), VideoCommon::CacheType::NoTextureCache); const auto uploads = FullUploadSwizzles(image.info); - runtime.AccelerateImageUpload(image, staging, uploads); + runtime.AccelerateImageUpload(image, staging, FixSmallVectorADL(uploads)); return; } Tegra::Memory::GpuGuestMemory swizzle_data( *gpu_memory, gpu_addr, image.guest_size_bytes, &swizzle_data_buffer); - if (True(image.flags & ImageFlagBits::Converted)) { unswizzle_data_buffer.resize_destructive(image.unswizzled_size_bytes); - auto copies = - UnswizzleImage(*gpu_memory, gpu_addr, image.info, swizzle_data, unswizzle_data_buffer); + auto copies = FixSmallVectorADL(UnswizzleImage(*gpu_memory, gpu_addr, image.info, swizzle_data, unswizzle_data_buffer)); ConvertImage(unswizzle_data_buffer, image.info, mapped_span, copies); image.UploadMemory(staging, copies); } else { - const auto copies = - UnswizzleImage(*gpu_memory, gpu_addr, image.info, swizzle_data, mapped_span); + const auto copies = FixSmallVectorADL(UnswizzleImage(*gpu_memory, gpu_addr, image.info, swizzle_data, mapped_span)); image.UploadMemory(staging, copies); } } @@ -1329,7 +1324,7 @@ void TextureCache

::TickAsyncDecode() { auto staging = runtime.UploadStagingBuffer(MapSizeBytes(image)); std::memcpy(staging.mapped_span.data(), async_decode->decoded_data.data(), async_decode->decoded_data.size()); - image.UploadMemory(staging, async_decode->copies); + image.UploadMemory(staging, FixSmallVectorADL(async_decode->copies)); image.flags &= ~ImageFlagBits::IsDecoding; has_uploads = true; i = async_decodes.erase(i); @@ -1576,9 +1571,9 @@ ImageId TextureCache

::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, DA const u32 down_shift = can_rescale ? resolution.down_shift : 0; auto copies = MakeShrinkImageCopies(new_info, overlap.info, base, up_scale, down_shift); if (overlap.info.num_samples != new_image.info.num_samples) { - runtime.CopyImageMSAA(new_image, overlap, std::move(copies)); + runtime.CopyImageMSAA(new_image, overlap, FixSmallVectorADL(copies)); } else { - runtime.CopyImage(new_image, overlap, std::move(copies)); + runtime.CopyImage(new_image, overlap, FixSmallVectorADL(copies)); } new_image.modification_tick = overlap.modification_tick; } diff --git a/src/video_core/texture_cache/util.h b/src/video_core/texture_cache/util.h index 5a0649d243..3e8bb00032 100644 --- a/src/video_core/texture_cache/util.h +++ b/src/video_core/texture_cache/util.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -119,4 +122,25 @@ void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* [[nodiscard]] u32 MapSizeBytes(const ImageBase& image); +// TODO: Remove once Debian STABLE no longer has such outdated boost +// This is a gcc bug where ADL lookup fails for range niebloids of std::span +// for any given type of the static_vector/small_vector, etc which makes a whole mess +// for anything using std::span so we just do this terrible hack on older versions of +// GCC12 because people actually still use stable debian so... yeah +// One may say: "This is bad for performance" - to which I say, using GCC 12 you already know +// what kind of bs you will be dealing with anyways. +template +#if BOOST_VERSION >= 108100 || __GNUC__ > 12 +[[nodiscard]] boost::container::small_vector FixSmallVectorADL(const boost::container::small_vector& v) { + return v; +} +#else +[[nodiscard]] std::vector FixSmallVectorADL(const boost::container::small_vector& v) { + std::vector u; + for (auto const& e : v) + u.push_back(e); + return u; +} +#endif + } // namespace VideoCommon