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

WebGPU MSAA render target with depth buffer fails #5714

Closed
slimbuck opened this issue Oct 4, 2023 · 1 comment · Fixed by #6945
Closed

WebGPU MSAA render target with depth buffer fails #5714

slimbuck opened this issue Oct 4, 2023 · 1 comment · Fixed by #6945
Assignees
Labels
area: graphics Graphics related issue bug

Comments

@slimbuck
Copy link
Member

slimbuck commented Oct 4, 2023

It is not possible to create a multisampled render target and specify a target depth texture roughly like so:

const colorBuffer = createTexture(widthPixels, heightPixels, PIXELFORMAT_RGBA8);
const depthBuffer = createTexture(widthPixels, heightPixels, PIXELFORMAT_DEPTH);
const renderTarget = new RenderTarget({
    name: 'rt',
    colorBuffer: colorBuffer,
    depthBuffer: depthBuffer,
    flipY: false,
    samples: device.maxSamples,
    autoResolve: false
});

The resulting error is:
Screenshot 2023-10-04 at 17 30 00

@slimbuck slimbuck added bug area: graphics Graphics related issue labels Oct 4, 2023
@mvaligursky
Copy link
Contributor

mvaligursky commented Oct 6, 2023

Yep, this is not supported at the moment. What needs to happen for this to work:

  • in WebgpuRenderTarget, when samples > 1 and a depthBuffer is passed in, we need to allocate multi-sampled depth buffer for rendering. We cannot specify the provided single-sampled buffer as a resolve target, as WebGPU cannot automatically resolve depth. Done in WebGPU partial support for multisampled RT using supplied depth texture #6917
  • then in the endPass for WebGPU, just before passEncoder.end (so using existing pass encoder) use WebgpuResolver to manually resolve the depth, which it already handles.
  • we possibly might need to update framegraph for the render pass in question to store the multisampled depth, as by default I think it just gets discarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants