mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-21 13:57:01 +02:00
[cmake] Allow proper unity builds
Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
e875a3196b
commit
b074892cbe
73 changed files with 857 additions and 767 deletions
|
|
@ -16,7 +16,6 @@ endif()
|
|||
add_library(video_core STATIC
|
||||
buffer_cache/buffer_base.h
|
||||
buffer_cache/buffer_cache_base.h
|
||||
buffer_cache/buffer_cache.cpp
|
||||
buffer_cache/buffer_cache.h
|
||||
buffer_cache/memory_tracker_base.h
|
||||
buffer_cache/usage_tracker.h
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
// 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-3.0-or-later
|
||||
|
||||
#include "video_core/buffer_cache/buffer_cache_base.h"
|
||||
#include "video_core/control/channel_state_cache.inc"
|
||||
|
||||
namespace VideoCommon {
|
||||
|
||||
template class VideoCommon::ChannelSetupCaches<VideoCommon::BufferCacheChannelInfo>;
|
||||
|
||||
} // namespace VideoCommon
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 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
|
||||
|
||||
|
|
@ -23,10 +26,9 @@ constexpr std::array VIEW_CLASS_128_BITS{
|
|||
|
||||
constexpr std::array VIEW_CLASS_96_BITS{
|
||||
PixelFormat::R32G32B32_FLOAT,
|
||||
PixelFormat::R32G32B32A32_SINT,
|
||||
PixelFormat::R32G32B32A32_UINT,
|
||||
};
|
||||
// Missing formats:
|
||||
// PixelFormat::RGB32UI,
|
||||
// PixelFormat::RGB32I,
|
||||
|
||||
constexpr std::array VIEW_CLASS_64_BITS{
|
||||
PixelFormat::R32G32_FLOAT, PixelFormat::R32G32_UINT,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "video_core/control/channel_state_cache.inc"
|
||||
#include "video_core/buffer_cache/buffer_cache_base.h"
|
||||
#include "video_core/control/channel_state.h"
|
||||
#include "video_core/control/channel_state_cache.h"
|
||||
#include "video_core/texture_cache/texture_cache_base.h"
|
||||
|
||||
namespace VideoCommon {
|
||||
|
||||
|
|
@ -9,6 +15,82 @@ ChannelInfo::ChannelInfo(Tegra::Control::ChannelState& channel_state)
|
|||
: maxwell3d{*channel_state.maxwell_3d}, kepler_compute{*channel_state.kepler_compute},
|
||||
gpu_memory{*channel_state.memory_manager}, program_id{channel_state.program_id} {}
|
||||
|
||||
template <class P>
|
||||
ChannelSetupCaches<P>::~ChannelSetupCaches() = default;
|
||||
|
||||
template <class P>
|
||||
void ChannelSetupCaches<P>::CreateChannel(struct Tegra::Control::ChannelState& channel) {
|
||||
std::unique_lock<std::mutex> lk(config_mutex);
|
||||
ASSERT(channel_map.find(channel.bind_id) == channel_map.end() && channel.bind_id >= 0);
|
||||
auto new_id = [this, &channel]() {
|
||||
if (!free_channel_ids.empty()) {
|
||||
auto id = free_channel_ids.front();
|
||||
free_channel_ids.pop_front();
|
||||
new (&channel_storage[id]) P(channel);
|
||||
return id;
|
||||
}
|
||||
channel_storage.emplace_back(channel);
|
||||
return channel_storage.size() - 1;
|
||||
}();
|
||||
channel_map.emplace(channel.bind_id, new_id);
|
||||
if (current_channel_id != UNSET_CHANNEL) {
|
||||
channel_state = &channel_storage[current_channel_id];
|
||||
}
|
||||
active_channel_ids.push_back(new_id);
|
||||
auto as_it = address_spaces.find(channel.memory_manager->GetID());
|
||||
if (as_it != address_spaces.end()) {
|
||||
as_it->second.ref_count++;
|
||||
return;
|
||||
}
|
||||
AddressSpaceRef new_gpu_mem_ref{
|
||||
.ref_count = 1,
|
||||
.storage_id = address_spaces.size(),
|
||||
.gpu_memory = channel.memory_manager.get(),
|
||||
};
|
||||
address_spaces.emplace(channel.memory_manager->GetID(), new_gpu_mem_ref);
|
||||
OnGPUASRegister(channel.memory_manager->GetID());
|
||||
}
|
||||
|
||||
/// Bind a channel for execution.
|
||||
template <class P>
|
||||
void ChannelSetupCaches<P>::BindToChannel(s32 id) {
|
||||
std::unique_lock<std::mutex> lk(config_mutex);
|
||||
auto it = channel_map.find(id);
|
||||
ASSERT(it != channel_map.end() && id >= 0);
|
||||
current_channel_id = it->second;
|
||||
channel_state = &channel_storage[current_channel_id];
|
||||
maxwell3d = &channel_state->maxwell3d;
|
||||
kepler_compute = &channel_state->kepler_compute;
|
||||
gpu_memory = &channel_state->gpu_memory;
|
||||
program_id = channel_state->program_id;
|
||||
current_address_space = gpu_memory->GetID();
|
||||
}
|
||||
|
||||
/// Erase channel's channel_state.
|
||||
template <class P>
|
||||
void ChannelSetupCaches<P>::EraseChannel(s32 id) {
|
||||
std::unique_lock<std::mutex> lk(config_mutex);
|
||||
const auto it = channel_map.find(id);
|
||||
ASSERT(it != channel_map.end() && id >= 0);
|
||||
const auto this_id = it->second;
|
||||
free_channel_ids.push_back(this_id);
|
||||
channel_map.erase(it);
|
||||
if (this_id == current_channel_id) {
|
||||
current_channel_id = UNSET_CHANNEL;
|
||||
channel_state = nullptr;
|
||||
maxwell3d = nullptr;
|
||||
kepler_compute = nullptr;
|
||||
gpu_memory = nullptr;
|
||||
program_id = 0;
|
||||
} else if (current_channel_id != UNSET_CHANNEL) {
|
||||
channel_state = &channel_storage[current_channel_id];
|
||||
}
|
||||
active_channel_ids.erase(
|
||||
std::find(active_channel_ids.begin(), active_channel_ids.end(), this_id));
|
||||
}
|
||||
|
||||
template class VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo>;
|
||||
template class VideoCommon::ChannelSetupCaches<VideoCommon::BufferCacheChannelInfo>;
|
||||
template class VideoCommon::ChannelSetupCaches<VideoCommon::TextureCacheChannelInfo>;
|
||||
|
||||
} // namespace VideoCommon
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "video_core/control/channel_state.h"
|
||||
#include "video_core/control/channel_state_cache.h"
|
||||
#include "video_core/engines/kepler_compute.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
#include "video_core/memory_manager.h"
|
||||
|
||||
namespace VideoCommon {
|
||||
|
||||
template <class P>
|
||||
ChannelSetupCaches<P>::~ChannelSetupCaches() = default;
|
||||
|
||||
template <class P>
|
||||
void ChannelSetupCaches<P>::CreateChannel(struct Tegra::Control::ChannelState& channel) {
|
||||
std::unique_lock<std::mutex> lk(config_mutex);
|
||||
ASSERT(channel_map.find(channel.bind_id) == channel_map.end() && channel.bind_id >= 0);
|
||||
auto new_id = [this, &channel]() {
|
||||
if (!free_channel_ids.empty()) {
|
||||
auto id = free_channel_ids.front();
|
||||
free_channel_ids.pop_front();
|
||||
new (&channel_storage[id]) P(channel);
|
||||
return id;
|
||||
}
|
||||
channel_storage.emplace_back(channel);
|
||||
return channel_storage.size() - 1;
|
||||
}();
|
||||
channel_map.emplace(channel.bind_id, new_id);
|
||||
if (current_channel_id != UNSET_CHANNEL) {
|
||||
channel_state = &channel_storage[current_channel_id];
|
||||
}
|
||||
active_channel_ids.push_back(new_id);
|
||||
auto as_it = address_spaces.find(channel.memory_manager->GetID());
|
||||
if (as_it != address_spaces.end()) {
|
||||
as_it->second.ref_count++;
|
||||
return;
|
||||
}
|
||||
AddressSpaceRef new_gpu_mem_ref{
|
||||
.ref_count = 1,
|
||||
.storage_id = address_spaces.size(),
|
||||
.gpu_memory = channel.memory_manager.get(),
|
||||
};
|
||||
address_spaces.emplace(channel.memory_manager->GetID(), new_gpu_mem_ref);
|
||||
OnGPUASRegister(channel.memory_manager->GetID());
|
||||
}
|
||||
|
||||
/// Bind a channel for execution.
|
||||
template <class P>
|
||||
void ChannelSetupCaches<P>::BindToChannel(s32 id) {
|
||||
std::unique_lock<std::mutex> lk(config_mutex);
|
||||
auto it = channel_map.find(id);
|
||||
ASSERT(it != channel_map.end() && id >= 0);
|
||||
current_channel_id = it->second;
|
||||
channel_state = &channel_storage[current_channel_id];
|
||||
maxwell3d = &channel_state->maxwell3d;
|
||||
kepler_compute = &channel_state->kepler_compute;
|
||||
gpu_memory = &channel_state->gpu_memory;
|
||||
program_id = channel_state->program_id;
|
||||
current_address_space = gpu_memory->GetID();
|
||||
}
|
||||
|
||||
/// Erase channel's channel_state.
|
||||
template <class P>
|
||||
void ChannelSetupCaches<P>::EraseChannel(s32 id) {
|
||||
std::unique_lock<std::mutex> lk(config_mutex);
|
||||
const auto it = channel_map.find(id);
|
||||
ASSERT(it != channel_map.end() && id >= 0);
|
||||
const auto this_id = it->second;
|
||||
free_channel_ids.push_back(this_id);
|
||||
channel_map.erase(it);
|
||||
if (this_id == current_channel_id) {
|
||||
current_channel_id = UNSET_CHANNEL;
|
||||
channel_state = nullptr;
|
||||
maxwell3d = nullptr;
|
||||
kepler_compute = nullptr;
|
||||
gpu_memory = nullptr;
|
||||
program_id = 0;
|
||||
} else if (current_channel_id != UNSET_CHANNEL) {
|
||||
channel_state = &channel_storage[current_channel_id];
|
||||
}
|
||||
active_channel_ids.erase(
|
||||
std::find(active_channel_ids.begin(), active_channel_ids.end(), this_id));
|
||||
}
|
||||
|
||||
} // namespace VideoCommon
|
||||
|
|
@ -414,7 +414,7 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) {
|
|||
};
|
||||
}
|
||||
|
||||
void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
|
||||
void BlitImageTransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
|
||||
VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) {
|
||||
constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT};
|
||||
|
|
@ -578,7 +578,7 @@ void BlitImageHelper::BlitColor(const Framebuffer* dst_framebuffer, VkImageView
|
|||
scheduler.RequestOutsideRenderPassOperationContext();
|
||||
scheduler.Record([this, dst_framebuffer, src_image_view, src_image, src_sampler, dst_region,
|
||||
src_region, src_size, pipeline, layout](vk::CommandBuffer cmdbuf) {
|
||||
TransitionImageLayout(cmdbuf, src_image, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||
BlitImageTransitionImageLayout(cmdbuf, src_image, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||
BeginRenderPass(cmdbuf, dst_framebuffer);
|
||||
const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit();
|
||||
UpdateOneTextureDescriptorSet(device, descriptor_set, src_sampler, src_image_view);
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@
|
|||
#include <variant>
|
||||
#include "video_core/present.h"
|
||||
#include "video_core/renderer_vulkan/present/anti_alias_pass.h"
|
||||
/* X11 defines */
|
||||
#undef Success
|
||||
#undef BadValue
|
||||
#include "video_core/renderer_vulkan/vk_rasterizer.h"
|
||||
|
||||
#include "common/settings.h"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <fmt/base.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include "video_core/surface.h"
|
||||
|
|
@ -65,8 +66,7 @@ struct fmt::formatter<VideoCommon::Extent3D> {
|
|||
|
||||
template <typename FormatContext>
|
||||
auto format(const VideoCommon::Extent3D& extent, FormatContext& ctx) const {
|
||||
return fmt::format_to(ctx.out(), "{{{}, {}, {}}}", extent.width, extent.height,
|
||||
extent.depth);
|
||||
return fmt::format_to(ctx.out(), "{{{}, {}, {}}}", extent.width, extent.height, extent.depth);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: 2021 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "video_core/control/channel_state_cache.inc"
|
||||
#include "video_core/texture_cache/texture_cache_base.h"
|
||||
|
||||
namespace VideoCommon {
|
||||
|
|
@ -10,6 +12,4 @@ TextureCacheChannelInfo::TextureCacheChannelInfo(Tegra::Control::ChannelState& s
|
|||
: ChannelInfo(state), graphics_image_table{gpu_memory}, graphics_sampler_table{gpu_memory},
|
||||
compute_image_table{gpu_memory}, compute_sampler_table{gpu_memory} {}
|
||||
|
||||
template class VideoCommon::ChannelSetupCaches<VideoCommon::TextureCacheChannelInfo>;
|
||||
|
||||
} // namespace VideoCommon
|
||||
|
|
|
|||
|
|
@ -22,6 +22,14 @@
|
|||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
// X11 defines
|
||||
#ifdef Success
|
||||
# undef Success
|
||||
#endif
|
||||
#ifdef BadValue
|
||||
# undef BadValue
|
||||
#endif
|
||||
|
||||
// Define maintenance 7-8 extension names (not yet in official Vulkan headers)
|
||||
#ifndef VK_KHR_MAINTENANCE_7_EXTENSION_NAME
|
||||
#define VK_KHR_MAINTENANCE_7_EXTENSION_NAME "VK_KHR_maintenance7"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue