diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 90f130f6..7db26d82 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -876,11 +876,7 @@ namespace dxvk { // We may only fast path copy non identicals one way! // We don't know what garbage could be in the X8 data. - bool similar = (srcFormat == dstFormat) - || (srcFormat == D3D9Format::A8B8G8R8 && dstFormat == D3D9Format::X8B8G8R8) - || (srcFormat == D3D9Format::A8R8G8B8 && dstFormat == D3D9Format::X8R8G8B8) - || (srcFormat == D3D9Format::A1R5G5B5 && dstFormat == D3D9Format::X1R5G5B5) - || (srcFormat == D3D9Format::A4R4G4B4 && dstFormat == D3D9Format::X4R4G4B4); + bool similar = AreFormatsSimilar(srcFormat, dstFormat); // Copies are only supported on similar formats. fastPath &= similar; diff --git a/src/d3d9/d3d9_util.h b/src/d3d9/d3d9_util.h index 50be2daf..0edd220a 100644 --- a/src/d3d9/d3d9_util.h +++ b/src/d3d9/d3d9_util.h @@ -239,4 +239,12 @@ namespace dxvk { return D3DRENDERSTATETYPE(i ? D3DRS_COLORWRITEENABLE1 + i - 1 : D3DRS_COLORWRITEENABLE); } + inline bool AreFormatsSimilar(D3D9Format srcFormat, D3D9Format dstFormat) { + return (srcFormat == dstFormat) + || (srcFormat == D3D9Format::A8B8G8R8 && dstFormat == D3D9Format::X8B8G8R8) + || (srcFormat == D3D9Format::A8R8G8B8 && dstFormat == D3D9Format::X8R8G8B8) + || (srcFormat == D3D9Format::A1R5G5B5 && dstFormat == D3D9Format::X1R5G5B5) + || (srcFormat == D3D9Format::A4R4G4B4 && dstFormat == D3D9Format::X4R4G4B4); + } + } \ No newline at end of file