Skip to content

Commit be42dff

Browse files
committed
Minor fixes
1 parent a8c27e4 commit be42dff

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/engine/renderer/gl_shader.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,15 +2094,11 @@ GLint GLShader::GetUniformLocation( const GLchar *uniformName ) const {
20942094

20952095
static int FindUniformForAlignment( std::vector<GLUniform*>& uniforms, const GLuint alignment ) {
20962096
for ( uint32_t i = 0; i < uniforms.size(); i++ ) {
2097-
if ( uniforms[i]->GetSTD430Size() == alignment ) {
2097+
if ( uniforms[i]->GetSTD430Size() <= alignment ) {
20982098
return i;
20992099
}
21002100
}
21012101

2102-
if ( uniforms[uniforms.size() - 1]->GetSTD430Size() < alignment ) {
2103-
return uniforms.size() - 1;
2104-
}
2105-
21062102
return -1;
21072103
}
21082104

@@ -2131,7 +2127,7 @@ void GLShader::PostProcessUniforms() {
21312127
// Higher-alignment uniforms first to avoid wasting memory
21322128
GLuint size = _materialSystemUniforms[0]->GetSTD430Size();
21332129
GLuint components = _materialSystemUniforms[0]->GetComponentSize();
2134-
size = components ? 4 * components : size;
2130+
size = components ? PAD( size, 4 ) * components : size;
21352131
GLuint alignmentConsume = 4 - size % 4;
21362132

21372133
tmp.emplace_back( _materialSystemUniforms[0] );

0 commit comments

Comments
 (0)