Merge pull request #11084 from hrydgard/crash-fix-attempts-1.6

Various fixes for 1.6.1
This commit is contained in:
Henrik Rydgård 2018-05-27 23:27:57 +02:00 committed by GitHub
commit 87beddc393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 21 deletions

View File

@ -2086,7 +2086,7 @@ static u32 sceIoPollAsync(int id, u32 address) {
FileNode *f = __IoGetFd(id, error);
if (f) {
if (f->pendingAsyncResult) {
DEBUG_LOG(SCEIO, "%lli = sceIoPollAsync(%i, %08x): not ready", f->asyncResult, id, address);
VERBOSE_LOG(SCEIO, "%lli = sceIoPollAsync(%i, %08x): not ready", f->asyncResult, id, address);
return 1;
} else if (f->hasAsyncResult) {
DEBUG_LOG(SCEIO, "%lli = sceIoPollAsync(%i, %08x)", f->asyncResult, id, address);

View File

@ -342,7 +342,8 @@ static u32 sceUmdGetDriveStat()
}
//u32 retVal = PSP_UMD_INITED | PSP_UMD_READY | PSP_UMD_PRESENT;
u32 retVal = __KernelUmdGetState();
DEBUG_LOG(SCEIO,"0x%02x=sceUmdGetDriveStat()", retVal);
// This one can be very spammy.
VERBOSE_LOG(SCEIO,"0x%02x=sceUmdGetDriveStat()", retVal);
return retVal;
}

View File

@ -103,15 +103,17 @@ void DrawEngineGLES::DeviceLost() {
DestroyDeviceObjects();
}
void DrawEngineGLES::DeviceRestore() {
void DrawEngineGLES::DeviceRestore(Draw::DrawContext *draw) {
draw_ = draw;
InitDeviceObjects();
}
void DrawEngineGLES::InitDeviceObjects() {
_assert_msg_(G3D, render_ != nullptr, "Render manager must be set");
for (int i = 0; i < GLRenderManager::MAX_INFLIGHT_FRAMES; i++) {
frameData_[i].pushVertex = render_->CreatePushBuffer(i, GL_ARRAY_BUFFER, 1024 * 1024);
frameData_[i].pushIndex = render_->CreatePushBuffer(i, GL_ELEMENT_ARRAY_BUFFER, 256 * 1024);
}
int vertexSize = sizeof(TransformedVertex);
@ -129,8 +131,10 @@ void DrawEngineGLES::DestroyDeviceObjects() {
if (!frameData_[i].pushVertex && !frameData_[i].pushIndex)
continue;
render_->DeletePushBuffer(frameData_[i].pushVertex);
render_->DeletePushBuffer(frameData_[i].pushIndex);
if (frameData_[i].pushVertex)
render_->DeletePushBuffer(frameData_[i].pushVertex);
if (frameData_[i].pushIndex)
render_->DeletePushBuffer(frameData_[i].pushIndex);
frameData_[i].pushVertex = nullptr;
frameData_[i].pushIndex = nullptr;
}

View File

@ -130,7 +130,7 @@ public:
}
void DeviceLost();
void DeviceRestore();
void DeviceRestore(Draw::DrawContext *draw);
void ClearTrackedVertexArrays() override;
void DecimateTrackedVertexArrays();

View File

@ -351,7 +351,7 @@ void GPU_GLES::DeviceRestore() {
textureCacheGL_->DeviceRestore(draw_);
framebufferManagerGL_->DeviceRestore(draw_);
drawEngine_.DeviceRestore();
drawEngine_.DeviceRestore(draw_);
}
void GPU_GLES::Reinitialize() {

View File

@ -856,13 +856,16 @@ public:
// PIC1 is the loading image, so let's only draw if it's available.
if (ginfo && ginfo->pic1.texture) {
dc.GetDrawContext()->BindTexture(0, ginfo->pic1.texture->GetTexture());
Draw::Texture *texture = ginfo->pic1.texture->GetTexture();
if (texture) {
dc.GetDrawContext()->BindTexture(0, texture);
double loadTime = ginfo->pic1.timeLoaded;
uint32_t color = alphaMul(color_, ease((time_now_d() - loadTime) * 3));
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, color);
dc.Flush();
dc.RebindTexture();
double loadTime = ginfo->pic1.timeLoaded;
uint32_t color = alphaMul(color_, ease((time_now_d() - loadTime) * 3));
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, color);
dc.Flush();
dc.RebindTexture();
}
}
}
@ -1154,6 +1157,8 @@ void EmuScreen::render() {
using namespace Draw;
DrawContext *thin3d = screenManager()->getDrawContext();
if (!thin3d)
return; // shouldn't really happen but I've seen a suspicious stack trace..
if (invalid_) {
// Loading, or after shutdown?

View File

@ -1004,6 +1004,11 @@ void NativeUpdate() {
}
bool NativeIsAtTopLevel() {
// This might need some synchronization?
if (!screenManager) {
ELOG("No screen manager active");
return false;
}
Screen *currentScreen = screenManager->topScreen();
if (currentScreen) {
bool top = currentScreen->isTopLevel();

View File

@ -323,6 +323,8 @@ bool System_GetPropertyBool(SystemProperty prop) {
}
std::string GetJavaString(JNIEnv *env, jstring jstr) {
if (!jstr)
return "";
const char *str = env->GetStringUTFChars(jstr, 0);
std::string cpp_string = std::string(str);
env->ReleaseStringUTFChars(jstr, str);
@ -397,7 +399,9 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init
langRegion = GetJavaString(env, jlangRegion);
std::string externalDir = GetJavaString(env, jexternalDir);
std::string user_data_path = GetJavaString(env, jdataDir) + "/";
std::string user_data_path = GetJavaString(env, jdataDir);
if (user_data_path.size() > 0)
user_data_path += "/";
library_path = GetJavaString(env, jlibraryDir) + "/";
std::string shortcut_param = GetJavaString(env, jshortcutParam);
std::string cacheDir = GetJavaString(env, jcacheDir);
@ -650,7 +654,8 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayRender(JNIEnv *env,
if (useCPUThread) {
// This is the "GPU thread".
graphicsContext->ThreadFrame();
if (graphicsContext)
graphicsContext->ThreadFrame();
} else {
UpdateRunLoopAndroid(env);
}

View File

@ -296,7 +296,12 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
File sdcard = Environment.getExternalStorageDirectory();
String externalStorageDir = sdcard.getAbsolutePath();
String dataDir = this.getFilesDir().getAbsolutePath();
File filesDir = this.getFilesDir();
String dataDir = null;
if (filesDir != null) {
// Null has been seen in Google Play stacktraces
dataDir = filesDir.getAbsolutePath();
}
String apkFilePath = appInfo.sourceDir;
String cacheDir = getCacheDir().getAbsolutePath();

View File

@ -353,8 +353,6 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, std::vector<VKRStep *> &st
// * Create copies of render target that are rendered to multiple times and textured from in sequence, and push those render passes
// as early as possible in the frame (Wipeout billboards).
// Push down empty "Clear/Store" renderpasses, and merge them with the first "Load/Store" to the same framebuffer.
// Actually let's just bother with the first one for now. This affects Wipeout Pure.
for (int j = 0; j < (int)steps.size() - 1; j++) {
if (steps[j]->stepType == VKRStepType::RENDER &&
steps[j]->render.finalColorLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
@ -362,6 +360,8 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, std::vector<VKRStep *> &st
steps[j]->render.finalColorLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
}
// Push down empty "Clear/Store" renderpasses, and merge them with the first "Load/Store" to the same framebuffer.
// Actually let's just bother with the first one for now. This affects Wipeout Pure.
if (steps.size() > 1 && steps[j]->stepType == VKRStepType::RENDER &&
steps[j]->render.numDraws == 0 &&
steps[j]->render.numReads == 0 &&

View File

@ -312,8 +312,13 @@ public:
}
VkImageView GetImageView() {
vkTex_->Touch();
return vkTex_->GetImageView();
if (vkTex_) {
vkTex_->Touch();
return vkTex_->GetImageView();
} else {
// This would be bad.
return VK_NULL_HANDLE;
}
}
private: