Skip to content

Commit

Permalink
[WebGPU] Implement GPUSampleMask support
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=251444
radar://103304584

Reviewed by Tadeu Zagallo.

webgpu:api,operation,render_pipeline,sample_mask:* is all
green locally in MiniBrowser after this change but there
is some timeout running it through WKTR so I did not update
the expectations.

* Source/WebGPU/WebGPU/RenderPipeline.mm:
(WebGPU::Device::createRenderPipeline):

Canonical link: https://commits.webkit.org/270535@main
  • Loading branch information
mwyrzykowski committed Nov 10, 2023
1 parent fdcc9a4 commit 6dc196f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/WebGPU/WebGPU/RenderPipeline.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
#import "Device.h"
#import "Pipeline.h"

// FIXME: remove after radar://104903411 or after we place the mask into the last buffer
@interface NSObject ()
- (void)setSampleMask:(NSUInteger)mask;
@end

namespace WebGPU {

static MTLBlendOperation blendOperation(WGPUBlendOperation operation)
Expand Down Expand Up @@ -647,6 +652,9 @@ static WGPUTextureViewDimension convertViewDimension(WGSL::TextureViewDimension

mtlRenderPipelineDescriptor.rasterSampleCount = descriptor.multisample.count ?: 1;
mtlRenderPipelineDescriptor.alphaToCoverageEnabled = descriptor.multisample.alphaToCoverageEnabled;
RELEASE_ASSERT([mtlRenderPipelineDescriptor respondsToSelector:@selector(setSampleMask:)]);
if (auto mask = descriptor.multisample.mask; mask != 0xFFFFFFFF)
[mtlRenderPipelineDescriptor setSampleMask:mask];

if (descriptor.vertex.bufferCount)
mtlRenderPipelineDescriptor.vertexDescriptor = createVertexDescriptor(descriptor.vertex);
Expand Down

0 comments on commit 6dc196f

Please sign in to comment.