浏览代码

Temp hack enabling some MSAA state

Binding targets is not working though...
/main
Robert Srinivasiah 7 年前
当前提交
66789f87
共有 3 个文件被更改,包括 24 次插入6 次删除
  1. 8
      ScriptableRenderPipeline/Core/CoreRP/CoreUtils.cs
  2. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDCamera.cs
  3. 16
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs

8
ScriptableRenderPipeline/Core/CoreRP/CoreUtils.cs


public static void CreateCmdTemporaryRT(CommandBuffer cmd, int nameID, RenderTextureDescriptor baseDesc,
int depthBufferBits, FilterMode filter, RenderTextureFormat format,
RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default, int msaaSamples = 1, bool enableRandomWrite = false)
RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default, int msaaSamplesOverride = 0, bool enableRandomWrite = false)
UpdateRenderTextureDescriptor(ref baseDesc, depthBufferBits, format, readWrite, msaaSamples, enableRandomWrite);
if (msaaSamplesOverride > 0)
UpdateRenderTextureDescriptor(ref baseDesc, depthBufferBits, format, readWrite, msaaSamplesOverride, enableRandomWrite);
else
UpdateRenderTextureDescriptor(ref baseDesc, depthBufferBits, format, readWrite, baseDesc.msaaSamples, enableRandomWrite);
cmd.GetTemporaryRT(nameID, baseDesc, filter);
}

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDCamera.cs


tempDesc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight);
}
tempDesc.msaaSamples = 1; // will be updated later, deferred will always set to 1
if (frameSettings.enableMSAA)
tempDesc.msaaSamples = HDRenderPipeline.kMsaaSamplesFixed;
else
tempDesc.msaaSamples = 1;
tempDesc.depthBufferBits = 0;
tempDesc.autoGenerateMips = false;
tempDesc.useMipMap = false;

16
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


int m_DebugFullScreenTempRT;
bool m_FullScreenDebugPushed;
// temp hack
public const int kMsaaSamplesFixed = 2;
public HDRenderPipeline(HDRenderPipelineAsset asset)
{
SetRenderingFeatures();

using (new ProfilingSample(cmd, "Deferred directional shadows", CustomSamplerId.RenderDeferredDirectionalShadow.GetSampler()))
{
cmd.ReleaseTemporaryRT(m_DeferredShadowBuffer);
// TODO: I'll leave this as 1x for easy sampling, but I need to make it MSAA
CoreUtils.CreateCmdTemporaryRT(cmd, m_DeferredShadowBuffer, hdCamera.renderTextureDesc, 0, FilterMode.Point, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear, 1, true);
m_LightLoop.RenderDeferredDirectionalShadow(hdCamera, m_DeferredShadowBufferRT, GetDepthTexture(), cmd);
PushFullScreenDebugTexture(cmd, m_DeferredShadowBuffer, hdCamera, renderContext, FullScreenDebugMode.DeferredShadows);

if (settings.IsEnabledAndSupported(null))
{
cmd.ReleaseTemporaryRT(HDShaderIDs._AmbientOcclusionTexture);
CoreUtils.CreateCmdTemporaryRT(cmd, HDShaderIDs._AmbientOcclusionTexture, hdCamera.renderTextureDesc, 0, FilterMode.Bilinear, RenderTextureFormat.R8, RenderTextureReadWrite.Linear, msaaSamples: 1, enableRandomWrite: true);
CoreUtils.CreateCmdTemporaryRT(cmd, HDShaderIDs._AmbientOcclusionTexture, hdCamera.renderTextureDesc, 0, FilterMode.Bilinear, RenderTextureFormat.R8, RenderTextureReadWrite.Linear, msaaSamplesOverride: 1, enableRandomWrite: true);
postProcessLayer.BakeMSVOMap(cmd, camera, HDShaderIDs._AmbientOcclusionTexture, GetDepthTexture(), true);
cmd.SetGlobalVector(HDShaderIDs._AmbientOcclusionParam, new Vector4(settings.color.value.r, settings.color.value.g, settings.color.value.b, settings.directLightingStrength.value));
PushFullScreenDebugTexture(cmd, HDShaderIDs._AmbientOcclusionTexture, hdCamera, renderContext, FullScreenDebugMode.SSAO);

void RenderPyramidDepth(Camera camera, CommandBuffer cmd, ScriptableRenderContext renderContext, FullScreenDebugMode debugMode)
{
if (!m_FrameSettings.enableRoughRefraction)
return;
using (new ProfilingSample(cmd, "Pyramid Depth", CustomSamplerId.PyramidDepth.GetSampler()))
{
var depthPyramidDesc = m_DepthPyramidBufferDesc;

cmd.ReleaseTemporaryRT(m_CameraColorBuffer);
cmd.ReleaseTemporaryRT(m_CameraSssDiffuseLightingBuffer);
CoreUtils.CreateCmdTemporaryRT(cmd, m_CameraColorBuffer, hdCamera.renderTextureDesc, 0, FilterMode.Point, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear, 1, true); // Enable UAV
CoreUtils.CreateCmdTemporaryRT(cmd, m_CameraSssDiffuseLightingBuffer, hdCamera.renderTextureDesc, 0, FilterMode.Point, RenderTextureFormat.RGB111110Float, RenderTextureReadWrite.Linear, 1, true); // Enable UAV
CoreUtils.CreateCmdTemporaryRT(cmd, m_CameraColorBuffer, hdCamera.renderTextureDesc, 0, FilterMode.Point, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear, 0, true); // Enable UAV
CoreUtils.CreateCmdTemporaryRT(cmd, m_CameraSssDiffuseLightingBuffer, hdCamera.renderTextureDesc, 0, FilterMode.Point, RenderTextureFormat.RGB111110Float, RenderTextureReadWrite.Linear, 0, true); // Enable UAV
// Color and depth pyramids

desc.depthBufferBits = 0;
desc.useMipMap = true;
desc.autoGenerateMips = false;
desc.msaaSamples = 1; // These are approximation textures, they don't need MSAA
var pyramidSize = CalculatePyramidSize((int)hdCamera.screenSize.x, (int)hdCamera.screenSize.y);

正在加载...
取消
保存