mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
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:
@ -44,6 +44,7 @@ BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog)
|
||||
EVT_CHECKBOX(ID_USEXFB, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_USEREALXFB, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_FORCEFILTERING, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_USENATIVEMIPS, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_AUTOSCALE, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_WIDESCREENHACK, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_ASPECT, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
@ -200,7 +201,7 @@ void GFXConfigDialogOGL::InitializeGUIValues()
|
||||
m_UseRealXFB->SetValue(g_Config.bUseRealXFB);
|
||||
m_AutoScale->SetValue(g_Config.bAutoScale);
|
||||
m_WidescreenHack->SetValue(g_Config.bWidescreenHack);
|
||||
|
||||
m_UseNativeMips->SetValue(g_Config.bUseNativeMips);
|
||||
// Enhancements
|
||||
m_MaxAnisotropyCB->SetSelection(g_Config.iMaxAnisotropy - 1);
|
||||
m_ForceFiltering->SetValue(g_Config.bForceFiltering);
|
||||
@ -369,6 +370,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
||||
m_UseRealXFB = new wxCheckBox(m_PageGeneral, ID_USEREALXFB, wxT("Use Real XFB"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_AutoScale = new wxCheckBox(m_PageGeneral, ID_AUTOSCALE, wxT("Auto scale (try to remove borders)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_WidescreenHack = new wxCheckBox(m_PageGeneral, ID_WIDESCREENHACK, wxT("Wide screen hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_UseNativeMips = new wxCheckBox(m_PageGeneral, ID_USENATIVEMIPS, wxT("Use Native Mips"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
// Enhancements
|
||||
sbEnhancements = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Enhancements"));
|
||||
@ -405,6 +407,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
||||
sBasicAdvanced->Add(m_UseRealXFB, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_AutoScale, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_WidescreenHack, wxGBPosition(5, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_UseNativeMips, wxGBPosition(6, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
|
||||
sbBasicAdvanced->Add(sBasicAdvanced);
|
||||
sGeneral->Add(sbBasicAdvanced, 0, wxEXPAND|wxALL, 5);
|
||||
@ -591,6 +594,9 @@ void GFXConfigDialogOGL::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
case ID_USEREALXFB:
|
||||
g_Config.bUseRealXFB = m_UseRealXFB->IsChecked();
|
||||
break;
|
||||
case ID_USENATIVEMIPS:
|
||||
g_Config.bUseNativeMips = m_UseNativeMips->IsChecked();
|
||||
break;
|
||||
case ID_AUTOSCALE:
|
||||
g_Config.bAutoScale = m_AutoScale->IsChecked();
|
||||
break;
|
||||
|
@ -95,6 +95,7 @@ class GFXConfigDialogOGL : public wxDialog
|
||||
wxCheckBox *m_ForceFiltering;
|
||||
wxCheckBox *m_Crop;
|
||||
wxCheckBox *m_UseXFB;
|
||||
wxCheckBox *m_UseNativeMips;
|
||||
wxCheckBox *m_UseRealXFB;
|
||||
wxCheckBox *m_AutoScale;
|
||||
wxChoice *m_MaxAnisotropyCB;
|
||||
@ -150,6 +151,7 @@ class GFXConfigDialogOGL : public wxDialog
|
||||
ID_CROP,
|
||||
ID_USEREALXFB,
|
||||
ID_USEXFB,
|
||||
ID_USENATIVEMIPS,
|
||||
ID_AUTOSCALE,
|
||||
ID_WIDESCREENHACK,
|
||||
|
||||
|
@ -260,7 +260,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
||||
TexMode0 &tm0 = bpmem.tex[texstage >> 2].texMode0[texstage & 3];
|
||||
TexMode1 &tm1 = bpmem.tex[texstage >> 2].texMode1[texstage & 3];
|
||||
|
||||
bool UseNativeMips = (tm0.min_filter & 3) && (tm0.min_filter != 8);
|
||||
bool UseNativeMips = (tm0.min_filter & 3) && (tm0.min_filter != 8) && g_ActiveConfig.bUseNativeMips;
|
||||
int maxlevel = ((tm1.max_lod >> 4));
|
||||
|
||||
u8 *ptr = g_VideoInitialize.pGetMemoryPointer(address);
|
||||
@ -395,13 +395,14 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
||||
|
||||
bool isPow2 = !((width & (width - 1)) || (height & (height - 1)));
|
||||
int TexLevels = (width > height)?width:height;
|
||||
TexLevels = (isPow2 && UseNativeMips && (maxlevel > 0)) ? (int)(log((double)TexLevels)/log((double)2)) + 1 : 1;
|
||||
TexLevels = (isPow2 && UseNativeMips && (maxlevel > 0)) ? (int)(log((double)TexLevels)/log((double)2)) + 1 : (isPow2? 0 : 1);
|
||||
if(TexLevels > maxlevel && maxlevel > 0)
|
||||
TexLevels = maxlevel;
|
||||
bool GenerateMipmaps = TexLevels > 1 || TexLevels == 0;
|
||||
entry.bHaveMipMaps = GenerateMipmaps;
|
||||
int gl_format = 0;
|
||||
int gl_iformat = 0;
|
||||
int gl_type = 0;
|
||||
entry.bHaveMipMaps = UseNativeMips;
|
||||
int gl_type = 0;
|
||||
if (dfmt != PC_TEX_FMT_DXT1)
|
||||
{
|
||||
switch (dfmt)
|
||||
@ -447,9 +448,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
||||
}
|
||||
if (expandedWidth != width)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, expandedWidth);
|
||||
//generate mipmaps even if we use native mips to suport textures with less levels
|
||||
bool GenerateMipmaps = isPow2 && UseNativeMips && (maxlevel > 0);
|
||||
entry.bHaveMipMaps = GenerateMipmaps;
|
||||
//generate mipmaps even if we use native mips to suport textures with less levels
|
||||
if(skip_texture_create)
|
||||
{
|
||||
glTexSubImage2D(target, 0,0,0,width, height, gl_format, gl_type, temp);
|
||||
@ -458,7 +457,16 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
||||
{
|
||||
if (GenerateMipmaps)
|
||||
{
|
||||
gluBuild2DMipmaps(target, gl_iformat, width, height, gl_format, gl_type, temp);
|
||||
if(UseNativeMips)
|
||||
{
|
||||
gluBuild2DMipmaps(target, gl_iformat, width, height, gl_format, gl_type, temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
glTexImage2D(target, 0, gl_iformat, width, height, 0, gl_format, gl_type, temp);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -126,9 +126,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 (max_Index_size - IndexGenerator::GetTriangleindexLen())/3;
|
||||
case GX_DRAW_LINE_STRIP:
|
||||
case GX_DRAW_LINES:
|
||||
return (max_Index_size - IndexGenerator::GetLineindexLen())/2;
|
||||
case GX_DRAW_POINTS:
|
||||
return (max_Index_size - IndexGenerator::GetPointindexLen());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AddVertices(int primitive, int numvertices)
|
||||
{
|
||||
if (numvertices < 0)
|
||||
if (numvertices <= 0)
|
||||
return;
|
||||
switch (primitive)
|
||||
{
|
||||
@ -136,7 +154,7 @@ void AddVertices(int primitive, int numvertices)
|
||||
case GX_DRAW_TRIANGLES:
|
||||
case GX_DRAW_TRIANGLE_STRIP:
|
||||
case GX_DRAW_TRIANGLE_FAN:
|
||||
if(max_Index_size - IndexGenerator::GetTriangleindexLen() < 2 * numvertices)
|
||||
if(max_Index_size - IndexGenerator::GetTriangleindexLen() < 3 * numvertices)
|
||||
Flush();
|
||||
break;
|
||||
case GX_DRAW_LINE_STRIP:
|
||||
|
Reference in New Issue
Block a user