2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2020-05-07 12:48:13 +00:00
|
|
|
#pragma once
|
2023-08-13 03:42:02 +00:00
|
|
|
#include "gpu_texture.h"
|
|
|
|
#include "common/types.h"
|
2020-05-07 12:48:13 +00:00
|
|
|
|
|
|
|
// Contains the information required to create a graphics context in a window.
|
|
|
|
struct WindowInfo
|
|
|
|
{
|
|
|
|
enum class Type
|
|
|
|
{
|
|
|
|
Surfaceless,
|
|
|
|
Win32,
|
|
|
|
X11,
|
|
|
|
Wayland,
|
|
|
|
MacOS,
|
2020-06-29 16:46:57 +00:00
|
|
|
Android,
|
2021-02-04 09:32:47 +00:00
|
|
|
Display,
|
2020-05-07 12:48:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Type type = Type::Surfaceless;
|
|
|
|
void* display_connection = nullptr;
|
|
|
|
void* window_handle = nullptr;
|
|
|
|
u32 surface_width = 0;
|
|
|
|
u32 surface_height = 0;
|
2021-02-13 11:24:58 +00:00
|
|
|
float surface_refresh_rate = 0.0f;
|
2020-06-30 14:35:19 +00:00
|
|
|
float surface_scale = 1.0f;
|
2023-08-13 03:42:02 +00:00
|
|
|
GPUTexture::Format surface_format = GPUTexture::Format::Unknown;
|
2020-06-22 05:58:07 +00:00
|
|
|
|
|
|
|
// Needed for macOS.
|
|
|
|
#ifdef __APPLE__
|
|
|
|
void* surface_handle = nullptr;
|
|
|
|
#endif
|
2021-04-02 14:55:09 +00:00
|
|
|
|
2023-08-13 03:42:02 +00:00
|
|
|
ALWAYS_INLINE bool IsSurfaceless() const { return type == Type::Surfaceless; }
|
|
|
|
|
2022-11-23 09:13:28 +00:00
|
|
|
// Changes the window to be surfaceless (i.e. no handle/size/etc).
|
|
|
|
void SetSurfaceless();
|
|
|
|
|
2021-04-02 14:55:09 +00:00
|
|
|
static bool QueryRefreshRateForWindow(const WindowInfo& wi, float* refresh_rate);
|
2020-05-07 12:48:13 +00:00
|
|
|
};
|