RESOLVED FIXED 237882
[WebGPU] Implement sampler creation according to the spec
https://bugs.webkit.org/show_bug.cgi?id=237882
Summary [WebGPU] Implement sampler creation according to the spec
Myles C. Maxfield
Reported 2022-03-15 01:38:37 PDT
.
Attachments
Patch (10.63 KB, patch)
2022-03-15 01:40 PDT, Myles C. Maxfield
kkinnunen: review+
Myles C. Maxfield
Comment 1 2022-03-15 01:40:43 PDT
Kimmo Kinnunen
Comment 2 2022-03-16 08:52:12 PDT
Comment on attachment 454680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=454680&action=review > Source/WebGPU/WebGPU/Sampler.mm:40 > + if (descriptor.lodMinClamp < 0) an edge case of edge cases: Do we have a mechanism to prevent NaNs in the floats or do we need to validate those? (those cause tricky failures to debug even if it's a content issue, so if validation rejects those, maybe it'd be good use of time?)
Kimmo Kinnunen
Comment 3 2022-03-16 09:01:19 PDT
Comment on attachment 454680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=454680&action=review > Source/WebGPU/WebGPU/Sampler.mm:190 > + samplerDescriptor.maxAnisotropy = descriptor.maxAnisotropy; this should be clamped?
Myles C. Maxfield
Comment 4 2022-03-16 20:51:08 PDT
Comment on attachment 454680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=454680&action=review >> Source/WebGPU/WebGPU/Sampler.mm:40 >> + if (descriptor.lodMinClamp < 0) > > an edge case of edge cases: > Do we have a mechanism to prevent NaNs in the floats or do we need to validate those? > (those cause tricky failures to debug even if it's a content issue, so if validation rejects those, maybe it'd be good use of time?) Yes, good catch. The spec says "Return true if and only if all of the following conditions are satisfied: descriptor.lodMinClamp is greater than or equal to 0. \ descriptor.lodMaxClamp is greater than or equal to descriptor.lodMinClamp." so I think a careful reading of the spec already catches NaN (those comparisons will be false in that case). My code, however, gets this wrong, since I've inverted the conditionals. I'll check for NaN explicitly. >> Source/WebGPU/WebGPU/Sampler.mm:190 >> + samplerDescriptor.maxAnisotropy = descriptor.maxAnisotropy; > > this should be clamped? Yes, the Metal spec https://developer.apple.com/documentation/metal/mtlsamplerdescriptor/1516164-maxanisotropy?language=objc says "Values must be between 1 and 16, inclusive."
Myles C. Maxfield
Comment 5 2022-03-16 20:56:10 PDT
Radar WebKit Bug Importer
Comment 6 2022-03-16 20:57:15 PDT
Note You need to log in before you can comment on or make changes to this bug.