Open SanderMertens opened 2 years ago
IME glGenerateMipmaps() is one of those GL functions which can cause trouble in poorly implemented GL drivers (e.g. on mobile), but maybe this has improved. Just something to keep in mind (for instance currently there is this unfixed crash on macOS Catalina: https://twitter.com/Akien/status/1459120447228989440)
IFIR there are a number of similar requests in the ticket list though... I think the consensus was that the best solution would be to add a boolean flag to sg_image_desc, and that glGenerateMipmaps (or the equivalent for D3D11 and Metal) would be called "when needed" (e.g. for render targets at the end of their render pass, and for immutable textures once during creation).
I'll work on smaller things next, and this would be a good candidate.
Hi, I was trying to use mipmapped images with render targets & noticed that mipmaps aren't generated for those. I was able to make it work by adding this snippet:
to
_sg_gl_create_image
(right after thefor (int slot = 0; slot < img->cmn.num_slots; slot++) {
loop) and_sg_gl_apply_bindings
(right after_sg_gl_cache_bind_texture
).I verified it works on macOS (
SOKOL_GLCORE33
) and webgl (SOKOL_GLES3
, chrome, firefox, safari and MS edge). Would be cool if this could be supported, it's a cheap way to downsample render targets.