duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

window_info.h (1065B)


      1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
      2 // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
      3 
      4 #pragma once
      5 
      6 #include "gpu_texture.h"
      7 #include "common/types.h"
      8 
      9 #include <optional>
     10 
     11 // Contains the information required to create a graphics context in a window.
     12 struct WindowInfo
     13 {
     14   enum class Type
     15   {
     16     Surfaceless,
     17     Win32,
     18     X11,
     19     Wayland,
     20     MacOS,
     21     Android,
     22     Display,
     23   };
     24 
     25   Type type = Type::Surfaceless;
     26   void* display_connection = nullptr;
     27   void* window_handle = nullptr;
     28   u32 surface_width = 0;
     29   u32 surface_height = 0;
     30   float surface_refresh_rate = 0.0f;
     31   float surface_scale = 1.0f;
     32   GPUTexture::Format surface_format = GPUTexture::Format::Unknown;
     33 
     34   // Needed for macOS.
     35 #ifdef __APPLE__
     36   void* surface_handle = nullptr;
     37 #endif
     38 
     39   ALWAYS_INLINE bool IsSurfaceless() const { return type == Type::Surfaceless; }
     40 
     41   // Changes the window to be surfaceless (i.e. no handle/size/etc).
     42   void SetSurfaceless();
     43 
     44   static std::optional<float> QueryRefreshRateForWindow(const WindowInfo& wi);
     45 };