Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single pass stereo support? #5

Open
Wully616 opened this issue Feb 25, 2022 · 1 comment
Open

Single pass stereo support? #5

Wully616 opened this issue Feb 25, 2022 · 1 comment

Comments

@Wully616
Copy link

I have modified PostProcessPass.RenderFinalPass to add in the FSR calls to the XR Module block

I'm getting an error with the compute shaders
Compute shader (RobustContrastAdaptiveSharpen): Property (_RCASInputTexture) at kernel index (0) has mismatching texture dimension (expected 2, got 5)

Compute shader (EdgeAdaptiveSpatialUpsampling): Property (_EASUInputTexture) at kernel index (0) has mismatching texture dimension (expected 2, got 5)

I suspect its due to using Single pass stereo, is there any way to add support for that?

#if ENABLE_VR && ENABLE_XR_MODULE
            if (cameraData.xr.enabled)
            {
                RenderTargetIdentifier cameraTarget = cameraTargetHandle.Identifier();
               
                //Blit(cmd, m_Source.Identifier(), BuiltinRenderTextureType.CurrentActive, material);
                bool isRenderToBackBufferTarget = cameraTarget == cameraData.xr.renderTarget && !cameraData.xr.renderTargetIsRenderTexture;
                // We y-flip if
                // 1) we are bliting from render texture to back buffer and
                // 2) renderTexture starts UV at top
                bool yflip = isRenderToBackBufferTarget && SystemInfo.graphicsUVStartsAtTop;

                Vector4 scaleBias = yflip ? new Vector4(1, -1, 0, 1) : new Vector4(1, 1, 0, 0);

                var xrTarget = new RenderTargetIdentifier(cameraTarget, 0, CubemapFace.Unknown, -1);

                var oldCameraTarget = xrTarget;
                var enableFSR = cameraData.enableFSR;
                if ( enableFSR )
                {
                    oldCameraTarget = xrTarget;
                    cmd.GetTemporaryRT(ShaderConstants._EASUInputTexture, GetCompatibleDescriptor());
                    xrTarget = ShaderConstants._EASUInputTexture;
                }

                cmd.SetRenderTarget(xrTarget, colorLoadAction, RenderBufferStoreAction.Store, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.DontCare);


                if ( !enableFSR )
                    cmd.SetViewport(cameraData.pixelRect);
                cmd.SetGlobalVector(ShaderPropertyId.scaleBias, scaleBias);
                cmd.DrawProcedural(Matrix4x4.identity, material, 0, MeshTopology.Quads, 4, 1, null);
                if ( enableFSR )
                    DoFSR(cmd, ref cameraData, oldCameraTarget);
            }
            else
#endif
@francisjsun-amd
Copy link

Hi @Wully616
Sure. As your error messages point out, the_EASUInputTexture is not correct. I guess it's because the single pass stereo uses the packed render texture, you can't use it as _EASUInputTexture directly. Fetching the texture with the normal UV will not be right. You can try adding the UnityStereoScreenSpaceUVAdjust where the _EASUInputTexture gets fetched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants