From 9f230af9434a7ef7146c4ea9ed69fa701120a98f Mon Sep 17 00:00:00 2001 From: DH Date: Wed, 23 Oct 2024 03:08:25 +0300 Subject: [PATCH] gpu: do not crash on null pixel shader --- rpcsx/gpu/Renderer.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rpcsx/gpu/Renderer.cpp b/rpcsx/gpu/Renderer.cpp index d3335fb..bd1fff1 100644 --- a/rpcsx/gpu/Renderer.cpp +++ b/rpcsx/gpu/Renderer.cpp @@ -467,19 +467,19 @@ void amdgpu::draw(GraphicsPipe &pipe, int vmId, std::uint32_t firstVertex, vsPrimType, viewPorts); } - auto pixelShader = - cacheTag.getPixelShader(pipe.sh.spiShaderPgmPs, pipe.context, viewPorts); + shaders[Cache::getStageIndex(VK_SHADER_STAGE_VERTEX_BIT)] = + vertexShader.handle; + + if (pipe.sh.spiShaderPgmPs.address != 0) { + auto pixelShader = cacheTag.getPixelShader(pipe.sh.spiShaderPgmPs, + pipe.context, viewPorts); - if (pixelShader.handle == nullptr) { shaders[Cache::getStageIndex(VK_SHADER_STAGE_FRAGMENT_BIT)] = - getFillRedFragShader(*cacheTag.getCache()); + pixelShader.handle != nullptr + ? pixelShader.handle + : getFillRedFragShader(*cacheTag.getCache()); } - shaders[Cache::getStageIndex(VK_SHADER_STAGE_VERTEX_BIT)] = - vertexShader.handle; - shaders[Cache::getStageIndex(VK_SHADER_STAGE_FRAGMENT_BIT)] = - pixelShader.handle; - if (pipe.uConfig.vgtPrimitiveType == gnm::PrimitiveType::RectList) { shaders[Cache::getStageIndex(VK_SHADER_STAGE_GEOMETRY_BIT)] = getPrimTypeRectGeomShader(*cacheTag.getCache());