|
|
|
|
|
|
|
|
|
|
m_DistortionBuffer = RTHandle.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: Builtin.GetDistortionBufferFormat(), sRGB: Builtin.GetDistortionBuffer_sRGBFlag()); |
|
|
|
|
|
|
|
// TODO: For MSAA, we'll need to add a Draw path in order to support MSAA properly
|
|
|
|
m_DeferredShadowBuffer = RTHandle.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGB32, sRGB: false, enableRandomWrite: true); |
|
|
|
|
|
|
|
m_GaussianPyramidColorBuffer = RTHandle.Alloc(size => CalculatePyramidSize(size), filterMode: FilterMode.Trilinear, colorFormat: RenderTextureFormat.ARGBHalf, sRGB: true, useMipMap: true, autoGenerateMips: false); |
|
|
|
|
|
|
|
|
|
|
using (new ProfilingSample(cmd, "Deferred directional shadows", CustomSamplerId.RenderDeferredDirectionalShadow.GetSampler())) |
|
|
|
{ |
|
|
|
// TODO: For MSAA, we are overriding to 1x, but we'll need to add a Draw path in order to support MSAA properly
|
|
|
|
// When debug is enabled we need to clear otherwise we may see non-shadows areas with stale values.
|
|
|
|
if(m_CurrentDebugDisplaySettings.fullScreenDebugMode == FullScreenDebugMode.DeferredShadows) |
|
|
|
{ |
|
|
|
HDUtils.SetRenderTarget(cmd, hdCamera, m_DeferredShadowBuffer, ClearFlag.Color, CoreUtils.clearColorAllBlack); |
|
|
|
} |
|
|
|
|
|
|
|
m_LightLoop.RenderDeferredDirectionalShadow(hdCamera, m_DeferredShadowBuffer, GetDepthTexture(), cmd); |
|
|
|
PushFullScreenDebugTexture(cmd, m_DeferredShadowBuffer, hdCamera, FullScreenDebugMode.DeferredShadows); |
|
|
|
} |
|
|
|
|
|
|
{ |
|
|
|
using (new ProfilingSample(cmd, "Blit to final RT", CustomSamplerId.CopyDepthForSceneView.GetSampler())) |
|
|
|
{ |
|
|
|
// This Blit will flip the screen anything other than openGL
|
|
|
|
// This Blit will flip the screen on anything other than openGL
|
|
|
|
HDUtils.BlitCameraTexture(cmd, hdCamera, m_CameraColorBuffer, BuiltinRenderTextureType.CameraTarget); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
cmd.SetGlobalVector(HDShaderIDs._DebugLightingSmoothness, debugSmoothness); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._DebugLightingNormal, debugNormal); |
|
|
|
|
|
|
|
Vector2 mousePixelCoord = MousePositionDebug.instance.GetMousePosition(hdCamera.screenSize.y); |
|
|
|
var mouseParam = new Vector4(mousePixelCoord.x, mousePixelCoord.y, mousePixelCoord.x / hdCamera.screenSize.x, mousePixelCoord.y / hdCamera.screenSize.y); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._MousePixelCoord, mouseParam); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._MousePixelCoord, HDUtils.GetMouseCoordinates(hdCamera)); |
|
|
|
|
|
|
|
cmd.SetGlobalTexture(HDShaderIDs._DebugFont, m_Asset.renderPipelineResources.debugFontTexture); |
|
|
|
} |
|
|
|