Skip to content

Commit

Permalink
GS:MTL: Fix handling of tex is depth fb
Browse files Browse the repository at this point in the history
  • Loading branch information
TellowKrinkle committed Oct 15, 2023
1 parent 1bc7762 commit 3478f05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pcsx2/GS/Renderers/Metal/GSDeviceMTL.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,8 @@ static void OnMainThread(Fn&& fn)
id<MTLRenderPipelineState> pipeline = m_convert_pipeline[static_cast<int>(shader)];
pxAssertRel(pipeline, fmt::format("No pipeline for {}", shaderName(shader)).c_str());

DoStretchRect(sTex, sRect, dTex, dRect, pipeline, linear, LoadAction::DontCareIfFull, nullptr, 0);
bool fully_writes_pixels = shader != ShaderConvert::FLOAT32_TO_RGB8;
DoStretchRect(sTex, sRect, dTex, dRect, pipeline, linear, fully_writes_pixels ? LoadAction::DontCareIfFull : LoadAction::Load, nullptr, 0);
}}

void GSDeviceMTL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, bool red, bool green, bool blue, bool alpha)
Expand Down
7 changes: 6 additions & 1 deletion pcsx2/GS/Renderers/Metal/tfx.metal
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,12 @@ struct PSMain

float4 fetch_c(ushort2 uv)
{
return PS_TEX_IS_DEPTH ? tex_depth.read(uv) : tex.read(uv);
if (PS_TEX_IS_FB)
return current_color;
else if (PS_TEX_IS_DEPTH)
return tex_depth.read(uv);
else
return tex.read(uv);
}

// MARK: Depth sampling
Expand Down

0 comments on commit 3478f05

Please sign in to comment.