Skip to content

Commit

Permalink
stripped the trailing "[0]" in uniform array name.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsebbe committed Aug 8, 2015
1 parent 2db12c8 commit 8c46d9a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/GLProgram.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,15 @@ - (BOOL)link:(NSError**)error
if(unamesize > 0)
{
loc = glGetUniformLocation(mHandle, uname);
[mUniformLookup setObject:[NSNumber numberWithInt:loc] forKey:[NSString stringWithCString:uname encoding:NSUTF8StringEncoding]];
NSString *uniformName = [NSString stringWithCString:uname encoding:NSUTF8StringEncoding];
if([uniformName hasSuffix:@"[0]"]) {
uniformName = [uniformName substringToIndex:uniformName.length-3];
}

if([uniformName containsString:@"[0]"])
GL_EXCEPT(YES, @"Uniforms with arrays of arrays are not supported");

[mUniformLookup setObject:[NSNumber numberWithInt:loc] forKey:uniformName];
}
}
//GLLog(@"Uniforms in program %d: %@", mHandle, mUniformLookup);
Expand Down

0 comments on commit 8c46d9a

Please sign in to comment.