- do not use SSBOs for dynamic lights on Intel graphics hardware for performance reasons.

This was already disabled for GL 4.4 and lower but also needs to be done for Intel's GL 4.5 drivers.
Unlike before this is now exclusive to the light buffer, the shadowmap feature is not affected anymore, although that should be impossible to use anyway on all affected hardware due to lack of computing power.
This commit is contained in:
Christoph Oelckers 2018-07-28 12:43:35 +02:00
commit 9768698eda
3 changed files with 23 additions and 23 deletions

View file

@ -39,7 +39,10 @@ FLightBuffer::FLightBuffer()
mBufferSize = INITIAL_BUFFER_SIZE;
mByteSize = mBufferSize * sizeof(float);
if (gl.flags & RFL_SHADER_STORAGE_BUFFER)
// Hack alert: On Intel's GL driver SSBO's perform quite worse than UBOs.
// We only want to disable using SSBOs for lights but not disable the feature entirely.
// Note that using an uniform buffer here will limit the number of lights per surface so it isn't done for NVidia and AMD.
if (gl.flags & RFL_SHADER_STORAGE_BUFFER && !strstr(gl.vendorstring, "Intel"))
{
mBufferType = GL_SHADER_STORAGE_BUFFER;
mBlockAlign = 0;
@ -50,6 +53,7 @@ FLightBuffer::FLightBuffer()
mBufferType = GL_UNIFORM_BUFFER;
mBlockSize = gl.maxuniformblock / 16;
if (mBlockSize > 2048) mBlockSize = 2048; // we don't really need a larger buffer
mBlockAlign = mBlockSize / 2;
}

View file

@ -365,7 +365,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
clipheightdirection_index = glGetUniformLocation(hShader, "uClipHeightDirection");
clipline_index = glGetUniformLocation(hShader, "uClipLine");
if (!(gl.flags & RFL_SHADER_STORAGE_BUFFER))
if (lightbuffertype == GL_UNIFORM_BUFFER)
{
int tempindex = glGetUniformBlockIndex(hShader, "LightBufferUBO");
if (tempindex != -1) glUniformBlockBinding(hShader, tempindex, LIGHTBUF_BINDINGPOINT);