|
SBgl 0.1.0
A graphics framework in C99
|
#include "sbgl.h"#include "sbgl_types.h"#include "core/sbl_arena.h"#include "backend/sbgl_graphics_hal.h"#include "core/sbgl_batcher.h"#include "core/sbgl_context_internal.h"#include "core/sbgl_internal_log.h"#include "core/sbgl_platform.h"#include "core/sbgl_sort.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>
Go to the source code of this file.
Data Structures | |
| struct | sbgl_RenderQueue |
| Internal storage for draw packets awaiting submission. More... | |
| struct | sbgl_InternalContext |
| Internal state for the engine context. More... | |
Macros | |
| #define | SBL_ARENA_IMPLEMENTATION |
Functions | |
| SblArena * | sbgl_GetContextArena (sbgl_Context *ctx) |
| Retrieves the persistent arena associated with a context. | |
| sbgl_Result | sbgl_GetResult (sbgl_Context *ctx) |
| Retrieves the last result code from the context. | |
| sbgl_ErrorDetail | sbgl_GetErrorDetail (sbgl_Context *ctx) |
| Retrieves detailed error information including backend-specific codes. | |
| void | sbgl_ClearResult (sbgl_Context *ctx) |
| Clears the result code to SBGL_SUCCESS. | |
| sbgl_InitResult | sbgl_InitWithConfig (const sbgl_InitConfig *config) |
| Initializes the engine and opens a window with explicit configuration. | |
| sbgl_InitResult | sbgl_Init (int w, int h, const char *title) |
| Initializes the engine and opens a window. | |
| void | sbgl_Shutdown (sbgl_Context *ctx) |
| Gracefully shuts down the engine and releases all resources. | |
| bool | sbgl_WindowShouldClose (sbgl_Context *ctx) |
| Checks if the user or OS has requested to close the window. | |
| double | sbgl_GetTime (sbgl_Context *ctx) |
| Retrieves the current monotonic system time in seconds. | |
| void | sbgl_GetWindowSize (sbgl_Context *ctx, int *w, int *h) |
| Retrieves the current window dimensions. | |
| void | sbgl_BeginDrawing (sbgl_Context *ctx) |
| Prepares the engine for a new frame of drawing. | |
| void | sbgl_EndDrawing (sbgl_Context *ctx) |
| Finalizes the current frame and presents it to the screen. | |
| void | sbgl_BeginCompute (sbgl_Context *ctx) |
| Prepares the engine for compute operations before the main drawing pass. | |
| void | sbgl_EndCompute (sbgl_Context *ctx) |
| Finalizes the compute phase. | |
| void | sbgl_DeviceWaitIdle (sbgl_Context *ctx) |
| Synchronizes the CPU with the GPU, waiting for all commands to complete. | |
| void | sbgl_SetClearColor (sbgl_Context *ctx, float r, float g, float b, float a) |
| Sets the clear color for the next frame. | |
| const sbgl_InputState * | sbgl_GetInputState (sbgl_Context *ctx) |
| Retrieves the input state for the current frame. | |
| void | sbgl_SetMouseMode (sbgl_Context *ctx, sbgl_MouseMode mode) |
| Sets the cursor behavior and visibility. | |
| sbgl_Telemetry | sbgl_GetTelemetry (sbgl_Context *ctx) |
| Retrieves the performance telemetry data for the previous frame. | |
| sbgl_Buffer | sbgl_CreateBuffer (sbgl_Context *ctx, sbgl_BufferUsage usage, size_t size, const void *data) |
| Creates a GPU buffer. | |
| void | sbgl_DestroyBuffer (sbgl_Context *ctx, sbgl_Buffer buffer) |
| Destroys a GPU buffer. | |
| void | sbgl_FillBuffer (sbgl_Context *ctx, sbgl_Buffer buffer, size_t offset, size_t size, uint32_t value) |
| Fills a region of a GPU buffer with a fixed 32-bit value. | |
| uint32_t | sbgl_GetFrameIndex (sbgl_Context *ctx) |
| Retrieves the current frame index for double/triple buffering. | |
| void * | sbgl_MapBuffer (sbgl_Context *ctx, sbgl_Buffer buffer) |
| Maps a GPU buffer into the CPU's address space. | |
| void | sbgl_UnmapBuffer (sbgl_Context *ctx, sbgl_Buffer buffer) |
| Unmaps a previously mapped GPU buffer. | |
| sbgl_Shader | sbgl_LoadShader (sbgl_Context *ctx, sbgl_ShaderStage stage, const uint32_t *bytecode, size_t size) |
| Loads a shader from SPIR-V bytecode. | |
| sbgl_Shader | sbgl_LoadShaderFromFile (sbgl_Context *ctx, sbgl_ShaderStage stage, const char *filename) |
| Helper function to load a shader directly from a SPIR-V file. | |
| void | sbgl_DestroyShader (sbgl_Context *ctx, sbgl_Shader shader) |
| Destroys a shader module. | |
| sbgl_Pipeline | sbgl_CreatePipeline (sbgl_Context *ctx, const sbgl_PipelineConfig *config) |
| Creates a graphics pipeline. | |
| void | sbgl_DestroyPipeline (sbgl_Context *ctx, sbgl_Pipeline pipeline) |
| Destroys a graphics pipeline. | |
| sbgl_ComputePipeline | sbgl_CreateComputePipeline (sbgl_Context *ctx, sbgl_Shader shader) |
| Creates a compute pipeline. | |
| void | sbgl_DestroyComputePipeline (sbgl_Context *ctx, sbgl_ComputePipeline pipeline) |
| Destroys a compute pipeline. | |
| void | sbgl_BindComputePipeline (sbgl_Context *ctx, sbgl_ComputePipeline pipeline) |
| Binds a compute pipeline for subsequent dispatch calls. | |
| void | sbgl_DispatchCompute (sbgl_Context *ctx, uint32_t x, uint32_t y, uint32_t z) |
| Dispatches a compute workload. | |
| void | sbgl_MemoryBarrier (sbgl_Context *ctx, sbgl_BarrierType type) |
| Injects a memory barrier to synchronize compute and graphics operations. | |
| void | sbgl_BindPipeline (sbgl_Context *ctx, sbgl_Pipeline pipeline) |
| Binds a graphics pipeline for subsequent draw calls. | |
| void | sbgl_BindBuffer (sbgl_Context *ctx, sbgl_Buffer buffer, sbgl_BufferUsage usage) |
| Binds a buffer to the pipeline. | |
| uint64_t | sbgl_GetBufferDeviceAddress (sbgl_Context *ctx, sbgl_Buffer buffer) |
| Retrieves the 64-bit GPU virtual address for a buffer. | |
| void | sbgl_Draw (sbgl_Context *ctx, uint32_t vertexCount, uint32_t firstVertex, uint32_t instanceCount) |
| Submits a non-indexed draw command. | |
| void | sbgl_DrawIndexed (sbgl_Context *ctx, uint32_t indexCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t instanceCount) |
| Submits an indexed draw command. | |
| void | sbgl_DrawIndirect (sbgl_Context *ctx, sbgl_Buffer buffer, size_t offset, uint32_t drawCount) |
| Submits a batch of draw calls stored in a GPU buffer. | |
| void | sbgl_PushConstants (sbgl_Context *ctx, size_t size, const void *data) |
| Updates push constants for the currently bound pipeline. | |
| sbgl_RenderQueue * | sbgl_CreateRenderQueue (sbgl_Context *ctx, SblArena *arena) |
| Creates a thread-local render queue for collecting draw commands. | |
| void | sbgl_SubmitDraw (sbgl_RenderQueue *queue, uint32_t mesh, uint32_t material, uint32_t blendMode, uint32_t sidedness, uint32_t tags, sbgl_SortKey key, const sbgl_InstanceData *data) |
| Appends a draw command to the render queue. | |
| void | sbgl_RenderQueues (sbgl_Context *ctx, sbgl_RenderQueue **queues, uint32_t queueCount, const sbgl_Mat4 *viewProj) |
| Merges, sorts, and submits pending draw commands to the GPU. | |
| void | sbgl_RenderQueuesEx (sbgl_Context *ctx, sbgl_RenderQueue **queues, uint32_t queueCount, const sbgl_Mat4 *viewProj, uint64_t userAddress) |
| Extended version of sbgl_RenderQueues with user metadata. | |
| #define SBL_ARENA_IMPLEMENTATION |
Definition at line 4 of file sbgl_core.c.
| void sbgl_BeginCompute | ( | sbgl_Context * | ctx | ) |
Prepares the engine for compute operations before the main drawing pass.
If a frame has not yet been started, this function initiates the frame lifecycle, acquiring a swapchain image and starting the command buffer. It must be called outside of a BeginDrawing/EndDrawing block.
| ctx | The engine context. |
Definition at line 344 of file sbgl_core.c.
| void sbgl_BeginDrawing | ( | sbgl_Context * | ctx | ) |
Prepares the engine for a new frame of drawing.
This function handles event polling and Vulkan swapchain image acquisition. It is called before clearing or drawing commands.
| ctx | The engine context. |
Definition at line 262 of file sbgl_core.c.
| void sbgl_BindBuffer | ( | sbgl_Context * | ctx, |
| sbgl_Buffer | buffer, | ||
| sbgl_BufferUsage | usage ) |
Binds a buffer to the pipeline.
| ctx | The engine context. |
| buffer | The buffer handle. |
| usage | The usage to bind it as (Vertex/Index). |
Definition at line 681 of file sbgl_core.c.
| void sbgl_BindComputePipeline | ( | sbgl_Context * | ctx, |
| sbgl_ComputePipeline | pipeline ) |
Binds a compute pipeline for subsequent dispatch calls.
| ctx | The engine context. |
| pipeline | The compute pipeline handle. |
Definition at line 649 of file sbgl_core.c.
| void sbgl_BindPipeline | ( | sbgl_Context * | ctx, |
| sbgl_Pipeline | pipeline ) |
Binds a graphics pipeline for subsequent draw calls.
| ctx | The engine context. |
| pipeline | The pipeline handle. |
Definition at line 673 of file sbgl_core.c.
| void sbgl_ClearResult | ( | sbgl_Context * | ctx | ) |
Clears the result code to SBGL_SUCCESS.
| ctx | The engine context (may be NULL). |
Definition at line 103 of file sbgl_core.c.
| sbgl_Buffer sbgl_CreateBuffer | ( | sbgl_Context * | ctx, |
| sbgl_BufferUsage | usage, | ||
| size_t | size, | ||
| const void * | data ) |
Creates a GPU buffer.
| ctx | The engine context. |
| usage | Intended usage of the buffer (Vertex/Index). |
| size | Size in bytes. |
| data | Optional initial data. If NULL, the buffer is created empty. |
Definition at line 445 of file sbgl_core.c.
| sbgl_ComputePipeline sbgl_CreateComputePipeline | ( | sbgl_Context * | ctx, |
| sbgl_Shader | shader ) |
Creates a compute pipeline.
| ctx | The engine context. |
| shader | The compute shader handle. |
Definition at line 619 of file sbgl_core.c.
| sbgl_Pipeline sbgl_CreatePipeline | ( | sbgl_Context * | ctx, |
| const sbgl_PipelineConfig * | config ) |
Creates a graphics pipeline.
| ctx | The engine context. |
| config | Configuration for the pipeline. |
Definition at line 587 of file sbgl_core.c.
| sbgl_RenderQueue * sbgl_CreateRenderQueue | ( | sbgl_Context * | ctx, |
| struct SblArena * | arena ) |
Creates a thread-local render queue for collecting draw commands.
Draw packets are stored in this queue and submitted to the backend for rendering. Multiple queues enable parallel command recording.
| ctx | The engine context. |
| arena | The arena to use for queue allocations. |
Definition at line 743 of file sbgl_core.c.
| void sbgl_DestroyBuffer | ( | sbgl_Context * | ctx, |
| sbgl_Buffer | buffer ) |
Destroys a GPU buffer.
All submitted GPU commands referencing this buffer must have completed before calling this. Use sbgl_DeviceWaitIdle() to synchronize.
| ctx | The engine context. |
| buffer | The buffer handle. |
Definition at line 457 of file sbgl_core.c.
| void sbgl_DestroyComputePipeline | ( | sbgl_Context * | ctx, |
| sbgl_ComputePipeline | pipeline ) |
Destroys a compute pipeline.
| ctx | The engine context. |
| pipeline | The compute pipeline handle. |
Definition at line 629 of file sbgl_core.c.
| void sbgl_DestroyPipeline | ( | sbgl_Context * | ctx, |
| sbgl_Pipeline | pipeline ) |
Destroys a graphics pipeline.
The pipeline must not be in use by any submitted command buffers. Use sbgl_DeviceWaitIdle() to ensure safe destruction.
| ctx | The engine context. |
| pipeline | The pipeline handle. |
Definition at line 597 of file sbgl_core.c.
| void sbgl_DestroyShader | ( | sbgl_Context * | ctx, |
| sbgl_Shader | shader ) |
Destroys a shader module.
Shaders must not be in use by the GPU. Use sbgl_DeviceWaitIdle() before destruction during shutdown.
| ctx | The engine context. |
| shader | The shader handle. |
Definition at line 565 of file sbgl_core.c.
| void sbgl_DeviceWaitIdle | ( | sbgl_Context * | ctx | ) |
Synchronizes the CPU with the GPU, waiting for all commands to complete.
This is called before destroying resources (Pipelines, Buffers, Shaders) to ensure they are no longer in use by the GPU. Failure to do so results in Vulkan validation errors and instability.
| ctx | The engine context. |
Definition at line 391 of file sbgl_core.c.
| void sbgl_DispatchCompute | ( | sbgl_Context * | ctx, |
| uint32_t | groupCountX, | ||
| uint32_t | groupCountY, | ||
| uint32_t | groupCountZ ) |
Dispatches a compute workload.
| ctx | The engine context. |
| groupCountX | Number of workgroups in X dimension. |
| groupCountY | Number of workgroups in Y dimension. |
| groupCountZ | Number of workgroups in Z dimension. |
Definition at line 657 of file sbgl_core.c.
| void sbgl_Draw | ( | sbgl_Context * | ctx, |
| uint32_t | vertexCount, | ||
| uint32_t | firstVertex, | ||
| uint32_t | instanceCount ) |
Submits a non-indexed draw command.
| ctx | The engine context. |
| vertexCount | Number of vertices to draw. |
| firstVertex | Offset to the first vertex. |
| instanceCount | Number of instances to draw. |
Definition at line 698 of file sbgl_core.c.
| void sbgl_DrawIndexed | ( | sbgl_Context * | ctx, |
| uint32_t | indexCount, | ||
| uint32_t | firstIndex, | ||
| int32_t | vertexOffset, | ||
| uint32_t | instanceCount ) |
Submits an indexed draw command.
| ctx | The engine context. |
| indexCount | Number of indices to draw. |
| firstIndex | Offset to the first index. |
| vertexOffset | Value added to each index before indexing into vertex buffers. |
| instanceCount | Number of instances to draw. |
Definition at line 706 of file sbgl_core.c.
| void sbgl_DrawIndirect | ( | sbgl_Context * | ctx, |
| sbgl_Buffer | buffer, | ||
| size_t | offset, | ||
| uint32_t | drawCount ) |
Submits a batch of draw calls stored in a GPU buffer.
| ctx | The engine context. |
| buffer | Handle to the buffer containing an array of sbgl_IndirectCommand. |
| offset | The byte offset into the buffer where the commands begin. |
| drawCount | The number of commands to execute from the buffer. |
Definition at line 720 of file sbgl_core.c.
| void sbgl_EndCompute | ( | sbgl_Context * | ctx | ) |
Finalizes the compute phase.
This function is semantically symmetrical to sbgl_BeginCompute. It does not submit the frame; that is still handled by sbgl_EndDrawing.
| ctx | The engine context. |
Definition at line 385 of file sbgl_core.c.
| void sbgl_EndDrawing | ( | sbgl_Context * | ctx | ) |
Finalizes the current frame and presents it to the screen.
This function submits the recorded GPU commands and swaps the buffer.
| ctx | The engine context. |
Definition at line 315 of file sbgl_core.c.
| void sbgl_FillBuffer | ( | sbgl_Context * | ctx, |
| sbgl_Buffer | buffer, | ||
| size_t | offset, | ||
| size_t | size, | ||
| uint32_t | value ) |
Fills a region of a GPU buffer with a fixed 32-bit value.
This operation is performed on the GPU and is highly efficient for clearing counters or initializing large memory regions.
| ctx | The engine context. |
| buffer | The buffer handle. |
| offset | Byte offset into the buffer. |
| size | Number of bytes to fill. Must be a multiple of 4. |
| value | The 32-bit value to fill with. |
Definition at line 480 of file sbgl_core.c.
| uint64_t sbgl_GetBufferDeviceAddress | ( | sbgl_Context * | ctx, |
| sbgl_Buffer | buffer ) |
Retrieves the 64-bit GPU virtual address for a buffer.
This address is used for Buffer Device Address (BDA) lookups in shaders.
| ctx | The engine context. |
| buffer | The buffer handle. |
Definition at line 689 of file sbgl_core.c.
| SblArena * sbgl_GetContextArena | ( | sbgl_Context * | ctx | ) |
Retrieves the persistent arena associated with a context.
Subsystems that need a lifetime-bound allocation region (e.g., the voxel engine) use this arena instead of malloc to remain consistent with the library's memory model.
| ctx | The engine context. |
Definition at line 62 of file sbgl_core.c.
| sbgl_ErrorDetail sbgl_GetErrorDetail | ( | sbgl_Context * | ctx | ) |
Retrieves detailed error information including backend-specific codes.
| ctx | The engine context (may be NULL). |
Definition at line 78 of file sbgl_core.c.
| uint32_t sbgl_GetFrameIndex | ( | sbgl_Context * | ctx | ) |
Retrieves the current frame index for double/triple buffering.
| ctx | The engine context. |
Definition at line 489 of file sbgl_core.c.
| const sbgl_InputState * sbgl_GetInputState | ( | sbgl_Context * | ctx | ) |
Retrieves the input state for the current frame.
Adheres to Data-Oriented Design by providing a read-only view of input arrays (keys, mouse) for batch processing.
| ctx | The engine context. |
Definition at line 413 of file sbgl_core.c.
| sbgl_Result sbgl_GetResult | ( | sbgl_Context * | ctx | ) |
Retrieves the last result code from the context.
| ctx | The engine context (may be NULL). |
Definition at line 71 of file sbgl_core.c.
| sbgl_Telemetry sbgl_GetTelemetry | ( | sbgl_Context * | ctx | ) |
Retrieves the performance telemetry data for the previous frame.
| ctx | The active engine context. |
Definition at line 436 of file sbgl_core.c.
| double sbgl_GetTime | ( | sbgl_Context * | ctx | ) |
Retrieves the current monotonic system time in seconds.
This timer is high-resolution and suitable for frame-time calculation.
| ctx | The active engine context. |
Definition at line 245 of file sbgl_core.c.
| void sbgl_GetWindowSize | ( | sbgl_Context * | ctx, |
| int * | w, | ||
| int * | h ) |
Retrieves the current window dimensions.
| ctx | The active engine context. |
| w | Pointer to store the width. |
| h | Pointer to store the height. |
Definition at line 252 of file sbgl_core.c.
| sbgl_InitResult sbgl_Init | ( | int | w, |
| int | h, | ||
| const char * | title ) |
Initializes the engine and opens a window.
This function sets up the internal HALs and the Vulkan 1.3 backend. It is a convenience wrapper around sbgl_InitWithConfig() that uses default resource limits and enables validation in debug builds.
| w | Desired width of the window. |
| h | Desired height of the window. |
| title | Title displayed in the OS window manager. |
Definition at line 193 of file sbgl_core.c.
| sbgl_InitResult sbgl_InitWithConfig | ( | const sbgl_InitConfig * | config | ) |
Initializes the engine and opens a window with explicit configuration.
This function sets up the internal HALs and the Vulkan 1.3 backend using the provided configuration. This allows fine-grained control over resource limits and validation settings.
| config | Pointer to the initialization configuration. |
Definition at line 112 of file sbgl_core.c.
| sbgl_Shader sbgl_LoadShader | ( | sbgl_Context * | ctx, |
| sbgl_ShaderStage | stage, | ||
| const uint32_t * | bytecode, | ||
| size_t | size ) |
Loads a shader from SPIR-V bytecode.
| ctx | The engine context. |
| stage | The shader stage (Vertex/Fragment). |
| bytecode | Pointer to the SPIR-V bytecode. |
| size | Size of the bytecode in bytes. |
Definition at line 523 of file sbgl_core.c.
| sbgl_Shader sbgl_LoadShaderFromFile | ( | sbgl_Context * | ctx, |
| sbgl_ShaderStage | stage, | ||
| const char * | filename ) |
Helper function to load a shader directly from a SPIR-V file.
| ctx | The engine context. |
| stage | The shader stage (Vertex/Fragment). |
| filename | Path to the SPIR-V file. |
Definition at line 534 of file sbgl_core.c.
| void * sbgl_MapBuffer | ( | sbgl_Context * | ctx, |
| sbgl_Buffer | buffer ) |
Maps a GPU buffer into the CPU's address space.
This allows for direct reading from and writing to GPU memory. SBgl buffers are created as host-visible and coherent by default.
| ctx | The engine context. |
| buffer | The buffer handle. |
Definition at line 497 of file sbgl_core.c.
| void sbgl_MemoryBarrier | ( | sbgl_Context * | ctx, |
| sbgl_BarrierType | type ) |
Injects a memory barrier to synchronize compute and graphics operations.
| ctx | The engine context. |
| type | The type of barrier to inject. |
Definition at line 665 of file sbgl_core.c.
| void sbgl_PushConstants | ( | sbgl_Context * | ctx, |
| size_t | size, | ||
| const void * | data ) |
Updates push constants for the currently bound pipeline.
| ctx | The engine context. |
| size | Size of the data to push. |
| data | Pointer to the data. |
Definition at line 733 of file sbgl_core.c.
| void sbgl_RenderQueues | ( | sbgl_Context * | ctx, |
| sbgl_RenderQueue ** | queues, | ||
| uint32_t | queueCount, | ||
| const sbgl_Mat4 * | viewProj ) |
Merges, sorts, and submits pending draw commands to the GPU.
This function processes render queues in a batching operation. A stable radix sort is performed on the packets to minimize state transitions, followed by baking them into indirect draw commands.
| ctx | The engine context. |
| queues | Array of pointers to the render queues to be processed. |
| queueCount | Number of queues in the array. |
| viewProj | Pointer to the view-projection matrix for the frame. |
Definition at line 808 of file sbgl_core.c.
| void sbgl_RenderQueuesEx | ( | sbgl_Context * | ctx, |
| sbgl_RenderQueue ** | queues, | ||
| uint32_t | queueCount, | ||
| const sbgl_Mat4 * | viewProj, | ||
| uint64_t | userAddress ) |
Extended version of sbgl_RenderQueues with user metadata.
| ctx | The engine context. |
| queues | Array of render queues. |
| queueCount | Number of queues. |
| viewProj | View-projection matrix. |
| userAddress | A 64-bit GPU address for user-defined data (e.g., SSBO heightmap). |
Definition at line 817 of file sbgl_core.c.
| void sbgl_SetClearColor | ( | sbgl_Context * | ctx, |
| float | r, | ||
| float | g, | ||
| float | b, | ||
| float | a ) |
Sets the clear color for the next frame.
| ctx | The engine context. |
| r | Red component (0.0 to 1.0). |
| g | Green component (0.0 to 1.0). |
| b | Blue component (0.0 to 1.0). |
| a | Alpha component (0.0 to 1.0). |
Definition at line 401 of file sbgl_core.c.
| void sbgl_SetMouseMode | ( | sbgl_Context * | ctx, |
| sbgl_MouseMode | mode ) |
Sets the cursor behavior and visibility.
| ctx | The engine context. |
| mode | The desired mouse mode. |
Definition at line 422 of file sbgl_core.c.
| void sbgl_Shutdown | ( | sbgl_Context * | ctx | ) |
Gracefully shuts down the engine and releases all resources.
| ctx | The context to destroy. |
Definition at line 204 of file sbgl_core.c.
| void sbgl_SubmitDraw | ( | sbgl_RenderQueue * | queue, |
| uint32_t | mesh, | ||
| uint32_t | material, | ||
| uint32_t | blendMode, | ||
| uint32_t | sidedness, | ||
| uint32_t | tags, | ||
| sbgl_SortKey | key, | ||
| const sbgl_InstanceData * | data ) |
Appends a draw command to the render queue.
The packets are cached in the queue until the next frame.
| queue | The render queue to append to. |
| mesh | The mesh identifier. |
| material | The material identifier. |
| blendMode | The blend mode identifier. |
| sidedness | The sidedness flag (e.g., single/double sided). |
| tags | Custom user tags for filtering. |
| key | The sort key for minimizing state changes. |
| data | Pointer to the per-instance data (transform, color, etc). |
Definition at line 772 of file sbgl_core.c.
| void sbgl_UnmapBuffer | ( | sbgl_Context * | ctx, |
| sbgl_Buffer | buffer ) |
Unmaps a previously mapped GPU buffer.
| ctx | The engine context. |
| buffer | The buffer handle. |
Definition at line 511 of file sbgl_core.c.
| bool sbgl_WindowShouldClose | ( | sbgl_Context * | ctx | ) |
Checks if the user or OS has requested to close the window.
This flag is set by the OS (for instance, clicking the 'X' button or Alt+F4). The application polls this flag in the main loop and manually initiates shutdown by calling sbgl_Shutdown() when it returns true.
| ctx | The active engine context. |
Definition at line 238 of file sbgl_core.c.