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 meshlet interactions with regular shading passes #13816

Merged
merged 4 commits into from
Jun 21, 2024

Conversation

JMS55
Copy link
Contributor

@JMS55 JMS55 commented Jun 11, 2024

Tested a combined scene with both regular meshes and meshlet meshes with:

  • Regular forward setup
  • Forward + normal/motion vector prepasses
  • Deferred (with depth prepass since that's required)
  • Deferred + depth/normal/motion vector prepasses

Still broken:

  • Using meshlet meshes rendering in deferred and regular meshes rendering in forward + depth/normal prepass. I don't know how to fix this at the moment, so for now I've just add instructions to not mix them.

@JMS55 JMS55 added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Jun 11, 2024
@JMS55 JMS55 added this to the 0.14 milestone Jun 11, 2024
@alice-i-cecile alice-i-cecile added the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Jun 11, 2024
@JMS55 JMS55 marked this pull request as ready for review June 12, 2024 00:04
@JMS55 JMS55 removed the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Jun 12, 2024
@JMS55 JMS55 marked this pull request as draft June 12, 2024 00:11
@JMS55 JMS55 added the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Jun 12, 2024
@JMS55 JMS55 changed the title Fix interactions with regular shading passes Fix meshlet interactions with regular shading passes Jun 12, 2024
@JMS55 JMS55 marked this pull request as ready for review June 13, 2024 03:27
@JMS55 JMS55 removed the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Jun 13, 2024
@JMS55 JMS55 requested a review from IceSentry June 13, 2024 03:27
@@ -162,7 +162,7 @@ impl ViewNode for PrepassNode {
pass_span.end(&mut render_pass);
drop(render_pass);

// Copy prepass depth to the main depth texture if deferred isn't going to
// After rendering to the view depth texture, copy it to the prepass depth texture if deferred isn't going to
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment makes sense for what the code does, but I'm not sure I understand when that would ever happen. If you use deferred + prepass, then you're using deferred so it will do the copy. If you just use the prepass without deferred, it should run before the main pass so I don't get why we would want to copy the view depth to the prepass depth. Shouldn't it be the other way around?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, is it because the meshlet prepass writes directly to the view depth?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think meshlets should be mentioned in that comment if that's the case.

Copy link
Contributor Author

@JMS55 JMS55 Jun 14, 2024

Choose a reason for hiding this comment

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

This is existing code, for the regular (non meshlet) prepass. We don't actually render directly to the prepass texture, we render to the view depth, and then copy the result into the prepass depth texture.

I was just updating the comment as it was inaccurate before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, right, I remember now.

@IceSentry IceSentry added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Jun 14, 2024
@@ -122,17 +122,17 @@ impl ViewNode for DeferredGBufferPrepassNode {
let view_entity = graph.view_entity();
render_context.add_command_buffer_generation_task(move |render_device| {
#[cfg(feature = "trace")]
let _deferred_span = info_span!("deferred").entered();
let _deferred_span = info_span!("deferred_prepass").entered();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the rename to add _prepass everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was a bit confusing seeing "deferred" in the profiler. This made it a bit clearer, and matched the node name.

@JMS55 JMS55 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 18, 2024
Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

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

not sure about the meshlet changes, but they are scoped to meshlet and shouldn't break anything outside

@mockersf mockersf added this pull request to the merge queue Jun 21, 2024
Merged via the queue into bevyengine:main with commit 158ccc6 Jun 21, 2024
29 checks passed
mockersf pushed a commit that referenced this pull request Jun 21, 2024
* Fixes #13813
* Fixes #13810

Tested a combined scene with both regular meshes and meshlet meshes
with:
* Regular forward setup
* Forward + normal/motion vector prepasses
* Deferred (with depth prepass since that's required) 
* Deferred + depth/normal/motion vector prepasses

Still broken:
* Using meshlet meshes rendering in deferred and regular meshes
rendering in forward + depth/normal prepass. I don't know how to fix
this at the moment, so for now I've just add instructions to not mix
them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MeshletMesh not writing to the depth prepass MeshletMesh incorrect depth buffer handling
5 participants