TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::sdlgpu::SDLGPUGraphicsContext::Impl Struct Reference

#include <gui_core/graphics/sdlgpu/sdlgpu_device.h>

Classes

struct  TextureCopy
 A whole image's pixels, or rows rows from firstRow written into one already up (UpdateImageRows); 0 rows is the whole image. More...
struct  BufferCopy
struct  CopyScratch
 RecordCopies' working lists, kept between frames for their storage. More...
struct  Resident
struct  Scene
 What RenderScene keeps for a key: its color texture (in the image set) and depth, both in liveImages. More...
struct  SceneRequest
struct  ImageTarget

Public Member Functions

uint32_t AddBuffer (SDL_GPUBuffer *buffer)
void RemoveBuffer (uint32_t entry)
SDL_GPUBuffer * Buffer (uint32_t entry) const
SDL_GPUBuffer * CreateBuffer (SDL_GPUBufferUsageFlags usage, const void *data, uint32_t bytes)
 A GPU buffer of usage and a transfer buffer holding data, copied at the next window frame's start.
void ReleaseBuffer (SDL_GPUBuffer *&buffer)
 Lets go of a buffer: its pending copy, if any, isn't made.
void RecordCopies (SDL_GPUCopyPass *pass)
 Records the queued copies; resident buffers they make are Ready after.
RHI::ResidentBufferId CreateResident (std::span< const RHI::UploadRequest > requests, std::span< DeviceAddress > addresses)
RHI::ResidentState ResidentState (RHI::ResidentBufferId id) const
void ReleaseResident (RHI::ResidentBufferId id)
SDL_GPUSampler * SamplerFor (tachyon::Sampler sampler) const
bool EnsureQuadIndices (uint32_t quads)
 Grows the quads' index buffer to hold quads (copied with the window frame's copies).
void RecordScenes (SDL_GPUCommandBuffer *cmd, ID window)
 Clears and records the scenes asked for in window this frame, before its UI's render pass and outside any pass.
