PostProcessing: Fix for Metal renderer

This commit is contained in:
Stenzek 2023-11-04 20:28:45 +10:00
parent 9d88a373bd
commit ca5b07acff
No known key found for this signature in database
4 changed files with 19 additions and 17 deletions

View file

@ -699,8 +699,6 @@ bool PostProcessing::Apply(GPUFramebuffer* final_target, s32 final_left, s32 fin
if (!CheckTargets(target_format, target_width, target_height))
return false;
g_gpu_device->SetViewportAndScissor(final_left, final_top, final_width, final_height);
GPUTexture* input = s_input_texture.get();
GPUFramebuffer* input_fb = s_input_framebuffer.get();
GPUTexture* output = s_output_texture.get();

View file

@ -1281,10 +1281,23 @@ bool PostProcessing::ReShadeFXShader::Apply(GPUTexture* input, GPUFramebuffer* f
for (const Pass& pass : m_passes)
{
GL_SCOPE_FMT("Draw pass {}", pass.name.c_str());
GL_INS_FMT("Render Target: ID {} [{}]", pass.render_target, GetTextureNameForID(pass.render_target));
GPUFramebuffer* output_fb = GetFramebufferByID(pass.render_target, input, final_target);
if (!output_fb)
{
// Drawing to final buffer.
if (!g_gpu_device->BeginPresent(false))
{
GL_POP();
return false;
}
}
else
{
g_gpu_device->SetFramebuffer(output_fb);
}
g_gpu_device->SetPipeline(pass.pipeline.get());
// Set all inputs first, before the render pass starts.
@ -1306,16 +1319,6 @@ bool PostProcessing::ReShadeFXShader::Apply(GPUTexture* input, GPUFramebuffer* f
g_gpu_device->SetTextureSampler(i, nullptr, nullptr);
}
if (!output_fb)
{
// Drawing to final buffer.
if (!g_gpu_device->BeginPresent(false))
{
GL_POP();
return false;
}
}
g_gpu_device->Draw(pass.num_vertices, 0);
}

View file

@ -176,6 +176,7 @@ bool PostProcessing::GLSLShader::Apply(GPUTexture* input, GPUFramebuffer* final_
g_gpu_device->SetPipeline(m_pipeline.get());
g_gpu_device->SetTextureSampler(0, input, m_sampler.get());
g_gpu_device->SetViewportAndScissor(final_left, final_top, final_width, final_height);
const u32 uniforms_size = GetUniformsSize();
void* uniforms = g_gpu_device->MapUniformBuffer(uniforms_size);
@ -377,7 +378,7 @@ static float4 o_col0;
{
if (m_use_glsl_interface_blocks)
{
if (IsVulkan())
if (IsVulkan() || IsMetal())
ss << "layout(location = 0) ";
ss << "in VertexData {\n";

View file

@ -19,7 +19,7 @@ ShaderGen::ShaderGen(RenderAPI render_api, bool supports_dual_source_blend)
m_spirv(render_api == RenderAPI::Vulkan || render_api == RenderAPI::Metal),
m_supports_dual_source_blend(supports_dual_source_blend), m_use_glsl_interface_blocks(false)
{
#if defined(ENABLE_OPENGL) || defined(ENABLE_VULKAN)
#if defined(ENABLE_OPENGL) || defined(ENABLE_VULKAN) || defined(__APPLE__)
if (m_glsl)
{
#ifdef ENABLE_OPENGL