Skip to content

Source Code Structure

Harrand edited this page Jul 30, 2022 · 3 revisions

All Topaz modules share a similar source code structure. However, some are more complicated than others.

All source code needed to build the engine can be found within Topaz/src/tz. Includes are not separated.

Topaz Core

Core libraries can be found within the top-level tz namespace. All of which can be found within tz/core. Behaviour such as windowing, mathematics, memory and containers can all be found here.

Topaz core is richly documented, you can find the documentation for the core libraries here.

Topaz Graphics Library

The graphics library is the most complicated module, because it has platform-dependent code. At present, Topaz supports the following graphics APIs:

  • OpenGL 4.5
  • Vulkan 1.2

The graphics library exposes a high-level interface via the tz::gl namespace. In addition, each graphics API has its own frontend and backend implementation. These are also documented but are not user-facing, those using the engine only need concern themselves with the public API.

The public API can mainly be found in tz/gl/api. This includes renderers, devices and resources. However, specific larger features are not implemented here. The rest of that can be found above the api directory in tz/gl.

Graphics API Specifics

If you intend to understand the graphics library on a deeper level, read on. Otherwise, you need not read this section.

The API is predominately for renderers, devices and resources. Each of these have their own implementations in the graphics API frontend. For example, the implementation for these for OpenGL can be found within tz/gl/impl/frontend/ogl2.

The backend is completely separate from tz::gl and acts more of an abstraction around each graphics API. These can be found in the backend subdirectory in the tz::gl::ogl2 and tz::gl::vk2 namespaces. If a new graphics API is to be supported, creating the backend would be the first step on adding support. The frontend has the responsibility of using the backend to implement the public-facing tz::gl API.