Hi,
I 'accidentally' set my d3d debug level to the highest level and noticed quite some redundant state setting.
Now I might have thought of a fairly simple improvement on this:
My render order (que):
- first everything opaque
- loop through all effects
- loop through all materials using that affect
- loop through all meshes using the material
- loop through all mesh instances of that mesh
- do the same all over again for blended mesh instances
Improvements?
- in my opaque technische I set AlphaBlendEnable and ZWriteEnable
- in my blended technique I set AlphaBlendEnable, ZWriteEnable, SrcBlend, DestBlend, AlphaOp and AlphaArg
Since each frame I also begin those techniques once, I don't think there's much to gain doing these with SetRenderSate in my code.
Although I'm seeing redundant state settings I can't explain yet...
BUT, for sure my texturesampler is the same for ALL materials, techniques and everything.
Wouldn't it then be better to set Texture, MinFilter, MagFilter, MipFilter and MaxAnisotropy, just once for each frame, using SetRenderState in my code? (not effect/hlsl)
Just curious what you think about this.