Attempt to fix the last very common issue of #11493 by being paranoid

This commit is contained in:
Henrik Rydgård 2018-11-21 22:15:01 +01:00
parent 7af93d08cf
commit 0fd5d10ab8
5 changed files with 8 additions and 6 deletions

View File

@ -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() {

View File

@ -64,8 +64,8 @@ private:
GLRenderManager *render_;
bool useGL3_;
bool vertexShaderFailed_;
GLRShader *vertexShader_;
bool vertexShaderFailed_ = false;
GLRShader *vertexShader_ = nullptr;
std::map<u32, DepalShader *> cache_;
std::map<u32, DepalTexture *> texCache_;
};

View File

@ -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;

View File

@ -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();

View File

@ -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();
}
@ -1200,7 +1202,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);
}