Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bf4e9ff
WIP in migrating vk::instance and replacing header includes to using …
SpinnerX Dec 20, 2025
fc51767
Changed path to vk.cppm to correct directory name
SpinnerX Dec 20, 2025
99f57cd
Replaced headers in demos and vk::physical_device to C++ modules
SpinnerX Dec 20, 2025
2cee7d4
Added migrated logical devices and queue family modules
SpinnerX Dec 20, 2025
73974f2
Replaced types.hpp with types.cppm to be imported as a module
SpinnerX Dec 20, 2025
14b0c1c
Demo 4 works with migrating vulkan surface code to modules
SpinnerX Dec 20, 2025
c5bad47
Swapchain demo works after migrating to modules
SpinnerX Dec 20, 2025
1d927b1
Migraated vulkan graphics pipeline implementation to be imported as C…
SpinnerX Dec 20, 2025
539ad8b
Made vertex_buffer implementation into a C++ module
SpinnerX Dec 20, 2025
6460615
Applied more changes in making vulkan-cpp wrappers to be imported as …
SpinnerX Dec 20, 2025
d663340
Descriptor sets work after migrating to modules
SpinnerX Dec 20, 2025
7b6ac4c
All demos work after migrating to modules and added the texture imple…
SpinnerX Dec 20, 2025
3407ebf
Added buffer_streams.cppm module
SpinnerX Dec 20, 2025
8095f27
Removed the old header and sources to replaced for using the modules …
SpinnerX Dec 20, 2025
931a828
Removed old headers from the demos
SpinnerX Dec 20, 2025
14e3c09
Version update to 4.0
SpinnerX Dec 20, 2025
5893021
Added github actions CI
SpinnerX Dec 20, 2025
4323e25
Revert "Added github actions CI"
SpinnerX Dec 20, 2025
c112926
Added githuhb actions
SpinnerX Dec 20, 2025
5158d4f
Revert "Added githuhb actions"
SpinnerX Dec 20, 2025
60f42ff
Reapply "Added githuhb actions"
SpinnerX Dec 20, 2025
d837b34
Revert "Reapply "Added githuhb actions""
SpinnerX Dec 20, 2025
d4b8a72
Adding CI
SpinnerX Dec 20, 2025
fe3ce1c
Removing CI from this branch
SpinnerX Dec 20, 2025
a0931d4
Adding CI
SpinnerX Dec 20, 2025
ab06879
Removed .github dir
SpinnerX Dec 20, 2025
c4d89ff
Merge branch 'main' of https://github.com/engine3d-dev/vulkan-cpp int…
SpinnerX Dec 20, 2025
b8d676b
Removed generate_compile_commands() call in cmake file
SpinnerX Dec 29, 2025
ee28f17
Actually removed the generate_compile_commands call because it was or…
SpinnerX Dec 29, 2025
2658d48
Did some cleanup to conanfile.py
SpinnerX Dec 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 43 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ cmake_minimum_required(VERSION 3.27)
project(vulkan-cpp CXX)

build_library(
DIRECTORIES
src
# demos/1-instance
# demos/2-physical-device
# demos/3-logical-device
# demos/4-surface
# demos/5-swapchain
# demos/6-graphics-pipeline
# demos/7-vertex-buffer
# demos/8-index-uniform-buffers
# demos/9-uniforms
# demos/10-textures
# demos/11-depth-buffering
# demos/12-loading-models
DIRECTORIES vulkan-cpp/
demos/1-instance
demos/2-physical-device
demos/3-logical-device
demos/4-surface
demos/5-swapchain
demos/6-graphics-pipeline
demos/7-vertex-buffer
demos/8-index-uniform-buffers
demos/9-uniforms
demos/10-textures
demos/11-depth-buffering
demos/12-loading-models
# demos/13-skybox
# demos/sandbox
ENABLE_TESTS OFF
Expand All @@ -37,6 +36,35 @@ build_library(
tinyobjloader::tinyobjloader
)

generate_compile_commands()
target_sources(${PROJECT_NAME} PUBLIC
FILE_SET CXX_MODULES
TYPE CXX_MODULES
FILES
vulkan-cpp/vk.cppm
vulkan-cpp/types.cppm
vulkan-cpp/utilities.cppm
vulkan-cpp/instance.cppm
vulkan-cpp/physical_device.cppm
vulkan-cpp/device.cppm
vulkan-cpp/device_queue.cppm
vulkan-cpp/surface.cppm
vulkan-cpp/swapchain.cppm
vulkan-cpp/device_present_queue.cppm
vulkan-cpp/command_buffer.cppm
vulkan-cpp/renderpass.cppm
vulkan-cpp/framebuffer.cppm
vulkan-cpp/sample_image.cppm
vulkan-cpp/shader_resource.cppm
vulkan-cpp/pipeline.cppm
vulkan-cpp/buffer_streams.cppm
vulkan-cpp/vertex_buffer.cppm
vulkan-cpp/buffer_streams16.cppm
vulkan-cpp/buffer_streams32.cppm
vulkan-cpp/index_buffer.cppm
vulkan-cpp/uniform_buffer.cppm
vulkan-cpp/descriptor_resource.cppm
vulkan-cpp/texture.cppm
)

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC ./)
20 changes: 11 additions & 9 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import os
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.system.package_manager import Apt, Yum, PacMan, Zypper
from conan.tools.scm import Git
from conan.tools.files import copy
import os

