Skip to content

externalhost0/Mythril

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mythril Framework

Mythril is C++20 Vulkan rendering framework for Windows, Linux, and MacOS. It aims to provide a easy to create and highly abstracted API for Vulkan, aswell as some bonus features described below.

Features:

  • RenderGraph implementation, automatically builds and optimizes your described frame.
  • Bindless design for textures & samplers.
  • Automatic shader reflection.
  • Abstracted and easy to use resource descriptors.
  • RAII Object System, all Vulkan objects are cleaned up automatically.
  • Supported plugin system for commonly used dev tools, currently includes ImGui and Tracy.

Sample 07 Screenshot

Minimal Example:

int main() {
	auto ctx = mythril::CTXBuilder{}
	.set_vulkan_cfg({
		.app_name = "Cool App Name",
		.engine_name = "Cool Engine Name"
	})
	.set_window_spec({
		.title = "Cool Window Name",
		.mode = mythril::WindowMode::Windowed,
		.width = 640,
		.height = 480,
		.resizeable = false,
	})
	.with_default_swapchain()
	.build();

	mythril::RenderGraph graph;
	graph.addGraphicsPass("main")
	.attachment({
		.texDesc = ctx->getBackBufferTexture(),
		.clearValue = {1, 0, 0, 1},
		.loadOp = mythril::LoadOp::CLEAR,
		.storeOp = mythril::StoreOp::STORE
	})
	.setExecuteCallback([&](mythril::CommandBuffer& cmd) {
		// do absolutely nothing, just begin and end a pass
		cmd.cmdBeginRendering();
		cmd.cmdEndRendering();
	});

	graph.compile(*ctx);

	bool quit = false;
	while(!quit) {
		SDL_Event e;
		while (SDL_PollEvent(&e)) {
			if (e.type == SDL_EVENT_QUIT) quit = true;
		}

		mythril::CommandBuffer& cmd = ctx->openCommand(mythril::CommandBuffer::Type::Graphics);
		graph.execute(cmd);
		ctx->submitCommand(cmd);
	}
	return 0;
}

Minimal Example Screenshot

Building

  • C++ 20 (Tested on clang 16.0.0 & gcc 13.3.0)
  • CMake 3.28+
  • Vulkan SDK 1.4.335.0+

Installing

You can easily include with CPM.

CPMAddPackage(
    NAME mythril
    GITHUB_REPOSITORY "externalhost0/Mythril"
    GIT_TAG main
)

You could also clone as a submodule and add as a subdirectory.

add_subdirectory(mythril)

CMake Options

Option Default Description
MYTH_RUN_SAMPLES ON Enables sample apps.
MYTH_ENABLE_IMGUI_STANDARD OFF Installs ImGui (Main Branch) and enables mythril's ImGuiPlugin
MYTH_ENABLE_IMGUI_DOCKING OFF Installs ImGui (Docking Branch) and enables mythril's ImGuiPlugin
MYTH_ENABLE_TESTS OFF Builds tests directory to be run by CMake.
MYTH_ENABLE_TRACY OFF Installs Tracy and enabled mythrils' TracyPlugin
MYTH_ENABLE_TRACY_GPU OFF Requires ENABLE_TRACY to be ON, allows GPU timing (CURRENTLY EXPERIMENTAL)

Note: MYTH_ENABLE_IMGUI_STANDARD and MYTH_ENABLE_IMGUI_DOCKING are mutually exclusive!

License

This project is distributed under the Mozilla Public License Version 2.0, please see LICENSE.txt for more.

Acknowledgments

  • LightweightVK - Basically why Mythril exists, I loved how simply lightweightvk is but found we could abstract even more out of it.

About

A High-level Vulkan Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published