mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
PostProcessing: Fix for Metal renderer
This commit is contained in:
parent
9d88a373bd
commit
ca5b07acff
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
g_gpu_device->SetFramebuffer(output_fb);
|
||||
|
||||
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.
|
||||
|
@ -1292,7 +1305,7 @@ bool PostProcessing::ReShadeFXShader::Apply(GPUTexture* input, GPUFramebuffer* f
|
|||
for (const Sampler& sampler : pass.samplers)
|
||||
{
|
||||
GL_INS_FMT("Texture Sampler {}: ID {} [{}]", sampler.slot, sampler.texture_id,
|
||||
GetTextureNameForID(sampler.texture_id));
|
||||
GetTextureNameForID(sampler.texture_id));
|
||||
g_gpu_device->SetTextureSampler(sampler.slot, GetTextureByID(sampler.texture_id, input, final_target),
|
||||
sampler.sampler);
|
||||
bound_textures[sampler.slot] = true;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue