浏览代码

Merge branch 'HDRP/staging' into HDLightExplorerExtension

/main
Sebastien Lagarde 6 年前
当前提交
05036cac
共有 324 个文件被更改,包括 2081 次插入1741 次删除
  1. 34
      TestProjects/CoreRP_Tests/Packages/manifest.json
  2. 2
      TestProjects/LWGraphicsTest/Packages/manifest.json
  3. 88
      TestProjects/LWGraphicsTest/ProjectSettings/EditorBuildSettings.asset
  4. 1
      TestProjects/LWGraphicsTest/ProjectSettings/GraphicsSettings.asset
  5. 97
      TestProjects/LWGraphicsTest/ProjectSettings/ProjectSettings.asset
  6. 15
      TestProjects/LWGraphicsTest/ProjectSettings/UnityConnectSettings.asset
  7. 8
      build.py
  8. 46
      com.unity.render-pipelines.core/CoreRP/Common/XRGraphicsConfig.cs
  9. 225
      com.unity.render-pipelines.core/CoreRP/Debugging/Prefabs/Resources/DebugUI Canvas.prefab
  10. 17
      com.unity.render-pipelines.core/CoreRP/Utilities/GeometryUtils.cs
  11. 11
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  12. 9
      com.unity.render-pipelines.high-definition/HDRP/Camera/HDCamera.cs
  13. 5
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugColorPicker.shader
  14. 1
      com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs
  15. 13
      com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs.hlsl
  16. 26
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs
  17. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Volumetric/Texture3DCreationEditor.cs.meta
  18. 161
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template
  19. 104
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDSubShaderUtilities.cs
  20. 162
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDUnlitPassForward.template
  21. 2
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/Deferred.compute
  22. 74
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  23. 20
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/lightlistbuild-bigtile.compute
  24. 68
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/lightlistbuild-clustered.compute
  25. 38
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/lightlistbuild.compute
  26. 67
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/scrbound.compute
  27. 3
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Volumetrics/DensityVolume.cs
  28. 2
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Volumetrics/DensityVolumeManager.cs
  29. 1
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Volumetrics/VBuffer.hlsl
  30. 1
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.shader
  31. 2
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitBuiltinData.hlsl
  32. 178
      com.unity.render-pipelines.high-definition/HDRP/Material/MaterialUtilities.hlsl
  33. 1
      com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLitData.hlsl
  34. 25
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
  35. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDUtils.cs
  36. 7
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/Settings/FrameSettings.cs
  37. 9
      com.unity.render-pipelines.high-definition/HDRP/Sky/SkyRenderingContext.cs
  38. 9
      com.unity.render-pipelines.lightweight/CHANGELOG.md
  39. 18
      com.unity.render-pipelines.lightweight/LWRP/DefaultRendererSetup.cs
  40. 130
      com.unity.render-pipelines.lightweight/LWRP/Editor/LightweightPipelineAssetEditor.cs
  41. 15
      com.unity.render-pipelines.lightweight/LWRP/LightweightForwardRenderer.cs
  42. 7
      com.unity.render-pipelines.lightweight/LWRP/LightweightShadowUtils.cs
  43. 3
      com.unity.render-pipelines.lightweight/LWRP/Passes/BeginXRRenderingPass.cs
  44. 10
      com.unity.render-pipelines.lightweight/LWRP/Passes/CopyColorPass.cs
  45. 12
      com.unity.render-pipelines.lightweight/LWRP/Passes/CopyDepthPass.cs
  46. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/CreateLightweightRenderTexturesPass.cs
  47. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/DepthOnlyPass.cs
  48. 16
      com.unity.render-pipelines.lightweight/LWRP/Passes/DirectionalShadowsPass.cs
  49. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/DrawSkyboxPass.cs
  50. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/EndXRRenderingPass.cs
  51. 16
      com.unity.render-pipelines.lightweight/LWRP/Passes/FinalBlitPass.cs
  52. 11
      com.unity.render-pipelines.lightweight/LWRP/Passes/LightweightForwardPass.cs
  53. 6
      com.unity.render-pipelines.lightweight/LWRP/Passes/LocalShadowsPass.cs
  54. 3
      com.unity.render-pipelines.lightweight/LWRP/Passes/OpaquePostProcessPass.cs
  55. 9
      com.unity.render-pipelines.lightweight/LWRP/Passes/RenderOpaqueForwardPass.cs
  56. 7
      com.unity.render-pipelines.lightweight/LWRP/Passes/RenderTransparentForwardPass.cs
  57. 16
      com.unity.render-pipelines.lightweight/LWRP/Passes/SceneViewDepthCopy.cs
  58. 11
      com.unity.render-pipelines.lightweight/LWRP/Passes/ScreenSpaceShadowResolvePass.cs
  59. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/ScriptableRenderPass.cs
  60. 3
      com.unity.render-pipelines.lightweight/LWRP/Passes/SetupForwardRenderingPass.cs
  61. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/SetupLightweightConstanstPass.cs
  62. 2
      com.unity.render-pipelines.lightweight/LWRP/Passes/TransparentPostProcessPass.cs
  63. 13
      com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Input.hlsl
  64. 7
      com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Shadows.hlsl
  65. 92
      com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Terrain/LightweightPassLitTerrain.hlsl
  66. 6
      com.unity.shadergraph/Editor/Data/Implementation/NodeUtils.cs
  67. 483
      com.unity.shadergraph/Editor/Data/Util/GraphUtil.cs
  68. 10
      com.unity.shadergraph/Editor/Data/Util/ShaderStringBuilder.cs
  69. 11
      com.unity.testframework.graphics/Editor/SetupGraphicsTestCases.cs
  70. 6
      com.unity.testframework.graphics/Editor/TestResultWindow.cs
  71. 34
      com.unity.testframework.graphics/Runtime/EditorGraphicsTestCaseProvider.cs
  72. 20
      com.unity.testframework.graphics/Runtime/IGraphicsTestCaseProvider.cs
  73. 14
      com.unity.testframework.graphics/Runtime/ResultsUtility.cs
  74. 30
      com.unity.testframework.graphics/Runtime/RuntimeGraphicsTestCaseProvider.cs
  75. 50
      com.unity.testframework.graphics/Runtime/UseGraphicsTestCasesAttribute.cs
  76. 2
      com.unity.testing.srp.lightweight/Tests/CommonAssets/Scripts/Setup/SetupGraphicsTestCases.cs
  77. 5
      com.unity.testing.srp.lightweight/Tests/CommonAssets/Scripts/LWGraphicsTests.cs
  78. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/050_Shader_Graphs.png.meta
  79. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/046_Camera_OpaqueTexture.png.meta
  80. 39
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/044_Lighting_ReflectionProbe.png.meta
  81. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/041_Lighting_BasicArea.png.meta
  82. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/040_UpgradeScene.png.meta
  83. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/037_Particles_Standard.png.meta
  84. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/036_Lighting_Scene_DirectionalBakedDirectional.png.meta
  85. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/034_Shader_HighlightsEnvironmentGradientBaked.png.meta
  86. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/033_Shader_HighlightsEnvironmentGradientSH.png.meta
  87. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/032_Shader_GlossyEnvironmentColor.png.meta
  88. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/031_Shader_GlossyEnvironmentSky.png.meta
  89. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/029_Particles.png.meta
  90. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/028_PostProcessing_Custom.png.meta
  91. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/027_PostProcessing.png.meta
  92. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/025_Shader_PBRvalidation_Metallic.png.meta
  93. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/024_Shader_PBRvalidation_Specular.png.meta
  94. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/015_CameraMulti_FPSCam.png.meta
  95. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/014_CameraMulti_MiniMap.png.meta
  96. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/013_CameraMulti_Splitscreen.png.meta
  97. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/004_Camera_TargetTexture.png.meta
  98. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/003_Camera_Ortho.png.meta
  99. 8
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/002_Camera_Clip.png.meta
  100. 989
      com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/OSXEditor/Metal/007_LitShaderMaps.png

34
TestProjects/CoreRP_Tests/Packages/manifest.json


{
"dependencies": {
"com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.terrainphysics": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.umbra": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
"com.unity.testing.srp.core": "file:../../../com.unity.testing.srp.core"
"com.unity.render-pipelines.core"
"com.unity.render-pipelines.core",
"com.unity.testing.srp.core"
]
}

2
TestProjects/LWGraphicsTest/Packages/manifest.json


"com.unity.render-pipelines.lightweight": "file:../../../com.unity.render-pipelines.lightweight",
"com.unity.shadergraph": "file:../../../com.unity.shadergraph",
"com.unity.testframework.graphics": "file:../../../com.unity.testframework.graphics",
"com.unity.testing.srp.lightweight": "file:../../../com.unity.testing.srp.lightweight",
"com.unity.testing.srp.lightweight",
"com.unity.testframework.graphics"
]
}

88
TestProjects/LWGraphicsTest/ProjectSettings/EditorBuildSettings.asset


serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/Scenes/001_SimpleCube.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/001_SimpleCube.unity
path: Assets/Scenes/002_Camera_Clip.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/002_Camera_Clip.unity
path: Assets/Scenes/003_Camera_Ortho.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/003_Camera_Ortho.unity
path: Assets/Scenes/004_Camera_TargetTexture.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/004_Camera_TargetTexture.unity
path: Assets/Scenes/005_LitBakedEmission.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/005_LitBakedEmission.unity
path: Assets/Scenes/006_LitShaderLightProbes.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/006_LitShaderLightProbes.unity
path: Assets/Scenes/007_LitShaderMaps.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/007_LitShaderMaps.unity
path: Assets/Scenes/011_UnlitSprites.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/011_UnlitSprites.unity
path: Assets/Scenes/012_PBS_EnvironmentBRDF_Spheres.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/012_PBS_EnvironmentBRDF_Spheres.unity
path: Assets/Scenes/013_CameraMulti_Splitscreen.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/013_CameraMulti_Splitscreen.unity
path: Assets/Scenes/014_CameraMulti_MiniMap.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/014_CameraMulti_MiniMap.unity
path: Assets/Scenes/015_CameraMulti_FPSCam.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/015_CameraMulti_FPSCam.unity
path: Assets/Scenes/016_Lighting_Scene_Directional.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/016_Lighting_Scene_Directional.unity
path: Assets/Scenes/017_Lighting_Scene_DirectionalBaked.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/017_Lighting_Scene_DirectionalBaked.unity
path: Assets/Scenes/019_Lighting_Scene_PointLights.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/019_Lighting_Scene_PointLights.unity
path: Assets/Scenes/020_Lighting_BasicDirectional.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/020_Lighting_BasicDirectional.unity
path: Assets/Scenes/021_Lighting_BasicPoint.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/021_Lighting_BasicPoint.unity
path: Assets/Scenes/022_Lighting_BasicSpot.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/022_Lighting_BasicSpot.unity
path: Assets/Scenes/023_Lighting_Mixed_Indirect.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/023_Lighting_Mixed_Indirect.unity
path: Assets/Scenes/026_Shader_PBRscene.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/026_Shader_PBRscene.unity
path: Assets/Scenes/024_Shader_PBRvalidation_Specular.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/024_Shader_PBRvalidation_Specular.unity
path: Assets/Scenes/025_Shader_PBRvalidation_Metallic.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/025_Shader_PBRvalidation_Metallic.unity
path: Assets/Scenes/027_PostProcessing.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/027_PostProcessing.unity
path: Assets/Scenes/028_PostProcessing_Custom.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/028_PostProcessing_Custom.unity
path: Assets/Scenes/029_Particles.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/029_Particles.unity
path: Assets/Scenes/031_Shader_GlossyEnvironmentSky.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/031_Shader_GlossyEnvironmentSky.unity
path: Assets/Scenes/032_Shader_GlossyEnvironmentColor.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/032_Shader_GlossyEnvironmentColor.unity
path: Assets/Scenes/033_Shader_HighlightsEnvironmentGradientSH.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/033_Shader_HighlightsEnvironmentGradientSH.unity
path: Assets/Scenes/034_Shader_HighlightsEnvironmentGradientBaked.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/034_Shader_HighlightsEnvironmentGradientBaked.unity
path: Assets/Scenes/035_Shader_TerrainShaders.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/035_Shader_TerrainShaders.unity
path: Assets/Scenes/036_Lighting_Scene_DirectionalBakedDirectional.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/036_Lighting_Scene_DirectionalBakedDirectional.unity
path: Assets/Scenes/037_Particles_Standard.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/037_Particles_Standard.unity
- enabled: 1
path: Assets/Scenes/040_UpgradeScene.unity
- enabled: 0
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/040_UpgradeScene.unity
path: Assets/Scenes/041_Lighting_BasicArea.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/041_Lighting_BasicArea.unity
path: Assets/Scenes/042_Lighting_Scene_VertexLighting.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/042_Lighting_Scene_VertexLighting.unity
path: Assets/Scenes/043_Lighting_Mixed_ShadowMask.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/043_Lighting_Mixed_ShadowMask.unity
path: Assets/Scenes/044_Lighting_ReflectionProbe.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/044_Lighting_ReflectionProbe.unity
path: Assets/Scenes/045_CustomLWPipe.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/045_CustomLWPipe.unity
path: Assets/Scenes/046_Camera_OpaqueTexture.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/046_Camera_OpaqueTexture.unity
path: Assets/Scenes/047_Lighting_DirectionalCascades.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/047_Lighting_DirectionalCascades.unity
path: Assets/Scenes/048_Lighting_LocalShadows.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/048_Lighting_LocalShadows.unity
path: Assets/Scenes/049_Lighting_Mixed_Subtractive.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/049_Lighting_Mixed_Subtractive.unity
path: Assets/Scenes/050_Shader_Graphs.unity
path: Packages/com.unity.testing.srp.lightweight/Tests/Scenes/050_Shader_Graphs.unity
guid: 6e7a83866a1e446b3becf7972371c5d0
m_configObjects: {}

1
TestProjects/LWGraphicsTest/ProjectSettings/GraphicsSettings.asset


- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}

97
TestProjects/LWGraphicsTest/ProjectSettings/ProjectSettings.asset


use32BitDisplayBuffer: 1
preserveFramebufferAlpha: 0
disableDepthAndStencilBuffers: 0
androidStartInFullscreen: 1
androidBlitType: 0
defaultIsNativeResolution: 1
macRetinaSupport: 1

xboxEnableGuest: 0
xboxEnablePIXSampling: 0
metalFramebufferOnly: 0
n3dsDisableStereoscopicView: 0
n3dsEnableSharedListOpt: 1
n3dsEnableVSync: 0
xboxOneResolution: 0
xboxOneSResolution: 0
xboxOneXResolution: 3

xboxOnePresentImmediateThreshold: 0
switchQueueCommandMemory: 0
videoMemoryForVertexBuffers: 0
psp2PowerMode: 0
psp2AcquireBGM: 1
vulkanUseSWCommandBuffers: 1
m_SupportedAspectRatios:
4:3: 1
5:4: 1

dashSupport: 0
enable360StereoCapture: 0
protectGraphicsMemory: 0
enableFrameTimingStats: 0
useHDRDisplay: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30

appleEnableAutomaticSigning: 0
iOSRequireARKit: 0
appleEnableProMotion: 0
vulkanEditorSupport: 0
clonedFromGUID: 00000000000000000000000000000000
templatePackageId:
templateDefaultScene:

ps4pnGameCustomData: 1
playerPrefsSupport: 0
enableApplicationExit: 0
resetTempFolder: 1
restrictedAudioUsageRights: 0
ps4UseResolutionFallback: 0
ps4ReprojectionSupport: 0

ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
monoEnv:
psp2Splashimage: {fileID: 0}
psp2NPTrophyPackPath:
psp2NPSupportGBMorGJP: 0
psp2NPAgeRating: 12
psp2NPTitleDatPath:
psp2NPCommsID:
psp2NPCommunicationsID:
psp2NPCommsPassphrase:
psp2NPCommsSig:
psp2ParamSfxPath:
psp2ManualPath:
psp2LiveAreaGatePath:
psp2LiveAreaBackroundPath:
psp2LiveAreaPath:
psp2LiveAreaTrialPath:
psp2PatchChangeInfoPath:
psp2PatchOriginalPackage:
psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui
psp2KeystoneFile:
psp2MemoryExpansionMode: 0
psp2DRMType: 0
psp2StorageType: 0
psp2MediaCapacity: 0
psp2DLCConfigPath:
psp2ThumbnailPath:
psp2BackgroundPath:
psp2SoundPath:
psp2TrophyCommId:
psp2TrophyPackagePath:
psp2PackagedResourcesPath:
psp2SaveDataQuota: 10240
psp2ParentalLevel: 1
psp2ShortTitle: Not Set
psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF
psp2Category: 0
psp2MasterVersion: 01.00
psp2AppVersion: 01.00
psp2TVBootMode: 0
psp2EnterButtonAssignment: 2
psp2TVDisableEmu: 0
psp2AllowTwitterDialog: 1
psp2Upgradable: 0
psp2HealthWarning: 0
psp2UseLibLocation: 0
psp2InfoBarOnStartup: 0
psp2InfoBarColor: 0
psp2ScriptOptimizationLevel: 2
splashScreenBackgroundSourceLandscape: {fileID: 0}
splashScreenBackgroundSourcePortrait: {fileID: 0}
spritePackerPolicy:

webGLUseEmbeddedResources: 0
webGLCompressionFormat: 1
webGLLinkerTarget: 0
webGLThreadsSupport: 0
14: UNITY_POST_PROCESSING_STACK_V2
18: UNITY_POST_PROCESSING_STACK_V2
19: UNITY_POST_PROCESSING_STACK_V2
21: UNITY_POST_PROCESSING_STACK_V2

27: UNITY_POST_PROCESSING_STACK_V2
28: UNITY_POST_PROCESSING_STACK_V2
managedStrippingLevel: {}
incrementalIl2cppBuild: {}
allowUnsafeCode: 0
additionalIl2CppArgs:

metroMediumTileShowName: 0
metroLargeTileShowName: 0
metroWideTileShowName: 0
metroSupportStreamingInstall: 0
metroLastRequiredScene: 0
metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628,
a: 1}
metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1}
metroSplashScreenUseBackgroundColor: 0
platformCapabilities: {}
metroFTAName:

n3dsUseExtSaveData: 0
n3dsCompressStaticMem: 1
n3dsExtSaveDataNumber: 0x12345
n3dsStackSize: 131072
n3dsTargetPlatform: 2
n3dsRegion: 7
n3dsMediaSize: 0
n3dsLogoStyle: 3
n3dsTitle: GameName
n3dsProductCode:
n3dsApplicationId: 0xFF3FF
XboxOneProductId:
XboxOneUpdateKey:
XboxOneSandboxId:

daydreamIconForeground: {fileID: 0}
daydreamIconBackground: {fileID: 0}
cloudServicesEnabled: {}
luminIcon:
m_Name:
m_ModelFolderPath:
m_PortalFolderPath:
luminCert:
m_CertPath:
m_PrivateKeyPath:
luminIsChannelApp: 0
luminVersion:
m_VersionCode: 1
m_VersionName:
facebookAppId:
facebookCookies: 1
facebookLogging: 1
facebookStatus: 1
facebookXfbml: 0
facebookFrictionlessRequests: 1
framebufferDepthMemorylessMode: 0
legacyClampBlendShapeWeights: 1

15
TestProjects/LWGraphicsTest/ProjectSettings/UnityConnectSettings.asset


--- !u!310 &1
UnityConnectSettings:
m_ObjectHideFlags: 0
m_Enabled: 0
serializedVersion: 1
m_Enabled: 1
m_TestEventUrl:
m_TestConfigUrl:
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
m_ConfigUrl: https://config.uca.cloud.unity3d.com
m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes
m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate
m_EventUrl: https://perf-events.cloud.unity3d.com
m_LogBufferSize: 10
m_CaptureEditorExceptions: 1
UnityPurchasingSettings:
m_Enabled: 0

m_InitializeOnStartup: 1
m_TestEventUrl:
m_TestConfigUrl:
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1

8
build.py


("com.unity.render-pipelines.core", os.path.join("com.unity.render-pipelines.core")),
("com.unity.render-pipelines.lightweight", os.path.join("com.unity.render-pipelines.lightweight")),
("com.unity.render-pipelines.high-definition", os.path.join("com.unity.render-pipelines.high-definition")),
("com.unity.testframework.graphics", os.path.join("com.unity.testframework.graphics"))
("com.unity.testframework.graphics", os.path.join("com.unity.testframework.graphics")),
("com.unity.testing.srp.core", os.path.join("com.unity.testing.srp.core")),
("com.unity.testing.srp.lightweight", os.path.join("com.unity.testing.srp.lightweight"))
"com.unity.render-pipelines.core",
"com.unity.render-pipelines.lightweight",
"com.unity.render-pipelines.high-definition",
"com.unity.shadergraph"
]
if __name__ == "__main__":

46
com.unity.render-pipelines.core/CoreRP/Common/XRGraphicsConfig.cs


using System;
using UnityEditor;
using UnityEngine.XR;
#if UNITY_2017_2_OR_NEWER
using UnityEngine.XR;
using XRSettings = UnityEngine.XR.XRSettings;
#elif UNITY_5_6_OR_NEWER
using UnityEngine.VR;
using XRSettings = UnityEngine.VR.VRSettings;
#endif
namespace UnityEngine.Experimental.Rendering
{

public float occlusionMaskScale;
public bool showDeviceView;
public GameViewRenderMode gameViewRenderMode;
public void SetConfig()
{ // If XR is enabled, sets XRSettings from our saved config
if (!enabled)

return false;
#endif
}
}
}
#if UNITY_EDITOR
// FIXME: We should probably have StereoREnderingPath defined in UnityEngine.XR, not UnityEditor...
public static StereoRenderingPath stereoRenderingMode
{
get
{
if (!enabled)
Assert.IsFalse(enabled);
#if UNITY_2018_3_OR_NEWER
return (StereoRenderingPath)XRSettings.stereoRenderingMode;
#else
if (eyeTextureDesc.vrUsage == VRTextureUsage.TwoEyes)
return StereoRenderingPath.SinglePass;
else if (eyeTextureDesc.dimension == UnityEngine.Rendering.TextureDimension.Tex2DArray)
return StereoRenderingPath.Instancing;
else
return StereoRenderingPath.MultiPass;
#endif
}
}
#endif
public static RenderTextureDescriptor eyeTextureDesc
{
get

}
}
public static string[] supportedDevices
public static int eyeTextureWidth
{
get
{
if (!enabled)
Assert.IsFalse(enabled);
return XRSettings.eyeTextureWidth;
}
}
public static int eyeTextureHeight
return XRSettings.supportedDevices;
return XRSettings.eyeTextureHeight;
}
}
}

225
com.unity.render-pipelines.core/CoreRP/Debugging/Prefabs/Resources/DebugUI Canvas.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1153602445894428}
m_IsPrefabParent: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 224711363741255626}
- component: {fileID: 223912878945851142}

