Minor cleanups

This commit is contained in:
Henrik Rydgård committed 2018-02-04 13:42:04 +01:00
1 parent 85446d6c51
commit 99386da01e
5 files changed
+22 -13

No files matched your search

+14
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
}
+2 -10
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();
+1 -1
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_) {
+3
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();
+2 -2
View File
@@ -477,7 +477,7 @@ private:
OpenGLTexture *boundTextures_[8]{};
int maxTextures_ = 0;
DeviceCaps caps_{};
// Bound state
OpenGLPipeline *curPipeline_ = nullptr;
OpenGLBuffer *curVBuffers_[4]{};
@@ -519,7 +519,7 @@ OpenGLContext::OpenGLContext() {
default:
caps_.vendor = GPUVendor::VENDOR_UNKNOWN;
break;
}
}
for (int i = 0; i < GLRenderManager::MAX_INFLIGHT_FRAMES; i++) {
frameData_[i].push = new GLPushBuffer(&renderManager_, GL_ARRAY_BUFFER, 64 * 1024);
renderManager_.RegisterPushBuffer(i, frameData_[i].push);