-
Notifications
You must be signed in to change notification settings - Fork 209
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
webgl: Support colorMask in RenderPass #2046
Conversation
@@ -180,6 +180,9 @@ export type RenderPassParameters = { | |||
blendConstant?: number[]; // GPUColor | |||
/** Stencil operation "replace" sets the value to stencilReference */ | |||
stencilReference?: number; // GPUStencilValue | |||
|
|||
/** Sets mask for channels (RGBA) to render/clear **/ | |||
colorMask?: boolean[]; |
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.
Nit: if we require exactly four channel masks, lets make that explicit —
colorMask?: boolean[]; | |
colorMask?: [boolean, boolean, boolean, boolean]; |
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.
Discussing with @Pessimistress we need to think of a way to make this WebGPU compatible. It may make more sense to pass writeMask instead
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, there's also the RenderPipeline parameter, colorMask
, which is a bit mask:
luma.gl/modules/core/src/adapter/types/parameters.ts
Lines 159 to 160 in f59d1d4
/** Bitmask controlling which channels are are written to when drawing to this color target. defaulting to 0xF */ | |
colorMask?: number; |
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.
Oh, I missed that! I still think it's worth moving to RenderPassParameters
Defer to @ibgreen - is the WebGPU name |
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.
FWIW
I believe clear colors in WebGPU are set per target (attachment) not as part of the props.
For now, I don't think I exposed that full API.
Why can't we set it before we call gl.clear?
We are trying to avoid using |
OK, so it seems this change is OK, but we should change it to be a bitmask to align with the WebGPU API before merging |
For visgl/deck.gl#8636
When a WebGLRenderPass is created it immediately does a clear(). deck.gl was previously setting a
colorMask
usingwithParametersWebGL
, but now with this removed there is no way to set thecolorMask
before the clear operation. Doing it inPass.getLayerParameters()
is too late, as by then theclear
operation has happenedBackground
Change List