From 4a463f4588e2968c499236458c5712a489622633 Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 31 Jan 2013 13:00:15 +0100 Subject: [PATCH] also add glBufferSubData for ubo upload so osx start game, but everything is black --- Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp index 76bf1e7e81..552a08f961 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp @@ -212,8 +212,12 @@ void ProgramShaderCache::UploadConstants() s_ubo_iterator = 0; } void *ubo = glMapBufferRange(GL_UNIFORM_BUFFER, s_ubo_iterator, s_ubo_buffer_size, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_RANGE_BIT); - memcpy(ubo, s_ubo_buffer, s_ubo_buffer_size); - glUnmapBuffer(GL_UNIFORM_BUFFER); + if(ubo) { + memcpy(ubo, s_ubo_buffer, s_ubo_buffer_size); + glUnmapBuffer(GL_UNIFORM_BUFFER); + } else { + glBufferSubData(GL_UNIFORM_BUFFER, s_ubo_iterator, s_ubo_buffer_size, s_ubo_buffer); + } glBindBufferRange(GL_UNIFORM_BUFFER, 1, s_ps_vs_ubo, s_ubo_iterator, s_vs_data_offset); glBindBufferRange(GL_UNIFORM_BUFFER, 2, s_ps_vs_ubo, s_ubo_iterator + s_vs_data_offset, s_ubo_buffer_size - s_vs_data_offset);