template<typename Derived>
RendererCore class
Public types
- struct UICapture
- What a UI capture gives back: the main window's document drawn alone over black.
Constructors, destructors, conversion operators
- RendererCore() defaulted
- ~RendererCore() defaulted
- RendererCore(const RendererCore&) deleted
Public functions
- auto operator=(const RendererCore&) -> RendererCore& deleted
- void Initialize(Registry* registry, LogicThreadBase* logic, const EngineConfig* config, VulkanContext* vkCtx, VulkanMemory* vkMem, SDL_Window* window, InputBuffer* vizInput)
- void Start()
- void Stop()
- void Join()
- auto GetTextures() -> TextureTable&
- Every sampled image the engine draws with. Encoder thread only.
- void SetUIHost(UIHost* host, PlatformWindowID mainWindow)
- Whose documents this renderer draws, and which window is the main one. Before Start.
- auto GetUIPass() const -> const UIPass&
- auto GetGlyphTexelsUploaded() const -> uint64_t
- auto GetUIImages() -> UIImages&
- The pictures UI documents show. Encoder thread only.
- auto RequestUICapture() -> bool
- auto TakeUICapture(UICapture& out) -> bool
- The capture, once it is ready (a few frames after the request). Any thread.
- void RequestScreenshot(std::string path)
- auto IsRunning() const -> bool
- auto GetPresentedFrameCount() const -> uint64_t
- Total frames rendered so far. Any thread.
- void NotifyResize()
- void AddWindow(PlatformWindowID id, SDL_Window* window, PresentPolicy policy)
- Present
windowas well as the main window (surface + swapchain withpolicy). - void RemoveWindow(PlatformWindowID id)
- void NotifyWindowResize(PlatformWindowID id)
- The window's pixel size changed: recreate its swapchain.
- auto PopReleasedWindow(PlatformWindowID& out) -> bool
- Windows whose surfaces were released (or could not be created). Single consumer (Sentinel).
- void WaitForGPU()
- Block until all submitted GPU work completes. Call before freeing in-flight resources.
Protected functions
- auto Self() -> Derived&
- void FillGpuFrameData(FrameSync& frame)
- void WriteToFrameSlab()
- void FlushPendingSlabUpload()
- void RecordCommandBuffer(FrameSync& frame, uint32_t imageIndex)
-
void RecordMainWindowUI(VkCommandBuffer cmd,
VkExtent2D extent,
UIPass::
Part part = UIPass::Part::All) - Draw the main window's document into the rendering scope open on its swapchain image.
- void RecordUICapture(VkCommandBuffer cmd)
- Draw an asked-for UI capture offscreen (RequestUICapture). After the main window's UI in a frame.
Protected variables
- Registry* RegistryPtr
- LogicThreadBase* LogicPtr
- const EngineConfig* ConfigPtr
- VulkanContext* VkCtx
- VulkanMemory* VkMem
- SDL_Window* WindowPtr
- VkDevice Device
- VkQueue GraphicsQueue
- InputBuffer* VizInputPtr
- std::thread Thread
- std::atomic<bool> bIsRunning
- std::atomic<bool> bResizeRequested
- VkFormat DepthFormat
- FrameSync Frames
- std::vector<vk::raii::Semaphore> RenderedSemaphores
- uint32_t CurrentFrame
- uint32_t LastRenderedFrame
- uint64_t LastVolatileFrame
- uint64_t LastTemporalFrame
- VkShaderModule VertShader
- VkShaderModule FragShader
- VulkanBuffer FieldSlabs
- uint32_t PrevFieldSlab
- uint32_t CurrentFieldSlab
- uint32_t GPUActiveFrame
- uint32_t GPUPrevFrame
- uint64_t* DirtyPlanes
- uint64_t* DirtySnapshot
- uint32_t DirtyWordCount
- bool FirstSlabWrite
- SlabFieldUploadInfo SlabUploadFields
-
TrinyxJobs::
JobCounter SlabUploadCounter - bool bSlabUploadPending
- uint32_t PendingSlabIdx
- uint64_t PendingRenderAckFrame
- uint64_t PendingVolatileFrameLock
- uint64_t PendingTemporalFrameLock
- std::array<GpuSlabFieldDesc, GpuTotalFieldCount+1> SlabFieldDescs
- SkinningPass Skinning
- vk::raii::PipelineLayout PipelineLayout
- vk::raii::Pipeline Pipeline
- VkPipeline PredicatePipeline
- VkPipeline PrefixSumPipeline
- VkPipeline ScatterPipeline
- VkPipeline BuildDrawsPipeline
- VkPipeline SortInstancesPipeline
- double RenderFpsTimer
- double RenderLastFPSCheck
- uint32_t RenderFrameCount
- std::atomic<uint64_t> PresentedFrames
- Total frames rendered; read from any thread.
- uint64_t FrameInputTimestamp
- double DisplayRefreshMs
- LatencyMeter Latency
Function documentation
template<typename Derived>
uint64_t RendererCore<Derived>:: GetGlyphTexelsUploaded() const
Glyph atlas texels sent to the GPU so far: a whole page when it is first needed, and after that only the rectangle new glyphs were rendered into.
template<typename Derived>
bool RendererCore<Derived>:: RequestUICapture()
Ask for the main window's document to be drawn into an offscreen target and read back. Any thread; one capture at a time. False if one is already under way.
template<typename Derived>
void RendererCore<Derived>:: RequestScreenshot(std::string path)
Write what the main window shows to path (a .bmp) a few frames from now, through a UI capture. TNX_SCREENSHOT=<path> asks for one after TNX_SCREENSHOT_FRAME frames (300 if not set). Any thread.
template<typename Derived>
void RendererCore<Derived>:: RemoveWindow(PlatformWindowID id)
Release the window's surface and swapchain. Once the GPU is done with it, the ID comes back from PopReleasedWindow() and the owner may destroy the OS window.