diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index f8283a25bdd..fc147642c14 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -649,6 +649,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix an issue with the half resolution Mode (performance) - Fix an issue with the color intensity of emissive for performance rtgi - Fixed issue with rendering being mostly broken when target platform disables VR. +- Fixed ray tracing with XR single-pass. ### Changed - Improve MIP selection for decals on Transparents diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index a4f08a4cc44..0381a867ac5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -4429,9 +4429,7 @@ void RenderSSRTransparent(HDCamera hdCamera, CommandBuffer cmd, ScriptableRender bool usesRaytracedReflections = hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) && settings.rayTracing.value; if (usesRaytracedReflections) { - hdCamera.xr.StartSinglePass(cmd); RenderRayTracedReflections(hdCamera, cmd, m_SsrLightingTexture, renderContext, m_FrameCount, true); - hdCamera.xr.StopSinglePass(cmd); } else { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index 2e39e0d1f8a..e6bf26aee7a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -226,6 +226,12 @@ void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputText if (!pathTracingShader || !m_PathTracingSettings.enable.value) return; + if (hdCamera.viewCount > 1) + { + Debug.LogError("Path Tracing is not supported when using XR single-pass rendering."); + return; + } + CheckDirtiness(hdCamera); // Inject the ray-tracing sampling data diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs index e550ec2577f..0aa54df11d4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs @@ -138,7 +138,6 @@ DeferredLightingRTParameters PrepareIndirectDiffuseDeferredLightingRTParameters( if (deferredParameters.viewCount > 1 && deferredParameters.rayBinning) { deferredParameters.rayBinning = false; - Debug.LogWarning("Ray binning is not supported with XR single-pass rendering!"); } deferredParameters.globalCB = m_ShaderVariablesRayTracingCB; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs index b285371c2e8..f8dd305551a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs @@ -156,7 +156,6 @@ DeferredLightingRTParameters PrepareReflectionDeferredLightingRTParameters(HDCam if (deferredParameters.viewCount > 1 && deferredParameters.rayBinning) { deferredParameters.rayBinning = false; - Debug.LogWarning("Ray binning is not supported with XR single-pass rendering!"); } deferredParameters.globalCB = m_ShaderVariablesRayTracingCB; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRayTracingSubSurface.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRayTracingSubSurface.hlsl index bfa4280104a..e2a87b493fe 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRayTracingSubSurface.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRayTracingSubSurface.hlsl @@ -4,6 +4,8 @@ [shader("closesthit")] void ClosestSubSurface(inout RayIntersectionSubSurface rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) { + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // Always set the new t value rayIntersection.t = RayTCurrent(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingForward.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingForward.hlsl index fa3a2198791..b3a8542713a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingForward.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingForward.hlsl @@ -5,6 +5,8 @@ [shader("closesthit")] void ClosestHitForward(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) { + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // The first thing that we should do is grab the intersection vertice IntersectionVertex currentVertex; GetCurrentIntersectionVertex(attributeData, currentVertex); @@ -212,6 +214,8 @@ void ClosestHitForward(inout RayIntersection rayIntersection : SV_RayPayload, At [shader("anyhit")] void AnyHitMain(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) { + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // The first thing that we should do is grab the intersection vertice IntersectionVertex currentVertex; GetCurrentIntersectionVertex(attributeData, currentVertex); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingGBuffer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingGBuffer.hlsl index 962b866422b..8edbf5da3cc 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingGBuffer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingGBuffer.hlsl @@ -4,6 +4,8 @@ [shader("closesthit")] void ClosestHitGBuffer(inout RayIntersectionGBuffer rayIntersectionGbuffer : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) { + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // The first thing that we should do is grab the intersection vertice IntersectionVertex currentVertex; GetCurrentIntersectionVertex(attributeData, currentVertex); @@ -53,6 +55,9 @@ void AnyHitGBuffer(inout RayIntersectionGBuffer rayIntersectionGbuffer : SV_RayP #ifdef _SURFACE_TYPE_TRANSPARENT IgnoreHit(); #else + + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // The first thing that we should do is grab the intersection vertice IntersectionVertex currentVertex; GetCurrentIntersectionVertex(attributeData, currentVertex); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl index 0f215a1cdec..8949e17b721 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl @@ -6,6 +6,8 @@ [shader("closesthit")] void ClosestHitMain(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) { + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // The first thing that we should do is grab the intersection vertice IntersectionVertex currentVertex; GetCurrentIntersectionVertex(attributeData, currentVertex); @@ -141,6 +143,9 @@ void AnyHitMain(inout RayIntersection rayIntersection : SV_RayPayload, Attribute #ifdef _SURFACE_TYPE_TRANSPARENT IgnoreHit(); #else + + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // The first thing that we should do is grab the intersection vertice IntersectionVertex currentVertex; GetCurrentIntersectionVertex(attributeData, currentVertex); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingVisibility.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingVisibility.hlsl index 648edea6da2..afd9a25bf55 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingVisibility.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingVisibility.hlsl @@ -5,6 +5,8 @@ [shader("closesthit")] void ClosestHitVisibility(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) { + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // The first thing that we should do is grab the intersection vertice IntersectionVertex currentVertex; GetCurrentIntersectionVertex(attributeData, currentVertex); @@ -26,6 +28,8 @@ void ClosestHitVisibility(inout RayIntersection rayIntersection : SV_RayPayload, [shader("anyhit")] void AnyHitVisibility(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) { + UNITY_XR_ASSIGN_VIEW_INDEX(DispatchRaysIndex().z); + // The first thing that we should do is grab the intersection vertice IntersectionVertex currentVertex; GetCurrentIntersectionVertex(attributeData, currentVertex);