Compare commits

...

5 commits

Author SHA1 Message Date
Megamouse
3e674a896f Minor struct memory layout optimization
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-24 18:24:58 +02:00
Megamouse
3aba805bc9 rsx: Fix use after move warning 2025-05-24 18:24:58 +02:00
Megamouse
09ab5477e8 rsx: use more const ref 2025-05-24 18:24:58 +02:00
Megamouse
da273761d1 Fix some static analysis warnings 2025-05-24 18:24:58 +02:00
FlexBy420
4f2324cae7 Remove roadmap link from README
Roadmap was removed from the website as it wasn't updated in years.
2025-05-24 16:47:47 +02:00
17 changed files with 51 additions and 48 deletions

View file

@ -22,7 +22,6 @@ If you want to contribute as a developer, please take a look at the following pa
* [Coding Style](https://github.com/RPCS3/rpcs3/wiki/Coding-Style)
* [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information)
* [Roadmap](https://rpcs3.net/roadmap)
You should also contact any of the developers in the forums or in the Discord server to learn more about the current state of the emulator.

View file

@ -459,11 +459,11 @@ struct VibrateMotor
struct ps_move_data
{
bool external_device_connected = false;
u32 external_device_id = 0;
std::array<u8, 5> external_device_data{};
std::array<u8, 38> external_device_read{}; // CELL_GEM_EXTERNAL_PORT_DEVICE_INFO_SIZE
std::array<u8, 40> external_device_write{}; // CELL_GEM_EXTERNAL_PORT_OUTPUT_SIZE
std::array<u8, 5> external_device_data{};
bool external_device_connected = false;
bool external_device_read_requested = false;
bool external_device_write_requested = false;

View file

@ -504,6 +504,7 @@ namespace rsx
{
// Exchange this surface with the invalidated one
surface = std::move(old_surface_storage);
old_surface_storage = {};
}
else
{

View file

@ -569,7 +569,7 @@ void GLGSRender::emit_geometry(u32 sub_index)
if (vertex_state && !m_vertex_layout.validate())
{
// No vertex inputs enabled
// Execute remainining pipeline barriers with NOP draw
// Execute remaining pipeline barriers with NOP draw
do
{
draw_call.execute_pipeline_dependencies(m_ctx);
@ -619,9 +619,9 @@ void GLGSRender::emit_geometry(u32 sub_index)
}
else
{
const auto subranges = draw_call.get_subranges();
const auto& subranges = draw_call.get_subranges();
const auto draw_count = subranges.size();
const auto driver_caps = gl::get_driver_caps();
const auto& driver_caps = gl::get_driver_caps();
bool use_draw_arrays_fallback = false;
m_scratch_buffer.resize(draw_count * 24);
@ -631,7 +631,7 @@ void GLGSRender::emit_geometry(u32 sub_index)
u32 first = 0;
u32 dst_index = 0;
for (const auto &range : subranges)
for (const auto& range : subranges)
{
firsts[dst_index] = first;
counts[dst_index] = range.count;

View file

@ -33,7 +33,7 @@ void GLFragmentDecompilerThread::insertHeader(std::stringstream & OS)
if (device_props.has_native_half_support)
{
const auto driver_caps = gl::get_driver_caps();
const auto& driver_caps = gl::get_driver_caps();
if (driver_caps.NV_gpu_shader5_supported)
{
required_extensions.push_back("GL_NV_gpu_shader5");
@ -47,7 +47,7 @@ void GLFragmentDecompilerThread::insertHeader(std::stringstream & OS)
if (properties.multisampled_sampler_mask)
{
// Requires this extension or GLSL 450
const auto driver_caps = gl::get_driver_caps();
const auto& driver_caps = gl::get_driver_caps();
if (driver_caps.glsl_version.version >= 450)
{
gl_version = 450;
@ -366,7 +366,7 @@ void GLFragmentProgram::Decompile(const RSXFragmentProgram& prog)
if (g_cfg.video.shader_precision == gpu_preset_level::low)
{
const auto driver_caps = gl::get_driver_caps();
const auto& driver_caps = gl::get_driver_caps();
decompiler.device_props.has_native_half_support = driver_caps.NV_gpu_shader5_supported || driver_caps.AMD_gpu_shader_half_float_supported;
decompiler.device_props.has_low_precision_rounding = driver_caps.vendor_NVIDIA;
}

View file

@ -148,7 +148,7 @@ void GLGSRender::on_init_thread()
rsx_log.success("GL VERSION: %s", reinterpret_cast<const char*>(glGetString(GL_VERSION)));
rsx_log.success("GLSL VERSION: %s", reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
auto& gl_caps = gl::get_driver_caps();
const auto& gl_caps = gl::get_driver_caps();
std::vector<std::string> exception_reasons;
if (!gl_caps.ARB_texture_buffer_object_supported)

View file

@ -582,7 +582,7 @@ namespace gl
const std::vector<rsx::subresource_layout> &input_layouts,
bool is_swizzled, GLenum gl_format, GLenum gl_type, rsx::simple_array<std::byte>& staging_buffer)
{
const auto driver_caps = gl::get_driver_caps();
const auto& driver_caps = gl::get_driver_caps();
rsx::texture_uploader_capabilities caps
{
.supports_byteswap = true,

View file

@ -143,10 +143,10 @@ class CgBinaryDisasm
std::vector<u32> m_loop_end_offsets;
// VP members
u32 m_sca_opcode;
u32 m_vec_opcode;
static const usz m_max_instr_count = 512;
usz m_instr_count;
u32 m_sca_opcode = 0;
u32 m_vec_opcode = 0;
static constexpr usz m_max_instr_count = 512;
usz m_instr_count = 0;
std::vector<u32> m_data;
public:

View file

@ -18,9 +18,8 @@ namespace rsx
static inline std::string_view location_tostring(u32 location)
{
ensure(location < 2);
constexpr const char* location_names[2] = { "CELL_GCM_LOCATION_LOCAL", "CELL_GCM_LOCATION_MAIN" };
return location_names[location];
return ::at32(location_names, location);
}
static inline u32 classify_location(u32 address)

View file

@ -565,7 +565,7 @@ VKGSRender::VKGSRender(utils::serial* ar) noexcept : GSRender(ar)
m_fragment_texture_params_buffer_info = { m_fragment_texture_params_ring_info.heap->value, 0, 16 };
m_raster_env_buffer_info = { m_raster_env_ring_info.heap->value, 0, 128 };
const auto limits = m_device->gpu().get_limits();
const auto& limits = m_device->gpu().get_limits();
m_texbuffer_view_size = std::min(limits.maxTexelBufferElements, VK_ATTRIB_RING_BUFFER_SIZE_M * 0x100000u);
if (m_texbuffer_view_size < 0x800000)

View file

@ -50,7 +50,7 @@ namespace vk
{
// For any managed resources, try to keep the number of unused/idle resources as low as possible.
// Improves search times as well as keeping us below the hardware limit.
const auto limits = get_current_renderer()->gpu().get_limits();
const auto& limits = get_current_renderer()->gpu().get_limits();
const auto allocated_sampler_count = vmm_get_application_pool_usage(VMM_ALLOCATION_POOL_SAMPLER);
const auto max_allowed_samplers = std::min((limits.maxSamplerAllocationCount * 3u) / 4u, 2048u);

View file

@ -16,7 +16,7 @@ namespace vk
disposable_t() = delete;
disposable_t(const disposable_t&) = delete;
disposable_t(disposable_t&& other) :
disposable_t(disposable_t&& other) noexcept :
ptr(std::exchange(other.ptr, nullptr)),
deleter(other.deleter)
{}

View file

@ -11,7 +11,7 @@ namespace vk
{
void image::validate(const vk::render_device& dev, const VkImageCreateInfo& info) const
{
const auto gpu_limits = dev.gpu().get_limits();
const auto& gpu_limits = dev.gpu().get_limits();
u32 longest_dim, dim_limit;
switch (info.imageType)

View file

@ -425,7 +425,7 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr<CPUDis
setLayout(vbox_panel);
// Events
connect(m_addr_line, &QLineEdit::returnPressed, [this]()
connect(m_addr_line, &QLineEdit::returnPressed, this, [this]()
{
bool ok = false;
const u32 addr = normalize_hex_qstring(m_addr_line->text()).toULong(&ok, 16);
@ -433,17 +433,17 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr<CPUDis
scroll(0); // Refresh
});
connect(sb_words, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=, this]()
connect(sb_words, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [=, this]()
{
m_colcount = 1 << sb_words->value();
ShowMemory();
});
connect(b_prev, &QAbstractButton::clicked, [this]() { scroll(-1); });
connect(b_next, &QAbstractButton::clicked, [this]() { scroll(1); });
connect(b_fprev, &QAbstractButton::clicked, [this]() { scroll(m_rowcount * -1); });
connect(b_fnext, &QAbstractButton::clicked, [this]() { scroll(m_rowcount); });
connect(b_img, &QAbstractButton::clicked, [=, this]()
connect(b_prev, &QAbstractButton::clicked, this, [this]() { scroll(-1); });
connect(b_next, &QAbstractButton::clicked, this, [this]() { scroll(1); });
connect(b_fprev, &QAbstractButton::clicked, this, [this]() { scroll(m_rowcount * -1); });
connect(b_fnext, &QAbstractButton::clicked, this, [this]() { scroll(m_rowcount); });
connect(b_img, &QAbstractButton::clicked, this, [=, this]()
{
const color_format format = cbox_img_mode->currentData().value<color_format>();
const int sizex = sb_img_size_x->value();
@ -580,7 +580,7 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr<CPUDis
const u32 id = idm::last_id();
auto handle_ptr = idm::get_unlocked<memory_viewer_handle>(id);
connect(this, &memory_viewer_panel::finished, [handle_ptr = std::move(handle_ptr), id, this](int)
connect(this, &memory_viewer_panel::finished, this, [handle_ptr = std::move(handle_ptr), id, this](int)
{
if (m_search_thread)
{
@ -617,7 +617,7 @@ memory_viewer_panel::~memory_viewer_panel()
void memory_viewer_panel::wheelEvent(QWheelEvent *event)
{
// Set some scrollspeed modifiers:
// Set some scroll speed modifiers:
u32 step_size = 1;
if (event->modifiers().testFlag(Qt::ControlModifier))
step_size *= m_rowcount;
@ -986,6 +986,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form
const u32 memsize = utils::mul_saturate<u32>(utils::mul_saturate<u32>(texel_bytes, width), height);
if (memsize == 0)
{
gui_log.error("Can not show image. memsize is 0 (texel_bytes=%d, width=%d, height=%d)", texel_bytes, width, height);
return;
}
@ -993,6 +994,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form
if (!originalBuffer)
{
gui_log.error("Can not show image. originalBuffer is null (addr=%d, memsize=%d)", addr, memsize);
return;
}
@ -1001,6 +1003,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form
if (!convertedBuffer)
{
// OOM or invalid memory address, give up
gui_log.error("Can not show image. convertedBuffer is null (addr=%d, memsize=%d)", addr, memsize);
return;
}
@ -1014,7 +1017,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form
{
const u32 offset = y * pitch;
const u32 offset_new = y * pitch_new;
for (u32 x = 0, x_new = 0; x < pitch; x += 3, x_new += 4)
for (u32 x = 0, x_new = 0; x < pitch && x_new < pitch_new; x += 3, x_new += 4)
{
convertedBuffer[offset_new + x_new + 0] = originalBuffer[offset + x + 2];
convertedBuffer[offset_new + x_new + 1] = originalBuffer[offset + x + 1];
@ -1116,19 +1119,20 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form
}
// Flip vertically
if (flipv && height > 1 && memsize > 1)
if (flipv && width > 0 && height > 1 && memsize > 1)
{
const u32 pitch = width * 4;
std::vector<u8> tmp_row(pitch);
for (u32 y = 0; y < height / 2; y++)
{
const u32 offset = y * pitch;
const u32 flip_offset = (height - y - 1) * pitch;
for (u32 x = 0; x < pitch; x++)
{
const u8 tmp = convertedBuffer[offset + x];
convertedBuffer[offset + x] = convertedBuffer[flip_offset + x];
convertedBuffer[flip_offset + x] = tmp;
}
u8* row_top = &convertedBuffer[y * pitch];
u8* row_bottom = &convertedBuffer[(height - y - 1) * pitch];
// Swap rows
std::memcpy(tmp_row.data(), row_top, pitch);
std::memcpy(row_top, row_bottom, pitch);
std::memcpy(row_bottom, tmp_row.data(), pitch);
}
}

View file

@ -86,13 +86,12 @@ std::array<midi_device, max_midi_devices> midi_creator::get_selection_list() con
std::string midi_creator::set_device(u32 num, const midi_device& device)
{
ensure(num < m_sel_list.size());
m_sel_list[num] = device;
midi_device& dev = ::at32(m_sel_list, num);
dev = device;
if (device.name == get_none().toStdString())
{
m_sel_list[num].name.clear();
dev.name.clear();
}
std::string result;

View file

@ -11,7 +11,7 @@
struct recvmessage_signal_struct
{
shared_ptr<std::pair<std::string, message_data>> msg;
u64 msg_id;
u64 msg_id = 0;
};
Q_DECLARE_METATYPE(recvmessage_signal_struct);

View file

@ -17,7 +17,7 @@ skylander_dialog* skylander_dialog::inst = nullptr;
std::optional<std::tuple<u8, u16, u16>> skylander_dialog::sky_slots[UI_SKY_NUM];
QString last_skylander_path;
const std::map<const std::pair<const u16, const u16>, const std::string> list_skylanders = {
static const std::map<const std::pair<const u16, const u16>, const std::string> list_skylanders = {
{{0, 0x0000}, "Whirlwind"},
{{0, 0x1801}, "Series 2 Whirlwind"},
{{0, 0x1C02}, "Polar Whirlwind"},
@ -502,7 +502,8 @@ const std::map<const std::pair<const u16, const u16>, const std::string> list_sk
u16 skylander_crc16(u16 init_value, const u8* buffer, u32 size)
{
const unsigned short CRC_CCITT_TABLE[256] = {0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, 0x3273,
constexpr unsigned short CRC_CCITT_TABLE[256] = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, 0x3273,
0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485, 0xA56A, 0xB54B, 0x8528,
0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D, 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4, 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC, 0x48C4, 0x58E5, 0x6886,
0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, 0xDBFD, 0xCBDC, 0xFBBF,