[Android] Remove Plugin_ForceGfxReset

This commit is contained in:
zilmar 2017-04-26 18:13:55 +10:00
parent c7f895737a
commit 9efae26d0c
15 changed files with 337 additions and 284 deletions

View File

@ -119,8 +119,6 @@
<string name="VerticalInterruptsPerSecond">Vertical interrupts per second</string> <string name="VerticalInterruptsPerSecond">Vertical interrupts per second</string>
<string name="RecordExecutionTimes_title">Record Execution Times</string> <string name="RecordExecutionTimes_title">Record Execution Times</string>
<string name="RecordExecutionTimes_summary">Record how long each block executes for</string> <string name="RecordExecutionTimes_summary">Record how long each block executes for</string>
<string name="ForceGfxReset_title">Reset GFX Plugin</string>
<string name="ForceGfxReset_summary">Always reload GFX plugin</string>
<string name="PreAllocSyncMem_title">Pre Alloc Sync Mem</string> <string name="PreAllocSyncMem_title">Pre Alloc Sync Mem</string>
<string name="PreAllocSyncMem_summary">Allocate sync memory at startup</string> <string name="PreAllocSyncMem_summary">Allocate sync memory at startup</string>
<string name="ReducedSyncMem_title">Reduced Sync Mem</string> <string name="ReducedSyncMem_title">Reduced Sync Mem</string>

View File

@ -26,10 +26,6 @@
android:key="Debugger_RecordExecutionTimes" android:key="Debugger_RecordExecutionTimes"
android:summary="@string/RecordExecutionTimes_summary" android:summary="@string/RecordExecutionTimes_summary"
android:title="@string/RecordExecutionTimes_title" /> android:title="@string/RecordExecutionTimes_title" />
<CheckBoxPreference
android:key="Plugin_ForceGfxReset"
android:summary="@string/ForceGfxReset_summary"
android:title="@string/ForceGfxReset_title" />
<CheckBoxPreference <CheckBoxPreference
android:key="PreAllocSyncMem" android:key="PreAllocSyncMem"
android:summary="@string/PreAllocSyncMem_summary" android:summary="@string/PreAllocSyncMem_summary"

View File

