mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +01:00
[d3d9] Add AreFormatsSimilar helper
This commit is contained in:
parent
9fce945b62
commit
e5df573292
@ -876,11 +876,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
// We may only fast path copy non identicals one way!
|
// We may only fast path copy non identicals one way!
|
||||||
// We don't know what garbage could be in the X8 data.
|
// We don't know what garbage could be in the X8 data.
|
||||||
bool similar = (srcFormat == dstFormat)
|
bool similar = AreFormatsSimilar(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);
|
|
||||||
|
|
||||||
// Copies are only supported on similar formats.
|
// Copies are only supported on similar formats.
|
||||||
fastPath &= similar;
|
fastPath &= similar;
|
||||||
|
@ -239,4 +239,12 @@ namespace dxvk {
|
|||||||
return D3DRENDERSTATETYPE(i ? D3DRS_COLORWRITEENABLE1 + i - 1 : D3DRS_COLORWRITEENABLE);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user