From 243fd0be78d2a7abd1b2b8165c2be2da36d93652 Mon Sep 17 00:00:00 2001 From: Herman Semenov Date: Sat, 24 Aug 2024 13:18:12 +0000 Subject: [PATCH] core,shader_recompiler: align structures for 64-bit platforms (#447) Decreased sizes: * TextureDefinition 32 bytes -> 24 bytes * PortOut 72 bytes -> 64 bytes * Request 48 bytes -> 40 bytes * WindowSystemInfo 32 bytes -> 24 bytes --- src/audio_core/sdl_audio.h | 8 ++++---- src/core/libraries/videoout/driver.cpp | 4 ++-- src/core/libraries/videoout/driver.h | 4 ++-- src/sdl_window.h | 6 +++--- .../backend/spirv/spirv_emit_context.cpp | 2 +- src/shader_recompiler/backend/spirv/spirv_emit_context.h | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/audio_core/sdl_audio.h b/src/audio_core/sdl_audio.h index 7844bd61..07e82145 100644 --- a/src/audio_core/sdl_audio.h +++ b/src/audio_core/sdl_audio.h @@ -22,15 +22,15 @@ public: private: struct PortOut { - bool isOpen = false; - int type = 0; + SDL_AudioStream* stream = nullptr; u32 samples_num = 0; - u8 sample_size = 0; u32 freq = 0; u32 format = -1; + int type = 0; int channels_num = 0; int volume[8] = {}; - SDL_AudioStream* stream = nullptr; + u8 sample_size = 0; + bool isOpen = false; }; std::shared_mutex m_mutex; std::array portsOut; // main up to 8 ports , BGM 1 port , voice up to 4 ports , diff --git a/src/core/libraries/videoout/driver.cpp b/src/core/libraries/videoout/driver.cpp index 25de48a4..dbbcb1de 100644 --- a/src/core/libraries/videoout/driver.cpp +++ b/src/core/libraries/videoout/driver.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include @@ -252,8 +252,8 @@ void VideoOutDriver::SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_ requests.push({ .frame = frame, .port = port, - .index = index, .flip_arg = flip_arg, + .index = index, .eop = is_eop, }); } diff --git a/src/core/libraries/videoout/driver.h b/src/core/libraries/videoout/driver.h index bee80060..6fc74e01 100644 --- a/src/core/libraries/videoout/driver.h +++ b/src/core/libraries/videoout/driver.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once @@ -92,8 +92,8 @@ private: struct Request { Vulkan::Frame* frame; VideoOutPort* port; - s32 index; s64 flip_arg; + s32 index; bool eop; operator bool() const noexcept { diff --git a/src/sdl_window.h b/src/sdl_window.h index cf6c3711..11ee9289 100644 --- a/src/sdl_window.h +++ b/src/sdl_window.h @@ -25,9 +25,6 @@ enum class WindowSystemType : u8 { }; struct WindowSystemInfo { - // Window system type. Determines which GL context or Vulkan WSI is used. - WindowSystemType type = WindowSystemType::Headless; - // Connection to a display server. This is used on X11 and Wayland platforms. void* display_connection = nullptr; @@ -38,6 +35,9 @@ struct WindowSystemInfo { // Scale of the render surface. For hidpi systems, this will be >1. float render_surface_scale = 1.0f; + + // Window system type. Determines which GL context or Vulkan WSI is used. + WindowSystemType type = WindowSystemType::Headless; }; class WindowSDL { diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp index d61e108f..e48b89f4 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp @@ -485,8 +485,8 @@ void EmitContext::DefineImagesAndSamplers() { Name(id, fmt::format("{}_{}{}_{:02x}", stage, "img", image_desc.sgpr_base, image_desc.dword_offset)); images.push_back({ - .id = id, .data_types = data_types, + .id = id, .sampled_type = image_desc.is_storage ? sampled_type : TypeSampledImage(image_type), .pointer_type = pointer_type, .image_type = image_type, diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.h b/src/shader_recompiler/backend/spirv/spirv_emit_context.h index 768b591f..5a09c411 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.h +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.h @@ -193,8 +193,8 @@ public: Id shared_memory_u32_type{}; struct TextureDefinition { - Id id; const VectorIds* data_types; + Id id; Id sampled_type; Id pointer_type; Id image_type;