2026-01-12 05:18:12 -05:00
|
|
|
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
2024-07-30 13:42:36 +02:00
|
|
|
// SPDX-License-Identifier: GPL-3.0+
|
2021-07-18 13:11:33 +10:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "Pcsx2Defs.h"
|
|
|
|
|
|
2024-05-23 23:35:34 +10:00
|
|
|
#include <optional>
|
|
|
|
|
|
2021-07-18 13:11:33 +10:00
|
|
|
/// Contains the information required to create a graphics context in a window.
|
|
|
|
|
struct WindowInfo
|
|
|
|
|
{
|
|
|
|
|
enum class Type
|
|
|
|
|
{
|
|
|
|
|
Surfaceless,
|
|
|
|
|
Win32,
|
|
|
|
|
X11,
|
|
|
|
|
Wayland,
|
2026-07-08 21:46:23 -04:00
|
|
|
MacOS,
|
2026-07-19 10:24:29 -07:00
|
|
|
Android,
|
|
|
|
|
|
2026-06-20 20:27:56 -07:00
|
|
|
// Vulkan VK_KHR_display direct-to-monitor (no compositor / no GBM
|
|
|
|
|
// intermediate). Frontend supplies no native window handle; the
|
|
|
|
|
// renderer enumerates displays itself. surface_width/surface_height
|
|
|
|
|
// carry the requested mode (0 = pick the display's preferred mode).
|
|
|
|
|
VulkanDirect
|
2021-07-18 13:11:33 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// The type of the surface. Surfaceless indicates it will not be displayed on screen at all.
|
|
|
|
|
Type type = Type::Surfaceless;
|
|
|
|
|
|
|
|
|
|
/// Connection to the display server. On most platforms except X11/Wayland, this is implicit and null.
|
|
|
|
|
void* display_connection = nullptr;
|
|
|
|
|
|
|
|
|
|
/// Abstract handle to the window. This depends on the surface type.
|
|
|
|
|
void* window_handle = nullptr;
|
|
|
|
|
|
2021-11-06 16:53:01 +10:00
|
|
|
/// For platforms where a separate surface/layer handle is needed, it is stored here (e.g. MacOS).
|
|
|
|
|
void* surface_handle = nullptr;
|
|
|
|
|
|
2021-07-18 13:11:33 +10:00
|
|
|
/// Width of the surface in pixels.
|
|
|
|
|
u32 surface_width = 0;
|
|
|
|
|
|
|
|
|
|
/// Height of the surface in pixels.
|
|
|
|
|
u32 surface_height = 0;
|
|
|
|
|
|
|
|
|
|
/// DPI scale for the surface.
|
|
|
|
|
float surface_scale = 1.0f;
|
|
|
|
|
|
|
|
|
|
/// Refresh rate of the surface, if available.
|
|
|
|
|
float surface_refresh_rate = 0.0f;
|
|
|
|
|
|
|
|
|
|
/// Returns the host's refresh rate for the given window, if available.
|
2024-05-23 23:35:34 +10:00
|
|
|
static std::optional<float> QueryRefreshRateForWindow(const WindowInfo& wi);
|
2021-07-18 13:11:33 +10:00
|
|
|
};
|