Skip to content

What's New in v0.7.0-beta

Version 0.7.0-beta introduces a modern GPU-accelerated renderer alongside major architectural improvements for better performance and flexibility.

Release Highlights

  • SDL3 GPU Renderer - Modern shader-based rendering with Vulkan/Metal/D3D11/D3D12 support
  • Rendering Backends - Choose between GPU and Legacy renderer at runtime
  • EventBus Core Integration - Moved to Brine2D.Core for global event handling
  • Window Events - Built-in support for window resize and lifecycle events
  • GPU Driver Selection - Configure preferred graphics API

Major Features

1. SDL3 GPU Renderer

The new SDL3GPURenderer provides modern, shader-based rendering with cross-platform GPU API support.

Key Features: - Modern GPU APIs: Vulkan, Metal, D3D11, D3D12 - Shader-based rendering: Custom shader pipeline - 10,000+ vertex batching: High-performance sprite rendering - Cross-platform: Automatic API selection per platform

Example:

builder.Services.AddSDL3Rendering(options =>
{
    options.Backend = GraphicsBackend.GPU;  // New GPU renderer (default)
    options.PreferredGPUDriver = "Vulkan"; // Optional: force Vulkan
});

Benefits: - Faster rendering for complex scenes - Better texture management - Modern GPU features - Future-proof architecture


2. Rendering Backend Selection

New GraphicsBackend enum allows runtime renderer selection.

Available Backends:

Backend Description When to Use
GPU Modern shader-based renderer (default) Most games, best performance
LegacyRenderer Classic SDL_Renderer API Compatibility, older systems
Auto Automatically selects GPU Recommended for new projects

Configuration:

{
  "Rendering": {
    "Backend": "GPU",
    "WindowTitle": "My Game",
    "WindowWidth": 1280,
    "WindowHeight": 720,
    "PreferredGPUDriver": null  // Auto-select, or "Vulkan"/"Metal"/"D3D11"/"D3D12"
  }
}
builder.Services.AddSDL3Rendering(options =>
{
    builder.Configuration.GetSection("Rendering").Bind(options);
});

Switching Backends:

// GPU renderer (recommended)
options.Backend = GraphicsBackend.GPU;

// Legacy renderer (compatibility)
options.Backend = GraphicsBackend.LegacyRenderer;

// Auto-select (defaults to GPU)
options.Backend = GraphicsBackend.Auto;

3. EventBus Moved to Core

EventBus relocated from Brine2D.ECS to Brine2D.Core for global accessibility.

Before (v0.6.0):

using Brine2D.ECS; // Old location

public class MyScene : Scene
{
    private readonly EventBus _eventBus;

    public MyScene(EventBus eventBus) // Only available with ECS
    {
        _eventBus = eventBus;
    }
}

After (v0.7.0):

using Brine2D.Core; // New location

public class MyScene : Scene
{
    private readonly EventBus? _eventBus; // Optional, available globally

    public MyScene(EventBus? eventBus) // Works without ECS
    {
        _eventBus = eventBus;
    }
}

Registration:

// EventBus is now optional
builder.Services.AddSingleton<EventBus>();

Benefits: - Use events without ECS dependency - Available in all scenes and systems - Cleaner architecture


4. Window Lifecycle Events

Built-in window events for responsive rendering.

New Events:

// Window resized event
public record WindowResizedEvent(int Width, int Height);

// Available in Brine2D.SDL.Common.Events namespace

Example Usage:

using Brine2D.Core;
using Brine2D.SDL.Common.Events;

public class ResponsiveScene : Scene
{
    private readonly EventBus? _eventBus;
    private readonly IRenderer _renderer;

    public ResponsiveScene(
        EventBus? eventBus,
        IRenderer renderer,
        ILogger<ResponsiveScene> logger) : base(logger)
    {
        _eventBus = eventBus;
        _renderer = renderer;
    }

    protected override void OnInitialize()
    {
        // Subscribe to window resize
        _eventBus?.Subscribe<WindowResizedEvent>(OnWindowResized);
    }

    private void OnWindowResized(WindowResizedEvent evt)
    {
        Logger.LogInformation("Window resized to {Width}x{Height}", 
            evt.Width, evt.Height);

        // Update camera, UI layout, etc.
        UpdateUILayout(evt.Width, evt.Height);
    }

    protected override void OnDispose()
    {
        // Clean up subscription
        _eventBus?.Unsubscribe<WindowResizedEvent>(OnWindowResized);
    }
}

Renderer Integration:

Both renderers now automatically subscribe to WindowResizedEvent for viewport updates.


5. GPU Driver Selection

Configure preferred graphics API for the GPU renderer.

Options:

builder.Services.AddSDL3Rendering(options =>
{
    options.Backend = GraphicsBackend.GPU;

    // Force specific GPU API
    options.PreferredGPUDriver = "Vulkan";  // Vulkan
    // OR
    options.PreferredGPUDriver = "Metal";   // Metal (macOS/iOS)
    // OR
    options.PreferredGPUDriver = "D3D11";   // Direct3D 11 (Windows)
    // OR
    options.PreferredGPUDriver = "D3D12";   // Direct3D 12 (Windows)
    // OR
    options.PreferredGPUDriver = null;      // Auto-select (recommended)
});

