Jump to content
  • Advertisement
Sign in to follow this  
AvengerDr

[HLSL] Primitive index inside a pixel shader?

This topic is 2472 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, is it possible to know to which triangle/vertex/primitive belongs the pixel currently being computed inside a pixel shader? I think it was not possible to do this under SM2.0 but I am not aware of the latest developments.
Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
You can [font="Arial"]use the [color="#2A2A2A"]SV_PrimitiveID and [color="#2A2A2A"]SV_VertexID semantics to get these infos.[/font]

Share this post


Link to post
Share on other sites
You can only do it in SM4.0 or higher. You could stuff a vertex ID in your vertices, but that won't help you if you render indexed triangle lists.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!