Bug 78951 - gl_PrimitiveID is zero if no geometry shader is present
Summary: gl_PrimitiveID is zero if no geometry shader is present
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: git
Hardware: Other All
: highest normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-20 08:15 UTC by pavol
Modified: 2015-01-29 08:35 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description pavol 2014-05-20 08:15:35 UTC
I case there is no geometry shader attached to program, gl_PrimitiveID is always zero.
Comment 1 Michel Dänzer 2014-05-20 09:33:14 UTC
AFAICT the hardware doesn't provide any way to retrieve the primitive ID without a geometry shader, so we'd probably need to use a passthrough geometry shader for this. Any volunteers?
Comment 2 pavol 2014-05-20 10:32:21 UTC
Alright, I can create 3 geometry shaders for all primitives, but I am not sure if that is the right way for mesa. Thanks
Comment 3 Michel Dänzer 2014-05-27 06:16:52 UTC
Just to be clear, I'm talking about doing this transparently in the driver, not in the application.
Comment 4 pavol 2014-12-12 22:13:56 UTC
I do not have radeonsi supported device. How does Intel driver support this? I think this is really useful for picking algorithm.
Comment 5 Ian Romanick 2014-12-13 00:08:48 UTC
(In reply to pavol from comment #4)
> I do not have radeonsi supported device. How does Intel driver support this?
> I think this is really useful for picking algorithm.

The piglit test tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test is for this very case.  That test passes at least on my Ivybridge.  I don't know what we do in the driver to make this work... or if the hardware just sorts it out.
Comment 6 Marek Olšák 2014-12-17 10:32:03 UTC
The hw GS mode A should be able to do this, which is basically a VS which gets PrimitiveID on the input.
Comment 7 Dave Airlie 2015-01-27 03:53:16 UTC
FYI I've posted patches to mesa-dev to address this for evergreen and later.
Comment 8 Dave Airlie 2015-01-28 00:54:31 UTC
fix for this pushed to mesa master
Comment 9 pavol 2015-01-29 08:35:05 UTC
Thank you, it works great.


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.