m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114530362809716058
--- !u!224 &224711363741255626
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153602445894428}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &223912878945851142
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153602445894428}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 1
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &114908889885781782
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Script: {fileID: 11500000, guid: 76db615e524a19c4990482d75a475543, type: 3}
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
panelPrefab: {fileID: 224481716535368988, guid: daa46a58178a6ad41ae1ddc2dc7f856d,
type: 2}
prefabs:
- type: UnityEngine.Experimental.Rendering.DebugUI+Value, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224720214277421396, guid: dc0f88987826e6e48b1fe9c7c2b53a53, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+BoolField, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224131888606727344, guid: ce347ad101f41ee4ab5c3fbc0ea447db, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+IntField, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224720214277421396, guid: ae00bb75e0cd5b04b8fe7fb4ab662629, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+UIntField, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224720214277421396, guid: f22bcc84a5f4a1944b075a2c4ac71493, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+FloatField, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224720214277421396, guid: 7d4fd3415ea7dd64bbcfe13fb48a730b, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+EnumField, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224224135738715566, guid: 988db55689193434fb0b3b89538f978f, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Button, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224438017010656346, guid: f6ce33b91f6ffe54cadacbf4bb112440, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Foldout, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224053494956566916, guid: 1c87ab2ce8b8b304d98fbe9a734b1f74, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+ColorField, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224636372931965878, guid: 77c185820dd1a464eac89cae3abccddf, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Vector2Field, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224169904409585018, guid: 326f7c58aed965d41bf7805a782d1e44, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Vector3Field, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224119945032119512, guid: 94afea5f242d72547979595ba963f335, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Vector4Field, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224325631027038092, guid: d47f009476100f545971a81ede14c750, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+VBox, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224489511352681190, guid: ca3e294656861a64b8aeeb9f916da0a9, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+HBox, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224719784157228276, guid: f7f5e36797cf0c1408561665c67b179b, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Container, com.unity.render-pipelines.core.Runtime,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224284813447651300, guid: 38a07789c9e87004dad98c2909f58369, type: 2}
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153602445894428}
m_Enabled: 1
m_EditorHideFlags: 0

m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &114908889885781782
--- !u!114 &114530362809716058
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 76db615e524a19c4990482d75a475543, type: 3}
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &223912878945851142
Canvas:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1153602445894428}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 1
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &224711363741255626
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1153602445894428}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
panelPrefab: {fileID: 224481716535368988, guid: daa46a58178a6ad41ae1ddc2dc7f856d, type: 2}
prefabs:
- type: UnityEngine.Experimental.Rendering.DebugUI+Value, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224720214277421396, guid: dc0f88987826e6e48b1fe9c7c2b53a53, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+BoolField, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224131888606727344, guid: ce347ad101f41ee4ab5c3fbc0ea447db, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+IntField, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224720214277421396, guid: ae00bb75e0cd5b04b8fe7fb4ab662629, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+UIntField, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224720214277421396, guid: f22bcc84a5f4a1944b075a2c4ac71493, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+FloatField, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224720214277421396, guid: 7d4fd3415ea7dd64bbcfe13fb48a730b, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+EnumField, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224224135738715566, guid: 988db55689193434fb0b3b89538f978f, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Button, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224438017010656346, guid: f6ce33b91f6ffe54cadacbf4bb112440, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Foldout, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224053494956566916, guid: 1c87ab2ce8b8b304d98fbe9a734b1f74, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+ColorField, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224636372931965878, guid: 77c185820dd1a464eac89cae3abccddf, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Vector2Field, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224169904409585018, guid: 326f7c58aed965d41bf7805a782d1e44, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Vector3Field, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224119945032119512, guid: 94afea5f242d72547979595ba963f335, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Vector4Field, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224325631027038092, guid: d47f009476100f545971a81ede14c750, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+VBox, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224489511352681190, guid: ca3e294656861a64b8aeeb9f916da0a9, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+HBox, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224719784157228276, guid: f7f5e36797cf0c1408561665c67b179b, type: 2}
- type: UnityEngine.Experimental.Rendering.DebugUI+Container, Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
prefab: {fileID: 224284813447651300, guid: 38a07789c9e87004dad98c2909f58369, type: 2}

17
com.unity.render-pipelines.core/CoreRP/Utilities/GeometryUtils.cs


1.0f,
1.0f);
var q = inversion * cps;
var c = clipPlane * (2.0f / Vector4.Dot(clipPlane, q));
Vector4 M4 = new Vector4(projection[3], projection[7], projection[11], projection[15]);
projection[2] = c.x - projection[3];
projection[6] = c.y - projection[7];
projection[10] = c.z - projection[11];
projection[14] = c.w - projection[15];
var c = clipPlane * ((2.0f*Vector4.Dot(M4, q)) / Vector4.Dot(clipPlane, q));
projection[2] = c.x - M4.x;
projection[6] = c.y - M4.y;
projection[10] = c.z - M4.z;
projection[14] = c.w - M4.w;
return projection;
}

public static Matrix4x4 GetProjectionMatrixLHS(this Camera camera)
{
return camera.projectionMatrix * FlipMatrixLHSRHS;
}
public static bool IsProjectionMatrixOblique(Matrix4x4 projectionMatrix)
{
return projectionMatrix[2] != 0 || projectionMatrix[6] != 0;
}
public static Matrix4x4 CalculateProjectionMatrix(Camera camera)

11
com.unity.render-pipelines.high-definition/CHANGELOG.md


## [3.2.0-preview]
### Added
- Added a luminance meter in the debug menu
- Fixed package upgrade crashing the editor
- Fix issue with package upgrading (HDRP resources asset is now versionned to worarkound package manager limitation)
- Fix lux meter mode - The lux meter isn't affected by the sky anymore
- Fix area light size reset when multi-selected
- Fixed filter pass number in HDUtils.BlitQuad
- Fixed Lux meter mode that was applying SSS
- Fixed planar reflections that were not working with tile/cluster (olbique matrix)
- Fixed debug menu at runtime not working after nested prefab PR come to trunk
## [3.1.0-preview]

9
com.unity.render-pipelines.high-definition/HDRP/Camera/HDCamera.cs


using System.Collections.Generic;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.XR;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

m_ActualHeight = camera.pixelHeight;
var screenWidth = m_ActualWidth;
var screenHeight = m_ActualHeight;
#if !UNITY_SWITCH
screenWidth = XRSettings.eyeTextureWidth;
screenHeight = XRSettings.eyeTextureHeight;
screenWidth = XRGraphicsConfig.eyeTextureWidth;
screenHeight = XRGraphicsConfig.eyeTextureHeight;
var xrDesc = XRSettings.eyeTextureDesc;
var xrDesc = XRGraphicsConfig.eyeTextureDesc;
#endif
// Unfortunately sometime (like in the HDCameraEditor) HDUtils.hdrpSettings can be null because of scripts that change the current pipeline...
m_msaaSamples = HDUtils.hdrpSettings != null ? HDUtils.hdrpSettings.msaaSampleCount : MSAASamples.None;

5
com.unity.render-pipelines.high-definition/HDRP/Debug/DebugColorPicker.shader


//Decompress value if luxMeter is active
if (_DebugLightingMode == DEBUGLIGHTINGMODE_LUX_METER && _ColorPickerMode != COLORPICKERDEBUGMODE_NONE)
result.rgb = result.rgb * LUXMETER_COMPRESSION_RATIO;
if (_DebugLightingMode == DEBUGLIGHTINGMODE_LUMINANCE_METER)
{
result = Luminance(result.rgb);
}
if (_FalseColor)
result.rgb = FasleColorRemap(Luminance(result.rgb), _FalseColorThresholds);

1
com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs


DiffuseLighting,
SpecularLighting,
LuxMeter,
LuminanceMeter,
VisualizeCascade,
VisualizeShadowMasks,
IndirectDiffuseOcclusion,

13
com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs.hlsl


#define DEBUGLIGHTINGMODE_DIFFUSE_LIGHTING (1)
#define DEBUGLIGHTINGMODE_SPECULAR_LIGHTING (2)
#define DEBUGLIGHTINGMODE_LUX_METER (3)
#define DEBUGLIGHTINGMODE_VISUALIZE_CASCADE (4)
#define DEBUGLIGHTINGMODE_VISUALIZE_SHADOW_MASKS (5)
#define DEBUGLIGHTINGMODE_INDIRECT_DIFFUSE_OCCLUSION (6)
#define DEBUGLIGHTINGMODE_INDIRECT_SPECULAR_OCCLUSION (7)
#define DEBUGLIGHTINGMODE_SCREEN_SPACE_TRACING_REFRACTION (8)
#define DEBUGLIGHTINGMODE_SCREEN_SPACE_TRACING_REFLECTION (9)
#define DEBUGLIGHTINGMODE_LUMINANCE_METER (4)
#define DEBUGLIGHTINGMODE_VISUALIZE_CASCADE (5)
#define DEBUGLIGHTINGMODE_VISUALIZE_SHADOW_MASKS (6)
#define DEBUGLIGHTINGMODE_INDIRECT_DIFFUSE_OCCLUSION (7)
#define DEBUGLIGHTINGMODE_INDIRECT_SPECULAR_OCCLUSION (8)
#define DEBUGLIGHTINGMODE_SCREEN_SPACE_TRACING_REFRACTION (9)
#define DEBUGLIGHTINGMODE_SCREEN_SPACE_TRACING_REFLECTION (10)
//
// UnityEngine.Experimental.Rendering.HDPipeline.DebugScreenSpaceTracing: static fields

26
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs


// In case of change, think to update InitDefaultHDAdditionalLightData()
settings.lightType.enumValueIndex = (int)LightType.Point;
m_AdditionalLightData.lightTypeExtent.enumValueIndex = (int)LightTypeExtent.Rectangle;
EditorGUI.BeginChangeCheck();
m_AdditionalLightData.shapeWidth.floatValue = Mathf.Max(m_AdditionalLightData.shapeWidth.floatValue, k_MinAreaWidth);
m_AdditionalLightData.shapeHeight.floatValue = Mathf.Max(m_AdditionalLightData.shapeHeight.floatValue, k_MinAreaWidth);
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
settings.areaSizeY.floatValue = m_AdditionalLightData.shapeHeight.floatValue;
if (EditorGUI.EndChangeCheck())
{
m_AdditionalLightData.shapeWidth.floatValue = Mathf.Max(m_AdditionalLightData.shapeWidth.floatValue, k_MinAreaWidth);
m_AdditionalLightData.shapeHeight.floatValue = Mathf.Max(m_AdditionalLightData.shapeHeight.floatValue, k_MinAreaWidth);
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
settings.areaSizeY.floatValue = m_AdditionalLightData.shapeHeight.floatValue;
}
if (settings.isRealtime)
settings.shadowsType.enumValueIndex = (int)LightShadows.None;
break;

//m_BaseData.type.enumValueIndex = (int)LightType.Area;
settings.lightType.enumValueIndex = (int)LightType.Point;
m_AdditionalLightData.lightTypeExtent.enumValueIndex = (int)LightTypeExtent.Line;
EditorGUI.BeginChangeCheck();
m_AdditionalLightData.shapeWidth.floatValue = Mathf.Max(m_AdditionalLightData.shapeWidth.floatValue, k_MinAreaWidth);
m_AdditionalLightData.shapeHeight.floatValue = Mathf.Max(m_AdditionalLightData.shapeHeight.floatValue, k_MinAreaWidth);
// Fake line with a small rectangle in vanilla unity for GI
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
settings.areaSizeY.floatValue = k_MinAreaWidth;
if (EditorGUI.EndChangeCheck())
{
m_AdditionalLightData.shapeWidth.floatValue = Mathf.Max(m_AdditionalLightData.shapeWidth.floatValue, k_MinAreaWidth);
m_AdditionalLightData.shapeHeight.floatValue = Mathf.Max(m_AdditionalLightData.shapeHeight.floatValue, k_MinAreaWidth);
// Fake line with a small rectangle in vanilla unity for GI
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
settings.areaSizeY.floatValue = k_MinAreaWidth;
}
settings.shadowsType.enumValueIndex = (int)LightShadows.None;
break;

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Volumetric/Texture3DCreationEditor.cs.meta


fileFormatVersion: 2
guid: 6fac8c32212b2374ba031d6c1cc3d128
guid: 9723a65f374db464a8a4f39c94ca7f54
MonoImporter:
externalObjects: {}
serializedVersion: 2

161
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template


Pass
{
// based on HDPBRPass.template
Name "${PassName}"
Tags { "LightMode" = "${LightMode}" }
Name "$splice(PassName)"
Tags { "LightMode" = "$splice(LightMode)" }
${Blending}
${Culling}
${ZTest}
${ZWrite}
${Stencil}
${ColorMask}
$splice(Blending)
$splice(Culling)
$splice(ZTest)
$splice(ZWrite)
$splice(Stencil)
$splice(ColorMask)
//-------------------------------------------------------------------------------------
// End Render Modes
//-------------------------------------------------------------------------------------

#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#pragma enable_d3d11_debug_symbols
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#pragma enable_d3d11_debug_symbols
//-------------------------------------------------------------------------------------
// Variant Definitions (active field translations to HDRP defines)

//-------------------------------------------------------------------------------------
// Defines
//-------------------------------------------------------------------------------------
${Defines}
$splice(Defines)
// this translates the new dependency tracker into the old preprocessor definitions for the existing HDRP shader code
$AttributesMesh.normalOS: #define ATTRIBUTES_NEED_NORMAL

// used for shaders that don't need lighting
#include "HDRP/Material/Material.hlsl"
#endif
#include "HDRP/Material/BuiltinUtilities.hlsl"
#include "HDRP/Material/MaterialUtilities.hlsl"
// this function assumes the bitangent flip is encoded in tangentWS.w

//-------------------------------------------------------------------------------------
// Interpolator Packing And Struct Declarations
//-------------------------------------------------------------------------------------
${InterpolatorPacking}
$buildType(AttributesMesh)
$buildType(VaryingsMeshToPS)
$buildType(VaryingsMeshToDS)
//-------------------------------------------------------------------------------------
// End Interpolator Packing And Struct Declarations
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
${Graph}
$splice(Graph)
#ifdef HAVE_MESH_MODIFICATION
// TODO: we should share this between template files somehow
VertexDescriptionInputs AttributesMeshToVertexDescriptionInputs(AttributesMesh input)
{
VertexDescriptionInputs output;
ZERO_INITIALIZE(VertexDescriptionInputs, output);
$features.modifyMesh: $include("VertexAnimation.template.hlsl")
$VertexDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = input.normalOS;
$VertexDescriptionInputs.WorldSpaceNormal: output.WorldSpaceNormal = TransformObjectToWorldNormal(input.normalOS);
$VertexDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = TransformWorldToViewDir(output.WorldSpaceNormal);
$VertexDescriptionInputs.TangentSpaceNormal: output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
$VertexDescriptionInputs.ObjectSpaceTangent: output.ObjectSpaceTangent = input.tangentOS;
$VertexDescriptionInputs.WorldSpaceTangent: output.WorldSpaceTangent = TransformObjectToWorldDir(input.tangentOS.xyz);
$VertexDescriptionInputs.ViewSpaceTangent: output.ViewSpaceTangent = TransformWorldToViewDir(output.WorldSpaceTangent);
$VertexDescriptionInputs.TangentSpaceTangent: output.TangentSpaceTangent = float3(1.0f, 0.0f, 0.0f);
$VertexDescriptionInputs.ObjectSpaceBiTangent: output.ObjectSpaceBiTangent = normalize(cross(input.normalOS, input.tangentOS) * (input.tangentOS.w > 0.0f ? 1.0f : -1.0f) * GetOddNegativeScale());
$VertexDescriptionInputs.WorldSpaceBiTangent: output.WorldSpaceBiTangent = TransformObjectToWorldDir(output.ObjectSpaceBiTangent);
$VertexDescriptionInputs.ViewSpaceBiTangent: output.ViewSpaceBiTangent = TransformWorldToViewDir(output.WorldSpaceBiTangent);
$VertexDescriptionInputs.TangentSpaceBiTangent: output.TangentSpaceBiTangent = float3(0.0f, 1.0f, 0.0f);
$VertexDescriptionInputs.ObjectSpacePosition: output.ObjectSpacePosition = input.positionOS;
$VertexDescriptionInputs.WorldSpacePosition: output.WorldSpacePosition = GetAbsolutePositionWS(TransformObjectToWorld(input.positionOS));
$VertexDescriptionInputs.ViewSpacePosition: output.ViewSpacePosition = TransformWorldToView(output.WorldSpacePosition);
$VertexDescriptionInputs.TangentSpacePosition: output.TangentSpacePosition = float3(0.0f, 0.0f, 0.0f);
$VertexDescriptionInputs.WorldSpaceViewDirection: output.WorldSpaceViewDirection = GetWorldSpaceNormalizeViewDir(output.WorldSpacePosition);
$VertexDescriptionInputs.ObjectSpaceViewDirection: output.ObjectSpaceViewDirection = TransformWorldToObjectDir(output.WorldSpaceViewDirection);
$VertexDescriptionInputs.ViewSpaceViewDirection: output.ViewSpaceViewDirection = TransformWorldToViewDir(output.WorldSpaceViewDirection);
$VertexDescriptionInputs.TangentSpaceViewDirection: float3x3 tangentSpaceTransform = float3x3(output.WorldSpaceTangent,output.WorldSpaceBiTangent,output.WorldSpaceNormal);
$VertexDescriptionInputs.TangentSpaceViewDirection: output.TangentSpaceViewDirection = mul(tangentSpaceTransform, output.WorldSpaceViewDirection);
$VertexDescriptionInputs.ScreenPosition: output.ScreenPosition = ComputeScreenPos(TransformWorldToHClip(output.WorldSpacePosition), _ProjectionParams.x);
$VertexDescriptionInputs.uv0: output.uv0 = float4(input.uv0, 0.0f, 0.0f);
$VertexDescriptionInputs.uv1: output.uv1 = float4(input.uv1, 0.0f, 0.0f);
$VertexDescriptionInputs.uv2: output.uv2 = float4(input.uv2, 0.0f, 0.0f);
$VertexDescriptionInputs.uv3: output.uv3 = float4(input.uv3, 0.0f, 0.0f);
$VertexDescriptionInputs.VertexColor: output.VertexColor = input.color;
$include("SharedCode.template.hlsl")
return output;
}
AttributesMesh ApplyMeshModification(AttributesMesh input)
{
// build graph inputs
VertexDescriptionInputs vertexDescriptionInputs = AttributesMeshToVertexDescriptionInputs(input);
// evaluate vertex graph
VertexDescription vertexDescription = VertexDescriptionFunction(vertexDescriptionInputs);
// copy graph output to the results
$VertexDescription.Position: input.positionOS = vertexDescription.Position;
return input;
}
#endif // HAVE_MESH_MODIFICATION
// TODO: Do we want to build include functionality for sharing these preprocessed functions across templates?
FragInputs BuildFragInputs(VaryingsMeshToPS input)
{
FragInputs output;
ZERO_INITIALIZE(FragInputs, output);
// Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used).
// TODO: this is a really poor workaround, but the variable is used in a bunch of places
// to compute normals which are then passed on elsewhere to compute other values...
output.worldToTangent = k_identity3x3;
output.positionSS = input.positionCS; // input.positionCS is SV_Position
$FragInputs.positionRWS: output.positionRWS = input.positionRWS;
$FragInputs.worldToTangent: output.worldToTangent = BuildWorldToTangent(input.tangentWS, input.normalWS);
$FragInputs.texCoord0: output.texCoord0 = input.texCoord0;
$FragInputs.texCoord1: output.texCoord1 = input.texCoord1;
$FragInputs.texCoord2: output.texCoord2 = input.texCoord2;
$FragInputs.texCoord3: output.texCoord3 = input.texCoord3;
$FragInputs.color: output.color = input.color;
#if SHADER_STAGE_FRAGMENT
$FragInputs.isFrontFace: output.isFrontFace = IS_FRONT_VFACE(input.cullFace, true, false); // TODO: SHADER_STAGE_FRAGMENT only
$FragInputs.isFrontFace: // Handle handness of the view matrix (In Unity view matrix default to a determinant of -1)
$FragInputs.isFrontFace: // when we render a cubemap the view matrix handness is flipped (due to convention used for cubemap) we have a determinant of +1
$FragInputs.isFrontFace: output.isFrontFace = _DetViewMatrix < 0.0 ? output.isFrontFace : !output.isFrontFace;
#endif // SHADER_STAGE_FRAGMENT
return output;
}
SurfaceDescriptionInputs FragInputsToSurfaceDescriptionInputs(FragInputs input, float3 viewWS)
{
SurfaceDescriptionInputs output;
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
$SurfaceDescriptionInputs.WorldSpaceNormal: output.WorldSpaceNormal = normalize(input.worldToTangent[2].xyz);
$SurfaceDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_M); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_I_V); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.TangentSpaceNormal: output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
$SurfaceDescriptionInputs.WorldSpaceTangent: output.WorldSpaceTangent = input.worldToTangent[0].xyz;
$SurfaceDescriptionInputs.ObjectSpaceTangent: output.ObjectSpaceTangent = TransformWorldToObjectDir(output.WorldSpaceTangent);
$SurfaceDescriptionInputs.ViewSpaceTangent: output.ViewSpaceTangent = TransformWorldToViewDir(output.WorldSpaceTangent);
$SurfaceDescriptionInputs.TangentSpaceTangent: output.TangentSpaceTangent = float3(1.0f, 0.0f, 0.0f);
$SurfaceDescriptionInputs.WorldSpaceBiTangent: output.WorldSpaceBiTangent = input.worldToTangent[1].xyz;
$SurfaceDescriptionInputs.ObjectSpaceBiTangent: output.ObjectSpaceBiTangent = TransformWorldToObjectDir(output.WorldSpaceBiTangent);
$SurfaceDescriptionInputs.ViewSpaceBiTangent: output.ViewSpaceBiTangent = TransformWorldToViewDir(output.WorldSpaceBiTangent);
$SurfaceDescriptionInputs.TangentSpaceBiTangent: output.TangentSpaceBiTangent = float3(0.0f, 1.0f, 0.0f);
$SurfaceDescriptionInputs.WorldSpaceViewDirection: output.WorldSpaceViewDirection = normalize(viewWS);
$SurfaceDescriptionInputs.ObjectSpaceViewDirection: output.ObjectSpaceViewDirection = TransformWorldToObjectDir(output.WorldSpaceViewDirection);
$SurfaceDescriptionInputs.ViewSpaceViewDirection: output.ViewSpaceViewDirection = TransformWorldToViewDir(output.WorldSpaceViewDirection);
$SurfaceDescriptionInputs.TangentSpaceViewDirection: float3x3 tangentSpaceTransform = float3x3(output.WorldSpaceTangent,output.WorldSpaceBiTangent,output.WorldSpaceNormal);
$SurfaceDescriptionInputs.TangentSpaceViewDirection: output.TangentSpaceViewDirection = mul(tangentSpaceTransform, output.WorldSpaceViewDirection);
$SurfaceDescriptionInputs.WorldSpacePosition: output.WorldSpacePosition = GetAbsolutePositionWS(input.positionRWS);
$SurfaceDescriptionInputs.ObjectSpacePosition: output.ObjectSpacePosition = TransformWorldToObject(input.positionRWS);
$SurfaceDescriptionInputs.ViewSpacePosition: float4 posViewSpace = TransformWorldToView(input.positionRWS);
$SurfaceDescriptionInputs.ViewSpacePosition: output.ViewSpacePosition = posViewSpace.xyz / posViewSpace.w;
$SurfaceDescriptionInputs.TangentSpacePosition: output.TangentSpacePosition = float3(0.0f, 0.0f, 0.0f);
$SurfaceDescriptionInputs.ScreenPosition: output.ScreenPosition = ComputeScreenPos(TransformWorldToHClip(input.positionRWS), _ProjectionParams.x);
$SurfaceDescriptionInputs.uv0: output.uv0 = float4(input.texCoord0, 0.0f, 0.0f);
$SurfaceDescriptionInputs.uv1: output.uv1 = float4(input.texCoord1, 0.0f, 0.0f);
$SurfaceDescriptionInputs.uv2: output.uv2 = float4(input.texCoord2, 0.0f, 0.0f);
$SurfaceDescriptionInputs.uv3: output.uv3 = float4(input.texCoord3, 0.0f, 0.0f);
$SurfaceDescriptionInputs.VertexColor: output.VertexColor = input.color;
$SurfaceDescriptionInputs.FaceSign: output.FaceSign = input.isFrontFace;
return output;
}
// existing HDRP code uses the combined function to go directly from packed to frag inputs
FragInputs UnpackVaryingsMeshToFragInputs(PackedVaryingsMeshToPS input)
{
VaryingsMeshToPS unpacked= UnpackVaryingsMeshToPS(input);
return BuildFragInputs(unpacked);
}
void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData)
{

//-------------------------------------------------------------------------------------
// Pass Includes
//-------------------------------------------------------------------------------------
${Includes}
$splice(Includes)
//-------------------------------------------------------------------------------------
// End Pass Includes
//-------------------------------------------------------------------------------------

104
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDSubShaderUtilities.cs


namespace UnityEditor.Experimental.Rendering.HDPipeline
{
public static class HDRPShaderStructs
internal static class HDRPShaderStructs
struct AttributesMesh
internal struct AttributesMesh
{
[Semantic("POSITION")] Vector3 positionOS;
[Semantic("NORMAL")][Optional] Vector3 normalOS;

[Semantic("COLOR")][Optional] Vector4 color;
};
struct VaryingsMeshToPS
[InterpolatorPack]
internal struct VaryingsMeshToPS
{
[Semantic("SV_Position")] Vector4 positionCS;
[Optional] Vector3 positionRWS;

};
};
struct VaryingsMeshToDS
[InterpolatorPack]
internal struct VaryingsMeshToDS
{
Vector3 positionRWS;
Vector3 normalWS;

};
};
struct FragInputs
internal struct FragInputs
{
public static Dependency[] dependencies = new Dependency[]
{

};
// this describes the input to the pixel shader graph eval
public struct SurfaceDescriptionInputs
internal struct SurfaceDescriptionInputs
{
[Optional] Vector3 ObjectSpaceNormal;
[Optional] Vector3 ViewSpaceNormal;

};
// this describes the input to the pixel shader graph eval
public struct VertexDescriptionInputs
internal struct VertexDescriptionInputs
{
[Optional] Vector3 ObjectSpaceNormal;
[Optional] Vector3 ViewSpaceNormal;

}
}
}
public static void Generate(
ShaderGenerator codeResult,
HashSet<string> activeFields)
{
// propagate requirements using dependencies
{
ShaderSpliceUtil.ApplyDependencies(
activeFields,
new List<Dependency[]>()
{
FragInputs.dependencies,
VaryingsMeshToPS.standardDependencies,
SurfaceDescriptionInputs.dependencies,
VertexDescriptionInputs.dependencies
});
}
// generate code based on requirements
ShaderSpliceUtil.BuildType(typeof(AttributesMesh), activeFields, codeResult);
ShaderSpliceUtil.BuildType(typeof(VaryingsMeshToPS), activeFields, codeResult);
ShaderSpliceUtil.BuildType(typeof(VaryingsMeshToDS), activeFields, codeResult);
ShaderSpliceUtil.BuildPackedType(typeof(VaryingsMeshToPS), activeFields, codeResult);
ShaderSpliceUtil.BuildPackedType(typeof(VaryingsMeshToDS), activeFields, codeResult);
}
};
public struct Pass

