BAHAMUT

A modern graphics API for the next generation

Key Features

Low-Level Control

Just one level above Vulkan in terms of verbosity, giving complete control over memory, resources and synchronization.

Plugin Architecture

Design your own renderer implementation through the plugin system. Choose between Vulkan, DirectX 12 or create custom backends.

Highly Performant

Written with high-performance in mind, focusing on minimal abstraction overhead.

Resource Management

Handle-based resource system with explicit lifetime management. Full control over buffer and texture creation and usage.

Command Recording

Flexible command buffer system supporting multi-threaded recording and explicit synchronization primitives.

Debug Features

Built-in validation layers, debug naming, and performance profiling support through graphics debugging tools.

Technical Overview

Forward+ Pipeline

    // Bahamut is continuously evolving,
    // the following snippet is not a final representation of the API.
    
    // Setup Forward+ pipeline with clustered lighting
    PipelineInfo pipelineInfo;
    pipelineInfo.vertexShader = LoadShader("shaders/forward_plus.vert");
    pipelineInfo.fragmentShader = LoadShader("shaders/forward_plus.frag");
    pipelineInfo.depthStencilState.depthTest = true;
    pipelineInfo.rasterizationState.cullMode = CullMode::BACK;
    
    // Define vertex attributes for position, normal, uv
    pipelineInfo.vertexLayout = {
        { 0, Format::RGB_F32, 0 },   // position
        { 1, Format::RGB_F32, 12 },  // normal
        { 2, Format::RG_F32, 24 }    // uv
    };
    
    // Descriptor bindings for material data, lights, etc.
    pipelineInfo.bindings = {
        { 0, 1, DescriptorType::UNIFORM_BUFFER },  // Camera/Scene data
        { 1, 1, DescriptorType::STORAGE_BUFFER },  // Light grid
        { 2, 1, DescriptorType::STORAGE_BUFFER }   // Light list
    };
    
    PipelineHandle pipeline = renderer.CreatePipeline(pipelineInfo);

Debug Markers

    // Bahamut is continuously evolving,
    // the following snippet is not a final representation of the API.

    // Group related commands with debug markers
    cmdList.BeginMarker("Shadow Pass");
    {
        cmdList.BeginRenderPass(shadowPass);
        cmdList.BindPipeline(shadowPipeline);
        
        for(const auto& mesh : meshes) {
            cmdList.PushMarker(mesh.GetName());  // Label specific mesh draws
            cmdList.BindVertexBuffer(mesh.GetVertexBuffer());
            cmdList.BindIndexBuffer(mesh.GetIndexBuffer());
            cmdList.DrawIndexed(mesh.GetIndexCount());
            cmdList.PopMarker();
        }
        
        cmdList.EndRenderPass();
    }
    cmdList.EndMarker();
    
    // Debug regions show up in tools like RenderDoc!
    cmdList.BeginMarker("Main Pass");
    {
        cmdList.BeginRenderPass(mainPass);
        // ... main scene rendering ...
    }

Depth Pre-Pass

    // Bahamut is continuously evolving,
    // the following snippet is not a final representation of the API.
    
    // Early Z optimization with depth pre-pass
    PipelineInfo depthPipelineInfo;
    depthPipelineInfo.vertexShader = LoadShader("shaders/depth_only.vert");

    // Setup depth state
    depthPipelineInfo.depthStencilState.depthTest = true;
    depthPipelineInfo.depthStencilState.depthWrite = true;
    depthPipelineInfo.blendState.blendEnabled = false;

    // Position only vertex layout
    depthPipelineInfo.vertexLayout = {
        { 0, Format::RGB_F32, offsetof(DepthPrePassVertex, position) }
    };

    PipelineHandle depthPipeline = renderer.CreatePipeline(depthPipelineInfo);

    // ...Inside the render loop...

    // Execute depth and main passes
    cmdList.BeginRenderPass(depthPrePass);
    cmdList.BindPipeline(depthPipeline);

    // Render all meshes for depth
    for(const auto& mesh : visibleMeshes) {
        cmdList.BindVertexBuffer(mesh.GetVertexBuffer());
        cmdList.Draw(mesh.GetVertexCount());
    }
    cmdList.EndRenderPass();

    // Main pass with early-Z optimization
    cmdList.BeginRenderPass(mainPass);
    cmdList.BindPipeline(mainPipeline);
    // ... render scene with full shading ...
    cmdList.EndRenderPass();

Coming Soon

Advanced Features

Ray tracing support, mesh shaders, and variable rate shading capabilities

Sample Framework

Comprehensive examples showcasing industry standard graphics techniques and renderer features

Compute Shaders

Support for compute pipelines