GLSL vertex shader compile crashes when using unsigned array indices.

Originator:webmaster
Number:rdar://12228253 Date Originated:04-Sep-2012 04:30 PM
Status:Open Resolved:
Product:Mac OS X Product Version:10.8.1
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Problem:
Using the OpenGL 3.2 core profile, when compiling a GLSL vertex shader that uses an uint variable as an index into a uniform array, the compiler crashes (and the entire program around it with it).

As an example, consider the following vertex shader:


#version 150

uniform mat4 matrices[25];
uint index1;

void main()
{
	mat4 matrix = matrices[index1];
}


Compiling this shader (in an OpenGL 3.2 Core Profile context) causes a crash in the internal function glpASTNodeGetKind which gets called (through several layers) from glCompileShader.

This does not happen with the following shader:


#version 150

uniform mat4 matrices[25];
int index1;

void main()
{
	mat4 matrix = matrices[index1];
}


The crash does not happen if there are any normal compile errors in the code. E.g.


#version 150

uniform mat4 matrices[25];
uint index1;
#error Test error

void main()
{
	mat4 matrix = matrices[index1];
}


or


#version 150

uniform mat4 matrices[25];
uinttttttt index1;

void main()
{
	mat4 matrix = matrices[index1];
}


both work as expected, i.e. glCompileShader does not crash, the compile status is GL_FALSE and the info log mentions the error; e.g. in the second case:

Could not compile shader. Log: ERROR: 0:3: 'uinttttttt' : syntax error syntax error 

It does not matter whether the index variable is declared as "uniform" or as "in". If an error is someplace else in the shader, it is listed correctly in the log, but the log does not mention that there is anything wrong with using an uint to index into the array. The error also appears when using a component of an uvec4 or similar.


Expected result:
A shader that compiles properly, or at least a clean failure of the shader compile and an info log message that unsigned indices are not supported.


Attachmments:
Attached are a crash log from the project where I first noticed this bug, and a system configuration report from the computer where I noticed the issue.

[No attachments on openradar as far as I can see]

Edit to add: I just saw that Apple has marked this as a duplicate of rdar://11305413 (status: Open), but my bug has not been set to closed yet.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!