mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Not using a GL config chooser seems to be the way to go, really, and was the way we used before the EGL attempt.
This commit is contained in:
parent
4c0e6d0138
commit
92c6810954
@ -411,7 +411,7 @@ static int DefaultAndroidHwScale() {
|
||||
int xres = System_GetPropertyInt(SYSPROP_DISPLAY_XRES);
|
||||
int yres = System_GetPropertyInt(SYSPROP_DISPLAY_YRES);
|
||||
|
||||
if (xres < 960) {
|
||||
if (xres <= 960) {
|
||||
// Smaller than the PSP*2, let's go native.
|
||||
return 0;
|
||||
} else if (xres <= 480 * 3) { // 720p xres
|
||||
|
@ -193,6 +193,8 @@ void GameSettingsScreen::CreateViews() {
|
||||
#ifdef ANDROID
|
||||
static const char *deviceResolutions[] = { "Native device resolution", "Auto (same as Rendering)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" };
|
||||
int max_res_temp = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)) / 480 + 2;
|
||||
if (max_res_temp == 3)
|
||||
max_res_temp = 4; // At least allow 2x
|
||||
int max_res = std::min(max_res_temp, (int)ARRAY_SIZE(deviceResolutions));
|
||||
UI::PopupMultiChoice *hwscale = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAndroidHwScale, gr->T("Display Resolution (HW scaler)"), deviceResolutions, 0, max_res, gr->GetName(), screenManager()));
|
||||
hwscale->OnChoice.Handle(this, &GameSettingsScreen::OnHwScaleChange); // To refresh the display mode
|
||||
|
@ -396,7 +396,8 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
|
||||
sz.y = NativeApp.getDesiredBackbufferHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
shuttingDown = false;
|
||||
@ -452,13 +453,8 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
|
||||
if (Build.MANUFACTURER == "OUYA") {
|
||||
mGLSurfaceView.getHolder().setFormat(PixelFormat.RGBX_8888);
|
||||
mGLSurfaceView.setEGLConfigChooser(new NativeEGLConfigChooser());
|
||||
} else {
|
||||
// Many devices require that we set a config chooser, despite the documentation
|
||||
// explicitly stating: "If no setEGLConfigChooser method is called, then by default the view will choose an RGB_888 surface with a depth buffer depth of at least 16 bits."
|
||||
// On these devices, I get these crashes: http://stackoverflow.com/questions/14167319/android-opengl-demo-no-config-chosen
|
||||
// So let's try it...
|
||||
mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 8);
|
||||
}
|
||||
// Tried to mess around with config choosers here but fail completely on Xperia Play.
|
||||
|
||||
mGLSurfaceView.setRenderer(nativeRenderer);
|
||||
setContentView(mGLSurfaceView);
|
||||
|
@ -4,6 +4,7 @@ import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
|
||||
import android.graphics.PixelFormat;
|
||||
import android.opengl.GLSurfaceView.EGLConfigChooser;
|
||||
import android.util.Log;
|
||||
|
||||
@ -12,6 +13,9 @@ public class NativeEGLConfigChooser implements EGLConfigChooser {
|
||||
|
||||
private static final int EGL_OPENGL_ES2_BIT = 4;
|
||||
|
||||
NativeEGLConfigChooser() {
|
||||
}
|
||||
|
||||
private class ConfigAttribs {
|
||||
EGLConfig config;
|
||||
public int red;
|
||||
@ -60,6 +64,7 @@ public class NativeEGLConfigChooser implements EGLConfigChooser {
|
||||
return attr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
|
||||
// The absolute minimum. We will do our best to choose a better config though.
|
||||
int[] configSpec = {
|
||||
@ -70,6 +75,7 @@ public class NativeEGLConfigChooser implements EGLConfigChooser {
|
||||
EGL10.EGL_STENCIL_SIZE, 0,
|
||||
EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT,
|
||||
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
// EGL10.EGL_TRANSPARENT_TYPE, EGL10.EGL_NONE
|
||||
EGL10.EGL_NONE
|
||||
};
|
||||
|
||||
@ -98,8 +104,10 @@ public class NativeEGLConfigChooser implements EGLConfigChooser {
|
||||
configs[i].Log();
|
||||
}
|
||||
|
||||
|
||||
// We now ignore destination alpha as a workaround for the Mali issue
|
||||
// where we get badly composited if we use it.
|
||||
// Though, that may be possible to fix by using EGL10.EGL_TRANSPARENT_TYPE, EGL10.EGL_NONE.
|
||||
|
||||
// First, find our ideal configuration. Prefer depth.
|
||||
for (int i = 0; i < configs.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user