fast commit :

make native mips loading an option to prevent performance lost in game that not need this functionality.( thanks to dorian.fevrier for point the performance lost.)
added a patch from  pierre@pirsoft.de to avoid vertex drops when index array is full in opengl implementation that do not support large index arrays

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5432 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado
2010-05-04 14:43:30 +00:00
parent a8659054ac
commit 0ea01d8462
13 changed files with 83 additions and 18 deletions

View File

@ -175,7 +175,7 @@ struct TabAdvanced : public W32Util::Tab
Button_SetCheck(GetDlgItem(hDlg,IDC_ENABLEEFBCOPY), !g_Config.bEFBCopyDisable);
Button_SetCheck(GetDlgItem(hDlg,IDC_ENABLEXFB),g_Config.bUseXFB);
Button_SetCheck(GetDlgItem(hDlg,IDC_ENABLEREALXFB),g_Config.bUseRealXFB);
Button_SetCheck(GetDlgItem(hDlg,IDC_USENATIVEMIPS),g_Config.bUseNativeMips);
if(g_Config.bCopyEFBToTexture)
Button_SetCheck(GetDlgItem(hDlg,IDC_EFBTOTEX), true);
else
@ -237,6 +237,7 @@ struct TabAdvanced : public W32Util::Tab
g_Config.bCopyEFBToTexture = Button_GetCheck(GetDlgItem(hDlg,IDC_EFBTORAM)) ? false : true;
g_Config.bUseXFB = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLEXFB)) ? true : false;
g_Config.bUseRealXFB = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLEREALXFB)) ? true : false;
g_Config.bUseNativeMips = Button_GetCheck(GetDlgItem(hDlg, IDC_USENATIVEMIPS)) ? true : false;
g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
if( D3D::dev != NULL ) {

View File

@ -283,7 +283,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
bool isPow2 = !((width & (width - 1)) || (height & (height - 1)));
entry.isNonPow2 = false;
int TexLevels = (width > height)?width:height;
TexLevels = (isPow2 && UseNativeMips && (maxlevel > 0)) ? (int)(log((double)TexLevels)/log((double)2)) + 1 : ((isPow2 && g_ActiveConfig.bForceFiltering)? 0 : 1);
TexLevels = (isPow2 && UseNativeMips && (maxlevel > 0)) ? (int)(log((double)TexLevels)/log((double)2)) + 1 : ((isPow2)? 0 : 1);
if(TexLevels > maxlevel && maxlevel > 0)
TexLevels = maxlevel;
if (!skip_texture_create)

View File

@ -53,7 +53,7 @@ static int lastPrimitive;
static u8 *LocalVBuffer;
static u16 *TIBuffer;
static u16 *LIBuffer;
static u16 *PIBuffer;
static u16 *PIBuffer;
#define MAXVBUFFERSIZE 0x50000
#define MAXIBUFFERSIZE 0xFFFF
static bool Flushed=false;
@ -118,9 +118,27 @@ int GetRemainingSize()
return MAXVBUFFERSIZE - (int)(s_pCurBufferPointer - LocalVBuffer);
}
int GetRemainingVertices(int primitive)
{
switch (primitive)
{
case GX_DRAW_QUADS:
case GX_DRAW_TRIANGLES:
case GX_DRAW_TRIANGLE_STRIP:
case GX_DRAW_TRIANGLE_FAN:
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen())/3;
case GX_DRAW_LINE_STRIP:
case GX_DRAW_LINES:
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen())/2;
case GX_DRAW_POINTS:
return (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen());
default: return 0;
}
}
void AddVertices(int _primitive, int _numVertices)
{
if (_numVertices < 0)
if (_numVertices <= 0)
return;
switch (_primitive)
{
@ -128,7 +146,7 @@ void AddVertices(int _primitive, int _numVertices)
case GX_DRAW_TRIANGLES:
case GX_DRAW_TRIANGLE_STRIP:
case GX_DRAW_TRIANGLE_FAN:
if(MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen() < 2 * _numVertices)
if(MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen() < 3 * _numVertices)
Flush();
break;
case GX_DRAW_LINE_STRIP:
@ -250,7 +268,7 @@ void Flush()
tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1,
tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9,
tex.texTlut[i&3].tlut_format,
(tex.texMode0[i&3].min_filter & 3) && (tex.texMode0[i&3].min_filter != 8),
(tex.texMode0[i&3].min_filter & 3) && (tex.texMode0[i&3].min_filter != 8) && g_ActiveConfig.bUseNativeMips,
(tex.texMode1[i&3].max_lod >> 4));
if (tentry) {

View File

@ -43,6 +43,7 @@
#define IDC_RADIO3 1043
#define IDC_SAFE_TEXTURE_CACHE_FAST 1043
#define IDC_CHECK1 1100
#define IDC_USENATIVEMIPS 1100
#define IDC_STATIC -1
// Next default values for new objects

View File

@ -79,6 +79,7 @@ BEGIN
CONTROL "Centered",IDC_TEXFMT_CENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,183,52,10
CONTROL "Enable XFB",IDC_ENABLEXFB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,81,8
CONTROL "Enable Real XFB",IDC_ENABLEREALXFB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,71,81,8
CONTROL "Use Native Mips",IDC_USENATIVEMIPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,83,67,10
END
IDD_ENHANCEMENTS DIALOGEX 0, 0, 224, 175