Bug 192817 - [WebGPU] BindGroupLayout and Device::createBindGroupLayout
Summary: [WebGPU] BindGroupLayout and Device::createBindGroupLayout
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Justin Fan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-12-18 11:32 PST by Justin Fan
Modified: 2018-12-18 13:52 PST (History)
3 users (show)

See Also:


Attachments
Patch (29.34 KB, patch)
2018-12-18 12:24 PST, Justin Fan
no flags Details | Formatted Diff | Diff
Patch for landing (29.21 KB, patch)
2018-12-18 13:14 PST, Justin Fan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.