Persist GL information from context so we can write to crash log

This commit is contained in:
Aaron Culliney 2015-10-23 00:02:12 -07:00
parent 42a2fac420
commit 42c4248a89
3 changed files with 41 additions and 4 deletions

View File

@ -15,7 +15,6 @@ import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.opengl.GLES20;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
@ -203,9 +202,9 @@ public class Apple2CrashHandler {
allCrashData.append("SAMPLE RATE: ").append(sampleRate).append("\n");
allCrashData.append("MONO BUFSIZE: ").append(monoBufferSize).append("\n");
allCrashData.append("STEREO BUFSIZE: ").append(stereoBufferSize).append("\n");
allCrashData.append("GPU VENDOR: ").append(GLES20.glGetString(GLES20.GL_VENDOR)).append("\n");
allCrashData.append("GPU RENDERER: ").append(GLES20.glGetString(GLES20.GL_RENDERER)).append("\n");
allCrashData.append("GPU VERSION: ").append(GLES20.glGetString(GLES20.GL_VERSION)).append("\n");
allCrashData.append("GPU VENDOR: ").append(Apple2Preferences.GL_VENDOR.stringValue(activity)).append("\n");
allCrashData.append("GPU RENDERER: ").append(Apple2Preferences.GL_RENDERER.stringValue(activity)).append("\n");
allCrashData.append("GPU VERSION: ").append(Apple2Preferences.GL_VERSION.stringValue(activity)).append("\n");
File[] nativeCrashes = _nativeCrashFiles(activity);
if (nativeCrashes == null) {

View File

@ -595,8 +595,42 @@ public enum Apple2Preferences {
public boolean booleanValue(Apple2Activity activity) {
return activity.getPreferences(Context.MODE_PRIVATE).getBoolean(toString(), true);
}
},
GL_VENDOR {
@Override
public void load(Apple2Activity activity) {
/* ... */
}
@Override
public String stringValue(Apple2Activity activity) {
return activity.getPreferences(Context.MODE_PRIVATE).getString(toString(), "");
}
},
GL_RENDERER {
@Override
public void load(Apple2Activity activity) {
/* ... */
}
@Override
public String stringValue(Apple2Activity activity) {
return activity.getPreferences(Context.MODE_PRIVATE).getString(toString(), "");
}
},
GL_VERSION {
@Override
public void load(Apple2Activity activity) {
/* ... */
}
@Override
public String stringValue(Apple2Activity activity) {
return activity.getPreferences(Context.MODE_PRIVATE).getString(toString(), "");
}
};
public enum HiresColor {
BW,
COLOR,

View File

@ -16,6 +16,7 @@
package org.deadc0de.apple2ix;
import android.graphics.PixelFormat;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.util.Log;
@ -299,6 +300,9 @@ class Apple2View extends GLSurfaceView {
}
public void onSurfaceChanged(GL10 gl, int width, int height) {
Apple2Preferences.GL_VENDOR.saveString(mActivity, GLES20.glGetString(GLES20.GL_VENDOR));
Apple2Preferences.GL_RENDERER.saveString(mActivity, GLES20.glGetString(GLES20.GL_RENDERER));
Apple2Preferences.GL_VERSION.saveString(mActivity, GLES20.glGetString(GLES20.GL_VERSION));
Apple2View.this.mActivity.graphicsInitialized(width, height);
}