On Wed Jul 9 13:54:19 2025 +0000, Connor McAdams wrote:
The `ID3DXBuffer`/ `ID3D10Blob` / `ID3DBlob` was what ultimately led me to doing that. Originally I was just returning allocated memory/size from the saving to file function, creating the appropriate buffer interface, and copying it over. That feels a bit wasteful WRT memory. In theory we're the ones implementing those interfaces in the first place, so we could add some way to do the equivalent of `D3DXCreateBuffer()` / `D3D10CreateBlob()` / `D3DCreateBlob()` with preallocated memory. The other alternative is to do a kind of dry run to get the size first, then pass in the allocated memory on the second call. That ends up with extra code complexity that felt a bit messy to me at the time.
Maybe we could introduce a thin wrapper around `D3DXCreateBuffer()` and the buffer / blob methods we use, implemented by each of the d3dx* and passed to `d3dx_save_pixels_to_memory()`.
It feels like it should be a good fit for this case but, as usual, it will be clear only after trying...