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

Started by
1 comment, last by Tubos 13 years, 2 months ago
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!

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 ?
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.

This topic is closed to new replies.

Advertisement