Minor cleanups

This commit is contained in:
Henrik Rydgård 2018-02-04 13:04:21 +01:00
parent 85446d6c51
commit 99386da01e
5 changed files with 22 additions and 13 deletions

View file

@ -126,3 +126,17 @@ int SDLGLGraphicsContext::Init(SDL_Window *&window, int x, int y, int mode, std:
window_ = window;
return 0;
}
void SDLGLGraphicsContext::Shutdown() {
}
void SDLGLGraphicsContext::ShutdownFromRenderThread() {
delete draw_;
draw_ = nullptr;
#ifdef USING_EGL
EGL_Close();
#else
SDL_GL_DeleteContext(glContext);
#endif
}

View file

@ -11,20 +11,12 @@ class SDLGLGraphicsContext : public DummyGraphicsContext {
public:
SDLGLGraphicsContext() {
}
~SDLGLGraphicsContext() {
delete draw_;
}
// Returns 0 on success.
int Init(SDL_Window *&window, int x, int y, int mode, std::string *error_message);
void Shutdown() override {
#ifdef USING_EGL
EGL_Close();
#else
SDL_GL_DeleteContext(glContext);
#endif
}
void Shutdown() override;
void ShutdownFromRenderThread() override;
void SwapBuffers() override {
renderManager_->Swap();

View file

@ -54,7 +54,7 @@ GLRenderManager::GLRenderManager() {
GLRenderManager::~GLRenderManager() {
for (int i = 0; i < MAX_INFLIGHT_FRAMES; i++) {
// _assert_(frameData_[i].deleter.IsEmpty());
}
if (!useThread_) {

View file

@ -194,6 +194,9 @@ public:
int semanticsMask_ = 0;
};
// Note: The GLRenderManager is created and destroyed on the render thread, and the latter
// happens after the emu thread has been destroyed. Therefore, it's safe to run wild deleting stuff
// directly in the destructor.
class GLRenderManager {
public:
GLRenderManager();