Re: [4/5] wined3d: Use a bitmask to store which bool and int
constants are set.
Why is this a good thing - this just artificially caps your constants at 32. If I remember correctly I had to change shaders to do the exact opposite change, because newer versions introduced more than 32 constants.
Ivan
Why is this a good thing - this just artificially caps your constants at 32. If I remember correctly I had to change shaders to do the exact opposite change, because newer versions introduced more than 32 constants.
I agree with you, this is a questionable change. The benefit in reduced data results in a gain of code size and runtime cost. --Juan
2008/12/3 Juan Lang juan.lang@gmail.com:
Why is this a good thing - this just artificially caps your constants at 32. If I remember correctly I had to change shaders to do the exact opposite change, because newer versions introduced more than 32 constants.
I agree with you, this is a questionable change. The benefit in reduced data results in a gain of code size and runtime cost. --Juan
Perhaps setting constants becomes slightly more expensive this way, but I'm not convinced it's very significant. The more performance critical code that applies the constants becomes significantly cheaper though.
"Henri Verbeet" hverbeet@gmail.com writes:
2008/12/3 Juan Lang juan.lang@gmail.com:
Why is this a good thing - this just artificially caps your constants at 32. If I remember correctly I had to change shaders to do the exact opposite change, because newer versions introduced more than 32 constants.
I agree with you, this is a questionable change. The benefit in reduced data results in a gain of code size and runtime cost. --Juan
Perhaps setting constants becomes slightly more expensive this way, but I'm not convinced it's very significant. The more performance critical code that applies the constants becomes significantly cheaper though.
I expect most operations will become faster, because the data is more likely to be kept in cache and in registers. It could probably be made even more efficient by getting rid of most of the remaining loops. I think it's a very reasonable change, using array of BOOLs is really wasteful.
2008/12/3 Ivan Gyurdiev ivg231@gmail.com:
Re: [4/5] wined3d: Use a bitmask to store which bool and int constants are set.
Why is this a good thing - this just artificially caps your constants at 32. If I remember correctly I had to change shaders to do the exact opposite change, because newer versions introduced more than 32 constants.
Ivan
We could always extend the number of possible constants by using an array. However, when we need more constants we'll probably need a scheme more like what's used for float constants anyway. The reduced memory usage is significant, not so much because we can't spare the memory, but because it allows the compiler to just keep the entire thing in a register. Perhaps even more importantly, when an application starts using constants from zero and goes up from there (which is not an unreasonable thing to do), we only have to go through the loop the amount of times as there are constants set. If the application doesn't use int or bool constants at all, we don't have to go through the loop at all either.