clean up accurate barriers

This commit is contained in:
Samuliak 2025-01-08 16:58:06 +01:00
parent 68d328b094
commit 27a31fedab
No known key found for this signature in database
2 changed files with 16 additions and 10 deletions

View file

@ -1031,7 +1031,11 @@ void MetalRenderer::draw_execute(uint32 baseVertex, uint32 baseInstance, uint32
endRenderPass = CheckIfRenderPassNeedsFlush(geometryShader);
if (endRenderPass)
{
EndEncoding();
// TODO: only log in debug?
cemuLog_logOnce(LogType::Force, "Ending render pass due to render target self-dependency\n");
}
}
// Primitive type
@ -1871,6 +1875,11 @@ bool MetalRenderer::CheckIfRenderPassNeedsFlush(LatteDecompilerShader* shader)
const auto relative_textureUnit = shader->resourceMapping.getTextureUnitFromBindingPoint(i);
auto hostTextureUnit = relative_textureUnit;
auto textureDim = shader->textureUnitDim[relative_textureUnit];
// Texture is accessed as a framebuffer fetch, therefore there is no need to flush it
if (shader->textureRenderTargetIndex[relative_textureUnit] != 255)
continue;
auto texUnitRegIndex = hostTextureUnit * 7;
switch (shader->shaderType)
{
@ -1895,8 +1904,7 @@ bool MetalRenderer::CheckIfRenderPassNeedsFlush(LatteDecompilerShader* shader)
continue;
LatteTexture* baseTexture = textureView->baseTexture;
if (!m_state.m_isFirstDrawInRenderPass)
{
// If the texture is also used in the current render pass, we need to end the render pass to "flush" the texture
for (uint8 i = 0; i < LATTE_NUM_COLOR_TARGET; i++)
{
@ -1905,7 +1913,6 @@ bool MetalRenderer::CheckIfRenderPassNeedsFlush(LatteDecompilerShader* shader)
return true;
}
}
}
return false;
}

View file

@ -125,8 +125,7 @@ struct MetalState
MetalActiveFBOState m_lastUsedFBO;
size_t m_vertexBufferOffsets[MAX_MTL_VERTEX_BUFFERS];
// TODO: find out what is the max number of bound textures on the Wii U
class LatteTextureViewMtl* m_textures[64] = {nullptr};
class LatteTextureViewMtl* m_textures[LATTE_NUM_MAX_TEX_UNITS] = {nullptr};
size_t m_uniformBufferOffsets[METAL_GENERAL_SHADER_TYPE_TOTAL][MAX_MTL_BUFFERS];
MTL::Viewport m_viewport;