Skip to content

NoFr1ends/LLGL

 
 

Repository files navigation

Low Level Graphics Library (LLGL)

License

3-Clause BSD License

Documentation

Progress

Renderer Progress Remarks
OpenGL ~90%
Direct3D 11 ~90%
Direct3D 12 ~50% Experimental state
Vulkan ~50% Experimental state
Metal ~50% Experimental state
Platform Progress Remarks
Windows 100% Tested on Windows 10
GNU/Linux 70% Tested on Kubuntu 16
macOS 70% Tested on macOS Sierra
iOS 1% Currently not compilable
Language Binding Progress Remarks
C# 30% Experimental state

Build Notes

Windows

Visual Studio 2015 or later is required to build LLGL on Windows.

macOS

Xcode 9 or later is required to build LLGL on macOS.

GNU/Linux

The following development libraries are required to build LLGL on GNU/Linux:

  • X11: libx11-dev
  • xf86vidmode: libxxf86vm-dev
  • Xrandr: libxrandr-dev

Thin Abstraction Layer

// Unified Interface:
CommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex);

// OpenGL Implementation:
void GLCommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
    const GLintptr indices = (renderState_.indexBufferOffset + firstIndex * renderState_.indexBufferStride);
    glDrawElements(
        renderState_.drawMode,
        static_cast<GLsizei>(numIndices),
        renderState_.indexBufferDataType,
        reinterpret_cast<const GLvoid*>(indices)
    );
}

// Direct3D 11 Implementation
void D3D11CommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
    context_->DrawIndexed(numIndices, firstIndex, 0);
}

// Direct3D 12 Implementation
void D3D12CommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
    commandList_->DrawIndexedInstanced(numIndices, 1, firstIndex, 0, 0);
}

// Vulkan Implementation
void VKCommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
    vkCmdDrawIndexed(commandBuffer_, numIndices, 1, firstIndex, 0, 0);
}

// Metal implementation
void MTCommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
    if (numPatchControlPoints_ > 0) {
        [renderEncoder_
            drawIndexedPatches:             numPatchControlPoints_
            patchStart:                     static_cast<NSUInteger>(firstIndex) / numPatchControlPoints_
            patchCount:                     static_cast<NSUInteger>(numIndices) / numPatchControlPoints_
            patchIndexBuffer:               nil
            patchIndexBufferOffset:         0
            controlPointIndexBuffer:        indexBuffer_
            controlPointIndexBufferOffset:  indexTypeSize_ * (static_cast<NSUInteger>(firstIndex))
            instanceCount:                  1
            baseInstance:                   0
        ];
    } else {
        [renderEncoder_
            drawIndexedPrimitives:  primitiveType_
            indexCount:             static_cast<NSUInteger>(numIndices)
            indexType:              indexType_
            indexBuffer:            indexBuffer_
            indexBufferOffset:      indexTypeSize_ * static_cast<NSUInteger>(firstIndex)
        ];
    }
}

About

Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 88.6%
  • Objective-C++ 5.5%
  • CMake 1.8%
  • Objective-C 1.4%
  • TeX 1.3%
  • HLSL 0.6%
  • Other 0.8%