From 64461329e7083f48267982f44e716e0809c5ee3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 1 Jan 2026 23:20:34 +0100 Subject: [PATCH] More minor fixes and cleanups --- Common/GPU/OpenGL/GLRenderManager.h | 7 ++++--- Common/GPU/Vulkan/thin3d_vulkan.cpp | 5 +++++ Core/HLE/sceDisplay.cpp | 7 ++++++- GPU/Common/PresentationCommon.cpp | 3 +-- GPU/GPUCommonHW.cpp | 1 + GPU/GPUState.h | 9 ++++----- UI/MiscViews.cpp | 2 ++ UI/Store.h | 1 - 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Common/GPU/OpenGL/GLRenderManager.h b/Common/GPU/OpenGL/GLRenderManager.h index 442b74bb2c..ca3d038581 100644 --- a/Common/GPU/OpenGL/GLRenderManager.h +++ b/Common/GPU/OpenGL/GLRenderManager.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -83,6 +84,7 @@ private: class GLRShader { public: + explicit GLRShader(std::string_view _desc) : desc(_desc) {} ~GLRShader() { if (shader) { glDeleteShader(shader); @@ -275,11 +277,10 @@ public: return step.create_buffer.buffer; } - GLRShader *CreateShader(GLuint stage, const std::string &code, const std::string &desc) { + GLRShader *CreateShader(GLuint stage, const std::string &code, std::string_view desc) { GLRInitStep &step = initSteps_.push_uninitialized(); step.stepType = GLRInitStepType::CREATE_SHADER; - step.create_shader.shader = new GLRShader(); - step.create_shader.shader->desc = desc; + step.create_shader.shader = new GLRShader(desc); step.create_shader.stage = stage; step.create_shader.code = new char[code.size() + 1]; memcpy(step.create_shader.code, code.data(), code.size() + 1); diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index ced87f32c3..17ac1d8eec 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -1225,6 +1225,11 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char for (auto &iter : desc.shaders) { VKShaderModule *vkshader = (VKShaderModule *)iter; + if (!iter) { + ERROR_LOG(Log::G3D, "Null shader in pipeline creation"); + delete pipeline; + return nullptr; + } vkshader->AddRef(); pipeline->deps.push_back(vkshader); if (vkshader->GetStage() == ShaderStage::Vertex) { diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 31aa24b4ac..6aecc36bb5 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -571,7 +571,12 @@ void __DisplaySetDisplayLayoutConfig(const DisplayLayoutConfig &config) { } void __DisplayFlip(int cyclesLate) { - _dbg_assert_(gpu); + if (!gpu) { + _dbg_assert_(gpu); + // Something has gone wrong. + flippedThisFrame = true; + return; + } __DisplaySetFramerate(); diff --git a/GPU/Common/PresentationCommon.cpp b/GPU/Common/PresentationCommon.cpp index cdfdd4a64e..49f60db226 100644 --- a/GPU/Common/PresentationCommon.cpp +++ b/GPU/Common/PresentationCommon.cpp @@ -596,8 +596,7 @@ Draw::ShaderModule *PresentationCommon::CompileShaderModule(ShaderStage stage, S return nullptr; } } - Draw::ShaderModule *shader = draw_->CreateShaderModule(stage, lang_, (const uint8_t *)translated.c_str(), translated.size(), "postshader"); - return shader; + return draw_->CreateShaderModule(stage, lang_, (const uint8_t *)translated.c_str(), translated.size(), "postshader"); } void PresentationCommon::SourceTexture(Draw::Texture *texture, int bufferWidth, int bufferHeight) { diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index f240f6fa22..b07273fc59 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -1252,6 +1252,7 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) { break; } + // Keep going if these commands don't change state. case GE_CMD_TEXBUFWIDTH0: case GE_CMD_TEXADDR0: if (data != gstate.cmdmem[data >> 24]) diff --git a/GPU/GPUState.h b/GPU/GPUState.h index b7427b7d1f..1eb67262a3 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -682,7 +682,10 @@ public: ShaderDepalMode shaderDepalMode; GEBufferFormat depalFramebufferFormat; - u32 getRelativeAddress(u32 data) const; + u32 getRelativeAddress(u32 data) const { + u32 baseExtended = ((gstate.base & 0x000F0000) << 8) | data; + return (offsetAddr + baseExtended) & 0x0FFFFFFF; + } static void Reset(); void DoState(PointerWrap &p); }; @@ -692,7 +695,3 @@ class GPUDebugInterface; extern GPUStateCache gstate_c; -inline u32 GPUStateCache::getRelativeAddress(u32 data) const { - u32 baseExtended = ((gstate.base & 0x000F0000) << 8) | data; - return (gstate_c.offsetAddr + baseExtended) & 0x0FFFFFFF; -} diff --git a/UI/MiscViews.cpp b/UI/MiscViews.cpp index 5b10ab1ebc..42273de999 100644 --- a/UI/MiscViews.cpp +++ b/UI/MiscViews.cpp @@ -185,6 +185,8 @@ GameInfoTex *GameImageView::GetTex(std::shared_ptr info) const { case GameInfoFlags::PIC1: tex = &info->pic1; break; + default: + break; } return tex; } diff --git a/UI/Store.h b/UI/Store.h index ffb785191f..9d31f03560 100644 --- a/UI/Store.h +++ b/UI/Store.h @@ -104,6 +104,5 @@ private: UI::ViewGroup *scrollItemView_ = nullptr; UI::ViewGroup *productPanel_ = nullptr; - UI::TextView *titleText_ = nullptr; };