浏览代码

Make sure the stencil buffer is copied for the shader feature classification pass

/RenderPassXR_Sandbox
Evgenii Golubev 7 年前
当前提交
09de458a
共有 2 个文件被更改,包括 11 次插入11 次删除
  1. 10
      Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  2. 12
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs

10
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


private RenderTexture m_CameraDepthStencilBuffer = null;
private RenderTexture m_CameraDepthBufferCopy = null;
private RenderTexture m_CameraStencilBufferCopy = null; // Currently, it's manually copied using a pixel shader, and optimized to only contain the SSS bit
private RenderTexture m_CameraStencilBufferCopy = null;
private RenderTexture m_HTile = null; // If the hardware does not expose it, we compute our own, optimized to only contain the SSS bit
private RenderTargetIdentifier m_CameraDepthStencilBufferRT;
private RenderTargetIdentifier m_CameraDepthBufferCopyRT;

bool NeedStencilBufferCopy()
{
// Currently, Unity does not offer a way to bind the stencil buffer as a texture in a compute shader.
// Therefore, it's manually copied using a pixel shader, and optimized to only contain the SSS bit.
return m_DebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission;
// Therefore, it's manually copied using a pixel shader.
return m_DebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission || LightLoop.GetFeatureVariantsEnabled(m_Asset.tileSettings);
}
bool NeedHTileCopy()

return NeedStencilBufferCopy();
return m_DebugDisplaySettings.renderingDebugSettings.enableSSSAndTransmission;
}
RenderTargetIdentifier GetDepthTexture()

CopyDepthBufferIfNeeded(cmd);
}
// Required for the SSS pass.
// Required for the SSS and the shader feature classification pass.
PrepareAndBindStencilTexture(cmd);
if (m_DebugDisplaySettings.IsDebugMaterialDisplayEnabled())

12
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs


return (camera.pixelHeight + (LightDefinitions.s_TileSizeClustered - 1)) / LightDefinitions.s_TileSizeClustered;
}
bool GetFeatureVariantsEnabled()
public static bool GetFeatureVariantsEnabled(TileSettings tileSettings)
return m_TileSettings.enableComputeLightEvaluation && (m_TileSettings.enableComputeLightVariants || m_TileSettings.enableComputeMaterialVariants) && !(m_TileSettings.enableClustered && !m_TileSettings.enableFptlForOpaqueWhenClustered);
return tileSettings.enableComputeLightEvaluation && (tileSettings.enableComputeLightVariants || tileSettings.enableComputeMaterialVariants) && !(tileSettings.enableClustered && !tileSettings.enableFptlForOpaqueWhenClustered);
}
TileSettings m_TileSettings = null;

s_GenAABBKernel = buildScreenAABBShader.FindKernel("ScreenBoundsAABB");
bool enableFeatureVariants = GetFeatureVariantsEnabled();
bool enableFeatureVariants = GetFeatureVariantsEnabled(m_TileSettings);
if (enableFeatureVariants)
{
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_TileSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile_FeatureFlags" : "TileLightListGen_FeatureFlags");

var numTilesX = GetNumTileFtplX(camera);
var numTilesY = GetNumTileFtplY(camera);
var numTiles = numTilesX * numTilesY;
bool enableFeatureVariants = GetFeatureVariantsEnabled();
bool enableFeatureVariants = GetFeatureVariantsEnabled(m_TileSettings);
if (usingFptl) // optimized for opaques only
{

PushGlobalParams(hdCamera.camera, cmd, null, 0);
if (lightingDebug.tileDebugByCategory == TileSettings.TileDebug.FeatureVariants)
{
if (GetFeatureVariantsEnabled())
if (GetFeatureVariantsEnabled(m_TileSettings))
{
// featureVariants
m_DebugViewTilesMaterial.SetInt("_NumTiles", numTiles);

if (m_TileSettings.enableComputeLightEvaluation)
{
bool enableFeatureVariants = GetFeatureVariantsEnabled() && !debugDisplaySettings.IsDebugDisplayEnabled();
bool enableFeatureVariants = GetFeatureVariantsEnabled(m_TileSettings) && !debugDisplaySettings.IsDebugDisplayEnabled();
int numVariants = 1;
if (enableFeatureVariants)

正在加载...
取消
保存