Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/surface.c:
if (FAILED(hr))
{
IStream_Release(wic_file);
goto exit;
}
hr = IStream_Read(wic_file, ID3DXBuffer_GetBufferPointer(buffer), buf_size, NULL);
IStream_Release(wic_file);
if (FAILED(hr))
goto exit;
}
- }
- /* Return an empty buffer for size 0 images via WIC. */
- else if (!buffer)
- {
hr = D3DXCreateBuffer(64, &buffer);
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".