|
coastline 0.0.4
|
The window of the game and the GPU device that draws into it. More...
#include <gpu.h>
Public Types | |
| using | OutputOverlay |
| Draw directly over the output texture after scaling and screen filters. | |
Public Member Functions | |
| ~GpuWindow () | |
| Release presentation resources and the window after all device-dependent users. | |
| GpuWindow (const GpuWindow &)=delete | |
| Prevent copying the window and GPU device. | |
| GpuWindow & | operator= (const GpuWindow &)=delete |
| Prevent assignment of the window and GPU device. | |
| bool | WideMenus () const |
| float | FieldOfViewScale () const |
| float | DrawDistanceScale () const |
| bool | N64Effects () const |
| bool | N64WindowReflections () const |
| bool | ApplyLiveOptions (const DisplayOptions &options) |
| Apply camera, particle, frame-size, post-processing, and pacing settings between frames. | |
| bool | ApplyRendererOptions (const DisplayOptions &options) |
| Update sampling and texture filtering, then apply live settings. | |
| SDL_Window * | Window () const |
| SDL_GPUDevice * | Device () const |
| Uint64 | GpuMemoryBytes () const |
| std::string | DeviceName () const |
| const std::string & | GpuPreference () const |
| bool | NvmlAllowed () const |
| float | AspectRatio () const |
| void | SetFramerateUnlocked (bool unlocked) |
| Set uncapped presentation while retaining the configured present mode. | |
| bool | FramerateUnlocked () const |
| Uint64 | PresentationWaitNanoseconds () const |
| bool | Fullscreen () const |
| bool | SetFullscreen (bool fullscreen) |
| Cover the display, at the desktop mode or the exclusive mode of the options, or return to a window. | |
| SDL_GPUPresentMode | PresentMode () const |
| void | SetPresentMode (SDL_GPUPresentMode mode) |
Present the frames with mode, with the other mode that does not wait and then vertical sync in the place of a mode the window does not support. | |
| Uint64 | RefreshPeriod () const |
| bool | PresentClear (SDL_FColor color, const std::filesystem::path *capture=nullptr) |
Clear the frame texture to color, present it, and save it when capture is given. | |
| bool | Present (SDL_GPUCommandBuffer *commands, const std::filesystem::path *capture=nullptr, const OutputOverlay &overlay={}) |
Scale the frame texture to the window and submit commands, which drew the frame. | |
| SDL_GPUTexture * | FrameTexture () const |
| Uint32 | FrameWidth () const |
| Uint32 | FrameHeight () const |
| void | UpdateFrameSize () |
| Give the frame the size of the window in pixels times the render scale, or the size of the options, recreating the frame texture when the size changes. | |
| int | Antialias () const |
| TextureFilter | Filter () const |
| bool | AlphaToCoverage () const |
| int | Anisotropy () const |
Static Public Member Functions | |
| static std::unique_ptr< GpuWindow > | Create (const char *title, const DisplayOptions &options) |
| Create the window, a GPU device for it, and the frame texture. | |
| static constexpr SDL_GPUTextureFormat | FrameFormat () |
Friends | |
| SDL_GPUTexture * | CreateGpuTexture (SDL_GPUDevice *device, const SDL_GPUTextureCreateInfo *info) |
| SDL_CreateGPUTexture(), recording bytes of every level and sample in GpuWindow::GpuMemoryBytes(). | |
| SDL_GPUBuffer * | CreateGpuBuffer (SDL_GPUDevice *device, const SDL_GPUBufferCreateInfo *info) |
| SDL_CreateGPUBuffer(), recording its size in GpuWindow::GpuMemoryBytes(). | |
| SDL_GPUTransferBuffer * | CreateGpuTransferBuffer (SDL_GPUDevice *device, const SDL_GPUTransferBufferCreateInfo *info) |
| SDL_CreateGPUTransferBuffer(), recording its size in GpuWindow::GpuMemoryBytes(). | |
| void | ReleaseGpuTexture (SDL_GPUDevice *device, SDL_GPUTexture *texture) |
| SDL_ReleaseGPUTexture(), subtracting its bytes from GpuWindow::GpuMemoryBytes(). | |
| void | ReleaseGpuBuffer (SDL_GPUDevice *device, SDL_GPUBuffer *buffer) |
| SDL_ReleaseGPUBuffer(), subtracting its bytes from GpuWindow::GpuMemoryBytes(). | |
| void | ReleaseGpuTransferBuffer (SDL_GPUDevice *device, SDL_GPUTransferBuffer *buffer) |
| SDL_ReleaseGPUTransferBuffer(), subtracting its bytes from GpuWindow::GpuMemoryBytes(). | |
The window of the game and the GPU device that draws into it.
Each frame is drawn into a texture of its own, which is scaled to the window when presented and can be read back.
Draw directly over the output texture after scaling and screen filters.
| coastline::GpuWindow::~GpuWindow | ( | ) |
Release presentation resources and the window after all device-dependent users.
|
delete |
Prevent copying the window and GPU device.
|
static |
Create the window, a GPU device for it, and the frame texture.
| title | The title of the window. |
| options | The size and the driver. |
Prevent assignment of the window and GPU device.
| bool coastline::GpuWindow::WideMenus | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
| bool coastline::GpuWindow::ApplyLiveOptions | ( | const DisplayOptions & | options | ) |
Apply camera, particle, frame-size, post-processing, and pacing settings between frames.
| options | The replacement live settings; window and adapter selection are unchanged. |
| bool coastline::GpuWindow::ApplyRendererOptions | ( | const DisplayOptions & | options | ) |
Update sampling and texture filtering, then apply live settings.
| options | The replacement renderer settings; rebuild scene resources after this call. |
|
inline |
|
inline |
|
inline |
| std::string coastline::GpuWindow::DeviceName | ( | ) | const |
|
inline |
| bool coastline::GpuWindow::NvmlAllowed | ( | ) | const |
|
inline |
| void coastline::GpuWindow::SetFramerateUnlocked | ( | bool | unlocked | ) |
Set uncapped presentation while retaining the configured present mode.
| unlocked | Whether to disable software pacing and request an uncapped present mode. |
|
inline |
|
inline |
|
inline |
| bool coastline::GpuWindow::SetFullscreen | ( | bool | fullscreen | ) |
Cover the display, at the desktop mode or the exclusive mode of the options, or return to a window.
An exclusive mode the display does not have falls back to the desktop mode.
| fullscreen | Whether the window covers the display. |
|
inline |
| void coastline::GpuWindow::SetPresentMode | ( | SDL_GPUPresentMode | mode | ) |
Present the frames with mode, with the other mode that does not wait and then vertical sync in the place of a mode the window does not support.
Vertical sync of a Wayland window presents to the mailbox at the refresh rate of the display, unless the options choose fifo.
| mode | How frames are presented. |
| Uint64 coastline::GpuWindow::RefreshPeriod | ( | ) | const |
| bool coastline::GpuWindow::PresentClear | ( | SDL_FColor | color, |
| const std::filesystem::path * | capture = nullptr ) |
Clear the frame texture to color, present it, and save it when capture is given.
| color | The clear colour. |
| capture | A PNG file a thread writes the frame to, logging the result. |
| bool coastline::GpuWindow::Present | ( | SDL_GPUCommandBuffer * | commands, |
| const std::filesystem::path * | capture = nullptr, | ||
| const OutputOverlay & | overlay = {} ) |
Scale the frame texture to the window and submit commands, which drew the frame.
| commands | The command buffer of the frame, submitted here. |
| capture | A PNG file a thread writes the frame to, logging the result. |
| overlay | Optional draws over the full output after presentation filters. |
|
inline |
|
inlinestaticconstexpr |
|
inline |
|
inline |
| void coastline::GpuWindow::UpdateFrameSize | ( | ) |
Give the frame the size of the window in pixels times the render scale, or the size of the options, recreating the frame texture when the size changes.
A frame of a size the device cannot create remains at the size before.
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
SDL_CreateGPUTexture(), recording bytes of every level and sample in GpuWindow::GpuMemoryBytes().
| device | The GPU device. |
| info | The texture to create. |
|
friend |
SDL_CreateGPUBuffer(), recording its size in GpuWindow::GpuMemoryBytes().
| device | The GPU device. |
| info | The buffer to create. |
|
friend |
SDL_CreateGPUTransferBuffer(), recording its size in GpuWindow::GpuMemoryBytes().
| device | The GPU device. |
| info | The transfer buffer to create. |
|
friend |
SDL_ReleaseGPUTexture(), subtracting its bytes from GpuWindow::GpuMemoryBytes().
| device | The GPU device. |
| texture | A texture of CreateGpuTexture(), or null. |
|
friend |
SDL_ReleaseGPUBuffer(), subtracting its bytes from GpuWindow::GpuMemoryBytes().
| device | The GPU device. |
| buffer | A buffer of CreateGpuBuffer(), or null. |
|
friend |
SDL_ReleaseGPUTransferBuffer(), subtracting its bytes from GpuWindow::GpuMemoryBytes().
| device | The GPU device. |
| buffer | A transfer buffer of CreateGpuTransferBuffer(), or null. |