- fixed: The dynamic light buffer's behavior needs to obey the gl.lightmethod variable, and not depend on presence of persistently mapped buffers.

Since there is a command line switch to revert to the lower behavior it can well be that they do not match.
This commit is contained in:
Christoph Oelckers 2016-08-04 12:55:21 +02:00
parent 7ba6269450
commit 63ad7d99d1
1 changed files with 4 additions and 4 deletions

View File

@ -71,7 +71,7 @@ FLightBuffer::FLightBuffer()
glGenBuffers(1, &mBufferId);
glBindBufferBase(mBufferType, LIGHTBUF_BINDINGPOINT, mBufferId);
glBindBuffer(mBufferType, mBufferId); // Note: Some older AMD drivers don't do that in glBindBufferBase, as they should.
if (gl.flags & RFL_BUFFER_STORAGE)
if (gl.lightmethod == LM_DIRECT)
{
glBufferStorage(mBufferType, mByteSize, NULL, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
mBufferPointer = (float*)glMapBufferRange(mBufferType, 0, mByteSize, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
@ -151,7 +151,7 @@ int FLightBuffer::UploadLights(FDynLightData &data)
// create the new buffer's storage (twice as large as the old one)
mBufferSize *= 2;
mByteSize *= 2;
if (gl.flags & RFL_BUFFER_STORAGE)
if (gl.lightmethod == LM_DIRECT)
{
glBufferStorage(mBufferType, mByteSize, NULL, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
mBufferPointer = (float*)glMapBufferRange(mBufferType, 0, mByteSize, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
@ -190,7 +190,7 @@ int FLightBuffer::UploadLights(FDynLightData &data)
void FLightBuffer::Begin()
{
if (!(gl.flags & RFL_BUFFER_STORAGE))
if (gl.lightmethod == LM_DEFERRED)
{
glBindBuffer(mBufferType, mBufferId);
mBufferPointer = (float*)glMapBufferRange(mBufferType, 0, mByteSize, GL_MAP_WRITE_BIT);
@ -199,7 +199,7 @@ void FLightBuffer::Begin()
void FLightBuffer::Finish()
{
if (!(gl.flags & RFL_BUFFER_STORAGE))
if (gl.lightmethod == LM_DEFERRED)
{
glBindBuffer(mBufferType, mBufferId);
glUnmapBuffer(mBufferType);