rsx: fix some warnings

This commit is contained in:
Megamouse 2025-11-11 08:09:41 +01:00 committed by Elad
parent fa06fed86f
commit 510ed00b11
3 changed files with 21 additions and 8 deletions

View file

@ -178,11 +178,24 @@ namespace rsx
return;
}
// Use memcpy to allow compiler optimizations
Ty _stack_alloc[_local_capacity];
std::memcpy(_stack_alloc, that._data, that.size_bytes());
std::memcpy(that._data, _data, size_bytes());
std::memcpy(_data, _stack_alloc, that.size_bytes());
if constexpr (std::is_trivially_copyable_v<Ty>)
{
// Use memcpy to allow compiler optimizations
Ty _stack_alloc[_local_capacity];
std::memcpy(_stack_alloc, that._data, that.size_bytes());
std::memcpy(that._data, _data, size_bytes());
std::memcpy(_data, _stack_alloc, that.size_bytes());
}
else
{
// Safe path: use element-wise std::swap
const usz count = std::max(size(), that.size());
for (usz i = 0; i < count; ++i)
{
std::swap(_data[i], that._data[i]);
}
}
std::swap(_size, that._size);
}

View file

@ -201,7 +201,7 @@ std::u32string utf16_to_u32string(const std::u16string& utf16_string)
for (const auto& code : utf16_string)
{
result.push_back(code);
result.push_back(static_cast<char32_t>(code));
}
return result;

View file

@ -453,7 +453,7 @@ namespace vk
}
m_descriptor_slots.resize(bind_slots_count);
std::memset(m_descriptor_slots.data(), 0, sizeof(descriptor_slot_t) * bind_slots_count);
std::fill(m_descriptor_slots.begin(), m_descriptor_slots.end(), descriptor_slot_t{});
m_descriptors_dirty.resize(bind_slots_count);
std::fill(m_descriptors_dirty.begin(), m_descriptors_dirty.end(), false);
@ -534,7 +534,7 @@ namespace vk
auto update_descriptor_slot = [this](unsigned idx)
{
const auto& slot = m_descriptor_slots[idx];
const VkDescriptorType type = m_descriptor_types[idx];
if (auto ptr = std::get_if<VkDescriptorImageInfoEx>(&slot))
{
m_descriptor_template[idx].pImageInfo = m_descriptor_set.store(*ptr);