@ -550,7 +550,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
final Context finalContext = this; final Context finalContext = this;
AlertDialog.Builder GameMenu = new AlertDialog.Builder(finalContext); AlertDialog.Builder GameMenu = new AlertDialog.Builder(finalContext);
GameMenu.setTitle(NativeExports.SettingsLoadString(SettingsID.Game_GoodName.getValue())); GameMenu.setTitle(NativeExports.SettingsLoadString(SettingsID.Rdb_GoodName.getValue()));
GameMenu.setAdapter(adapter, new DialogInterface.OnClickListener() GameMenu.setAdapter(adapter, new DialogInterface.OnClickListener()
{ {
@Override @Override

View File

@ -210,7 +210,7 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
{ {
item.setChecked(true); item.setChecked(true);
} }
String SaveFileName = SaveDirectory + "/" + NativeExports.SettingsLoadString(SettingsID.Game_GoodName.getValue()) + ".pj"; String SaveFileName = SaveDirectory + "/" + NativeExports.SettingsLoadString(SettingsID.Rdb_GoodName.getValue()) + ".pj";
String Timestamp = ""; String Timestamp = "";
if (SaveSlot != 0) if (SaveSlot != 0)
{ {

View File

@ -97,7 +97,7 @@ public enum SettingsID
Game_File, Game_File,
Game_UniqueSaveDir, Game_UniqueSaveDir,
Game_GameName, Game_GameName,
Game_GoodName, Cfg_GoodName,
Game_TempLoaded, Game_TempLoaded,
Game_SystemType, Game_SystemType,
Game_EditPlugin_Gfx, Game_EditPlugin_Gfx,
@ -255,7 +255,6 @@ public enum SettingsID
Plugin_UseHleGfx, Plugin_UseHleGfx,
Plugin_UseHleAudio, Plugin_UseHleAudio,
Plugin_EnableAudio, Plugin_EnableAudio,
Plugin_ForceGfxReset,
Logging_GenerateLog, Logging_GenerateLog,
Logging_LogRDRamRegisters, Logging_LogRDRamRegisters,

View File

@ -60,7 +60,6 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
.putBoolean("audio_Enabled",NativeExports.SettingsLoadBool(SettingsID.Plugin_EnableAudio.getValue())) .putBoolean("audio_Enabled",NativeExports.SettingsLoadBool(SettingsID.Plugin_EnableAudio.getValue()))
.putBoolean("PreAllocSyncMem",NativeExports.SettingsLoadBool(SettingsID.Setting_PreAllocSyncMem.getValue())) .putBoolean("PreAllocSyncMem",NativeExports.SettingsLoadBool(SettingsID.Setting_PreAllocSyncMem.getValue()))
.putBoolean("ReducedSyncMem",NativeExports.SettingsLoadBool(SettingsID.Setting_ReducedSyncMem.getValue())) .putBoolean("ReducedSyncMem",NativeExports.SettingsLoadBool(SettingsID.Setting_ReducedSyncMem.getValue()))
.putBoolean("Plugin_ForceGfxReset",NativeExports.SettingsLoadBool(SettingsID.Plugin_ForceGfxReset.getValue()))
.putBoolean("UserInterface_BasicMode",NativeExports.SettingsLoadBool(SettingsID.UserInterface_BasicMode.getValue())) .putBoolean("UserInterface_BasicMode",NativeExports.SettingsLoadBool(SettingsID.UserInterface_BasicMode.getValue()))
.putBoolean("Debugger_Enabled",NativeExports.SettingsLoadBool(SettingsID.Debugger_Enabled.getValue())) .putBoolean("Debugger_Enabled",NativeExports.SettingsLoadBool(SettingsID.Debugger_Enabled.getValue()))
.putBoolean("Debugger_RecordRecompilerAsm",NativeExports.SettingsLoadBool(SettingsID.Debugger_RecordRecompilerAsm.getValue())) .putBoolean("Debugger_RecordRecompilerAsm",NativeExports.SettingsLoadBool(SettingsID.Debugger_RecordRecompilerAsm.getValue()))
@ -145,7 +144,6 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
else if (key.equals("touchscreenLayout")) { NativeExports.UISettingsSaveString(UISettingID.TouchScreen_Layout.getValue(), sharedPreferences.getString(key, "Analog")); } else if (key.equals("touchscreenLayout")) { NativeExports.UISettingsSaveString(UISettingID.TouchScreen_Layout.getValue(), sharedPreferences.getString(key, "Analog")); }
else if (key.equals("Patreon_email")) { NativeExports.UISettingsSaveString(UISettingID.SupportWindow_PatreonEmail.getValue(), sharedPreferences.getString(key, "")); } else if (key.equals("Patreon_email")) { NativeExports.UISettingsSaveString(UISettingID.SupportWindow_PatreonEmail.getValue(), sharedPreferences.getString(key, "")); }
else if (key.equals("audio_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_EnableAudio.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("audio_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_EnableAudio.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("Plugin_ForceGfxReset")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_ForceGfxReset.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("PreAllocSyncMem")) { NativeExports.SettingsSaveBool(SettingsID.Setting_PreAllocSyncMem.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("PreAllocSyncMem")) { NativeExports.SettingsSaveBool(SettingsID.Setting_PreAllocSyncMem.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("ReducedSyncMem")) { NativeExports.SettingsSaveBool(SettingsID.Setting_ReducedSyncMem.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("ReducedSyncMem")) { NativeExports.SettingsSaveBool(SettingsID.Setting_ReducedSyncMem.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("Debugger_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_Enabled.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("Debugger_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_Enabled.getValue(), sharedPreferences.getBoolean(key,false)); }

View File

@ -356,6 +356,8 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen(GrColorFormat_t color_format, GrOrigin
{ {
static int show_warning = 1; static int show_warning = 1;
GLCache::ResetCache();
// ZIGGY // ZIGGY
// allocate static texture names // allocate static texture names
// the initial value should be big enough to support the maximal resolution // the initial value should be big enough to support the maximal resolution

View File

@ -42,313 +42,351 @@
void vbo_draw(); void vbo_draw();
void cache_glActiveTexture (GLenum texture) GLenum GLCache::m_cached_texture;
{ GLenum GLCache::m_cached_mode;
static GLenum cached_texture; GLenum GLCache::m_cached_modeRGB;
GLenum GLCache::m_cached_modeAlpha;
GLenum GLCache::m_cached_sfactor;
GLenum GLCache::m_cached_dfactor;
GLenum GLCache::m_cached_BlendFuncSeparate_srcRGB;
GLenum GLCache::m_cached_BlendFuncSeparate_dstRGB;
GLenum GLCache::m_cached_BlendFuncSeparate_srcAlpha;
GLenum GLCache::m_cached_BlendFuncSeparate_dstAlpha;
GLclampf GLCache::m_cached_depth;
GLenum GLCache::m_cached_CullFace_mode;
GLenum GLCache::m_cached_func;
GLboolean GLCache::m_cached_DepthMask_flag;
GLclampf GLCache::m_cached_zNear;
GLclampf GLCache::m_cached_zFar;
bool GLCache::m_cached_BLEND = false;
bool GLCache::m_cached_CULL_FACE = false;
bool GLCache::m_cached_DEPTH_TEST = false;
bool GLCache::m_cached_DITHER = false;
bool GLCache::m_cached_POLYGON_OFFSET_FILL = false;
bool GLCache::m_cached_SAMPLE_ALPHA_TO_COVERAGE = false;
bool GLCache::m_cached_SAMPLE_COVERAGE = false;
bool GLCache::m_cached_SCISSOR_TEST = false;
bool GLCache::m_cached_STENCIL_TEST = false;
GLenum GLCache::m_cached_FrontFace_mode;
GLfloat GLCache::m_cached_factor;
GLfloat GLCache::m_cached_units;
GLclampf GLCache::m_cached_red, GLCache::m_cached_green, GLCache::m_cached_blue, GLCache::m_cached_alpha;
GLint GLCache::m_cached_x, GLCache::m_cached_y;
GLsizei GLCache::m_cached_width, GLCache::m_cached_height;
GLuint GLCache::m_cached_program;
GLint GLCache::m_Viewport_cached_x = 0, GLCache::m_Viewport_cached_y = 0;
GLsizei GLCache::m_Viewport_cached_width = 0, GLCache::m_Viewport_cached_height = 0;
if(texture != cached_texture) void GLCache::ResetCache(void)
{
m_cached_texture = 0;
m_cached_mode = 0;
m_cached_modeRGB = 0;
m_cached_modeAlpha = 0;
m_cached_sfactor = 0;
m_cached_dfactor = 0;
m_cached_BlendFuncSeparate_srcRGB = 0;
m_cached_BlendFuncSeparate_dstRGB = 0;
m_cached_BlendFuncSeparate_srcAlpha = 0;
m_cached_BlendFuncSeparate_dstAlpha = 0;
m_cached_depth = 0;
m_cached_CullFace_mode = 0;
m_cached_func = 0;
m_cached_DepthMask_flag = 0;
m_cached_zNear = 0;
m_cached_zFar = 0;
m_cached_BLEND = false;
m_cached_CULL_FACE = false;
m_cached_DEPTH_TEST = false;
m_cached_DITHER = false;
m_cached_POLYGON_OFFSET_FILL = false;
m_cached_SAMPLE_ALPHA_TO_COVERAGE = false;
m_cached_SAMPLE_COVERAGE = false;
m_cached_SCISSOR_TEST = false;
m_cached_STENCIL_TEST = false;
m_cached_FrontFace_mode = 0;
m_cached_factor = 0;
m_cached_units = 0;
m_cached_red = 0;
m_cached_green = 0;
m_cached_blue = 0;
m_cached_alpha = 0;
m_cached_x = 0;
m_cached_y = 0;
m_cached_width = 0;
m_cached_height = 0;
m_cached_program = 0;
m_Viewport_cached_x = 0;
m_Viewport_cached_y = 0;
m_Viewport_cached_width = 0;
m_Viewport_cached_height = 0;
}
void GLCache::glActiveTexture(GLenum texture)
{
if (texture != m_cached_texture)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "texture: %d",texture); WriteTrace(TraceOGLWrapper, TraceDebug, "texture: %d", texture);
vbo_draw(); vbo_draw();
glActiveTexture(texture); ::glActiveTexture(texture);
cached_texture = texture; m_cached_texture = texture;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - texture: %d",texture); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - texture: %d", texture);
} }
} }
void cache_glBindTexture (GLenum target, GLuint texture) void GLCache::glBindTexture(GLenum target, GLuint texture)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "target: %d texture: %d",target, texture); WriteTrace(TraceOGLWrapper, TraceDebug, "target: %d texture: %d", target, texture);
vbo_draw(); vbo_draw();
glBindTexture(target, texture); ::glBindTexture(target, texture);
} }
void cache_glBlendEquation ( GLenum mode ) void GLCache::glBlendEquation(GLenum mode)
{ {
static GLenum cached_mode; if (mode != m_cached_mode)
if(mode != cached_mode)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d",mode); WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d", mode);
vbo_draw(); vbo_draw();
glBlendEquation(mode); ::glBlendEquation(mode);
cached_mode = mode; m_cached_mode = mode;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d",mode); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d", mode);
} }
} }
void cache_glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) void GLCache::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
{ {
static GLenum cached_modeRGB; if (modeRGB != m_cached_modeRGB || modeAlpha != m_cached_modeAlpha)
static GLenum cached_modeAlpha;
if(modeRGB != cached_modeRGB || modeAlpha != cached_modeAlpha)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "modeRGB: %d cached_modeAlpha: %d",modeRGB, cached_modeAlpha); WriteTrace(TraceOGLWrapper, TraceDebug, "modeRGB: %d cached_modeAlpha: %d", modeRGB, m_cached_modeAlpha);
vbo_draw(); vbo_draw();
glBlendEquationSeparate(modeRGB, modeAlpha); ::glBlendEquationSeparate(modeRGB, modeAlpha);
cached_modeRGB = modeRGB; m_cached_modeRGB = modeRGB;
cached_modeAlpha = modeAlpha; m_cached_modeAlpha = modeAlpha;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - modeRGB: %d cached_modeAlpha: %d",modeRGB, cached_modeAlpha); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - modeRGB: %d cached_modeAlpha: %d", modeRGB, m_cached_modeAlpha);
} }
} }
void cache_glBlendFunc (GLenum sfactor, GLenum dfactor) void GLCache::glBlendFunc(GLenum sfactor, GLenum dfactor)
{ {
static GLenum cached_sfactor; if (sfactor != m_cached_sfactor || dfactor != m_cached_dfactor)
static GLenum cached_dfactor;
if(sfactor != cached_sfactor || dfactor != cached_dfactor)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "sfactor: %d dfactor: %d",sfactor, dfactor); WriteTrace(TraceOGLWrapper, TraceDebug, "sfactor: %d dfactor: %d", sfactor, dfactor);
vbo_draw(); vbo_draw();
glBlendFunc(sfactor, dfactor); ::glBlendFunc(sfactor, dfactor);
cached_sfactor = sfactor; m_cached_sfactor = sfactor;
cached_dfactor = dfactor; m_cached_dfactor = dfactor;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - sfactor: %d dfactor: %d",sfactor, dfactor); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - sfactor: %d dfactor: %d", sfactor, dfactor);
} }
} }
void cache_glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) void GLCache::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{ {
static GLenum cached_BlendFuncSeparate_srcRGB; if (srcRGB != m_cached_BlendFuncSeparate_srcRGB || dstRGB != m_cached_BlendFuncSeparate_dstRGB || srcAlpha != m_cached_BlendFuncSeparate_srcAlpha || dstAlpha != m_cached_BlendFuncSeparate_dstAlpha)
static GLenum cached_BlendFuncSeparate_dstRGB;
static GLenum cached_BlendFuncSeparate_srcAlpha;
static GLenum cached_BlendFuncSeparate_dstAlpha;
if(srcRGB != cached_BlendFuncSeparate_srcRGB || dstRGB != cached_BlendFuncSeparate_dstRGB || srcAlpha != cached_BlendFuncSeparate_srcAlpha || dstAlpha != cached_BlendFuncSeparate_dstAlpha)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "srcRGB: %d dstRGB: %d srcAlpha: %d dstAlpha: %d",srcRGB, dstRGB, srcAlpha, dstAlpha); WriteTrace(TraceOGLWrapper, TraceDebug, "srcRGB: %d dstRGB: %d srcAlpha: %d dstAlpha: %d", srcRGB, dstRGB, srcAlpha, dstAlpha);
vbo_draw(); vbo_draw();
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
cached_BlendFuncSeparate_srcRGB = srcRGB; m_cached_BlendFuncSeparate_srcRGB = srcRGB;
cached_BlendFuncSeparate_dstRGB = dstRGB; m_cached_BlendFuncSeparate_dstRGB = dstRGB;
cached_BlendFuncSeparate_srcAlpha = srcAlpha; m_cached_BlendFuncSeparate_srcAlpha = srcAlpha;
cached_BlendFuncSeparate_dstAlpha = dstAlpha; m_cached_BlendFuncSeparate_dstAlpha = dstAlpha;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - srcRGB: %d dstRGB: %d srcAlpha: %d dstAlpha: %d",srcRGB, dstRGB, srcAlpha, dstAlpha); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - srcRGB: %d dstRGB: %d srcAlpha: %d dstAlpha: %d", srcRGB, dstRGB, srcAlpha, dstAlpha);
} }
} }
void cache_glClearDepthf (GLclampf depth) void GLCache::glClearDepthf(GLclampf depth)
{ {
static GLclampf cached_depth; if (depth != m_cached_depth)
if(depth != cached_depth)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "depth: %d",depth); WriteTrace(TraceOGLWrapper, TraceDebug, "depth: %d", depth);
vbo_draw(); vbo_draw();
glClearDepthf(depth); ::glClearDepthf(depth);
cached_depth = depth; m_cached_depth = depth;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - depth: %d",depth); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - depth: %d", depth);
} }
} }
void cache_glCullFace (GLenum mode) void GLCache::glCullFace(GLenum mode)
{ {
static GLenum cached_CullFace_mode; if (mode != m_cached_CullFace_mode)
if(mode != cached_CullFace_mode)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d",mode); WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d", mode);
vbo_draw(); vbo_draw();
glCullFace(mode); ::glCullFace(mode);
cached_CullFace_mode = mode; m_cached_CullFace_mode = mode;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d",mode); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d", mode);
} }
} }
void cache_glDepthFunc (GLenum func) void GLCache::glDepthFunc(GLenum func)
{ {
static GLenum cached_func; if (func != m_cached_func)
if(func != cached_func)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "func: %d",func); WriteTrace(TraceOGLWrapper, TraceDebug, "func: %d", func);
vbo_draw(); vbo_draw();
glDepthFunc(func); ::glDepthFunc(func);
cached_func = func; m_cached_func = func;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - func: %d",func); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - func: %d", func);
} }
} }
void cache_glDepthMask (GLboolean flag) void GLCache::glDepthMask(GLboolean flag)
{ {
static GLboolean cached_DepthMask_flag; if (flag != m_cached_DepthMask_flag)
if(flag != cached_DepthMask_flag)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "flag: %d",(int)flag); WriteTrace(TraceOGLWrapper, TraceDebug, "flag: %d", (int)flag);
vbo_draw(); vbo_draw();
glDepthMask(flag); ::glDepthMask(flag);
cached_DepthMask_flag = flag; m_cached_DepthMask_flag = flag;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - flag: %d",(int)flag); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - flag: %d", (int)flag);
} }
} }
void cache_glDepthRangef (GLclampf zNear, GLclampf zFar) void GLCache::glDepthRangef(GLclampf zNear, GLclampf zFar)
{ {
static GLclampf cached_zNear; if (zNear != m_cached_zNear || zFar != m_cached_zFar)
static GLclampf cached_zFar;
if(zNear != cached_zNear || zFar != cached_zFar)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "zNear: %d zFar: %d",zNear, zFar); WriteTrace(TraceOGLWrapper, TraceDebug, "zNear: %d zFar: %d", zNear, zFar);
vbo_draw(); vbo_draw();
glDepthRangef(zNear, zFar); ::glDepthRangef(zNear, zFar);
cached_zNear = zNear; m_cached_zNear = zNear;
cached_zFar = zFar; m_cached_zFar = zFar;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - zNear: %d zFar: %d",zNear, zFar); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - zNear: %d zFar: %d", zNear, zFar);
} }
} }
void GLCache::glEnableDisableItem(GLenum cap, bool enable, bool & cached_state, const char * StateName)
void cache_glEnableDisableItem (GLenum cap, bool enable, bool & cached_state, const char * StateName)
{ {
if (enable) if (enable)
{ {
if(!cached_state) if (!cached_state)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "glEnable(%s)",StateName); WriteTrace(TraceOGLWrapper, TraceDebug, "glEnable(%s)", StateName);
vbo_draw(); vbo_draw();
glEnable(cap); ::glEnable(cap);
cached_state = true; cached_state = true;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - glEnable(%s)",StateName); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - glEnable(%s)", StateName);
} }
} }
else else
{ {
if (cached_state) if (cached_state)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "glDisable(%s)",StateName); WriteTrace(TraceOGLWrapper, TraceDebug, "glDisable(%s)", StateName);
vbo_draw(); vbo_draw();
glDisable(cap); ::glDisable(cap);
cached_state = false; cached_state = false;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - glEnable(%s)",StateName); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - glEnable(%s)", StateName);
} }
} }
} }
void cache_glEnableDisable (GLenum cap, bool enable) void GLCache::glEnableDisable(GLenum cap, bool enable)
{ {
static bool cached_BLEND = false; if (cap == GL_BLEND) { GLCache::glEnableDisableItem(cap, enable, m_cached_BLEND, "GL_BLEND"); }
static bool cached_CULL_FACE = false; else if (cap == GL_CULL_FACE) { GLCache::glEnableDisableItem(cap, enable, m_cached_CULL_FACE, "GL_CULL_FACE"); }
static bool cached_DEPTH_TEST = false; else if (cap == GL_DEPTH_TEST) { GLCache::glEnableDisableItem(cap, enable, m_cached_DEPTH_TEST, "GL_DEPTH_TEST"); }
static bool cached_DITHER = false; else if (cap == GL_DITHER) { GLCache::glEnableDisableItem(cap, enable, m_cached_DITHER, "GL_DITHER"); }
static bool cached_POLYGON_OFFSET_FILL = false; else if (cap == GL_POLYGON_OFFSET_FILL) { GLCache::glEnableDisableItem(cap, enable, m_cached_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL"); }
static bool cached_SAMPLE_ALPHA_TO_COVERAGE = false; else if (cap == GL_SAMPLE_ALPHA_TO_COVERAGE) { GLCache::glEnableDisableItem(cap, enable, m_cached_SAMPLE_ALPHA_TO_COVERAGE, "GL_SAMPLE_ALPHA_TO_COVERAGE"); }
static bool cached_SAMPLE_COVERAGE = false; else if (cap == GL_SAMPLE_COVERAGE) { GLCache::glEnableDisableItem(cap, enable, m_cached_SAMPLE_COVERAGE, "GL_SAMPLE_COVERAGE"); }
static bool cached_SCISSOR_TEST = false; else if (cap == GL_SCISSOR_TEST) { GLCache::glEnableDisableItem(cap, enable, m_cached_SCISSOR_TEST, "GL_SCISSOR_TEST"); }
static bool cached_STENCIL_TEST = false; else if (cap == GL_STENCIL_TEST) { GLCache::glEnableDisableItem(cap, enable, m_cached_STENCIL_TEST, "GL_STENCIL_TEST"); }
if(cap == GL_BLEND) { cache_glEnableDisableItem(cap, enable, cached_BLEND, "GL_BLEND"); }
else if(cap == GL_CULL_FACE) { cache_glEnableDisableItem(cap, enable, cached_CULL_FACE, "GL_CULL_FACE"); }
else if(cap == GL_DEPTH_TEST) { cache_glEnableDisableItem(cap, enable, cached_DEPTH_TEST, "GL_DEPTH_TEST"); }
else if(cap == GL_DITHER) { cache_glEnableDisableItem(cap, enable, cached_DITHER, "GL_DITHER"); }
else if(cap == GL_POLYGON_OFFSET_FILL) { cache_glEnableDisableItem(cap, enable, cached_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL"); }
else if(cap == GL_SAMPLE_ALPHA_TO_COVERAGE) { cache_glEnableDisableItem(cap, enable, cached_SAMPLE_ALPHA_TO_COVERAGE, "GL_SAMPLE_ALPHA_TO_COVERAGE"); }
else if(cap == GL_SAMPLE_COVERAGE) { cache_glEnableDisableItem(cap, enable, cached_SAMPLE_COVERAGE, "GL_SAMPLE_COVERAGE"); }
else if(cap == GL_SCISSOR_TEST) { cache_glEnableDisableItem(cap, enable, cached_SCISSOR_TEST, "GL_SCISSOR_TEST"); }
else if(cap == GL_STENCIL_TEST) { cache_glEnableDisableItem(cap, enable, cached_STENCIL_TEST, "GL_STENCIL_TEST"); }
else else
{ {
if (enable) if (enable)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "glEnable(%d)",cap); WriteTrace(TraceOGLWrapper, TraceDebug, "glEnable(%d)", cap);
vbo_draw(); vbo_draw();
glEnable(cap); ::glEnable(cap);
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "glDisable(%d)",cap); WriteTrace(TraceOGLWrapper, TraceDebug, "glDisable(%d)", cap);
vbo_draw(); vbo_draw();
glDisable(cap); ::glDisable(cap);
} }
} }
} }
void cache_glFrontFace (GLenum mode) void GLCache::glFrontFace(GLenum mode)
{ {
static GLenum cached_FrontFace_mode; if (mode != m_cached_FrontFace_mode)
if(mode != cached_FrontFace_mode)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d",mode); WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d", mode);
vbo_draw(); vbo_draw();
glFrontFace(mode); ::glFrontFace(mode);
cached_FrontFace_mode = mode; m_cached_FrontFace_mode = mode;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d",mode); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d", mode);
} }
} }
void cache_glPolygonOffset (GLfloat factor, GLfloat units) void GLCache::glPolygonOffset(GLfloat factor, GLfloat units)
{ {
static GLfloat cached_factor; if (factor != m_cached_factor || units != m_cached_units)
static GLfloat cached_units;
if(factor != cached_factor || units != cached_units)
{ {
vbo_draw(); vbo_draw();
WriteTrace(TraceOGLWrapper, TraceDebug, "factor: %f units: %f",factor, units); WriteTrace(TraceOGLWrapper, TraceDebug, "factor: %f units: %f", factor, units);
glPolygonOffset(factor, units); ::glPolygonOffset(factor, units);
cached_factor = factor; m_cached_factor = factor;
cached_units = units; m_cached_units = units;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - factor: %f units: %f",factor, units); WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - factor: %f units: %f", factor, units);
} }
} }
void cache_glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) void GLCache::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{ {
static GLclampf cached_red, cached_green, cached_blue, cached_alpha; if (red != m_cached_red || green != m_cached_green || blue != m_cached_blue || alpha != m_cached_alpha)
if(red != cached_red || green != cached_green || blue != cached_blue || alpha != cached_alpha)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "red: %f, green: %f, blue: %f, alpha: %f", red, green, blue, alpha); WriteTrace(TraceOGLWrapper, TraceDebug, "red: %f, green: %f, blue: %f, alpha: %f", red, green, blue, alpha);
vbo_draw(); vbo_draw();
glClearColor(red, green, blue, alpha); ::glClearColor(red, green, blue, alpha);
cached_red = red; m_cached_red = red;
cached_green = green; m_cached_green = green;
cached_blue = blue; m_cached_blue = blue;
cached_alpha = alpha; m_cached_alpha = alpha;
} }
else else
{ {
@ -356,20 +394,17 @@ void cache_glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf a
} }
} }
void cache_glScissor (GLint x, GLint y, GLsizei width, GLsizei height) void GLCache::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
{ {
static GLint cached_x, cached_y; if (x != m_cached_x || y != m_cached_y || width != m_cached_width || height != m_cached_height)
static GLsizei cached_width, cached_height;
if(x != cached_x || y != cached_y || width != cached_width || height != cached_height)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "x: %d, y: %d, width: %d, height: %d", x, y, width, height); WriteTrace(TraceOGLWrapper, TraceDebug, "x: %d, y: %d, width: %d, height: %d", x, y, width, height);
vbo_draw(); vbo_draw();
glScissor(x, y, width, height); ::glScissor(x, y, width, height);
cached_x = x; m_cached_x = x;
cached_y = y; m_cached_y = y;
cached_width = width; m_cached_width = width;
cached_height = height; m_cached_height = height;
} }
else else
{ {
@ -377,15 +412,14 @@ void cache_glScissor (GLint x, GLint y, GLsizei width, GLsizei height)
} }
} }
void cache_glUseProgram (GLuint program) void GLCache::glUseProgram(GLuint program)
{ {
static GLuint cached_program; if (program != m_cached_program)
if(program != cached_program)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "program: %d", program); WriteTrace(TraceOGLWrapper, TraceDebug, "program: %d", program);
vbo_draw(); vbo_draw();
glUseProgram(program); ::glUseProgram(program);
cached_program = program; m_cached_program = program;
} }
else else
{ {
@ -393,24 +427,20 @@ void cache_glUseProgram (GLuint program)
} }
} }
void cache_glViewport (GLint x, GLint y, GLsizei width, GLsizei height) void GLCache::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{ {
static GLint cached_x = 0, cached_y = 0; if (x != m_Viewport_cached_x || y != m_Viewport_cached_y || width != m_Viewport_cached_width || height != m_Viewport_cached_height)
static GLsizei cached_width = 0, cached_height = 0;
if(x != cached_x || y != cached_y || width != cached_width || height != cached_height)
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "x: %d, y: %d, width: %d, height: %d", x, y, width, height); WriteTrace(TraceOGLWrapper, TraceDebug, "x: %d, y: %d, width: %d, height: %d", x, y, width, height);
vbo_draw(); vbo_draw();
glViewport(x, y, width, height); ::glViewport(x, y, width, height);
cached_x = x; m_Viewport_cached_x = x;
cached_y = y; m_Viewport_cached_y = y;
cached_width = width; m_Viewport_cached_width = width;
cached_height = height; m_Viewport_cached_height = height;
} }
else else
{ {
WriteTrace(TraceOGLWrapper, TraceDebug, "ignored x: %d, y: %d, width: %d, height: %d", x, y, width, height); WriteTrace(TraceOGLWrapper, TraceDebug, "ignored x: %d, y: %d, width: %d, height: %d", x, y, width, height);
} }
} }

