Pix/HLSL wierdness

Started by
3 comments, last by danromeo 14 years, 2 months ago
Hey. I have a couple of related situations here that just don't make any sense to me. Seems like one of those deals where I'm simply missing a crucial piece of information. 1. Why doesn't a simple equation in HLSL like the following seem to work when debugging a pixel in Pix? uniform const float3 EyePosition; VertexShaderOutput VertexShaderFunction(float4 inPos : POSITION) { float3 pos = EyePosition; OR float3 pos; pos[0] = EyePosition[0]; pos[1] = EyePosition[1]; pos[2] = EyePosition[2]; } The Pix debugger seems to always return pos(0,0,0); 2. I'm experimenting with creating a LookAt view matrix in the same HLSL function (don't ask, long story, yes, I'm generating a view matrix per pixel). I'm using the identical source code from MS C# GraphicsDevice.CreateLookAt(yada yada yada...), tranlsated to HLSL. I'm reasonably certain that my code is correct, but the results are completely screwed up, ie, GraphicsDevice.CreateLookAt and HLSL CreateLookAt are returning completely different results. I suspect that this has much to do with the above situation (the lookat matrix is being generated using the results of pos=EyePosition). I don't really expect anybody to get any useful info out of the above code but I'm hopeful that this will ring a bell for somebody....any input would be useful. Thanks!
Advertisement
What value is PIX showing for the constant register that EyePosition is mapped to?
Huh? :)

Gee, do you think it might help if I checked out your Tutorial link?

If you're using XNA, I definitely recommend having a read through the tutorial.

As for what I was talking about here...when you declare a shader constant in HLSL, it will get mapped to an assembly constant register (they're named c# where # is a number). If you flip over to the assembly view in the PIX debugger, it'll show you which registers your variables are mapped to. Then you can look in the registers tab to see the value of that register, to make sure it's what you expect it to be.
Cool, Thanks!

This topic is closed to new replies.

Advertisement