class VulkanCpp(ConanFile):
name = "vulkan-cpp"
version = "3.0"
version = "4.0"
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"

# Putting all of your build-related dependencies here
def build_requirements(self):
self.tool_requires("make/4.4.1")
self.tool_requires("cmake/3.27.1")
self.tool_requires("cmake/4.1.2")
self.tool_requires("ninja/1.13.1")
self.tool_requires("engine3d-cmake-utils/4.0")
self.tool_requires("cmake-modules-toolchain/1.0.3")

# Putting all of your packages here
def requirements(self):
self.requires("glfw/3.4")
self.requires("vulkan-headers/1.3.290.0")
self.requires("imguidocking/2.0")
# self.requires("imguidocking/2.0")
self.requires("glm/1.0.1")
self.requires("stb/cci.20230920")
self.requires("tinyobjloader/2.0.0-rc10")
Expand All @@ -35,6 +31,12 @@ def export_sources(self):
copy(self,"*.hpp", self.recipe_folder, self.export_sources_folder)
copy(self,"*.cpp", self.recipe_folder, self.export_sources_folder)

def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
Expand Down
19 changes: 15 additions & 4 deletions demos/1-instance/application.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#define FMT_HEADER_ONLY
#include <fmt/format.h>
#define GLFW_INCLUDE_VULKAN
#if _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#include <GLFW/glfw3.h>
#include <vulkan-cpp/instance.hpp>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#include <vulkan/vulkan.h>
#else
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
#endif

#include <array>
#include <print>
#include <span>
import vk;


