Merge remote-tracking branch 'upstream/master' into fix-smashbros

This commit is contained in:
Reg Tiangha 2024-04-16 07:33:14 -06:00
commit a378014156
No known key found for this signature in database
GPG Key ID: 00D437798B1C2970
144 changed files with 1025 additions and 1023 deletions

View File

@ -7,7 +7,7 @@ if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dis
fi
# Default clang-format points to default 3.5 version one
CLANG_FORMAT=clang-format-15
CLANG_FORMAT=clang-format-18
$CLANG_FORMAT --version
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then

View File

@ -2,7 +2,7 @@
if [ "$TARGET" = "appimage" ]; then
# Compile the AppImage we distribute with Clang.
export EXTRA_CMAKE_FLAGS=(-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=/etc/bin/ld.lld)
export EXTRA_CMAKE_FLAGS=(-DCMAKE_LINKER=/etc/bin/ld.lld)
else
# For the linux-fresh verification target, verify compilation without PCH as well.
export EXTRA_CMAKE_FLAGS=(-DCITRA_USE_PRECOMPILED_HEADERS=OFF)
@ -13,6 +13,8 @@ cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_C_COMPILER=clang-18 \
"${EXTRA_CMAKE_FLAGS[@]}" \
-DENABLE_QT_TRANSLATION=ON \
-DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON \

View File

@ -28,7 +28,7 @@ jobs:
matrix:
target: ["appimage", "fresh"]
container:
image: polarzincomfrio/lime-build-environments:linux-${{ matrix.target }}
image: opensauce04/lime3ds-build:latest
options: -u 1001
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache

View File

@ -10,7 +10,7 @@ jobs:
clang-format:
runs-on: ubuntu-latest
container:
image: polarzincomfrio/lime-build-environments:linux-fresh
image: opensauce04/lime3ds-build:latest
options: -u 1001
steps:
- uses: actions/checkout@v4

View File

@ -117,7 +117,7 @@ else()
if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
# _FORTIFY_SOURCE can't be used without optimizations.
add_compile_options(-Wp,-D_FORTIFY_SOURCE=2)
add_compile_options(-D_FORTIFY_SOURCE=2)
endif()
if (CITRA_WARNINGS_AS_ERRORS)

View File

