|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var postProcessLayer = camera.GetComponent<PostProcessLayer>(); |
|
|
|
var hdCamera = HDCamera.Get(camera, postProcessLayer); |
|
|
|
var hdCamera = HDCamera.Get(camera, postProcessLayer, m_FrameSettings.enableStereo); |
|
|
|
|
|
|
|
Resize(hdCamera); |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
ConfigureForShadowMask(enableBakeShadowMask, cmd); |
|
|
|
|
|
|
|
InitAndClearBuffer(hdCamera, enableBakeShadowMask, cmd); |
|
|
|
InitAndClearBuffer(hdCamera, enableBakeShadowMask, cmd, m_FrameSettings.enableStereo); |
|
|
|
|
|
|
|
RenderDepthPrepass(m_CullResults, hdCamera, renderContext, cmd); |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void InitAndClearBuffer(HDCamera hdCamera, bool enableBakeShadowMask, CommandBuffer cmd) |
|
|
|
void InitAndClearBuffer(HDCamera hdCamera, bool enableBakeShadowMask, CommandBuffer cmd, bool stereoEnabled) |
|
|
|
{ |
|
|
|
using (new ProfilingSample(cmd, "InitAndClearBuffer", GetSampler(CustomSamplerId.InitAndClearBuffer))) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Color and depth pyramids
|
|
|
|
m_GaussianPyramidColorBufferDesc = BuildPyramidDescriptor(hdCamera, PyramidType.Color); |
|
|
|
m_GaussianPyramidColorBufferDesc = BuildPyramidDescriptor(hdCamera, PyramidType.Color, stereoEnabled); |
|
|
|
m_DepthPyramidBufferDesc = BuildPyramidDescriptor(hdCamera, PyramidType.Depth); |
|
|
|
m_DepthPyramidBufferDesc = BuildPyramidDescriptor(hdCamera, PyramidType.Depth, stereoEnabled); |
|
|
|
|
|
|
|
cmd.ReleaseTemporaryRT(m_DepthPyramidBuffer); |
|
|
|
cmd.GetTemporaryRT(m_DepthPyramidBuffer, m_DepthPyramidBufferDesc, FilterMode.Trilinear); |
|
|
|
|
|
|
Depth = 1 |
|
|
|
} |
|
|
|
|
|
|
|
static RenderTextureDescriptor BuildPyramidDescriptor(HDCamera hdCamera, PyramidType pyramidType ) |
|
|
|
static RenderTextureDescriptor BuildPyramidDescriptor(HDCamera hdCamera, PyramidType pyramidType, bool stereoEnabled) |
|
|
|
{ |
|
|
|
var desc = hdCamera.renderTextureDesc; |
|
|
|
desc.colorFormat = (pyramidType == PyramidType.Color) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.RFloat; |
|
|
|
|
|
|
|
|
|
|
var pyramidSize = CalculatePyramidSize((int)hdCamera.screenSize.x, (int)hdCamera.screenSize.y); |
|
|
|
|
|
|
|
// Gotta plug-in proper stereo bits from frame settings?
|
|
|
|
if (false /*hdCamera.stereoEnabled*/ && (desc.dimension != TextureDimension.Tex2DArray)) |
|
|
|
if (stereoEnabled && (desc.dimension != TextureDimension.Tex2DArray)) |
|
|
|
widthModifier = 2; // double-wide
|
|
|
|
|
|
|
|
desc.width = pyramidSize * widthModifier; |
|
|
|