{
public static bool GenerateShaderPass(AbstractMaterialNode masterNode, Pass pass, GenerationMode mode, SurfaceMaterialOptions materialOptions, HashSet<string> activeFields, ShaderGenerator result, List<string> sourceAssetDependencyPaths)
{
var templateLocation = Path.Combine(Path.Combine(Path.Combine(HDUtils.GetHDRenderPipelinePath(), "Editor"), "ShaderGraph"), pass.TemplateName);
string templatePath = Path.Combine(Path.Combine(HDUtils.GetHDRenderPipelinePath(), "Editor"), "ShaderGraph");
string templateLocation = Path.Combine(templatePath, pass.TemplateName);
if (!File.Exists(templateLocation))
{
// TODO: produce error here

bool debugOutput = false;
if (sourceAssetDependencyPaths != null)
sourceAssetDependencyPaths.Add(templateLocation);
// grab all of the active nodes (for pixel and vertex graphs)
var vertexNodes = ListPool<INode>.Get();

HDRPShaderStructs.AddRequiredFields(pass.RequiredFields, activeFields);
// apply dependencies to the active fields, and build interpolators (TODO: split this function)
var packedInterpolatorCode = new ShaderGenerator();
HDRPShaderStructs.Generate(
packedInterpolatorCode,
activeFields);
// propagate active field requirements using dependencies
ShaderSpliceUtil.ApplyDependencies(
activeFields,
new List<Dependency[]>()
{
HDRPShaderStructs.FragInputs.dependencies,
HDRPShaderStructs.VaryingsMeshToPS.standardDependencies,
HDRPShaderStructs.SurfaceDescriptionInputs.dependencies,
HDRPShaderStructs.VertexDescriptionInputs.dependencies
});
// debug output all active fields
var interpolatorDefines = new ShaderGenerator();

// build the hash table of all named fragments TODO: could make this Dictionary<string, ShaderGenerator / string> ?
Dictionary<string, string> namedFragments = new Dictionary<string, string>();
namedFragments.Add("${Defines}", defines.GetShaderString(2, false));
namedFragments.Add("${Graph}", graph.GetShaderString(2, false));
namedFragments.Add("${LightMode}", pass.LightMode);
namedFragments.Add("${PassName}", pass.Name);
namedFragments.Add("${Includes}", shaderPassIncludes.GetShaderString(2, false));
namedFragments.Add("${InterpolatorPacking}", packedInterpolatorCode.GetShaderString(2, false));
namedFragments.Add("${Blending}", blendCode.ToString());
namedFragments.Add("${Culling}", cullCode.ToString());
namedFragments.Add("${ZTest}", zTestCode.ToString());
namedFragments.Add("${ZWrite}", zWriteCode.ToString());
namedFragments.Add("${Stencil}", stencilCode.ToString());
namedFragments.Add("${ColorMask}", colorMaskCode.ToString());
namedFragments.Add("${LOD}", materialOptions.lod.ToString());
namedFragments.Add("Defines", defines.GetShaderString(2, false));
namedFragments.Add("Graph", graph.GetShaderString(2, false));
namedFragments.Add("LightMode", pass.LightMode);
namedFragments.Add("PassName", pass.Name);
namedFragments.Add("Includes", shaderPassIncludes.GetShaderString(2, false));
namedFragments.Add("Blending", blendCode.ToString());
namedFragments.Add("Culling", cullCode.ToString());
namedFragments.Add("ZTest", zTestCode.ToString());
namedFragments.Add("ZWrite", zWriteCode.ToString());
namedFragments.Add("Stencil", stencilCode.ToString());
namedFragments.Add("ColorMask", colorMaskCode.ToString());
namedFragments.Add("LOD", materialOptions.lod.ToString());
// this is the format string for building the 'C# qualified assembly type names' for $buildType() commands
string buildTypeAssemblyNameFormat = "UnityEditor.Experimental.Rendering.HDPipeline.HDRPShaderStructs+{0}, " + typeof(HDSubShaderUtilities).Assembly.FullName.ToString();
// process the template to generate the shader code for this pass
ShaderSpliceUtil.TemplatePreprocessor templatePreprocessor =
new ShaderSpliceUtil.TemplatePreprocessor(activeFields, namedFragments, debugOutput, templatePath, sourceAssetDependencyPaths, buildTypeAssemblyNameFormat);
// process the template to generate the shader code for this pass TODO: could make this a shared function
string[] templateLines = File.ReadAllLines(templateLocation);
System.Text.StringBuilder builder = new System.Text.StringBuilder();
foreach (string line in templateLines)
{
ShaderSpliceUtil.PreprocessShaderCode(line, activeFields, namedFragments, builder, debugOutput);
}
templatePreprocessor.ProcessTemplateFile(templateLocation);
result.AddShaderChunk(builder.ToString(), false);
result.AddShaderChunk(templatePreprocessor.GetShaderCode().ToString(), false);
return true;
}

162
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDUnlitPassForward.template


Pass
{
// based on HDUnlitPassForward.template
Name "${PassName}"
Tags { "LightMode" = "${LightMode}" }
Name "$splice(PassName)"
Tags { "LightMode" = "$splice(LightMode)" }
${Blending}
${Culling}
${ZTest}
${ZWrite}
${Stencil}
${ColorMask}
$splice(Blending)
$splice(Culling)
$splice(ZTest)
$splice(ZWrite)
$splice(Stencil)
$splice(ColorMask)
//-------------------------------------------------------------------------------------
// End Render Modes
//-------------------------------------------------------------------------------------

#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#pragma enable_d3d11_debug_symbols
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
//#pragma enable_d3d11_debug_symbols
//-------------------------------------------------------------------------------------
// Variant Definitions (active field translations to HDRP defines)

//-------------------------------------------------------------------------------------
// Defines
//-------------------------------------------------------------------------------------
${Defines}
$splice(Defines)
// this translates the new dependency tracker into the old preprocessor definitions for the existing HDRP shader code
$AttributesMesh.normalOS: #define ATTRIBUTES_NEED_NORMAL

// used for shaders that don't need lighting
#include "HDRP/Material/Material.hlsl"
#endif
#include "HDRP/Material/BuiltinUtilities.hlsl"
#include "HDRP/Material/MaterialUtilities.hlsl"
// this function assumes the bitangent flip is encoded in tangentWS.w

//-------------------------------------------------------------------------------------
// Interpolator Packing And Struct Declarations
//-------------------------------------------------------------------------------------
${InterpolatorPacking}
$buildType(AttributesMesh)
$buildType(VaryingsMeshToPS)
$buildType(VaryingsMeshToDS)
//-------------------------------------------------------------------------------------
// End Interpolator Packing And Struct Declarations
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
${Graph}
$splice(Graph)
#ifdef HAVE_MESH_MODIFICATION
// TODO: we should share this between template files somehow
VertexDescriptionInputs AttributesMeshToVertexDescriptionInputs(AttributesMesh input)
{
VertexDescriptionInputs output;
ZERO_INITIALIZE(VertexDescriptionInputs, output);
$VertexDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = input.normalOS;
$VertexDescriptionInputs.WorldSpaceNormal: output.WorldSpaceNormal = TransformObjectToWorldNormal(input.normalOS);
$VertexDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = TransformWorldToViewDir(output.WorldSpaceNormal);
$VertexDescriptionInputs.TangentSpaceNormal: output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
$VertexDescriptionInputs.ObjectSpaceTangent: output.ObjectSpaceTangent = input.tangentOS;
$VertexDescriptionInputs.WorldSpaceTangent: output.WorldSpaceTangent = TransformObjectToWorldDir(input.tangentOS.xyz);
$VertexDescriptionInputs.ViewSpaceTangent: output.ViewSpaceTangent = TransformWorldToViewDir(output.WorldSpaceTangent);
$VertexDescriptionInputs.TangentSpaceTangent: output.TangentSpaceTangent = float3(1.0f, 0.0f, 0.0f);
$VertexDescriptionInputs.ObjectSpaceBiTangent: output.ObjectSpaceBiTangent = normalize(cross(input.normalOS, input.tangentOS) * (input.tangentOS.w > 0.0f ? 1.0f : -1.0f) * GetOddNegativeScale());
$VertexDescriptionInputs.WorldSpaceBiTangent: output.WorldSpaceBiTangent = TransformObjectToWorldDir(output.ObjectSpaceBiTangent);
$VertexDescriptionInputs.ViewSpaceBiTangent: output.ViewSpaceBiTangent = TransformWorldToViewDir(output.WorldSpaceBiTangent);
$VertexDescriptionInputs.TangentSpaceBiTangent: output.TangentSpaceBiTangent = float3(0.0f, 1.0f, 0.0f);
$VertexDescriptionInputs.ObjectSpacePosition: output.ObjectSpacePosition = input.positionOS;
$VertexDescriptionInputs.WorldSpacePosition: output.WorldSpacePosition = GetAbsolutePositionWS(TransformObjectToWorld(input.positionOS));
$VertexDescriptionInputs.ViewSpacePosition: output.ViewSpacePosition = TransformWorldToView(output.WorldSpacePosition);
$VertexDescriptionInputs.TangentSpacePosition: output.TangentSpacePosition = float3(0.0f, 0.0f, 0.0f);
$VertexDescriptionInputs.WorldSpaceViewDirection: output.WorldSpaceViewDirection = GetWorldSpaceNormalizeViewDir(output.WorldSpacePosition);
$VertexDescriptionInputs.ObjectSpaceViewDirection: output.ObjectSpaceViewDirection = TransformWorldToObjectDir(output.WorldSpaceViewDirection);
$VertexDescriptionInputs.ViewSpaceViewDirection: output.ViewSpaceViewDirection = TransformWorldToViewDir(output.WorldSpaceViewDirection);
$VertexDescriptionInputs.TangentSpaceViewDirection: float3x3 tangentSpaceTransform = float3x3(output.WorldSpaceTangent,output.WorldSpaceBiTangent,output.WorldSpaceNormal);
$VertexDescriptionInputs.TangentSpaceViewDirection: output.TangentSpaceViewDirection = mul(tangentSpaceTransform, output.WorldSpaceViewDirection);
$VertexDescriptionInputs.ScreenPosition: output.ScreenPosition = ComputeScreenPos(TransformWorldToHClip(output.WorldSpacePosition), _ProjectionParams.x);
$VertexDescriptionInputs.uv0: output.uv0 = float4(input.uv0, 0.0f, 0.0f);
$VertexDescriptionInputs.uv1: output.uv1 = float4(input.uv1, 0.0f, 0.0f);
$VertexDescriptionInputs.uv2: output.uv2 = float4(input.uv2, 0.0f, 0.0f);
$VertexDescriptionInputs.uv3: output.uv3 = float4(input.uv3, 0.0f, 0.0f);
$VertexDescriptionInputs.VertexColor: output.VertexColor = input.color;
return output;
}
AttributesMesh ApplyMeshModification(AttributesMesh input)
{
// build graph inputs
VertexDescriptionInputs vertexDescriptionInputs = AttributesMeshToVertexDescriptionInputs(input);
// evaluate vertex graph
VertexDescription vertexDescription = VertexDescriptionFunction(vertexDescriptionInputs);
// copy graph output to the results
$VertexDescription.Position: input.positionOS = vertexDescription.Position;
return input;
}
#endif // HAVE_MESH_MODIFICATION
$features.modifyMesh: $include("VertexAnimation.template.hlsl")
// TODO: Do we want to build include functionality for sharing these preprocessed functions across templates?
FragInputs BuildFragInputs(VaryingsMeshToPS input)
{
FragInputs output;
ZERO_INITIALIZE(FragInputs, output);
$include("SharedCode.template.hlsl")
// Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used).
// TODO: this is a really poor workaround, but the variable is used in a bunch of places
// to compute normals which are then passed on elsewhere to compute other values...
output.worldToTangent = k_identity3x3;
output.positionSS = input.positionCS; // input.positionCS is SV_Position
$FragInputs.positionRWS: output.positionRWS = input.positionRWS;
$FragInputs.worldToTangent: output.worldToTangent = BuildWorldToTangent(input.tangentWS, input.normalWS);
$FragInputs.texCoord0: output.texCoord0 = input.texCoord0;
$FragInputs.texCoord1: output.texCoord1 = input.texCoord1;
$FragInputs.texCoord2: output.texCoord2 = input.texCoord2;
$FragInputs.texCoord3: output.texCoord3 = input.texCoord3;
$FragInputs.color: output.color = input.color;
#if SHADER_STAGE_FRAGMENT
$FragInputs.isFrontFace: output.isFrontFace = IS_FRONT_VFACE(input.cullFace, true, false); // TODO: SHADER_STAGE_FRAGMENT only
$FragInputs.isFrontFace: // Handle handness of the view matrix (In Unity view matrix default to a determinant of -1)
$FragInputs.isFrontFace: // when we render a cubemap the view matrix handness is flipped (due to convention used for cubemap) we have a determinant of +1
$FragInputs.isFrontFace: output.isFrontFace = _DetViewMatrix < 0.0 ? output.isFrontFace : !output.isFrontFace;
#endif // SHADER_STAGE_FRAGMENT
return output;
}
SurfaceDescriptionInputs FragInputsToSurfaceDescriptionInputs(FragInputs input, float3 viewWS)
{
SurfaceDescriptionInputs output;
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
$SurfaceDescriptionInputs.WorldSpaceNormal: output.WorldSpaceNormal = normalize(input.worldToTangent[2].xyz);
$SurfaceDescriptionInputs.ObjectSpaceNormal: output.ObjectSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_M); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.ViewSpaceNormal: output.ViewSpaceNormal = mul(output.WorldSpaceNormal, (float3x3) UNITY_MATRIX_I_V); // transposed multiplication by inverse matrix to handle normal scale
$SurfaceDescriptionInputs.TangentSpaceNormal: output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
$SurfaceDescriptionInputs.WorldSpaceTangent: output.WorldSpaceTangent = input.worldToTangent[0].xyz;
$SurfaceDescriptionInputs.ObjectSpaceTangent: output.ObjectSpaceTangent = TransformWorldToObjectDir(output.WorldSpaceTangent);
$SurfaceDescriptionInputs.ViewSpaceTangent: output.ViewSpaceTangent = TransformWorldToViewDir(output.WorldSpaceTangent);
$SurfaceDescriptionInputs.TangentSpaceTangent: output.TangentSpaceTangent = float3(1.0f, 0.0f, 0.0f);
$SurfaceDescriptionInputs.WorldSpaceBiTangent: output.WorldSpaceBiTangent = input.worldToTangent[1].xyz;
$SurfaceDescriptionInputs.ObjectSpaceBiTangent: output.ObjectSpaceBiTangent = TransformWorldToObjectDir(output.WorldSpaceBiTangent);
$SurfaceDescriptionInputs.ViewSpaceBiTangent: output.ViewSpaceBiTangent = TransformWorldToViewDir(output.WorldSpaceBiTangent);
$SurfaceDescriptionInputs.TangentSpaceBiTangent: output.TangentSpaceBiTangent = float3(0.0f, 1.0f, 0.0f);
$SurfaceDescriptionInputs.WorldSpaceViewDirection: output.WorldSpaceViewDirection = normalize(viewWS);
$SurfaceDescriptionInputs.ObjectSpaceViewDirection: output.ObjectSpaceViewDirection = TransformWorldToObjectDir(output.WorldSpaceViewDirection);
$SurfaceDescriptionInputs.ViewSpaceViewDirection: output.ViewSpaceViewDirection = TransformWorldToViewDir(output.WorldSpaceViewDirection);
$SurfaceDescriptionInputs.TangentSpaceViewDirection: float3x3 tangentSpaceTransform = float3x3(output.WorldSpaceTangent,output.WorldSpaceBiTangent,output.WorldSpaceNormal);
$SurfaceDescriptionInputs.TangentSpaceViewDirection: output.TangentSpaceViewDirection = mul(tangentSpaceTransform, output.WorldSpaceViewDirection);
$SurfaceDescriptionInputs.WorldSpacePosition: output.WorldSpacePosition = GetAbsolutePositionWS(input.positionRWS);
$SurfaceDescriptionInputs.ObjectSpacePosition: output.ObjectSpacePosition = TransformWorldToObject(input.positionRWS);
$SurfaceDescriptionInputs.ViewSpacePosition: float4 posViewSpace = TransformWorldToView(input.positionRWS);
$SurfaceDescriptionInputs.ViewSpacePosition: output.ViewSpacePosition = posViewSpace.xyz / posViewSpace.w;
$SurfaceDescriptionInputs.TangentSpacePosition: output.TangentSpacePosition = float3(0.0f, 0.0f, 0.0f);
$SurfaceDescriptionInputs.ScreenPosition: output.ScreenPosition = ComputeScreenPos(TransformWorldToHClip(input.positionRWS), _ProjectionParams.x);
$SurfaceDescriptionInputs.uv0: output.uv0 = float4(input.texCoord0, 0.0f, 0.0f);
$SurfaceDescriptionInputs.uv1: output.uv1 = float4(input.texCoord1, 0.0f, 0.0f);
$SurfaceDescriptionInputs.uv2: output.uv2 = float4(input.texCoord2, 0.0f, 0.0f);
$SurfaceDescriptionInputs.uv3: output.uv3 = float4(input.texCoord3, 0.0f, 0.0f);
$SurfaceDescriptionInputs.VertexColor: output.VertexColor = input.color;
$SurfaceDescriptionInputs.FaceSign: output.FaceSign = input.isFrontFace;
return output;
}
// existing HDRP code uses the combined function to go directly from packed to frag inputs
FragInputs UnpackVaryingsMeshToFragInputs(PackedVaryingsMeshToPS input)
{
VaryingsMeshToPS unpacked= UnpackVaryingsMeshToPS(input);
return BuildFragInputs(unpacked);
}
void BuildSurfaceData(FragInputs fragInputs, SurfaceDescription surfaceDescription, float3 V, out SurfaceData surfaceData)
{

//-------------------------------------------------------------------------------------
// Pass Includes
//-------------------------------------------------------------------------------------
${Includes}
$splice(Includes)
//-------------------------------------------------------------------------------------
// End Pass Includes
//-------------------------------------------------------------------------------------

2
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/Deferred.compute


BSDFData bsdfData;
BuiltinData builtinData;
DECODE_FROM_GBUFFER(posInput.positionSS, UINT_MAX, bsdfData, builtinData);
DECODE_FROM_GBUFFER(posInput.positionSS, featureFlags, bsdfData, builtinData);
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData);

74
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs


static int s_GenAABBKernel;
static int s_GenAABBKernel_Oblique;
static int s_GenListPerTileKernel_Oblique;
static int s_GenListPerVoxelKernelOblique;
static int s_ClearVoxelAtomicKernel;
static int s_ClearDispatchIndirectKernel;
static int s_BuildDispatchIndirectKernel;

{
{ "TileLightListGen_NoDepthRT", "TileLightListGen_DepthRT", "TileLightListGen_DepthRT_MSAA" },
{ "TileLightListGen_NoDepthRT_SrcBigTile", "TileLightListGen_DepthRT_SrcBigTile", "TileLightListGen_DepthRT_MSAA_SrcBigTile" }
};
static string[,] s_ClusterObliqueKernelNames = new string[(int)ClusterPrepassSource.Count, (int)ClusterDepthSource.Count]
{
{ "TileLightListGen_NoDepthRT ", "TileLightListGen_DepthRT_Oblique", "TileLightListGen_DepthRT_MSAA_Oblique" },
{ "TileLightListGen_NoDepthRT_SrcBigTile", "TileLightListGen_DepthRT_SrcBigTile_Oblique", "TileLightListGen_DepthRT_MSAA_SrcBigTile_Oblique" }
};
// clustered light list specific buffers and data end

m_ReflectionPlanarProbeCache = new PlanarReflectionProbeCache(hdAsset, iblFilterGGX, gLightLoopSettings.planarReflectionProbeCacheSize, (int)gLightLoopSettings.planarReflectionTextureSize, planarProbeCacheFormat, true);
s_GenAABBKernel = buildScreenAABBShader.FindKernel("ScreenBoundsAABB");
s_GenAABBKernel_Oblique = buildScreenAABBShader.FindKernel("ScreenBoundsAABB_Oblique");
// The bounds and light volumes are view-dependent, and AABB is additionally projection dependent.
// The view and proj matrices are per eye in stereo. This means we have to double the size of these buffers.

s_AABBBoundsBuffer = new ComputeBuffer(k_MaxStereoEyes * 2 * k_MaxLightsOnScreen, 3 * sizeof(float));
s_AABBBoundsBuffer = new ComputeBuffer(k_MaxStereoEyes * 2 * k_MaxLightsOnScreen, 4 * sizeof(float));
s_ConvexBoundsBuffer = new ComputeBuffer(k_MaxStereoEyes * k_MaxLightsOnScreen, System.Runtime.InteropServices.Marshal.SizeOf(typeof(SFiniteLightBound)));
s_LightVolumeDataBuffer = new ComputeBuffer(k_MaxStereoEyes * k_MaxLightsOnScreen, System.Runtime.InteropServices.Marshal.SizeOf(typeof(LightVolumeData)));
s_DispatchIndirectBuffer = new ComputeBuffer(LightDefinitions.s_NumFeatureVariants * 3, sizeof(uint), ComputeBufferType.IndirectArguments);

clustDepthSourceIdx = ClusterDepthSource.Depth;
}
var kernelName = s_ClusterKernelNames[(int)clustPrepassSourceIdx, (int)clustDepthSourceIdx];
var kernelObliqueName = s_ClusterObliqueKernelNames[(int)clustPrepassSourceIdx, (int)clustDepthSourceIdx];
s_GenListPerVoxelKernelOblique = buildPerVoxelLightListShader.FindKernel(kernelObliqueName);
s_GenListPerTileKernel_Oblique = buildPerTileLightListShader.FindKernel(m_FrameSettings.lightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile_FeatureFlags_Oblique" : "TileLightListGen_FeatureFlags_Oblique");
s_GenListPerTileKernel_Oblique = buildPerTileLightListShader.FindKernel(m_FrameSettings.lightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile_Oblique" : "TileLightListGen_Oblique");
}
m_CookieTexArray.NewFrame();

void VoxelLightListGeneration(CommandBuffer cmd, HDCamera hdCamera, Matrix4x4[] projscrArr, Matrix4x4[] invProjscrArr, RenderTargetIdentifier cameraDepthBufferRT)
{
Camera camera = hdCamera.camera;
var isProjectionOblique = GeometryUtils.IsProjectionMatrixOblique(camera.projectionMatrix);
// clear atomic offset index
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_ClearVoxelAtomicKernel, HDShaderIDs.g_LayeredSingleIdxBuffer, s_GlobalLightListAtomic);
cmd.DispatchCompute(buildPerVoxelLightListShader, s_ClearVoxelAtomicKernel, 1, 1, 1);

cmd.SetComputeFloatParam(buildPerVoxelLightListShader, HDShaderIDs.g_fClustScale, m_ClustScale);
cmd.SetComputeFloatParam(buildPerVoxelLightListShader, HDShaderIDs.g_fClustBase, k_ClustLogBase);
cmd.SetComputeTextureParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_depth_tex, cameraDepthBufferRT);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_vLayeredLightList, s_PerVoxelLightLists);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_LayeredOffset, s_PerVoxelOffset);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_LayeredSingleIdxBuffer, s_GlobalLightListAtomic);
var genListPerVoxelKernel = isProjectionOblique ? s_GenListPerVoxelKernelOblique : s_GenListPerVoxelKernel;
cmd.SetComputeTextureParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs.g_depth_tex, cameraDepthBufferRT);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs.g_vLayeredLightList, s_PerVoxelLightLists);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs.g_LayeredOffset, s_PerVoxelOffset);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs.g_LayeredSingleIdxBuffer, s_GlobalLightListAtomic);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_vBigTileLightList, s_BigTileLightList);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs.g_vBigTileLightList, s_BigTileLightList);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_logBaseBuffer, s_PerTileLogBaseTweak);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs.g_logBaseBuffer, s_PerTileLogBaseTweak);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_vBoundsBuffer, s_AABBBoundsBuffer);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs._LightVolumeData, s_LightVolumeDataBuffer);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, HDShaderIDs.g_data, s_ConvexBoundsBuffer);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs.g_vBoundsBuffer, s_AABBBoundsBuffer);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs._LightVolumeData, s_LightVolumeDataBuffer);
cmd.SetComputeBufferParam(buildPerVoxelLightListShader, genListPerVoxelKernel, HDShaderIDs.g_data, s_ConvexBoundsBuffer);
//cmd.DispatchCompute(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, numTilesX, numTilesY, 1);
cmd.DispatchCompute(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, numTilesX, numTilesY, numEyes);
//cmd.DispatchCompute(buildPerVoxelLightListShader, genListPerVoxelKernel, numTilesX, numTilesY, 1);
cmd.DispatchCompute(buildPerVoxelLightListShader, genListPerVoxelKernel, numTilesX, numTilesY, numEyes);
}
public void BuildGPULightListsCommon(HDCamera hdCamera, CommandBuffer cmd, RenderTargetIdentifier cameraDepthBufferRT, RenderTargetIdentifier stencilTextureRT, bool skyEnabled)

