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

Fix VT Feedback buffer #4868

Merged
merged 8 commits into from
Jul 8, 2021

Conversation

zeroyao
Copy link
Contributor

@zeroyao zeroyao commented Jun 9, 2021

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. No documentation change is necessary.
  • [ ] 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. Adding a graphics test for checking the VT feedback buffer might be possible, but is difficult to do. For the scope of this PR it doesn't feel necessary.

Purpose of this PR

Fix VT feedback buffer values by correctly initialize BuiltinData.vtPackedFeedback to (1,1,1,1) for cases either InitBuiltinData function is called or ZERO_INITIALIZE. Fix for ShaderGraph too.

Previously the value is zero initialized which actually is a valid tile ID ({0,0,0} for tileset 0). Correcting it is important for the underlying VT code to correctly prioritize tile requests coming from manually managed procedural VT stacks.


Testing status

Manually tested with SG shaders and HDRP Lit shader, in HDRP Test project plus the Environment test project.

…ses where InitBuiltinData function is called or ZERO_INITIALIZE. Fix for ShaderGraph too.
@github-actions
Copy link

github-actions bot commented Jun 9, 2021

It appears that you made a non-draft PR!
Please convert your PR to draft (button on the right side of the page)
and cancel any jobs that started on Yamato.
See the PR template for more information.
Thank you!

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to the Unity SRP repo!
Please make sure to fill out the PR template as best you can to give reviewers as much information as possible.
If you have any questions (and you are a Unity employee) go to "#devs-renderpipe"

@zeroyao
Copy link
Contributor Author

zeroyao commented Jun 9, 2021

@sebastienlagarde Hello! What is the current process for backporting PRs? Will your team pick it up or should I do it myself? I need to backport all the way to 8.0.0 as this version is used by 2020.3 editor. I don't see a backport label for 8.0 though?

Copy link
Contributor

@debaetsd debaetsd left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@GraphineCharles GraphineCharles left a comment

Choose a reason for hiding this comment

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

Good for the VT change of 0,0,0,0 to 1,1,1,1. Difficult for me to judge if the changes will catch all situations where the struct is initialized by hdrp.

@zeroyao
Copy link
Contributor Author

zeroyao commented Jun 16, 2021

Good for the VT change of 0,0,0,0 to 1,1,1,1. Difficult for me to judge if the changes will catch all situations where the struct is initialized by hdrp.

Yup that was the majority of the effort to find out all the places. It's really hard to centralize as there are different situations this struct is used. And I guess not really future proof. Having a graphics tests that checks out what's being written to the VT feedback buffer sounds unviable either as you'll basically need to have all shaders now and future in the test. Just adding the initialization code probably is the best we can do now. Hopefully there is little chance in the future that a new handwritten shader will be added to HDRP, so that for the majority of the situations SG coverage is good enough.

Copy link
Contributor

@cdxntchou cdxntchou left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@jonaskhalil jonaskhalil left a comment

Choose a reason for hiding this comment

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

Nothing to add, looks okay for as far as I can tell ...

…ack-initialization

# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md
#	com.unity.shadergraph/CHANGELOG.md
…ata struct plus correct vt feedback initializing. Guard the code under UNITY_VIRTUAL_TEXTURING define.
@github-actions
Copy link

github-actions bot commented Jul 7, 2021

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://yamato.cds.internal.unity3d.com/jobs/902-Graphics
Search for your PR branch using the sidebar on the left, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

HDRP
/.yamato%252Fall-hdrp.yml%2523PR_HDRP_2021.2

Shader Graph
/.yamato%252Fall-shadergraph.yml%2523PR_ShaderGraph_2021.2

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.

@sebastienlagarde sebastienlagarde merged commit 2df5f0e into master Jul 8, 2021
@sebastienlagarde sebastienlagarde deleted the fix-vt-packed-feedback-initialization branch July 8, 2021 21:51
sebastienlagarde pushed a commit that referenced this pull request Aug 5, 2021
sebastienlagarde added a commit that referenced this pull request Aug 6, 2021
* Improved a bit the area cookie behavior for higher smoothness values to reduce artifacts. #3578

* [SRP] Add Conditional field for shader code generation in Generate include command #4889

* Fix VT Feedback buffer #4868

* [HDRP][Path Tracing] Backport of sky+recorder fix #5001

* [HDRP] Fix distortion when resizing the graphics compositor window in builds #5062

* Add compatibility with Unity 2020.3 for compositor resize callback

* Small cleanup

Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com>
Co-authored-by: Yao Xiaoling <yao@unity3d.com>
Co-authored-by: Emmanuel Turquin <emmanuel@turquin.org>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
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.

6 participants