fix: component indexing for framebuffer fetch

This commit is contained in:
Samuliak 2025-01-10 15:40:19 +01:00
parent 4479584eb6
commit ca3fe96104
No known key found for this signature in database

View file

@ -2261,24 +2261,14 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
} }
// Do a framebuffer fetch if possible // Do a framebuffer fetch if possible
// TODO: support comparison samplers
if (static_cast<MetalRenderer*>(g_renderer.get())->SupportsFramebufferFetch())
{
uint8 renderTargetIndex = shaderContext->shader->textureRenderTargetIndex[texInstruction->textureFetch.textureIndex]; uint8 renderTargetIndex = shaderContext->shader->textureRenderTargetIndex[texInstruction->textureFetch.textureIndex];
if (renderTargetIndex != 255) if (static_cast<MetalRenderer*>(g_renderer.get())->SupportsFramebufferFetch() && renderTargetIndex != 255)
{ {
src->addFmt("col{}.", renderTargetIndex); // TODO: support comparison samplers
// TODO: clean up src->addFmt("col{}", renderTargetIndex);
std::string components[] = {"x", "y", "z", "w"}; }
for (sint32 i = 0; i < numWrittenElements; i++) else
{ {
src->addFmt("{}", components[i]);
}
src->add(");" _CRLF);
return;
}
}
if (emulateCompare) if (emulateCompare)
{ {
cemu_assert_debug(!isGather); cemu_assert_debug(!isGather);
@ -2537,6 +2527,8 @@ static void _emitTEXSampleTextureCode(LatteDecompilerShaderContext* shaderContex
// lod bias (TODO: wht?) // lod bias (TODO: wht?)
src->add(")"); src->add(")");
}
// sample_compare doesn't return a float // sample_compare doesn't return a float
if (!isCompare) if (!isCompare)
{ {