projArr[eyeIndex] = CameraProjectionStereoLHS(hdCamera.camera, (Camera.StereoscopicEye)eyeIndex);
projscrArr[eyeIndex] = temp * projArr[eyeIndex];
invProjscrArr[eyeIndex] = projscrArr[eyeIndex].inverse;
projArr[0] = CameraProjectionNonObliqueLHS(hdCamera);
projArr[0] = GeometryUtils.GetProjectionMatrixLHS(hdCamera.camera);
var isProjectionOblique = GeometryUtils.IsProjectionMatrixOblique(projArr[0]);
// generate screen-space AABBs (used for both fptl and clustered).
if (m_lightCount != 0)

invProjhArr[0] = projhArr[0].inverse;
}
var genAABBKernel = isProjectionOblique ? s_GenAABBKernel_Oblique : s_GenAABBKernel;
cmd.SetComputeBufferParam(buildScreenAABBShader, s_GenAABBKernel, HDShaderIDs.g_data, s_ConvexBoundsBuffer);
cmd.SetComputeBufferParam(buildScreenAABBShader, genAABBKernel, HDShaderIDs.g_data, s_ConvexBoundsBuffer);
cmd.SetComputeBufferParam(buildScreenAABBShader, s_GenAABBKernel, HDShaderIDs.g_vBoundsBuffer, s_AABBBoundsBuffer);
cmd.SetComputeBufferParam(buildScreenAABBShader, genAABBKernel, HDShaderIDs.g_vBoundsBuffer, s_AABBBoundsBuffer);
cmd.DispatchCompute(buildScreenAABBShader, s_GenAABBKernel, (m_lightCount + 7) / 8, tgY, 1);
cmd.DispatchCompute(buildScreenAABBShader, genAABBKernel, (m_lightCount + 7) / 8, tgY, 1);
}
// enable coarse 2D pass on 64x64 tiles (used for both fptl and clustered).

// optimized for opaques only
if (m_FrameSettings.lightLoopSettings.isFptlEnabled)
{
var genListPerTileKernel = isProjectionOblique ? s_GenListPerTileKernel_Oblique : s_GenListPerTileKernel;
cmd.SetComputeIntParam(buildPerTileLightListShader, HDShaderIDs.g_isOrthographic, isOrthographic ? 1 : 0);
cmd.SetComputeIntParams(buildPerTileLightListShader, HDShaderIDs.g_viDimensions, s_TempScreenDimArray);
cmd.SetComputeIntParam(buildPerTileLightListShader, HDShaderIDs._EnvLightIndexShift, m_lightList.lights.Count);

cmd.SetComputeBufferParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_vBoundsBuffer, s_AABBBoundsBuffer);
cmd.SetComputeBufferParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs._LightVolumeData, s_LightVolumeDataBuffer);
cmd.SetComputeBufferParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_data, s_ConvexBoundsBuffer);
cmd.SetComputeBufferParam(buildPerTileLightListShader, genListPerTileKernel, HDShaderIDs.g_vBoundsBuffer, s_AABBBoundsBuffer);
cmd.SetComputeBufferParam(buildPerTileLightListShader, genListPerTileKernel, HDShaderIDs._LightVolumeData, s_LightVolumeDataBuffer);
cmd.SetComputeBufferParam(buildPerTileLightListShader, genListPerTileKernel, HDShaderIDs.g_data, s_ConvexBoundsBuffer);
cmd.SetComputeTextureParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_depth_tex, cameraDepthBufferRT);
cmd.SetComputeBufferParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_vLightList, s_LightList);
cmd.SetComputeTextureParam(buildPerTileLightListShader, genListPerTileKernel, HDShaderIDs.g_depth_tex, cameraDepthBufferRT);
cmd.SetComputeBufferParam(buildPerTileLightListShader, genListPerTileKernel, HDShaderIDs.g_vLightList, s_LightList);
cmd.SetComputeBufferParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_vBigTileLightList, s_BigTileLightList);
cmd.SetComputeBufferParam(buildPerTileLightListShader, genListPerTileKernel, HDShaderIDs.g_vBigTileLightList, s_BigTileLightList);
if (enableFeatureVariants)
{

baseFeatureFlags |= LightDefinitions.s_MaterialFeatureMaskFlags;
}
cmd.SetComputeIntParam(buildPerTileLightListShader, HDShaderIDs.g_BaseFeatureFlags, (int)baseFeatureFlags);
cmd.SetComputeBufferParam(buildPerTileLightListShader, s_GenListPerTileKernel, HDShaderIDs.g_TileFeatureFlags, s_TileFeatureFlags);
cmd.SetComputeBufferParam(buildPerTileLightListShader, genListPerTileKernel, HDShaderIDs.g_TileFeatureFlags, s_TileFeatureFlags);
cmd.DispatchCompute(buildPerTileLightListShader, s_GenListPerTileKernel, numTilesX, numTilesY, 1);
cmd.DispatchCompute(buildPerTileLightListShader, genListPerTileKernel, numTilesX, numTilesY, 1);
}
// Cluster

20
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/lightlistbuild-bigtile.compute


#define EXACT_EDGE_TESTS
#define PERFORM_SPHERICAL_INTERSECTION_TESTS
// is not actually used for anything in this kernel
#define USE_OBLIQUE_MODE
#define MAX_NR_BIGTILE_LIGHTS (MAX_NR_BIG_TILE_LIGHTS_PLUS_ONE-1)

uniform float g_fFarPlane;
uniform uint g_isOrthographic;
StructuredBuffer<float3> g_vBoundsBuffer : register( t1 );
StructuredBuffer<float4> g_vBoundsBuffer : register( t1 );
StructuredBuffer<LightVolumeData> _LightVolumeData : register(t2);
StructuredBuffer<SFiniteLightBound> g_data : register( t3 );

// TODO: Remove this function and g_mInvScrProjectionArr from constants.
// Only usage of that constant.
float GetLinearDepth(float zDptBufSpace) // 0 is near 1 is far
float GetLinearDepth(float2 pixXY, float zDptBufSpace) // 0 is near 1 is far
float4x4 g_mInvScrProjection = g_mInvScrProjectionArr[0];
float4x4 g_mInvScrProjection = g_mInvScrProjectionArr[0];
// for perspective projection m22 is zero and m23 is +1/-1 (depends on left/right hand proj)
#ifdef USE_OBLIQUE_MODE
float2 res2 = mul(g_mInvScrProjection, float4(pixXY, zDptBufSpace, 1.0)).zw;
return res2.x / res2.y;
#else
// for perspective projection m22 is zero and m23 is +1/-1 (depends on left/right hand proj)
//float3 vP = float3(0.0f,0.0f,zDptBufSpace);
//float4 v4Pres = mul(g_mInvScrProjection, float4(vP,1.0));
//return v4Pres.z / v4Pres.w;
#endif
}
float3 GetViewPosFromLinDepth(float2 v2ScrPos, float fLinDepth, uint eyeIndex)

68
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/lightlistbuild-clustered.compute


#pragma kernel TileLightListGen_NoDepthRT_SrcBigTile LIGHTLISTGEN=TileLightListGen_NoDepthRT_SrcBigTile USE_TWO_PASS_TILED_LIGHTING
#pragma kernel TileLightListGen_DepthRT_SrcBigTile LIGHTLISTGEN=TileLightListGen_DepthRT_SrcBigTile ENABLE_DEPTH_TEXTURE_BACKPLANE USE_TWO_PASS_TILED_LIGHTING
#pragma kernel TileLightListGen_DepthRT_MSAA_SrcBigTile LIGHTLISTGEN=TileLightListGen_DepthRT_MSAA_SrcBigTile ENABLE_DEPTH_TEXTURE_BACKPLANE MSAA_ENABLED USE_TWO_PASS_TILED_LIGHTING
#pragma kernel TileLightListGen_DepthRT_Oblique LIGHTLISTGEN=TileLightListGen_DepthRT_Oblique ENABLE_DEPTH_TEXTURE_BACKPLANE USE_OBLIQUE_MODE
#pragma kernel TileLightListGen_DepthRT_MSAA_Oblique LIGHTLISTGEN=TileLightListGen_DepthRT_MSAA_Oblique ENABLE_DEPTH_TEXTURE_BACKPLANE MSAA_ENABLED USE_OBLIQUE_MODE
#pragma kernel TileLightListGen_DepthRT_SrcBigTile_Oblique LIGHTLISTGEN=TileLightListGen_DepthRT_SrcBigTile_Oblique ENABLE_DEPTH_TEXTURE_BACKPLANE USE_TWO_PASS_TILED_LIGHTING USE_OBLIQUE_MODE
#pragma kernel TileLightListGen_DepthRT_MSAA_SrcBigTile_Oblique LIGHTLISTGEN=TileLightListGen_DepthRT_MSAA_SrcBigTile_Oblique ENABLE_DEPTH_TEXTURE_BACKPLANE MSAA_ENABLED USE_TWO_PASS_TILED_LIGHTING USE_OBLIQUE_MODE
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "ShaderBase.hlsl"

#else
Texture2D g_depth_tex : register( t0 );
#endif
StructuredBuffer<float3> g_vBoundsBuffer : register( t1 );
StructuredBuffer<float4> g_vBoundsBuffer : register( t1 );
StructuredBuffer<LightVolumeData> _LightVolumeData : register(t2);
StructuredBuffer<SFiniteLightBound> g_data : register( t3 );

groupshared uint lightOffsSph;
#endif
float GetLinearDepth(float zDptBufSpace, uint eyeIndex) // 0 is near 1 is far
float GetLinearDepth(float2 pixXY, float zDptBufSpace, uint eyeIndex) // 0 is near 1 is far
#ifdef USE_OBLIQUE_MODE
float2 res2 = mul(g_mInvScrProjection, float4(pixXY, zDptBufSpace, 1.0)).zw;
return res2.x / res2.y;
#else
// for perspective projection m22 is zero and m23 is +1/-1 (depends on left/right hand proj)
// however this function must also work for orthographic projection so we keep it like this.
float m22 = g_mInvScrProjection[2].z, m23 = g_mInvScrProjection[2].w;

//float3 vP = float3(0.0f,0.0f,zDptBufSpace);
//float4 v4Pres = mul(g_mInvScrProjection, float4(vP,1.0));
//return v4Pres.z / v4Pres.w;
#endif
}
float3 GetViewPosFromLinDepth(float2 v2ScrPos, float fLinDepth, uint eyeIndex)

bool CheckIntersection(int l, int k, uint2 viTilLL, uint2 viTilUR, float suggestedBase, uint eyeIndex)
{
// If this light's screen space depth bounds intersect this cluster...simple cluster test
// TODO: Unify this code with the code in CheckIntersectionBasic...
unsigned int val = (clusterIdxs[l>>1]>>(16*(l&1)))&0xffff;
bool bIsHit = ((val>>0)&0xff)<=((uint) k) && ((uint) k)<=((val>>8)&0xff);
if(bIsHit)

GroupMemoryBarrierWithGroupSync();
#endif
float dpt_ma=1.0;
//float linMaDist=g_fFarPlane;
// establish min and max depth first
dpt_ma=0.0;
// establish max depth first
float linMaDist=0.0;
for(int idx=t; idx<(TILE_SIZE_CLUSTERED*TILE_SIZE_CLUSTERED); idx+=NR_THREADS)
{

for(int i=0; i<g_iNumSamplesMSAA; i++)
{
const float fDpth = FetchDepthMSAA(g_depth_tex, uPixCrd, i);
const float2 fracSampleCoord = g_depth_tex.GetSamplePosition(i).xy; // this is optimized away when USE_OBLIQUE_MODE is NOT set.
const float2 fracSampleCoord = float2(0.5,0.5);
dpt_ma = max(fDpth, dpt_ma);
// unclear here if stereoDWOffset is taken into account in g_mInvScrProjectionArr[eyeIndex] used in GetLinearDepth()
// otherwise it should not be included in uPixCrd when querying GetLinearDepth().
float linZ = GetLinearDepth(uPixCrd+fracSampleCoord, fDpth, eyeIndex);
#if USE_LEFT_HAND_CAMERA_SPACE
float linDistZ = linZ;
#else
float linDistZ = -linZ;
#endif
linMaDist = max(linDistZ, linMaDist);
}
#ifdef MSAA_ENABLED
}

// Why is this a uint? Doesn't InterlockedMax support shared mem floats?
InterlockedMax(ldsZMax, asuint(dpt_ma) );
linMaDist = max(linMaDist, 0.0);
InterlockedMax(ldsZMax, asuint(linMaDist) );
dpt_ma = asfloat(ldsZMax);
if(dpt_ma<=0.0) dpt_ma = VIEWPORT_SCALE_Z; // assume sky pixel
linMaDist = asfloat(ldsZMax);
if(linMaDist<=0.0) linMaDist = g_fFarPlane; // assume sky pixel
#endif
// 'Normalized' coordinates of tile, for use with AABB bounds in g_vBoundsBuffer

for(int l=(int) t; l<(int) g_iNrVisibLights; l += NR_THREADS)
{
#endif
// TODO: Seems kinda funny that we repeat this exact code here, bigtile, and FPTL...
const ScreenSpaceBoundsIndices boundsIndices = GenerateScreenSpaceBoundsIndices(l, g_iNrVisibLights, eyeIndex);
const float2 vMi = g_vBoundsBuffer[boundsIndices.min].xy;
const float2 vMa = g_vBoundsBuffer[boundsIndices.max].xy;

#endif
#ifdef ENABLE_DEPTH_TEXTURE_BACKPLANE
#if USE_LEFT_HAND_CAMERA_SPACE
float fTileFarPlane = GetLinearDepth(dpt_ma, eyeIndex);
#else // USE_LEFT_HAND_CAMERA_SPACE
float fTileFarPlane = -GetLinearDepth(dpt_ma, eyeIndex);
#endif
float fTileFarPlane = linMaDist;
float suggestedBase = SuggestLogBase50(fTileFarPlane);
#else // ENABLE_DEPTH_TEXTURE_BACKPLANE
float fTileFarPlane = g_fFarPlane;

#endif
// sort lights (gives a more efficient execution in both deferred and tiled forward lighting).
// NOTE: Why not sort on console?
#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL)
SORTLIST(coarseList, iNrCoarseLights, MAX_NR_COARSE_ENTRIES, t, NR_THREADS);
#endif

const ScreenSpaceBoundsIndices l0Bounds = GenerateScreenSpaceBoundsIndices(l0, g_iNrVisibLights, eyeIndex);
const ScreenSpaceBoundsIndices l1Bounds = GenerateScreenSpaceBoundsIndices(l1, g_iNrVisibLights, eyeIndex);
const unsigned int clustIdxMi0 = (const unsigned int)min(255, SnapToClusterIdx(GetLinearDepth(g_vBoundsBuffer[l0Bounds.min].z, eyeIndex), suggestedBase));
const unsigned int clustIdxMa0 = (const unsigned int)min(255, SnapToClusterIdx(GetLinearDepth(g_vBoundsBuffer[l0Bounds.max].z, eyeIndex), suggestedBase));
const unsigned int clustIdxMi1 = (const unsigned int)min(255, SnapToClusterIdx(GetLinearDepth(g_vBoundsBuffer[l1Bounds.min].z, eyeIndex), suggestedBase));
const unsigned int clustIdxMa1 = (const unsigned int)min(255, SnapToClusterIdx(GetLinearDepth(g_vBoundsBuffer[l1Bounds.max].z, eyeIndex), suggestedBase));
const unsigned int clustIdxMi0 = (const unsigned int)min(255, SnapToClusterIdx(g_vBoundsBuffer[l0Bounds.min].w, suggestedBase));
const unsigned int clustIdxMa0 = (const unsigned int)min(255, SnapToClusterIdx(g_vBoundsBuffer[l0Bounds.max].w, suggestedBase));
const unsigned int clustIdxMi1 = (const unsigned int)min(255, SnapToClusterIdx(g_vBoundsBuffer[l1Bounds.min].w, suggestedBase));
const unsigned int clustIdxMa1 = (const unsigned int)min(255, SnapToClusterIdx(g_vBoundsBuffer[l1Bounds.max].w, suggestedBase));
clusterIdxs[l] = (clustIdxMa1<<24) | (clustIdxMi1<<16) | (clustIdxMa0<<8) | (clustIdxMi0<<0);
}
}

// to make it work correctly
int shiftIndex[LIGHTCATEGORY_COUNT];
ZERO_INITIALIZE_ARRAY(int, shiftIndex, LIGHTCATEGORY_COUNT);
// NOTE: Why is this indexed like this?
shiftIndex[LIGHTCATEGORY_COUNT - 3] = _EnvLightIndexShift;
shiftIndex[LIGHTCATEGORY_COUNT - 2] = _DecalIndexShift;
shiftIndex[LIGHTCATEGORY_COUNT - 1] = _DensityVolumeIndexShift;

38
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/lightlistbuild.compute


