RESOLVED FIXED 227449
ANGLE Metal primitive restart range computation could index with size_t
https://bugs.webkit.org/show_bug.cgi?id=227449
Summary ANGLE Metal primitive restart range computation could index with size_t
Kimmo Kinnunen
Reported 2021-06-28 07:46:48 PDT
ANGLE Metal primitive restart range computation could index with size_t It'd be simpler to understand that the index does not overflow. The index limit is size_t.
Attachments
Patch (5.59 KB, patch)
2021-06-28 07:57 PDT, Kimmo Kinnunen
no flags
Patch (5.61 KB, patch)
2021-06-28 08:03 PDT, Kimmo Kinnunen
no flags
Patch for landing (5.75 KB, patch)
2021-06-29 00:58 PDT, Kimmo Kinnunen
no flags
Kimmo Kinnunen
Comment 1 2021-06-28 07:57:17 PDT
EWS Watchlist
Comment 2 2021-06-28 07:58:11 PDT
Note that there are important steps to take when updating ANGLE. See https://trac.webkit.org/wiki/UpdatingANGLE
Kimmo Kinnunen
Comment 3 2021-06-28 08:03:32 PDT
Kenneth Russell
Comment 4 2021-06-28 14:46:33 PDT
Comment on attachment 432394 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=432394&action=review This is certainly easier to understand. r+ with a couple of small questions. I defer to kpiddington's review if there's any further feedback. > Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.mm:421 > + for (size_t i = 0; i < numIndices; i++) Would it be better to use "++i" here for consistency with the inner loop? > Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.mm:430 > + } while (i < numIndices && bufferData[i] == restartMarker); Out of curiosity do you want to leave the restart indices in these ranges or elide them? > Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.mm:445 > + mRestartIndices = calculateRestartRanges<uint8_t>(ctx, getCurrentBuffer()); How hot is this routine? If it's called very often then maybe there is an advantage to continuing to pass mRestartIndices as an argument to reduce copying (or is return value optimization expected to handle this)?
Kimmo Kinnunen
Comment 5 2021-06-29 00:58:04 PDT
Created attachment 432457 [details] Patch for landing
Kimmo Kinnunen
Comment 6 2021-06-29 06:50:35 PDT
Comment on attachment 432394 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=432394&action=review >> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.mm:430 >> + } while (i < numIndices && bufferData[i] == restartMarker); > > Out of curiosity do you want to leave the restart indices in these ranges or elide them? restart indices should be in the ranges. >> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.mm:445 >> + mRestartIndices = calculateRestartRanges<uint8_t>(ctx, getCurrentBuffer()); > > How hot is this routine? If it's called very often then maybe there is an advantage to continuing to pass mRestartIndices as an argument to reduce copying (or is return value optimization expected to handle this)? RVO is expected. It's not hot, it's called during draw, but only once after the buffer is modified.
EWS
Comment 7 2021-06-29 06:53:51 PDT
Committed r279373 (239239@main): <https://commits.webkit.org/239239@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 432457 [details].
Radar WebKit Bug Importer
Comment 8 2021-06-29 06:54:15 PDT
Note You need to log in before you can comment on or make changes to this bug.