diff --git a/WickedEngine/RenderPath3D.cpp b/WickedEngine/RenderPath3D.cpp index deef9dcdc..dbcc274f1 100644 --- a/WickedEngine/RenderPath3D.cpp +++ b/WickedEngine/RenderPath3D.cpp @@ -42,8 +42,15 @@ void RenderPath3D::ResizeBuffers() desc.Format = wiRenderer::RTFormat_hdr; desc.Width = wiRenderer::GetInternalResolution().x; desc.Height = wiRenderer::GetInternalResolution().y; + desc.SampleDesc.Count = getMSAASampleCount(); device->CreateTexture2D(&desc, nullptr, &rtParticleDistortion); - device->SetName(&rtParticleDistortion, "rtParticle"); + device->SetName(&rtParticleDistortion, "rtParticleDistortion"); + if (getMSAASampleCount() > 1) + { + desc.SampleDesc.Count = 1; + device->CreateTexture2D(&desc, nullptr, &rtParticleDistortion_Resolved); + device->SetName(&rtParticleDistortion_Resolved, "rtParticleDistortion_Resolved"); + } } { TextureDesc desc; @@ -288,9 +295,9 @@ void RenderPath3D::ResizeBuffers() RenderPassDesc desc; desc.numAttachments = 2; desc.attachments[0] = { RenderPassAttachment::RENDERTARGET,RenderPassAttachment::LOADOP_CLEAR,&rtParticleDistortion,-1 }; - desc.attachments[1] = { RenderPassAttachment::DEPTH_STENCIL,RenderPassAttachment::LOADOP_LOAD,&depthBuffer,-1 }; + desc.attachments[1] = { RenderPassAttachment::DEPTH_STENCIL,RenderPassAttachment::LOADOP_LOAD,&depthBuffer,-1,RenderPassAttachment::STOREOP_DONTCARE }; - device->CreateRenderPass(&desc, &renderpass_particles); + device->CreateRenderPass(&desc, &renderpass_particledistortion); } { RenderPassDesc desc; @@ -605,7 +612,7 @@ void RenderPath3D::RenderTransparents(const RenderPass& renderpass_transparent, // Distortion particles: { - device->RenderPassBegin(&renderpass_particles, cmd); + device->RenderPassBegin(&renderpass_particledistortion, cmd); ViewPort vp; vp.Width = (float)rtParticleDistortion.GetDesc().Width; @@ -615,6 +622,11 @@ void RenderPath3D::RenderTransparents(const RenderPass& renderpass_transparent, wiRenderer::DrawSoftParticles(wiRenderer::GetCamera(), rtLinearDepth, true, cmd); device->RenderPassEnd(cmd); + + if (getMSAASampleCount() > 1) + { + device->MSAAResolve(&rtParticleDistortion_Resolved, &rtParticleDistortion, cmd); + } } } void RenderPath3D::TemporalAAResolve(const Texture2D& srcdstSceneRT, const Texture2D& srcGbuffer1, CommandList cmd) const @@ -716,7 +728,7 @@ void RenderPath3D::RenderPostprocessChain(const Texture2D& srcSceneRT, const Tex wiRenderer::Postprocess_Tonemap( *rt_read, getEyeAdaptionEnabled() ? *wiRenderer::ComputeLuminance(srcSceneRT, cmd) : *wiTextureHelper::getColor(wiColor::Gray()), - rtParticleDistortion, + getMSAASampleCount() > 1 ? rtParticleDistortion_Resolved : rtParticleDistortion, *rt_write, cmd, getExposure() diff --git a/WickedEngine/RenderPath3D.h b/WickedEngine/RenderPath3D.h index 5179816c8..01f1a49fb 100644 --- a/WickedEngine/RenderPath3D.h +++ b/WickedEngine/RenderPath3D.h @@ -49,6 +49,7 @@ protected: wiGraphics::Texture2D rtSceneCopy; // contains the rendered scene that can be fed into transparent pass for distortion effect wiGraphics::Texture2D rtWaterRipple; // water ripple sprite normal maps are rendered into this wiGraphics::Texture2D rtParticleDistortion; // contains distortive particles + wiGraphics::Texture2D rtParticleDistortion_Resolved; // contains distortive particles wiGraphics::Texture2D rtVolumetricLights; // contains the volumetric light results wiGraphics::Texture2D rtDof[2]; // depth of field blurred out-of focus part wiGraphics::Texture2D rtTemporalAA[2]; // temporal AA history buffer @@ -71,7 +72,7 @@ protected: wiGraphics::RenderPass renderpass_downsampledepthbuffer; wiGraphics::RenderPass renderpass_lightshafts; wiGraphics::RenderPass renderpass_volumetriclight; - wiGraphics::RenderPass renderpass_particles; + wiGraphics::RenderPass renderpass_particledistortion; wiGraphics::RenderPass renderpass_waterripples; // Post-processes are ping-ponged, this function helps to obtain the last postprocess render target that was written diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index bc7477a55..34b5167cc 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 31; // minor bug fixes, alterations, refactors, updates - const int revision = 5; + const int revision = 6; long GetVersion()