Add GPUDevice.VideoOutputs with a list of attached monitors

This commit is contained in:
Wojtek Figat
2025-10-09 15:13:04 +02:00
parent 8cb67f017a
commit 2bf62cc54f
6 changed files with 143 additions and 19 deletions

View File

@@ -392,6 +392,8 @@ bool GPUDevice::Init()
LOG(Info, "Total graphics memory: {0}", Utilities::BytesToText(TotalGraphicsMemory));
if (!Limits.HasCompute)
LOG(Warning, "Compute Shaders are not supported");
for (const auto& videoOutput : VideoOutputs)
LOG(Info, "Video output '{0}' {1}x{2} {3} Hz", videoOutput.Name, videoOutput.Width, videoOutput.Height, videoOutput.RefreshRate);
Engine::RequestingExit.Bind<GPUDevice, &GPUDevice::OnRequestingExit>(this);
return false;
}
@@ -725,6 +727,7 @@ void GPUDevice::Draw()
void GPUDevice::Dispose()
{
RenderList::CleanupCache();
VideoOutputs.Resize(0);
VideoOutputModes.Resize(0);
}

View File

@@ -54,7 +54,40 @@ public:
};
/// <summary>
/// Describes a video output display mode.
/// Describes a video output display (monitor).
/// </summary>
API_STRUCT() struct VideoOutput
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(VideoOutputMode);
/// <summary>
/// The display name.
/// </summary>
API_FIELD() String Name;
/// <summary>
/// The native screen resolution width (in pixel).
/// </summary>
API_FIELD() uint32 Width = 0;
/// <summary>
/// The native screen resolution height (in pixel).
/// </summary>
API_FIELD() uint32 Height = 0;
/// <summary>
/// The maximum screen refresh rate (in hertz).
/// </summary>
API_FIELD() float RefreshRate = 0;
/// <summary>
/// Flag that indicates that monitor supports displaying High Dynamic Range colors.
/// </summary>
API_FIELD() bool HDR = false;
};
/// <summary>
/// Describes a video output display mode (monitor screen mode).
/// </summary>
API_STRUCT() struct VideoOutputMode
{
@@ -73,7 +106,12 @@ public:
/// <summary>
/// The screen refresh rate (in hertz).
/// </summary>
API_FIELD() uint32 RefreshRate;
API_FIELD() float RefreshRate;
/// <summary>
/// The index of the VideoOutput from the device monitors list.
/// </summary>
API_FIELD() int32 VideoOutputIndex;
};
/// <summary>
@@ -134,6 +172,11 @@ public:
/// </summary>
API_FIELD(ReadOnly) GPULimits Limits;
/// <summary>
/// The available video outputs (monitors).
/// </summary>
API_FIELD(ReadOnly) Array<VideoOutput> VideoOutputs;
/// <summary>
/// The available video output modes.
/// </summary>