static VKAPI_ATTR VkBool32 VKAPI_CALL
debug_callback(
Expand Down Expand Up @@ -55,7 +66,7 @@ int
main() {
//! @note Just added the some test code to test the conan-starter setup code
if (!glfwInit()) {
fmt::print("glfwInit could not be initialized!\n");
std::print("glfwInit could not be initialized!\n");
return -1;
}

Expand Down
39 changes: 15 additions & 24 deletions demos/10-textures/application.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
#define GLFW_INCLUDE_VULKAN
#if _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#include <vulkan/vulkan.h>
#else
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
#endif

#include <array>
#include <print>

// This is required to select the correct extension for specific platform
#include <vulkan-cpp/imports.hpp>

#include <vulkan-cpp/utilities.hpp>
#include <vulkan-cpp/instance.hpp>
#include <vulkan-cpp/physical_device.hpp>
#include <vulkan-cpp/device.hpp>
#include <vulkan-cpp/device_queue.hpp>
#include <vulkan-cpp/surface.hpp>
#include <vulkan-cpp/swapchain.hpp>
#include <vulkan-cpp/device_present_queue.hpp>
#include <vulkan-cpp/command_buffer.hpp>
#include <vulkan-cpp/renderpass.hpp>
#include <vulkan-cpp/framebuffer.hpp>
#include <vulkan-cpp/sample_image.hpp>

#include <vulkan-cpp/shader_resource.hpp>
#include <vulkan-cpp/pipeline.hpp>
#include <vulkan-cpp/vertex_buffer.hpp>
#include <vulkan-cpp/index_buffer.hpp>
#include <vulkan-cpp/uniform_buffer.hpp>
#include <vulkan-cpp/descriptor_resource.hpp>
#include <vulkan-cpp/texture.hpp>
#include <span>
#include <filesystem>
import vk;

#include <chrono>
#define GLM_FORCE_RADIANS
Expand Down
39 changes: 15 additions & 24 deletions demos/11-depth-buffering/application.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
#define GLFW_INCLUDE_VULKAN
#if _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#include <vulkan/vulkan.h>
#else
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
#endif

#include <array>
#include <print>

// This is required to select the correct extension for specific platform
#include <vulkan-cpp/imports.hpp>

#include <vulkan-cpp/utilities.hpp>
#include <vulkan-cpp/instance.hpp>
#include <vulkan-cpp/physical_device.hpp>
#include <vulkan-cpp/device.hpp>
#include <vulkan-cpp/device_queue.hpp>
#include <vulkan-cpp/surface.hpp>
#include <vulkan-cpp/swapchain.hpp>
#include <vulkan-cpp/device_present_queue.hpp>
#include <vulkan-cpp/command_buffer.hpp>
#include <vulkan-cpp/renderpass.hpp>
#include <vulkan-cpp/framebuffer.hpp>

#include <vulkan-cpp/shader_resource.hpp>
#include <vulkan-cpp/pipeline.hpp>
#include <vulkan-cpp/vertex_buffer.hpp>
#include <vulkan-cpp/index_buffer.hpp>
#include <vulkan-cpp/uniform_buffer.hpp>
#include <vulkan-cpp/descriptor_resource.hpp>
#include <vulkan-cpp/texture.hpp>
#include <vulkan-cpp/sample_image.hpp>
#include <span>
#include <filesystem>
import vk;

#include <chrono>
#define GLM_FORCE_RADIANS
Expand Down
39 changes: 15 additions & 24 deletions demos/12-loading-models/application.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
#define GLFW_INCLUDE_VULKAN
#if _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#include <vulkan/vulkan.h>
#else
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
#endif

#include <array>
#include <print>

// This is required to select the correct extension for specific platform
#include <vulkan-cpp/imports.hpp>

#include <vulkan-cpp/utilities.hpp>
#include <vulkan-cpp/instance.hpp>
#include <vulkan-cpp/physical_device.hpp>
#include <vulkan-cpp/device.hpp>
#include <vulkan-cpp/device_queue.hpp>
#include <vulkan-cpp/surface.hpp>
#include <vulkan-cpp/swapchain.hpp>
#include <vulkan-cpp/device_present_queue.hpp>
#include <vulkan-cpp/command_buffer.hpp>
#include <vulkan-cpp/renderpass.hpp>
#include <vulkan-cpp/framebuffer.hpp>
#include <vulkan-cpp/sample_image.hpp>

#include <vulkan-cpp/shader_resource.hpp>
#include <vulkan-cpp/pipeline.hpp>
#include <vulkan-cpp/vertex_buffer.hpp>
#include <vulkan-cpp/index_buffer.hpp>
#include <vulkan-cpp/uniform_buffer.hpp>
#include <vulkan-cpp/descriptor_resource.hpp>
#include <vulkan-cpp/texture.hpp>
#include <span>
#include <filesystem>
import vk;

#include <chrono>
#define GLM_FORCE_RADIANS
Expand Down
22 changes: 15 additions & 7 deletions demos/2-physical-device/application.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#define GLFW_INCLUDE_VULKAN
#if _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#include <vulkan/vulkan.h>
#else
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
#endif

#include <array>
#include <print>

#define FMT_HEADER_ONLY
#include <fmt/format.h>
#include <GLFW/glfw3.h>
#include <vulkan-cpp/instance.hpp>
#include <vulkan-cpp/physical_device.hpp>
#include <span>
import vk;

static VKAPI_ATTR VkBool32 VKAPI_CALL
debug_callback(
Expand Down Expand Up @@ -57,7 +65,7 @@ int
main() {
//! @note Just added the some test code to test the conan-starter setup code
if (!glfwInit()) {
fmt::print("glfwInit could not be initialized!\n");
std::print("glfwInit could not be initialized!\n");
return -1;
}

Expand Down
24 changes: 15 additions & 9 deletions demos/3-logical-device/application.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#define GLFW_INCLUDE_VULKAN
#if _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#include <vulkan/vulkan.h>
#else
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
#endif

#include <array>
#include <print>
#include <span>
import vk;

#define FMT_HEADER_ONLY
#include <fmt/format.h>
#include <GLFW/glfw3.h>
#include <vulkan-cpp/utilities.hpp>
#include <vulkan-cpp/instance.hpp>
#include <vulkan-cpp/physical_device.hpp>
#include <vulkan-cpp/device.hpp>
#include <vulkan-cpp/device_queue.hpp>

static VKAPI_ATTR VkBool32 VKAPI_CALL
debug_callback(
Expand Down Expand Up @@ -60,7 +66,7 @@ int
main() {
//! @note Just added the some test code to test the conan-starter setup code
if (!glfwInit()) {
fmt::print("glfwInit could not be initialized!\n");
std::print("glfwInit could not be initialized!\n");
return -1;
}

Expand Down
27 changes: 15 additions & 12 deletions demos/4-surface/application.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
#define GLFW_INCLUDE_VULKAN
#if _WIN32
#define VK_USE_PLATFORM_WIN32_KHR
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#include <vulkan/vulkan.h>
#else
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
#endif

#include <array>
#include <print>

#include <vulkan-cpp/imports.hpp>

#define FMT_HEADER_ONLY
#include <fmt/format.h>
#include <vulkan-cpp/utilities.hpp>
#include <vulkan-cpp/instance.hpp>
#include <vulkan-cpp/physical_device.hpp>
#include <vulkan-cpp/device.hpp>
#include <vulkan-cpp/device_queue.hpp>
#include <vulkan-cpp/surface.hpp>
#include <span>
import vk;

static VKAPI_ATTR VkBool32 VKAPI_CALL
debug_callback(
Expand Down Expand Up @@ -62,7 +65,7 @@ int
main() {
//! @note Just added the some test code to test the conan-starter setup code
if (!glfwInit()) {
fmt::print("glfwInit could not be initialized!\n");
std::print("glfwInit could not be initialized!\n");
return -1;
}

Expand Down
Loading