Renderer/RenderDeviceInfo: Ensure storage/uniform buffer alignment is a power of two
This commit is contained in:
parent
9ff1dcc42a
commit
51e0876bed
|
|
@ -311,7 +311,7 @@ int main(int argc, char* argv[])
|
|||
std::size_t innerAngleOffset = spotLightOffsets.AddField(nzsl::StructFieldType::Float1);
|
||||
std::size_t outerAngleOffset = spotLightOffsets.AddField(nzsl::StructFieldType::Float1);
|
||||
|
||||
std::size_t alignedSpotLightSize = Nz::Align(spotLightOffsets.GetAlignedSize(), static_cast<std::size_t>(deviceInfo.limits.minUniformBufferOffsetAlignment));
|
||||
std::size_t alignedSpotLightSize = Nz::AlignPow2(spotLightOffsets.GetAlignedSize(), static_cast<std::size_t>(deviceInfo.limits.minUniformBufferOffsetAlignment));
|
||||
|
||||
constexpr std::size_t MaxPointLight = 2000;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ namespace Nz
|
|||
break; // TODO
|
||||
|
||||
case BufferType::Storage:
|
||||
m_bufferAlignedSize = Align(m_bufferAlignedSize, m_renderDevice->GetDeviceInfo().limits.minStorageBufferOffsetAlignment);
|
||||
m_bufferAlignedSize = AlignPow2(m_bufferAlignedSize, m_renderDevice->GetDeviceInfo().limits.minStorageBufferOffsetAlignment);
|
||||
break;
|
||||
|
||||
case BufferType::Uniform:
|
||||
m_bufferAlignedSize = Align(m_bufferAlignedSize, m_renderDevice->GetDeviceInfo().limits.minUniformBufferOffsetAlignment);
|
||||
m_bufferAlignedSize = AlignPow2(m_bufferAlignedSize, m_renderDevice->GetDeviceInfo().limits.minUniformBufferOffsetAlignment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <Nazara/OpenGLRenderer/OpenGLTextureSampler.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Loader.hpp>
|
||||
#include <Nazara/Renderer/CommandPool.hpp>
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
#include <array>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/OpenGLRenderer/Debug.hpp>
|
||||
|
|
@ -91,12 +92,12 @@ namespace Nz
|
|||
|
||||
// Limits
|
||||
m_deviceInfo.limits.maxUniformBufferSize = m_referenceContext->GetInteger<UInt64>(GL_MAX_UNIFORM_BLOCK_SIZE);
|
||||
m_deviceInfo.limits.minUniformBufferOffsetAlignment = m_referenceContext->GetInteger<UInt64>(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT);
|
||||
m_deviceInfo.limits.minUniformBufferOffsetAlignment = RoundToPow2(m_referenceContext->GetInteger<UInt64>(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT));
|
||||
|
||||
if (m_deviceInfo.features.storageBuffers)
|
||||
{
|
||||
m_deviceInfo.limits.maxStorageBufferSize = m_referenceContext->GetInteger<UInt64>(GL_MAX_SHADER_STORAGE_BLOCK_SIZE);
|
||||
m_deviceInfo.limits.minStorageBufferOffsetAlignment = m_referenceContext->GetInteger<UInt64>(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT);
|
||||
m_deviceInfo.limits.minStorageBufferOffsetAlignment = RoundToPow2(m_referenceContext->GetInteger<UInt64>(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT));
|
||||
}
|
||||
|
||||
if (m_deviceInfo.features.computeShaders)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <Nazara/Utility/Utility.hpp>
|
||||
#include <Nazara/VulkanRenderer/Config.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanDevice.hpp>
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
#include <NazaraUtils/CallOnExit.hpp>
|
||||
#include <array>
|
||||
#include <unordered_set>
|
||||
|
|
@ -69,8 +70,8 @@ namespace Nz
|
|||
deviceInfo.limits.maxComputeWorkGroupInvocations = physDevice.properties.limits.maxComputeWorkGroupInvocations;
|
||||
deviceInfo.limits.maxStorageBufferSize = physDevice.properties.limits.maxStorageBufferRange;
|
||||
deviceInfo.limits.maxUniformBufferSize = physDevice.properties.limits.maxUniformBufferRange;
|
||||
deviceInfo.limits.minStorageBufferOffsetAlignment = physDevice.properties.limits.minStorageBufferOffsetAlignment;
|
||||
deviceInfo.limits.minUniformBufferOffsetAlignment = physDevice.properties.limits.minUniformBufferOffsetAlignment;
|
||||
deviceInfo.limits.minStorageBufferOffsetAlignment = RoundToPow2(physDevice.properties.limits.minStorageBufferOffsetAlignment);
|
||||
deviceInfo.limits.minUniformBufferOffsetAlignment = RoundToPow2(physDevice.properties.limits.minUniformBufferOffsetAlignment);
|
||||
|
||||
switch (physDevice.properties.deviceType)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ end
|
|||
|
||||
add_repositories("nazara-engine-repo https://github.com/NazaraEngine/xmake-repo")
|
||||
|
||||
add_requires("entt 3.12.2", "fmt", "frozen", "nazarautils >=2023.08.04")
|
||||
add_requires("entt 3.12.2", "fmt", "frozen", "nazarautils >=2023.08.31")
|
||||
|
||||
-- Module dependencies
|
||||
if has_config("audio") then
|
||||
|
|
|
|||
Loading…
Reference in New Issue