Bug 99144 - Incorrect rendering using glDrawArraysInstancedBaseInstance and first != 0 on Skylake
Summary: Incorrect rendering using glDrawArraysInstancedBaseInstance and first != 0 on...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Kenneth Graunke
QA Contact: Intel 3D Bugs Mailing List
Depends on:
Reported: 2016-12-19 14:29 UTC by Pierre-Eric Pelloux-Prayer
Modified: 2016-12-21 04:57 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

simple test case (7.75 KB, application/zip)
2016-12-19 14:29 UTC, Pierre-Eric Pelloux-Prayer
expected result (10.74 KB, image/jpeg)
2016-12-19 14:30 UTC, Pierre-Eric Pelloux-Prayer
result on skylake (23.95 KB, image/jpeg)
2016-12-19 14:32 UTC, Pierre-Eric Pelloux-Prayer
hackpatch (634 bytes, patch)
2016-12-19 17:48 UTC, Ilia Mirkin
Details | Splinter Review

Description Pierre-Eric Pelloux-Prayer 2016-12-19 14:29:42 UTC
Created attachment 128549 [details]
simple test case

The attached program produces different incorrect result on Intel Skylake (using Mesa 13.0.2 or master).

Modifying the vertex shader to use: "3 + gl_VertexID" is enough to get the expected behavior.
Comment 1 Pierre-Eric Pelloux-Prayer 2016-12-19 14:30:33 UTC
Created attachment 128550 [details]
expected result

Output using: nouveau, r600 and intel haswell
Comment 2 Pierre-Eric Pelloux-Prayer 2016-12-19 14:32:13 UTC
Created attachment 128551 [details]
result on skylake


00:02.0 VGA compatible controller: Intel Corporation Sky Lake Integrated Graphics (rev 07)
Comment 3 Ilia Mirkin 2016-12-19 14:47:57 UTC
In case it's not obvious, the issue is that gl_VertexID does not appear to get the proper base offset. There are tests for this in piglit, which presumably don't fail on SKL. So it means that this test is doing something odd -- one thing is that it doesn't have a VBO. Although I thought there were piglit tests for that too.
Comment 4 Ilia Mirkin 2016-12-19 17:48:12 UTC
Created attachment 128562 [details] [review]

The attached hack-patch "fixes" it. I guess the condition in question needs to look at the nr_buffers as set a few lines below, not the vb.nr_enabled ones. As I don't have full visibility of the programming model, I'll let someone else sort out the precise way this needs to be resolved.
Comment 5 Kenneth Graunke 2016-12-19 19:30:27 UTC
Thanks for the report and simple test!  Here's a patch to fix the issue:

Would you be willing to contribute a Piglit test which reproduces this bug?  It should be pretty straightforward to port your existing sample code from SDL to the Piglit framework.  Doing that means that we'll regression test this on all drivers in the future, meaning it's more likely to not break in the future.

Thanks again!
Comment 6 Kenneth Graunke 2016-12-21 04:57:26 UTC
Fixed in Mesa master by:

commit 8fc5443a2b39aaa8292984f7225a2c7968d568ae
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Dec 19 11:21:27 2016 -0800

    i965: Don't bail on vertex element processing if we need draw params

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.