fix some crashes in metal implementation when pathCount and eltCount are 0 #65

Merged
MartinFouilleul merged 1 commits from macos_metal_fixes into main 2023-08-28 10:16:52 +00:00
Collaborator

Running any of the samples under XCode on my old macbook with an integrated GPU resulted in asserts like this:

[MTLDebugComputeCommandEncoder dispatchThreads:threadsPerThreadgroup:]:1180: failed assertion `(threadsPerGrid.width(0) * threadsPerGrid.y(1) * threadsPerGrid.depth(1))(0) must not be 0.'

This would happen when pathCount and/or eltCount were 0. These changes just protect against issuing GPU passes when there's no data.

Running any of the samples under XCode on my old macbook with an integrated GPU resulted in asserts like this: ```[MTLDebugComputeCommandEncoder dispatchThreads:threadsPerThreadgroup:]:1180: failed assertion `(threadsPerGrid.width(0) * threadsPerGrid.y(1) * threadsPerGrid.depth(1))(0) must not be 0.'``` This would happen when `pathCount` and/or `eltCount` were 0. These changes just protect against issuing GPU passes when there's no data.
rdunnington added 1 commit 2023-08-24 18:36:48 +00:00
Collaborator

Couldn't we just early out if either pathCount or eltCount are zero (similar to d3e27df818/src/graphics/gl_canvas.c (L1085))?

Couldn't we just early out if either `pathCount` or `eltCount` are zero (similar to https://git.handmade.network/hmn/orca/src/commit/d3e27df818698056927abaae21f3b1703c5178d3/src/graphics/gl_canvas.c#L1085)?
rdunnington added 13 commits 2023-08-25 14:42:44 +00:00
Author
Collaborator

Oh yeah definitely, I didn't realize the GL renderer did the same thing and was trying to be conservative since I wasn't sure if there were some passes that weren't dependent on pathCount or eltCount that needed to happen regardless.
I've reverted the original change and added your suggested one.

Oh yeah definitely, I didn't realize the GL renderer did the same thing and was trying to be conservative since I wasn't sure if there were some passes that weren't dependent on `pathCount` or `eltCount` that needed to happen regardless. I've reverted the original change and added your suggested one.
MartinFouilleul force-pushed macos_metal_fixes from 2d3fe44239 to 9de9f93686 2023-08-28 10:15:46 +00:00 Compare
MartinFouilleul force-pushed macos_metal_fixes from 9de9f93686 to ceb4a3a95d 2023-08-28 10:16:38 +00:00 Compare
MartinFouilleul merged commit ceb4a3a95d into main 2023-08-28 10:16:52 +00:00
MartinFouilleul deleted branch macos_metal_fixes 2023-08-28 10:16:52 +00:00
Sign in to join this conversation.
No reviewers
No Label
macOS
windows
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hmn/orca#65
No description provided.