More minor fixes and cleanups

This commit is contained in:
Henrik Rydgård 2026-01-01 23:20:34 +01:00
parent cadbe3a2e0
commit 64461329e7
8 changed files with 23 additions and 12 deletions

View File

@ -6,6 +6,7 @@
#include <functional>
#include <set>
#include <string>
#include <string_view>
#include <mutex>
#include <queue>
#include <condition_variable>
@ -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);

View File

@ -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) {

View File

@ -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();

View File

@ -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) {

View File

@ -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])

View File

@ -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;
}

View File

@ -185,6 +185,8 @@ GameInfoTex *GameImageView::GetTex(std::shared_ptr<GameInfo> info) const {
case GameInfoFlags::PIC1:
tex = &info->pic1;
break;
default:
break;
}
return tex;
}

View File

@ -104,6 +104,5 @@ private:
UI::ViewGroup *scrollItemView_ = nullptr;
UI::ViewGroup *productPanel_ = nullptr;
UI::TextView *titleText_ = nullptr;
};