diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index 139d47613c..59083f5352 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -36,7 +36,9 @@ enum { }; DrawEngineCommon::DrawEngineCommon() : decoderMap_(16) { - decJitCache_ = new VertexDecoderJitCache(); + if (g_Config.bVertexDecoderJit && g_Config.iCpuCore == (int)CPUCore::JIT) { + decJitCache_ = new VertexDecoderJitCache(); + } transformed = (TransformedVertex *)AllocateMemoryPages(TRANSFORMED_VERTEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE); transformedExpanded = (TransformedVertex *)AllocateMemoryPages(3 * TRANSFORMED_VERTEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE); } @@ -169,7 +171,8 @@ static Vec3f ScreenToDrawing(const Vec3f& coords) { } void DrawEngineCommon::NotifyConfigChanged() { - decJitCache_->Clear(); + if (decJitCache_) + decJitCache_->Clear(); lastVType_ = -1; dec_ = nullptr; decoderMap_.Iterate([&](const uint32_t vtype, VertexDecoder *decoder) { diff --git a/GPU/Common/DrawEngineCommon.h b/GPU/Common/DrawEngineCommon.h index d5f8056417..94ce1f35e7 100644 --- a/GPU/Common/DrawEngineCommon.h +++ b/GPU/Common/DrawEngineCommon.h @@ -117,7 +117,9 @@ public: } bool IsCodePtrVertexDecoder(const u8 *ptr) const { - return decJitCache_->IsInSpace(ptr); + if (decJitCache_) + return decJitCache_->IsInSpace(ptr); + return false; } int GetNumDrawCalls() const { return numDrawCalls; diff --git a/GPU/Common/VertexDecoderCommon.cpp b/GPU/Common/VertexDecoderCommon.cpp index 488c1736e9..21b3e76a6f 100644 --- a/GPU/Common/VertexDecoderCommon.cpp +++ b/GPU/Common/VertexDecoderCommon.cpp @@ -1274,7 +1274,7 @@ void VertexDecoder::SetVertexType(u32 fmt, const VertexDecoderOptions &options, // Attempt to JIT as well. But only do that if the main CPU JIT is enabled, in order to aid // debugging attempts - if the main JIT doesn't work, this one won't do any better, probably. - if (jitCache && g_Config.bVertexDecoderJit && g_Config.iCpuCore == (int)CPUCore::JIT) { + if (jitCache) { jitted_ = jitCache->Compile(*this, &jittedSize_); if (!jitted_) { WARN_LOG(G3D, "Vertex decoder JIT failed! fmt = %08x (%s)", fmt_, GetString(SHADER_STRING_SHORT_DESC).c_str()); diff --git a/unittest/TestVertexJit.cpp b/unittest/TestVertexJit.cpp index 12dad2f5aa..e759d64444 100644 --- a/unittest/TestVertexJit.cpp +++ b/unittest/TestVertexJit.cpp @@ -38,9 +38,6 @@ public: dst_ = new u8[BUFFER_SIZE]; cache_ = new VertexDecoderJitCache(); - g_Config.bVertexDecoderJit = true; - // Required for jit to be enabled. - g_Config.iCpuCore = (int)CPUCore::JIT; gstate_c.uv.uScale = 1.0f; gstate_c.uv.vScale = 1.0f; }