Created attachment 143227 [details]
apitrace of example program
Originally reported as a Blender bug: https://developer.blender.org/T60762
(which it is not)
Using desktop GL 3.3+.
Steps to reproduce:
* prepare a vertex and index buffer
* enable GL_PRIMITIVE_RESTART
* draw a GL_TRIANGLE_FAN using those buffers
* draw any number of GL_LINE_STRIPs with those same buffers
Drawing a GL_TRIANGLE_FAN prior to GL_LINE_STRIPs makes the strip draw calls fail to use restart markers (here, 0xFF), resulting in the line strips' supposedly unconnected strips being connected through a point of invalid coordinates (observed to consistently be (0, 0, 0)).
IOW, restart markers seems to be (re-)considered as normal indices.
Interfering with GL calls that read or write to the index buffer makes the problem go away, hinting at a GL state tracking or cache issue.
Created attachment 143228 [details]
test program source code
Hi Dorian. Thanks for the report.
I reproduced issue using provided app.
Ivi bridge - reproduced on 11.0.0, 17.0.0, 18.3.0, 18.3.2, 19.0.0 git latest
But didn't reproduce on KBL with 18.1.5
I managed to reproduce this issue on SNB using the latest git mesa.
I am going to continue my investigation)
I found out the root cause of the issue. Unfortunately the issue is in mesa. I have been working on a mesa patch and a piglit test for this issue.
Created attachment 143256 [details] [review]
Mesa patch v1
Could you please check this mesa patch with this issue if it is possible and confirm if it helps you.
I reproduce this issue on KBL using the following test:
The solution was suggested:
Fixed with :
commit f4f4ec941e1427142656e588244f378e469e996e (HEAD -> master, origin/master)
Author: Andrii Simiklit <firstname.lastname@example.org>
Date: Fri Jan 25 15:03:07 2019 +0200
i965: re-emit index buffer state on a reset option change.
Seems like we forget to update the index buffer (ib) status and
IndexedDrawCutIndexEnable or CutIndexEnable flag is left unchanged it
leads to ignoring of glEnable/glDisable functions for GL_PRIMITIVE_RESTART
in some cases. The index buffer (ib) status should be re-emmited after the
reset option change to avoid some unexpected behavior.
Reviewed-by: Lionel Landwerlin <email@example.com>
Signed-off-by: Andrii Simiklit <firstname.lastname@example.org>
Signed-off-by: Andrii Simiklit <email@example.com>