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

Shader validation seems to erroneously decide the geometry shader is writing to PointSize #321

Closed
bpeel opened this issue Sep 10, 2018 · 0 comments
Assignees
Labels
Bug Something isn't working
Milestone

Comments

@bpeel
Copy link

bpeel commented Sep 10, 2018

If I compile this simple geometry shader with glslang and pass it through the validation layer it reports an error about writing to PointSize and not enabling shaderTessellationAndGeometryPointSize.

#version 450

layout(points) in;
layout(triangle_strip, max_vertices = 4) out;

void
main()
{
        for (int y = -1; y <= 1; y += 2) {
                for (int x = -1; x <= 1; x += 2) {
                        gl_Position = vec4(gl_in[0].gl_Position.xy + vec2(x, y),
                                           0.0,
                                           1.0);
                        EmitVertex();
                }
        }
        EndPrimitive();
}

The shader clearly isn’t using gl_PointSize at all. glslang seems to declare two structs with point size members anyway. The first is used for the output and the second is used for gl_in. I think there is something going wrong with this line in shader_validation.cpp:

bool found_write = !init_complete && (type == spv::OpMemberDecorate);

init_complete ends up being false for gl_in because there is no variable that writes to it.

If I remove the part that reads from gl_in then glslang no longer adds a declaration for its type and the validation error disappears.

This can be seen with the geometry.shader_test example in VkRunner with a command like this:

VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_standard_validation \
./src/vkrunner examples/geometry.shader_test
@mark-lunarg mark-lunarg self-assigned this Sep 10, 2018
@mark-lunarg mark-lunarg added the Bug Something isn't working label Sep 10, 2018
@mark-lunarg mark-lunarg added this to the P1 milestone Sep 10, 2018
@shannon-lunarg shannon-lunarg modified the milestones: P1, sdk-1.1.temp.0 Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants