I case there is no geometry shader attached to program, gl_PrimitiveID is always zero.
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?
Alright, I can create 3 geometry shaders for all primitives, but I am not sure if that is the right way for mesa. Thanks
Just to be clear, I'm talking about doing this transparently in the driver, not in the application.
I do not have radeonsi supported device. How does Intel driver support this? I think this is really useful for picking algorithm.
(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.
The hw GS mode A should be able to do this, which is basically a VS which gets PrimitiveID on the input.
FYI I've posted patches to mesa-dev to address this for evergreen and later.
fix for this pushed to mesa master
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.