Presents a canvas's rendered frame to the screen (swap chain Present).
Takes canvasID (Int).
Returns nothing.
BGI GUI
Parameters & Returns
Parameters
canvasIDInt
Returns
Void
Quick Summary
Presents a canvas's rendered frame to the screen (swap chain Present).
Takes canvasID (Int).
Returns nothing.
Technical Exegesis...
Presents a canvas's rendered frame to the screen (swap chain Present). Searches g_canvasMap for canvasID. If not found, outputs debug message and returns. Gets canvas reference. If canvas.supports3D is true (3D canvas path): checks g_currentContext exists (requires b3dCls3D call). Gets command list from context. Calls BBR_2DOverlay_Render to draw 2D overlay over 3D scene. If canvas.activeScreenShader > 0, gets canvas RTV handle, calls BBR_Shaders3D_ApplyCanvasScreenShader for post-process effect.
Presents a canvas's rendered frame to the screen (swap chain Present). Searches g_canvasMap for canvasID. If not found, outputs debug message and returns. Gets canvas reference. If canvas.supports3D is true (3D canvas path): checks g_currentContext exists (requires b3dCls3D call). Gets command list from context. Calls BBR_2DOverlay_Render to draw 2D overlay over 3D scene. If canvas.activeScreenShader > 0, gets canvas RTV handle, calls BBR_Shaders3D_ApplyCanvasScreenShader for post-process effect. Transitions canvas render target from D3D12_RESOURCE_STATE_RENDER_TARGET to D3D12_RESOURCE_STATE_PRESENT via ResourceBarrier. Calls g_commandListManager->ExecuteCommandList to submit 3D commands to GPU. Calls canvas.swapChain->Present with syncInterval (1 if g_3D_isSynced, 0 otherwise) and presentFlags (DXGI_PRESENT_ALLOW_TEARING if unlocked). Updates canvas.frameIndex to current back buffer. Sets canvas.isFirstRender=false. Calls CalculateCanvasFPS for FPS tracking. Sets g_currentContext=nullptr. If canvas.supports3D is false (2D canvas path): calls RenderPrimitivesBatch, FlushCurrentBatch, updates screen constants, flushes shader batches, RenderUnifiedBatch, resets instance buffers, transitions instance buffers to COMMON state, transitions render target to PRESENT, executes 2D command list, calls swapChain->Present, updates frameIndex, calculates FPS, resets command list. No return value.
This function finalizes rendering and displays canvas on screen. Must be called after b3dRenderWorld (3D) or BBR drawing commands (2D). 3D path uses CommandListManager's fence system for GPU synchronization. 2D path flushes batched sprites/text/primitives before present. BBR_2DOverlay_Render overlays 2D UI on 3D scene (UI, debug text, HUD). Screen shader applies post-process effects (bloom, color grading, CRT). Resource barriers transition render target for safe presentation. Present() swaps front/back buffers - displayed image is previous frame. SyncInterval=1 enables VSync (60fps cap), =0 disables (uncapped FPS with tearing). ALLOW_TEARING flag required for tearing mode (set during canvas creation). FrameIndex tracks current back buffer (0-2 for triple buffering). CalculateCanvasFPS updates canvas.framesPerSecond every second. g_currentContext=nullptr forces new context allocation on next b3dCls3D. Each canvas presents independently - enables different refresh rates per viewport. Common pattern: render to canvas, bgiFlipCanvas, repeat. DO NOT call BBR_Flip for canvases - use bgiFlipCanvas instead.