summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2016-11-27 11:56:22 +0100
committerLéo Lam <leo@innovatetechnologi.es>2016-12-06 20:33:53 +0100
commit31ccfffd386cdf7bfafdccda240a179431ecc98c (patch)
tree820bdb640091e5726e4c52d42f819956f82bfd28 /Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
parent7192789c1162e2deb5923151d05158f459448ab9 (diff)
Common: Add alignment header
Gets rid of duplicated alignment code.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
index 66952ed976..44bf063a8a 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
@@ -5,8 +5,8 @@
#include <memory>
#include <string>
+#include "Common/Align.h"
#include "Common/Common.h"
-#include "Common/MathUtil.h"
#include "Common/StringUtil.h"
#include "Core/ConfigManager.h"
@@ -148,22 +148,22 @@ void ProgramShaderCache::UploadConstants()
memcpy(buffer.first, &PixelShaderManager::constants, sizeof(PixelShaderConstants));
- memcpy(buffer.first + ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align),
+ memcpy(buffer.first + Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align),
&VertexShaderManager::constants, sizeof(VertexShaderConstants));
- memcpy(buffer.first + ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align) +
- ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align),
+ memcpy(buffer.first + Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align) +
+ Common::AlignUp(sizeof(VertexShaderConstants), s_ubo_align),
&GeometryShaderManager::constants, sizeof(GeometryShaderConstants));
s_buffer->Unmap(s_ubo_buffer_size);
glBindBufferRange(GL_UNIFORM_BUFFER, 1, s_buffer->m_buffer, buffer.second,
sizeof(PixelShaderConstants));
glBindBufferRange(GL_UNIFORM_BUFFER, 2, s_buffer->m_buffer,
- buffer.second + ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align),
+ buffer.second + Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align),
sizeof(VertexShaderConstants));
glBindBufferRange(GL_UNIFORM_BUFFER, 3, s_buffer->m_buffer,
- buffer.second + ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align) +
- ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align),
+ buffer.second + Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align) +
+ Common::AlignUp(sizeof(VertexShaderConstants), s_ubo_align),
sizeof(GeometryShaderConstants));
PixelShaderManager::dirty = false;
@@ -407,9 +407,10 @@ void ProgramShaderCache::Init()
// then the UBO will fail.
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &s_ubo_align);
- s_ubo_buffer_size = ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align) +
- ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align) +
- ROUND_UP(sizeof(GeometryShaderConstants), s_ubo_align);
+ s_ubo_buffer_size =
+ static_cast<u32>(Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align) +
+ Common::AlignUp(sizeof(VertexShaderConstants), s_ubo_align) +
+ Common::AlignUp(sizeof(GeometryShaderConstants), s_ubo_align));
// We multiply by *4*4 because we need to get down to basic machine units.
// So multiply by four to get how many floats we have from vec4s