I'm having a problem where the value read from gl_TessLevelOuter in my tessellation evaluation shader does not match the value written by my tessellation control shader. If I pass the value as a patch variable (called csStripCount here), the result is correct.
Can anyone else replicate this or am I doing something wrong? See code below, tested on AMD Radeon HD 7770.
Tessellation Control shader
#version 410 core
layout(vertices = 3) out;
patch out float csStripCount;
void main()
{
...
csStripCount = stripCount;
gl_TessLevelOuter[0] = segmentCount;
gl_TessLevelOuter[1] = stripCount;
}
Tesselation Evaluation shader
#version 410 core
layout(isolines) in;
patch in float csStripCount;
void main()
{
//int stripIndex = int(gl_TessCoord.y * gl_TessLevelOuter[1]); // incorrect result
int stripIndex = int(gl_TessCoord.y * csStripCount); // correct result
vec3 interpolationWeights = barycentricSamples[stripIndex];
...
}