• Advertisement
Sign in to follow this  

[HLSL] Passing float2x2 from VS to PS without using TEXCOORD

This topic is 2532 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!

I want to pass a 2D rotation matrix (float2x2) from VS to PS.

I cannot use the TEXCOORD registers, because I use point sprites. Some graphics cards overwrite ALL point sprite registers when using point sprites.

I found only two options:

1) Use COLOR1. Problem: the values are clamped to 0-1. Solution: Scale them into the 0-1 range.

2) Pass the rotation amount as 1 float via VFACE and create the rotation matrix inside the PS.

Is there any way I can pass my matrix directly from VS to PS?




Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Not with extra tex-coords, enabling point sprites will thrash them (undefined behavior, the docs are enigmatic in this regard)

Recreating the matrix for every pixel sounds like wasted performance, so I'd go for 1). There was a XNA example somewhere which I currently don't find. Maybe you can (ab)use other semantics, never tried myself.

Edit: By the way: It does not look like you actually can write to VFACE from the vertex shader. Have you tried and did that work ?

Share this post


Link to post
Share on other sites
Thanks, COLOR works by scaling the values. I was just curious if there's a direct solution that doesn't involve scaling.

I didn't try VFACE, I just read it in the docs and thought you could use that.

Share this post


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

  • Advertisement