From 53ca0da4b20d865810e48d740b82b12ec3e5376d Mon Sep 17 00:00:00 2001 From: Herman Semenov Date: Wed, 21 Aug 2024 22:05:33 +0300 Subject: [PATCH] core,shader_recompiler: align structures for 64-bit platforms 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 | 5 ++--- src/core/libraries/videoout/driver.h | 5 ++--- 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(+), 15 deletions(-) diff --git a/src/audio_core/sdl_audio.h b/src/audio_core/sdl_audio.h index d20c4455..a739133a 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::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 97b1816e..3d87ab9e 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 @@ -220,9 +220,8 @@ bool VideoOutDriver::SubmitFlip(VideoOutPort* port, s32 index, s64 flip_arg, requests.push({ .frame = frame, .port = port, - .index = index, .flip_arg = flip_arg, - .submit_tsc = Libraries::Kernel::sceKernelReadTsc(), + .index = index, .eop = is_eop, }); diff --git a/src/core/libraries/videoout/driver.h b/src/core/libraries/videoout/driver.h index 104056de..b1254b18 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 @@ -91,9 +91,8 @@ private: struct Request { Vulkan::Frame* frame; VideoOutPort* port; - s32 index; s64 flip_arg; - u64 submit_tsc; + s32 index; bool eop; operator bool() const noexcept { diff --git a/src/sdl_window.h b/src/sdl_window.h index 02d01128..d52c0b4c 100644 --- a/src/sdl_window.h +++ b/src/sdl_window.h @@ -24,9 +24,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; @@ -37,6 +34,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 61b55437..ea37d870 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp @@ -469,8 +469,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 0d090eb3..46909874 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;