From: Connor McAdams <cmcadams(a)codeweavers.com> This optimzation helps us to more closely match the output of native d3dx's DXT compression, which helps with d3dx10 tests. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/d3dx9_36/stb_dxt.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/d3dx9_36/stb_dxt.h b/dlls/d3dx9_36/stb_dxt.h index c25f6b015da..2b40829deac 100644 --- a/dlls/d3dx9_36/stb_dxt.h +++ b/dlls/d3dx9_36/stb_dxt.h @@ -565,6 +565,16 @@ static void stb__CompressAlphaBlock(unsigned char *dest,unsigned char *src, int 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; + } + // determine bias and emit color indices // given the choice of mx/mn, these indices are optimal: // http://fgiesen.wordpress.com/2009/12/15/dxt5-alpha-block-index-determination... -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9034