Is setting a uniform variable persistent?
Started by schupf, Apr 09 2012 10:46 AM
7 replies to this topic
#1 Members - Reputation: 213
Posted 09 April 2012 - 10:46 AM
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?
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?
Sponsor:
#4 Members - Reputation: 3828
Posted 09 April 2012 - 06:23 PM
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.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#8 Members - Reputation: 3828
Posted 10 April 2012 - 03:15 AM
...or you're using the Effects framework, in which case one constant may overwrite another.
Not relevant with SetPixelShaderConstantF of course, but something that the OP should be aware of nonetheless.
Not relevant with SetPixelShaderConstantF of course, but something that the OP should be aware of nonetheless.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.






