Bug 237871

Summary: [WebGPU] Implement first draft of buffer copying according to the spec
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: WebGPUAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, djg, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 237870    
Bug Blocks: 237583, 237875, 237877    
Attachments:
Description Flags
Patch
none
Patch kkinnunen: review+

Description Myles C. Maxfield 2022-03-14 20:39:21 PDT
.
Comment 1 Myles C. Maxfield 2022-03-14 20:44:09 PDT
Created attachment 454658 [details]
Patch
Comment 2 Myles C. Maxfield 2022-03-14 21:39:06 PDT
Comment on attachment 454658 [details]
Patch

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

> Source/WebGPU/WebGPU/CommandEncoder.mm:144
> +    if (validateCopyBufferToBuffer(source, sourceOffset, destination, destinationOffset, size)) {

if (!validateCopyBufferToBuffer(source, sourceOffset, destination, destinationOffset, size))
Comment 3 Myles C. Maxfield 2022-03-14 22:05:22 PDT
Created attachment 454664 [details]
Patch
Comment 4 Kimmo Kinnunen 2022-03-16 06:59:15 PDT
Comment on attachment 454664 [details]
Patch

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

> Source/WebGPU/WebGPU/CommandEncoder.mm:52
> +    commandBuffer.label = [NSString stringWithCString:descriptor.label encoding:NSUTF8StringEncoding];

nullptr label remark (in case it's not handled in the fromAPI patch)

> Source/WebGPU/WebGPU/CommandsMixin.h:32
> +class CommandsMixin : public RefCounted<CommandsMixin> {

Based on this commit alone, it's not clear why would the refcounted be in the mixin. it would indicate objects hold references to the mixin, which is counter (my) expectation of mixins being just "way to import a bag of common functionality"

Also having the WTF_MAKE_FAST_ALLOCATED here would imply you allocate the mixins
Comment 5 Kimmo Kinnunen 2022-03-16 07:08:01 PDT
Comment on attachment 454664 [details]
Patch

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

>> Source/WebGPU/WebGPU/CommandEncoder.mm:52
>> +    commandBuffer.label = [NSString stringWithCString:descriptor.label encoding:NSUTF8StringEncoding];
> 
> nullptr label remark (in case it's not handled in the fromAPI patch)

Checked, I think the fromAPI patch was not written with this patch in, so there's that.
so probably you could have some sort of fromAPI<NSString*>(descriptor.label) for these cases (or something else you come up with)
Comment 6 Myles C. Maxfield 2022-03-16 15:08:32 PDT
Comment on attachment 454664 [details]
Patch

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

>>> Source/WebGPU/WebGPU/CommandEncoder.mm:52
>>> +    commandBuffer.label = [NSString stringWithCString:descriptor.label encoding:NSUTF8StringEncoding];
>> 
>> nullptr label remark (in case it's not handled in the fromAPI patch)
> 
> Checked, I think the fromAPI patch was not written with this patch in, so there's that.
> so probably you could have some sort of fromAPI<NSString*>(descriptor.label) for these cases (or something else you come up with)

Right. I'll have to update the fromAPI patch after this lands.

>> Source/WebGPU/WebGPU/CommandsMixin.h:32
>> +class CommandsMixin : public RefCounted<CommandsMixin> {
> 
> Based on this commit alone, it's not clear why would the refcounted be in the mixin. it would indicate objects hold references to the mixin, which is counter (my) expectation of mixins being just "way to import a bag of common functionality"
> 
> Also having the WTF_MAKE_FAST_ALLOCATED here would imply you allocate the mixins

Ah, I see what you're saying. Yeah, I guess multiple inheritance is better than making a mixin class that appears to be refcounted.
Comment 7 Myles C. Maxfield 2022-03-16 15:13:51 PDT
Committed r291372 (248504@trunk): <https://commits.webkit.org/248504@trunk>
Comment 8 Radar WebKit Bug Importer 2022-03-16 15:14:16 PDT
<rdar://problem/90394764>