-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
WebGPURenderer: Initial Antialiasing #20281
Conversation
|
||
colorAttachment.attachment = renderTargetProperties.colorBuffer.createView(); | ||
colorAttachment.resolveTarget = renderTargetProperties.colorTextureGPU.createView(); | ||
colorAttachment.storeOp = GPUStoreOp.Store; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be GPUStoreOp.Clear, unless you're planning on reusing the content of the multisampled texture. It helps a TON with memory bandwidth on tiler GPUs. The resolve target pixels will be stored, but multisampled pixels will be forgotten and the texture marked for lazy-clearing internally in Dawn/Chromium.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment. Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takahirox I had to remove the modifications to storeOp
since enabling antialiasing produced a red screen. Would be great if you can revisit this setting. It's now using the default store
again. 8e70942
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share a demo or code snippet which causes the problem? Here I enabled antialias in webgpu sandbox example but couldn't reproduce it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, it does not work on my system (macOS 10.15.6). I've just added the code back and set antialias
to true
in the example. I've updated to the latest Canary version (Version 87.0.4258.0) but without success. The entire screen becomes red.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm it could be platform or hardware specific issue? Working fine on my Windows10 + Canary(87.0.4257.0) + intel(R) HD graphics 530.
Anyways, using default for now is ok to me because it still works on my system, too. Let's revisit later if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll try to check the demo tomorrow on a Windows 10 notebook.
WebGPU canvas textures will always have a sample count of 1 because it makes the expensive MSAA resolve step explicit compared to WebGL where you could accidentally trigger resolves in some cases. |
b7fd874
to
1018bde
Compare
1018bde
to
60120ce
Compare
Thanks! |
This PR adds initial antialiasing support to
WebGPURenderer
.API
WebGPURenderer
constructor takesantialias
parameter. Default isfalse
.const new renderer = WebGPURenderer( { antialias: true } );
Screenshot
Left with antialiasing and right without antialiasing.
Changes
In
WebGL
,HTMLCanvasElement.getContext()
takesantialias
parameter and if it'strue
hardware antialiasing is enabled.In
WebGPU
,HTMLCanvasElement.getContext()
doesn't takeantialias
and we seem to need to manually setup MSAA (at least now).