SDLGPUImage * CreateTargetImage (uint2 size, SDL_GPUTextureFormat format, SDL_GPUTextureUsageFlags usage, Sampler sampler)
 A texture the GPU draws into (a scene's), in liveImages so DestroyImageAtEnd frees it; null on failure.

Public Attributes

DebugConfig debug
std::string driverAsked
 SetDriver; empty, SDL's choice.
bool lowPower = false
WindowResolver resolveWindow = nullptr
uint32_t imageSlots = 4096
SDL_GPUDevice * device = nullptr
SDL_GPUDevice * externalDevice = nullptr
 the host's (SetExternalDevice): not destroyed at Cleanup
SDL_GPUShaderFormat shaderFormat = SDL_GPU_SHADERFORMAT_INVALID
 the one the GUI's shaders are taken in
std::string driver
 the one in use
std::string deviceName
SDL_LogOutputFunction previousLog = nullptr
 SDL's log output while the debug callback takes SDL GPU's messages.
void * previousLogData = nullptr
bool logHooked = false
std::vector< SDL_GPUBuffer * > buffers { nullptr }
 entry 0 is none
std::vector< uint32_t > freeBuffers
std::mutex copyMutex
 images are made and let go on any thread
std::vector< TextureCopy > textureCopies
std::vector< BufferCopy > bufferCopies
std::vector< SDLGPUImage * > releasedImages
 Images let go of (DestroyImageAtEnd, on any thread), freed by RecordCopies on the frame's thread after the copies it took: one may be among them.
struct tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::CopyScratch copyScratch
std::unordered_map< RHI::ResidentBufferId, Resident > residents
std::vector< RHI::ResidentBufferId > pendingResidents
 Made and not copied yet, oldest first; one let go of meanwhile is no longer in residents and is passed over.
RHI::ResidentBufferId nextResident = 1
std::unordered_set< SDLGPUImage * > liveImages
 Every image made and not let go for a frame: Cleanup frees what's left.
SDLGPUImageSet imageSet
std::array< SDL_GPUSampler *, 3 > samplers {}
 nearest repeat, linear repeat, linear clamp
SDL_GPUTexture * blankImage = nullptr
 bound where a draw has fewer images
std::array< SDL_GPUGraphicsPipeline *, kPrimitiveKindCount > pipelineObjects {}
PipelineSet pipelines {}
 pipeline: the object; layout: the kind
SDL_GPUBuffer * blankBuffer = nullptr
 bound to the storage slots a draw doesn't use
SDL_GPUBuffer * quadIndices = nullptr
 p * 4 + { 0, 1, 3, 0, 3, 2 } for each quad p
uint32_t quadCapacity = 0
SDL_GPUBuffer * boxStyles = nullptr
SDL_GPUBuffer * colorStyles = nullptr
std::vector< ImageIndex > gradientPages
 each gradient page's index in the image set
ImageBatcher batcher
float elapsedTime = 0.0f
StyleManager * lastStyles = nullptr
 PrepareFrame's, for a live resize's redraw.
GradientManager * lastGradients = nullptr
std::unordered_map< ID, Scene > scenes
std::vector< SceneRequest > sceneRequests
uint64_t sceneFrame = 0
std::unordered_map< uint32_t, std::unique_ptr< SDLGPUImage > > externalImages
 By image slot index: the host's texture, which the GUI never releases.
std::unordered_map< ID, ImageTarget > imageTargets

Static Public Attributes

static constexpr SDL_GPUTextureFormat kSceneColorFormat = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
static constexpr uint64_t kSceneKeepFrames = 4
 a scene not asked for this long goes

Member Function Documentation

◆ AddBuffer()

uint32_t tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::AddBuffer ( SDL_GPUBuffer * buffer)

◆ RemoveBuffer()

void tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::RemoveBuffer ( uint32_t entry)

◆ Buffer()

SDL_GPUBuffer * tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::Buffer ( uint32_t entry) const
inline

◆ CreateBuffer()

SDL_GPUBuffer * tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::CreateBuffer ( SDL_GPUBufferUsageFlags usage,
const void * data,
uint32_t bytes )

A GPU buffer of usage and a transfer buffer holding data, copied at the next window frame's start.

Null on failure.

◆ ReleaseBuffer()

void tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::ReleaseBuffer ( SDL_GPUBuffer *& buffer)

Lets go of a buffer: its pending copy, if any, isn't made.

◆ RecordCopies()

void tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::RecordCopies ( SDL_GPUCopyPass * pass)

Records the queued copies; resident buffers they make are Ready after.

◆ CreateResident()

RHI::ResidentBufferId tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::CreateResident ( std::span< const RHI::UploadRequest > requests,
std::span< DeviceAddress > addresses )

◆ ResidentState()

RHI::ResidentState tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::ResidentState ( RHI::ResidentBufferId id) const

◆ ReleaseResident()

void tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::ReleaseResident ( RHI::ResidentBufferId id)

◆ SamplerFor()

SDL_GPUSampler * tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::SamplerFor ( tachyon::Sampler sampler) const

◆ EnsureQuadIndices()

bool tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::EnsureQuadIndices ( uint32_t quads)

Grows the quads' index buffer to hold quads (copied with the window frame's copies).

◆ RecordScenes()

void tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::RecordScenes ( SDL_GPUCommandBuffer * cmd,
ID window )

Clears and records the scenes asked for in window this frame, before its UI's render pass and outside any pass.

◆ CreateTargetImage()

SDLGPUImage * tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::CreateTargetImage ( uint2 size,
SDL_GPUTextureFormat format,
SDL_GPUTextureUsageFlags usage,
Sampler sampler )

