[WebGPU] Clean up implementation of Device::createSampler()
Created attachment 455483 [details] Patch
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.
(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.
Committed r291758 (?): <https://commits.webkit.org/r291758>
<rdar://problem/90714790>
(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