Skip to content

Fixup destroyTriangleBatch batch type #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025

Conversation

kcbanner
Copy link
Collaborator

This commit was intended to be part of #12

@hazeycode
Copy link
Member

Sorry, I changed this to be typed to get the sample apps to work. Why does this need to be type erased?

@kcbanner
Copy link
Collaborator Author

kcbanner commented Jul 29, 2025

The create functions return a DebugRendererImpl::BatchImpl instance which is constructed via JPC_DebugRenderer_TriangleBatch_Create. BatchImpl is a reference counted wrapper around the user-code batch pointer.

When the destructor for BatchImpl runs, it calls the destroyTriangleBatch function with the user-code batch pointer as the parameter, not the TriangleBatch (aka the BatchImpl) itself. Essentially it's unwrapping the reference to hand the callback the original user-code pointer (instead of needing a getter for it).

@hazeycode hazeycode merged commit dbebe90 into zig-gamedev:main Jul 29, 2025
3 checks passed
@hazeycode
Copy link
Member

hazeycode commented Jul 29, 2025

Ah, thanks for the explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants