Convert Figma logo to code with AI

GPUOpen-LibrariesAndSDKs logoCauldron

A simple framework for rapid prototyping on Vulkan or Direct3D 12

1,021
87
1,021
12

Top Related Projects

This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

One stop solution for all Vulkan samples

10,880

C++ examples for the Vulkan graphics API

15,844

Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

18,602

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2

8,403

minimal cross-platform standalone C headers

Quick Overview

Cauldron is a framework for developing graphics applications and rendering techniques. It provides a collection of helper classes and functions to simplify the creation of cross-platform graphics applications using DirectX 12 and Vulkan. Cauldron aims to accelerate development by offering a unified interface for common graphics tasks.

Pros

  • Cross-platform support for DirectX 12 and Vulkan
  • Simplifies complex graphics programming tasks
  • Includes various helper classes and utilities for common operations
  • Actively maintained by AMD's GPUOpen initiative

Cons

  • Learning curve for developers new to graphics programming
  • May have limitations for highly specialized or custom rendering techniques
  • Documentation could be more comprehensive for some components
  • Dependency on specific versions of DirectX and Vulkan SDKs

Code Examples

  1. Initializing the Cauldron framework:
#include "Cauldron.h"

int main()
{
    Cauldron::CauldronInit();
    // ... Application code ...
    Cauldron::CauldronShutdown();
    return 0;
}
  1. Creating a simple renderer:
class MyRenderer : public Cauldron::Renderer
{
public:
    void OnCreate(const Cauldron::DeviceCreationParameters& params) override
    {
        // Initialize renderer
    }

    void OnDestroy() override
    {
        // Cleanup resources
    }

    void OnRender(double deltaTime) override
    {
        // Render frame
    }
};
  1. Loading a texture:
Cauldron::Texture* LoadTexture(const char* filename)
{
    Cauldron::TextureLoadInfo loadInfo = {};
    loadInfo.filename = filename;
    loadInfo.generateMips = true;

    return Cauldron::CreateTextureFromFile(loadInfo);
}

Getting Started

  1. Clone the Cauldron repository:

    git clone https://github.com/GPUOpen-LibrariesAndSDKs/Cauldron.git
    
  2. Install required dependencies (DirectX 12 SDK, Vulkan SDK)

  3. Build the project using CMake:

    mkdir build && cd build
    cmake ..
    cmake --build .
    
  4. Include Cauldron headers in your project and link against the built libraries

  5. Initialize Cauldron in your main function:

    #include "Cauldron.h"
    
    int main()
    {
        Cauldron::CauldronInit();
        // Your application code here
        Cauldron::CauldronShutdown();
        return 0;
    }
    

Competitor Comparisons

This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

Pros of DirectX-Graphics-Samples

  • Comprehensive coverage of DirectX 12 features and techniques
  • Official Microsoft samples, ensuring up-to-date and best practice implementations
  • Extensive documentation and comments within the code

Cons of DirectX-Graphics-Samples

  • Focused solely on DirectX, limiting cross-platform development options
  • May have a steeper learning curve for beginners due to its advanced nature
  • Less emphasis on performance optimization compared to Cauldron

Code Comparison

DirectX-Graphics-Samples (D3D12HelloTriangle.cpp):

ComPtr<ID3D12Resource> m_vertexBuffer;
D3D12_VERTEX_BUFFER_VIEW m_vertexBufferView;

