• Advertisement
Sign in to follow this  

write to an uniform variable in shader

This topic is 2380 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

hello,

I have a question wheather it is posible to write to an HLSL uniform variable, or they are only readonly. I am using dx9 and pixel shader target 3.0. Thanks

Share this post


Link to post
Share on other sites
Advertisement
No it is not possible. if you want to pass a variable from vertex shader to the pixel shader store in the vertex shader output and read it in the pixel shader input

Share this post


Link to post
Share on other sites
Thanks. My intention is to detect wheather the pixel function has been run, and I do not want to lock the render target. Is there no way to output from pixel function somewhere else but render target? Maybe if I declared the uniform with some different semantic...

Share this post


Link to post
Share on other sites
Uniforms are named as such because they're constant values over all the vertices and pixels that are being processed when you make a draw call, so the name very much implies the meaning. Another way to think about it is, a pixel shader can run for hundreds and thousands of times...how can each of those write data to a single variable in a meaningful way? That's what render targets are for!

I don't know what sort of problem you're trying to solve, but if you're drawing something to a texture and want to make sure its working, why not run PIX? You can view resources and the results of draw calls to ensure things are working.

Share this post


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

  • Advertisement