Skip to content

Commit

Permalink
[Renderer] Fixed an issue where FSR 2 would ghost if any transparent …
Browse files Browse the repository at this point in the history
…object was rendered
  • Loading branch information
PanosK92 committed Oct 22, 2023
1 parent 9a4b6a8 commit ffff608
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion runtime/Rendering/Renderer_Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ namespace Spartan
// deduce depth-stencil state
RHI_DepthStencilState* depth_stencil_state = depth_prepass ? GetDepthStencilState(Renderer_DepthStencilState::Depth_read).get() : GetDepthStencilState(Renderer_DepthStencilState::Depth_read_write_stencil_read).get();

// note: if is_transparent_pass is true we could simply clear the RTs, however we don't do this as fsr
// can be enabled, and if it is, it will expect the RTs to contain both the opaque and transparent data

uint32_t start_index = !is_transparent_pass ? 0 : 2;
uint32_t end_index = !is_transparent_pass ? 2 : 4;
bool is_first_pass = true;
Expand All @@ -605,7 +608,7 @@ namespace Spartan
pso.rasterizer_state = rasterizer_state;
pso.depth_stencil_state = depth_stencil_state;
pso.render_target_color_textures[0] = tex_albedo;
pso.clear_color[0] = (!is_first_pass || pso.instancing) ? rhi_color_load : Color::standard_transparent;
pso.clear_color[0] = (!is_first_pass || pso.instancing || is_transparent_pass) ? rhi_color_load : Color::standard_transparent;
pso.render_target_color_textures[1] = tex_normal;
pso.clear_color[1] = pso.clear_color[0];
pso.render_target_color_textures[2] = tex_material;
Expand Down
6 changes: 3 additions & 3 deletions runtime/Rendering/Renderer_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ namespace Spartan
shader(Renderer_Shader::quad_p)->Compile(RHI_Shader_Pixel, shader_dir + "quad.hlsl", async);
}

// vedlight depth
// light depth
{
shader(Renderer_Shader::depth_light_v) = make_shared<RHI_Shader>();
shader(Renderer_Shader::depth_light_v)->Compile(RHI_Shader_Vertex, shader_dir + "depth_light.hlsl", async, RHI_Vertex_Type::PosUvNorTan);
Expand Down Expand Up @@ -460,13 +460,13 @@ namespace Spartan
shader(Renderer_Shader::temporal_filter_c) = make_shared<RHI_Shader>();
shader(Renderer_Shader::temporal_filter_c)->Compile(RHI_Shader_Compute, shader_dir + "temporal_filter.hlsl", async);

// AMD FidelityFX CAS - Contrast Adaptive Sharpening
// amd fidelityfx cas - Contrast Adaptive Sharpening
shader(Renderer_Shader::ffx_cas_c) = make_shared<RHI_Shader>();
shader(Renderer_Shader::ffx_cas_c)->Compile(RHI_Shader_Compute, shader_dir + "amd_fidelity_fx\\cas.hlsl", async);

// compiled immediately, they are needed the moment the engine starts.
{
// AMD FidelityFX SPD - Single Pass Downsample
// amd fidelityfx spd - single pass downsample
shader(Renderer_Shader::ffx_spd_c) = make_shared<RHI_Shader>();
shader(Renderer_Shader::ffx_spd_c)->Compile(RHI_Shader_Compute, shader_dir + "amd_fidelity_fx\\spd.hlsl", false);

Expand Down

0 comments on commit ffff608

Please sign in to comment.