On Mon Mar 3 23:19:38 2025 +0000, Matteo Bruni wrote:
This is copying existing code from `D3DXSaveSurfaceToFileInMemory()`, so nothing really about the patch itself, just an excuse to discuss this bit. We're returning a zero-initialized buffer for size-0 images for WIC file formats. Do we know what does native do for these (assuming there is consistent behavior in the first place)? I'd expect some kind of "empty" image but with a normal file header (at least with the retail d3d version, I see the test mentions a `D3DERR_INVALIDCALL` return with the debug runtime). It doesn't seem like a big deal in any case, but it might be worthwhile to give it a look and possibly add a `FIXME` if this isn't exactly "compliant".
I wrote some tests for this awhile ago and forgot how it behaved on native :)
I just tested it again, it's format dependent. BMP/TGA/PPM/HDR/PFM/DDS all encode a header with width/height fields set to 0. JPG and PNG just return a buffer with a size of 0. I've added a `FIXME` now to indicate that we're returning an empty buffer.