QuaziGNRLnose , I don't know too much about how alphtesting affects optimizations- I basically just re-enabled it. Your code had a syntax error with it, and a comment saying that having it enabled didn't seem to do anything- so I assumed the syntax error was the reason why it appeared not to do anything. Fixing the syntax error allowed alphatest to get applied.
I think alphatest is useful if you aren't using a shader, since you can discard fragments in the shader to get the same effect.
I wanted to try and get shadows working with alphatest using a custom depth material, like you said.
When I was writing a shader, I wanted to use texture2D to grab color data from a texture, but there wasn't any clear way to specify the texture in the uniforms, so I had to force it to get picked after the shader was loaded from the qfx file.
for example-
I figured out that this worked in the uniform section: