Skip to content

Vulkan-based graphics framwork designed for game development and graphics applications on Linux.

Notifications You must be signed in to change notification settings

K1ngst0m/Aphrodite

Repository files navigation

Aphrodite

(Work-In-Progress…)

Aphrodite is a high-performance, Vulkan-based graphics engine designed for game development and graphics applications on Linux.

https://raw.githubusercontent.com/k1ngst0m/assets_dir/master/.github/aphrodite/screenshot.png

Features

  • Vulkan
  • Mesh Shading Support
  • Render Graph
  • Async Resource Management
  • Multi-threading, Job System
  • Scene Management
  • Built-in Windowing, Input, Event Support
  • UI Support
  • Shader Reflections
  • Application Framework

Cloning

To clone the Aphrodite repository, execute the following commands:

git clone https://github.com/K1ngst0m/Aphrodite -b next
cd Aphrodite

Building and Running

To build and run the project, use the following commands:

cmake -B build && cmake --build build -- -j$(nproc)
./build/bin/xxx

Usage

For complete and most recent examples, please refer to the examples/xxxx/ directory.

  • Resource Loading
    // loading vertex buffer
    aph::BufferLoadInfo loadInfo{
        .debugName  = "triangle::vertexBuffer",
        .data       = vertexArray.data(),
        .createInfo = {.size  = static_cast<uint32_t>(vertexArray.size() * sizeof(vertexArray[0])),
                        .usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT}};
    
    m_pResourceLoader->loadAsync(loadInfo, &m_pVB);
    
    // loading texture
    
    aph::ImageLoadInfo loadInfo{.data       = "texture://container2.png",
                                .createInfo = {
                                    .alignment = 0,
                                    .arraySize = 1,
                                    .usage     = VK_IMAGE_USAGE_SAMPLED_BIT,
                                    .domain    = aph::ImageDomain::Device,
                                    .imageType = VK_IMAGE_TYPE_2D,
                                }};
    m_pResourceLoader->loadAsync(loadInfo, &m_pImage);
    
    // loading shader
    aph::ShaderLoadInfo shaderLoadInfo{.stageInfo =
            {
              {aph::ShaderStage::VS, {"shader_slang://triangle.slang"}},
              {aph::ShaderStage::FS, {"shader_slang://triangle.slang"}},
            }};
    m_pResourceLoader->loadAsync(shaderLoadInfo, &m_pProgram);
    
    // ...
    
    // wait for resource loading complete
    m_pResourceLoader->wait();
        
  • Frame Graph Operations
    // record graph execution
    m_renderer->recordGraph([this](auto* graph) {
        auto drawPass = graph->createPass("drawing quad with texture", aph::QueueType::Graphics);
        drawPass->setColorOutput("render target",
                                    {
                                        .extent = {m_pSwapChain->getWidth(), m_pSwapChain->getHeight(), 1},
                                        .format = m_pSwapChain->getFormat(),
                                    });
        // import external resource
        drawPass->addTextureInput("container texture", m_pImage);
    
        drawPass->recordExecute([this](auto* pCmd) {
            pCmd->bindVertexBuffers(m_pVB);
            pCmd->bindIndexBuffers(m_pIB);
            pCmd->setResource({m_pImage}, 0, 0);
            pCmd->setResource({m_pSampler}, 0, 1);
            pCmd->setProgram(m_pProgram);
            pCmd->insertDebugLabel({
                .name  = "draw a quad with texture",
                .color = {0.5f, 0.3f, 0.2f, 1.0f},
            });
            pCmd->drawIndexed({6, 1, 0, 0, 0});
        });
    });
    
    ...
    
    // render loop
    {
        ...
        m_renderer->update();
        m_renderer->render();
        ...
    }
        

Third Party Libraries

About

Vulkan-based graphics framwork designed for game development and graphics applications on Linux.

Topics

Resources

Stars

Watchers

Forks