diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp index c62016a853..d66fd9ec19 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp @@ -16,6 +16,8 @@ // http://code.google.com/p/dolphin-emu/ #include "ProgramShaderCache.h" +#include "MathUtil.h" + #include namespace OGL { @@ -176,14 +178,14 @@ namespace OGL // 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 // Then once more to get bytes - glBufferData(GL_UNIFORM_BUFFER, (C_PENVCONST_END * 4 * 4) - (C_PENVCONST_END * 4 * 4 % Align) + Align, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_UNIFORM_BUFFER, ROUND_UP(C_PENVCONST_END * 4 * 4, Align), NULL, GL_DYNAMIC_DRAW); // Now bind the buffer to the index point // We know PS is 0 since we have it statically set in the shader glBindBufferBase(GL_UNIFORM_BUFFER, 1, UBOBuffers[0]); // Repeat for VS shader glBindBuffer(GL_UNIFORM_BUFFER, UBOBuffers[1]); - glBufferData(GL_UNIFORM_BUFFER, (C_VENVCONST_END * 4 * 4) - (C_VENVCONST_END * 4 * 4 % Align) + Align, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_UNIFORM_BUFFER, ROUND_UP(C_VENVCONST_END * 4 * 4, Align), NULL, GL_DYNAMIC_DRAW); glBindBufferBase(GL_UNIFORM_BUFFER, 2, UBOBuffers[1]); } void ProgramShaderCache::Shutdown(void)