Yes, I’m rendering whole texture (or all Tilelayers) with SpriteBatch.Draw(TileLayer, Vector2.Zero, Color.White);
I hadn’t thought about using Source Rectangle.
I’m still on 3.5, but moving to 3.6 before finishing my game.
I use Deferred mode a lot, is it ok?
Currently there are 8 SpriteBatch.Begin - Ends to draw the game:
//Game Drawing
SpriteBatch.Begin(samplerState: SamplerState.PointClamp, blendState: SpecialBlend);
//Creates Special Effect with RenderTarget if needed, otherwise not called
SpriteBatch.End();
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointWrap, null, null, null, ScreenMatrix);
//Background Tile Layers
SpriteBatch.End();
SpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, null, ScreenMatrix);
//Game Objects
SpriteBatch.End();
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointWrap, null, null, null, ScreenMatrix);
//Foreground Tile Layers
SpriteBatch.End();
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, null, ScreenMatrix);
//Normal Effects & Particles
SpriteBatch.End();
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, null, null, null, ScreenMatrix);
//Other Effects & Particles
SpriteBatch.End();
SpriteBatch.Begin(transformMatrix: ScreenMatrix);
//Draw the Special Effect if needed
SpriteBatch.End();
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, null, ScreenMatrix);
//UI
SpriteBatch.End();
As you can see, only changes in SpriteBatch.Begins are in BlendState and/or in SamplerState, excluding “Special Effect”.
To be fair, on my 5820K / 980Ti, if I remove the FPS limit, the game runs in debug Map around 2000-2300FPS, but goes down to 500FPS with thousands of objects. In normal Map FPS is around 3200-3500