Bug 96354 - [i965] GS instancing (gl_InvocationID) reads garbage instead of what the vertex shader says
Summary: [i965] GS instancing (gl_InvocationID) reads garbage instead of what the vert...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-03 04:28 UTC by Ben Russell
Modified: 2018-06-27 03:19 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Point-to-cube geometry shader with toggleable GS instancing (1.43 KB, text/plain)
2016-06-03 04:28 UTC, Ben Russell
Details
Results on Mesa 18.2.0 (Intel) (7.21 KB, image/png)
2018-06-04 11:21 UTC, asimiklit
Details
Results on Mesa 12.1.0-devel (git-d10ae20) (3.16 KB, image/png)
2018-06-04 11:26 UTC, asimiklit
Details
Results on Mesa 17.2.8 (Radeon) (7.15 KB, image/png)
2018-06-04 11:28 UTC, asimiklit
Details
The shader_test to reproduce the issue (3.35 KB, text/plain)
2018-06-04 11:30 UTC, asimiklit
Details

Description Ben Russell 2016-06-03 04:28:34 UTC
Created attachment 124298 [details]
Point-to-cube geometry shader with toggleable GS instancing

Overview:

  If GLSL 4.00 GS instancing is enabled via the `layout(invocations = x) in;` layout specifier (where x > 1), the GS no longer reads valid data from the vertex shader.

Steps to Reproduce:

  You will need a GPU which currently supports GLSL 4.00. This is currently restricted to gen8+.

  1) Find a geometry shader you can change.
  2) Ensure the #version directive is 400 or higher - if not, bump it up to 400.
  3) Add this line near the top of it:

    layout(invocations = 2) in;

  4) Observe that the geometry is now garbage or apparently missing (degenerate / culled primitives).

  Attached is a geometry shader with toggleable GS instancing. It requires GL_POINTS as input.

  vec3 v_vtx[], v_col[] are vertex and colour attribute data respectively.
  mat4 Mproj, Mcam are projection and modelview matrices respectively.
  vec3 campos is the position of the camera in the world.

Expected Results:

  For the given shader, input points should be expanded to cubes of their respective colours.

Actual Results:

  A single black cube appears at (0, 0, 0).

  In some frames you may see intermittent garbage - this is noticeable at ~3000FPS with vsync disabled.

  The uniform data is being read correctly, but the VS input data is completely wrong.

Additional Information:

  Build Date: 2016-06-03 ~15:30 +1200
  Git Revision: d10ae20b9678f1a5b8a81716c68e612662665277
  GPU: Intel HD 530 (Skylake GT2)
  OS: Void Linux

  This bug may be relevant (#93859) - the output is SIMD8: https://bugs.freedesktop.org/show_bug.cgi?id=93859
Comment 1 asimiklit 2018-05-31 08:23:31 UTC
Could you please provide also an application and the vertex/fragment shaders which helped you to reproduce this issue? It would be very helpful and could expedite the issue solving.
Comment 2 asimiklit 2018-06-04 11:21:15 UTC
Created attachment 140004 [details]
Results on Mesa 18.2.0 (Intel)
Comment 3 asimiklit 2018-06-04 11:26:56 UTC
Created attachment 140005 [details]
Results on  Mesa 12.1.0-devel (git-d10ae20)
Comment 4 asimiklit 2018-06-04 11:28:49 UTC
Created attachment 140006 [details]
Results on Mesa 17.2.8 (Radeon)
Comment 5 asimiklit 2018-06-04 11:30:17 UTC
Created attachment 140007 [details]
The shader_test to reproduce the issue
Comment 6 asimiklit 2018-06-04 11:40:48 UTC
I managed to reproduce this issue using geometry-point-to-cube-using-instancing.shader_test on Mesa 12.1.0 from revision d10ae20b9678f1a5b8a81716c68e612662665277.

Note: To reproduce this issue you should press 'space' key (actually any key except 'escape') once or more times on the shader_runner screen and after that single black cube should appear in the center of the screen:

But I could not reproduce this issue on Mesa 13.1.0 and Mesa 18.2.0. So I think that this issue was fixed at least in Mesa 13.1.0 or in earlier version.
Comment 7 Timothy Arceri 2018-06-27 03:19:48 UTC
Should be covered by new piglit test. Closing.

commit ad2158276164e40f52e8a8656256c1e03ac304f3
Author: Andrii Simiklit <asimiklit.work@gmail.com>
Date:   Tue Jun 5 16:33:00 2018 +0300

    arb_gpu_shader5: Add a test for instanced GS inputs.
    
    None of our other tests for instanced geometry shaders transfered
    the vertices to the geometry shader from the vertex shader via
    gl_Position.
    
    This used to be broken with the i965 driver's in Mesa 12.1.0
    on revision d10ae20b9678f1a5b8a81716c68e612662665277.
    
    Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
    Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96354


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.