temporal AA enabled for transparent pass + deferred pipeline

This commit is contained in:
turanszkij
2017-03-31 00:12:03 +02:00
parent 5f3fd81c72
commit dc6953dd93
6 changed files with 30 additions and 26 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ void DeferredRenderableComponent::ResizeBuffers()
rtGBuffer.Initialize(
wiRenderer::GetDevice()->GetScreenWidth(), wiRenderer::GetDevice()->GetScreenHeight()
, true, FORMAT_R8G8B8A8_UNORM);
rtGBuffer.Add(FORMAT_R16G16_FLOAT);
rtGBuffer.Add(FORMAT_R16G16B16A16_FLOAT);
rtGBuffer.Add(FORMAT_R8G8B8A8_UNORM);
rtGBuffer.Add(FORMAT_R8G8B8A8_UNORM);
+25 -23
View File
@@ -324,29 +324,6 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende
}
wiProfiler::GetInstance().BeginRange("Secondary Scene", wiProfiler::DOMAIN_GPU, threadID);
if (wiRenderer::GetTemporalAAEnabled())
{
wiRenderer::GetDevice()->EventBegin("Temporal AA Resolve", threadID);
int current = wiRenderer::GetDevice()->GetFrameCount() % 2 == 0 ? 0 : 1;
int history = 1 - current;
rtTemporalAA[current].Activate(threadID); {
fx.process.setTemporalAAResolve(true);
fx.setMaskMap(rtTemporalAA[history].GetTexture());
wiImage::Draw(shadedSceneRT.GetTextureResolvedMSAA(threadID), fx, threadID);
fx.process.clear();
}
wiRenderer::GetDevice()->UnBindResources(TEXSLOT_GBUFFER0, 1, threadID);
wiRenderer::GetDevice()->UnBindResources(TEXSLOT_ONDEMAND0, 1, threadID);
shadedSceneRT.Set(threadID, nullptr, false, 0); {
fx.presentFullScreen = true;
fx.blendFlag = BLENDMODE_OPAQUE;
fx.quality = QUALITY_NEAREST;
wiImage::Draw(rtTemporalAA[current].GetTexture(), fx, threadID);
fx.presentFullScreen = false;
}
wiRenderer::GetDevice()->EventEnd();
}
if (getLightShaftsEnabled() && XMVectorGetX(XMVector3Dot(wiRenderer::GetSunPosition(), wiRenderer::getCamera()->GetAt())) > 0)
{
wiRenderer::GetDevice()->EventBegin("Light Shafts", threadID);
@@ -443,6 +420,31 @@ void Renderable3DComponent::RenderSecondaryScene(wiRenderTarget& mainRT, wiRende
wiRenderer::GetDevice()->EventEnd();
}
if (wiRenderer::GetTemporalAAEnabled())
{
wiRenderer::GetDevice()->EventBegin("Temporal AA Resolve", threadID);
int current = wiRenderer::GetDevice()->GetFrameCount() % 2 == 0 ? 0 : 1;
int history = 1 - current;
rtTemporalAA[current].Activate(threadID); {
wiRenderer::UpdateGBuffer(mainRT.GetTextureResolvedMSAA(threadID, 0), mainRT.GetTextureResolvedMSAA(threadID, 1), nullptr, nullptr, nullptr, threadID);
fx.presentFullScreen = false;
fx.process.setTemporalAAResolve(true);
fx.setMaskMap(rtTemporalAA[history].GetTexture());
wiImage::Draw(shadedSceneRT.GetTextureResolvedMSAA(threadID), fx, threadID);
fx.process.clear();
}
wiRenderer::GetDevice()->UnBindResources(TEXSLOT_GBUFFER0, 1, threadID);
wiRenderer::GetDevice()->UnBindResources(TEXSLOT_ONDEMAND0, 1, threadID);
shadedSceneRT.Set(threadID, nullptr, false, 0); {
fx.presentFullScreen = true;
fx.blendFlag = BLENDMODE_OPAQUE;
fx.quality = QUALITY_NEAREST;
wiImage::Draw(rtTemporalAA[current].GetTexture(), fx, threadID);
fx.presentFullScreen = false;
}
wiRenderer::GetDevice()->EventEnd();
}
wiProfiler::GetInstance().EndRange(); // Secondary Scene
}
void Renderable3DComponent::RenderTransparentScene(wiRenderTarget& refractionRT, GRAPHICSTHREAD threadID)
+1
View File
@@ -17,6 +17,7 @@ GBUFFEROutputType main(GS_OUT PSIn)
float metalness = 0;
float ao = 1;
float sss = 0;
float2 velocity = 0;
OBJECT_PS_OUT_GBUFFER
}
+1 -1
View File
@@ -332,7 +332,7 @@ inline void TiledLighting(in float2 pixel, in float3 N, in float3 V, in float3 P
#define OBJECT_PS_OUT_GBUFFER \
GBUFFEROutputType Out = (GBUFFEROutputType)0; \
Out.g0 = float4(color.rgb, 1); /*FORMAT_R8G8B8A8_UNORM*/ \
Out.g1 = float4(encode(N), 0, 0); /*FORMAT_R16G16_FLOAT*/ \
Out.g1 = float4(encode(N), velocity); /*FORMAT_R16G16B16_FLOAT*/ \
Out.g2 = float4(0, 0, sss, emissive); /*FORMAT_R8G8B8A8_UNORM*/ \
Out.g3 = float4(roughness, reflectance, metalness, ao); /*FORMAT_R8G8B8A8_UNORM*/ \
return Out;
+1
View File
@@ -18,6 +18,7 @@ GBUFFEROutputType main(QGS_OUT PSIn)
float metalness = 0;
float ao = 1;
float sss = 0;
float2 velocity = 0;
OBJECT_PS_OUT_GBUFFER
}
+1 -1
View File
@@ -1399,7 +1399,7 @@ GraphicsDevice_DX11::GraphicsDevice_DX11(wiWindowRegistration::window_type windo
}
UINT createDeviceFlags = 0;
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
//createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
D3D_DRIVER_TYPE driverTypes[] =
{