View File

@ -1,42 +1,87 @@
#pragma once #pragma once
#include "opengl.h" #include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
void vbo_draw(); void vbo_draw();
void cache_glActiveTexture (GLenum texture); class GLCache
void cache_glBindTexture (GLenum target, GLuint texture); {
void cache_glBlendEquation ( GLenum mode ); public:
void cache_glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); static void ResetCache(void);
void cache_glBlendFunc (GLenum sfactor, GLenum dfactor);
void cache_glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
void cache_glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void cache_glClearDepthf (GLclampf depth);
void cache_glCullFace (GLenum mode);
void cache_glDepthFunc (GLenum func);
void cache_glDepthMask (GLboolean flag);
void cache_glDepthRangef (GLclampf zNear, GLclampf zFar);
void cache_glEnableDisable (GLenum cap, bool enable);
void cache_glPolygonOffset (GLfloat factor, GLfloat units);
void cache_glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
void cache_glUseProgram (GLuint program);
void cache_glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
#define glActiveTexture(texture) cache_glActiveTexture(texture) static void glActiveTexture(GLenum texture);
#define glBindTexture(target, texture) cache_glBindTexture(target, texture) static void glBindTexture(GLenum target, GLuint texture);
#define glBlendEquation(mode) cache_glBlendEquation(mode) static void glBlendEquation(GLenum mode);
#define glBlendEquationSeparate(modeRGB, modeAlpha) cache_glBlendEquationSeparate(modeRGB, modeAlpha) static void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
#define glBlendFunc(sfactor, dfactor) cache_glBlendFunc(sfactor, dfactor) static void glBlendFunc(GLenum sfactor, GLenum dfactor);
#define glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha) cache_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha) static void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
#define glClearColor(red, green, blue, alpha) cache_glClearColor(red, green, blue, alpha) static void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
#define glClearDepthf(depth) cache_glClearDepthf(depth) static void glClearDepthf(GLclampf depth);
#define glCullFace(mode) cache_glCullFace(mode) static void glCullFace(GLenum mode);
#define glDepthFunc(func) cache_glDepthFunc(func) static void glDepthFunc(GLenum func);
#define glDepthMask(flag) cache_glDepthMask(flag) static void glDepthMask(GLboolean flag);
#define glDepthRangef(zNear, zFar) cache_glDepthRangef(zNear, zFar) static void glDepthRangef(GLclampf zNear, GLclampf zFar);
#define glDisable(cap) cache_glEnableDisable(cap, false) static void glEnableDisable(GLenum cap, bool enable);
#define glEnable(cap) cache_glEnableDisable(cap, true) static void glPolygonOffset(GLfloat factor, GLfloat units);
#define glFrontFace(mode) cache_glFrontFace(mode) static void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
#define glPolygonOffset(factor, units) cache_glPolygonOffset(factor, units) static void glUseProgram(GLuint program);
#define glScissor(x, y, width, height) cache_glScissor(x, y, width, height) static void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
#define glUseProgram(program) cache_glUseProgram(program) static void glFrontFace(GLenum mode);
#define glViewport(x, y, width, height) cache_glViewport(x, y, width, height)
private:
static void glEnableDisableItem(GLenum cap, bool enable, bool & cached_state, const char * StateName);
static GLenum m_cached_texture;
static GLenum m_cached_mode;
static GLenum m_cached_modeRGB;
static GLenum m_cached_modeAlpha;
static GLenum m_cached_sfactor;
static GLenum m_cached_dfactor;
static GLenum m_cached_BlendFuncSeparate_srcRGB;
static GLenum m_cached_BlendFuncSeparate_dstRGB;
static GLenum m_cached_BlendFuncSeparate_srcAlpha;
static GLenum m_cached_BlendFuncSeparate_dstAlpha;
static GLclampf m_cached_depth;
static GLenum m_cached_CullFace_mode;
static GLenum m_cached_func;
static GLboolean m_cached_DepthMask_flag;
static GLclampf m_cached_zNear;
static GLclampf m_cached_zFar;
static bool m_cached_BLEND;
static bool m_cached_CULL_FACE;
static bool m_cached_DEPTH_TEST;
static bool m_cached_DITHER;
static bool m_cached_POLYGON_OFFSET_FILL;
static bool m_cached_SAMPLE_ALPHA_TO_COVERAGE;
static bool m_cached_SAMPLE_COVERAGE;
static bool m_cached_SCISSOR_TEST;
static bool m_cached_STENCIL_TEST;
static GLenum m_cached_FrontFace_mode;
static GLfloat m_cached_factor;
static GLfloat m_cached_units;
static GLclampf m_cached_red, m_cached_green, m_cached_blue, m_cached_alpha;
static GLint m_cached_x, m_cached_y;
static GLsizei m_cached_width, m_cached_height;
static GLuint m_cached_program;
static GLint m_Viewport_cached_x, m_Viewport_cached_y;
static GLsizei m_Viewport_cached_width, m_Viewport_cached_height;
};
#define glActiveTexture(texture) GLCache::glActiveTexture(texture)
#define glBindTexture(target, texture) GLCache::glBindTexture(target, texture)
#define glBlendEquation(mode) GLCache::glBlendEquation(mode)
#define glBlendEquationSeparate(modeRGB, modeAlpha) GLCache::glBlendEquationSeparate(modeRGB, modeAlpha)
#define glBlendFunc(sfactor, dfactor) GLCache::glBlendFunc(sfactor, dfactor)
#define glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha) GLCache::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha)
#define glClearColor(red, green, blue, alpha) GLCache::glClearColor(red, green, blue, alpha)
#define glClearDepthf(depth) GLCache::glClearDepthf(depth)
#define glCullFace(mode) GLCache::glCullFace(mode)
#define glDepthFunc(func) GLCache::glDepthFunc(func)
#define glDepthMask(flag) GLCache::glDepthMask(flag)
#define glDepthRangef(zNear, zFar) GLCache::glDepthRangef(zNear, zFar)
#define glDisable(cap) GLCache::glEnableDisable(cap, false)
#define glEnable(cap) GLCache::glEnableDisable(cap, true)
#define glFrontFace(mode) GLCache::glFrontFace(mode)
#define glPolygonOffset(factor, units) GLCache::glPolygonOffset(factor, units)
#define glScissor(x, y, width, height) GLCache::glScissor(x, y, width, height)
#define glUseProgram(program) GLCache::glUseProgram(program)
#define glViewport(x, y, width, height) GLCache::glViewport(x, y, width, height)

