Skip to content

lepsalex/sophon-engine

Repository files navigation

Sophon Engine

An exercise in what's possible.

Renderer Status

RendererScreenshot
Rendered in Engine =)

Development Quick Start

Note: Only the Windows platform is really supported ATM but Linux support shouldn't be to much of an issue if/when that need arises

  1. Clone the repo
  2. Run either /Scripts/Setup.bat or /Scripts/Setup.sh depending on your plaform (Python3 required)
  3. Open the VisualStudio Project
  4. Profit (or just build/run)

Project Goals

  • Entry-point - launch the engine from a client
  • Application Layer - app life-cycle, time, etc
    • Create window
    • Subscribe to window events
      • Close
      • Resize
    • Timestep/Deltatime
  • Window Layers
    • Basic layer and layer-stack classes
      • Update layers bottom-up
      • Propagate input/events top-down through layers
      • Refactor/Review
  • Input
    • Poll user input
    • Key codes
    • Mouse codes
    • Decouple key/mouse codes from GLFW?
  • Event System
    • Basic synchronous event system (starting out)
    • Buffered event system (non-blocking)
    • Propagate through layers
  • Renderer
    • High-level API
      • Init
      • Shutdown
      • OnWindowResize
      • BeginScene
      • EndScene
      • Submit
      • GetAPI (RendererAPI)
    • Generic Abstractions
      • VertexBuffer
      • VertexBufferLayout
      • IndexBuffer
      • VertexArray
      • Shader
      • Texture
        • Texture2D
    • OpenGL Renderer
      • VertexBuffer
      • VertexBufferLayout
      • IndexBuffer
      • VertexArray
      • Shader
      • Texture
        • Texture2D
    • Renderer2D
      • Init/Setup
      • DrawQuad
      • Batching
      • Basic Stats
      • Draw Sprites (ECS)
    • Renderer (3D)
      • Init/Setup
      • Batching
    • Framebuffer
      • Bind/unbind as render target
    • Camera
      • Base Camera
      • Editor Camera
      • Scene Camera (ECS Managed)
      • 3D Orthographic
      • 3D Perspective
  • RendererAPI Abstraction
    • Ability to swap RendererAPI
    • Generic RendererAPI
      • SetViewport
      • SetClearColor
      • Clear
      • DrawCall
      • Renderer Submission
    • OpenGL RendererAPI
      • SetViewport
      • SetClearColor
      • Clear
      • DrawCall (DrawIndexed)
      • Renderer Submission
  • Editor
    • Editor "App"
    • ImGui dockspace setup (renderer base)
    • Viewport for main render target
  • Debugging Support
    • Logging
    • Instrumented Profiling (Chrome)
      • Basic ImGui Support
    • Editor RenderStats panel
  • Entity Component System (ECS)
    • Entity
    • Basic Components
  • Scenes
    • Entity API
    • Copy API
    • OnUpdateRuntime
    • OnUpdateEditor
    • Pause/Step ECS
  • Scripting Language - C#, Lua, ???
  • Memory - allocator, tracking, etc
  • Physics
  • Shader Compilation
    • SPIR-V Cross
    • Vulkan GLSL -> OpenGL GLSL
    • Vulkan GLSL -> Metal MSL
  • Build System / Custom File Format
    • PreMake

Application Profiling

Sophon Engine can be profiled by enabling the SFN_PROFILE flag. The Premake generated DebugProfile configuration will set this for you or you can manually enable it in the Debug/Instrumentor.h file. When enabled, execution times will be recorded for many of the core functions. The "client" app can also use the same macros to debug it's own methods:

  • SFN_PROFILE_SCOPE(name) - enables the capturing of metrics for all code executing within the current scope {}
  • SFN_PROFILE_FUNCTION() - enables the capturing of metrics for all code executing within the functions scope fn() {}

Running the application with the profiler enabled will generate JSON files for startup, runtime, and shutdown, which can be read via the Chrome Tracing to visualize the application performance and easily identify potential bottlenecks.

  1. Open Chrome to: chrome://tracing/
  2. Drag or Load the file you want to visualize, example: Sophon-Profiler-Data-Runtime.json
  3. You can use W and S to zoom in and out, mouse left-click and drag to pan the timeline
  4. Happy Profiling!

RendererScreenshot
Example Runtime Profiling