mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[dxgi] Add helpers for new wsi interface
This commit is contained in:
parent
9f9c93dcbd
commit
71a630801e
@ -5,6 +5,8 @@
|
||||
|
||||
#include "dxgi_interfaces.h"
|
||||
|
||||
#include "../wsi/wsi_monitor.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
class DxgiSwapChain;
|
||||
@ -55,4 +57,33 @@ namespace dxvk {
|
||||
uint32_t GetMonitorFormatBpp(
|
||||
DXGI_FORMAT Format);
|
||||
|
||||
/**
|
||||
* \brief Converts a DXVK WSI display mode to a DXGI display mode
|
||||
*/
|
||||
inline DXGI_MODE_DESC1 ConvertDisplayMode(const wsi::WsiMode& WsiMode) {
|
||||
DXGI_MODE_DESC1 dxgiMode = { };
|
||||
dxgiMode.Width = WsiMode.width;
|
||||
dxgiMode.Height = WsiMode.height;
|
||||
dxgiMode.RefreshRate = DXGI_RATIONAL{ WsiMode.refreshRate.numerator, WsiMode.refreshRate.denominator };
|
||||
dxgiMode.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; // FIXME
|
||||
dxgiMode.ScanlineOrdering = WsiMode.interlaced ? DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST : DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE;
|
||||
dxgiMode.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
||||
dxgiMode.Stereo = FALSE;
|
||||
return dxgiMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Converts a DXGI display mode to a DXVK WSI display mode
|
||||
*/
|
||||
inline wsi::WsiMode ConvertDisplayMode(const DXGI_MODE_DESC1& DxgiMode) {
|
||||
wsi::WsiMode wsiMode = { };
|
||||
wsiMode.width = DxgiMode.Width;
|
||||
wsiMode.height = DxgiMode.Height;
|
||||
wsiMode.refreshRate = wsi::WsiRational{ DxgiMode.RefreshRate.Numerator, DxgiMode.RefreshRate.Denominator };
|
||||
wsiMode.bitsPerPixel = GetMonitorFormatBpp(DxgiMode.Format);
|
||||
wsiMode.interlaced = DxgiMode.ScanlineOrdering == DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST
|
||||
|| DxgiMode.ScanlineOrdering == DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST;
|
||||
return wsiMode;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user