Add some paranoid checks guided by stack traces from Google Play

This commit is contained in:
Henrik Rydgård committed 2018-05-27 22:12:59 +02:00
1 parent d7770307f3
commit b730d187e8
5 files changed
+28 -14

No files matched your search

+6 -3
View File
@@ -108,10 +108,11 @@ void DrawEngineGLES::DeviceRestore() {
}
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 +130,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;
}
+11 -6
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?
+2 -1
View File
@@ -650,7 +650,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);
}
+2 -2
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.color == VKRRenderPassAction::CLEAR &&
+7 -2
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: