Bug 192817

Summary: [WebGPU] BindGroupLayout and Device::createBindGroupLayout
Product: WebKit Reporter: Justin Fan <justin_fan>
Component: New BugsAssignee: Justin Fan <justin_fan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dino, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Description Justin Fan 2018-12-18 11:32:12 PST
[WebGPU] BindGroupLayout and Device::createBindGroupLayout
Comment 1 Justin Fan 2018-12-18 11:34:56 PST
<rdar://problem/46816659>
Comment 2 Justin Fan 2018-12-18 12:24:48 PST
Created attachment 357597 [details]
Patch
Comment 3 Dean Jackson 2018-12-18 12:47:50 PST
Comment on attachment 357597 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=357597&action=review

> Source/WebCore/Modules/webgpu/WebGPUBindGroupLayout.cpp:41
> +    UNUSED_PARAM(layout);

Remove this. You use the parameter.

> Source/WebCore/Modules/webgpu/WebGPUDevice.cpp:71
> +    return layout ? static_cast<RefPtr<WebGPUBindGroupLayout>>(WebGPUBindGroupLayout::create(layout.releaseNonNull())) : nullptr;

Why do you have to cast? I think the compiler will handle this.

> Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.cpp:35
> +    return adoptRef(new GPUBindGroupLayout(WTFMove(descriptor)));

So for now it will never fail to return a layout? But it will in the future, hence the try name?
Comment 4 Justin Fan 2018-12-18 13:07:29 PST
(In reply to Dean Jackson from comment #3)
> Comment on attachment 357597 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=357597&action=review
> 
> > Source/WebCore/Modules/webgpu/WebGPUDevice.cpp:71
> > +    return layout ? static_cast<RefPtr<WebGPUBindGroupLayout>>(WebGPUBindGroupLayout::create(layout.releaseNonNull())) : nullptr;
> 
> Why do you have to cast? I think the compiler will handle this.
> 
> > Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.cpp:35
> > +    return adoptRef(new GPUBindGroupLayout(WTFMove(descriptor)));
> 
> So for now it will never fail to return a layout? But it will in the future,
> hence the try name?

Since there's no way to fail to create a layout right now, I've refactored the ::create s to return a Ref, obviating the need for a conditional null check.
Comment 5 Justin Fan 2018-12-18 13:14:14 PST
Created attachment 357600 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2018-12-18 13:52:05 PST
Comment on attachment 357600 [details]
Patch for landing

Clearing flags on attachment: 357600

Committed r239351: <https://trac.webkit.org/changeset/239351>
Comment 7 WebKit Commit Bot 2018-12-18 13:52:07 PST
All reviewed patches have been landed.  Closing bug.