views:

58

answers:

2

In my XNA game, I program and design the entire thing for 1920x1080 resolution and then scale scale and letterbox to fit the running system (XBox or PC).

This has been a great solution as it allows me to only ever worry about one resolution.

However, I'm now wondering if this will come back to bite me in the future as the game becomes more complex.

Since I'm having to scale everything with every draw (I scale SpriteBatch.Begin() with the scale factor only once, do all drawing, then call End()), is this going to have any detrimental effect on performance? I know the XBox already does this for XNA games for you when set to 720p natively (which, I actually am when running on XBox, it just gets the appropriate scaling factor).... so I can't imagine it's too bad, even for the PC.

+1  A: 

The xbox does its scale in a specialized scaler in the video output - there is zero performance hit to your app.

The scale factor you pass in to SpriteBatch just translates the vertices of your sprite. Its done with a factor of 1 even if you don't pass in a scale so there is no extra load there.

With different screen sizes there will be different fill rates (more or less pixels) and texture lookups will be different too so that will show some variances.

Just using a 1028x720 backbuffer is the safest to do. The xbox can hardware scale that into ANY resolution or ratio without a single line of code or any perf issues. It will letter box properly and the hardware scaler is very good quality. You cannot claim 1080p support is really the only downside.

If you chose 1020x1080 as your back buffer note that the hardware scaler cannot scale that down to 480i and WILL fail in peer review (well it should if anyone notices)

On WIndows the easiest thing is probably to draw everything to a RenderTarget and then just scale the whole darn thing on one go at the end. See the SpaceWar starterkit for the few lines of code it takes to do that. (All inside #if !XBOX so you dont waste cycles doing it on the 360)

Andy Dunn
To clarify, the back buffer on Xbox IS 1280x720, it's just that the sprites are drawn for 1080, so I still give a scale factor in the Begin() call. So, while the graphics were created for 1080p, the game is still running at only 720 so, if I understand correctly, the xbox should scale to 480i just fine... correct? The main point was to have the ability to go up to 1080 if it's available. I could also prob just set to 720 on xbox if I detect it's not running at 1080, right?
Adam Haile
If you must have 1080p then the best thing is to always make the back buffer 1920x1080p and do no scaling. Let the hardware scaler do it for you - it will probably look better than scaling individual elements. Then treat 480 as the exception case.There's no easy way to cover everything is you do want 1080
Andy Dunn
Except you just said that it won't scale down on XBox went at 1080p?For the time being I will likely just make the XBox only run at 720, I just wanted to be able to scale up to 1080 either just on the computer or on both later, but that way I have the graphics already at that resolution.
Adam Haile
A: 

This shouldn't cost you. The scaling is done by he video card.

However, if this does worry you, another option to handle different resolutions is to change the render target to an off screen buffer, render to that, and then draw a square on the screen with the buffer as the texture. More pixels are rendered, but you don't need to do a transform on each vertex.

Nikhil