diff --git a/CMakeLists.txt b/CMakeLists.txt index f82894244d97c351d31755d8d5146116b74a1496..f66070ef15fa13ad4c7f891c991878ad74eef107 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,3 +31,8 @@ if (TARGET aion) target_link_libraries(typed-graphics PUBLIC aion) target_compile_definitions(typed-graphics PUBLIC TG_PROFILE_AION) endif() + +if (TARGET volk) + target_link_libraries(typed-graphics PRIVATE volk) + target_compile_definitions(typed-graphics PUBLIC TG_BACKEND_VULKAN) +endif() diff --git a/README.md b/README.md index e17f6f7e4782e2147991f6fb0f9f82b505ca936f..ee7e528ed0acaa09e3c3623f164be0abe5716f28 100644 --- a/README.md +++ b/README.md @@ -17,23 +17,48 @@ Graphics library with strongly typed interfaces. `typed-graphics` expects dependencies as CMake targets. +### Quickstart + +Vulkan example (with some recommended dependencies): + +``` +mkdir extern +cd extern +git submodule add https://github.com/zeux/volk.git +git submodule add https://www.graphics.rwth-aachen.de:9000/ptrettner/typed-geometry.git +git submodule add https://www.graphics.rwth-aachen.de:9000/ptrettner/typed-graphics.git +git submodule add https://www.graphics.rwth-aachen.de:9000/ptrettner/polymesh.git +git submodule add https://www.graphics.rwth-aachen.de:9000/ptrettner/imgui-lean.git +git submodule add https://github.com/glfw/glfw.git +``` + +Optionals: + +``` +git submodule add https://github.com/g-truc/glm.git +git submodule add https://github.com/google/googletest.git +git submodule add https://github.com/emil-e/rapidcheck.git +``` + ### Required -* ??? +* `typed-geometry` math library ### Backend Dependencies -* TODO: vanilla vulkan +(Don't forget to install the vulkan SDK) + +* `volk` Vulkan loader * `lava` Vulkan library * `glow` OpenGL library ### Optional -* `typed-geometry` math library * `glm` math library * `polymesh` mesh library * `imgui` UI library * `aion` profiling library +* `glfw` window library ## CMake Usage diff --git a/src/tg/backend/_backend.hh b/src/tg/backend/_backend.hh new file mode 100644 index 0000000000000000000000000000000000000000..f220b7e2454c14b6cb3d97d9df27bb84d0c226af --- /dev/null +++ b/src/tg/backend/_backend.hh @@ -0,0 +1,19 @@ +#pragma once + +#include <tg/typed-graphics-lean.hh> + +namespace tg +{ +namespace backend +{ +SharedBackend vulkan(); +// SharedBackend glow(); +// SharedBackend lava(); +// SharedBackend opengl(); +} + +class Backend +{ + virtual ~Backend() {} +}; +} // namespace tg \ No newline at end of file diff --git a/src/tg/backend/backend.hh b/src/tg/backend/backend.hh deleted file mode 100644 index 60eba8332d15f7af56b3c661dac7034c4174b910..0000000000000000000000000000000000000000 --- a/src/tg/backend/backend.hh +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -namespace tg -{ -class Backend -{ - virtual ~Backend() {} -}; -} // namespace tg \ No newline at end of file diff --git a/src/tg/backend/vulkan/VulkanBackend.cc b/src/tg/backend/vulkan/VulkanBackend.cc new file mode 100644 index 0000000000000000000000000000000000000000..f38e75d2d7af49cf154807f17065357448fb1e5c --- /dev/null +++ b/src/tg/backend/vulkan/VulkanBackend.cc @@ -0,0 +1,9 @@ +#include "VulkanBackend.hh" + +#if TG_BACKEND_VULKAN + +// vulkan loader +#include <volk.h> + + +#endif \ No newline at end of file diff --git a/src/tg/backend/vulkan/VulkanBackend.hh b/src/tg/backend/vulkan/VulkanBackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..37943b3deecb9506046b39f9f3a6f430be902391 --- /dev/null +++ b/src/tg/backend/vulkan/VulkanBackend.hh @@ -0,0 +1,16 @@ +#pragma once + +#if TG_BACKEND_VULKAN + +#include "../Backend.hh" + +namespace tg +{ +namespace backend +{ +class VulkanBackend : public Backend +{ +}; +} +} // namespace tg +#endif diff --git a/src/tg/backend/vulkan/vulkan-backend.cc b/src/tg/backend/vulkan/vulkan-backend.cc deleted file mode 100644 index 0ffdd02fcbce683e436c0030ffe0517135c6ceda..0000000000000000000000000000000000000000 --- a/src/tg/backend/vulkan/vulkan-backend.cc +++ /dev/null @@ -1 +0,0 @@ -// TODO \ No newline at end of file