LukasBanana / LLGL

Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal
BSD 3-Clause "New" or "Revised" License
2.05k stars 139 forks source link

RenderSystem, RenderContext, VideoMode refactor #48

Closed LukasBanana closed 1 year ago

LukasBanana commented 4 years ago

RenderSystem interface should be renamed to Device and RenderContext should be renamed to SwapChain. Along this renaming, the RenderContextDescriptor, VsyncDescriptor and VideoModeDescriptor should be merged into SwapChainDescriptor like this:

Before:

struct VsyncDescriptor {
    bool            enabled     = false;
    std::uint32_t   refreshRate = 60;
    std::uint32_t   interval    = 1;
};

struct VideoModeDescriptor {
    Extent2D        resolution;
    int             colorBits       = 32;
    int             depthBits       = 24;
    int             stencilBits     = 8;
    bool            fullscreen      = false;
    std::uint32_t   swapChainSize   = 2;
};

struct RenderContextDescriptor {
    VsyncDescriptor         vsync;
    std::uint32_t           samples     = 1;
    VideoModeDescriptor     videoMode;
};

After:

struct SwapChainDescriptor {
    Extent2D        resolution;
    int             colorBits       = 32;
    int             depthBits       = 24;
    int             stencilBits     = 8;
    bool            fullscreen      = false;
    std::uint32_t   swapBuffers     = 2;
//  std::uint32_t   refreshRate     = 60; // Refresh rate is display dependent and should not be an option here
    std::uint32_t   samples         = 1;
    std::uint32_t   vsyncInterval   = 0;
};
LukasBanana commented 1 year ago

This is mostly done now with commit e3622eb: