diff --git a/GPU/GLES/DepalettizeShaderGLES.cpp b/GPU/GLES/DepalettizeShaderGLES.cpp index b18ddd5876..5886df27ee 100644 --- a/GPU/GLES/DepalettizeShaderGLES.cpp +++ b/GPU/GLES/DepalettizeShaderGLES.cpp @@ -50,6 +50,7 @@ static const char *depalVShader300 = "}\n"; DepalShaderCacheGLES::DepalShaderCacheGLES(Draw::DrawContext *draw) { + _assert_(draw); render_ = (GLRenderManager *)draw->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); // Pre-build the vertex program useGL3_ = gl_extensions.GLES3 || gl_extensions.VersionGEThan(3, 3); @@ -57,9 +58,6 @@ DepalShaderCacheGLES::DepalShaderCacheGLES(Draw::DrawContext *draw) { // Use the floating point path, it just can't handle the math. useGL3_ = false; } - - vertexShaderFailed_ = false; - vertexShader_ = 0; } DepalShaderCacheGLES::~DepalShaderCacheGLES() { diff --git a/GPU/GLES/DepalettizeShaderGLES.h b/GPU/GLES/DepalettizeShaderGLES.h index e183ba22b0..c93ef87fc0 100644 --- a/GPU/GLES/DepalettizeShaderGLES.h +++ b/GPU/GLES/DepalettizeShaderGLES.h @@ -64,8 +64,8 @@ private: GLRenderManager *render_; bool useGL3_; - bool vertexShaderFailed_; - GLRShader *vertexShader_; + bool vertexShaderFailed_ = false; + GLRShader *vertexShader_ = nullptr; std::map cache_; std::map texCache_; }; diff --git a/GPU/GPU.cpp b/GPU/GPU.cpp index e7026973b4..3a4f9a921e 100644 --- a/GPU/GPU.cpp +++ b/GPU/GPU.cpp @@ -61,6 +61,7 @@ bool GPU_IsReady() { } bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) { + _assert_(draw); #if PPSSPP_PLATFORM(UWP) SetGPU(new GPU_D3D11(ctx, draw)); return true; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index fe82bf2373..91220e16b5 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -231,6 +231,7 @@ void EmuScreen::bootGame(const std::string &filename) { if (g_Config.bSoftwareRendering) { coreParam.gpuCore = GPUCORE_SOFTWARE; } + // Preserve the existing graphics context. coreParam.graphicsContext = PSP_CoreParameter().graphicsContext; coreParam.thin3d = screenManager()->getDrawContext(); diff --git a/ext/native/thin3d/GLQueueRunner.cpp b/ext/native/thin3d/GLQueueRunner.cpp index 49031eafca..fbb66b188c 100644 --- a/ext/native/thin3d/GLQueueRunner.cpp +++ b/ext/native/thin3d/GLQueueRunner.cpp @@ -66,8 +66,10 @@ void GLQueueRunner::DestroyDeviceObjects() { glDeleteVertexArrays(1, &globalVAO_); } delete[] readbackBuffer_; + readbackBuffer_ = nullptr; readbackBufferSize_ = 0; delete[] tempBuffer_; + tempBuffer_ = nullptr; tempBufferSize_ = 0; CHECK_GL_ERROR_IF_DEBUG(); } @@ -1241,7 +1243,7 @@ void GLQueueRunner::PerformReadback(const GLRStep &pass) { if (!gl_extensions.IsGLES || gl_extensions.GLES3) { glPixelStorei(GL_PACK_ROW_LENGTH, 0); } - if (convert) { + if (convert && tempBuffer_ && readbackBuffer_) { ConvertFromRGBA8888(readbackBuffer_, tempBuffer_, pixelStride, pixelStride, rect.w, rect.h, pass.readback.dstFormat); }