1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[d3d9] Add helpers for new WSI interface

This commit is contained in:
Joshua Ashton 2022-08-17 19:43:12 +00:00 committed by Philip Rebohle
parent bc8e75fdfa
commit 654b517057

View File

@ -4,6 +4,9 @@
#include "d3d9_format.h"
#include "../wsi/wsi_window.h"
#include "../wsi/wsi_monitor.h"
namespace dxvk {
/**
@ -32,4 +35,27 @@ namespace dxvk {
bool IsSupportedBackBufferFormat(
D3D9Format BackBufferFormat);
inline wsi::WsiMode ConvertDisplayMode(const D3DDISPLAYMODEEX& mode) {
wsi::WsiMode wsiMode = { };
wsiMode.width = mode.Width;
wsiMode.height = mode.Height;
wsiMode.refreshRate = wsi::WsiRational{ mode.RefreshRate, 1 };
wsiMode.bitsPerPixel = GetMonitorFormatBpp(EnumerateFormat(mode.Format));
wsiMode.interlaced = mode.ScanLineOrdering == D3DSCANLINEORDERING_INTERLACED;
return wsiMode;
}
inline D3DDISPLAYMODEEX ConvertDisplayMode(const wsi::WsiMode& wsiMode) {
D3DDISPLAYMODEEX d3d9Mode = { };
d3d9Mode.Size = sizeof(D3DDISPLAYMODEEX);
d3d9Mode.Width = wsiMode.width;
d3d9Mode.Height = wsiMode.height;
d3d9Mode.RefreshRate = wsiMode.refreshRate.numerator / wsiMode.refreshRate.denominator;
d3d9Mode.Format = D3DFMT_X8R8G8B8;
d3d9Mode.ScanLineOrdering = wsiMode.interlaced ? D3DSCANLINEORDERING_INTERLACED : D3DSCANLINEORDERING_PROGRESSIVE;
return d3d9Mode;
}
}