set hint GL_STREAM_READ

it's wrong, but so we are guaranteed to get pinned memory.
it's slower for rendering, but faster for mapping.
This commit is contained in:
degasus
2013-01-28 13:03:31 +01:00
parent 4fadb65259
commit fd06342a97
2 changed files with 8 additions and 8 deletions

View File

@ -197,7 +197,7 @@ void ProgramShaderCache::UploadConstants()
{
if(s_ubo_dirty) {
if(s_ubo_iterator + s_ubo_buffer_size >= UBO_LENGTH) {
glBufferData(GL_UNIFORM_BUFFER, UBO_LENGTH, NULL, GL_STREAM_DRAW);
glBufferData(GL_UNIFORM_BUFFER, UBO_LENGTH, NULL, GL_STREAM_READ);
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);
@ -242,7 +242,7 @@ void ProgramShaderCache::Init(void)
// Then once more to get bytes
glGenBuffers(1, &s_ps_vs_ubo);
glBindBuffer(GL_UNIFORM_BUFFER, s_ps_vs_ubo);
glBufferData(GL_UNIFORM_BUFFER, UBO_LENGTH, NULL, GL_STREAM_DRAW);
glBufferData(GL_UNIFORM_BUFFER, UBO_LENGTH, NULL, GL_STREAM_READ);
s_ubo_iterator = 0;
s_ubo_buffer = new float[s_ubo_buffer_size/sizeof(float)];