|
SBgl 0.1.0
A graphics framework in C99
|


Go to the source code of this file.
Data Structures | |
| struct | sbgl_GfxTransientAllocation |
| Represents a slice of a persistent GPU buffer used for transient data. More... | |
Typedefs | |
| typedef struct sbgl_GfxContext | sbgl_GfxContext |
| Opaque handle for the graphics backend context. | |
Functions | |
| sbgl_GfxContext * | sbgl_gfx_Init (sbgl_Window *window, struct SblArena *arena, const sbgl_ResourceLimits *limits, bool enableValidation) |
| Initializes the graphics backend with configurable resource limits. | |
| void | sbgl_gfx_Shutdown (sbgl_GfxContext *ctx) |
| bool | sbgl_gfx_BeginFrame (sbgl_GfxContext *ctx) |
| Starts a new frame, acquiring an image and starting the command buffer. | |
| void | sbgl_gfx_EndFrame (sbgl_GfxContext *ctx) |
| Submits the current frame's commands and presents the image. | |
| void | sbgl_gfx_BeginRenderPass (sbgl_GfxContext *ctx, float r, float g, float b, float a) |
| Starts a graphics rendering pass. | |
| void | sbgl_gfx_EndRenderPass (sbgl_GfxContext *ctx) |
| Ends the current graphics rendering pass. | |
| void | sbgl_gfx_DeviceWaitIdle (sbgl_GfxContext *ctx) |
| sbgl_Buffer | sbgl_gfx_CreateBuffer (sbgl_GfxContext *ctx, sbgl_BufferUsage usage, size_t size, const void *data) |
| void | sbgl_gfx_DestroyBuffer (sbgl_GfxContext *ctx, sbgl_Buffer buffer) |
| void | sbgl_gfx_FillBuffer (sbgl_GfxContext *ctx, sbgl_Buffer buffer, size_t offset, size_t size, uint32_t value) |
| Performs a hardware-accelerated buffer fill. | |
| uint32_t | sbgl_gfx_GetFrameIndex (sbgl_GfxContext *ctx) |
| Retrieves the current backend frame index. | |
| void * | sbgl_gfx_MapBuffer (sbgl_GfxContext *ctx, sbgl_Buffer buffer) |
| void | sbgl_gfx_UnmapBuffer (sbgl_GfxContext *ctx, sbgl_Buffer buffer) |
| sbgl_Shader | sbgl_gfx_LoadShader (sbgl_GfxContext *ctx, sbgl_ShaderStage stage, const uint32_t *bytecode, size_t size) |
| void | sbgl_gfx_DestroyShader (sbgl_GfxContext *ctx, sbgl_Shader shader) |
| sbgl_Pipeline | sbgl_gfx_CreatePipeline (sbgl_GfxContext *ctx, const sbgl_PipelineConfig *config) |
| void | sbgl_gfx_DestroyPipeline (sbgl_GfxContext *ctx, sbgl_Pipeline pipeline) |
| sbgl_ComputePipeline | sbgl_gfx_CreateComputePipeline (sbgl_GfxContext *ctx, sbgl_Shader shader) |
| void | sbgl_gfx_DestroyComputePipeline (sbgl_GfxContext *ctx, sbgl_ComputePipeline pipeline) |
| void | sbgl_gfx_BindComputePipeline (sbgl_GfxContext *ctx, sbgl_ComputePipeline pipeline) |
| void | sbgl_gfx_DispatchCompute (sbgl_GfxContext *ctx, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) |
| void | sbgl_gfx_MemoryBarrier (sbgl_GfxContext *ctx, sbgl_BarrierType type) |
| void | sbgl_gfx_BindPipeline (sbgl_GfxContext *ctx, sbgl_Pipeline pipeline) |
| void | sbgl_gfx_BindBuffer (sbgl_GfxContext *ctx, sbgl_Buffer buffer, sbgl_BufferUsage usage) |
| void | sbgl_gfx_Draw (sbgl_GfxContext *ctx, uint32_t vertexCount, uint32_t firstVertex, uint32_t instanceCount) |
| void | sbgl_gfx_DrawIndexed (sbgl_GfxContext *ctx, uint32_t indexCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t instanceCount) |
| void | sbgl_gfx_DrawIndirect (sbgl_GfxContext *ctx, sbgl_Buffer buffer, size_t offset, uint32_t drawCount) |
| Submits a batch of draw calls stored in a GPU buffer. | |
| sbgl_GfxTransientAllocation | sbgl_gfx_AllocateTransient (sbgl_GfxContext *ctx, size_t size, uint32_t alignment) |
| Allocates a slice of GPU-visible memory for transient per-frame data. | |
| uint64_t | sbgl_gfx_GetBufferDeviceAddress (sbgl_GfxContext *ctx, sbgl_Buffer buffer) |
| Retrieves the 64-bit GPU virtual address for a buffer. | |
| void | sbgl_gfx_DestroyBufferDeferred (sbgl_GfxContext *ctx, sbgl_Buffer buffer) |
| Marks a buffer for destruction after current frames complete. | |
| void | sbgl_gfx_PushConstants (sbgl_GfxContext *ctx, size_t size, const void *data) |
| float | sbgl_gfx_GetGpuTime (sbgl_GfxContext *ctx) |
| Retrieves the elapsed GPU time for the previous frame in milliseconds. | |
| int32_t | sbgl_gfx_GetLastVkResult (sbgl_GfxContext *ctx) |
| Retrieves the last VkResult from the backend for error inspection. | |
| typedef struct sbgl_GfxContext sbgl_GfxContext |
Opaque handle for the graphics backend context.
Definition at line 21 of file sbgl_graphics_hal.h.
| sbgl_GfxTransientAllocation sbgl_gfx_AllocateTransient | ( | sbgl_GfxContext * | ctx, |
| size_t | size, | ||
| uint32_t | alignment ) |
Allocates a slice of GPU-visible memory for transient per-frame data.
This memory is managed by the backend's internal per-frame ring buffers and does not require manual destruction.
| ctx | The graphics context. |
| size | The number of bytes to allocate. |
| alignment | The required byte alignment for the allocation. |
Definition at line 2040 of file sbgl_backend_vulkan.c.
| bool sbgl_gfx_BeginFrame | ( | sbgl_GfxContext * | ctx | ) |
Starts a new frame, acquiring an image and starting the command buffer.
This must be called before any GPU commands (Compute or Graphics) are recorded.
Definition at line 1106 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_BeginRenderPass | ( | sbgl_GfxContext * | ctx, |
| float | r, | ||
| float | g, | ||
| float | b, | ||
| float | a ) |
Starts a graphics rendering pass.
This must be called before any draw commands are recorded. It handles clearing the attachments if requested.
Definition at line 1167 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_BindBuffer | ( | sbgl_GfxContext * | ctx, |
| sbgl_Buffer | buffer, | ||
| sbgl_BufferUsage | usage ) |
Definition at line 1971 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_BindComputePipeline | ( | sbgl_GfxContext * | ctx, |
| sbgl_ComputePipeline | pipeline ) |
Definition at line 1851 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_BindPipeline | ( | sbgl_GfxContext * | ctx, |
| sbgl_Pipeline | pipeline ) |
Definition at line 1943 of file sbgl_backend_vulkan.c.
| sbgl_Buffer sbgl_gfx_CreateBuffer | ( | sbgl_GfxContext * | ctx, |
| sbgl_BufferUsage | usage, | ||
| size_t | size, | ||
| const void * | data ) |
Definition at line 1324 of file sbgl_backend_vulkan.c.
| sbgl_ComputePipeline sbgl_gfx_CreateComputePipeline | ( | sbgl_GfxContext * | ctx, |
| sbgl_Shader | shader ) |
Definition at line 1764 of file sbgl_backend_vulkan.c.
| sbgl_Pipeline sbgl_gfx_CreatePipeline | ( | sbgl_GfxContext * | ctx, |
| const sbgl_PipelineConfig * | config ) |
Definition at line 1551 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DestroyBuffer | ( | sbgl_GfxContext * | ctx, |
| sbgl_Buffer | buffer ) |
Definition at line 1410 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DestroyBufferDeferred | ( | sbgl_GfxContext * | ctx, |
| sbgl_Buffer | buffer ) |
Marks a buffer for destruction after current frames complete.
This function should be used for temporary buffers that are submitted for GPU execution in the current frame and must not be destroyed until the GPU has finished using them.
| ctx | The graphics context. |
| buffer | Handle to the buffer to destroy. |
Definition at line 1480 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DestroyComputePipeline | ( | sbgl_GfxContext * | ctx, |
| sbgl_ComputePipeline | pipeline ) |
Definition at line 1837 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DestroyPipeline | ( | sbgl_GfxContext * | ctx, |
| sbgl_Pipeline | pipeline ) |
Definition at line 1752 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DestroyShader | ( | sbgl_GfxContext * | ctx, |
| sbgl_Shader | shader ) |
Definition at line 1540 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DeviceWaitIdle | ( | sbgl_GfxContext * | ctx | ) |
Definition at line 1317 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DispatchCompute | ( | sbgl_GfxContext * | ctx, |
| uint32_t | groupCountX, | ||
| uint32_t | groupCountY, | ||
| uint32_t | groupCountZ ) |
Definition at line 1870 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_Draw | ( | sbgl_GfxContext * | ctx, |
| uint32_t | vertexCount, | ||
| uint32_t | firstVertex, | ||
| uint32_t | instanceCount ) |
Definition at line 1997 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DrawIndexed | ( | sbgl_GfxContext * | ctx, |
| uint32_t | indexCount, | ||
| uint32_t | firstIndex, | ||
| int32_t | vertexOffset, | ||
| uint32_t | instanceCount ) |
Definition at line 2001 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_DrawIndirect | ( | sbgl_GfxContext * | ctx, |
| sbgl_Buffer | buffer, | ||
| size_t | offset, | ||
| uint32_t | drawCount ) |
Submits a batch of draw calls stored in a GPU buffer.
| ctx | The graphics 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 2018 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_EndFrame | ( | sbgl_GfxContext * | ctx | ) |
Submits the current frame's commands and presents the image.
Definition at line 1277 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_EndRenderPass | ( | sbgl_GfxContext * | ctx | ) |
Ends the current graphics rendering pass.
Definition at line 1240 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_FillBuffer | ( | sbgl_GfxContext * | ctx, |
| sbgl_Buffer | buffer, | ||
| size_t | offset, | ||
| size_t | size, | ||
| uint32_t | value ) |
Performs a hardware-accelerated buffer fill.
Definition at line 1431 of file sbgl_backend_vulkan.c.
| uint64_t sbgl_gfx_GetBufferDeviceAddress | ( | sbgl_GfxContext * | ctx, |
| sbgl_Buffer | buffer ) |
Retrieves the 64-bit GPU virtual address for a buffer.
Used primarily for passing buffer pointers to shaders via push constants or storage buffers when using VK_KHR_buffer_device_address.
| ctx | The graphics context. |
| buffer | The buffer to query. |
Definition at line 1493 of file sbgl_backend_vulkan.c.
| uint32_t sbgl_gfx_GetFrameIndex | ( | sbgl_GfxContext * | ctx | ) |
Retrieves the current backend frame index.
Definition at line 1455 of file sbgl_backend_vulkan.c.
| float sbgl_gfx_GetGpuTime | ( | sbgl_GfxContext * | ctx | ) |
Retrieves the elapsed GPU time for the previous frame in milliseconds.
| ctx | The graphics context. |
Definition at line 2100 of file sbgl_backend_vulkan.c.
| int32_t sbgl_gfx_GetLastVkResult | ( | sbgl_GfxContext * | ctx | ) |
Retrieves the last VkResult from the backend for error inspection.
| ctx | The graphics context. |
Definition at line 2124 of file sbgl_backend_vulkan.c.
| sbgl_GfxContext * sbgl_gfx_Init | ( | sbgl_Window * | window, |
| struct SblArena * | arena, | ||
| const sbgl_ResourceLimits * | limits, | ||
| bool | enableValidation ) |
Initializes the graphics backend with configurable resource limits.
| window | The platform window handle. |
| arena | The arena for persistent allocations. |
| limits | Pointer to resource limits (must not be NULL). |
| enableValidation | Whether to enable Vulkan validation layers. |
Definition at line 986 of file sbgl_backend_vulkan.c.
| sbgl_Shader sbgl_gfx_LoadShader | ( | sbgl_GfxContext * | ctx, |
| sbgl_ShaderStage | stage, | ||
| const uint32_t * | bytecode, | ||
| size_t | size ) |
Definition at line 1510 of file sbgl_backend_vulkan.c.
| void * sbgl_gfx_MapBuffer | ( | sbgl_GfxContext * | ctx, |
| sbgl_Buffer | buffer ) |
Definition at line 1461 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_MemoryBarrier | ( | sbgl_GfxContext * | ctx, |
| sbgl_BarrierType | type ) |
Definition at line 1876 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_PushConstants | ( | sbgl_GfxContext * | ctx, |
| size_t | size, | ||
| const void * | data ) |
Definition at line 2067 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_Shutdown | ( | sbgl_GfxContext * | ctx | ) |
Definition at line 1039 of file sbgl_backend_vulkan.c.
| void sbgl_gfx_UnmapBuffer | ( | sbgl_GfxContext * | ctx, |
| sbgl_Buffer | buffer ) |
Definition at line 1473 of file sbgl_backend_vulkan.c.