mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +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 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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user