Skip to content

Conversation

manuele-bonanno
Copy link
Contributor

…y for the post processing pass

Please read the Contributing guide before making a PR.

Checklist for PR maker

  • Have you added a backport label (if needed)? For example, the need-backport-* label. After you backport the PR, the label changes to backported-*.
  • Have you updated the changelog? Each package has a CHANGELOG.md file.
  • Have you updated or added the documentation for your PR? When you add a new feature, change a property name, or change the behavior of a feature, it's best practice to include related documentation changes in the same PR. If you do add documentation, make sure to add the relevant Graphics Docs team member as a reviewer of the PR. If you are not sure which person to add, see the Docs team contacts sheet.
  • Have you added a graphic test for your PR (if needed)? When you add a new feature, or discover a bug that tests don't cover, please add a graphic test.

Purpose of this PR

Why is this PR needed, what hard problem is it solving/fixing?


Testing status

Describe what manual/automated tests were performed for this PR


Comments to reviewers

Notes for the reviewers you have assigned.

@github-actions
Copy link

Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed.
Link to Yamato: https://unity-ci.cds.internal.unity3d.com/project/902/
Search for your PR branch using the search bar at the top, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

URP
/jobDefinition/.yamato%252Fall-urp.yml%2523PR_URP_trunk
With changes to URP packages, you should also run
/jobDefinition/.yamato%2Fall-lightmapping.yml%23PR_Lightmapping_trunk

Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure.

Copy link
Contributor

@phi-lira phi-lira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing changelogs, otherwise minor comments that should not block PR.

Comment on lines +275 to +283
// m_Depth is the main geometry pass' depth buffer. If condition is true, we bind this depth buffer to _CameraDepthTexture shader binding resource
if (m_UseDepthTextureFromMainPass)
cmd.SetGlobalTexture("_CameraDepthTexture", m_Depth.Identifier());

Render(cmd, ref renderingData);

// Restore the _CameraDepthTexture binding to its original bound resource
if (m_UseDepthTextureFromMainPass)
cmd.SetGlobalTexture("_CameraDepthTexture", m_CameraDepthTexture.Identifier());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to improve depth binding in URP so we would unify the depth buffer and the shader resource with a single ID, similar to how we handle color? I feel otherwise this is quite confusing for user that would like to do the same thing. I guess this is because the depth resolve issues and the fact that we don't have secondary id?

&& createDepthTexture;
// Post process passes that require depth texture (Motion Blur / DoF) as shader read resource will need to access depth information from main geometry pass if there is no depth copy
// and depth pre-pass enqueued
bool postProcessingUseDepthTextureMainPass = !requiresDepthCopyPass && !requiresDepthPrepass && cameraHasPostProcessingWithDepth;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool postProcessingUseDepthTextureMainPass = !requiresDepthCopyPass && !requiresDepthPrepass && cameraHasPostProcessingWithDepth;
bool postProcessingUseDepthTextureMainPass = !requiresDepthCopyPass && cameraHasPostProcessingWithDepth;

requiresDepthPrepass is reduntant logic here. If you expand requiresDepthCopyPass the expression you get:

bool postProcessingUseDepthTExtureMainPass = (!requiresDepthPrepass && requiresDepthTexture && createDepthTexture) && !requiresDepthPrepass && cameraHasPostProcessingWithDepth;

// we could StoreAndResolve when the depth copy is after opaque, but performance wise doing StoreAndResolve of depth targets is more expensive than a simple Store + following depth copy pass on Apple GPUs,
// because of the extra resolve step. So, unless we are copying the depth after the transparent pass, just Store the depth target.
if (isCopyDepthAfterTransparent && !copyColorPass)
if ((isCopyDepthAfterTransparent || postProcessingUseDepthTextureMainPass) && !copyColorPass)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking: you have in multiple places isCopyDEpthAfterTransparent || postProcessingUseDepthTextureMainPass maybe you could give have a variable with some meaning for this to improve readability. The logic of store actions is a little bit convoluted, but I guess the plan is to improve it with RenderGraph anyway, so no big deal.

@manuele-bonanno
Copy link
Contributor Author

this is WIP and not currentlly being worked on. Closing the PR temporarily to avoid confusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants