Jump to content
  • Advertisement
Sign in to follow this  
AvengerDr

[HLSL] Primitive index inside a pixel shader?

This topic is 2621 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!