- it looks like glProgramUniform is not working correctly with Intel drivers, so better forget about it for setting the view and projection matrices. Even on NVidia the time difference can only be measured in microseconds per frame so it's not a big loss.

This commit is contained in:
Christoph Oelckers 2014-08-02 11:57:42 +02:00
parent a8e9c1832f
commit b2860a1d63
3 changed files with 4 additions and 16 deletions

View file

@ -298,20 +298,11 @@ FShader *FShaderManager::Compile (const char *ShaderName, const char *ShaderPath
//========================================================================== //==========================================================================
void FShader::ApplyMatrices(VSMatrix *proj, VSMatrix *view) void FShader::ApplyMatrices(VSMatrix *proj, VSMatrix *view)
{
if (gl.flags & RFL_SEPARATE_SHADER_OBJECTS) // this check is just for safety. All supported hardware reports this extension as being present.
{
glProgramUniformMatrix4fv(hShader, projectionmatrix_index, 1, false, proj->get());
glProgramUniformMatrix4fv(hShader, viewmatrix_index, 1, false, view->get());
}
else
{ {
Bind(); Bind();
glUniformMatrix4fv(projectionmatrix_index, 1, false, proj->get()); glUniformMatrix4fv(projectionmatrix_index, 1, false, proj->get());
glUniformMatrix4fv(viewmatrix_index, 1, false, view->get()); glUniformMatrix4fv(viewmatrix_index, 1, false, view->get());
} }
}
//========================================================================== //==========================================================================

View file

@ -131,7 +131,6 @@ void gl_LoadExtensions()
if (CheckExtension("GL_ARB_texture_compression")) gl.flags|=RFL_TEXTURE_COMPRESSION; if (CheckExtension("GL_ARB_texture_compression")) gl.flags|=RFL_TEXTURE_COMPRESSION;
if (CheckExtension("GL_EXT_texture_compression_s3tc")) gl.flags|=RFL_TEXTURE_COMPRESSION_S3TC; if (CheckExtension("GL_EXT_texture_compression_s3tc")) gl.flags|=RFL_TEXTURE_COMPRESSION_S3TC;
if (CheckExtension("GL_ARB_shader_storage_buffer_object")) gl.flags |= RFL_SHADER_STORAGE_BUFFER; if (CheckExtension("GL_ARB_shader_storage_buffer_object")) gl.flags |= RFL_SHADER_STORAGE_BUFFER;
if (CheckExtension("GL_ARB_separate_shader_objects")) gl.flags |= RFL_SEPARATE_SHADER_OBJECTS;
glGetIntegerv(GL_MAX_TEXTURE_SIZE,&gl.max_texturesize); glGetIntegerv(GL_MAX_TEXTURE_SIZE,&gl.max_texturesize);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

View file

@ -9,9 +9,7 @@ enum RenderFlags
RFL_TEXTURE_COMPRESSION=1, RFL_TEXTURE_COMPRESSION=1,
RFL_TEXTURE_COMPRESSION_S3TC=2, RFL_TEXTURE_COMPRESSION_S3TC=2,
RFL_SEPARATE_SHADER_OBJECTS = 4, // we need this extension for glProgramUniform. On hardware not supporting it we need some rather clumsy workarounds RFL_SHADER_STORAGE_BUFFER = 4, // to be used later for a parameter buffer
RFL_SHADER_STORAGE_BUFFER = 16, // to be used later for a parameter buffer
RFL_BASEINDEX = 32, // currently unused
}; };
enum TexMode enum TexMode