D3D9: Make sure to use powers of two as render target dimensions if it's needed by the device.

Some other cleanups.

Possibly fixes issue 3256.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6725 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2011-01-02 23:13:29 +00:00
parent 4b15325acd
commit ecf92f5c3c
9 changed files with 69 additions and 64 deletions

View File

@ -20,6 +20,7 @@
#include "Render.h"
#include "XFStructs.h"
#include "StringUtil.h"
#include "VideoCommon.h"
// D3DX
HINSTANCE hD3DXDll = NULL;
@ -434,6 +435,29 @@ const D3DCAPS9 &GetCaps()
return caps;
}
// returns true if size was changed
bool FixTextureSize(int& width, int& height)
{
int oldw = width, oldh = height;
// conditional nonpow2 support should work fine for us
if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && !(caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL))
{
// all texture dimensions need to be powers of two
width = GetPow2(width);
height = GetPow2(height);
}
if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
{
width = height = max(width, height);
}
width = min(width, (int)caps.MaxTextureWidth);
height = min(height, (int)caps.MaxTextureHeight);
return (width != oldw) || (height != oldh);
}
const char *VertexShaderVersionString()
{
static const char *versions[5] = {"ERROR", "vs_1_4", "vs_2_0", "vs_3_0", "vs_4_0"};