floooh / sokol

minimal cross-platform standalone C headers
https://floooh.github.io/sokol-html5
zlib License
6.63k stars 472 forks source link

Question: Where are mipmaps generated? #902

Closed danielchasehooper closed 10 months ago

danielchasehooper commented 10 months ago

I don't see any calls to glGenerateMipmap in sokol_gfx. When and how do mipmaps get generated? Does that happen automatically as needed if a mipmap sampler object is bound with a texture that hasn't been mipmapped? Is there a way to force it to generate mipmaps at a convenient time (other than to do a dummy draw call)?

floooh commented 10 months ago

There's no support for generating mipmaps in sokol_gfx.h, mainly because it's not universally supported across backend APIs.

One thing I have in mind is a support header which offers helper functions for things like generating mipmaps (and mainly stuff like postprocessing-antialiasing).

The mipmap generation would come in two versions, one to be plugged into sg_image_desc (using 'raw' data in memory as input and running on the CPU), and another version which uses a render target texture as input, and would use render passes to generate the mipmap chain.

danielchasehooper commented 10 months ago

I see now this is a dupe of #102