diff --git a/WickedEngine/shaders/temporalaaCS.hlsl b/WickedEngine/shaders/temporalaaCS.hlsl index 7f8a5990f..f4ff9c9a4 100644 --- a/WickedEngine/shaders/temporalaaCS.hlsl +++ b/WickedEngine/shaders/temporalaaCS.hlsl @@ -22,6 +22,12 @@ groupshared float tile_depth[TILE_SIZE*TILE_SIZE]; [numthreads(POSTPROCESS_BLOCKSIZE, POSTPROCESS_BLOCKSIZE, 1)] void main(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint3 Gid : SV_GroupID, uint groupIndex : SV_GroupIndex) { + if (postprocess.params0.x) + { + // Early exit when it is the first frame + output[DTid.xy] = input_current[DTid.xy].rgb; + return; + } const float2 uv = (DTid.xy + 0.5f) * postprocess.resolution_rcp; float3 neighborhoodMin = 100000; float3 neighborhoodMax = -100000; diff --git a/WickedEngine/wiRenderPath3D.cpp b/WickedEngine/wiRenderPath3D.cpp index 39c1c020b..f70943ea8 100644 --- a/WickedEngine/wiRenderPath3D.cpp +++ b/WickedEngine/wiRenderPath3D.cpp @@ -1894,7 +1894,7 @@ namespace wi rt_read = &rtFSR[0]; rt_write = &rtFSR[1]; } - else if (wi::renderer::GetTemporalAAEnabled() && !wi::renderer::GetTemporalAADebugEnabled()) + else if (wi::renderer::GetTemporalAAEnabled() && !wi::renderer::GetTemporalAADebugEnabled() && temporalAAResources.IsValid()) { wi::renderer::Postprocess_TemporalAA( temporalAAResources, diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index c6aa5c68d..0e6e3a802 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -14293,23 +14293,25 @@ void Postprocess_TemporalAA( device->BindComputeShader(&shaders[CSTYPE_POSTPROCESS_TEMPORALAA], cmd); - device->BindResource(&input, 0, cmd); + device->BindResource(&input, 0, cmd); // input_current + if (first_frame) { - device->BindResource(&input, 0, cmd); + device->BindResource(&input, 1, cmd); // input_history } else { - device->BindResource(res.GetHistory(), 1, cmd); + device->BindResource(res.GetHistory(), 1, cmd); // input_history } const TextureDesc& desc = res.texture_temporal[0].GetDesc(); - PostProcess postprocess; + PostProcess postprocess = {}; postprocess.resolution.x = desc.width; postprocess.resolution.y = desc.height; postprocess.resolution_rcp.x = 1.0f / postprocess.resolution.x; postprocess.resolution_rcp.y = 1.0f / postprocess.resolution.y; + postprocess.params0.x = first_frame ? 1.0f : 0.0f; device->PushConstants(&postprocess, sizeof(postprocess), cmd); const Texture* output = res.GetCurrent(); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index f3c4c69d5..7ac6fb9f9 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 248; + const int revision = 249; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);