Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/d3dx_helpers.c:
> expected_src_data_size = (image->layer_pitch * image->layer_count) + header_size;
> if (src_data_size < expected_src_data_size)
> {
> + const uint32_t dxt10_info_only_flags = D3DX_IMAGE_INFO_ONLY | D3DX_IMAGE_SUPPORT_DXT10;
> +
> WARN("File is too short %u, expected at least %u bytes.\n", src_data_size, expected_src_data_size);
> - /* D3DX10/D3DX11 do not validate the size of the pixels, only the header. */
> - if (!(flags & D3DX_IMAGE_SUPPORT_DXT10))
> + /*
> + * D3DX10/D3DX11 do not validate the size of the pixels, only the header.
> + * However, if we're loading the image data, don't match native
> + * behavior.
> + */
I'd mention explicitly that we're doing it to be safe and until we find reason to do otherwise.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/9034#note_117121
Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/stb_dxt.h:
> dest[1] = (unsigned char)mn;
> dest += 2;
>
> + /*
> + * Wine specific optimization to more closely match Windows behavior: If
> + * max is equal to minimum, just set all bits to 0 (which means the value
> + * is the value of max in this case).
> + */
> + if (mx == mn) {
> + memset(dest, 0, 6);
> + return;
> + }
If I understand correctly, this affects the output. In which case I'd avoid calling it an optimization, both in the comment and the commit subject.
It's a bit of a pet peeve of mine, please bear with me...
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/9034#note_117120