Skip to content

Commit

Permalink
Android: Fix Vulkan immersive startup.
Browse files Browse the repository at this point in the history
Would commonly not actually start with immersive resolution due to race
conditions in setting the resolution and ui visibility.
  • Loading branch information
unknownbrackets committed Oct 7, 2018
1 parent 9cb471e commit 5a5483c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion UI/NativeApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ static UI::Theme ui_theme;
ScreenManager *screenManager;
std::string config_filename;

bool g_graphicsIniting;
bool g_graphicsInited;

// Really need to clean this mess of globals up... but instead I add more :P
Expand Down Expand Up @@ -743,6 +744,7 @@ static void UIThemeInit() {
void RenderOverlays(UIContext *dc, void *userdata);

bool NativeInitGraphics(GraphicsContext *graphicsContext) {
g_graphicsIniting = true;
ILOG("NativeInitGraphics");
_assert_msg_(G3D, graphicsContext, "No graphics context!");

Expand Down Expand Up @@ -819,6 +821,7 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
gpu->DeviceRestore();

g_graphicsInited = true;
g_graphicsIniting = false;
ILOG("NativeInitGraphics completed");
return true;
}
Expand Down Expand Up @@ -1240,7 +1243,7 @@ void NativeMessageReceived(const char *message, const char *value) {

void NativeResized() {
// NativeResized can come from any thread so we just set a flag, then process it later.
if (g_graphicsInited) {
if (g_graphicsInited || g_graphicsIniting) {
resized = true;
} else {
ILOG("NativeResized ignored, not initialized");
Expand Down
5 changes: 5 additions & 0 deletions android/src/org/ppsspp/ppsspp/NativeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ public void surfaceCreated(SurfaceHolder holder) {
// Note that desiredSize might be 0,0 here - but that's fine when calling setFixedSize! It means auto.
Log.d(TAG, "Setting fixed size " + desiredSize.x + " x " + desiredSize.y);
holder.setFixedSize(desiredSize.x, desiredSize.y);

// This may change it - but, since we're visible now, we can actually set this.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
updateSystemUiVisibility();
}
}

@Override
Expand Down

0 comments on commit 5a5483c

Please sign in to comment.