Add render depth to available options to provide fps boost

This commit is contained in:
TwistedUmbrella 2014-02-16 20:57:28 -05:00
parent da7c82c02d
commit 65c1b947a4
7 changed files with 69 additions and 28 deletions

View File

@ -238,6 +238,35 @@
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/depth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ems="10"
android:gravity="center_vertical|left"
android:text="@string/select_depth" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<Spinner
android:id="@+id/depth_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginTop="10dp"
android:gravity="center_vertical" >

View File

@ -29,6 +29,7 @@
<string name="select_fps">Show OnScreen FPS</string>
<string name="select_software">Force Software Rendering</string>
<string name="select_sound">Enable Emulator Sound</string>
<string name="select_depth">Rendering Depth</string>
<string name="select_force_gpu">Force v6 GPU Config</string>
<string name="default_disk">Set Default Disk</string>
@ -79,6 +80,12 @@
<item>Controller C</item>
<item>Controller D</item>
</string-array>
<string-array name="depth">
<item>16</item>
<item>24</item>
<item>32</item>
</string-array>
<string-array name="images">
<item>cdi</item>

View File

@ -81,7 +81,6 @@ public class MainActivity extends SlidingFragmentActivity implements
} else {
loadInterface(savedInstanceState);
}
}
private void loadInterface(Bundle savedInstanceState) {

View File

@ -318,6 +318,36 @@ public class ConfigureFragment extends Fragment {
int count) {
}
});
String[] depths = parentActivity.getResources().getStringArray(
R.array.depth);
Spinner depth_spnr = (Spinner) getView().findViewById(
R.id.depth_spinner);
ArrayAdapter<String> depthAdapter = new ArrayAdapter<String>(
parentActivity, android.R.layout.simple_spinner_item, depths);
depthAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
depth_spnr.setAdapter(depthAdapter);
String depth = String.valueOf(mPrefs.getInt("depth_render", 24));
depth_spnr.setSelection(depthAdapter.getPosition(depth), true);
depth_spnr.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id) {
int render = Integer.valueOf(parent.getItemAtPosition(pos)
.toString());
mPrefs.edit().putInt("depth_render", render).commit();
}
public void onNothingSelected(AdapterView<?> arg0) {
}
});
}
public void generateErrorLog() {

View File

@ -272,7 +272,7 @@ public class GL2JNIActivity extends Activity {
fileName = Uri.decode(intent.getData().toString());
// Create the actual GLES view
mView = new GL2JNIView(getApplication(), fileName, false, 24, 0, false);
mView = new GL2JNIView(getApplication(), fileName, false, prefs.getInt("depth_render", 24), 0, false);
setContentView(mView);
String menu_spec;

View File

@ -606,7 +606,7 @@ private static class ContextFactory implements GLSurfaceView.EGLContextFactory
EGL10.EGL_GREEN_SIZE, 4,
EGL10.EGL_BLUE_SIZE, 4,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_DEPTH_SIZE, 24,
EGL10.EGL_DEPTH_SIZE, 16,
EGL10.EGL_NONE
};
@ -660,30 +660,6 @@ private static class ContextFactory implements GLSurfaceView.EGLContextFactory
return(null);
}
private boolean checkGLSupport(int renderableType)
{
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int[] version = new int[2];
egl.eglInitialize(display, version);
int[] configAttribs =
{
EGL10.EGL_RED_SIZE, 4,
EGL10.EGL_GREEN_SIZE, 4,
EGL10.EGL_BLUE_SIZE, 4,
EGL10.EGL_RENDERABLE_TYPE, renderableType,
EGL10.EGL_NONE
};
EGLConfig[] configs = new EGLConfig[10];
int[] num_config = new int[1];
egl.eglChooseConfig(display, configAttribs, configs, 10, num_config);
egl.eglTerminate(display);
return num_config[0] > 0;
}
private int findConfigAttrib(EGL10 egl,EGLDisplay display,EGLConfig config,int attribute,int defaultValue)
{

View File

@ -93,7 +93,7 @@ public class GLCFactory6 {
EGL14.EGL_GREEN_SIZE, 4,
EGL14.EGL_BLUE_SIZE, 4,
EGL14.EGL_RENDERABLE_TYPE, renderableType,
EGL14.EGL_DEPTH_SIZE, 24,
EGL14.EGL_DEPTH_SIZE, 16,
EGL14.EGL_NONE
};