@ -42,7 +42,9 @@ struct CaptureSession final {
#define MEMBER(type, name, func) \
struct type##Deleter { \
void operator()(type* ptr) { type##_##func(ptr); } \
void operator()(type* ptr) { \
type##_##func(ptr); \
} \
}; \
std::unique_ptr<type, type##Deleter> name

View File

@ -40,8 +40,8 @@ class SharedContext_Android : public Frontend::GraphicsContext {
public:
SharedContext_Android(EGLDisplay egl_display, EGLConfig egl_config,
EGLContext egl_share_context)
: egl_display{egl_display}, egl_surface{eglCreatePbufferSurface(egl_display, egl_config,
egl_empty_attribs.data())},
: egl_display{egl_display},
egl_surface{eglCreatePbufferSurface(egl_display, egl_config, egl_empty_attribs.data())},
egl_context{eglCreateContext(egl_display, egl_config, egl_share_context,
egl_context_attribs.data())} {
ASSERT_MSG(egl_surface, "eglCreatePbufferSurface() failed!");

View File

@ -215,8 +215,8 @@ Joystick::~Joystick() {
}
ButtonFactory::ButtonFactory()
: button_list{std::make_shared<ButtonList>()}, analog_button_list{
std::make_shared<AnalogButtonList>()} {}
: button_list{std::make_shared<ButtonList>()},
analog_button_list{std::make_shared<AnalogButtonList>()} {}
std::unique_ptr<Input::ButtonDevice> ButtonFactory::Create(const Common::ParamPackage& params) {
if (params.Has("axis")) {

View File

@ -599,14 +599,14 @@ public:
template <typename G = E, std::enable_if_t<std::is_constructible_v<E, G&&>>* = nullptr,
std::enable_if_t<!std::is_convertible_v<G&&, E>>* = nullptr>
constexpr explicit Expected(Unexpected<G>&& e) noexcept(std::is_nothrow_constructible_v<E, G&&>)
: impl_base{unexpect_t{}, std::move(e.value())}, ctor_base{
detail::default_constructor_tag{}} {}
: impl_base{unexpect_t{}, std::move(e.value())},
ctor_base{detail::default_constructor_tag{}} {}
template <typename G = E, std::enable_if_t<std::is_constructible_v<E, G&&>>* = nullptr,
std::enable_if_t<std::is_convertible_v<G&&, E>>* = nullptr>
constexpr Expected(Unexpected<G>&& e) noexcept(std::is_nothrow_constructible_v<E, G&&>)
: impl_base{unexpect_t{}, std::move(e.value())}, ctor_base{
detail::default_constructor_tag{}} {}
: impl_base{unexpect_t{}, std::move(e.value())},
ctor_base{detail::default_constructor_tag{}} {}
template <typename... Args, std::enable_if_t<std::is_constructible_v<E, Args&&...>>* = nullptr>
constexpr explicit Expected(unexpect_t, Args&&... args)

View File

@ -204,8 +204,8 @@ public:
explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val,
const std::string& name)
requires(ranged)
: value{default_val},
default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {}
: value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val},
label{name} {}
/**
* Returns a reference to the setting's value.
@ -460,8 +460,7 @@ struct Values {
// TODO: Add a null renderer backend for this, perhaps.
#error "At least one renderer must be enabled."
#endif
GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api"
};
GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api"};
SwitchableSetting<u32> physical_device{0, "physical_device"};
Setting<bool> use_gles{false, "use_gles"};
Setting<bool> renderer_debug{false, "renderer_debug"};

View File

@ -396,7 +396,9 @@ public:
// _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all
// component names (x<->r) and permutations (xy<->yx)
#define _DEFINE_SWIZZLER2(a, b, name) \
[[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); }
[[nodiscard]] constexpr Vec2<T> name() const { \
return Vec2<T>(a, b); \
}
#define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \
_DEFINE_SWIZZLER2(a, b, a##b); \
_DEFINE_SWIZZLER2(a, b, a2##b2); \
@ -596,7 +598,9 @@ public:
// DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and
// permutations (xy<->yx)
#define _DEFINE_SWIZZLER2(a, b, name) \
[[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); }
[[nodiscard]] constexpr Vec2<T> name() const { \
return Vec2<T>(a, b); \
}
#define DEFINE_SWIZZLER2_COMP1(a, a2) \
_DEFINE_SWIZZLER2(a, a, a##a); \
_DEFINE_SWIZZLER2(a, a, a2##a2)
@ -621,7 +625,9 @@ public:
#undef _DEFINE_SWIZZLER2
#define _DEFINE_SWIZZLER3(a, b, c, name) \
[[nodiscard]] constexpr Vec3<T> name() const { return Vec3<T>(a, b, c); }
[[nodiscard]] constexpr Vec3<T> name() const { \
return Vec3<T>(a, b, c); \
}
#define DEFINE_SWIZZLER3_COMP1(a, a2) \
_DEFINE_SWIZZLER3(a, a, a, a##a##a); \
_DEFINE_SWIZZLER3(a, a, a, a2##a2##a2)

View File

@ -12,9 +12,8 @@
#include "ui_configure_cheats.h"
ConfigureCheats::ConfigureCheats(Cheats::CheatEngine& cheat_engine_, u64 title_id_, QWidget* parent)
: QWidget(parent),
ui(std::make_unique<Ui::ConfigureCheats>()), cheat_engine{cheat_engine_}, title_id{
title_id_} {
: QWidget(parent), ui(std::make_unique<Ui::ConfigureCheats>()), cheat_engine{cheat_engine_},
title_id{title_id_} {
// Setup gui control settings
ui->setupUi(this);
ui->tableCheats->setColumnWidth(0, 30);

View File

@ -141,8 +141,8 @@ QString BreakPointModel::DebugContextEventToString(Pica::DebugContext::Event eve
GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent)
: QDockWidget(tr("Pica Breakpoints"), parent), Pica::DebugContext::BreakPointObserver(
debug_context) {
: QDockWidget(tr("Pica Breakpoints"), parent),
Pica::DebugContext::BreakPointObserver(debug_context) {
setObjectName(QStringLiteral("PicaBreakPointsWidget"));
status_text = new QLabel(tr("Emulation running"));

View File

@ -16,8 +16,8 @@
#include "ui_movie_play_dialog.h"
MoviePlayDialog::MoviePlayDialog(QWidget* parent, GameList* game_list_, const Core::System& system_)
: QDialog(parent),
ui(std::make_unique<Ui::MoviePlayDialog>()), game_list{game_list_}, system{system_} {
: QDialog(parent), ui(std::make_unique<Ui::MoviePlayDialog>()), game_list{game_list_},
system{system_} {
ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);

View File

@ -43,8 +43,8 @@ struct GPU::Impl {
: timing{system.CoreTiming()}, system{system}, memory{system.Memory()},
debug_context{Pica::g_debug_context}, pica{memory, debug_context},
renderer{VideoCore::CreateRenderer(emu_window, secondary_window, pica, system)},
rasterizer{renderer->Rasterizer()}, sw_blitter{std::make_unique<SwRenderer::SwBlitter>(
memory, rasterizer)} {}
rasterizer{renderer->Rasterizer()},
sw_blitter{std::make_unique<SwRenderer::SwBlitter>(memory, rasterizer)} {}
~Impl() = default;
};

View File

@ -31,9 +31,8 @@ union CommandHeader {
static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!");
PicaCore::PicaCore(Memory::MemorySystem& memory_, std::shared_ptr<DebugContext> debug_context_)
: memory{memory_}, debug_context{std::move(debug_context_)}, geometry_pipeline{regs.internal,
gs_unit,
gs_setup},
: memory{memory_}, debug_context{std::move(debug_context_)},
geometry_pipeline{regs.internal, gs_unit, gs_setup},
shader_engine{CreateEngine(Settings::values.use_shader_jit.GetValue())} {
InitializeRegs();

View File

@ -55,12 +55,12 @@ OGLProgram CreateProgram(std::string_view frag) {
BlitHelper::BlitHelper(const Driver& driver_)
: driver{driver_}, linear_sampler{CreateSampler(GL_LINEAR)},
nearest_sampler{CreateSampler(GL_NEAREST)}, bicubic_program{CreateProgram(
HostShaders::BICUBIC_FRAG)},
nearest_sampler{CreateSampler(GL_NEAREST)},
bicubic_program{CreateProgram(HostShaders::BICUBIC_FRAG)},
scale_force_program{CreateProgram(HostShaders::SCALE_FORCE_FRAG)},
xbrz_program{CreateProgram(HostShaders::XBRZ_FREESCALE_FRAG)},
mmpx_program{CreateProgram(HostShaders::MMPX_FRAG)}, gradient_x_program{CreateProgram(
HostShaders::X_GRADIENT_FRAG)},
mmpx_program{CreateProgram(HostShaders::MMPX_FRAG)},
gradient_x_program{CreateProgram(HostShaders::X_GRADIENT_FRAG)},
gradient_y_program{CreateProgram(HostShaders::Y_GRADIENT_FRAG)},
refine_program{CreateProgram(HostShaders::REFINE_FRAG)},
d24s8_to_rgba8{CreateProgram(HostShaders::D24S8_TO_RGBA8_FRAG)},

View File

@ -79,13 +79,12 @@ RasterizerOpenGL::RasterizerOpenGL(Memory::MemorySystem& memory, Pica::PicaCore&
: VideoCore::RasterizerAccelerated{memory, pica}, driver{driver_},
shader_manager{renderer.GetRenderWindow(), driver, !driver.IsOpenGLES()},
runtime{driver, renderer}, res_cache{memory, custom_tex_manager, runtime, regs, renderer},
texture_buffer_size{TextureBufferSize()}, vertex_buffer{driver, GL_ARRAY_BUFFER,
VERTEX_BUFFER_SIZE},
texture_buffer_size{TextureBufferSize()},
vertex_buffer{driver, GL_ARRAY_BUFFER, VERTEX_BUFFER_SIZE},
uniform_buffer{driver, GL_UNIFORM_BUFFER, UNIFORM_BUFFER_SIZE},
index_buffer{driver, GL_ELEMENT_ARRAY_BUFFER, INDEX_BUFFER_SIZE},
texture_buffer{driver, GL_TEXTURE_BUFFER, texture_buffer_size}, texture_lf_buffer{
driver, GL_TEXTURE_BUFFER,
texture_buffer_size} {
texture_buffer{driver, GL_TEXTURE_BUFFER, texture_buffer_size},
texture_lf_buffer{driver, GL_TEXTURE_BUFFER, texture_buffer_size} {
// Clipping plane 0 is always enabled for PICA fixed clip plane z <= 0
state.clip_distance[0] = true;
@ -965,10 +964,9 @@ void RasterizerOpenGL::SyncAndUploadLUTsLF() {
if (fs_uniform_block_data.fog_lut_dirty || invalidate) {
std::array<Common::Vec2f, 128> new_data;
std::transform(pica.fog.lut.begin(), pica.fog.lut.end(), new_data.begin(),
[](const auto& entry) {
return Common::Vec2f{entry.ToFloat(), entry.DiffToFloat()};
});
std::transform(
pica.fog.lut.begin(), pica.fog.lut.end(), new_data.begin(),
[](const auto& entry) { return Common::Vec2f{entry.ToFloat(), entry.DiffToFloat()}; });
if (new_data != fog_lut_data || invalidate) {
fog_lut_data = new_data;

View File

@ -331,8 +331,8 @@ public:
ShaderProgramManager::ShaderProgramManager(Frontend::EmuWindow& emu_window_, const Driver& driver_,
bool separable)
: emu_window{emu_window_}, driver{driver_},
strict_context_required{emu_window.StrictContextRequired()}, impl{std::make_unique<Impl>(
driver_, separable)} {}
strict_context_required{emu_window.StrictContextRequired()},
impl{std::make_unique<Impl>(driver_, separable)} {}
ShaderProgramManager::~ShaderProgramManager() = default;

View File

@ -602,8 +602,8 @@ void Surface::BlitScale(const VideoCore::TextureBlit& blit, bool up_scale) {
Framebuffer::Framebuffer(TextureRuntime& runtime, const VideoCore::FramebufferParams& params,
const Surface* color, const Surface* depth)
: VideoCore::FramebufferParams{params}, res_scale{color ? color->res_scale
: (depth ? depth->res_scale : 1u)} {
: VideoCore::FramebufferParams{params},
res_scale{color ? color->res_scale : (depth ? depth->res_scale : 1u)} {
if (shadow_rendering && !color) {
return;

View File

@ -75,9 +75,8 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons
RendererOpenGL::RendererOpenGL(Core::System& system, Pica::PicaCore& pica_,
Frontend::EmuWindow& window, Frontend::EmuWindow* secondary_window)
: VideoCore::RendererBase{system, window, secondary_window}, pica{pica_},
rasterizer{system.Memory(), pica, system.CustomTexManager(), *this, driver}, frame_dumper{
system,
window} {
rasterizer{system.Memory(), pica, system.CustomTexManager(), *this, driver},
frame_dumper{system, window} {
const bool has_debug_tool = driver.HasDebugTool();
window.mailbox = std::make_unique<OGLTextureMailbox>(has_debug_tool);
if (secondary_window) {

View File

@ -54,7 +54,8 @@ RendererVulkan::RendererVulkan(Core::System& system, Pica::PicaCore& pica_,
Frontend::EmuWindow& window, Frontend::EmuWindow* secondary_window)
: RendererBase{system, window, secondary_window}, memory{system.Memory()}, pica{pica_},
instance{window, Settings::values.physical_device.GetValue()}, scheduler{instance},
renderpass_cache{instance, scheduler}, main_window{window, instance, scheduler},
renderpass_cache{instance, scheduler}, pool{instance},
main_window{window, instance, scheduler},
vertex_buffer{instance, scheduler, vk::BufferUsageFlagBits::eVertexBuffer,
VERTEX_BUFFER_SIZE},
update_queue{instance},

View File

@ -132,14 +132,14 @@ std::string GetReadableVersion(u32 version) {
} // Anonymous namespace
Instance::Instance(bool enable_validation, bool dump_command_buffers)
: library{OpenLibrary()}, instance{CreateInstance(*library,
Frontend::WindowSystemType::Headless,
enable_validation, dump_command_buffers)},
: library{OpenLibrary()},
instance{CreateInstance(*library, Frontend::WindowSystemType::Headless, enable_validation,
dump_command_buffers)},
physical_devices{instance->enumeratePhysicalDevices()} {}
Instance::Instance(Frontend::EmuWindow& window, u32 physical_device_index)
: library{OpenLibrary(&window)}, instance{CreateInstance(
*library, window.GetWindowInfo().type,
: library{OpenLibrary(&window)},
instance{CreateInstance(*library, window.GetWindowInfo().type,
Settings::values.renderer_debug.GetValue(),
Settings::values.dump_command_buffers.GetValue())},
debug_callback{CreateDebugCallback(*instance, debug_utils_supported)},

View File

@ -100,8 +100,8 @@ bool CanBlitToSwapchain(const vk::PhysicalDevice& physical_device, vk::Format fo
PresentWindow::PresentWindow(Frontend::EmuWindow& emu_window_, const Instance& instance_,
Scheduler& scheduler_)
: emu_window{emu_window_}, instance{instance_}, scheduler{scheduler_},
surface{CreateSurface(instance.GetInstance(), emu_window)},
next_surface{surface}, swapchain{instance, emu_window.GetFramebufferLayout().width,
surface{CreateSurface(instance.GetInstance(), emu_window)}, next_surface{surface},
swapchain{instance, emu_window.GetFramebufferLayout().width,
emu_window.GetFramebufferLayout().height, surface},
graphics_queue{instance.GetGraphicsQueue()}, present_renderpass{CreateRenderpass()},
vsync_enabled{Settings::values.use_vsync_new.GetValue()},

View File

@ -61,11 +61,9 @@ RasterizerVulkan::RasterizerVulkan(Memory::MemorySystem& memory, Pica::PicaCore&
Scheduler& scheduler, RenderManager& renderpass_cache,
DescriptorUpdateQueue& update_queue_, u32 image_count)
: RasterizerAccelerated{memory, pica}, instance{instance}, scheduler{scheduler},
renderpass_cache{renderpass_cache}, update_queue{update_queue_},
pipeline_cache{instance, scheduler, renderpass_cache, update_queue}, runtime{instance,
scheduler,
renderpass_cache,
update_queue,
renderpass_cache{renderpass_cache},
pipeline_cache{instance, scheduler, renderpass_cache, pool},
runtime{instance, scheduler, renderpass_cache, pool, pipeline_cache.TextureProvider(),
image_count},
res_cache{memory, custom_tex_manager, runtime, regs, renderer},
stream_buffer{instance, scheduler, BUFFER_USAGE, STREAM_BUFFER_SIZE},
@ -966,10 +964,9 @@ void RasterizerVulkan::SyncAndUploadLUTsLF() {
if (fs_uniform_block_data.fog_lut_dirty || invalidate) {
std::array<Common::Vec2f, 128> new_data;
std::transform(pica.fog.lut.begin(), pica.fog.lut.end(), new_data.begin(),
[](const auto& entry) {
return Common::Vec2f{entry.ToFloat(), entry.DiffToFloat()};
});
std::transform(
pica.fog.lut.begin(), pica.fog.lut.end(), new_data.begin(),
[](const auto& entry) { return Common::Vec2f{entry.ToFloat(), entry.DiffToFloat()}; });
if (new_data != fog_lut_data || invalidate) {
fog_lut_data = new_data;

View File

@ -1450,8 +1450,8 @@ void Surface::BlitScale(const VideoCore::TextureBlit& blit, bool up_scale) {
Framebuffer::Framebuffer(TextureRuntime& runtime, const VideoCore::FramebufferParams& params,
Surface* color, Surface* depth)
: VideoCore::FramebufferParams{params}, res_scale{color ? color->res_scale
: (depth ? depth->res_scale : 1u)} {
: VideoCore::FramebufferParams{params},
res_scale{color ? color->res_scale : (depth ? depth->res_scale : 1u)} {
auto& renderpass_cache = runtime.GetRenderpassCache();
if (shadow_rendering && !color) {
return;
@ -1544,8 +1544,8 @@ Sampler::Sampler(TextureRuntime& runtime, const VideoCore::SamplerParams& params
Sampler::~Sampler() = default;
DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f color, std::string_view label)
: scheduler{runtime.GetScheduler()}, has_debug_tool{
runtime.GetInstance().HasDebuggingToolAttached()} {
: scheduler{runtime.GetScheduler()},
has_debug_tool{runtime.GetInstance().HasDebuggingToolAttached()} {
if (!has_debug_tool) {
return;
}