Platform Defaults: - Windows: D3D11 or D3D12 - macOS/iOS: Metal - Linux: Vulkan - Android: Vulkan

When to Override: - Testing specific GPU APIs - Performance comparison - Known driver issues - Development debugging


Breaking Changes

EventBus Namespace Change

Action Required: Update using statements if using EventBus.

// Old (v0.6.0)
using Brine2D.ECS;

// New (v0.7.0)
using Brine2D.Core;

Migration:

  1. Find and replace: using Brine2D.ECS;using Brine2D.Core; (where EventBus is used)
  2. Make EventBus optional: EventBus eventBusEventBus? eventBus
  3. Register EventBus if needed: builder.Services.AddSingleton<EventBus>();

Renderer Constructor Signature

Renderers now accept optional EventBus parameter.

If you manually instantiate renderers (rare):

// Old (v0.6.0)
var renderer = new SDL3Renderer(
    logger,
    loggerFactory,
    options,
    fontLoader);

// New (v0.7.0)
var renderer = new SDL3Renderer(
    logger,
    loggerFactory,
    options,
    fontLoader,
    eventBus);  // New optional parameter

// Or with GPU renderer
var gpuRenderer = new SDL3GPURenderer(
    logger,
    loggerFactory,
    options,
    fontLoader,
    eventBus);  // New optional parameter

Most users won't need changes - DI handles this automatically.


Upgrade Guide

Step 1: Update Configuration

Add Backend option to gamesettings.json:

{
  "Rendering": {
    "Backend": "GPU",
    "WindowTitle": "My Game",
    "WindowWidth": 1280,
    "WindowHeight": 720
  }
}

Step 2: Update EventBus Imports

Replace old namespace:

// Find this:
using Brine2D.ECS;

// Replace with (only where EventBus is used):
using Brine2D.Core;

Step 3: Optional - Register EventBus

If using custom events:

builder.Services.AddSingleton<EventBus>();

Step 4: Test Your Game

  1. Run with GPU renderer (default)
  2. Test window resizing
  3. Verify graphics display correctly

Performance Improvements

GPU Renderer Benchmarks

Comparison vs Legacy Renderer (same hardware):

Scenario Legacy Renderer GPU Renderer Improvement
1,000 sprites 60 FPS 60 FPS -
5,000 sprites 45 FPS 60 FPS 33% faster
10,000 sprites 25 FPS 60 FPS 140% faster
Texture switches Expensive Optimized Reduced overhead

GPU Renderer is recommended for: - Games with 1,000+ sprites - Complex particle systems - Dynamic lighting/effects - Modern hardware

Legacy Renderer is suitable for: - Simple 2D games - Older hardware - Compatibility requirements


Migration Checklist

  • [ ] Update gamesettings.json with Backend option
  • [ ] Change using Brine2D.ECS; to using Brine2D.Core; (for EventBus)
  • [ ] Optional: Register EventBus if using custom events
  • [ ] Test with GPU renderer (default)
  • [ ] Verify window resizing works correctly
  • [ ] Check sprite rendering performance
  • [ ] Test on target platforms

Documentation Updates

Updated guides for v0.7.0:


Known Issues

  1. GPU Renderer on very old hardware - May fall back to software rendering
  2. Solution: Use Backend = "LegacyRenderer"

  3. Metal support on macOS - Requires macOS 10.15+

  4. Solution: System requirement, or use Legacy renderer

  5. Vulkan on Windows 7 - Not supported

  6. Solution: Upgrade to Windows 10+, or use PreferredGPUDriver = "D3D11"

Future Plans

Coming in future versions:

  • Custom shaders - User-defined rendering effects
  • Render-to-texture - Off-screen rendering
  • Post-processing - Screen effects, filters
  • 3D rendering support - Basic 3D primitives

Feedback

We'd love to hear about your experience with v0.7.0-beta!


Summary

Version 0.7.0-beta focuses on modern rendering architecture:

  • SDL3 GPU Renderer - High-performance, shader-based rendering
  • Backend selection - GPU vs Legacy, configurable
  • EventBus improvements - Global accessibility
  • Window events - Responsive rendering
  • GPU driver control - Fine-tune graphics API

Upgrade today for better performance and modern rendering capabilities!


Changelog

Added

  • SDL3GPURenderer - Modern GPU-accelerated renderer
  • GraphicsBackend enum - Runtime backend selection (GPU/Legacy/Auto)
  • WindowResizedEvent - Window resize event handling
  • PreferredGPUDriver configuration option
  • EventBus in Brine2D.Core namespace

Changed

  • EventBus moved from Brine2D.ECS to Brine2D.Core
  • Renderer constructors accept optional EventBus parameter
  • GPU renderer is now the default backend
  • Both renderers subscribe to window events

Fixed

  • Window resize viewport updates
  • Texture memory management improvements
  • Shader compilation error handling

Deprecated

  • None

Removed

  • None

← Back to What's New | Installation Guide →