From c22312ef767ad28b9af0559013cf9d2d7b48f76f Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 6 Oct 2020 18:20:01 +0200 Subject: [PATCH 1/2] disable quad overdraw on ps4 --- .../Runtime/Debug/DebugDisplay.cs | 7 +++++-- .../ShaderPass/ShaderPassFullScreenDebug.hlsl | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index 1590e2f9d26..2148953c2af 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -297,11 +297,14 @@ internal DebugDisplaySettings() FillFullScreenDebugEnum(ref s_RenderingFullScreenDebugStrings, ref s_RenderingFullScreenDebugValues, FullScreenDebugMode.MinRenderingFullScreenDebug, FullScreenDebugMode.MaxRenderingFullScreenDebug); FillFullScreenDebugEnum(ref s_MaterialFullScreenDebugStrings, ref s_MaterialFullScreenDebugValues, FullScreenDebugMode.MinMaterialFullScreenDebug, FullScreenDebugMode.MaxMaterialFullScreenDebug); - if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal) + var device = SystemInfo.graphicsDeviceType; + if (device == GraphicsDeviceType.Metal) { - // Disable QuadOverdraw and VertexDensity on metal as they are not supported s_RenderingFullScreenDebugStrings = s_RenderingFullScreenDebugStrings.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.VertexDensity).ToArray(); s_RenderingFullScreenDebugValues = s_RenderingFullScreenDebugValues.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.VertexDensity).ToArray(); + } + if (device == GraphicsDeviceType.Metal || device == GraphicsDeviceType.PlayStation4) + { s_RenderingFullScreenDebugStrings = s_RenderingFullScreenDebugStrings.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.QuadOverdraw).ToArray(); s_RenderingFullScreenDebugValues = s_RenderingFullScreenDebugValues.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.QuadOverdraw).ToArray(); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassFullScreenDebug.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassFullScreenDebug.hlsl index 4fc32d1f72b..cad35f32e4b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassFullScreenDebug.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassFullScreenDebug.hlsl @@ -32,7 +32,7 @@ PackedVaryingsToPS VertTesselation(VaryingsToDS input) [earlydepthstencil] // quad overshading debug mode writes to UAV #endif void Frag(PackedVaryingsToPS packedInput -#if !defined(SHADER_API_METAL) // Metal does not support SV_PrimitiveID +#if !defined(SHADER_API_METAL) && !defined(SHADER_API_PSSL) // Metal and pssl does not support SV_PrimitiveID , uint primitiveID : SV_PrimitiveID #endif ) @@ -44,7 +44,7 @@ void Frag(PackedVaryingsToPS packedInput if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) { -#if !defined(SHADER_API_METAL) // Metal does not support SV_PrimitiveID +#if !defined(SHADER_API_METAL) && !defined(SHADER_API_PSSL) // Metal and pssl does not support SV_PrimitiveID IncrementQuadOverdrawCounter(posInput.positionSS.xy, primitiveID); #endif } From 1be4b23d2929742354bcdd81a7b31cfe3234fce8 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 6 Oct 2020 18:38:37 +0200 Subject: [PATCH 2/2] update doc --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Documentation~/Render-Pipeline-Debug-Window.md | 2 +- .../Documentation~/whats-new-10-0.md | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index d0255d2c037..a86c73ed2ec 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -134,6 +134,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed outlines in transitions between post-processed and plain regions in the graphics compositor (case 1278775). - Fix decal being applied twice with LOD Crossfade. - Fixed camera stacking for AOVs in the graphics compositor (case 1273223). +- Disable quad overdraw on ps4. ### Changed - Preparation pass for RTSSShadows to be supported by render graph. diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md b/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md index 96f1135b30d..18a139a0de9 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md @@ -181,7 +181,7 @@ The **Rendering** panel has tools that you can use to visualize various HDRP ren | **Debug Option** | **Description** | | ----------------------------- | ------------------------------------------------------------ | -| **Fullscreen Debug Mode** | Use the drop-down to select a rendering mode to display as an overlay on the screen.
• **Motion Vectors**: Select this option to display motion vectors. Note that object motion vectors are not visible in the Scene view.
• **NaN Tracker**: Select this option to display an overlay that highlights [NaN]() values.
• **Quad Overdraw**: Select this option to display an overlay that highlights gpu quads running multiple fragment shaders. This is mainly caused by small or thin triangles. Use LODs to reduce the amount of overdraw when objects are far away. (This mode is currently not supported on Metal)
• **Vertex Density**: Select this option to display an overlay that highlights pixels running multiple vertex shaders. A vertex can be run multiple times when part of different triangles. This helps finding models that need LODs. (This mode is currently not supported on Metal) | +| **Fullscreen Debug Mode** | Use the drop-down to select a rendering mode to display as an overlay on the screen.
• **Motion Vectors**: Select this option to display motion vectors. Note that object motion vectors are not visible in the Scene view.
• **NaN Tracker**: Select this option to display an overlay that highlights [NaN]() values.
• **Quad Overdraw**: Select this option to display an overlay that highlights gpu quads running multiple fragment shaders. This is mainly caused by small or thin triangles. Use LODs to reduce the amount of overdraw when objects are far away. (This mode is currently not supported on Metal and PS4)
• **Vertex Density**: Select this option to display an overlay that highlights pixels running multiple vertex shaders. A vertex can be run multiple times when part of different triangles. This helps finding models that need LODs. (This mode is currently not supported on Metal) | | **MipMaps** | Use the drop-down to select a mipmap streaming property to debug.
• **None**: Select this option to disable this debug feature.
• **MipRatio**: Select this option to display a heat map of pixel to texel ratio. A blue tint represents areas with too little Texture detail (the Texture is too small). A bed tint represents areas with too much Texture detail (the Texture is too large for the screen area). If the debugger shows the original colour for a pixel, this means that the level of detail is just right.
• **MipCount**: Select this option to display mip count as grayscale from black to white as the number of mips increases (for up to 14 mips, or 16K size). Red inidates Textures with more than 14 mips. Magenta indicates Textures with 0 mips or that the Shader does not support mip count.
• **MipCountReduction**: Select this option to display the difference between the current mip count and the original mip count as a green scale. A brighter green represents a larger reduction (that mip streaming saves more Texture memory). Magenta means that the debugger does not know the original mip count.
• **StreamingMipBudget**: Select this option to display the mip status due to streaming budget. Green means that streaming Textures saves some memory. Red means that mip levels are lower than is optimal, due to full Texture memory budget. White means that streaming Textures saves no memory.
• **StreamingMip**: Select this option to display the same information as **StreamingMipBudget**, but to apply the colors to the original Textures. | | **- Terrain Texture** | Use the drop-down to select the terrain Texture to debug the mipmap for. This property only appears when you select an option other than **None** from the **MipMaps** drop-down. | | **Color Picker - Debug Mode** | Use the drop-down to select the format of the color picker display. | diff --git a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-10-0.md b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-10-0.md index 2c8522490ab..0910b5924b4 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-10-0.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-10-0.md @@ -80,8 +80,10 @@ The Render Pipeline Debug window now has a new Volume panel which you can use to #### Quad Overdraw and Vertex Density ![quad_density](Images/quad_density_example.png) -Two full screen rendering debugs modes have been added. Quad Overdraw highlights GPU quads running multiple fragment shaders, which is mainly caused by small or thin triangles while Vertex Density displays pixels running multiple vertex shaders. -This is mainly due to Meshes far away or with too many details so it can help finding GameObjects in you scene that need LODs. (This modes are currently not supported on Metal) +To help you finding GameObjects in you scene that need LODs, HDRP includes two new full screen rendering debug modes to spot Meshes far away or with too many details. + +- Quad Overdraw: highlights GPU quads running multiple fragment shaders, which is mainly caused by small or thin triangles. (Not supported on Metal and PS4) +- Vertex Density: displays pixels running multiple vertex shaders. (Not supported on Metal) ### Alpha to Mask