A texture the GPU draws into (a scene's), in liveImages so DestroyImageAtEnd frees it; null on failure.

Member Data Documentation

◆ debug

DebugConfig tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::debug

◆ driverAsked

std::string tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::driverAsked

SetDriver; empty, SDL's choice.

◆ lowPower

bool tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::lowPower = false

◆ resolveWindow

WindowResolver tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::resolveWindow = nullptr

◆ imageSlots

uint32_t tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::imageSlots = 4096

◆ device

SDL_GPUDevice* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::device = nullptr

◆ externalDevice

SDL_GPUDevice* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::externalDevice = nullptr

the host's (SetExternalDevice): not destroyed at Cleanup

◆ shaderFormat

SDL_GPUShaderFormat tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::shaderFormat = SDL_GPU_SHADERFORMAT_INVALID

the one the GUI's shaders are taken in

◆ driver

std::string tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::driver

the one in use

◆ deviceName

std::string tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::deviceName

◆ previousLog

SDL_LogOutputFunction tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::previousLog = nullptr

SDL's log output while the debug callback takes SDL GPU's messages.

◆ previousLogData

void* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::previousLogData = nullptr

◆ logHooked

bool tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::logHooked = false

◆ buffers

std::vector<SDL_GPUBuffer*> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::buffers { nullptr }

entry 0 is none

◆ freeBuffers

std::vector<uint32_t> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::freeBuffers

◆ copyMutex

std::mutex tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::copyMutex

images are made and let go on any thread

◆ textureCopies

std::vector<TextureCopy> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::textureCopies

◆ bufferCopies

std::vector<BufferCopy> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::bufferCopies

◆ releasedImages

std::vector<SDLGPUImage*> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::releasedImages

Images let go of (DestroyImageAtEnd, on any thread), freed by RecordCopies on the frame's thread after the copies it took: one may be among them.

◆ copyScratch

struct tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::CopyScratch tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::copyScratch

◆ residents

std::unordered_map<RHI::ResidentBufferId, Resident> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::residents

◆ pendingResidents

std::vector<RHI::ResidentBufferId> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::pendingResidents

Made and not copied yet, oldest first; one let go of meanwhile is no longer in residents and is passed over.

Ids are never handed out twice.

◆ nextResident

RHI::ResidentBufferId tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::nextResident = 1

◆ liveImages

std::unordered_set<SDLGPUImage*> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::liveImages

Every image made and not let go for a frame: Cleanup frees what's left.

◆ imageSet

SDLGPUImageSet tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::imageSet

◆ samplers

std::array<SDL_GPUSampler*, 3> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::samplers {}

nearest repeat, linear repeat, linear clamp

◆ blankImage

SDL_GPUTexture* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::blankImage = nullptr

bound where a draw has fewer images

◆ pipelineObjects

std::array<SDL_GPUGraphicsPipeline*, kPrimitiveKindCount> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::pipelineObjects {}

◆ pipelines

PipelineSet tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::pipelines {}

pipeline: the object; layout: the kind

◆ blankBuffer

SDL_GPUBuffer* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::blankBuffer = nullptr

bound to the storage slots a draw doesn't use

◆ quadIndices

SDL_GPUBuffer* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::quadIndices = nullptr

p * 4 + { 0, 1, 3, 0, 3, 2 } for each quad p

◆ quadCapacity

uint32_t tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::quadCapacity = 0

◆ boxStyles

SDL_GPUBuffer* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::boxStyles = nullptr

◆ colorStyles

SDL_GPUBuffer* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::colorStyles = nullptr

◆ gradientPages

std::vector<ImageIndex> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::gradientPages

each gradient page's index in the image set

◆ batcher

ImageBatcher tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::batcher

◆ elapsedTime

float tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::elapsedTime = 0.0f

◆ lastStyles

StyleManager* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::lastStyles = nullptr

PrepareFrame's, for a live resize's redraw.

◆ lastGradients

GradientManager* tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::lastGradients = nullptr

◆ kSceneColorFormat

SDL_GPUTextureFormat tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::kSceneColorFormat = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
staticconstexpr

◆ kSceneKeepFrames

uint64_t tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::kSceneKeepFrames = 4
staticconstexpr

a scene not asked for this long goes

◆ scenes

std::unordered_map<ID, Scene> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::scenes

◆ sceneRequests

std::vector<SceneRequest> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::sceneRequests

◆ sceneFrame

uint64_t tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::sceneFrame = 0

◆ externalImages

std::unordered_map<uint32_t, std::unique_ptr<SDLGPUImage> > tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::externalImages

By image slot index: the host's texture, which the GUI never releases.

◆ imageTargets

std::unordered_map<ID, ImageTarget> tachyon::sdlgpu::SDLGPUGraphicsContext::Impl::imageTargets

The documentation for this struct was generated from the following file: