[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 <lizzie@eden-emu.dev>

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2763
Reviewed-by: crueter <crueter@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2025-10-18 01:54:43 +02:00 committed by crueter
parent 84ab54c4bc
commit f55e560ac5
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
17 changed files with 122 additions and 51 deletions

View file

@ -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<typename T, size_t N>
#if BOOST_VERSION >= 108100 || __GNUC__ > 12
[[nodiscard]] boost::container::static_vector<T, N> FixStaticVectorADL(const boost::container::static_vector<T, N>& v) {
return v;
}
#else
[[nodiscard]] std::vector<T> FixStaticVectorADL(const boost::container::static_vector<T, N>& v) {
std::vector<T> 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<AudioBuffer, BufferCount> buffers_to_flush{};
buffers.RegisterBuffers(buffers_to_flush);
session->AppendBuffers(buffers_to_flush);
session->AppendBuffers(FixStaticVectorADL(buffers_to_flush));
session->SetRingSize(static_cast<u32>(buffers_to_flush.size()));
return ResultSuccess;
@ -137,7 +155,7 @@ void System::RegisterBuffers() {
if (state == State::Started) {
boost::container::static_vector<AudioBuffer, BufferCount> registered_buffers{};
buffers.RegisterBuffers(registered_buffers);
session->AppendBuffers(registered_buffers);
session->AppendBuffers(FixStaticVectorADL(registered_buffers));
}
}

View file

@ -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<typename T, size_t N>
#if BOOST_VERSION >= 108100 || __GNUC__ > 12
[[nodiscard]] boost::container::static_vector<T, N> FixStaticVectorADL(const boost::container::static_vector<T, N>& v) {
return v;
}
#else
[[nodiscard]] std::vector<T> FixStaticVectorADL(const boost::container::static_vector<T, N>& v) {
std::vector<T> 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<AudioBuffer, BufferCount> buffers_to_flush{};
buffers.RegisterBuffers(buffers_to_flush);
session->AppendBuffers(buffers_to_flush);
session->AppendBuffers(FixStaticVectorADL(buffers_to_flush));
session->SetRingSize(static_cast<u32>(buffers_to_flush.size()));
return ResultSuccess;
@ -136,7 +154,7 @@ void System::RegisterBuffers() {
if (state == State::Started) {
boost::container::static_vector<AudioBuffer, BufferCount> registered_buffers{};
buffers.RegisterBuffers(registered_buffers);
session->AppendBuffers(registered_buffers);
session->AppendBuffers(FixStaticVectorADL(registered_buffers));
}
}

View file

@ -32,7 +32,10 @@ struct SlotId {
};
template <class T>
// TODO: More "stable" debian fixes... wohoo
#if __GNUC__ > 12
requires std::is_nothrow_move_assignable_v<T> && std::is_nothrow_move_constructible_v<T>
#endif
class SlotVector {
public:
class Iterator {

View file

@ -5,8 +5,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <mutex>
#include <utility>
#include <boost/asio.hpp>
#include <boost/version.hpp>

View file

@ -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<HwcLayer, 2> composition_stack;
#else //TODO: debian stable
std::vector<HwcLayer> composition_stack;
#endif
// Set default speed limit to 100%.
*out_speed_scale = 1.0f;

View file

@ -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<u8, 0x1B0> m_data_buffer;
boost::container::small_vector<u8, 0x40> m_object_buffer;
#if BOOST_VERSION >= 108100 || __GNUC__ > 12
boost::container::small_vector<u8, 0x200> m_output_buffer;
#else //TODO: debian stable
std::vector<u8> m_output_buffer;
#endif
};
} // namespace Service::android

View file

@ -5,6 +5,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <random>
#include <utility>
#include <boost/asio.hpp>
#include <fmt/ranges.h>

View file

@ -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 <array>
#include <string>
#include <thread>
#include <utility>
#include <boost/asio.hpp>
#include <boost/crc.hpp>
#include <catch2/catch_test_macros.hpp>

View file

@ -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<P>::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();

View file

@ -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{

View file

@ -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<false>(addr, size, page_stash2);
});
rasterizer->InnerInvalidation(page_stash2);
rasterizer->InnerInvalidation(VideoCommon::FixSmallVectorADL(page_stash2));
page_stash2.clear();
accumulator->Clear();
}

View file

@ -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);

View file

@ -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) {

View file

@ -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 <algorithm>
#include <array>
#include <vector>
#include <boost/container/small_vector.hpp>
#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<ShaderInfo*, 16> 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<ShaderInfo>& 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<ShaderInfo*> removed_shaders) {
// Remove them from the cache
std::erase_if(storage, [&removed_shaders](const std::unique_ptr<ShaderInfo>& 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>(Entry{addr, addr_end, data});
Entry* const entry_pointer = entry.get();

View file

@ -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<ShaderInfo*> 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);

View file

@ -108,7 +108,7 @@ void TextureCache<P>::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<P>::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<P>::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<P>::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<u8> 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<u8> download_span =
@ -901,7 +900,7 @@ void TextureCache<P>::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<P>::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<P>::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<u8, Tegra::Memory::GuestMemoryFlags::UnsafeRead> 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<P>::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<P>::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;
}

View file

@ -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<T>
// for any given type of the static_vector/small_vector, etc which makes a whole mess
// for anything using std::span<T> 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<typename T, size_t N>
#if BOOST_VERSION >= 108100 || __GNUC__ > 12
[[nodiscard]] boost::container::small_vector<T, N> FixSmallVectorADL(const boost::container::small_vector<T, N>& v) {
return v;
}
#else
[[nodiscard]] std::vector<T> FixSmallVectorADL(const boost::container::small_vector<T, N>& v) {
std::vector<T> u;
for (auto const& e : v)
u.push_back(e);
return u;
}
#endif
} // namespace VideoCommon