// Create the vertex buffer.
{
    // Define the geometry for a triangle.
    Vertex triangleVertices[] =
    {
        { { 0.0f, 0.25f * m_aspectRatio, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } },
        { { 0.25f, -0.25f * m_aspectRatio, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } },
        { { -0.25f, -0.25f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } }
    };

Cauldron (TriangleVS.hlsl):

struct VSInput
{
    float3 Position : POSITION;
    float3 Color : COLOR;
};

struct VSOutput
{
    float4 Position : SV_POSITION;
    float3 Color : COLOR;
};

One stop solution for all Vulkan samples

Pros of Vulkan-Samples

  • Extensive collection of Vulkan samples covering a wide range of topics
  • Official repository maintained by Khronos Group, ensuring up-to-date and accurate implementations
  • Cross-platform support with builds for Windows, Linux, macOS, and Android

Cons of Vulkan-Samples

  • Focused solely on Vulkan, lacking support for other graphics APIs
  • May be overwhelming for beginners due to the large number of samples and advanced topics

Code Comparison

Vulkan-Samples (Initialization):

VkInstanceCreateInfo instance_info = {};
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instance_info.pApplicationInfo = &app_info;
vkCreateInstance(&instance_info, nullptr, &instance);

Cauldron (Initialization):

Device* pDevice = new Device();
pDevice->OnCreate("Cauldron", "Sample", false, nullptr);
SwapChain* pSwapChain = new SwapChain();
pSwapChain->OnCreate(pDevice, 1280, 720);

Cauldron provides a higher-level abstraction for device and swapchain creation, while Vulkan-Samples demonstrates raw Vulkan API usage. Cauldron's approach may be more accessible for beginners, but Vulkan-Samples offers more direct control over the Vulkan implementation.

10,880

C++ examples for the Vulkan graphics API

Pros of Vulkan

  • Extensive collection of Vulkan examples covering various techniques and features
  • Well-documented code with detailed explanations for each example
  • Actively maintained with frequent updates and community contributions

Cons of Vulkan

  • Focused solely on Vulkan, lacking support for other graphics APIs
  • May be overwhelming for beginners due to the large number of examples
  • Less emphasis on creating a reusable framework compared to Cauldron

Code Comparison

Vulkan (Basic triangle rendering):

void buildCommandBuffers()
{
    VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
    VkClearValue clearValues[2];
    clearValues[0].color = defaultClearColor;
    clearValues[1].depthStencil = { 1.0f, 0 };
    VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
    renderPassBeginInfo.renderPass = renderPass;
    renderPassBeginInfo.renderArea.offset.x = 0;
    renderPassBeginInfo.renderArea.offset.y = 0;
    renderPassBeginInfo.renderArea.extent.width = width;
    renderPassBeginInfo.renderArea.extent.height = height;
    renderPassBeginInfo.clearValueCount = 2;
    renderPassBeginInfo.pClearValues = clearValues;
    // ...
}

Cauldron (Basic rendering setup):

void Sample::LoadScene()
{
    m_pGltfLoader = new GLTFCommon();
    if (m_pGltfLoader->Load(m_jsonConfigFile.c_str()) == false)
    {
        MessageBox(NULL, "The selected GLTF file is invalid or can't be found", "Cauldron Viewer", MB_ICONERROR);
        return;
    }
    // ...
}
15,844

Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

Pros of bgfx

  • More mature and widely adopted, with a larger community and ecosystem
  • Supports a broader range of platforms and rendering APIs
  • Offers more low-level control and flexibility for advanced graphics programming

Cons of bgfx

  • Steeper learning curve due to its lower-level nature
  • Less focus on modern rendering techniques and PBR workflows
  • Requires more manual setup and configuration compared to Cauldron

Code Comparison

bgfx example:

bgfx::init(init);
bgfx::setViewClear(0, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x303030ff, 1.0f, 0);
bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height));

Cauldron example:

Device* pDevice = new Device();
SwapChain* pSwapChain = new SwapChain(pDevice);
ResourceViewHeaps* pResourceViewHeaps = new ResourceViewHeaps(pDevice);

bgfx provides a more low-level API with direct control over rendering states, while Cauldron offers a higher-level abstraction with object-oriented design. bgfx requires more explicit setup of rendering parameters, whereas Cauldron handles many of these details internally.