// https://github.com/wolfgangfengel/GPU-Pro-7
#pragma kernel TileLightListGen LIGHTLISTGEN=TileLightListGen
#pragma kernel TileLightListGen_SrcBigTile LIGHTLISTGEN=TileLightListGen_SrcBigTile USE_TWO_PASS_TILED_LIGHTING
#pragma kernel TileLightListGen_FeatureFlags LIGHTLISTGEN=TileLightListGen_FeatureFlags USE_FEATURE_FLAGS
#pragma kernel TileLightListGen_SrcBigTile_FeatureFlags LIGHTLISTGEN=TileLightListGen_SrcBigTile_FeatureFlags USE_TWO_PASS_TILED_LIGHTING USE_FEATURE_FLAGS
#pragma kernel TileLightListGen_SrcBigTile LIGHTLISTGEN=TileLightListGen_SrcBigTile USE_TWO_PASS_TILED_LIGHTING
#pragma kernel TileLightListGen_FeatureFlags LIGHTLISTGEN=TileLightListGen_FeatureFlags USE_FEATURE_FLAGS
#pragma kernel TileLightListGen_SrcBigTile_FeatureFlags LIGHTLISTGEN=TileLightListGen_SrcBigTile_FeatureFlags USE_TWO_PASS_TILED_LIGHTING USE_FEATURE_FLAGS
#pragma kernel TileLightListGen_Oblique LIGHTLISTGEN=TileLightListGen_Oblique USE_OBLIQUE_MODE
#pragma kernel TileLightListGen_SrcBigTile_Oblique LIGHTLISTGEN=TileLightListGen_SrcBigTile_Oblique USE_TWO_PASS_TILED_LIGHTING USE_OBLIQUE_MODE
#pragma kernel TileLightListGen_FeatureFlags_Oblique LIGHTLISTGEN=TileLightListGen_FeatureFlags_Oblique USE_FEATURE_FLAGS USE_OBLIQUE_MODE
#pragma kernel TileLightListGen_SrcBigTile_FeatureFlags_Oblique LIGHTLISTGEN=TileLightListGen_SrcBigTile_FeatureFlags_Oblique USE_TWO_PASS_TILED_LIGHTING USE_FEATURE_FLAGS USE_OBLIQUE_MODE
//#pragma #pragma enable_d3d11_debug_symbols

#define FINE_PRUNING_ENABLED
#define PERFORM_SPHERICAL_INTERSECTION_TESTS
uniform int g_iNrVisibLights;
uniform uint2 g_viDimensions;
uniform float4x4 g_mInvScrProjection;

uniform uint g_BaseFeatureFlags;
Texture2D g_depth_tex : register( t0 );
StructuredBuffer<float3> g_vBoundsBuffer : register( t1 );
StructuredBuffer<float4> g_vBoundsBuffer : register( t1 );
StructuredBuffer<LightVolumeData> _LightVolumeData : register(t2);
StructuredBuffer<SFiniteLightBound> g_data : register( t3 );

RWStructuredBuffer<uint> g_TileFeatureFlags;
#endif
//float GetLinearDepth(float3 vP)
//{
// float4 v4Pres = mul(g_mInvScrProjection, float4(vP,1.0));
// return v4Pres.z / v4Pres.w;
//}
float GetLinearDepth(float zDptBufSpace) // 0 is near 1 is far
float GetLinearDepth(float2 pixXY, float zDptBufSpace) // 0 is near 1 is far
// for perspective projection m22 is zero and m23 is +1/-1 (depends on left/right hand proj)
#ifdef USE_OBLIQUE_MODE
float2 res2 = mul(g_mInvScrProjection, float4(pixXY, zDptBufSpace, 1.0)).zw;
return res2.x / res2.y;
#else
// for perspective projection m22 is zero and m23 is +1/-1 (depends on left/right hand proj)
//float3 vP = float3(0.0f,0.0f,zDptBufSpace);
//float4 v4Pres = mul(g_mInvScrProjection, float4(vP,1.0));
//return v4Pres.z / v4Pres.w;
#endif
}
float3 GetViewPosFromLinDepth(float2 v2ScrPos, float fLinDepth)

int idx = i * NR_THREADS + t;
uint2 uCrd = min( uint2(viTilLL.x+(idx&0xf), viTilLL.y+(idx>>4)), uint2(iWidth-1, iHeight-1) );
const float fDepth = FetchDepth(g_depth_tex, uCrd);
vLinDepths[i] = GetLinearDepth(fDepth);
vLinDepths[i] = GetLinearDepth(uCrd+float2(0.5,0.5), fDepth);
if(fDepth<VIEWPORT_SCALE_Z) // if not skydome
{
dpt_mi = min(fDepth, dpt_mi);

// Skip density volumes (lights are sorted by category). TODO: improve data locality
if (_LightVolumeData[l].lightCategory == LIGHTCATEGORY_DENSITY_VOLUME) { break; }
const float3 vMi = g_vBoundsBuffer[l];
const float3 vMa = g_vBoundsBuffer[l+g_iNrVisibLights];
const float3 vMi = g_vBoundsBuffer[l].xyz;
const float3 vMa = g_vBoundsBuffer[l+g_iNrVisibLights].xyz;
if( all(vMa>vTileLL) && all(vMi<vTileUR))
{

67
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/scrbound.compute


// The implementation is based on the demo on "fine pruned tiled lighting" published in GPU Pro 7.
// https://github.com/wolfgangfengel/GPU-Pro-7
#pragma kernel ScreenBoundsAABB
#pragma kernel ScreenBoundsAABB SCRAABBGEN=ScreenBoundsAABB
#pragma kernel ScreenBoundsAABB_Oblique SCRAABBGEN=ScreenBoundsAABB_Oblique USE_OBLIQUE_MODE
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "LightLoop.cs.hlsl"

#define NR_THREADS 64
// output buffer
RWStructuredBuffer<float3> g_vBoundsBuffer : register( u0 );
RWStructuredBuffer<float4> g_vBoundsBuffer : register( u0 );
#define MAX_PNTS 9 // strictly this should be 10=6+4 but we get more wavefronts and 10 seems to never hit (fingers crossed)
// However, worst case the plane that would be skipped if such an extreme case ever happened would be backplane

[numthreads(NR_THREADS, 1, 1)]
void ScreenBoundsAABB(uint threadID : SV_GroupIndex, uint3 u3GroupID : SV_GroupID)
void SCRAABBGEN(uint threadID : SV_GroupIndex, uint3 u3GroupID : SV_GroupID)
{
uint groupID = u3GroupID.x;
uint eyeIndex = u3GroupID.y; // currently, can only be 0 or 1

}
////////////////////// look for camera frustum verts that need to be included. That is frustum vertices inside the convex hull for the light
#ifdef USE_OBLIQUE_MODE
bool bIsObliqueClipPlane = true;
#else
bool bIsObliqueClipPlane = false;
#endif
const int nrFrustVertsToTest = bIsObliqueClipPlane ? 4 : 8;
for(i=0; i<8; i++) // establish 8 camera frustum vertices
for(i=0; i<nrFrustVertsToTest; i++) // establish 8 camera frustum vertices
{
float3 vVertPSpace = float3((i&1)!=0 ? 1 : (-1), (i&2)!=0 ? 1 : (-1), (i&4)!=0 ? 1 : 0);

float3 vP0, vN;
GetHullPlane(vP0, vN, boxX, boxY, boxZ, center, scaleXY, f);
for(i=0; i<8; i++)
for(i=0; i<nrFrustVertsToTest; i++)
{
float3 vViewSpace = float3(posX[subLigt*MAX_PNTS*2 + i], posY[subLigt*MAX_PNTS*2 + i], posZ[subLigt*MAX_PNTS*2 + i]);
uVisibFl &= ( dot(vViewSpace-vP0, vN)<0 ? 0xff : (~(1<<i)) );

// apply camera frustum vertices inside the convex hull to the AABB
for(i=0; i<8; i++)
for(i=0; i<nrFrustVertsToTest; i++)
{
if((uVisibFl&(1<<i))!=0)
{

vMin.xy = max(vMin.xy, vMi);
vMax.xy = min(vMax.xy, vMa);
}
#ifndef USE_OBLIQUE_MODE
#if USE_LEFT_HAND_CAMERA_SPACE
if((center.z-radius)>0.0)
{

vMin = float3(-3,-3,-3);
vMax = float3(-2,-2,-2);
}
#endif
}

// a set of maxs, and each set is equal to g_iNrVisibLights.
const ScreenSpaceBoundsIndices boundsIndices = GenerateScreenSpaceBoundsIndices(lgtIndex, g_iNrVisibLights, eyeIndex);
g_vBoundsBuffer[boundsIndices.min] = float3(0.5*vMin.x + 0.5, 0.5*vMin.y + 0.5, vMin.z*VIEWPORT_SCALE_Z);
g_vBoundsBuffer[boundsIndices.max] = float3(0.5*vMax.x + 0.5, 0.5*vMax.y + 0.5, vMax.z*VIEWPORT_SCALE_Z);
// build a linear (in camera space) min/max Z for the aabb. This is needed for clustered when oblique is active
float linMiZ, linMaZ;
#ifndef USE_OBLIQUE_MODE
float2 vMiZW = mul(g_mInvProjection, float4(vMin,1)).zw;
float2 vMaZW = mul(g_mInvProjection, float4(vMax,1)).zw;
linMiZ = vMiZW.x/vMiZW.y; linMaZ = vMaZW.x/vMaZW.y;
#else
for(int i=0; i<8; i++) // establish 8 aabb points in camera space.
{
float3 vP = float3((i&1)!=0 ? vMax.x : vMin.x, (i&2)!=0 ? vMax.y : vMin.y, (i&4)!=0 ? vMax.z : vMin.z);
float2 v2Pc = mul(g_mInvProjection, float4(vP,1)).zw;
float linZ = v2Pc.x/v2Pc.y;
if(i==0) { linMiZ=linZ; linMaZ=linZ; }
#if USE_LEFT_HAND_CAMERA_SPACE
linMiZ = min(linMiZ, linZ); linMaZ = max(linMaZ, linZ);
#else
linMiZ = max(linMiZ, linZ); linMaZ = min(linMaZ, linZ);
#endif
}
float z0 = center.z-radius, z1 = center.z+radius;
#if USE_LEFT_HAND_CAMERA_SPACE
linMiZ = max(linMiZ, z0); linMaZ = min(linMaZ, z1);
#else
linMiZ = min(linMiZ, z1); linMaZ = max(linMaZ, z0);
#endif
#endif
g_vBoundsBuffer[boundsIndices.min] = float4(0.5*vMin.x + 0.5, 0.5*vMin.y + 0.5, vMin.z*VIEWPORT_SCALE_Z, linMiZ);
g_vBoundsBuffer[boundsIndices.max] = float4(0.5*vMax.x + 0.5, 0.5*vMax.y + 0.5, vMax.z*VIEWPORT_SCALE_Z, linMaZ);
}
}
}

unsigned int GetClip(const float4 P)
{
#ifdef USE_OBLIQUE_MODE
bool bIsObliqueClipPlane = true;
#else
bool bIsObliqueClipPlane = false;
#endif
return ((P.x<-P.w)?1:0) | ((P.x>P.w)?2:0) | ((P.y<-P.w)?4:0) | ((P.y>P.w)?8:0) | ((P.z<0)?16:0) | ((P.z>P.w)?32:0);
return (((P.x<-P.w)?1:0) | ((P.x>P.w)?2:0) | ((P.y<-P.w)?4:0) | ((P.y>P.w)?8:0) | ((P.z<0)?16:0) | ((P.z>P.w)?32:0)) & (bIsObliqueClipPlane ? 0x1f : 0x3f);
}
float4 GenNewVert(const float4 vVisib, const float4 vInvisib, const int p)

3
com.unity.render-pipelines.high-definition/HDRP/Lighting/Volumetrics/DensityVolume.cs


{
float animationTime = animate ? time : 0.0f;
volumeScrollingAmount = (textureScrollingSpeed * animationTime);
// Switch from right-handed to left-handed coordinate system.
volumeScrollingAmount.x = -volumeScrollingAmount.x;
volumeScrollingAmount.y = -volumeScrollingAmount.y;
}
}

2
com.unity.render-pipelines.high-definition/HDRP/Lighting/Volumetrics/DensityVolumeManager.cs


}
}
public void TriggerVolumeAtlasRefresh()
private void TriggerVolumeAtlasRefresh()
{
atlasNeedsRefresh = true;
}

1
com.unity.render-pipelines.high-definition/HDRP/Lighting/Volumetrics/VBuffer.hlsl


BiquadraticFilter(1 - fc, weights, offsets); // Inverse-translate the filter centered around 0.5
// Apply the viewport scale right at the end.
// TODO: perform per-sample (4, in this case) bilateral filtering, rather than per-pixel. This should reduce leaking.
// TODO: precompute (VBufferResolution.zw * VBufferUvScale).
result = (weights[0].x * weights[0].y) * SAMPLE_TEXTURE3D_LOD(VBuffer, clampSampler, float3(min((ic + float2(offsets[0].x, offsets[0].y)) * (VBufferResolution.zw * VBufferUvScale), VBufferUvLimit), w), 0) // Top left
+ (weights[1].x * weights[0].y) * SAMPLE_TEXTURE3D_LOD(VBuffer, clampSampler, float3(min((ic + float2(offsets[1].x, offsets[0].y)) * (VBufferResolution.zw * VBufferUvScale), VBufferUvLimit), w), 0) // Top right

1
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.shader


#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#pragma enable_d3d11_debug_symbols
//-------------------------------------------------------------------------------------
// Variant
//-------------------------------------------------------------------------------------

2
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitBuiltinData.hlsl


#include "HDRP/Material/BuiltinUtilities.hlsl"
void GetBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, SurfaceData surfaceData, float alpha, float3 bentNormalWS, float depthOffset, out BuiltinData builtinData)
{
// For back lighting we use the oposite vertex normal

178
com.unity.render-pipelines.high-definition/HDRP/Material/MaterialUtilities.hlsl


// Return camera relative probe volume world to object transformation
float4x4 GetProbeVolumeWorldToObject()
{
return ApplyCameraTranslationToInverseMatrix(unity_ProbeVolumeWorldToObject);
}
// In unity we can have a mix of fully baked lightmap (static lightmap) + enlighten realtime lightmap (dynamic lightmap)
// for each case we can have directional lightmap or not.
// Else we have lightprobe for dynamic/moving entity. Either SH9 per object lightprobe or SH4 per pixel per object volume probe
float3 SampleBakedGI(float3 positionRWS, float3 normalWS, float2 uvStaticLightmap, float2 uvDynamicLightmap)
{
// If there is no lightmap, it assume lightprobe
#if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
// TODO: Confirm with Ionut but it seems that UNITY_LIGHT_PROBE_PROXY_VOLUME is always define for high end and
// unity_ProbeVolumeParams always bind.
if (unity_ProbeVolumeParams.x == 0.0)
{
// TODO: pass a tab of coefficient instead!
real4 SHCoefficients[7];
SHCoefficients[0] = unity_SHAr;
SHCoefficients[1] = unity_SHAg;
SHCoefficients[2] = unity_SHAb;
SHCoefficients[3] = unity_SHBr;
SHCoefficients[4] = unity_SHBg;
SHCoefficients[5] = unity_SHBb;
SHCoefficients[6] = unity_SHC;
return SampleSH9(SHCoefficients, normalWS);
}
else
{
return SampleProbeVolumeSH4(TEXTURE3D_PARAM(unity_ProbeVolumeSH, samplerunity_ProbeVolumeSH), positionRWS, normalWS, GetProbeVolumeWorldToObject(),
unity_ProbeVolumeParams.y, unity_ProbeVolumeParams.z, unity_ProbeVolumeMin, unity_ProbeVolumeSizeInv);
}
#else
float3 bakeDiffuseLighting = float3(0.0, 0.0, 0.0);
#ifdef UNITY_LIGHTMAP_FULL_HDR
bool useRGBMLightmap = false;
float4 decodeInstructions = float4(0.0, 0.0, 0.0, 0.0); // Never used but needed for the interface since it supports gamma lightmaps
#else
bool useRGBMLightmap = true;
#if defined(UNITY_LIGHTMAP_RGBM_ENCODING)
float4 decodeInstructions = float4(34.493242, 2.2, 0.0, 0.0); // range^2.2 = 5^2.2, gamma = 2.2
#else
float4 decodeInstructions = float4(2.0, 2.2, 0.0, 0.0); // range = 2.0^2.2 = 4.59
#endif
#endif
#ifdef LIGHTMAP_ON
#ifdef DIRLIGHTMAP_COMBINED
bakeDiffuseLighting += SampleDirectionalLightmap(TEXTURE2D_PARAM(unity_Lightmap, samplerunity_Lightmap),
TEXTURE2D_PARAM(unity_LightmapInd, samplerunity_Lightmap),
uvStaticLightmap, unity_LightmapST, normalWS, useRGBMLightmap, decodeInstructions);
#else
bakeDiffuseLighting += SampleSingleLightmap(TEXTURE2D_PARAM(unity_Lightmap, samplerunity_Lightmap), uvStaticLightmap, unity_LightmapST, useRGBMLightmap, decodeInstructions);
#endif
#endif
#ifdef DYNAMICLIGHTMAP_ON
#ifdef DIRLIGHTMAP_COMBINED
bakeDiffuseLighting += SampleDirectionalLightmap(TEXTURE2D_PARAM(unity_DynamicLightmap, samplerunity_DynamicLightmap),
TEXTURE2D_PARAM(unity_DynamicDirectionality, samplerunity_DynamicLightmap),
uvDynamicLightmap, unity_DynamicLightmapST, normalWS, false, decodeInstructions);
#else
bakeDiffuseLighting += SampleSingleLightmap(TEXTURE2D_PARAM(unity_DynamicLightmap, samplerunity_DynamicLightmap), uvDynamicLightmap, unity_DynamicLightmapST, false, decodeInstructions);
#endif
#endif
return bakeDiffuseLighting;
#endif
}
float4 SampleShadowMask(float3 positionRWS, float2 uvStaticLightmap) // normalWS not use for now
{
#if defined(LIGHTMAP_ON)
float2 uv = uvStaticLightmap * unity_LightmapST.xy + unity_LightmapST.zw;
float4 rawOcclusionMask = SAMPLE_TEXTURE2D(unity_ShadowMask, samplerunity_Lightmap, uv); // Reuse sampler from Lightmap
#else
float4 rawOcclusionMask;
if (unity_ProbeVolumeParams.x == 1.0)
{
rawOcclusionMask = SampleProbeOcclusion(TEXTURE3D_PARAM(unity_ProbeVolumeSH, samplerunity_ProbeVolumeSH), positionRWS, GetProbeVolumeWorldToObject(),
unity_ProbeVolumeParams.y, unity_ProbeVolumeParams.z, unity_ProbeVolumeMin, unity_ProbeVolumeSizeInv);
}
else
{
// Note: Default value when the feature is not enabled is float(1.0, 1.0, 1.0, 1.0) in C++
rawOcclusionMask = unity_ProbesOcclusion;
}
#endif
return rawOcclusionMask;
}
// Calculate velocity in Clip space [-1..1]
float2 CalculateVelocity(float4 positionCS, float4 previousPositionCS)
{
// This test on define is required to remove warning of divide by 0 when initializing empty struct
// TODO: Add forward opaque MRT case...
#if (SHADERPASS == SHADERPASS_VELOCITY)
// Encode velocity
positionCS.xy = positionCS.xy / positionCS.w;
previousPositionCS.xy = previousPositionCS.xy / previousPositionCS.w;
float2 velocity = (positionCS.xy - previousPositionCS.xy);
#if UNITY_UV_STARTS_AT_TOP
velocity.y = -velocity.y;
#endif
return velocity;
#else
return float2(0.0, 0.0);
#endif
}
// For builtinData we want to allow the user to overwrite default GI in the surface shader / shader graph.
// So we perform the following order of operation:
// 1. InitBuiltinData - Init bakeDiffuseLighting and backBakeDiffuseLighting
// 2. User can overwrite these value in the surface shader / shader graph
// 3. PostInitBuiltinData - Handle debug mode + allow the current lighting model to update the data with ModifyBakedDiffuseLighting
// This method initialize BuiltinData usual values and after update of builtinData by the caller must be follow by PostInitBuiltinData
void InitBuiltinData( float alpha, float3 normalWS, float3 backNormalWS, float3 positionRWS, float2 texCoord1, float2 texCoord2,
out BuiltinData builtinData)
{
ZERO_INITIALIZE(BuiltinData, builtinData);
builtinData.opacity = alpha;
// Sample lightmap/lightprobe/volume proxy
builtinData.bakeDiffuseLighting = SampleBakedGI(positionRWS, normalWS, texCoord1, texCoord2);
// We also sample the back lighting in case we have transmission. If not use this will be optimize out by the compiler
// For now simply recall the function with inverted normal, the compiler should be able to optimize the lightmap case to not resample the directional lightmap
// however it may not optimize the lightprobe case due to the proxy volume relying on dynamic if (to verify), not a problem for SH9, but a problem for proxy volume.
// TODO: optimize more this code.
builtinData.backBakeDiffuseLighting = SampleBakedGI(positionRWS, backNormalWS, texCoord1, texCoord2);
#ifdef SHADOWS_SHADOWMASK
float4 shadowMask = SampleShadowMask(positionRWS, texCoord1);
builtinData.shadowMask0 = shadowMask.x;
builtinData.shadowMask1 = shadowMask.y;
builtinData.shadowMask2 = shadowMask.z;
builtinData.shadowMask3 = shadowMask.w;
#endif
// Use uniform directly - The float need to be cast to uint (as unity don't support to set a uint as uniform)
builtinData.renderingLayers = _EnableLightLayers ? asuint(unity_RenderingLayer.x) : DEFAULT_LIGHT_LAYERS;
}
// InitBuiltinData must be call before calling PostInitBuiltinData
void PostInitBuiltinData( float3 V, inout PositionInputs posInput, SurfaceData surfaceData,
inout BuiltinData builtinData)
{
#ifdef DEBUG_DISPLAY
if (_DebugLightingMode == DEBUGLIGHTINGMODE_LUX_METER)
{
// The lighting in SH or lightmap is assume to contain bounced light only (i.e no direct lighting),
// and is divide by PI (i.e Lambert is apply), so multiply by PI here to get back the illuminance
builtinData.bakeDiffuseLighting *= PI; // don't take into account backBakeDiffuseLighting
}
else
#endif
{
// Apply control from the indirect lighting volume settings - This is apply here so we don't affect emissive
// color in case of lit deferred for example and avoid material to have to deal with it
builtinData.bakeDiffuseLighting *= _IndirectLightingMultiplier.x;
builtinData.backBakeDiffuseLighting *= _IndirectLightingMultiplier.x;
#ifdef MODIFY_BAKED_DIFFUSE_LIGHTING
ModifyBakedDiffuseLighting(V, posInput, surfaceData, builtinData);
#endif
}
}
// Flipping or mirroring a normal can be done directly on the tangent space. This has the benefit to apply to the whole process either in surface gradient or not.
// This function will modify FragInputs and this is not propagate outside of GetSurfaceAndBuiltinData(). This is ok as tangent space is not use outside of GetSurfaceAndBuiltinData().
void ApplyDoubleSidedFlipOrMirror(inout FragInputs input)

1
com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLitData.hlsl


// Fill SurfaceData/Builtin data function
//-------------------------------------------------------------------------------------
#include "CoreRP/ShaderLibrary/Sampling/SampleUVMapping.hlsl"
#include "HDRP/Material/BuiltinUtilities.hlsl"
#include "HDRP/Material/MaterialUtilities.hlsl"
//-----------------------------------------------------------------------------

25
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs


using System.Linq;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.Experimental.GlobalIllumination;
using UnityEngine.XR;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

return false;
}
#if !UNITY_SWITCH
if (XRSettings.isDeviceActive)
if (XRGraphicsConfig.enabled)
#endif
return true;
}

