mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 23:59:27 +01:00
VideoBackends:Metal: Align utility uniform sizes
Prevents complaining from validation layers
This commit is contained in:
parent
89963c287c
commit
a399dc43a1
@ -7,6 +7,7 @@
|
||||
#include <bit>
|
||||
#include <mutex>
|
||||
|
||||
#include "Common/Align.h"
|
||||
#include "Common/Assert.h"
|
||||
|
||||
#include "Core/System.h"
|
||||
@ -565,12 +566,15 @@ void Metal::StateTracker::InvalidateUniforms(bool vertex, bool geometry, bool fr
|
||||
|
||||
void Metal::StateTracker::SetUtilityUniform(const void* buffer, size_t size)
|
||||
{
|
||||
// Shader often uses 16-byte aligned types
|
||||
// Metal validation will complain if our upload is smaller than the struct with padding
|
||||
size_t aligned_size = Common::AlignUp(size, 16);
|
||||
if (m_state.utility_uniform_capacity < size)
|
||||
{
|
||||
m_state.utility_uniform = std::unique_ptr<u8[]>(new u8[size]);
|
||||
m_state.utility_uniform_capacity = size;
|
||||
m_state.utility_uniform = std::unique_ptr<u8[]>(new u8[aligned_size]);
|
||||
m_state.utility_uniform_capacity = static_cast<u32>(aligned_size);
|
||||
}
|
||||
m_state.utility_uniform_size = size;
|
||||
m_state.utility_uniform_size = static_cast<u32>(aligned_size);
|
||||
memcpy(m_state.utility_uniform.get(), buffer, size);
|
||||
m_flags.has_utility_vs_uniform = false;
|
||||
m_flags.has_utility_ps_uniform = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user