Both libraries aim to simplify cross-platform graphics development, but they cater to different levels of abstraction and use cases. bgfx is better suited for developers who need fine-grained control and maximum performance, while Cauldron is designed for ease of use and rapid prototyping of modern rendering techniques.

18,602

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2

Pros of Filament

  • Cross-platform support: Android, iOS, Windows, macOS, Linux, and WebGL
  • Extensive documentation and examples
  • Active development and community support

Cons of Filament

  • Steeper learning curve due to its comprehensive feature set
  • Larger codebase and potentially higher resource usage
  • Less focus on AMD-specific optimizations

Code Comparison

Filament (Material definition):

material {
    name : "MyMaterial",
    parameters : [
        { type : float3, name : "baseColor" }
    ],
    requires : [
        uv0
    ],
    shadingModel : unlit
}

Cauldron (Material definition):

MaterialInstance* pMaterial = MaterialInstance::CreateMaterialInstance(pDevice, "MyMaterial");
pMaterial->SetParameter("baseColor", float3(1.0f, 0.0f, 0.0f));
pMaterial->SetTexture("albedoMap", pTexture);

Both Filament and Cauldron provide powerful rendering capabilities, but Filament offers broader platform support and more extensive documentation. Cauldron, being developed by AMD, may have better optimizations for AMD hardware. The code examples show different approaches to material definition, with Filament using a more declarative style and Cauldron using a programmatic approach.

8,403

minimal cross-platform standalone C headers

Pros of sokol

  • Lightweight and minimalistic, focusing on simplicity and ease of use
  • Supports multiple platforms (Windows, macOS, Linux, iOS, Android, and web)
  • Single-file header-only libraries for easy integration

Cons of sokol

  • Less comprehensive feature set compared to Cauldron
  • May require more manual setup and configuration for complex rendering scenarios
  • Limited built-in support for advanced graphics techniques

Code Comparison

Sokol (initializing a window and graphics context):

#include "sokol_app.h"
#include "sokol_gfx.h"

sapp_desc sokol_main(int argc, char* argv[]) {
    return (sapp_desc){ .width = 800, .height = 600, .init_cb = init, .frame_cb = frame };
}

Cauldron (initializing a window and graphics context):

#include "Application.h"
#include "Renderer.h"

int main(int argc, char* argv[]) {
    Application app;
    app.Init();
    Renderer renderer;
    renderer.Init(app.GetWindow());
    return app.Run();
}

The code comparison shows that sokol offers a more concise initialization process, while Cauldron provides a more structured approach with separate classes for application and renderer management.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Cauldron

A simple framework for rapid prototyping on Vulkan or DirectX12.

Cauldron was developed by AMD and is used internally to develop prototypes, demos and SDK samples.

Cauldron is compiled as a static library. To see it in action check projects below.

Projects that feature Cauldron

Cauldron Features

  • glTF 2.0 File loader
    • Animation for cameras, objects, skeletons and lights
    • Skinning
      • Baking skinning into buffers (DX12 only)
    • PBR Materials
      • Metallic-Roughness
      • Specular-Glossiness (KHR_materials_pbrSpecularGlossiness)
    • Lighting
      • KHR_lights_punctual extension
        • Point
        • Directional
        • Spot Lights w/ Shadows (up to 4)
      • Image-based Lighting (IBL) CubeMaps
    • Shadow techniques
      • shadow maps (PCF)
      • shadow masks (DX12 only)
  • Configurable GBuffer, supported techniques:
    • Full forward
    • Motion vectors
    • Normals
    • Depth
    • Specular-roughness
    • Diffuse-alpha
  • Postprocessing
    • TAA
    • Bloom
    • HDR/Tonemapping
  • Texture Loaders for DDS (including the BCn formats), JPEG and PNG formats
    • MIP Map generation for powers-of-two textures
  • In-app user interface using Dear ImGui
  • Rendering Resource Management
    • Command Buffer Ring
    • Timestamp Queries
    • Memory Heap Manager (Linear Allocator)
    • Static buffers for VB/IB/CB with suballocation support
    • Dynamic buffers for VB/IB/CB using a ring buffer
  • Debug Rendering
    • Wireframe Bounding Boxes
    • Light Frustums
  • Window management & swapchain creation
    • Fullscreen/Windowed Modes
  • Support for DXC/SM6.x
  • Shader Binary & PSO caching
  • FreeSync :tm: 2 HDR support
  • Multithreading loading & creation of resources
    • Textures & MIP map generation
    • Shader compilation
    • Pipeline creation
  • VK extensions can be enabled from the app side
  • Benchmarking

