   Effect Variables - what's the value?
  Couple of questions about effect variables:1) If I have an effect variable, we'll make it a bool and call it x.I set the value of that variable from my application as part of my rendering code as I draw mesh #1 to false.It then comes time to render another object, mesh #2, using the same effect.What is the value of x in the effect, after I call pass:apply() ?2)Exact same scenario except:Before I call pass::apply() for mesh #2, I set a different effect varibale y that is also global in the effect.What is the value of x in the effect, after I call pass:apply() ?3) If I give x a default value of true.I set the value of that variable from my application as part of my rendering code as I draw mesh #1 to false.It then comes time to render another object, mesh #2, using the same effect.What is the value of x in the effect, after I call pass:apply() ?[Edited by - brekehan on May 8, 2009 9:26:57 PM]
  I don't understand why questions about effect variable value state never get answered :( I think I've got about 15 of them in the last month all 0 replies on this and the official MS D3D10 forums.Am I asking it wrong?Or am I the only one using the same HLSL effect to render more than 1 object?Or maybe I am the only one that doesn't explicitly set every single effect variable, such that noone else worries about it?I think knowing what the value of an effect variable is at any given time, is certainly pertanent knowlege...;  Have you actually tested any of these scenarios to see if you can find the answer that way? For example, this question, "Suppose I set the value of one of those effect variables, that had a default value set in the HLSL, from my application prior to rendering an object.Now suppose I render another object (applying the pass again) without setting that value. What is the value of that variable?" Have you actually attempted programming this to get a result and see what happens?   ;Quote:Original post by leet bixHave you actually tested any of these scenarios to see if you can find the answer that way? For example, this question, "Suppose I set the value of one of those effect variables, that had a default value set in the HLSL, from my application prior to rendering an object.Now suppose I render another object (applying the pass again) without setting that value. What is the value of that variable?" Have you actually attempted programming this to get a result and see what happens?Absolutely!The results are not consistant, hence the questions.Furthermore, I experience frequent "nvidia display driver has stopped responding" errors, and am not sure if this is the cause.Without a definitive answer, one cannot tell if:A) Application code is screwedB) HLSL code is screwedC) The debugging tool is screwed, or you aren't using it properly. (PIX)D) Nvidia's display driver is screwedWriting an effect is not as simple as writing "hello world", there are too many factors that can go wrong for the unlearned.Niether do the docs say a word about it.When you started learning C++, did they tell you to write a program and see what it does _before_ they told you the difference between a declaration and a definition? I doubt it.Even if you do view it as a silly question... I make an effort to answer any question, regardless if it is silly or not, whenever I come on here. I might tell them, "hey you might want to take a step back and read such and such", but I'll still answer. Because I know it takes me 30 seconds to write a few lines opposed to hours of someone else struggling through it.Now I'll give you some trial and error is a great thing, but without a solid understanding of what you are trying, it isn't going to do much good. I am asking for one of the foundational rules here.[Edited by - brekehan on May 9, 2009 5:25:21 AM];  Well, I'll answer my own question.After 3 days of debugging, through crashing display drivers, blue screens, and what have you, it seems my problems aren't effect variables at all.As soon as I wiped November 2008 SDK off my system completely and installed March 2009 SDK, I was able to debug and find my answers.I assumed that the crashing was due to inconsistant effect variable states, but it wasn't at all. It was just coincidence it started when I started to render multple objects with the same effect. At least that's my story.But, anywho.. I find that effect variables work like states. 1) An effect variable or any state set in an effect will maintain its last set value for the life time of the effect or until it is set again.2) If that value happens to come from a default set in the HLSL it will have that value at creation, until it is set by the application to something else, for the lifetime of the effect.3) If a variable is not set at all, it will have a value of zero.Someone correct me if I am wrong.   