Skip to content

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Apr 20, 2024

Related issue: #28132

Description

This PR fixes a bug in the transmission implementation. ignoreDepthValues was a stored in the render target properties so far. When a render target gets resized though, the properties are deleted because dispose() is internally called so the flag is lost. This actually happens in renderTransmissionPass() when the transmission render target gets resized.

Since ignoreDepthValues is also used in the WebXR space, it seems reasonable to add it as resolveDepthBuffer to the RenderTarget class.

/cc @mrxz

@Mugen87 Mugen87 added this to the r164 milestone Apr 20, 2024
@github-actions
Copy link

github-actions bot commented Apr 20, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
674.4 kB (167.2 kB) 674.4 kB (167.1 kB) -31 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
453.8 kB (109.6 kB) 453.8 kB (109.5 kB) -32 B

minFilter: LinearFilter,
depthBuffer: true,
stencilBuffer: false,
ignoreDepthValues: false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this an undocumented property that users do not set? Perhaps it should it be "private" in some form.

ignoreDepthValues: false

Also, I am not in fan of double-negatives. Maybe _resolveDepthBuffer, or something similar.

Copy link
Collaborator Author

@Mugen87 Mugen87 Apr 20, 2024

Choose a reason for hiding this comment

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

I'm going to add a documentation. Similar to resolveStencilBuffer this property is for advanced use cases.

I've picked ignoreDepthValues as a name so it matches the same property of the WebXR spec.

https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/ignoreDepthValues

The property does not just control the MSAA resolve. The ignore also means the respective depth buffers are invalidated (if the browser supports framebuffer invalidation).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We also need to evaluate this property in WebGPURenderer at some point. Not having a property in RenderTarget means redundant code snippets like the following will be spread in both renderers multiple times.

const renderTargetProperties = properties.get( renderTarget );
const ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : false;

Copy link
Collaborator Author

@Mugen87 Mugen87 Apr 20, 2024

Choose a reason for hiding this comment

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

Besides, the property does not just control the MSAA resolve. The ignore also means the respective depth buffers are invalidated (if the browser supports framebuffer invalidation).

On the other hand, the framebuffer invalidation is some sort of clean up that only happens in the MSAA codepath now. Um, I'll add a commit with resolveDepthBuffer for comparison.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@WestLangley Looking better now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Mugen87 I like that better, thanks.

Let's leave this review section open for now, so others can see your explanations. 👍

@Mugen87 Mugen87 changed the title RenderTarget: Add ignoreDepthValues. RenderTarget: Add resolveDepthBuffer. Apr 20, 2024
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

Successfully merging this pull request may close these issues.

3 participants