Directory Structure

  • build : Build scripts & generated solution files/folders
  • libs : Libraries
    • AGS : AMD helper library for querying GPU info
    • VulkanMemoryAllocator : Helper library for memory management with Vulkan applications
    • d3d12x : The D3D12 helper library
    • dxc : DirectX Shader Compiler
    • imgui : Graphical User Interface library
    • json : Library for adding JSON support w/ C++ syntax
    • stb : stb_image.h and stb_image_write.h from stb
  • media : Builtin textures and other data
  • src : Source code files
    • common : Common code used by both DX12/VK
    • DX12 : DirectX12 backend
    • VK : Vulkan backend

Note: more info on the rendering backends can be found in the Readme of their respective folders.

Build

Prerequisites

How-to-Build

  • Run the GenerateSolutions.bat file in the build directory.
  • build/VK and build/DX12 folders will contain the Cauldron_*.sln files
  • Simply build the solution file for the desired API
  • build/DX12/src/DX12/ directory will contain the compiled static library Framework_DX12.lib for DX12 (similar for VK) under the selected configuration (Debug/Release) folder.

Framework Architecture

Every feature in Cauldron has been implemented in a single file using C++11.

The main features could be grouped in 4 categories:

  • Resource managers & loaders
    • Texture loaders - can load DDS, PNG, JPG and any other file supported by the WIC subsystem. It can also create image views.
    • StaticBufferPool - holds vertices and indices for static geometry. It creates a huge buffer and then suballocates chunks from it in a linear fashion. Chunks cannot be freed.
    • DynamicBufferRing - holds constant buffers and also vertices and indices. Same as before but allocation happens in a ring fashion.
    • ResourceViewHeaps - holds the Descriptor Sets.
    • UploadHeap - system memory buffer that holds the texture data to be uploaded to video memory via DMA
    • CommandListRing - allocates a number of command buffers from a ring buffer and returns a ready-to-use command buffer.
    • Device - all the device related code.
  • Renderers
    • GLTF* - loads and renders the model using a certain technique
    • PostProcPS/PS - draws a 2D quad using a custom shader, used by the post processing passes.
    • ImGUI - code for driving the ImGUI
    • Widgets
      • Wireframe - draws a wireframe cube (used for rendering bounding boxes and light/camera frustums)
      • Axis - draws the coordinate axis of a matrix
  • Vulkan specific helpers & setup code
    • InstanceVK - creates an instance and enables the validation layer
    • Extension helpers
      • ExtDebugMarkers - sets up the debug markers
      • ExtFp16 - enables FP16 extension
      • ExtFreeSync2 - enables FreeSync extension
      • ExtValidation - enables the validation layer
  • Commons & OS-specific code
    • Swapchain - handles resizing, fullscreen/windowed modes, etc.
    • FrameworkWindows - creates a window, processes windows message pump

Cauldron was originally written using DX12 and later on ported to Vulkan using the same structure. This would make Cauldron ideal for learning Vulkan if you're coming from DirectX12, or vice versa.

Known Issues

Please bear in mind that in order to keep Cauldron simple we are only covering the most frequently used features (for now).

Please feel free to open an issue for bug reports.

Contribution

Cauldron should be very easy to extend, should you want to contribute to Cauldron, you can open a pull request.

3rd-Party Open Source Projects Used