Skip to content
zschzenPublic

About

RHI for OpenGL+ES and Vulkan

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

rhio Logo

rhio

License: zlib C99 Platform
CI Linux OpenGL Linux Vulkan

A minimal, high-performance Rendering Hardware Interface (RHI) for a simpler world. 🍃



Introduction

rhio is a lightweight, single-header Rendering Hardware Interface (RHI) built around an explicit device/backend contract. It enables portable rendering code without hiding backend ownership or lifecycle rules behind a heavy framework.

It currently defines a unified interface for OpenGL 3.3, GLES 2.0/3.0, and Vulkan 1.4.

Features

  • Header-only Architecture: Self-contained integration; implementation via RHIO_IMPLEMENTATION.
  • C99 Compliance: Written in pure C99 for maximum portability across platforms.
  • Backend Selectable: Choose the compiled backend at device creation time.
  • Minimal Overhead: Thin vtable dispatch with a small binary footprint.
  • Extensible: Straightforward vtable hooks for custom backend implementations.

Getting Started

Manual Installation

Simply copy rhio.h to your project. Define the implementation in exactly one source file:

#define RHIO_IMPLEMENTATION
#include "rhio.h"

// ...

Desktop OpenGL builds also need GLEW available to the implementation translation unit and linked into the final binary. The CMake target handles this through glew-cmake.

CMake (via CPM.cmake)

CPMAddPackage(
  NAME rhio
  GITHUB_REPOSITORY zschzen/rhio
  GIT_TAG v0.1.0
)
target_link_libraries(my_project PRIVATE rhio::rhio)

Usage Example

Caution

rhio is a work in progress. APIs and backends may evolve rapidly, and breaking changes are to be expected.

#include "rhio.h"

int main() {
    riDevice device = NULL;

    riDeviceInfo info = RI_DEVICE_INFO_INIT;
    info.base.appName = "My App";
    info.backend = RI_BACKEND_OPENGL;

    riStatus status = rhioCreateDevice(&info, &device);
    if (RI_FAILED(status)) return -1;

    while (running) {
        rhioBeginFrame(device);
        {
          // Rendering logic...
        }
        rhioEndFrame(device);
        rhioPresent(device);
    }

    rhioDestroyDevice(device);
    return 0;
}

Roadmap

  • Core Backends: Finalize OpenGL 3.3 and GLES 3.0 driver implementations.
  • Vulkan: Progress towards Vulkan 1.4 compliance and validation.
  • Resource Management: Implement Buffer, Texture, and PSO handles.
  • Command API: Draw command recording and Render Pass management.

Build Options

Option Description Default
RHIO_BACKEND_OPENGL Enable OpenGL/ES backends ON
RHIO_BACKEND_VULKAN Enable Vulkan backend OFF
LOG_SUPPORT Enable internal logging ON
RHIO_BUILD_EXAMPLES Build project examples ON

📜 License

rhio is licensed under the zlib/libpng license. See LICENSE for more information.

Copyright (c) 2026 - SOHNE, Leandro Peres (@zschzen).

About

RHI for OpenGL+ES and Vulkan

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages