Permalink
Browse files

Merge pull request #10203 from hrydgard/1.5-crash-fixes-2

More crash fixes from Play logs..
  • Loading branch information...
hrydgard committed Nov 30, 2017
2 parents c0d0dec + b4bca7d commit d032b41d949c6ffb90814d56a2fcd022eeea8ca6
@@ -733,9 +733,11 @@ void ARM64XEmitter::EncodeLoadStoreIndexedInst(u32 op, ARM64Reg Rt, ARM64Reg Rn,
else if (size == 16)
shift = 1;
_assert_msg_(DYNA_REC, ((imm >> shift) << shift) == imm, "%s(INDEX_UNSIGNED): offset must be aligned %d", __FUNCTION__, imm);
if (shift) {
_assert_msg_(DYNA_REC, ((imm >> shift) << shift) == imm, "%s(INDEX_UNSIGNED): offset must be aligned %d", __FUNCTION__, imm);
imm >>= shift;
}
imm >>= shift;
_assert_msg_(DYNA_REC, imm >= 0, "%s(INDEX_UNSIGNED): offset must be positive %d", __FUNCTION__, imm);
_assert_msg_(DYNA_REC, !(imm & ~0xFFF), "%s(INDEX_UNSIGNED): offset too large %d", __FUNCTION__, imm);
@@ -106,21 +106,6 @@ void ArmJit::DoState(PointerWrap &p)
}
}
// This is here so the savestate matches between jit and non-jit.
void ArmJit::DoDummyState(PointerWrap &p)
{
auto s = p.Section("Jit", 1, 2);
if (!s)
return;
bool dummy = false;
p.Do(dummy);
if (s >= 2) {
dummy = true;
p.Do(dummy);
}
}
void ArmJit::FlushAll()
{
gpr.FlushAll();
@@ -39,7 +39,6 @@ class ArmJit : public ArmGen::ARMXCodeBlock, public JitInterface, public MIPSFro
virtual ~ArmJit();
void DoState(PointerWrap &p) override;
void DoDummyState(PointerWrap &p) override;
const JitOptions &GetJitOptions() { return jo; }
@@ -98,20 +98,6 @@ void Arm64Jit::DoState(PointerWrap &p) {
}
}
// This is here so the savestate matches between jit and non-jit.
void Arm64Jit::DoDummyState(PointerWrap &p) {
auto s = p.Section("Jit", 1, 2);
if (!s)
return;
bool dummy = false;
p.Do(dummy);
if (s >= 2) {
dummy = true;
p.Do(dummy);
}
}
void Arm64Jit::FlushAll()
{
gpr.FlushAll();
@@ -39,7 +39,6 @@ class Arm64Jit : public Arm64Gen::ARM64CodeBlock, public JitInterface, public MI
virtual ~Arm64Jit();
void DoState(PointerWrap &p) override;
void DoDummyState(PointerWrap &p) override;
const JitOptions &GetJitOptions() { return jo; }
@@ -50,20 +50,6 @@ void IRJit::DoState(PointerWrap &p) {
frontend_.DoState(p);
}
// This is here so the savestate matches between jit and non-jit.
void IRJit::DoDummyState(PointerWrap &p) {
auto s = p.Section("Jit", 1, 2);
if (!s)
return;
bool dummy = false;
p.Do(dummy);
if (s >= 2) {
dummy = true;
p.Do(dummy);
}
}
void IRJit::ClearCache() {
ILOG("IRJit: Clearing the cache!");
blocks_.Clear();
@@ -127,7 +127,6 @@ class IRJit : public JitInterface {
virtual ~IRJit();
void DoState(PointerWrap &p) override;
void DoDummyState(PointerWrap &p) override;
const JitOptions &GetJitOptions() { return jo; }
@@ -21,6 +21,8 @@
#include "ext/udis86/udis86.h"
#include "Common/StringUtils.h"
#include "Common/ChunkFile.h"
#include "Core/Util/DisArm64.h"
#include "Core/Config.h"
@@ -46,6 +48,20 @@ namespace MIPSComp {
jit->Compile(currentMIPS->pc);
}
void DoDummyJitState(PointerWrap &p) {
// This is here so the savestate matches between jit and non-jit.
auto s = p.Section("Jit", 1, 2);
if (!s)
return;
bool dummy = false;
p.Do(dummy);
if (s >= 2) {
dummy = true;
p.Do(dummy);
}
}
JitInterface *CreateNativeJit(MIPSState *mips) {
#if PPSSPP_ARCH(ARM)
return new MIPSComp::ArmJit(mips);
@@ -125,7 +125,6 @@ namespace MIPSComp {
virtual JitBlockCache *GetBlockCache() = 0;
virtual void InvalidateCacheAt(u32 em_address, int length = 4) = 0;
virtual void DoState(PointerWrap &p) = 0;
virtual void DoDummyState(PointerWrap &p) = 0;
virtual void RunLoopUntil(u64 globalticks) = 0;
virtual void Compile(u32 em_address) = 0;
virtual void ClearCache() = 0;
@@ -147,5 +146,7 @@ namespace MIPSComp {
extern JitInterface *jit;
void DoDummyJitState(PointerWrap &p);
JitInterface *CreateNativeJit(MIPSState *mips);
}
@@ -262,7 +262,7 @@ void MIPSState::DoState(PointerWrap &p) {
if (MIPSComp::jit)
MIPSComp::jit->DoState(p);
else
MIPSComp::jit->DoDummyState(p);
MIPSComp::DoDummyJitState(p);
p.DoArray(r, sizeof(r) / sizeof(r[0]));
p.DoArray(f, sizeof(f) / sizeof(f[0]));
@@ -66,21 +66,6 @@ void MipsJit::DoState(PointerWrap &p)
}
}
// This is here so the savestate matches between jit and non-jit.
void MipsJit::DoDummyState(PointerWrap &p)
{
auto s = p.Section("Jit", 1, 2);
if (!s)
return;
bool dummy = false;
p.Do(dummy);
if (s >= 2) {
dummy = true;
p.Do(dummy);
}
}
void MipsJit::FlushAll()
{
//gpr.FlushAll();
@@ -38,7 +38,6 @@ class MipsJit : public MIPSGen::MIPSCodeBlock, public JitInterface, public MIPSF
MipsJit(MIPSState *mips);
void DoState(PointerWrap &p) override;
void DoDummyState(PointerWrap &p) override;
// Compiled ops should ignore delay slots
// the compiler will take care of them by itself
@@ -142,21 +142,6 @@ void Jit::DoState(PointerWrap &p) {
CBreakPoints::SetSkipFirst(0);
}
// This is here so the savestate matches between jit and non-jit.
void Jit::DoDummyState(PointerWrap &p) {
auto s = p.Section("Jit", 1, 2);
if (!s)
return;
bool dummy = false;
p.Do(dummy);
if (s >= 2) {
dummy = true;
p.Do(dummy);
}
}
void Jit::GetStateAndFlushAll(RegCacheState &state) {
gpr.GetState(state.gpr);
fpr.GetState(state.fpr);
@@ -52,7 +52,6 @@ class Jit : public Gen::XCodeBlock, public JitInterface, public MIPSFrontendInte
const JitOptions &GetJitOptions() { return jo; }
void DoState(PointerWrap &p) override;
void DoDummyState(PointerWrap &p) override;
// Compiled ops should ignore delay slots
// the compiler will take care of them by itself
@@ -698,7 +698,12 @@ void VertexDecoderJitCache::Jit_PosS16Through() {
}
void VertexDecoderJitCache::Jit_NormalS8() {
LDRH(INDEX_UNSIGNED, tempReg1, srcReg, dec_->nrmoff);
// nrmoff can be odd in case of byte-only vertices! odd unsigned offsets are not allowed for LDRH.
// Switching to LDRB.
// Only seen this in a crash log.
LDRB(INDEX_UNSIGNED, tempReg1, srcReg, dec_->nrmoff);
LDRB(INDEX_UNSIGNED, tempReg3, srcReg, dec_->nrmoff + 1);
ORR(tempReg1, tempReg1, tempReg3, ArithOption(tempReg3, ST_LSL, 8));
LDRB(INDEX_UNSIGNED, tempReg3, srcReg, dec_->nrmoff + 2);
ORR(tempReg1, tempReg1, tempReg3, ArithOption(tempReg3, ST_LSL, 16));
STR(INDEX_UNSIGNED, tempReg1, dstReg, dec_->decFmt.nrmoff);
@@ -20,17 +20,18 @@
void startLocationUpdates() {
Log.d(TAG, "startLocationUpdates");
if (!mLocationEnable) {
boolean isGPSEnabled = mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
boolean isNetworkEnabled = mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
boolean isGPSEnabled = false;
boolean isNetworkEnabled = false;
try {
isGPSEnabled = mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
isNetworkEnabled = mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this);
mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, this);
mLocationEnable = true;
} catch (SecurityException e) {
Log.e(TAG, "Cannot start location updates: " + e.toString());
}
if(!isGPSEnabled && !isNetworkEnabled) {
if (!isGPSEnabled && !isNetworkEnabled) {
Log.i(TAG, "No location provider found");
// TODO: notify user
}
@@ -467,7 +467,8 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
vkCmdEndRenderPass(cmd);
// Transition the framebuffer if requested.
if (fb && step.render.finalColorLayout != VK_IMAGE_LAYOUT_UNDEFINED) {
// Don't need to transition it if VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.
if (fb && step.render.finalColorLayout != VK_IMAGE_LAYOUT_UNDEFINED && step.render.finalColorLayout != VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
VkImageMemoryBarrier barrier{};
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.oldLayout = fb->color.layout;
@@ -490,6 +491,9 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
break;
case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL:
barrier.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT;
break;
default:
Crash();
}
@@ -687,6 +687,12 @@ VkImageView VulkanRenderManager::BindFramebufferAsTexture(VKRFramebuffer *fb, in
}
}
if (!curRenderStep_->preTransitions.empty() &&
curRenderStep_->preTransitions.back().fb == fb &&
curRenderStep_->preTransitions.back().targetLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) {
// We're done.
return fb->color.imageView;
}
curRenderStep_->preTransitions.push_back({ fb, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL });
return fb->color.imageView;
}
@@ -51,13 +51,20 @@ class VKRFramebuffer {
}
~VKRFramebuffer() {
vulkan_->Delete().QueueDeleteImage(color.image);
vulkan_->Delete().QueueDeleteImage(depth.image);
vulkan_->Delete().QueueDeleteImageView(color.imageView);
vulkan_->Delete().QueueDeleteImageView(depth.imageView);
vulkan_->Delete().QueueDeleteDeviceMemory(color.memory);
vulkan_->Delete().QueueDeleteDeviceMemory(depth.memory);
vulkan_->Delete().QueueDeleteFramebuffer(framebuf);
if (color.image)
vulkan_->Delete().QueueDeleteImage(color.image);
if (depth.image)
vulkan_->Delete().QueueDeleteImage(depth.image);
if (color.imageView)
vulkan_->Delete().QueueDeleteImageView(color.imageView);
if (depth.imageView)
vulkan_->Delete().QueueDeleteImageView(depth.imageView);
if (color.memory)
vulkan_->Delete().QueueDeleteDeviceMemory(color.memory);
if (depth.memory)
vulkan_->Delete().QueueDeleteDeviceMemory(depth.memory);
if (framebuf)
vulkan_->Delete().QueueDeleteFramebuffer(framebuf);
}
int numShadows = 1; // TODO: Support this.
@@ -264,7 +264,7 @@ class PopupMultiChoice : public UI::Choice {
const char *category_;
ScreenManager *screenManager_;
std::string valueText_;
bool restoreFocus_;
bool restoreFocus_ = false;
std::set<int> hidden_;
};
@@ -1314,8 +1314,10 @@ EventReturn ListView::OnItemCallback(int num, EventParams &e) {
View *focused = GetFocusedView();
OnChoice.Trigger(ev);
CreateAllItems();
if (focused)
SetFocusedView(e.v);
// TODO: At this point, focused may no longer exist, depending on what OnChoice.Trigger does.
// Disable the refocus feature for now.
// if (focused)
// SetFocusedView(e.v);
return EVENT_DONE;
}

0 comments on commit d032b41

Please sign in to comment.