浏览代码

Merge pull request #49 from Unity-Technologies/fix-issue-with-pragma-disable-warning-and-debugger

HDRenderLoop: fix issue with pragma disable warning and debugger
/main
GitHub 8 年前
当前提交
d85c76fd
共有 3 个文件被更改,包括 4 次插入13 次删除
  1. 2
      Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
  2. 9
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  3. 6
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs

2
Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs


}
#endif
private ShaderPassName shaderPassBasic;
public override void Build()
{
}

9
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


m_gbufferManager.SetBufferDescription(gbufferIndex, "_GBufferTexture" + gbufferIndex, RTFormat[gbufferIndex], RTReadWrite[gbufferIndex]);
}
#pragma warning disable 162 // warning CS0162: Unreachable code detected
if (ShaderConfig.VelocityInGbuffer == 1)
if (ShaderConfig.s_VelocityInGbuffer == 1)
{
// If velocity is in GBuffer then it is in the last RT. Assign a different name to it.
m_gbufferManager.SetBufferDescription(m_gbufferManager.gbufferCount, "_VelocityTexture", Builtin.RenderLoop.GetVelocityBufferFormat(), Builtin.RenderLoop.GetVelocityBufferReadWrite());

#pragma warning restore 162
m_DistortionBuffer = Shader.PropertyToID("_DistortionTexture");
m_DistortionBufferRT = new RenderTargetIdentifier(m_DistortionBuffer);

{
using (new Utilities.ProfilingSample("Velocity Pass", renderLoop))
{
// warning CS0162: Unreachable code detected // warning CS0429: Unreachable expression code detected
#pragma warning disable 162, 429
if ((ShaderConfig.VelocityInGbuffer == 0) || debugParameters.useForwardRenderingOnly)
if ((ShaderConfig.s_VelocityInGbuffer == 0) || debugParameters.useForwardRenderingOnly)
return ;
int w = camera.pixelWidth;

cmd.Dispose();
RenderOpaqueRenderList(cullResults, camera, renderLoop, "MotionVectors");
#pragma warning restore 162, 429
}
}

6
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs


public enum GBufferMaterial
{
// Note: This count doesn't include the velocity buffer. On shader and csharp side the velocity buffer will be added by the framework
Count = (ShaderConfig.PackgbufferInU16 == 1) ? 2 : 4
Count = (ShaderConfig.k_PackgbufferInU16 == 1) ? 2 : 4
};
public partial class RenderLoop : Object

RTFormat = new RenderTextureFormat[(int)GBufferMaterial.Count];
RTReadWrite = new RenderTextureReadWrite[(int)GBufferMaterial.Count];
#pragma warning disable 162 // warning CS0162: Unreachable code detected
if (ShaderConfig.PackgbufferInU16 == 1)
if (ShaderConfig.s_PackgbufferInU16 == 1)
{
// TODO: Just discovered that Unity doesn't support unsigned 16 RT format.
RTFormat[0] = RenderTextureFormat.ARGBInt; RTReadWrite[0] = RenderTextureReadWrite.Linear;

RTFormat[2] = RenderTextureFormat.ARGB32; RTReadWrite[2] = RenderTextureReadWrite.Linear;
RTFormat[3] = RenderTextureFormat.RGB111110Float; RTReadWrite[3] = RenderTextureReadWrite.Linear;
}
#pragma warning restore 162
}
//-----------------------------------------------------------------------------

正在加载...
取消
保存