get a variable value from a shader

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
grunt
Posts: 96
Joined: Tue Aug 17, 2004 9:14 pm
Contact:

get a variable value from a shader

Post by grunt »

How can I get the value of a variable from an hlsl shader to debug it?
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

You can't. Or at least, not directly, i think! i am not sure if there are Shader Debuggers able to extract HLSL variables.

If you need to know the value of a variable, you have to "render" it to a rendertarget, lock the texture after rendering it and read the pixels.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

No direct way probably but you can render those values. I often use pixel colour to display values I want to debug for example.
Post Reply