Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only declare compatibility gl_ variables in compatibility mode #2664

Merged
merged 1 commit into from
Jun 17, 2021

Conversation

mbechard
Copy link
Contributor

@mbechard mbechard commented Jun 11, 2021

avoid declaring them in GLSL 1.50+ if core profile is chosen by the version statement

fixes #2663

It seems like the ARBCompatibility variable is meant to act as if the hosting GL context was created with WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB. However I think this should only be inherited into the GLSL compiler for GLSL 1.40. 1.50+ should use what is declared by the #version statement.

For the test cases that were changed, here are my thoughts:

430scope.vert
cppSimple.vert
link.multiAnonBlocksInvalid.0.0.vert
link.multiAnonBlocksValid.0.0.vert
link.multiBlocksInvalid.0.0.vert
link.multiBlocksValid.1.0.vert
versionsErrors.vert:
New output seems correct, the variables are just no longer declared:

150.vert:
core profile - gl_ClipVertex shouldn't be declared, new error is correct.

150.frag:
not sure why we lost an error message here, seem like the extra error was superfluous anyways.

400.frag:
core profile - gl_Color shouldn't even exist, previous redeclaration error makes no sense.

450.vert:
not sure about this one.

specExamples.frag:
specExamples.vert:
I don't see why was these were considered valid code. They are both core profile, so using the deprecated variables should have been an error.

avoid declaring them in GLSL 1.50+ if core profile is chosen by the
version statement

fixes KhronosGroup#2663
@greg-lunarg greg-lunarg added the kokoro:run Trigger Google bot runs label Jun 17, 2021
@kokoro-team kokoro-team removed the kokoro:run Trigger Google bot runs label Jun 17, 2021
@greg-lunarg
Copy link
Contributor

Thanks. I will take a look.

@greg-lunarg
Copy link
Contributor

I am still seeing the problem :(

$ glslangValidator.exe -l t.vert t.geom
t.vert
t.geom
ERROR: Linking vertex stage: Types must match:
anon@0: " out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}" versus gl_in: " in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}"

$ cat t.vert
#version 150 core

in vec3 vertexPosition;

out VertexData {
vec3 position;
} vs_out;

uniform mat4 mvp;

void main(void)
{
vs_out.position = vertexPosition;

gl_Position = mvp * vec4(vertexPosition, 1.0);

}

$ cat t.geom
#version 150 core

layout(triangles) in;
layout(line_strip, max_vertices = 4 /* 2 lines = 4 vertices */) out;

in VertexData {
vec3 position;
} gs_in[];

void drawLine(vec4 a, vec4 b)
{
gl_Position = a;
EmitVertex();

gl_Position = b;
EmitVertex();

EndPrimitive();

}

void main()
{
// This GS takes all three sides of a rectangle, but only emits vertices for
// its catheti, which gives us a nice wireframe.

vec3 aSide = (gs_in[0].position - gs_in[1].position);
vec3 bSide = (gs_in[0].position - gs_in[2].position);
vec3 cSide = (gs_in[1].position - gs_in[2].position);

if (dot(aSide, bSide) == 0) {
    drawLine(gl_in[0].gl_Position, gl_in[1].gl_Position);
    drawLine(gl_in[0].gl_Position, gl_in[2].gl_Position);
} else if (dot(aSide, cSide) == 0) {
    drawLine(gl_in[0].gl_Position, gl_in[1].gl_Position);
    drawLine(gl_in[1].gl_Position, gl_in[2].gl_Position);
} else if (dot(bSide, cSide) == 0) {
    drawLine(gl_in[0].gl_Position, gl_in[2].gl_Position);
    drawLine(gl_in[1].gl_Position, gl_in[2].gl_Position);
}

}

Do you see this as well?

@mbechard
Copy link
Contributor Author

mbechard commented Jun 17, 2021

Hmm, no I don't. The widget_wireframe.vert and .geom compile fine for me.

@greg-lunarg
Copy link
Contributor

Sorry for the thrash. It looks like a git glitch. Its working for me now.

@greg-lunarg greg-lunarg merged commit e74b35f into KhronosGroup:master Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect gl_PerVertex Linking Errors Reported
3 participants