Fix padding size calculation
This commit is contained in:
parent
593f78a230
commit
a2228adef1
@ -23,6 +23,16 @@ GEConfig* getGEConfig();
|
|||||||
void deinit();
|
void deinit();
|
||||||
uint64_t getMonoTimeMs();
|
uint64_t getMonoTimeMs();
|
||||||
void mathPlaneFrustumf(float* out, const irr::core::matrix4& pvm);
|
void mathPlaneFrustumf(float* out, const irr::core::matrix4& pvm);
|
||||||
|
inline size_t getPadding(size_t in, size_t alignment)
|
||||||
|
{
|
||||||
|
if (in == 0 || alignment == 0)
|
||||||
|
return 0;
|
||||||
|
size_t mod = in % alignment;
|
||||||
|
if (mod == 0)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return alignment - mod;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -432,9 +432,7 @@ void GEVulkanDrawCall::uploadDynamicData(GEVulkanDriver* vk,
|
|||||||
const size_t object_data_size =
|
const size_t object_data_size =
|
||||||
sizeof(ObjectData) * m_visible_objects.size();
|
sizeof(ObjectData) * m_visible_objects.size();
|
||||||
size_t ubo_alignment = limit.minUniformBufferOffsetAlignment;
|
size_t ubo_alignment = limit.minUniformBufferOffsetAlignment;
|
||||||
size_t ubo_padding = 0;
|
size_t ubo_padding = getPadding(object_data_size, ubo_alignment);
|
||||||
if (ubo_alignment > 0)
|
|
||||||
ubo_padding = object_data_size % ubo_alignment;
|
|
||||||
m_object_data_padded_size = object_data_size + ubo_padding;
|
m_object_data_padded_size = object_data_size + ubo_padding;
|
||||||
|
|
||||||
// https://github.com/google/filament/pull/3814
|
// https://github.com/google/filament/pull/3814
|
||||||
|
Loading…
Reference in New Issue
Block a user