View File

@ -675,10 +675,6 @@ void CN64System::Reset(bool bInitReg, bool ClearMenory)
} }
if (m_Plugins && g_Settings->LoadBool(GameRunning_CPU_Running)) if (m_Plugins && g_Settings->LoadBool(GameRunning_CPU_Running))
{ {
if (g_Settings->LoadBool(Plugin_ForceGfxReset))
{
m_Plugins->Reset(this);
}
m_Plugins->RomClosed(); m_Plugins->RomClosed();
m_Plugins->RomOpened(); m_Plugins->RomOpened();
} }

View File

@ -326,12 +326,6 @@ bool CPlugins::Reset(CN64System * System)
bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0; bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0; bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
if (g_Settings->LoadBool(Plugin_ForceGfxReset))
{
//this is a hack and should not be here, glide64 is not correctly freeing something on restart, this needs to be fixed but this is a short term workaround
bGfxChange = true;
}
//if GFX and Audio has changed we also need to force reset of RSP //if GFX and Audio has changed we also need to force reset of RSP
if (bGfxChange || bAudioChange) if (bGfxChange || bAudioChange)
{ {

View File

@ -260,7 +260,6 @@ enum SettingID
Plugin_UseHleGfx, Plugin_UseHleGfx,
Plugin_UseHleAudio, Plugin_UseHleAudio,
Plugin_EnableAudio, Plugin_EnableAudio,
Plugin_ForceGfxReset,
Logging_GenerateLog, Logging_GenerateLog,
Logging_LogRDRamRegisters, Logging_LogRDRamRegisters,

View File

@ -357,11 +357,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX", true)); AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX", true));
AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio", false)); AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio", false));
AddHandler(Plugin_EnableAudio, new CSettingTypeApplication("Audio", "Enable Audio", true)); AddHandler(Plugin_EnableAudio, new CSettingTypeApplication("Audio", "Enable Audio", true));
#ifdef ANDROID
AddHandler(Plugin_ForceGfxReset, new CSettingTypeApplication("Plugin", "Force Gfx Reset", true));
#else
AddHandler(Plugin_ForceGfxReset, new CSettingTypeApplication("Plugin", "Force Gfx Reset", false));
#endif
//Logging //Logging
AddHandler(Logging_GenerateLog, new CSettingTypeApplication("Logging", "Generate Log Files", false)); AddHandler(Logging_GenerateLog, new CSettingTypeApplication("Logging", "Generate Log Files", false));
AddHandler(Logging_LogRDRamRegisters, new CSettingTypeApplication("Logging", "Log RDRam Registers", false)); AddHandler(Logging_LogRDRamRegisters, new CSettingTypeApplication("Logging", "Log RDRam Registers", false));