Kode / Kha

Ultra-portable, high performance, open source multimedia framework.
http://kha.tech
zlib License
1.48k stars 174 forks source link

Binding specific mip-levels for images #1407

Open MoritzBrueckner opened 2 years ago

MoritzBrueckner commented 2 years ago

Is your feature request related to a problem? Please describe. When using a readonly image2D uniform in a shader with imageStore(), there is currently no way of binding a specific mip-level to write to. It seems to be possible though with some graphics APIs and can be handy for a series of downsampling operations for example.

Describe the solution you'd like A setTexture() function with a parameter to specify the mip level.

Describe alternatives you've considered Using individual textures for each mip level, as for my concrete use case (downsampling an image) mip levels are not required and I only need one level per shader dispatch because each operation requires the result of the previous iteration.

MoritzBrueckner commented 1 year ago

Looks like I can achieve my concrete use case also with Image.setMipmaps(), whose existence I didn't know about until a few minutes ago. Before that I changed the issue description above, but now that I realized that the feature I described is already available, I reverted it back to the original issue that is still not implemented in Kha as far as I know. However, my issue is resolved, and if you think that Kha doesn't need this specific feature (which still would be nice to have though), feel free to close this issue.