Skip to content
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

Expose _sg_pixelformat_bytesize to users? #946

Closed
logankaser opened this issue Nov 30, 2023 · 4 comments · Fixed by #962
Closed

Expose _sg_pixelformat_bytesize to users? #946

logankaser opened this issue Nov 30, 2023 · 4 comments · Fixed by #962

Comments

@logankaser
Copy link

_sg_pixelformat_bytesize Would be useful to expose to users.
I have a texture manager abstraction that internally creates sg_images.
Its API accepts sg_pixel_format(s) from callers, and width and height parameters,
and it would be nice to be able to use _sg_pixelformat_bytesize to calculate data size.

@floooh
Copy link
Owner

floooh commented Dec 3, 2023

I would prefer adding that as a field to sg_pixelformat_info returned by the sg_query_pixelformat call.

Thoughts?

@logankaser
Copy link
Author

That seems like a great place to add it!

@floooh
Copy link
Owner

floooh commented Jan 4, 2024

I'll start looking into this today.

@floooh
Copy link
Owner

floooh commented Jan 6, 2024

Ok, this is now merged. I also exposed two helper functions to compute the number of bytes in a texture row and surface, which might actually be a bit more useful.

Details are in the changelog https://github.com/floooh/sokol/blob/master/CHANGELOG.md#06-jan-2024, and also in the sokol_gfx.h documentation comments.

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

Successfully merging a pull request may close this issue.

2 participants