Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid calling any GL calls during shutdown on Android. Should help #11063 #11447

Merged
merged 2 commits into from
Oct 6, 2018

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Oct 6, 2018

Should help #11063.

The context is already lost and we're really running shutdown when the process is woken
up again. Additionally, orderly shutdown through the button doesn't happen
on the render thread so remove a couple of asserts that are wrong.

@hrydgard hrydgard added this to the v1.7.0 milestone Oct 6, 2018
Copy link
Collaborator

@unknownbrackets unknownbrackets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, it might be cleaner to just have a flag on renderManager itself stopping_ and renderManager->BeginStopping(); or something. We won't reuse it anyway.

-[Unknown]

@@ -6,7 +6,7 @@
// Utility to be able to liberally sprinkle GL error checks around your code
// and easily disable them all in release builds - just undefine DEBUG_OPENGL.

// #define DEBUG_OPENGL
#define DEBUG_OPENGL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops indeed! Fixing.

GLRTexture *tex = step.texture_image.texture;
if (step.texture_image.allocType == GLRAllocType::ALIGNED) {
FreeAlignedMemory(step.texture_image.data);
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case we merge #11425 and forget, maybe we should explicitly check allocType == NEW here?

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, ok.

}
case GLRInitStepType::CREATE_SHADER:
{
WARN_LOG(G3D, "CREATE_PROGRAM found with skipGLCalls, not good");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*SHADER

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops

switch (step.stepType) {
case GLRStepType::RENDER:
break;
// TODO
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing here is subdata with #11425, I think nothing else needs to be freed? Should we add a note?

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a note.

delete info.buffer;
} else {
_dbg_assert_(G3D, !OnRenderThread());
// _dbg_assert_(G3D, !OnRenderThread());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, okay as long as the other thread is waiting. I feel like it'd be nicer to keep the threads the same on shutdown...

Anyway, we should remove these rather than commenting them out.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit unclear to me which thread the manual shutdown (main screen button) actually runs on ... should dig into that.

…1063

The context is already lost and we're really running shutdown when the process is woken
up again. Additionally, orderly shutdown through the button doesn't happen
on the render thread so remove a couple of asserts that are wrong.
@hrydgard
Copy link
Owner Author

hrydgard commented Oct 6, 2018

Reworked as suggested, addressed comments. Thanks!

@unknownbrackets unknownbrackets merged commit 8a74e6f into master Oct 6, 2018
@hrydgard hrydgard deleted the android-gl-shutdown-fixes branch October 6, 2018 20:55
xebra added a commit to xebra/ppsspp that referenced this pull request Oct 7, 2018
LunaMoo added a commit to LunaMoo/ppsspp that referenced this pull request Nov 2, 2018
commit 0d7a5cd
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Oct 8 00:29:41 2018 +0900

    GLES: Fix to delete subimage data since hrydgard#11447.

commit 46d30d0
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Oct 2 21:13:40 2018 +0900

    [spline/bezier]minor fix

commit eca9386
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Oct 1 12:54:14 2018 +0900

    [spline/bezier]Reduce static buffers. Get rid of the spline buffer using half of the vertex buffer.

commit 5f07213
Author: xebra <xebra.zebra@gmail.com>
Date:   Sun Sep 30 17:10:58 2018 +0900

    [spline/bezier]minor fix

commit 5f9022a
Author: xebra <xebra.zebra@gmail.com>
Date:   Sun Sep 30 11:07:28 2018 +0900

    [spline/bezier]minor fix

commit 405ead8
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Sep 29 18:04:32 2018 +0900

    [spline/bezier]Get rid of duplication call of Flush().

commit ef53195
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Sep 29 13:39:02 2018 +0900

    [spline/bezier]Surround with namespace Spline.

commit 1dfb402
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Sep 29 01:15:38 2018 +0900

    [spline/bezier]Remove comment.

commit 10afcf2
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Sep 27 20:57:30 2018 +0900

    [spline/bezier]Improve basic spline/bezier structures.

commit 8ad38df
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Sep 24 20:12:28 2018 +0900

    [spline/bezier]oops

commit c49d9e2
Author: xebra <xebra.zebra@gmail.com>
Date:   Sun Sep 23 14:24:23 2018 +0900

    [spline/bezier]minor fix(referenced to c1f0e98).

commit 41823f8
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Sep 22 22:06:40 2018 +0900

    [spline/bezier]Fix GLES texture resolution of HW tess to real 2D to avoid huge width in FF4CC mist dragon morphing.

commit 89786b9
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Sep 22 19:20:30 2018 +0900

    [spline/bezier]Instanced rendering for B-Spline is very slow when using weak GPU, so disabled it and simplify the shaders.
    Add changing the quality of HW tessellation.

commit d98fa06
Author: xebra <xebra.zebra@gmail.com>
Date:   Fri Aug 31 20:10:02 2018 +0900

    [spline/bezier]Fix to build for Android(clang).

commit 019e276
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Aug 9 19:29:19 2018 +0900

    [spline/bezier]Modify ControlPoints and fix VertexPreview.

commit 1c604d5
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jul 31 04:12:12 2018 +0900

    [spline/bezier]Put the control points stuffs all in one structure.

commit 6683351
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Jul 30 19:36:41 2018 +0900

    [spline/bezier]Modify the weights cache variables to a template variable.

commit 62aaf63
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Jul 23 23:11:58 2018 +0900

    Math3D: Something wrong with hand simd optimization in vec2<float>, so it causes very slow down.
    However, compiler optimization is faster enough, so removed it.

commit c4a8d80
Author: xebra <xebra.zebra@gmail.com>
Date:   Sun Jul 22 11:22:17 2018 +0900

    [spline/bezier]Put the output buffers all in one structure.

commit a241058
Author: xebra <xebra.zebra@gmail.com>
Date:   Sun Jul 22 01:11:23 2018 +0900

    [spline/bezier]Improve TemplateParameterDispatcher class macro to a real class.

commit 98ddefb
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Jul 21 23:00:28 2018 +0900

    [spline/bezier]Extract an if-check in the hot loops to the template parameter.

commit 3216a83
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Jul 21 19:46:14 2018 +0900

    [spline/bezier]Expand loops in the shaders.

commit 8c279c0
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Jul 21 17:01:03 2018 +0900

    [spline/bezier]Precalculate weights in the shaders using the outer product.

commit 03b9492
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Jul 21 00:18:34 2018 +0900

    [spline/bezier]Sharing textures to avoid heavily textures creation/deletion in one frame. At least, it occurs about 1000 and very slow down in Pursuit Force.

commit 453e274
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jul 18 00:52:20 2018 +0900

    [spline/bezier]Fix around vertex type flags.

commit d4a6673
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Jul 14 09:40:13 2018 +0900

    [spline/bezier]Improve shader uniforms a bit.

commit de5975f
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Jul 14 06:40:50 2018 +0900

    [spline/bezier]Reduce multiplications in the shaders from 16 to 4.

commit 103d180
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Jul 14 00:14:19 2018 +0900

    [spline/bezier]Get rid of wasted if-checks at Graphics Processors.

commit 41d6c3c
Author: xebra <xebra.zebra@gmail.com>
Date:   Fri Jul 13 23:36:36 2018 +0900

    [spline/bezier]Move whole tessellation logic in the shaders into a subroutine.

commit 3d07bca
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Feb 12 00:50:21 2018 +0900

    [spline/bezier]Fix spline weights calculation and get rid of using next patch position in hwtess.

    # Conflicts:
    #	GPU/Directx9/VertexShaderGeneratorDX9.cpp
    #	GPU/GLES/VertexShaderGeneratorGLES.cpp
    #	GPU/Vulkan/VertexShaderGeneratorVulkan.cpp

commit a48a5b3
Author: xebra <xebra.zebra@gmail.com>
Date:   Fri Jul 13 18:35:44 2018 +0900

    [spline/bezier]Unify hardware tessellation of bezier and spline.

commit 3c0fb44
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jul 11 01:09:20 2018 +0900

    [spline/bezier]Improve hwtess to use cached weights.

commit e5976f5
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Feb 5 01:47:58 2018 +0900

    [spline/bezier]Unify software tessellation of bezier and spline.

    # Conflicts:
    #	GPU/Common/SplineCommon.cpp

commit 1b076f8
Author: xebra <xebra.zebra@gmail.com>
Date:   Sat Jun 30 00:21:30 2018 +0900

    [spline/bezier]Improve HW tess on Opengl to combine 3 textures into a single texture and use it.

commit 3add123
Author: xebra <xebra.zebra@gmail.com>
Date:   Fri Jun 29 23:50:07 2018 +0900

    thin3d: Add support for texture subimage to GLRender.

commit 0cb6331
Author: xebra <xebra.zebra@gmail.com>
Date:   Fri Jun 29 00:51:31 2018 +0900

    [spline/bezier]Fix to build for GE debugger.

commit 7d45078
Author: xebra <xebra.zebra@gmail.com>
Date:   Fri Jun 29 00:26:23 2018 +0900

    [spline/bezier]minor cleanup

commit 24123e6
Author: xebra <xebra.zebra@gmail.com>
Date:   Fri Feb 2 17:36:02 2018 +0900

    [spline/bezier]Fix about quality.

commit da1176f
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 20:33:17 2018 +0900

    [spline/bezier]Improve template parameter dispatch method.

    # Conflicts:
    #	GPU/Common/SplineCommon.h

commit f7ac708
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 15:09:41 2018 +0900

    [spline/bezier]Improve spline tessellation using same as bezier tessellation method.(performance improvements, at least 10 FPS or more)

commit b11f9e6
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 14:09:02 2018 +0900

    [spline/bezier]Fix normal generation flag and some minor stuffs.

commit ca4e246
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 13:37:53 2018 +0900

    [spline/bezier]Improve tessellator more generic.

commit 07888d7
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 12:27:29 2018 +0900

    [spline/bezier]Improve bezier tesselator more.

commit f12d796
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 12:02:03 2018 +0900

    [spline/bezier]minor cleanup

commit 3069153
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 11:51:58 2018 +0900

    [spline/bezier]Fix bezier texcoord generation.

commit 4c6098d
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 11:46:46 2018 +0900

    [spline/bezier]Improve bezier tessellator more.

commit 068cc37
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Feb 1 11:21:58 2018 +0900

    [spline/bezier]Improve bezier tessellator.

commit 1e84a62
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 21:42:39 2018 +0900

    [spline/bezier]Implement weights cache system.

commit 15b409a
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 20:59:41 2018 +0900

    [spline/bezier]Make a spline weights calculation class and precalculate all spline weights at the beginning.

commit 0c96804
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 20:25:07 2018 +0900

    [spline/bezier]minor fix

commit 1b9af84
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 20:24:00 2018 +0900

    [spline/bezier]minor fix

commit 2a3210a
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 20:18:47 2018 +0900

    [spline/bezier]Make a bezier weights calculation class and precalculate all bezier weights at the beginning.

commit 3aeb320
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 19:25:43 2018 +0900

    [spline/bezier]Improve bezier weights calculation.

commit a340390
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 18:39:43 2018 +0900

    [spline/bezier]Move bezier patch loops into the function and pre-convert control-points.

commit d0682d7
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 16:38:11 2018 +0900

    [spline/bezier]Move SIMD optimization of vector operations to Math3D.h.
    Needs rebuild to avoid a dialog confirmation on Visual Studio.

commit c8e45ae
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 12:44:05 2018 +0900

    [spline/bezier]Use real tessellation in low-quality with "fixed to 2" tessellation factor.

    # Conflicts:
    #	GPU/Common/SplineCommon.cpp

commit 36ed61d
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 11:34:37 2018 +0900

    [spline/bezier]Pre-convert control-points for the accumulation of SIMD optimization, and avoid conversion in hot loops.

    # Conflicts:
    #	GPU/Common/SplineCommon.cpp
    #	GPU/Common/SplineCommon.h

commit 62ad5fe
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jan 31 09:03:13 2018 +0900

    Fix namespace Vec2f.

commit 15a11d5
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 18:17:54 2018 +0900

    Modify IndexConverter class to functor.

commit d8ccc1c
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 18:10:11 2018 +0900

    [spline/bezier]minor fix

commit 30c3c87
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 17:42:41 2018 +0900

    [spline/bezier]Make a function to build indices.

commit 7cbc97f
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 16:24:42 2018 +0900

    [spline/bezier]minor cleanup

commit 966ff32
Author: xebra <xebra.zebra@gmail.com>
Date:   Thu Jun 28 01:41:16 2018 +0900

    [spline/bezier]Improve the logic of copying control-points.

commit 485260c
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 16:16:25 2018 +0900

    [spline/bezier]Make a function to copy control points.

commit b1289cd
Author: xebra <xebra.zebra@gmail.com>
Date:   Wed Jun 27 23:37:21 2018 +0900

    [spline/bezier]minor fix

commit 3c2837b
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 14:56:21 2018 +0900

    [spline/bezier]minor fix

commit a7754c4
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 14:53:03 2018 +0900

    [spline/bezier]minor fix

    # Conflicts:
    #	GPU/Common/SplineCommon.cpp

commit 1d4e8cc
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 14:41:39 2018 +0900

    [spline/bezier]minor fix

commit 28a5005
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 11:26:32 2018 +0900

    [spline/bezier]minor fix

commit a4860b6
Author: xebra <xebra.zebra@gmail.com>
Date:   Tue Jan 30 10:31:48 2018 +0900

    [spline/bezier]Managing buffer allocation.

    # Conflicts:
    #	GPU/Common/SplineCommon.cpp

commit a9ac860
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Jan 29 19:24:42 2018 +0900

    [spline/bezier]Add spline derivative calculation for normal generation.

commit 5c7284f
Author: xebra <xebra.zebra@gmail.com>
Date:   Mon Jan 29 18:25:38 2018 +0900

    [spline/bezier]Get rid of divisions in spline weights calculation.

# Conflicts:
#	UI/GameSettingsScreen.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants