Bug 238250

Summary: [WebGPU] Clean up implementation of Device::createSampler()
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, dino, djg, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Myles C. Maxfield
Reported 2022-03-23 03:46:16 PDT
[WebGPU] Clean up implementation of Device::createSampler()
Attachments
Patch (9.17 KB, patch)
2022-03-23 03:46 PDT, Myles C. Maxfield
darin: review+
Myles C. Maxfield
Comment 1 2022-03-23 03:46:52 PDT
Darin Adler
Comment 2 2022-03-23 09:04:40 PDT
Comment on attachment 455483 [details] Patch Love these conversion helper functions. Names can be really short since they do such a straightforward mapping. Not so thrilled by all the use of default here. Typically we like to use enums and switches without default cases so we can get warnings when new values are introduced.
Myles C. Maxfield
Comment 3 2022-03-23 11:48:12 PDT
(In reply to Darin Adler from comment #2) > Comment on attachment 455483 [details] > Patch > > Love these conversion helper functions. Names can be really short since they > do such a straightforward mapping. Not so thrilled by all the use of default > here. Typically we like to use enums and switches without default cases so > we can get warnings when new values are introduced. Right. The reason I made the defaults originally is because the enum values have values like `WGPUFilterMode_Force32 = 0x7FFFFFFF` (because they come from a C header which doesn't have enum classes). I think you're right, though, that it's better to list these Force32 values explicitly, because doing so would automatically indicate many of the places which would need to be updated when adding new enum values in the future. I'll also make a follow-up patch to try to get rid of as many default:s as possible throughout the entire framework.
Myles C. Maxfield
Comment 4 2022-03-23 11:58:36 PDT
Radar WebKit Bug Importer
Comment 5 2022-03-23 11:59:11 PDT
Myles C. Maxfield
Comment 6 2022-03-23 19:54:52 PDT
(In reply to Myles C. Maxfield from comment #3) > (In reply to Darin Adler from comment #2) > > Comment on attachment 455483 [details] > > Patch > > > > Love these conversion helper functions. Names can be really short since they > > do such a straightforward mapping. Not so thrilled by all the use of default > > here. Typically we like to use enums and switches without default cases so > > we can get warnings when new values are introduced. > > Right. The reason I made the defaults originally is because the enum values > have values like `WGPUFilterMode_Force32 = 0x7FFFFFFF` (because they come > from a C header which doesn't have enum classes). I think you're right, > though, that it's better to list these Force32 values explicitly, because > doing so would automatically indicate many of the places which would need to > be updated when adding new enum values in the future. > > I'll also make a follow-up patch to try to get rid of as many default:s as > possible throughout the entire framework. https://bugs.webkit.org/show_bug.cgi?id=238305
Note You need to log in before you can comment on or make changes to this bug.