gboisse / gfx

A minimalist and easy to use graphics API.
MIT License
498 stars 35 forks source link

Add function to copy a texture to buffer #102

Closed maoliver-amd closed 7 months ago

maoliver-amd commented 7 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