Bug 106411

Summary: Invalid gl_InstanceID value with combination of gl_DrawIDARB under OpenGL
Product: Mesa Reporter: Alexander <frustumo>
Component: glsl-compilerAssignee: mesa-dev
Status: RESOLVED WONTFIX QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: 18.0   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: app

Description Alexander 2018-05-05 18:39:01 UTC
Created attachment 139374 [details]
app

The value of gl_InstanceID variable is incorrect when shader has gl_DrawIDARB.
Inserting additional dependency on gl_VertexID or gl_BaseInstanceARB variable
restores gl_InstanceID value.

Uncomment 17 line inside main_vertex.glsl file to fix gl_InstanceID:
// position.x += gl_VertexID * 1e-6f;

There is no such problem under Vulkan API.

Mesa DRI Intel(R) Iris Pro Graphics 580 (Skylake GT4e) 
4.5 (Core Profile) Mesa 18.0.0-rc4
Comment 1 Tapani Pälli 2018-07-25 10:32:58 UTC
I've tried your example app with current Mesa (b3b170ade9) and for me the end result visually is the same whether or not I comment out line that adds gl_VertexID usage. Could you comment on what is the expected result with/without the line and maybe also retry test with current Mesa?
Comment 2 Alexander 2018-07-25 13:51:26 UTC
I'm still on Ubuntu 16.04 and the latest available Mesa version is 18.0.5 (from x-swat). I have main_instance_draw.png without dependency on gl_VertexID. With artificial dependency rendering is correct (main_instance_draw_vertex.png). I will try to upgrade Mesa on 18.1.* branch in few days.
Comment 3 Alexander 2018-07-29 17:51:49 UTC
I have no reproduction on Mesa 18.1.3. So the bug is related to Mesa 18.0.* only.
Comment 4 Lionel Landwerlin 2018-07-29 20:41:49 UTC
Could this be related to https://bugs.freedesktop.org/show_bug.cgi?id=102678 ?
Comment 5 Dylan Baker 2018-08-15 21:37:46 UTC
This bug cannot be reproduced on a supported version of mesa, closing.

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.