if (m_CurrentDebugDisplaySettings.IsDebugDisplayRemovePostprocess() || !HDUtils.IsPostProcessingActive(postProcessLayer))
{
currentFrameSettings.enablePostprocess = false;
}
// Disable SSS if luxmeter is enabled
if (debugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.LuxMeter)
{
currentFrameSettings.enableSubsurfaceScattering = false;
}
var hdCamera = HDCamera.Get(camera);

public void PushColorPickerDebugTexture(CommandBuffer cmd, RTHandleSystem.RTHandle textureID, HDCamera hdCamera)
{
if (m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None || m_DebugDisplaySettings.falseColorDebugSettings.falseColor)
if (m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None || m_DebugDisplaySettings.falseColorDebugSettings.falseColor || m_DebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.LuminanceMeter)
{
using (new ProfilingSample(cmd, "Push To Color Picker"))
{

// TODO TEMP: Not sure I want to keep this special case. Gotta see how to get rid of it (not sure it will work correctly for non-full viewports.
public void PushColorPickerDebugTexture(HDCamera hdCamera, CommandBuffer cmd, RenderTargetIdentifier textureID)
{
if (m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None || m_DebugDisplaySettings.falseColorDebugSettings.falseColor)
if (m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None || m_DebugDisplaySettings.falseColorDebugSettings.falseColor || m_DebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.LuminanceMeter)
{
using (new ProfilingSample(cmd, "Push To Color Picker"))
{

DecalSystem.instance.RenderDebugOverlay(hdCamera, cmd, m_CurrentDebugDisplaySettings, ref x, ref y, overlaySize, hdCamera.actualWidth);
if (m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None || m_CurrentDebugDisplaySettings.falseColorDebugSettings.falseColor)
if (m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None || m_CurrentDebugDisplaySettings.falseColorDebugSettings.falseColor || m_CurrentDebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.LuminanceMeter)
{
ColorPickerDebugSettings colorPickerDebugSettings = m_CurrentDebugDisplaySettings.colorPickerDebugSettings;
FalseColorDebugSettings falseColorDebugSettings = m_CurrentDebugDisplaySettings.falseColorDebugSettings;

using (new ProfilingSample(cmd, "Clear HDR target", CustomSamplerId.ClearHDRTarget.GetSampler()))
{
if (hdCamera.clearColorMode == HDAdditionalCameraData.ClearColorMode.BackgroundColor ||
// If the luxmeter is enabled, the sky isn't rendered so we clear the background color
m_DebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.LuxMeter ||
// If we want the sky but the sky don't exist, still clear with background color
(hdCamera.clearColorMode == HDAdditionalCameraData.ClearColorMode.Sky && !m_SkyManager.IsVisualSkyValid()) ||
// Special handling for Preview we force to clear with background color (i.e black)

{
Color clearColor = hdCamera.backgroundColorHDR;
// We set the background color to black when the luxmeter is enabled to avoid picking the sky color
if (m_DebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.LuxMeter)
clearColor = Color.black;
HDUtils.SetRenderTarget(cmd, hdCamera, m_CameraColorBuffer, m_CameraDepthStencilBuffer, ClearFlag.Color, clearColor);
}
}

2
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDUtils.cs


s_PropertyBlock.SetVector(HDShaderIDs._BlitScaleBias, scaleBiasTex);
s_PropertyBlock.SetVector(HDShaderIDs._BlitScaleBiasRt, scaleBiasRT);
s_PropertyBlock.SetFloat(HDShaderIDs._BlitMipLevel, mipLevelTex);
cmd.DrawProcedural(Matrix4x4.identity, GetBlitMaterial(), bilinear ? 2 : 3, MeshTopology.Quads, 4, 1, s_PropertyBlock);
cmd.DrawProcedural(Matrix4x4.identity, GetBlitMaterial(), bilinear ? 3 : 2, MeshTopology.Quads, 4, 1, s_PropertyBlock);
}
public static void BlitTexture(CommandBuffer cmd, RTHandleSystem.RTHandle source, RTHandleSystem.RTHandle destination, Vector4 scaleBias, float mipLevel, bool bilinear)

7
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/Settings/FrameSettings.cs


using System;
using System.Collections.Generic;
using UnityEngine.XR;
using UnityEngine.Serialization;
namespace UnityEngine.Experimental.Rendering.HDPipeline

// Planar and real time cubemap doesn't need post process and render in FP16
aggregate.enablePostprocess = camera.cameraType != CameraType.Reflection && srcFrameSettings.enablePostprocess;
#if UNITY_SWITCH
aggregate.enableStereo = false;
#else
aggregate.enableStereo = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableStereo && XRSettings.isDeviceActive && (camera.stereoTargetEye == StereoTargetEyeMask.Both) && renderPipelineSettings.supportStereo;
#endif
aggregate.enableStereo = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableStereo && XRGraphicsConfig.enabled && (camera.stereoTargetEye == StereoTargetEyeMask.Both);
aggregate.enableAsyncCompute = srcFrameSettings.enableAsyncCompute && SystemInfo.supportsAsyncCompute;

9
com.unity.render-pipelines.high-definition/HDRP/Sky/SkyRenderingContext.cs


m_BuiltinParameters.debugSettings = debugSettings;
skyContext.renderer.SetRenderTargets(m_BuiltinParameters);
// When rendering the visual sky for reflection probes, we need to remove the sun disk if skySettings.includeSunInBaking is false.
skyContext.renderer.RenderSky(m_BuiltinParameters, false, hdCamera.camera.cameraType != CameraType.Reflection || skyContext.skySettings.includeSunInBaking);
// If the luxmeter is enabled, we don't render the sky
if (debugSettings.lightingDebugSettings.debugLightingMode != DebugLightingMode.LuxMeter)
{
// When rendering the visual sky for reflection probes, we need to remove the sun disk if skySettings.includeSunInBaking is false.
skyContext.renderer.RenderSky(m_BuiltinParameters, false, hdCamera.camera.cameraType != CameraType.Reflection || skyContext.skySettings.includeSunInBaking);
}
}
}
}

9
com.unity.render-pipelines.lightweight/CHANGELOG.md


and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [3.2.0-preview]
### Changed
- The UI for Lightweight asset has been updated with new categories. A more clean structure and foldouts has been added to keep things organized.
### Fixed
- Shadow casters are now properly culled per cascade. (case 1059142)
- Rendering no longer breaks when Android platform is selected in Build Settings. (case 1058812)
- Scriptable passes no longer have missing material references. Now they access cached materials in the renderer.(case 1061353)
- When you change a Shadow Cascade option in the Pipeline Asset, this no longer warns you that you've exceeded the array size for the _WorldToShadow property.
- Terrain shader optimizations.
## [3.1.0-preview]

18
com.unity.render-pipelines.lightweight/LWRP/DefaultRendererSetup.cs


[NonSerialized]
private bool m_Initialized = false;
private void Init(LightweightForwardRenderer renderer)
private void Init()
{
if (m_Initialized)
return;

m_LocalShadowPass = new LocalShadowsPass();
m_SetupForwardRenderingPass = new SetupForwardRenderingPass();
m_ScreenSpaceShadowResovePass = new ScreenSpaceShadowResolvePass(renderer.GetMaterial(MaterialHandles.ScrenSpaceShadow));
m_ScreenSpaceShadowResovePass = new ScreenSpaceShadowResolvePass();
m_RenderOpaqueForwardPass = new RenderOpaqueForwardPass(renderer.GetMaterial(MaterialHandles.Error));
m_RenderOpaqueForwardPass = new RenderOpaqueForwardPass();
m_CopyDepthPass = new CopyDepthPass(renderer.GetMaterial(MaterialHandles.DepthCopy));
m_CopyColorPass = new CopyColorPass(renderer.GetMaterial(MaterialHandles.Sampling));
m_RenderTransparentForwardPass = new RenderTransparentForwardPass(renderer.GetMaterial(MaterialHandles.Error));
m_CopyDepthPass = new CopyDepthPass();
m_CopyColorPass = new CopyColorPass();
m_RenderTransparentForwardPass = new RenderTransparentForwardPass();
m_FinalBlitPass = new FinalBlitPass(renderer.GetMaterial(MaterialHandles.Blit));
m_FinalBlitPass = new FinalBlitPass();
m_SceneViewDepthCopyPass = new SceneViewDepthCopyPass(renderer.GetMaterial(MaterialHandles.DepthCopy));
m_SceneViewDepthCopyPass = new SceneViewDepthCopyPass();
#endif
// RenderTexture format depends on camera and pipeline (HDR, non HDR, etc)

public void Setup(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults, ref RenderingData renderingData)
{
Init(renderer);
Init();
renderer.Clear();

130
com.unity.render-pipelines.lightweight/LWRP/Editor/LightweightPipelineAssetEditor.cs


[CustomEditor(typeof(LightweightPipelineAsset))]
public class LightweightPipelineAssetEditor : Editor
{
bool generalSettingsFoldout = false;
bool qualitySettingsFoldout = false;
bool shadowsSettingsFoldout = false;
public static GUIContent renderingLabel = new GUIContent("Rendering");
public static GUIContent qualityLabel = new GUIContent("Quality");
public static GUIContent capabilitiesLabel = new GUIContent("Capabilities");
public static GUIContent featuresLabel = new GUIContent("Shader Features");
public static GUIContent renderScaleLabel = new GUIContent("Render Scale", "Scales the camera render target allowing the game to render at a resolution different than native resolution. UI is always rendered at native resolution.");

SerializedProperty m_CustomShaderVariantStripSettingsProp;
SerializedProperty m_XRConfig;
public override void OnInspectorGUI()
{
serializedObject.Update();

DrawCapabilitiesSettings();
DrawShaderFeaturesSettings();
DrawQualitySettings();
DrawShadowSettings();
EditorGUILayout.PropertyField(m_XRConfig);
serializedObject.ApplyModifiedProperties();

{
{
m_RenderScale = serializedObject.FindProperty("m_RenderScale");
m_MaxPixelLights = serializedObject.FindProperty("m_MaxPixelLights");
m_SupportsVertexLightProp = serializedObject.FindProperty("m_SupportsVertexLight");

m_ShowOpaqueTextureScale.valueChanged.AddListener(Repaint);
m_ShowOpaqueTextureScale.value = m_RequireOpaqueTextureProp.boolValue;
m_XRConfig = serializedObject.FindProperty("m_SavedXRConfig");
}
void OnDisable()

m_ShowOpaqueTextureScale.target = m_RequireOpaqueTextureProp.boolValue;
}
void DrawGeneralSettings()
void DrawShaderFeaturesSettings()
EditorGUILayout.LabelField(Styles.generalSettingsLabel, EditorStyles.boldLabel);
EditorGUILayout.LabelField(Styles.featuresLabel, EditorStyles.boldLabel);
m_RenderScale.floatValue = EditorGUILayout.Slider(Styles.renderScaleLabel, m_RenderScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
m_MaxPixelLights.intValue = EditorGUILayout.IntSlider(Styles.maxPixelLightsLabel, m_MaxPixelLights.intValue, 0, k_MaxSupportedPixelLights);
EditorGUILayout.PropertyField(m_SupportsVertexLightProp, Styles.enableVertexLightLabel);
EditorGUILayout.PropertyField(m_DirectionalShadowsSupportedProp, Styles.supportsDirectionalShadows);
EditorGUILayout.PropertyField(m_LocalShadowSupportedProp, Styles.supportsLocalShadows);
EditorGUI.BeginDisabledGroup(!(m_DirectionalShadowsSupportedProp.boolValue || m_LocalShadowSupportedProp.boolValue));
EditorGUILayout.PropertyField(m_SoftShadowsSupportedProp, Styles.supportsSoftShadows);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
bool directionalShadows = m_DirectionalShadowsSupportedProp.boolValue;
if (directionalShadows)
void DrawGeneralSettings()
{
generalSettingsFoldout = EditorGUILayout.Foldout(generalSettingsFoldout, Styles.generalSettingsLabel, true);
if (generalSettingsFoldout)
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_SupportsDynamicBatching, Styles.dynamicBatching);
EditorGUILayout.PropertyField(m_RequireDepthTextureProp, Styles.requireDepthTexture);
EditorGUI.BeginDisabledGroup(!m_RequireDepthTextureProp.boolValue);
EditorGUILayout.PropertyField(m_RequireSoftParticlesProp, Styles.requireSoftParticles);
EditorGUI.EndDisabledGroup();
EditorGUILayout.PropertyField(m_RequireOpaqueTextureProp, Styles.requireOpaqueTexture);
EditorGUI.indentLevel++;
EditorGUI.BeginDisabledGroup(!m_RequireOpaqueTextureProp.boolValue);
EditorGUILayout.PropertyField(m_OpaqueDownsamplingProp, Styles.opaqueDownsampling);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.Space();
}
}
void DrawQualitySettings()
{
qualitySettingsFoldout = EditorGUILayout.Foldout(qualitySettingsFoldout, Styles.qualityLabel, true);
if (qualitySettingsFoldout)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_HDR, Styles.hdrContent);
EditorGUILayout.PropertyField(m_MSAA, Styles.msaaContent);
m_RenderScale.floatValue = EditorGUILayout.Slider(Styles.renderScaleLabel, m_RenderScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
m_MaxPixelLights.intValue = EditorGUILayout.IntSlider(Styles.maxPixelLightsLabel, m_MaxPixelLights.intValue, 0, k_MaxSupportedPixelLights);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.Space();
}
}
void DrawShadowSettings()
{
shadowsSettingsFoldout = EditorGUILayout.Foldout(shadowsSettingsFoldout, Styles.shadowLabel, true);
if (shadowsSettingsFoldout)
{
// Directional Shadows
EditorGUI.BeginDisabledGroup(!m_DirectionalShadowsSupportedProp.boolValue);
EditorGUI.indentLevel++;
EditorGUILayout.LabelField(Styles.directionalShadowLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_DirectionalShadowAtlasResolutionProp, Styles.directionalShadowAtlasResolution);

EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
EditorGUI.EndDisabledGroup();
bool localShadows = m_LocalShadowSupportedProp.boolValue;
if (localShadows)
{
// Local Shadows
EditorGUI.BeginDisabledGroup(!m_LocalShadowSupportedProp.boolValue);
EditorGUILayout.Space();
EditorGUI.indentLevel--;
EditorGUI.EndDisabledGroup();
if (directionalShadows || localShadows)
EditorGUILayout.PropertyField(m_SoftShadowsSupportedProp, Styles.supportsSoftShadows);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.Space();
void DrawCapabilitiesSettings()
{
EditorGUILayout.LabelField(Styles.capabilitiesLabel, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_SupportsVertexLightProp, Styles.enableVertexLightLabel);
EditorGUILayout.PropertyField(m_RequireDepthTextureProp, Styles.requireDepthTexture);
EditorGUI.BeginDisabledGroup(!m_RequireDepthTextureProp.boolValue);
EditorGUILayout.PropertyField(m_RequireSoftParticlesProp, Styles.requireSoftParticles);
EditorGUI.EndDisabledGroup();
EditorGUILayout.PropertyField(m_RequireOpaqueTextureProp, Styles.requireOpaqueTexture);
EditorGUI.indentLevel++;
EditorGUI.BeginDisabledGroup(!m_RequireOpaqueTextureProp.boolValue);
EditorGUILayout.PropertyField(m_OpaqueDownsamplingProp, Styles.opaqueDownsampling);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
EditorGUILayout.PropertyField(m_HDR, Styles.hdrContent);
EditorGUILayout.PropertyField(m_MSAA, Styles.msaaContent);
EditorGUILayout.PropertyField(m_SupportsDynamicBatching, Styles.dynamicBatching);
EditorGUILayout.PropertyField(m_DirectionalShadowsSupportedProp, Styles.supportsDirectionalShadows);
EditorGUILayout.PropertyField(m_LocalShadowSupportedProp, Styles.supportsLocalShadows);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.Space();
}
}
}

15
com.unity.render-pipelines.lightweight/LWRP/LightweightForwardRenderer.cs


using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;

{
get
{
return SystemInfo.supportsComputeShaders &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLCore &&
!Application.isMobilePlatform &&
Application.platform != RuntimePlatform.WebGLPlayer;
// TODO: Graphics Emulation are breaking StructuredBuffers disabling it for now until
// we have a fix for it
return false;
// return SystemInfo.supportsComputeShaders &&
// SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLCore &&
// !Application.isMobilePlatform &&
// Application.platform != RuntimePlatform.WebGLPlayer;
}
}

public void Execute(ref ScriptableRenderContext context, ref CullResults cullResults, ref RenderingData renderingData)
{
for (int i = 0; i < m_ActiveRenderPassQueue.Count; ++i)
m_ActiveRenderPassQueue[i].Execute(ref context, ref cullResults, ref renderingData);
m_ActiveRenderPassQueue[i].Execute(this, ref context, ref cullResults, ref renderingData);
public Material GetMaterial(MaterialHandles handle)
{
int handleID = (int)handle;

7
com.unity.render-pipelines.lightweight/LWRP/LightweightShadowUtils.cs


cascadeIndex, shadowData.directionalLightCascadeCount, shadowData.directionalLightCascades, shadowResolution, shadowNearPlane, out viewMatrix, out projMatrix,
out splitData);
float cullingSphereRadius = splitData.cullingSphere.w;
cascadeSplitDistance.w = cullingSphereRadius * cullingSphereRadius;
shadowSliceData.offsetX = (cascadeIndex % 2) * shadowResolution;
shadowSliceData.offsetY = (cascadeIndex / 2) * shadowResolution;
shadowSliceData.resolution = shadowResolution;

}
public static void RenderShadowSlice(CommandBuffer cmd, ref ScriptableRenderContext context,
ref ShadowSliceData shadowSliceData,
Matrix4x4 proj, Matrix4x4 view, DrawShadowsSettings settings)
ref ShadowSliceData shadowSliceData, ref DrawShadowsSettings settings,
Matrix4x4 proj, Matrix4x4 view)
{
cmd.SetViewport(new Rect(shadowSliceData.offsetX, shadowSliceData.offsetY, shadowSliceData.resolution, shadowSliceData.resolution));
cmd.EnableScissorRect(new Rect(shadowSliceData.offsetX + 4, shadowSliceData.offsetY + 4, shadowSliceData.resolution - 8, shadowSliceData.resolution - 8));

3
com.unity.render-pipelines.lightweight/LWRP/Passes/BeginXRRenderingPass.cs


{
public class BeginXRRenderingPass : ScriptableRenderPass
{
public override void Execute(ref ScriptableRenderContext context, ref CullResults cullResults,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{
Camera camera = renderingData.cameraData.camera;

10
com.unity.render-pipelines.lightweight/LWRP/Passes/CopyColorPass.cs


private RenderTargetHandle source { get; set; }
private RenderTargetHandle destination { get; set; }
private Material samplingMaterial { get; set; }
public CopyColorPass(Material samplingMaterial)
public CopyColorPass()
this.samplingMaterial = samplingMaterial;
m_SampleOffsetShaderHandle = Shader.PropertyToID("_SampleOffset");
}

this.destination = destination;
}
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

cmd.Blit(colorRT, opaqueColorRT);
break;
case Downsampling._4xBox:
Material samplingMaterial = renderer.GetMaterial(MaterialHandles.Sampling);
samplingMaterial.SetFloat(m_SampleOffsetShaderHandle, 2);
cmd.Blit(colorRT, opaqueColorRT, samplingMaterial, 0);
break;

}
}
}
}

12
com.unity.render-pipelines.lightweight/LWRP/Passes/CopyDepthPass.cs


{
private RenderTargetHandle source { get; set; }
private RenderTargetHandle destination { get; set; }
private Material depthCopyMaterial { get; set; }
public CopyDepthPass(Material depthCopyMaterial)
{
this.depthCopyMaterial = depthCopyMaterial;
}
const string k_DepthCopyTag = "Depth Copy";
public void Setup(RenderTargetHandle source, RenderTargetHandle destination)
{

public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
CommandBuffer cmd = CommandBufferPool.Get("Depth Copy");
CommandBuffer cmd = CommandBufferPool.Get(k_DepthCopyTag);
Material depthCopyMaterial = renderer.GetMaterial(MaterialHandles.DepthCopy);
RenderTextureDescriptor descriptor = LightweightForwardRenderer.CreateRTDesc(ref renderingData.cameraData);
descriptor.colorFormat = RenderTextureFormat.Depth;

2
com.unity.render-pipelines.lightweight/LWRP/Passes/CreateLightweightRenderTexturesPass.cs


descriptor = baseDescriptor;
}
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

2
com.unity.render-pipelines.lightweight/LWRP/Passes/DepthOnlyPass.cs


};
}
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

16
com.unity.render-pipelines.lightweight/LWRP/Passes/DirectionalShadowsPass.cs


this.destination = destination;
}
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

success = LightweightShadowUtils.ExtractDirectionalLightMatrix(ref cullResults, ref shadowData, shadowLightIndex, cascadeIndex, shadowResolution, shadowNearPlane, out m_CascadeSplitDistances[cascadeIndex], out m_CascadeSlices[cascadeIndex], out view, out proj);
if (success)
{
settings.splitData.cullingSphere = m_CascadeSplitDistances[cascadeIndex];
LightweightShadowUtils.RenderShadowSlice(cmd, ref context, ref m_CascadeSlices[cascadeIndex], proj,
view, settings);
LightweightShadowUtils.RenderShadowSlice(cmd, ref context, ref m_CascadeSlices[cascadeIndex], ref settings, proj, view);
}
}

float invHalfShadowAtlasWidth = 0.5f * invShadowAtlasWidth;
float invHalfShadowAtlasHeight = 0.5f * invShadowAtlasHeight;
cmd.SetGlobalTexture(destination.id, m_DirectionalShadowmapTexture);
if (shadowData.directionalLightCascadeCount > 1)
cmd.SetGlobalMatrixArray(DirectionalShadowConstantBuffer._WorldToShadow, m_DirectionalShadowMatrices);
else
cmd.SetGlobalMatrix(DirectionalShadowConstantBuffer._WorldToShadow, m_DirectionalShadowMatrices[0]);
cmd.SetGlobalMatrixArray(DirectionalShadowConstantBuffer._WorldToShadow, m_DirectionalShadowMatrices);
cmd.SetGlobalVector(DirectionalShadowConstantBuffer._DirShadowSplitSphereRadii, new Vector4(m_CascadeSplitDistances[0].w, m_CascadeSplitDistances[1].w, m_CascadeSplitDistances[2].w, m_CascadeSplitDistances[3].w));
cmd.SetGlobalVector(DirectionalShadowConstantBuffer._DirShadowSplitSphereRadii, new Vector4(m_CascadeSplitDistances[0].w * m_CascadeSplitDistances[0].w,
m_CascadeSplitDistances[1].w * m_CascadeSplitDistances[1].w,
m_CascadeSplitDistances[2].w * m_CascadeSplitDistances[2].w,
m_CascadeSplitDistances[3].w * m_CascadeSplitDistances[3].w));
cmd.SetGlobalVector(DirectionalShadowConstantBuffer._ShadowOffset0, new Vector4(-invHalfShadowAtlasWidth, -invHalfShadowAtlasHeight, 0.0f, 0.0f));
cmd.SetGlobalVector(DirectionalShadowConstantBuffer._ShadowOffset1, new Vector4(invHalfShadowAtlasWidth, -invHalfShadowAtlasHeight, 0.0f, 0.0f));
cmd.SetGlobalVector(DirectionalShadowConstantBuffer._ShadowOffset2, new Vector4(-invHalfShadowAtlasWidth, invHalfShadowAtlasHeight, 0.0f, 0.0f));

2
com.unity.render-pipelines.lightweight/LWRP/Passes/DrawSkyboxPass.cs


{
public class DrawSkyboxPass : ScriptableRenderPass
{
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

2
com.unity.render-pipelines.lightweight/LWRP/Passes/EndXRRenderingPass.cs


{
public class EndXRRenderingPass : ScriptableRenderPass
{
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

16
com.unity.render-pipelines.lightweight/LWRP/Passes/FinalBlitPass.cs


{
public class FinalBlitPass : ScriptableRenderPass
{
const string k_FinalBlitTag = "Final Blit Pass";
private Material blitMaterial { get; set; }
public FinalBlitPass(Material blitMaterial)
{
this.blitMaterial = blitMaterial;
}
public void Setup(RenderTextureDescriptor baseDescriptor, RenderTargetHandle colorAttachmentHandle)
{
this.colorAttachmentHandle = colorAttachmentHandle;

public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
Material material = renderingData.cameraData.isStereoEnabled ? null : blitMaterial;
Material material = renderingData.cameraData.isStereoEnabled ? null : renderer.GetMaterial(MaterialHandles.Blit);
CommandBuffer cmd = CommandBufferPool.Get("Final Blit Pass");
CommandBuffer cmd = CommandBufferPool.Get(k_FinalBlitTag);
cmd.SetGlobalTexture("_BlitTex", sourceRT);
// We need to handle viewport on a RT. We do it by rendering a fullscreen quad + viewport

11
com.unity.render-pipelines.lightweight/LWRP/Passes/LightweightForwardPass.cs


private RenderTargetHandle colorAttachmentHandle { get; set; }
private RenderTargetHandle depthAttachmentHandle { get; set; }
private RenderTextureDescriptor descriptor { get; set; }
private Material errorMaterial { get; set; }
const string k_SwitchRTs = "Switch RT";
protected LightweightForwardPass(Material errorMaterial)
protected LightweightForwardPass()
{
m_LegacyShaderPassNames = new List<ShaderPassName>();
m_LegacyShaderPassNames.Add(new ShaderPassName("Always"));

m_LegacyShaderPassNames.Add(new ShaderPassName("VertexLMRGBM"));
m_LegacyShaderPassNames.Add(new ShaderPassName("VertexLM"));
this.errorMaterial = errorMaterial;
RegisterShaderPassName("LightweightForward");
RegisterShaderPassName("SRPDefaultUnlit");

}
[Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")]
protected void RenderObjectsWithError(ref ScriptableRenderContext context, ref CullResults cullResults, Camera camera, FilterRenderersSettings filterSettings, SortFlags sortFlags)
protected void RenderObjectsWithError(LightweightForwardRenderer renderer, ref ScriptableRenderContext context, ref CullResults cullResults, Camera camera, FilterRenderersSettings filterSettings, SortFlags sortFlags)
Material errorMaterial = renderer.GetMaterial(MaterialHandles.Error);
if (errorMaterial != null)
{
DrawRendererSettings errorSettings = new DrawRendererSettings(camera, m_LegacyShaderPassNames[0]);

6
com.unity.render-pipelines.lightweight/LWRP/Passes/LocalShadowsPass.cs


using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering.LightweightPipeline

}
}
public override void Execute(ref ScriptableRenderContext context, ref CullResults cullResults,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{
if (renderingData.shadowData.renderLocalShadows)

var settings = new DrawShadowsSettings(cullResults, shadowLightIndex);
LightweightShadowUtils.SetupShadowCasterConstants(cmd, ref shadowLight, proj, sliceResolution);
LightweightShadowUtils.RenderShadowSlice(cmd, ref context, ref m_LocalLightSlices[i], proj, view, settings);
LightweightShadowUtils.RenderShadowSlice(cmd, ref context, ref m_LocalLightSlices[i], ref settings, proj, view);
}
}

3
com.unity.render-pipelines.lightweight/LWRP/Passes/OpaquePostProcessPass.cs


descriptor = baseDescriptor;
}
public override void Execute(ref ScriptableRenderContext context, ref CullResults cullResults,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{
CommandBuffer cmd = CommandBufferPool.Get("Render Opaque PostProcess Effects");

9
com.unity.render-pipelines.lightweight/LWRP/Passes/RenderOpaqueForwardPass.cs


const string k_RenderOpaquesTag = "Render Opaques";
public FilterRenderersSettings opaqueFilterSettings { get; private set; }
public RenderOpaqueForwardPass(Material errorMaterial) : base(errorMaterial)
public RenderOpaqueForwardPass()
{
opaqueFilterSettings = new FilterRenderersSettings(true)
{

public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

SetRenderTarget(cmd, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, clearFlag, CoreUtils.ConvertSRGBToActiveColorSpace(clearColor));
// TODO: We need a proper way to handle multiple camera/ camera stack. Issue is: multiple cameras can share a same RT

// cmd.SetViewport(camera.pixelRect);
Camera camera = renderingData.cameraData.camera;
var drawSettings = CreateDrawRendererSettings(camera, SortFlags.CommonOpaque, rendererConfiguration, dynamicBatching);

RenderObjectsWithError(ref context, ref cullResults, camera, opaqueFilterSettings, SortFlags.None);
RenderObjectsWithError(renderer, ref context, ref cullResults, camera, opaqueFilterSettings, SortFlags.None);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);

7
com.unity.render-pipelines.lightweight/LWRP/Passes/RenderTransparentForwardPass.cs


private FilterRenderersSettings transparentFilterSettings { get; set; }
public RenderTransparentForwardPass(Material errorMaterial) : base(errorMaterial)
public RenderTransparentForwardPass()
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

context.DrawRenderers(cullResults.visibleRenderers, ref drawSettings, transparentFilterSettings);
// Render objects that did not match any shader pass with error shader
RenderObjectsWithError(ref context, ref cullResults, camera, transparentFilterSettings, SortFlags.None);
RenderObjectsWithError(renderer, ref context, ref cullResults, camera, transparentFilterSettings, SortFlags.None);
}
context.ExecuteCommandBuffer(cmd);

16
com.unity.render-pipelines.lightweight/LWRP/Passes/SceneViewDepthCopy.cs


{
public class SceneViewDepthCopyPass : ScriptableRenderPass
{
private RenderTargetHandle source { get; set; }
private Material depthCopyMaterial { get; set; }
const string k_CopyDepthToCameraTag = "Copy Depth to Camera";
public SceneViewDepthCopyPass(Material depthCopyMaterial)
{
this.depthCopyMaterial = depthCopyMaterial;
}
private RenderTargetHandle source { get; set; }
public void Setup(RenderTargetHandle source)
{

public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
CommandBuffer cmd = CommandBufferPool.Get("Copy Depth to Camera");
CommandBuffer cmd = CommandBufferPool.Get(k_CopyDepthToCameraTag);
cmd.Blit(source.Identifier(), BuiltinRenderTextureType.CameraTarget, depthCopyMaterial);
cmd.Blit(source.Identifier(), BuiltinRenderTextureType.CameraTarget, renderer.GetMaterial(MaterialHandles.DepthCopy));
}
}

11
com.unity.render-pipelines.lightweight/LWRP/Passes/ScreenSpaceShadowResolvePass.cs


public class ScreenSpaceShadowResolvePass : ScriptableRenderPass
{
RenderTextureFormat m_ColorFormat;
private Material screenSpaceShadowsMaterial { get; set; }
public ScreenSpaceShadowResolvePass(Material screenSpaceShadowsMaterial)
public ScreenSpaceShadowResolvePass()
this.screenSpaceShadowsMaterial = screenSpaceShadowsMaterial;
}
private RenderTargetHandle colorAttachmentHandle { get; set; }

descriptor = baseDescriptor;
}
public override void Execute(ref ScriptableRenderContext context, ref CullResults cullResults,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{
if (renderingData.shadowData.renderedDirectionalShadowQuality == LightShadows.None)

RenderTargetIdentifier screenSpaceOcclusionTexture = colorAttachmentHandle.Identifier();
SetRenderTarget(cmd, screenSpaceOcclusionTexture, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store,
ClearFlag.Color | ClearFlag.Depth, Color.white, descriptor.dimension);
cmd.Blit(screenSpaceOcclusionTexture, screenSpaceOcclusionTexture, screenSpaceShadowsMaterial);
cmd.Blit(screenSpaceOcclusionTexture, screenSpaceOcclusionTexture, renderer.GetMaterial(MaterialHandles.ScrenSpaceShadow));
if (renderingData.cameraData.isStereoEnabled)
{

2
com.unity.render-pipelines.lightweight/LWRP/Passes/ScriptableRenderPass.cs


public virtual void FrameCleanup(CommandBuffer cmd)
{}
public abstract void Execute(ref ScriptableRenderContext context,
public abstract void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData);

3
com.unity.render-pipelines.lightweight/LWRP/Passes/SetupForwardRenderingPass.cs


{
public class SetupForwardRenderingPass : ScriptableRenderPass
{
public override void Execute(ref ScriptableRenderContext context, ref CullResults cullResults,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{
// SetupCameraProperties does the following:

2
com.unity.render-pipelines.lightweight/LWRP/Passes/SetupLightweightConstanstPass.cs


CoreUtils.SetKeyword(cmd, "SOFTPARTICLES_ON", cameraData.requiresSoftParticles);
}
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

2
com.unity.render-pipelines.lightweight/LWRP/Passes/TransparentPostProcessPass.cs


descriptor = baseDescriptor;
}
public override void Execute(ref ScriptableRenderContext context,
public override void Execute(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
ref CullResults cullResults,
ref RenderingData renderingData)
{

13
com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Input.hlsl


#define MAX_VISIBLE_LIGHTS 16
// TODO: Graphics Emulation are breaking structured buffers for now disabling it until we have a fix
#define USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA 0
#if defined(SHADER_API_MOBILE) || defined(SHADER_API_GLES) || defined(SHADER_API_GLCORE)
#define USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA 0
#else
#define USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA 1
#endif
// #if defined(SHADER_API_MOBILE) || defined(SHADER_API_GLES) || defined(SHADER_API_GLCORE)
// #define USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA 0
// #else
// #define USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA 1
// #endif
struct InputData
{

7
com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Shadows.hlsl


// Last cascade is initialized with a no-op matrix. It always transforms
// shadow coord to half(0, 0, NEAR_PLANE). We use this trick to avoid
// branching since ComputeCascadeIndex can return cascade index = MAX_SHADOW_CASCADES
#ifdef _SHADOWS_CASCADE
#else
float4x4 _WorldToShadow;
#endif
float4 _DirShadowSplitSpheres0;
float4 _DirShadowSplitSpheres1;
float4 _DirShadowSplitSpheres2;

half ComputeCascadeIndex(float3 positionWS)
{
// TODO: profile if there's a performance improvement if we avoid indexing here
float3 fromCenter0 = positionWS - _DirShadowSplitSpheres0.xyz;
float3 fromCenter1 = positionWS - _DirShadowSplitSpheres1.xyz;
float3 fromCenter2 = positionWS - _DirShadowSplitSpheres2.xyz;

half cascadeIndex = ComputeCascadeIndex(positionWS);
return mul(_WorldToShadow[cascadeIndex], float4(positionWS, 1.0));
#else
return mul(_WorldToShadow, float4(positionWS, 1.0));
return mul(_WorldToShadow[0], float4(positionWS, 1.0));
#endif
}

92
com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Terrain/LightweightPassLitTerrain.hlsl


float4 uvSplat01 : TEXCOORD0; // xy: splat0, zw: splat1
float4 uvSplat23 : TEXCOORD1; // xy: splat2, zw: splat3
float4 uvControlAndLM : TEXCOORD2; // xy: control, zw: lightmap
#if _TERRAIN_NORMAL_MAP
half4 normal : TEXCOORD3; // xyz: normal, w: viewDir.x
half4 tangent : TEXCOORD4; // xyz: tangent, w: viewDir.y
half4 binormal : TEXCOORD5; // xyz: binormal, w: viewDir.z
#else
#if _TERRAIN_NORMAL_MAP
half3 tangent : TEXCOORD4;
half3 binormal : TEXCOORD5;
half3 viewDir : TEXCOORD4;
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
float3 positionWS : TEXCOORD7;
float4 shadowCoord : TEXCOORD8;

input.positionWS = IN.positionWS;
#ifdef _TERRAIN_NORMAL_MAP
input.normalWS = TangentToWorldNormal(normalTS, IN.tangent, IN.binormal, IN.normal);
half3 viewDir = half3(IN.normal.w, IN.tangent.w, IN.binormal.w);
input.normalWS = TangentToWorldNormal(normalTS, IN.tangent.xyz, IN.binormal.xyz, IN.normal.xyz);
input.normalWS = normalize(IN.normal);
half3 viewDir = IN.viewDir;
input.normalWS = FragmentNormalWS(IN.normal);
input.viewDirectionWS = SafeNormalize(GetCameraPositionWS() - IN.positionWS);
input.viewDirectionWS = FragmentViewDirWS(viewDir);
#ifdef _SHADOWS_ENABLED
input.shadowCoord = IN.shadowCoord;
#else

#endif
}
void SplatmapMix(VertexOutput IN, half4 defaultAlpha, out half4 splat_control, out half weight, out half4 mixedDiffuse, inout half3 mixedNormal)
void SplatmapMix(VertexOutput IN, half4 defaultAlpha, out half4 splatControl, out half weight, out half4 mixedDiffuse, inout half3 mixedNormal)
splat_control = SAMPLE_TEXTURE2D(_Control, sampler_Control, IN.uvControlAndLM.xy);
weight = dot(splat_control, 1);
splatControl = SAMPLE_TEXTURE2D(_Control, sampler_Control, IN.uvControlAndLM.xy);
weight = dot(splatControl, 1.0h);
clip(weight == 0.0f ? -1 : 1);
clip(weight == 0.0h ? -1.0h : 1.0h);
splat_control /= (weight + 1e-3f);
splatControl /= (weight + HALF_MIN);
mixedDiffuse = 0.0f;
mixedDiffuse += splat_control.r * SAMPLE_TEXTURE2D(_Splat0, sampler_Splat0, IN.uvSplat01.xy) * half4(1.0, 1.0, 1.0, defaultAlpha.r);
mixedDiffuse += splat_control.g * SAMPLE_TEXTURE2D(_Splat1, sampler_Splat0, IN.uvSplat01.zw) * half4(1.0, 1.0, 1.0, defaultAlpha.g);
mixedDiffuse += splat_control.b * SAMPLE_TEXTURE2D(_Splat2, sampler_Splat0, IN.uvSplat23.xy) * half4(1.0, 1.0, 1.0, defaultAlpha.b);
mixedDiffuse += splat_control.a * SAMPLE_TEXTURE2D(_Splat3, sampler_Splat0, IN.uvSplat23.zw) * half4(1.0, 1.0, 1.0, defaultAlpha.a);
half4 alpha = defaultAlpha * splatControl;
mixedDiffuse = 0.0h;
mixedDiffuse += SAMPLE_TEXTURE2D(_Splat0, sampler_Splat0, IN.uvSplat01.xy) * half4(splatControl.rrr, alpha.r);
mixedDiffuse += SAMPLE_TEXTURE2D(_Splat1, sampler_Splat0, IN.uvSplat01.zw) * half4(splatControl.ggg, alpha.g);
mixedDiffuse += SAMPLE_TEXTURE2D(_Splat2, sampler_Splat0, IN.uvSplat23.xy) * half4(splatControl.bbb, alpha.b);
mixedDiffuse += SAMPLE_TEXTURE2D(_Splat3, sampler_Splat0, IN.uvSplat23.zw) * half4(splatControl.aaa, alpha.a);
nrm += splat_control.r * SAMPLE_TEXTURE2D(_Normal0, sampler_Normal0, IN.uvSplat01.xy);
nrm += splat_control.g * SAMPLE_TEXTURE2D(_Normal1, sampler_Normal0, IN.uvSplat01.zw);
nrm += splat_control.b * SAMPLE_TEXTURE2D(_Normal2, sampler_Normal0, IN.uvSplat23.xy);
nrm += splat_control.a * SAMPLE_TEXTURE2D(_Normal3, sampler_Normal0, IN.uvSplat23.zw);
nrm += SAMPLE_TEXTURE2D(_Normal0, sampler_Normal0, IN.uvSplat01.xy) * splatControl.r;
nrm += SAMPLE_TEXTURE2D(_Normal1, sampler_Normal0, IN.uvSplat01.zw) * splatControl.g;
nrm += SAMPLE_TEXTURE2D(_Normal2, sampler_Normal0, IN.uvSplat23.xy) * splatControl.b;
nrm += SAMPLE_TEXTURE2D(_Normal3, sampler_Normal0, IN.uvSplat23.zw) * splatControl.a;
mixedNormal = half3(0, 0, 1);
mixedNormal = half3(0.0h, 0.0h, 1.0h);
#endif
}

#ifdef TERRAIN_SPLAT_ADDPASS
ApplyFogColor(color.rgb, half3(0,0,0), fogCoord);
#else
ApplyFog(color.rgb, fogCoord);
#endif
#ifdef TERRAIN_SPLAT_ADDPASS
ApplyFogColor(color.rgb, half3(0.0h, 0.0h, 0.0h), fogCoord);
#else
ApplyFog(color.rgb, fogCoord);
#endif
}
///////////////////////////////////////////////////////////////////////////////

o.uvControlAndLM.xy = TRANSFORM_TEX(v.texcoord, _Control);
o.uvControlAndLM.zw = v.texcoord1 * unity_LightmapST.xy + unity_LightmapST.zw;
half3 viewDir = VertexViewDirWS(GetCameraPositionWS() - positionWS.xyz);
OutputTangentToWorld(vertexTangent, v.normal, o.tangent, o.binormal, o.normal);
OutputTangentToWorld(vertexTangent, v.normal, o.tangent.xyz, o.binormal.xyz, o.normal.xyz);
o.normal.w = viewDir.x;
o.tangent.w = viewDir.y;
o.binormal.w = viewDir.z;
o.viewDir = viewDir;
#endif
o.fogFactorAndVertexLight.x = ComputeFogFactor(clipPos.z);
o.fogFactorAndVertexLight.yzw = VertexLighting(positionWS, o.normal);

#ifdef _SHADOWS_ENABLED
#if SHADOWS_SCREEN
o.shadowCoord = ComputeShadowCoord(o.clipPos);
#else
o.shadowCoord = TransformWorldToShadowCoord(positionWS);
#endif
#if SHADOWS_SCREEN
o.shadowCoord = ComputeShadowCoord(o.clipPos);
#else
o.shadowCoord = TransformWorldToShadowCoord(positionWS);
#endif
#endif
return o;

half4 SpatmapFragment(VertexOutput IN) : SV_TARGET
{
half4 splat_control;
half4 splatControl;
SplatmapMix(IN, defaultSmoothness, splat_control, weight, mixedDiffuse, normalTS);
SplatmapMix(IN, defaultSmoothness, splatControl, weight, mixedDiffuse, normalTS);
half metallic = dot(splat_control, half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3));
half3 specular = half3(0, 0, 0);
half metallic = dot(splatControl, half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3));
half3 specular = half3(0.0h, 0.0h, 0.0h);
half4 color = LightweightFragmentPBR(inputData, albedo, metallic, specular, smoothness, /* occlusion */ 1.0, /* emission */ half3(0, 0, 0), alpha);
half4 color = LightweightFragmentPBR(inputData, albedo, metallic, specular, smoothness, /* occlusion */ 1.0h, /* emission */ half3(0.0h, 0.0h, 0.0h), alpha);
return half4(color.rgb, 1);
return half4(color.rgb, 1.0h);
}
#endif // LIGHTWEIGHT_PASS_LIT_TERRAIN_INCLUDED

6
com.unity.shadergraph/Editor/Data/Implementation/NodeUtils.cs


if (nodeList.Contains(node))
return;
var ids = node.GetInputSlots<ISlot>().Select(x => x.id);
if (slotIds != null)
IEnumerable<int> ids;
if (slotIds == null)
ids = node.GetInputSlots<ISlot>().Select(x => x.id);
else
ids = node.GetInputSlots<ISlot>().Where(x => slotIds.Contains(x.id)).Select(x => x.id);
foreach (var slot in ids)

483
com.unity.shadergraph/Editor/Data/Util/GraphUtil.cs


}
};
[System.AttributeUsage(System.AttributeTargets.Struct)]
public class InterpolatorPack : System.Attribute
{
public InterpolatorPack()
{
}
}
// attribute used to flag a field as needing an HLSL semantic applied
// i.e. float3 position : POSITION;
// ^ semantic

}
result.Deindent();
result.AddShaderChunk("};");
object[] packAttributes = t.GetCustomAttributes(typeof(InterpolatorPack), false);
if (packAttributes.Length > 0)
{
BuildPackedType(t, activeFields, result);
}
}
public static void BuildPackedType(System.Type unpacked, HashSet<string> activeFields, ShaderGenerator result)

result.AddGenerator(unpacker);
}
// an easier to use version of substring Append() -- explicit inclusion on each end, and checks for positive length
private static void AppendSubstring(System.Text.StringBuilder target, string str, int start, bool includeStart, int end, bool includeEnd)
{
if (!includeStart)
{
start++;
}
if (!includeEnd)
{
end--;
}
int count = end - start + 1;
if (count > 0)
{
target.Append(str, start, count);
}
}
// returns the offset of the first non-whitespace character, in the range [start, end] inclusive ... will return end if none found
private static int SkipWhitespace(string str, int start, int end)
{

return index;
}
public static System.Text.StringBuilder PreprocessShaderCode(string code, HashSet<string> activeFields, Dictionary<string, string> namedFragments, System.Text.StringBuilder result, bool debugOutput)
public class TemplatePreprocessor
if (result == null)
// inputs
HashSet<string> activeFields;
Dictionary<string, string> namedFragments;
string templatePath;
bool debugOutput;
string buildTypeAssemblyNameFormat;
// intermediates
HashSet<string> includedFiles;
// outputs
ShaderStringBuilder result;
List<string> sourceAssetDependencyPaths;
public TemplatePreprocessor(HashSet<string> activeFields, Dictionary<string, string> namedFragments, bool debugOutput, string templatePath, List<string> sourceAssetDependencyPaths, string buildTypeAssemblyNameFormat, ShaderStringBuilder outShaderCodeResult = null)
{
this.activeFields = activeFields;
this.namedFragments = namedFragments;
this.debugOutput = debugOutput;
this.templatePath = templatePath;
this.sourceAssetDependencyPaths = sourceAssetDependencyPaths;
this.buildTypeAssemblyNameFormat = buildTypeAssemblyNameFormat;
this.result = outShaderCodeResult ?? new ShaderStringBuilder();
includedFiles = new HashSet<string>();
}
public ShaderStringBuilder GetShaderCode()
result = new System.Text.StringBuilder();
return result;
int cur = 0;
int end = code.Length;
bool skipEndln = false;
public void ProcessTemplateFile(string filePath)
{
if (File.Exists(filePath) &&
!includedFiles.Contains(filePath))
{
includedFiles.Add(filePath);
while (cur < end)
if (sourceAssetDependencyPaths != null)
sourceAssetDependencyPaths.Add(filePath);
string[] templateLines = File.ReadAllLines(filePath);
foreach (string line in templateLines)
{
ProcessTemplateLine(line, 0, line.Length);
}
}
}
private struct Token
int dollar = code.IndexOf('$', cur);
if (dollar < 0)
public string s;
public int start;
public int end;
public Token(string s, int start, int end)
// no escape sequence found -- just append the remaining part of the code verbatim
AppendSubstring(result, code, cur, true, end, false);
cur = end;
this.s = s;
this.start = start;
this.end = end;
else
public static Token Invalid()
// found $ escape sequence
return new Token(null, 0, 0);
}
// find the end of the line (or if none found, the end of the code)
int endln = code.IndexOf('\n', dollar + 1);
if (endln < 0)
public bool IsValid()
{
return (s != null);
}
public bool Is(string other)
{
int len = end - start;
return (other.Length == len) && (0 == string.Compare(s, start, other, 0, len));
}
public string GetString()
{
int len = end - start;
if (len > 0)
endln = end;
return s.Substring(start, end - start);
return null;
}
}
// see if the character after '$' is '{', which would indicate a named fragment splice
if ((dollar + 1 < endln) && (code[dollar + 1] == '{'))
public void ProcessTemplateLine(string line, int start, int end)
{
bool appendEndln = true;
int cur = start;
while (cur < end)
{
// find an escape code '$'
int dollar = line.IndexOf('$', cur, end - cur);
if (dollar < 0)
{
// no escape code found in the remaining code -- just append the rest verbatim
AppendSubstring(line, cur, true, end, false);
break;
}
else
// named fragment splice
// search for the '}' within the current line
int curlystart = dollar + 1;
int curlyend = -1;
if (endln > curlystart + 1)
// found $ escape sequence
Token command = ParseIdentifier(line, dollar+1, end);
if (!command.IsValid())
curlyend = code.IndexOf('}', curlystart + 1, endln - curlystart - 1);
Error("ERROR: $ must be followed by a command string (if, splice, or include)", line, dollar+1);
break;
int nameLength = curlyend - dollar + 1;
if ((curlyend < 0) || (nameLength <= 0))
else
// no } found, or zero length name
// append everything before the beginning of the escape sequence
AppendSubstring(result, code, cur, true, dollar, false);
if (curlyend < 0)
if (command.Is("include"))
result.Append("// ERROR: unterminated escape sequence ('${' and '}' must be matched)\n");
ProcessIncludeCommand(command, end);
break; // include command always ignores the rest of the line, error or not
else
else if (command.Is("splice"))
result.Append("// ERROR: name '${}' is empty\n");
if (!ProcessSpliceCommand(command, end, ref cur))
{
// error, skip the rest of the line
break;
}
// append the line (commented out) for context
result.Append("// ");
AppendSubstring(result, code, dollar, true, endln, false);
result.Append("\n");
}
else
{
// } found!
// ugh, this probably allocates memory -- wish we could do the name lookup direct from a substring
string name = code.Substring(dollar, nameLength);
// append everything before the beginning of the escape sequence
AppendSubstring(result, code, cur, true, dollar, false);
string fragment;
if ((namedFragments != null) && namedFragments.TryGetValue(name, out fragment))
else if (command.Is("buildType"))
// splice the fragment
result.Append(fragment);
// advance to just after the '}'
cur = curlyend + 1;
ProcessBuildTypeCommand(command, end);
break; // buildType command always ignores the rest of the line, error or not
// no named fragment found
result.AppendFormat("/* Could not find named fragment '{0}' */", name);
cur = curlyend + 1;
// let's see if it is a predicate
Token predicate = ParseUntil(line, dollar + 1, end, ':');
if (!predicate.IsValid())
{
Error("ERROR: unrecognized command: " + command.GetString(), line, command.start);
break;
}
else
{
if (!ProcessPredicate(predicate, end, ref cur, ref appendEndln))
{
break; // skip the rest of the line
}
}
}
if (appendEndln)
{
result.AppendNewLine();
}
}
private void ProcessIncludeCommand(Token includeCommand, int lineEnd)
{
if (Expect(includeCommand.s, includeCommand.end, '('))
{
Token param = ParseString(includeCommand.s, includeCommand.end + 1, lineEnd);
if (!param.IsValid())
{
Error("ERROR: $include expected a string file path parameter", includeCommand.s, includeCommand.end + 1);
}
// it's a predicate
// search for the colon within the current line
int colon = -1;
if (endln > dollar + 1)
var includeLocation = Path.Combine(templatePath, param.GetString());
if (!File.Exists(includeLocation))
{
Error("ERROR: $include cannot find file : " + includeLocation, includeCommand.s, param.start);
}
else
colon = code.IndexOf(':', dollar + 1, endln - dollar - 1);
// skip a line, just to be sure we've cleaned up the current line
result.AppendNewLine();
result.AppendLine("//-------------------------------------------------------------------------------------");
result.AppendLine("// TEMPLATE INCLUDE : " + param.GetString());
result.AppendLine("//-------------------------------------------------------------------------------------");
ProcessTemplateFile(includeLocation);
result.AppendNewLine();
result.AppendLine("//-------------------------------------------------------------------------------------");
result.AppendLine("// END TEMPLATE INCLUDE : " + param.GetString());
result.AppendLine("//-------------------------------------------------------------------------------------");
}
}
}
int predicateLength = colon - dollar - 1;
if ((colon < 0) || (predicateLength <= 0))
private bool ProcessSpliceCommand(Token spliceCommand, int lineEnd, ref int cur)
{
if (!Expect(spliceCommand.s, spliceCommand.end, '('))
{
return false;
}
else
{
Token param = ParseUntil(spliceCommand.s, spliceCommand.end + 1, lineEnd, ')');
if (!param.IsValid())
{
Error("ERROR: splice command is missing a ')'", spliceCommand.s, spliceCommand.start);
return false;
}
else
{
// append everything before the beginning of the escape sequence
AppendSubstring(spliceCommand.s, cur, true, spliceCommand.start-1, false);
// find the named fragment
string name = param.GetString(); // unfortunately this allocates a new string
string fragment;
if ((namedFragments != null) && namedFragments.TryGetValue(name, out fragment))
// no colon found... error! Spit out error and context
// splice the fragment
result.Append(fragment);
}
else
{
// no named fragment found
result.Append("/* WARNING: $splice Could not find named fragment '{0}' */", name);
}
// append everything before the beginning of the escape sequence
AppendSubstring(result, code, cur, true, dollar, false);
// advance to just after the ')' and continue parsing
cur = param.end + 1;
}
}
return true;
}
if (colon < 0)
{
result.Append("// ERROR: unterminated escape sequence ('$' and ':' must be matched)\n");
}
else
{
result.Append("// ERROR: predicate is zero length\n");
}
// append the line (commented out) for context
result.Append("// ");
AppendSubstring(result, code, dollar, true, endln, false);
private void ProcessBuildTypeCommand(Token command, int endLine)
{
if (Expect(command.s, command.end, '('))
{
Token param = ParseUntil(command.s, command.end + 1, endLine, ')');
if (!param.IsValid())
{
Error("ERROR: buildType command is missing a ')'", command.s, command.start);
}
else
{
string typeName = param.GetString();
string assemblyQualifiedTypeName = string.Format(buildTypeAssemblyNameFormat, typeName);
Type type = Type.GetType(assemblyQualifiedTypeName);
if (type == null)
{
Error("ERROR: buildType could not find type : " + typeName, command.s, param.start);
// colon found!
// ugh, this probably allocates memory -- wish we could do the field lookup direct from a substring
string predicate = code.Substring(dollar + 1, predicateLength);
int nonwhitespace = SkipWhitespace(code, colon + 1, endln);
if (activeFields.Contains(predicate))
{
// append everything before the beginning of the escape sequence
AppendSubstring(result, code, cur, true, dollar, false);
result.AppendLine("// Generated Type: " + typeName);
ShaderGenerator temp = new ShaderGenerator();
BuildType(type, activeFields, temp);
result.AppendLine(temp.GetShaderString(0, false));
}
}
}
}
private bool ProcessPredicate(Token predicate, int endLine, ref int cur, ref bool appendEndln)
{
// eval if(param)
string fieldName = predicate.GetString();
int nonwhitespace = SkipWhitespace(predicate.s, predicate.end + 1, endLine);
if (activeFields.Contains(fieldName))
{
// predicate is active
// append everything before the beginning of the escape sequence
AppendSubstring(predicate.s, cur, true, predicate.start-1, false);
// continue parsing the rest of the line, starting with the first nonwhitespace character
cur = nonwhitespace;
return true;
}
else
{
// predicate is not active
if (debugOutput)
{
// append everything before the beginning of the escape sequence
AppendSubstring(predicate.s, cur, true, predicate.start-1, false);
// append the rest of the line, commented out
result.Append("// ");
AppendSubstring(predicate.s, nonwhitespace, true, endLine, false);
}
else
{
// don't append anything
appendEndln = false;
}
return false;
}
}
// predicate is active, append the line
AppendSubstring(result, code, nonwhitespace, true, endln, false);
}
else
{
// predicate is not active
if (debugOutput)
{
// append everything before the beginning of the escape sequence
AppendSubstring(result, code, cur, true, dollar, false);
result.Append("// ");
AppendSubstring(result, code, nonwhitespace, true, endln, false);
}
else
{
skipEndln = true;
}
}
private Token ParseIdentifier(string code, int start, int end)
{
if (start < end)
{
char c = code[start];
if (Char.IsLetter(c) || (c == '_'))
{
int cur = start + 1;
while (cur < end)
{
c = code[cur];
if (!(Char.IsLetterOrDigit(c) || (c == '_')))
break;
cur++;
cur = endln + 1;
return new Token(code, start, cur);
return Token.Invalid();
if (!skipEndln)
private Token ParseString(string line, int start, int end)
result.AppendLine();
if (Expect(line, start, '"'))
{
return ParseUntil(line, start + 1, end, '"');
}
return Token.Invalid();
return result;
private Token ParseUntil(string line, int start, int end, char endChar)
{
int cur = start;
while (cur < end)
{
if (line[cur] == endChar)
{
return new Token(line, start, cur);
}
cur++;
}
return Token.Invalid();
}
private bool Expect(string line, int location, char expected)
{
if ((location < line.Length) && (line[location] == expected))
{
return true;
}
Error("Expected '" + expected + "'", line, location);
return false;
}
private void Error(string error, string line, int location)
{
// append the line for context
result.Append("\n");
result.Append("// ");
AppendSubstring(line, 0, true, line.Length, false);
result.Append("\n");
// append the location marker, and error description
result.Append("// ");
result.AppendSpaces(location);
result.Append("^ ");
result.Append(error);
result.Append("\n");
}
// an easier to use version of substring Append() -- explicit inclusion on each end, and checks for positive length
private void AppendSubstring(string str, int start, bool includeStart, int end, bool includeEnd)
{
if (!includeStart)
{
start++;
}
if (!includeEnd)
{
end--;
}
int count = end - start + 1;
if (count > 0)
{
result.Append(str, start, count);
}
}
}
public static void ApplyDependencies(HashSet<string> activeFields, List<Dependency[]> dependsList)

10
com.unity.shadergraph/Editor/Data/Util/ShaderStringBuilder.cs


m_StringBuilder.Append(value);
}
public void Append(string value, int start, int count)
{
m_StringBuilder.Append(value, start, count);
}
}
public void AppendSpaces(int count)
{
m_StringBuilder.Append(' ', count);
}
public void AppendIndentation()

11
com.unity.testframework.graphics/Editor/SetupGraphicsTestCases.cs


/// player.
/// Will also build Lightmaps for specially labelled scenes.
/// </summary>
public class SetupGraphicsTestCases : IPrebuildSetup
public class SetupGraphicsTestCases
{
static string bakeLabel = "TestRunnerBake";

{
var playmodeLauncher =
typeof(UnityEditor.TestTools.RequirePlatformSupportAttribute).Assembly.GetType(
typeof(RequirePlatformSupportAttribute).Assembly.GetType(
"UnityEditor.TestTools.TestRunner.PlaymodeLauncher");
var isRunningField = playmodeLauncher.GetField("IsRunning");

public void Setup()
{
Setup(EditorGraphicsTestCaseProvider.ReferenceImagesRoot);
}
public void Setup(string rootImageTemplatePath)
{
ColorSpace colorSpace;
BuildTarget buildPlatform;

foreach (var api in graphicsDevices)
{
var images = EditorGraphicsTestCaseProvider.CollectReferenceImagePathsFor(colorSpace, runtimePlatform, api);
var images = EditorGraphicsTestCaseProvider.CollectReferenceImagePathsFor(rootImageTemplatePath, colorSpace, runtimePlatform, api);
Utils.SetupReferenceImageImportSettings(images.Values);

6
com.unity.testframework.graphics/Editor/TestResultWindow.cs


return false; // No reference image found
}
var colorSpace = UseGraphicsTestCasesAttribute.Provider.ColorSpace;
var platform = UseGraphicsTestCasesAttribute.Provider.Platform;
var graphicsDevice = UseGraphicsTestCasesAttribute.Provider.GraphicsDevice;
var colorSpace = UseGraphicsTestCasesAttribute.ColorSpace;
var platform = UseGraphicsTestCasesAttribute.Platform;
var graphicsDevice = UseGraphicsTestCasesAttribute.GraphicsDevice;
var actualImagesDir = Path.Combine(ActualImagesRoot, string.Format("{0}/{1}/{2}", colorSpace, platform, graphicsDevice));

34
com.unity.testframework.graphics/Runtime/EditorGraphicsTestCaseProvider.cs


#if UNITY_EDITOR
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.IO;

{
internal class EditorGraphicsTestCaseProvider : IGraphicsTestCaseProvider
{
public ColorSpace ColorSpace
{
get
{
return QualitySettings.activeColorSpace;
}
}
string m_ReferenceImagePath = string.Empty;
public RuntimePlatform Platform
public EditorGraphicsTestCaseProvider()
get
{
return Application.platform;
}
public GraphicsDeviceType GraphicsDevice
public EditorGraphicsTestCaseProvider(string referenceImagePath)
get
{
return SystemInfo.graphicsDeviceType;
}
m_ReferenceImagePath = referenceImagePath;
var allImages = CollectReferenceImagePathsFor(QualitySettings.activeColorSpace, Application.platform,
var allImages = CollectReferenceImagePathsFor(string.IsNullOrEmpty(m_ReferenceImagePath) ? ReferenceImagesRoot : m_ReferenceImagePath, QualitySettings.activeColorSpace, Application.platform,
SystemInfo.graphicsDeviceType);
foreach (var scenePath in EditorBuildSettings.scenes.Where(s => s.enabled == true).Select(s => s.path).ToArray())

public const string ReferenceImagesRoot = "Assets/ReferenceImages";
public static Dictionary<string, string> CollectReferenceImagePathsFor(ColorSpace colorSpace, RuntimePlatform runtimePlatform,
public static Dictionary<string, string> CollectReferenceImagePathsFor(string referenceImageRoot, ColorSpace colorSpace, RuntimePlatform runtimePlatform,
if (!Directory.Exists(ReferenceImagesRoot))
if (!Directory.Exists(referenceImageRoot))
var fullPathPrefix = string.Format("{0}/{1}/{2}/{3}/", ReferenceImagesRoot, colorSpace, runtimePlatform, graphicsApi);
var fullPathPrefix = string.Format("{0}/{1}/{2}/{3}/", referenceImageRoot, colorSpace, runtimePlatform, graphicsApi);
.Where(p => p.StartsWith(ReferenceImagesRoot, StringComparison.OrdinalIgnoreCase))
.Where(p => p.StartsWith(referenceImageRoot, StringComparison.OrdinalIgnoreCase))
.Where(p => fullPathPrefix.StartsWith(Path.GetDirectoryName(p)))
.OrderBy(p => p.Count(ch => ch == '/')))
{

20
com.unity.testframework.graphics/Runtime/IGraphicsTestCaseProvider.cs


using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine.Rendering;
namespace UnityEngine.TestTools.Graphics

/// </summary>
/// <returns></returns>
IEnumerable<GraphicsTestCase> GetTestCases();
/// <summary>
/// The color space that the test cases are for.
/// </summary>
ColorSpace ColorSpace { get; }
/// <summary>
/// The platform that the test cases are for.
/// </summary>
RuntimePlatform Platform { get; }
/// <summary>
/// The graphics device type that the test cases are for.
/// </summary>
GraphicsDeviceType GraphicsDevice { get; }
}
}

14
com.unity.testframework.graphics/Runtime/ResultsUtility.cs


#if UNITY_EDITOR
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.IO;

using NUnit.Framework.Interfaces;
using UnityEditor.Graphs;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.TestTools.Graphics;

if (!(test.Properties.ContainsKey("Image") ||
test.Properties.ContainsKey("DiffImage")))
return;
var colorSpace = UseGraphicsTestCasesAttribute.Provider.ColorSpace;
var platform = UseGraphicsTestCasesAttribute.Provider.Platform;
var graphicsDevice = UseGraphicsTestCasesAttribute.Provider.GraphicsDevice;
var dirName = Path.Combine(ActualImagesRoot, string.Format("{0}/{1}/{2}", colorSpace, platform, graphicsDevice));
var dirName = Path.Combine(ActualImagesRoot, string.Format("{0}/{1}/{2}", UseGraphicsTestCasesAttribute.ColorSpace, UseGraphicsTestCasesAttribute.Platform, UseGraphicsTestCasesAttribute.GraphicsDevice));
if (!Directory.Exists(dirName))
Directory.CreateDirectory(dirName);

}
}
}
#endif
#endif

30
com.unity.testframework.graphics/Runtime/RuntimeGraphicsTestCaseProvider.cs


using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Rendering;
public ColorSpace ColorSpace
{
get
{
return QualitySettings.activeColorSpace;
}
}
public RuntimePlatform Platform
{
get
{
return Application.platform;
}
}
public GraphicsDeviceType GraphicsDevice
{
get
{
return SystemInfo.graphicsDeviceType;
}
}
public IEnumerable<GraphicsTestCase> GetTestCases()
public IEnumerable<GraphicsTestCase> GetTestCases()
var referenceImagesBundlePath = string.Format("{0}/referenceimages-{1}-{2}-{3}", Application.streamingAssetsPath, ColorSpace, Platform, GraphicsDevice);
var referenceImagesBundlePath = string.Format("{0}/referenceimages-{1}-{2}-{3}", Application.streamingAssetsPath, UseGraphicsTestCasesAttribute.ColorSpace, UseGraphicsTestCasesAttribute.Platform, UseGraphicsTestCasesAttribute.GraphicsDevice);
if (File.Exists(referenceImagesBundlePath))
referenceImagesBundle = AssetBundle.LoadFromFile(referenceImagesBundlePath);

50
com.unity.testframework.graphics/Runtime/UseGraphicsTestCasesAttribute.cs


using System;
using System;
using UnityEngine.Rendering;
using Attribute = System.Attribute;
namespace UnityEngine.TestTools.Graphics

/// </summary>
public class UseGraphicsTestCasesAttribute : Attribute, ITestBuilder
{
string m_ReferenceImagePath = string.Empty;
public UseGraphicsTestCasesAttribute()
{}
public UseGraphicsTestCasesAttribute(string referenceImagePath)
{
m_ReferenceImagePath = referenceImagePath;
}
public static IGraphicsTestCaseProvider Provider
public IGraphicsTestCaseProvider Provider
return new UnityEditor.TestTools.Graphics.EditorGraphicsTestCaseProvider();
return new UnityEditor.TestTools.Graphics.EditorGraphicsTestCaseProvider(m_ReferenceImagePath);
#else
return new RuntimeGraphicsTestCaseProvider();
#endif

public static ColorSpace ColorSpace
{
get
{
return QualitySettings.activeColorSpace;
}
}
public static RuntimePlatform Platform
{
get
{
return Application.platform;
}
}
public static GraphicsDeviceType GraphicsDevice
{
get
{
return SystemInfo.graphicsDeviceType;
}
}
IEnumerable<TestMethod> ITestBuilder.BuildFrom(IMethodInfo method, Test suite)
{
List<TestMethod> results = new List<TestMethod>();

throw;
}
suite.Properties.Set("ColorSpace", provider.ColorSpace);
suite.Properties.Set("RuntimePlatform", provider.Platform);
suite.Properties.Set("GraphicsDevice", provider.GraphicsDevice);
suite.Properties.Set("ColorSpace", ColorSpace);
suite.Properties.Set("RuntimePlatform", Platform);
suite.Properties.Set("GraphicsDevice", GraphicsDevice);
}
}

2
com.unity.testing.srp.lightweight/Tests/CommonAssets/Scripts/Setup/SetupGraphicsTestCases.cs


{
public void Setup()
{
new UnityEditor.TestTools.Graphics.SetupGraphicsTestCases().Setup();
new UnityEditor.TestTools.Graphics.SetupGraphicsTestCases().Setup(LWGraphicsTests.lwPackagePath);
}
}

5
com.unity.testing.srp.lightweight/Tests/CommonAssets/Scripts/LWGraphicsTests.cs


public class LWGraphicsTests
{
public const string lwPackagePath = "Packages/com.unity.testing.srp.lightweight/Tests/ReferenceImages";
[UseGraphicsTestCases]
[UseGraphicsTestCases(lwPackagePath)]
public IEnumerator Run(GraphicsTestCase testCase)
{
SceneManager.LoadScene(testCase.ScenePath);

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/050_Shader_Graphs.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/046_Camera_OpaqueTexture.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

39
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/044_Lighting_ReflectionProbe.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Nintendo Switch
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/041_Lighting_BasicArea.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/040_UpgradeScene.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/037_Particles_Standard.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/036_Lighting_Scene_DirectionalBakedDirectional.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/034_Shader_HighlightsEnvironmentGradientBaked.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/033_Shader_HighlightsEnvironmentGradientSH.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/032_Shader_GlossyEnvironmentColor.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/031_Shader_GlossyEnvironmentSky.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/029_Particles.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/028_PostProcessing_Custom.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/027_PostProcessing.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/025_Shader_PBRvalidation_Metallic.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/024_Shader_PBRvalidation_Specular.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/015_CameraMulti_FPSCam.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/014_CameraMulti_MiniMap.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/013_CameraMulti_Splitscreen.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/004_Camera_TargetTexture.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/003_Camera_Ortho.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

8
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/WindowsEditor/Direct3D11/002_Camera_Clip.png.meta


serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0

externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0

989
com.unity.testing.srp.lightweight/Tests/ReferenceImages/Linear/OSXEditor/Metal/007_LitShaderMaps.png

之前 之后
宽度: 640  |  高度: 360  |  大小: 161 KiB

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存