My performance concern is about the switch statement itself, less about the
actual value checking. If you have something like
switch(renderstate) {
case WINED3DRS_A:
case WINED3DRS_B:
doSomething();
break;
default: break;
}
The binary code generated by the compiler still checks 239 states against
D3DRS_A and D3DRS_B(the only exception is D3DRS_A, which is never compared
against D3DRS_B). That is where my worries come from, not the doSomething()
itself.
But beyond that, I think checking the value ranges is just wrong, at least
we need a test to show Windows does that as well.