gboisse / gfx

A minimalist and easy to use graphics API.
MIT License
502 stars 36 forks source link

Add function to copy a texture to buffer #102

Closed maoliver-amd closed 9 months ago

maoliver-amd commented 9 months ago

This adds a new function gfxCommandCopyTextureToBuffer that can be used to copy a texture into a host readable buffer.

Tested to dump AOV to disk as well as round trip from bufeer to texture and then back to buffer with input and output contents identical for images of power-of-2 and non-power-of-2 and with and without mip chains.

I also added to this PR a new path within gfxCommandCopyTexture that will handle copying between textures with different mip levels. This allows (and was tested) copying a texture into the first mip level of another texture