Sign in to follow this  
schupf

Is setting a uniform variable persistent?

Recommended Posts

Hello!

I made some tests but I am still not sure about this:
If I set a certain shader register (i.e. register c4 with mDevice->SetPixelShaderConstantF(4, data, 1))
Will register c4 now contain this value also the next frames or do I have to update c4 every frame even if the value never changes?

In other words: Should I upload everything every frame or upload all uniforms ONCE and then only update the ones that have been changed?

Share this post


Link to post
Share on other sites
Updating everything every frame would seem better to me; it's more in line with the way constant buffers are used in D3D10/11 which would be more likely to be the optimal path on current and future hardware. But this is just a personal hunch - as usual, benchmark.

Share this post


Link to post
Share on other sites
...or you're using the Effects framework, in which case one constant [i]may[/i] overwrite another.

Not relevant with SetPixelShaderConstantF of course, but something that the OP should be aware of nonetheless.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this