diff --git a/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl b/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl index 6bafb0566b2..6fef620a56a 100644 --- a/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl +++ b/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl @@ -17,6 +17,7 @@ #define PLATFORM_SUPPORTS_EXPLICIT_BINDING #define PLATFORM_NEEDS_UNORM_UAV_SPECIFIER #define PLATFORM_SUPPORTS_BUFFER_ATOMICS_IN_PIXEL_SHADER +#define PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER // flow control attributes diff --git a/com.unity.render-pipelines.core/ShaderLibrary/API/Vulkan.hlsl b/com.unity.render-pipelines.core/ShaderLibrary/API/Vulkan.hlsl index e536ac06ab8..da2442be658 100644 --- a/com.unity.render-pipelines.core/ShaderLibrary/API/Vulkan.hlsl +++ b/com.unity.render-pipelines.core/ShaderLibrary/API/Vulkan.hlsl @@ -18,6 +18,7 @@ #define PLATFORM_SUPPORTS_EXPLICIT_BINDING #define PLATFORM_NEEDS_UNORM_UAV_SPECIFIER #define PLATFORM_SUPPORTS_BUFFER_ATOMICS_IN_PIXEL_SHADER +#define PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER // flow control attributes #define UNITY_BRANCH [branch] diff --git a/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl b/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl index 2afab39d984..c1c6827ac77 100644 --- a/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl +++ b/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl @@ -184,6 +184,10 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Macros.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Random.hlsl" +#ifdef SHADER_API_XBOXONE // TODO: to move in .nda package in 21.1 +#define PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER +#endif + // ---------------------------------------------------------------------------- // Common intrinsic (general implementation of intrinsic available on some platform) // ---------------------------------------------------------------------------- diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 626460da63c..c12f69e7b35 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -145,6 +145,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix issue with alpha output in forward. - Fix compilation issue on Vulkan for shaders using high quality shadows in XR mode. - Fixed wrong error message when fixing DXR resources from Wizard. +- Fixed compilation error of quad overdraw with double sided materials ### Changed - Preparation pass for RTSSShadows to be supported by render graph. 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 cad35f32e4b..4b6984f1a15 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 @@ -31,11 +31,11 @@ PackedVaryingsToPS VertTesselation(VaryingsToDS input) #if !defined(_DEPTHOFFSET_ON) [earlydepthstencil] // quad overshading debug mode writes to UAV #endif -void Frag(PackedVaryingsToPS packedInput -#if !defined(SHADER_API_METAL) && !defined(SHADER_API_PSSL) // Metal and pssl does not support SV_PrimitiveID - , uint primitiveID : SV_PrimitiveID +void Frag( +#ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + uint primitiveID : SV_PrimitiveID, // Must be declare before FRONT_FACE_SEMANTIC #endif - ) + PackedVaryingsToPS packedInput) { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh); @@ -44,7 +44,7 @@ void Frag(PackedVaryingsToPS packedInput if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) { -#if !defined(SHADER_API_METAL) && !defined(SHADER_API_PSSL) // Metal and pssl does not support SV_PrimitiveID +#ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER IncrementQuadOverdrawCounter(posInput.positionSS.xy, primitiveID); #endif }