Conversation
added manual run
Cpp-Linter Report
|
There was a problem hiding this comment.
Cpp-linter Review
Used clang-tidy v19.1.1
Click here for the full clang-tidy patch
diff --git a/demo/main.cpp b/demo/main.cpp
index 4585d80..f737563 100644
--- a/demo/main.cpp
+++ b/demo/main.cpp
@@ -7 +7 @@
-int main([[maybe_unused]] int argc, [[maybe_unused]] char* args[]) {
+auto main([[maybe_unused]] int argc, [[maybe_unused]] char* args[]) -> int {
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp
index 5586b3a..2edcd88 100644
--- a/src/graphics/Graphics.cpp
+++ b/src/graphics/Graphics.cpp
@@ -4 +4 @@ namespace engine::graphics {
-Graphics* Graphics::getInstance() {
+auto Graphics::getInstance() -> Graphics* {
@@ -9,3 +9,3 @@ Graphics* Graphics::getInstance() {
-uint64_t Graphics::create_mesh_instance() {
- std::uint64_t new_index;
- std::uint64_t new_uid;
+auto Graphics::createMeshInstance() -> uint64_t {
+ std::uint64_t new_index = 0;
+ std::uint64_t new_uid = 0;
@@ -13,2 +13,2 @@ uint64_t Graphics::create_mesh_instance() {
- if (!meshes.empty()) {
- auto lastPair = *meshes.rbegin();
+ if (!_meshes.empty()) {
+ auto last_pair = *_meshes.rbegin();
@@ -16,2 +16,2 @@ uint64_t Graphics::create_mesh_instance() {
- new_index = lastPair.second + 1;
- new_uid = lastPair.first + 1;
+ new_index = last_pair.second + 1;
+ new_uid = last_pair.first + 1;
@@ -23 +23 @@ uint64_t Graphics::create_mesh_instance() {
- meshes[new_uid] = new_index;
+ _meshes[new_uid] = new_index;
@@ -30,2 +30,2 @@ uint64_t Graphics::create_mesh_instance() {
-void Graphics::set_mesh_instance_transform([[maybe_unused]] uint64_t rid,
- [[maybe_unused]] glm::mat4 matrix) {
+void Graphics::setMeshInstanceTransform([[maybe_unused]] uint64_t rid,
+ [[maybe_unused]] glm::mat4 matrix) {
@@ -35 +35 @@ void Graphics::set_mesh_instance_transform([[maybe_unused]] uint64_t rid,
-void Graphics::free_mesh_instance(uint64_t rid) {
+void Graphics::freeMeshInstance(uint64_t rid) {
@@ -39 +39 @@ void Graphics::free_mesh_instance(uint64_t rid) {
- meshes.erase(rid);
+ _meshes.erase(rid);
@@ -41,2 +41,2 @@ void Graphics::free_mesh_instance(uint64_t rid) {
- auto it = meshes.find(rid);
- if (it != meshes.end()) {
+ auto it = _meshes.find(rid);
+ if (it != _meshes.end()) {
@@ -47 +47 @@ void Graphics::free_mesh_instance(uint64_t rid) {
- meshes.erase(it);
+ _meshes.erase(it);
@@ -49 +49 @@ void Graphics::free_mesh_instance(uint64_t rid) {
- for (auto& entry : meshes) {
+ for (auto& entry : _meshes) {
diff --git a/src/scene/TransformSystem.cpp b/src/scene/TransformSystem.cpp
index 515f37f..7be5add 100644
--- a/src/scene/TransformSystem.cpp
+++ b/src/scene/TransformSystem.cpp
@@ -7 +7 @@ namespace {
-void UpdateChildrenGlobal(flecs::entity e, const GlobalTransform &t) {
+void updateChildrenGlobal(flecs::entity e, const GlobalTransform &t) {
@@ -9,3 +9,3 @@ void UpdateChildrenGlobal(flecs::entity e, const GlobalTransform &t) {
- auto c = e.get<Child>();
- for (auto &child : c->children) {
- auto *child_transform = child.get<LocalTransform>();
+ const auto *c = e.get<Child>();
+ for (const auto &child : c->children) {
+ const auto *child_transform = child.get<LocalTransform>();
@@ -13,2 +13,2 @@ void UpdateChildrenGlobal(flecs::entity e, const GlobalTransform &t) {
- child_global_transform->TransformMatrix =
- t.TransformMatrix *
+ child_global_transform->transform_matrix =
+ t.transform_matrix *
@@ -24 +24 @@ void UpdateChildrenGlobal(flecs::entity e, const GlobalTransform &t) {
-void CreateChildLocalIfParentSet(flecs::entity e, const Parent &p) {
+void createChildLocalIfParentSet(flecs::entity e, const Parent &p) {
@@ -26 +26 @@ void CreateChildLocalIfParentSet(flecs::entity e, const Parent &p) {
- const auto t = e.get<GlobalTransform>();
+ const auto *const t = e.get<GlobalTransform>();
@@ -28,2 +28,2 @@ void CreateChildLocalIfParentSet(flecs::entity e, const Parent &p) {
- t->TransformMatrix *
- glm::inverse(p.parent.get<GlobalTransform>()->TransformMatrix);
+ t->transform_matrix *
+ glm::inverse(p.parent.get<GlobalTransform>()->transform_matrix);
@@ -36 +36,2 @@ void CreateChildLocalIfParentSet(flecs::entity e, const Parent &p) {
- e.set(LocalTransform{position, rotation, scale.x});
+ e.set(LocalTransform{
+ .position = position, .rotation = rotation, .scale = scale.x});
@@ -40,2 +41,2 @@ void CreateChildLocalIfParentSet(flecs::entity e, const Parent &p) {
-void UpdateChildLocalIfParentChanged(flecs::entity e, const Parent &p) {
- const auto t = e.get<GlobalTransform>();
+void updateChildLocalIfParentChanged(flecs::entity e, const Parent &p) {
+ const auto *const t = e.get<GlobalTransform>();
@@ -43,2 +44,2 @@ void UpdateChildLocalIfParentChanged(flecs::entity e, const Parent &p) {
- t->TransformMatrix *
- glm::inverse(p.parent.get<GlobalTransform>()->TransformMatrix);
+ t->transform_matrix *
+ glm::inverse(p.parent.get<GlobalTransform>()->transform_matrix);
@@ -57 +58 @@ void UpdateChildLocalIfParentChanged(flecs::entity e, const Parent &p) {
-void UpdateChildLocalIfGlobalChanged(flecs::entity e,
+void updateChildLocalIfGlobalChanged(flecs::entity e,
@@ -60 +61 @@ void UpdateChildLocalIfGlobalChanged(flecs::entity e,
- const auto p = e.get<Parent>();
+ const auto *const p = e.get<Parent>();
@@ -62,2 +63,3 @@ void UpdateChildLocalIfGlobalChanged(flecs::entity e,
- t.TransformMatrix *
- glm::inverse(p->parent.get<GlobalTransform>()->TransformMatrix);
+ t.transform_matrix *
+ glm::inverse(
+ p->parent.get<GlobalTransform>()->transform_matrix);
@@ -77 +79 @@ void UpdateChildLocalIfGlobalChanged(flecs::entity e,
-void UpdateChildGlobalIfLocalChanged(flecs::entity e, const LocalTransform &t) {
+void updateChildGlobalIfLocalChanged(flecs::entity e, const LocalTransform &t) {
@@ -79 +81 @@ void UpdateChildGlobalIfLocalChanged(flecs::entity e, const LocalTransform &t) {
- ->TransformMatrix =
+ ->transform_matrix =
@@ -81 +83 @@ void UpdateChildGlobalIfLocalChanged(flecs::entity e, const LocalTransform &t) {
- e.get<Parent>()->parent.get<GlobalTransform>()->TransformMatrix;
+ e.get<Parent>()->parent.get<GlobalTransform>()->transform_matrix;
@@ -116 +118,2 @@ void setLocalFromMatrix(flecs::entity e, const glm::mat4 &mat) {
- e.set<LocalTransform>({position, rotation, scale});
+ e.set<LocalTransform>(
+ {.position = position, .rotation = rotation, .scale = scale});
@@ -120 +123,2 @@ void setLocalFromPosition(flecs::entity e, const glm::vec3 &pos) {
- e.set<LocalTransform>({pos, glm::quat(1, 0, 0, 0), 1});
+ e.set<LocalTransform>(
+ {.position = pos, .rotation = glm::quat(1, 0, 0, 0), .scale = 1});
@@ -124 +128,2 @@ void setLocalFromRotation(flecs::entity e, const glm::quat &rot) {
- e.set<LocalTransform>({glm::vec3(0, 0, 0), rot, 1});
+ e.set<LocalTransform>(
+ {.position = glm::vec3(0, 0, 0), .rotation = rot, .scale = 1});
@@ -128 +133,3 @@ void setLocalFromScale(flecs::entity e, const glm::float64 &scale) {
- e.set<LocalTransform>({glm::vec3(0, 0, 0), glm::quat(1, 0, 0, 0), scale});
+ e.set<LocalTransform>({.position = glm::vec3(0, 0, 0),
+ .rotation = glm::quat(1, 0, 0, 0),
+ .scale = scale});
@@ -131 +138 @@ void setLocalFromScale(flecs::entity e, const glm::float64 &scale) {
-glm::f64mat4 getMatrixFromLocal(flecs::entity e) {
+auto getMatrixFromLocal(flecs::entity e) -> glm::f64mat4 {
@@ -136 +143 @@ glm::f64mat4 getMatrixFromLocal(flecs::entity e) {
- return glm::f64mat4(1.0);
+ return {1.0};
@@ -145 +152 @@ glm::f64mat4 getMatrixFromLocal(flecs::entity e) {
-glm::f64mat4 getMatrixFromLocal(const LocalTransform &t) {
+auto getMatrixFromLocal(const LocalTransform &t) -> glm::f64mat4 {
@@ -349 +356 @@ void setGlobalFromEntity(flecs::entity e, const flecs::entity &parent) {
- e.set(GlobalTransform{parent.get<GlobalTransform>()->TransformMatrix});
+ e.set(GlobalTransform{parent.get<GlobalTransform>()->transform_matrix});
@@ -355 +362 @@ void inverseGlobal(flecs::entity e) {
- transform->TransformMatrix = glm::inverse(transform->TransformMatrix);
+ transform->transform_matrix = glm::inverse(transform->transform_matrix);
@@ -358 +365 @@ void inverseGlobal(flecs::entity e) {
-void TransformSystem(const flecs::world &world) {
+void transformSystem(const flecs::world &world) {
@@ -361 +368 @@ void TransformSystem(const flecs::world &world) {
- .each(UpdateChildrenGlobal);
+ .each(updateChildrenGlobal);
@@ -364 +371 @@ void TransformSystem(const flecs::world &world) {
- .each(CreateChildLocalIfParentSet);
+ .each(createChildLocalIfParentSet);
@@ -367 +374 @@ void TransformSystem(const flecs::world &world) {
- .each(UpdateChildLocalIfParentChanged);
+ .each(updateChildLocalIfParentChanged);
@@ -370 +377 @@ void TransformSystem(const flecs::world &world) {
- .each(UpdateChildLocalIfGlobalChanged);
+ .each(updateChildLocalIfGlobalChanged);
@@ -373 +380 @@ void TransformSystem(const flecs::world &world) {
- .each(UpdateChildGlobalIfLocalChanged);
+ .each(updateChildGlobalIfLocalChanged);
diff --git a/src/scene/MeshSystem.cpp b/src/scene/MeshSystem.cpp
index 087f448..0bfb5ff 100644
--- a/src/scene/MeshSystem.cpp
+++ b/src/scene/MeshSystem.cpp
@@ -5,3 +5,3 @@ namespace {
-void UpdateMesh(flecs::entity e, const GlobalTransform >) {
- engine::graphics::Graphics::getInstance()->set_mesh_instance_transform(
- e.get_mut<MeshComponent>()->MeshID, gt.TransformMatrix);
+void updateMesh(flecs::entity e, const GlobalTransform >) {
+ engine::graphics::Graphics::getInstance()->setMeshInstanceTransform(
+ e.get_mut<MeshComponent>()->mesh_id, gt.transform_matrix);
@@ -10,2 +10,2 @@ void UpdateMesh(flecs::entity e, const GlobalTransform >) {
-void DestroyMesh(const MeshComponent &mc) {
- engine::graphics::Graphics::getInstance()->free_mesh_instance(mc.MeshID);
+void destroyMesh(const MeshComponent &mc) {
+ engine::graphics::Graphics::getInstance()->freeMeshInstance(mc.mesh_id);
@@ -15 +15 @@ void DestroyMesh(const MeshComponent &mc) {
-void MeshSystem(const flecs::world &world) {
+void meshSystem(const flecs::world &world) {
@@ -18 +18 @@ void MeshSystem(const flecs::world &world) {
- .each(UpdateMesh);
+ .each(updateMesh);
@@ -21 +21 @@ void MeshSystem(const flecs::world &world) {
- .each(DestroyMesh);
+ .each(destroyMesh);
diff --git a/src/scene/Camera.cpp b/src/scene/Camera.cpp
index 942b83a..7446111 100644
--- a/src/scene/Camera.cpp
+++ b/src/scene/Camera.cpp
@@ -7,2 +7,2 @@ void Camera::update() {
- const glm::mat4 cameraRotation = getRotationMatrix();
- position += glm::vec3(cameraRotation * glm::vec4(velocity * 0.05f, 0.f));
+ const glm::mat4 camera_rotation = getRotationMatrix();
+ position += glm::vec3(camera_rotation * glm::vec4(velocity * 0.05F, 0.F));
@@ -43,2 +43,2 @@ void Camera::processSDLEvent(const SDL_Event& e) {
- yaw += (float)e.motion.xrel / 200.f;
- pitch -= (float)e.motion.yrel / 200.f;
+ yaw += (float)e.motion.xrel / 200.F;
+ pitch -= (float)e.motion.yrel / 200.F;
@@ -48 +48 @@ void Camera::processSDLEvent(const SDL_Event& e) {
-glm::mat4 Camera::getViewMatrix() const {
+auto Camera::getViewMatrix() const -> glm::mat4 {
@@ -52,4 +52,4 @@ glm::mat4 Camera::getViewMatrix() const {
- const glm::mat4 cameraTranslation =
- glm::translate(glm::mat4(1.f), position);
- const glm::mat4 cameraRotation = getRotationMatrix();
- return glm::inverse(cameraTranslation * cameraRotation);
+ const glm::mat4 camera_translation =
+ glm::translate(glm::mat4(1.F), position);
+ const glm::mat4 camera_rotation = getRotationMatrix();
+ return glm::inverse(camera_translation * camera_rotation);
@@ -58 +58 @@ glm::mat4 Camera::getViewMatrix() const {
-glm::mat4 Camera::getRotationMa!����������<���+auto Camera::getRotationMatrix() const -> glm::mat4 {
@@ -62,4 +62,4 @@ glm::mat4 Camera::getRotationMatrix() const {
- const glm::quat pitchRotation =
- glm::angleAxis(pitch, glm::vec3{1.f, 0.f, 0.f});
- const glm::quat yawRotation =
- glm::angleAxis(yaw, glm::vec3{0.f, -1.f, 0.f});
+ const glm::quat pitch_rotation =
+ glm::angleAxis(pitch, glm::vec3{1.F, 0.F, 0.F});
+ const glm::quat yaw_rotation =
+ glm::angleAxis(yaw, glm::vec3{0.F, -1.F, 0.F});
@@ -67 +67 @@ glm::mat4 Camera::getRotationMatrix() const {
- return glm::toMat4(yawRotation) * glm::toMat4(pitchRotation);
+ return glm::toMat4(yaw_rotation) * glm::toMat4(pitch_rotation);
diff --git a/src/scene/Node.cpp b/src/scene/Node.cpp
index d5340d1..1516d73 100644
--- a/src/scene/Node.cpp
+++ b/src/scene/Node.cpp
@@ -7 +7 @@
-Node::Node(std::shared_ptr<Node> parent, std::string name)
+Node::Node(const std::shared_ptr<Node>& parent, std::string name)
@@ -18 +18 @@ Node::~Node() {
- parent->remove_child(shared_from_this());
+ parent->removeChild(shared_from_this());
@@ -22 +22 @@ Node::~Node() {
-���������������iZ�����PZu�������������() const {
+auto Node::getParent() const -> std::shared_ptr<Node> {
@@ -26 +26 @@ std::shared_ptr<Node> Node::get_parent() const {
-tr<Node> {
@@ -26 +26 @@ std::shared_ptr<Node> Node::get_parent(+auto Node::getChildren() const -> std::vector<std::shared_ptr<Node>> {
@@ -30 +30 @@ std::vector<std::shared_ptr<Node>> Node::get_children() const {
-@@ -26 +26 @@ std::shared_ptr<Node> Node::+auto Node::addChild() -> std::shared_ptr<Node> {
@@ -37 +37 @@ std::shared_ptr<Node> Node::add_child() {
-ode::get_children() const {
-@@ -26 +26 @@ std::shared_ptr<+void Node::removeChild(const std::shared_ptr<Node>& del_child) {
@@ -54 +54 @@ void Node::remove_child(std::shared_ptr<Node> del_child) {
-std::string Node::get_name() const {
+auto Node::getName() const -> std::string {
@@ -58 +58 @@ std::string Node::get_name() const {
-void Node::change_name(const std::string& new_name) {
+void Node::changeName(const std::string& new_name) {
diff --git a/src/scene/Light.cpp b/src/scene/Light.cpp
index 8681a76..2c42a59 100644
--- a/src/scene/Light.cpp
+++ b/src/scene/Light.cpp
@@ -6,5 +6,2 @@ Light::Light()
- : _position(glm::vec3(0.0f, 0.0f, 0.0f)),
- _rotation(glm::quat(1.0f, 0.0f, 0.0f, 0.0f)),
- _radius(5.0f),
- _strength(1.0f),
- _color(glm::vec3(1.0f, 1.0f, 1.0f)) {}
+ : _position(glm::vec3(0.0F, 0.0F, 0.0F)),
+ _rotation(glm::quat(1.0F, 0.0F, 0.0F, 0.0F)),
@@ -12 +9,3 @@ Light::Light()
-glm::vec3 Light::getPosition() const {
+ _color(glm::vec3(1.0F, 1.0F, 1.0F)) {}
+
+auto Light::getPosition() const -> glm::vec3 {
@@ -20 +19 @@ void Light::setPosition(const glm::vec3& position) {
-glm::quat Light::getRotation() const {
+auto Light::getRotation() const -> glm::quat {
@@ -28 +27 @@ void Light::setRotation(const glm::quat& rotation) {
-float Light::getRadius() const {
+auto Light::getRadius() const -> float {
@@ -36 +35 @@ void Light::setRadius(float radius) {
-float Light::getStrength() const {
+auto Light::getStrength() const -> float {
@@ -44 +43 @@ void Light::setStrength(float strength) {
-glm::vec3 Light::getColor() const {
+auto Light::getColor() const -> glm::vec3 {
diff --git a/src/scene/ParentSystem.cpp b/src/scene/ParentSystem.cpp
index 7f48821..ec78682 100644
--- a/src/scene/ParentSystem.cpp
+++ b/src/scene/ParentSystem.cpp
@@ -17 +17 @@ void updateChild(Child &c) {
- const auto newEnd =
+ const auto new_end =
@@ -21 +21 @@ void updateChild(Child &c) {
- children.erase(newEnd, children.end());
+ children.erase(new_end, children.end());
@@ -33 +33 @@ void changeParent(flecs::entity e, Parent &p, const PreviousParent &pp) {
- const auto newEnd =
+ const auto new_end =
@@ -39 +39 @@ void changeParent(flecs::entity e, Parent &p, const PreviousParent &pp) {
- child->children.erase(newEnd, child->children.end());
+ child->children.erase(new_end, child->children.end());
@@ -74,2 +73,0 @@ void setRelation(flecs::entity child, flecs::entity parent) {
- } else {
- child.set<PreviousParent>({child.get<Parent>()->parent});
@@ -76,0 +75 @@ void setRelation(flecs::entity child, flecs::entity parent) {
+ child.set<PreviousParent>({child.get<Parent>()->parent});
@@ -117,7 +116,7 @@ void removeRelation(flecs::entity removing_child, flecs::entity parent) {
- const auto newEnd = std::ranges::remove_if(
- children,
- [removing_child](const flecs::entity &child) {
- return child == removing_child;
- })
- .begin();
- children.erase(newEnd, children.end());
+ const auto new_end = std::ranges::remove_if(
+ children,
+ [removing_child](const flecs::entity &child) {
+ return child == removing_child;
+ })
+ .begin();
+ children.erase(new_end, children.end());
@@ -126 +125 @@ void removeRelation(flecs::entity removing_child, flecs::entity parent) {
-void ParentSystem(const flecs::world &world) {
+void parentSystem(const flecs::world &world) {
diff --git a/src/core/ControllerImpl.cpp b/src/core/ControllerImpl.cpp
index d7ee3a5..ed3238e 100644
--- a/src/core/ControllerImpl.cpp
+++ b/src/core/ControllerImpl.cpp
@@ -16 +16 @@ ControllerImpl::ControllerImpl(IModel::Ptr model) : _model(std::move(model)) {}
-double getCurrentGlobalTime() {
+auto getCurrentGlobalTime() -> double {
@@ -21 +21 @@ double getCurrentGlobalTime() {
- const auto durationSinceEpoch = now.time_since_epoch();
+ const auto duration_since_epoch = now.time_since_epoch();
@@ -24 +24 @@ double getCurrentGlobalTime() {
- const std::chrono::duration<double> seconds = durationSinceEpoch;
+ const std::chrono::duration<double> seconds = duration_since_epoch;
@@ -31 +31 @@ void updateCube(const std::shared_ptr<IModel> &_model, int name) {
- const double sinValue = std::sin(getCurrentGlobalTime() + name) * 5.0;
+ const double sin_value = std::sin(getCurrentGlobalTime() + name) * 5.0;
@@ -33 +33 @@ void updateCube(const std::shared_ptr<IModel> &_model, int name) {
-:sin(getCurrentGlobalTime() + name) * 5.0;
@@ -33 +33 @@ + const glm::mat4 scale = glm::scale(glm::vec3{0.2F});
@@ -35 +35 @@ void updateCube(const std::shared_ptr<IModel> &_model, int name) {
-del, int name) {
-:sin(getCurrentGlobalTime() + name) * 5.0;
@@ -33 +3+ glm::vec3{static_cast<float>(name) - 2.5F, sin_value, 0});
diff --git a/src/core/ViewImpl.cpp b/src/core/ViewImpl.cpp
index 45fc8b7..70a9bc0 100644
--- a/src/core/ViewImpl.cpp
+++ b/src/core/ViewImpl.cpp
@@ -29 +29,5 @@ ViewImpl::ViewImpl(IController::Ptr controller, IModel::Ptr model)
- : _controller(std::move(controller)), _model(std::move(model)) {
+ : _controller(std::move(controller)),
+ _model(std::move(model)),
+ window(SDL_CreateWindow("engine", SDL_WINDOWPOS_UNDEFINED,
+ SDL_WINDOWPOS_UNDEFINED, 1700, 900,
+ kWindowFlags)) {
@@ -31,2 +34,0 @@ ViewImpl::ViewImpl(IController::Ptr controller, IModel::Ptr model)
- window = SDL_CreateWindow("engine", SDL_WINDOWPOS_UNDEFINED,
- SDL_WINDOWPOS_UNDEFINED, 1700, 900, kWindowFlags);
@@ -47 +49 @@ void ViewImpl::run() const {
- bool bQuit = false;
+ bool b_quit = false;
@@ -52 +54 @@ void ViewImpl::run() const {
- while (!bQuit) {
+ while (!b_quit) {
@@ -56 +58,3 @@ void ViewImpl::run() const {
- if (e.type == SDL_QUIT) bQuit = true;
+ if (e.type == SDL_QUIT) {
+ b_quit = true;
+ }
@@ -84,2 +88,2 @@ void ViewImpl::run() const {
- VulkanEngine &engine = VulkanEngine::Get();
- ImGui::SliderFloat("Render Scale", &engine.renderScale, 0.3f, 1.f);
+ VulkanEngine &engine = VulkanEngine::get();
+ ImGui::SliderFloat("Render Scale", &engine.render_scale, 0.3F, 1.F);
@@ -101 +105 @@ ViewImpl::~ViewImpl() {
- SDL_DestroyWindow(window);
+ sdlDestroyWindow(window);
diff --git a/src/core/Model.cpp b/src/core/Model.cpp
index 0df2b63..a008528 100644
--- a/src/core/Model.cpp
+++ b/src/core/Model.cpp
@@ -5 +5 @@
-IModel::Ptr createModel() {
+auto createModel() -> IModel::Ptr {
diff --git a/src/core/createInstance.cpp b/src/core/createInstance.cpp
index fe1eb2b..5818caa 100644
--- a/src/core/createInstance.cpp
+++ b/src/core/createInstance.cpp
@@ -5 +5 @@
-IController::Ptr createInstance() {
+auto createInstance() -> IController::Ptr {
diff --git a/src/core/Mesh.cpp b/src/core/Mesh.cpp
index f496c69..4498773 100644
--- a/src/core/Mesh.cpp
+++ b/src/core/Mesh.cpp
@@ -5 +5 @@ Mesh::Mesh(const std::string &filePath) : _currentModelPath(filePath) {
- VulkanEngine &engine = VulkanEngine::Get();
+ VulkanEngine &engine = VulkanEngine::get();
@@ -10 +10 @@ Mesh::~Mesh() {
- remove_model();
+ removeModel();
@@ -13,2 +13,2 @@ Mesh::~Mesh() {
-void Mesh::set_model(const std::string &filePath) {
- VulkanEngine &engine = VulkanEngine::Get();
+void Mesh::setModel(const std::string &filePath) {
+ VulkanEngine &engine = VulkanEngine::get();
@@ -29 +29 @@ void Mesh::set_model(const std::string &filePath) {
-void Mesh::remove_model() {
+void Mesh::removeModel() {
@@ -31 +31 @@ void Mesh::remove_model() {
- VulkanEngine &engine = VulkanEngine::Get();
+ VulkanEngine &engine = VulkanEngine::get();
@@ -37,3 +37,2 @@ void Mesh::remove_model() {
-
-void Mesh::set_transform(glm::mat4 t) {
- VulkanEngine &engine = VulkanEngine::Get();
+void Mesh::setTransform(glm::mat4 t) {
+ VulkanEngine &engine = VulkanEngine::get();
@@ -46 +45 @@ void Mesh::set_transform(glm::mat4 t) {
-glm::mat4 Mesh::get_transform() {
+auto Mesh::getTransform() -> glm::mat4 {
diff --git a/src/core/Controller.cpp b/src/core/Controller.cpp
index cfabd7e..616d782 100644
--- a/src/core/Controller.cpp
+++ b/src/core/Controller.cpp
@@ -8 +8 @@
-IController::Ptr createController(IModel::Ptr ptr) {
+auto createController(IModel::Ptr ptr) -> IController::Ptr {
diff --git a/src/core/View.cpp b/src/core/View.cpp
index 8751d9d..9a41a9d 100644
--- a/src/core/View.cpp
+++ b/src/core/View.cpp
@@ -8 +8 @@
-IView::Ptr createView(IController::Ptr controller, IModel::Ptr model) {
+auto createView(IController::Ptr controller, IModel::Ptr model) -> IView::Ptr {
diff --git a/src/graphics/vulkan/pipelines.cpp b/src/graphics/vulkan/pipelines.cpp
index 5926226..b9a3ca6 100644
--- a/src/graphics/vulkan/pipelines.cpp
+++ b/src/graphics/vulkan/pipelines.cpp
@@ -4,5 +4,5 @@
-void GLTFMetallic_Roughness::build_pipelines(VulkanEngine* engine) {
- VkShaderModule meshFragShader =
- load_shader(engine, "./shaders/mesh.frag.spv", "fragment");
- VkShaderModule meshVertexShader =
- load_shader(engine, "./shaders/mesh.vert.spv", "vertex");
+void GltfMetallicRoughness::buildPipelines(VulkanEngine* engine) {
+ VkShaderModule mesh_frag_shader =
+ loadShader(engine, "./shaders/mesh.frag.spv", "fragment");
+ VkShaderModule mesh_vertex_shader =
+ loadShader(engine, "./shaders/mesh.vert.spv", "vertex");
@@ -11 +11 @@ void GLTFMetallic_Roughness::build_pipelines(VulkanEngine* engine) {
- VkPipelineLayout newLayout = create_pipeline_layout(engine);
+ VkPipelineLayout new_layout = create_pipeline_layout(engine);
@@ -16,3 +16,4 @@ void GLTFMetallic_Roughness::build_pipelines(VulkanEngine* engine) {
- build_opaque_pipeline(engine, meshVertexShader, meshFragShader, newLayout);
- build_transparent_pipeline(engine, meshVertexShader, meshFragShader,
- newLayout);
+ build_opaque_pipeline(engine, mesh_vertex_shader, mesh_frag_shader,
+ new_layout);
+ build_transparent_pipeline(engine, mesh_vertex_shader, mesh_frag_shader,
+ new_layout);
@@ -20,2 +21,2 @@ void GLTFMetallic_Roughness::build_pipelines(VulkanEngine* engine) {
- vkDestroyShaderModule(engine->_device, meshFragShader, nullptr);
- vkDestroyShaderModule(engine->_device, meshVertexShader, nullptr);
+ vkDestroyShaderModule(engine->_device, mesh_frag_shader, nullptr);
+ vkDestroyShaderModule(engine->_device, mesh_vertex_shader, nullptr);
@@ -140,8 +141,8 @@ void Pipelines::init(VkDevice device,
- GraphicsPipeline::GraphicsPipelineConfig triangleConfig;
- triangleConfig.vertexShaderPath = "./shaders/colored_triangle.vert.spv";
- triangleConfig.fragmentShaderPath = "./shaders/colored_triangle.frag.spv";
- triangleConfig.colorFormat = _drawImage.imageFormat;
- triangleConfig.depthFormat = VK_FORMAT_UNDEFINED; // No depth testing
- triangleConfig.depthTest = false;
- triangleConfig.cullMode = VK_CULL_MODE_NONE;
- triangleConfig.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+ GraphicsPipeline::GraphicsPipelineConfig triangle_config;
+ triangle_config.vertexShaderPath = "./shaders/colored_triangle.vert.spv";
+ triangle_config.fragmentShaderPath = "./shaders/colored_triangle.frag.spv";
+ triangle_config.colorFormat = _drawImage.imageFormat;
+ triangle_config.depthFormat = VK_FORMAT_UNDEFINED; // No depth testing
+ triangle_config.depthTest = false;
+ triangle_config.cullMode = VK_CULL_MODE_NONE;
+ triangle_config.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
@@ -150 +151 @@ void Pipelines::init(VkDevice device,
- triangleConfig.customPipelineSetup = [](PipelineBuilder& builder) {
+ triangle_config.customPipelineSetup = [](PipelineBuilder& builder) {
@@ -161,12 +162,12 @@ void Pipelines::init(VkDevice device,
- GraphicsPipeline::GraphicsPipelineConfig meshConfig;
- meshConfig.vertexShaderPath = "./shaders/colored_triangle_mesh.vert.spv";
- meshConfig.fragmentShaderPath = "./shaders/tex_image.frag.spv";
- meshConfig.colorFormat = _drawImage.imageFormat;
- meshConfig.depthFormat = VK_FORMAT_D32_SFLOAT;
- meshConfig.depthTest = true;
- meshConfig.depthCompareOp = VK_COMPARE_OP_GREATER;
- meshConfig.cullMode = VK_CULL_MODE_NONE;
- meshConfig.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
-
- // Explicitly setup pipeline details via callback
- meshConfig.customPipelineSetup = [](PipelineBuilder& builder) {
+ GraphicsPipeline::GraphicsPipelineConfig mesh_config;
+ mesh_config.vertexShaderPath = "./shaders/colored_triangle_mesh.vert.spv";
+ mesh_config.fragmentShaderPath = "./shaders/tex_image.frag.spv";
+ mesh_config.colorFormat = _drawImage.imageFormat;
+ mesh_config.depthFormat = VK_FORMAT_D32_SFLOAT;
+ mesh_config.depthTest = true;
+ mesh_config.depthCompareOp = VK_COMPARE_OP_GREATER;
+ mesh_config.cullMode = VK_CULL_MODE_NONE;
+ mesh_config.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+
+ // Explicitly setup pipeline details via callback
+ mesh_config.customPipelineSetup = [](PipelineBuilder& builder) {
@@ -177,8 +178,8 @@ void Pipelines::init(VkDevice device,
-
- VkPushConstantRange bufferRange{};
- bufferRange.offset = 0;
- bufferRange.size = sizeof(GPUDrawPushConstants);
- bufferRange.stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
- meshConfig.pushConstants.push_back(bufferRange);
-
- meshConfig.descriptorSetLayouts.push_back(_singleImageDescriptorLayout);
+
+ VkPushConstantRange buffer_range{};
+ buffer_range.offset = 0;
+ buffer_range.size = sizeof(GPUDrawPushConstants);
+ buffer_range.stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
+ mesh_config.pushConstants.push_back(buffer_range);
+
+ mesh_config.descriptorSetLayouts.push_back(_singleImageDescriptorLayout);
@@ -190,4 +191,4 @@ void Pipelines::init(VkDevice device,
- ComputePipeline::ComputePipelineConfig gradientConfig;
- gradientConfig.descriptorSetLayout = _drawImageDescriptorLayout;
- gradientConfig.shaderPath = "./shaders/gradient.comp.spv";
-
+ ComputePipeline::ComputePipelineConfig gradient_config;
+ gradient_config.descriptorSetLayout = _drawImageDescriptorLayout;
+ gradient_config.shaderPath = "./shaders/gradient.comp.spv";
+
diff --git a/src/graphics/vulkan/ComputePipeline.cpp b/src/graphics/vulkan/ComputePipeline.cpp
index 462ee47..ad343a6 100644
--- a/src/graphics/vulkan/ComputePipeline.cpp
+++ b/src/graphics/vulkan/ComputePipeline.cpp
@@ -1,0 +2,3 @@
+
+#include <utility>
+
@@ -4,3 +7,2 @@
-ComputePipeline::ComputePipeline(const ComputePipelineConfig& config)
- : _config(config) {
-}
+ComputePipeline::ComputePipeline(ComputePipelineConfig config)
+ : _config(std::move(config)) {}
@@ -10,11 +12,13 @@ void ComputePipeline::init(VkDevice device) {
-
- VkPipelineLayoutCreateInfo computeLayout{};
- computeLayout.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
- computeLayout.pNext = nullptr;
- computeLayout.pSetLayouts = &_config.descriptorSetLayout;
- computeLayout.setLayoutCount = 1;
-
- VK_CHECK(vkCreatePipelineLayout(_device, &computeLayout, nullptr, &_pipelineLayout));
-
- VkShaderModule computeShader;
- if (!vkutil::load_shader_module(_config.shaderPath.c_str(), _device, &computeShader)) {
+
+ VkPipelineLayoutCreateInfo compute_layout{};
+ compute_layout.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
+ compute_layout.pNext = nullptr;
+ compute_layout.pSetLayouts = &_config.descriptor_set_layout;
+ compute_layout.setLayoutCount = 1;
+
+ VK_CHECK(vkCreatePipelineLayout(_device, &compute_layout, nullptr,
+ &_pipelineLayout));
+
+ VkShaderModule compute_shader = nullptr;
+ if (!vkutil::loadShaderModule(_config.shader_path.c_str(), _device,
+ &compute_shader)) {
@@ -24,14 +28,15 @@ void ComputePipeline::init(VkDevice device) {
-
-out, nullptr, &_pipelineLayout));
-
- VkSh-aderModule computeShader;
- if (!vkutil::load_shader_module(_config.shad-erPath.c_str(), _device, &compu-teShader)) {
+
+ VkPipelineLayoutCreateInfo comp-ute_layout{};
+ compute_layout.sTyp-e = VK_STRUCTURE_TYPE_PIPELINE-_LAYO-UT_CREATE_INFO;
+ compute_layout.pNext = nullptr;
+ com-pute_layout.pSetLayouts = &_config.descriptor_set_layout;
+ compute_layout.setLayou-tCount = 1;
+
+ VK_CHECK(vkCreatePipelineLay-out(_device, &compute_layout, nullptr,
+ - &_pipelineLayout));
+
+ Vk-Shade+
+ VkPipelineShaderStageCreateInfo stage_info{};
+ stage_info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
+ stage_info.pNext = nullptr;
+ stage_info.stage = VK_SHADER_STAGE_COMPUTE_BIT;
+ stage_info.module = compute_shader;
+ stage_info.pName = "main";
+
+ VkComputePipelineCreateInfo compute_pipeline_create_info{};
+ compute_pipeline_create_info.sType =
+ VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
+ compute_pipeline_create_info.pNext = nullptr;
+ compute_pipeline_create_info.layout = _pipelineLayout;
+ compute_pipeline_create_info.stage = stage_info;
+
@@ -39,5 +44,5 @@ void ComputePipeline::init(VkDevice device) {
-le(_config.shader_path.c_str(), _device,
+ - &compute_shader)) {
@@ -24,14 +28,15 @@ void Co-mpute-Pipeline::init(VkDevice device) {
- -
-out, nullptr, &_pipelineLayout));
-
- VkSh-aderModule computeShad+ &compute_pipeline_create_info, nullptr,
+ &_pipeline));
+
+ if (_config.custom_setup_callback) {
+ _config.custom_setup_callback(_device, _pipeline, _pipelineLayout);
@@ -45,2 +50,2 @@ void ComputePipeline::init(VkDevice device) {
- if- (!vkutil::load_shader_module(_config.shad-erPath.c_str(), _+
+ vkDestroyShaderModule(_device, compute_shader, nullptr);
diff --git a/src/graphics/vulkan/vk_initializers.cpp b/src/graphics/vulkan/vk_initializers.cpp
index 3663236..2996bd5 100644
--- a/src/graphics/vulkan/vk_initializers.cpp
+++ b/src/graphics/vulkan/vk_initializers.cpp
@@ -4,3 +4,3 @@
-VkCommandPoolCreateInfo vkinit::command_pool_create_info(
- [[maybe_unused]] uint32_t queueFamilyIndex,
- VkCommandPoolCreateFlags flags /*= 0*/) {
+auto vkinit::commandPoolCreateInfo([[maybe_unused]] uint32_t queueFamilyIndex,
+ VkCommandPoolCreateFlags flags /*= 0*/)
+ -> VkCommandPoolCreateInfo {
@@ -15,2 +15,3 @@ VkCommandPoolCreateInfo vkinit::command_pool_create_info(
-VkCommandBufferAllocateInfo vkinit::command_buffer_allocate_info(
- VkCommandPool pool, uint32_t count /*= 1*/) {
+auto vkinit::commandBufferAllocateInfo(VkCommandPool pool,
+ uint32_t count /*= 1*/)
+ -> VkCommandBufferAllocateInfo {
@@ -30,2 +31,2 @@ VkCommandBufferAllocateInfo vkinit::command_buffer_allocate_info(
-VkCommandBufferBeginInfo vkinit::command_buffer_begin_info(
- VkCommandBufferUsageFlags flags /*= 0*/) {
+auto vkinit::commandBufferBeginInfo(VkCommandBufferUsageFlags flags /*= 0*/)
+ -> VkCommandBufferBeginInfo {
@@ -44 +45,2 @@ VkCommandBufferBeginInfo vkinit::command_buffer_begin_info(
-VkFenceCreateInfo vkinit::fence_create_info(VkFenceCreateFlags flags /*= 0*/) {
+auto vkinit::fenceCreateInfo(VkFenceCreateFlags flags /*= 0*/)
+ -> VkFenceCreateInfo {
@@ -54,2 +56,2 @@ VkFenceCreateInfo vkinit::fence_create_info(VkFenceCreateFlags flags /*= 0*/) {
-VkSemaphoreCreateInfo vkinit::semaphore_create_info(
- VkSemaphoreCreateFlags flags /*= 0*/) {
+auto vkinit::semaphoreCreateInfo(VkSemaphoreCreateFlags flags /*= 0*/)
+ -> VkSemaphoreCreateInfo {
@@ -66,11 +68,12 @@ VkSemaphoreCreateInfo vkinit::semaphore_create_info(
-VkSemaphoreSubmitInfo vkinit::semaphore_submit_info(
- VkPipelineStageFlags2 stageMask, VkSemaphore semaphore) {
- VkSemaphoreSubmitInfo submitInfo{};
- submitInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO;
- submitInfo.pNext = nullptr;
- submitInfo.semaphore = semaphore;
- submitInfo.stageMask = stageMask;
- submitInfo.deviceIndex = 0;
- submitInfo.value = 1;
-
- return submitInfo;
+auto vkinit::semaphoreSubmitInfo(VkPipelineStageFlags2 stageMask,
+ VkSemaphore semaphore)
+ -> VkSemaphoreSubmitInfo {
+ VkSemaphoreSubmitInfo submit_info{};
+ submit_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO;
+ submit_info.pNext = nullptr;
+ submit_info.semaphore = semaphore;
+ submit_info.stageMask = stageMask;
+ submit_info.deviceIndex = 0;
+ submit_info.value = 1;
+
+ return submit_info;
@@ -79,2 +82,2 @@ VkSemaphoreSubmitInfo vkinit::semaphore_submit_info(
-VkCommandBufferSubmitInfo vkinit::command_buffer_submit_info(
- VkCommandBuffer cmd) {
+auto vkinit::commandBufferSubmitInfo(VkCommandBuffer cmd)
+ -> VkCommandBufferSubmitInfo {
@@ -90,4 +93,4 @@ VkCommandBufferSubmitInfo vkinit::command_buffer_submit_info(
-VkSubmitInfo2 vkinit::submit_info(
- const VkCommandBufferSubmitInfo* cmd,
- const VkSemaphoreSubmitInfo* signalSemaphoreInfo,
- const VkSemaphoreSubmitInfo* waitSemaphoreInfo) {
+auto vkinit::submitInfo(const VkCommandBufferSubmitInfo* cmd,
+ const VkSemaphoreSubmitInfo* signalSemaphoreInfo,
+ const VkSemaphoreSubmitInfo* waitSemaphoreInfo)
+ -> VkSubmitInfo2 {
@@ -112 +115 @@ VkSubmitInfo2 vkinit::submit_info(
-VkPresentInfoKHR vkinit::present_info() {
+auto vkinit::presentInfo() -> VkPresentInfoKHR {
@@ -127 +130 @@ VkPresentInfoKHR vkinit::present_info() {
-VkRenderingAttachmentInfo vkinit::attachment_info(
+auto vkinit::attachmentInfo(
@@ -129,12 +132,13 @@ VkRenderingAttachmentInfo vkinit::attachment_info(
- VkImageLayout layout /*= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL*/) {
- VkRenderingAttachmentInfo colorAttachment{};
- colorAttachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
- colorAttachment.pNext = nullptr;
-
- colorAttachment.imageView = view;
- colorAttachment.imageLayout = layout;
- colorAttachment.loadOp =
- clear ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD;
- colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
- if (clear) {
- colorAttachment.clearValue = *clear;
+ VkImageLayout layout /*= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL*/)
+ -> VkRenderingAttachmentInfo {
+ VkRenderingAttachmentInfo color_attachment{};
+ color_attachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
+ color_attachment.pNext = nullptr;
+
+ color_attachment.imageView = view;
+ color_attachment.imageLayout = layout;
+ color_attachment.loadOp = (clear != nullptr) ? VK_ATTACHMENT_LOAD_OP_CLEAR
+ : VK_ATTACHMENT_LOAD_OP_LOAD;
+ color_attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
+ if (clear != nullptr) {
+ color_attachment.clearValue = *clear;
@@ -143 +147 @@ VkRenderingAttachmentInfo vkinit::attachment_info(
- return colorAttachment;
+ return color_attachment;
@@ -148 +152 @@ VkRenderingAttachmentInfo vkinit::attachment_info(
-VkRenderingAttachmentInfo vkinit::depth_attachment_info(
+auto vkinit::depthAttachmentInfo(
@@ -150,12 +154,13 @@ VkRenderingAttachmentInfo vkinit::depth_attachment_info(
- VkImageLayout layout /*= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL*/) {
- VkRenderingAttachmentInfo depthAttachment{};
- depthAttachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
- depthAttachment.pNext = nullptr;
-
- depthAttachment.imageView = view;
- depthAttachment.imageLayout = layout;
- depthAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
- depthAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
- depthAttachment.clearValue.depthStencil.depth = 0.f;
-
- return depthAttachment;
+ VkImageLayout layout /*= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL*/)
+ -> VkRenderingAttachmentInfo {
+ VkRenderingAttachmentInfo depth_attachment{};
+ depth_attachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
+ depth_attachment.pNext = nullptr;
+
+ depth_attachment.imageView = view;
+ depth_attachment.imageLayout = layout;
+ depth_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ depth_attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
+ depth_attachment.clearValue.depthStencil.depth = 0.F;
+
+ return depth_attachment;
@@ -166,16 +171,16 @@ VkRenderingAttachmentInfo vkinit::depth_attachment_info(
-VkRenderingInfo vkinit::rendering_info(
- VkExtent2D renderExtent,
- const VkRenderingAttachmentInfo* colorAttachment,
- const VkRenderingAttachmentInfo* depthAttachment) {
- VkRenderingInfo renderInfo{};
- renderInfo.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
- renderInfo.pNext = nullptr;
-
- renderInfo.renderArea = VkRect2D{VkOffset2D{0, 0}, renderExtent};
- renderInfo.layerCount = 1;
- renderInfo.colorAttachmentCount = 1;
- renderInfo.pColorAttachments = colorAttachment;
- renderInfo.pDepthAttachment = depthAttachment;
- renderInfo.pStencilAttachment = nullptr;
-
- return renderInfo;
+auto vkinit::renderingInfo(VkExtent2D renderExtent,
+ const VkRenderingAttachmentInfo* colorAttachment,
+ const VkRenderingAttachmentInfo* depthAttachment)
+ -> VkRenderingInfo {
+ VkRenderingInfo render_info{};
+ render_info.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
+ render_info.pNext = nullptr;
+
+ render_info.renderArea = VkRect2D{VkOffset2D{0, 0}, renderExtent};
+ render_info.layerCount = 1;
+ render_info.colorAttachmentCount = 1;
+ render_info.pColorAttachments = colorAttachment;
+ render_info.pDepthAttachment = depthAttachment;
+ render_info.pStencilAttachment = nullptr;
+
+ return render_info;
@@ -186,10 +191,10 @@ VkRenderingInfo vkinit::rendering_info(
-VkImageSubresourceRange vkinit::image_subresource_range(
- VkImageAspectFlags aspectMask) {
- VkImageSubresourceRange subImage{};
- subImage.aspectMask = aspectMask;
- subImage.baseMipLevel = 0;
- subImage.levelCount = VK_REMAINING_MIP_LEVELS;
- subImage.baseArrayLayer = 0;
- subImage.layerCount = VK_REMAINING_ARRAY_LAYERS;
-
- return subImage;
+auto vkinit::imageSubresourceRange(VkImageAspectFlags aspectMask)
+ -> VkImageSubresourceRange {
+ VkImageSubresourceRange sub_image{};
+ sub_image.aspectMask = aspectMask;
+ sub_image.baseMipLevel = 0;
+ sub_image.levelCount = VK_REMAINING_MIP_LEVELS;
+ sub_image.baseArrayLayer = 0;
+ sub_image.layerCount = VK_REMAINING_ARRAY_LAYERS;
+
+ return sub_image;
@@ -200,3 +205,4 @@ VkImageSubresourceRange vkinit::image_subresource_range(
-p = VK_ATTACHMENT_LOAD_OP_CLEAR;
- depthAttachment.storeOp = VK_-ATTACHMENT_STORE_OP_STORE;
- depthAttachment.clearValue.dep-thStencil.depth = 0.f;
-
- +auto vkinit::descriptorsetLayoutBinding(VkDescriptorType type,
+ VkShaderStageFlags stageFlags,
+ uint32_t binding)
+ -> VkDescriptorSetLayoutBinding {
@@ -213,2 +219,3 @@ VkDescriptorSetLayoutBinding vkinit::descriptorset_layout_binding(
-ING_ATTACHMENT_INFO;
+ depth_attachment.pNext = nullptr;
+
+ depth_a-ttachment.imageView = view;
+ depth_attachment.imageLayout = layout;
+ de+auto vkinit::descriptorsetLayoutCreateInfo(
+ const VkDescriptorSetLayoutBinding* bindings, uint32_t bindingCount)
+ -> VkDescriptorSetLayoutCreateInfo {
@@ -226,3 +233,3 @@ VkDescriptorSetLayoutCreateInfo vkinit::descriptorset_layout_create_info(
-vkinit::depth_attachment_info(
-VkRenderingInfo vkini-t::rendering_info(
- VkExtent2D renderExtent,
- - const VkRenderingAttachmentInfo* colorAttachment,
- co+auto vkinit::writeDescriptorImage(VkDescriptorType type, VkDescriptorSet dstSet,
+ const VkDescriptorImageInfo* imageInfo,
+ uint32_t binding) -> VkWriteDescriptorSet {
@@ -242,3 +249,4 @@ VkWriteDescriptorSet vkinit::write_descriptor_image(
-AttachmentCount = 1;
- renderInfo.pColorAttachments- = colorAttachment;
- renderInfo.pDepthAttachment = -depthAttachment;
- renderInfo.pStencilAttachment = nullptr;
-
- +auto vkinit::writeDescriptorBuffer(VkDescriptorType type,
+ VkDescriptorSet dstSet,
+ const VkDescriptorBufferInfo* bufferInfo,
+ uint32_t binding) -> VkWriteDescriptorSet {
@@ -258,2 +266,2 @@ VkWriteDescriptorSet vkinit::write_descriptor_buffer(
-r_info.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
+ render_info.pNext = nullptr-;
+
+ render_info.renderArea = VkRect2D{VkOffset2D{0, 0}, rend+auto vkinit::bufferInfo(VkBuffer buffer, VkDeviceSize offset,
+ VkDeviceSize range) -> VkDescriptorBufferInfo {
@@ -268,3 +276,2 @@ VkDescriptorBufferInfo vkinit::buffer_info(VkBuffer buffer, VkDeviceSize offset,
-er_info.pDepthAttachment = depthAttachment;
+ render_info.-pStencilAttachment = nullptr;
+
+ return render_info;
@@ -186,10 +191,1-0 @@ VkRenderingInfo vkinit::rendering_info(
-VkImageSubresourceR+auto vkinit::imageCreateInfo(VkFormat format, VkImageUsageFlags usageFlags,
+ VkExtent3D extent) -> VkImageCreateInfo {
@@ -294,2 +301,3 @@ VkImageCreateInfo vkinit::image_create_info(VkFormat format,
-l = 0;
+ sub_image.levelCount = VK_REMAINING_MIP_L-EVELS;
+ sub_image.baseArrayLayer = 0;
+ sub_image.layerCount = VK_R+auto vkinit::imageview_create_info(VkFormat format, VkImage image,
+ VkImageAspectFlags aspectFlags)
+ -> VkImageViewCreateInfo {
@@ -314 +322 @@ VkImageViewCreateInfo vkinit::imageview_create_info(
-kDescriptorSetLayoutBinding vkinit::descriptorset_layout_binding(
-+auto vkinit::pipelineLayoutCreateInfo() -> VkPipelineLayoutCreateInfo {
@@ -328,3 +336,4 @@ VkPipelineLayoutCreateInfo vkinit::pipeline_layout_create_info() {
-,3 +233,3 @@ VkDescriptorSetLayoutCreateInfo vkinit::descriptorset_layout_c-reate_info(
-vkinit::depth_attachment_info(
-VkRenderingInfo vkini--t::rendering_info(
- +auto vkinit::pipelineShaderStageCreateInfo(VkShaderStageFlagBits stage,
+ VkShaderModule shaderModule,
+ const char* entry)
+ -> VkPipelineShaderStageCreateInfo {
diff --git a/src/graphics/vulkan/vk_descriptors.cpp b/src/graphics/vulkan/vk_descriptors.cpp
index 8f1bbae..b0526a9 100644
--- a/src/graphics/vulkan/vk_descriptors.cpp
+++ b/src/graphics/vulkan/vk_descriptors.cpp
@@ -5,2 +5,2 @@
-void DescriptorLayoutBuilder::add_binding(uint32_t binding,
- VkDescriptorType type) {
+void DescriptorLayoutBuilder::addBinding(uint32_t binding,
+ VkDescriptorType type) {
@@ -19,3 +19,5 @@ void DescriptorLayoutBuilder::clear() {
-VkDescriptorSetLayout DescriptorLayoutBuilder::build(
- VkDevice device, VkShaderStageFlags shaderStages, const void* pNext,
- VkDescriptorSetLayoutCreateFlags flags) {
+auto DescriptorLayoutBuilder::build(VkDevice device,
+ VkShaderStageFlags shaderStages,
+ const void* pNext,
+ VkDescriptorSetLayoutCreateFlags flags)
+ -> VkDescriptorSetLayout {
@@ -34 +36 @@ VkDescriptorSetLayout DescriptorLayoutBuilder::build(
- VkDescriptorSetLayout set;
+ VkDescriptorSetLayout set = nullptr;
@@ -40,3 +42,3 @@ VkDescriptorSetLayout DescriptorLayoutBuilder::build(
-void DescriptorAllocator::init_pool(VkDevice device, uint32_t maxSets,
- std::span<PoolSizeRatio> poolRatios) {
- std::vector<VkDescriptorPoolSize> poolSizes;
+void DescriptorAllocator::initPool(VkDevice device, uint32_t maxSets,
+ std::span<PoolSizeRatio> poolRatios) {
+ std::vector<VkDescriptorPoolSize> pool_sizes;
@@ -44 +46 @@ void DescriptorAllocator::init_pool(VkDevice device, uint32_t maxSets,
- poolSizes.emplace_back(VkDescriptorPoolSize{
+ pool_sizes.emplace_back(VkDescriptorPoolSize{
@@ -53,2 +55,2 @@ void DescriptorAllocator::init_pool(VkDevice device, uint32_t maxSets,
- pool_info.poolSizeCount = (uint32_t)poolSizes.size();
- pool_info.pPoolSizes = poolSizes.data();
+ pool_info.poolSizeCount = (uint32_t)pool_sizes.size();
+ pool_info.pPoolSizes = pool_sizes.data();
@@ -59 +61 @@ void DescriptorAllocator::init_pool(VkDevice device, uint32_t maxSets,
-void DescriptorAllocator::clear_descriptors(VkDevice device) const {
+void DescriptorAllocator::clearDescriptors(VkDevice device) const {
@@ -63 +65 @@ void DescriptorAllocator::clear_descriptors(VkDevice device) const {
-void DescriptorAllocator::destroy_pool(VkDevice device) const {
+void DescriptorAllocator::destroyPool(VkDevice device) const {
@@ -67,3 +69,4 @@ void DescriptorAllocator::destroy_pool(VkDevice device) const {
-VkDescriptorSet DescriptorAllocator::allocate(
- VkDevice device, VkDescriptorSetLayout layout) const {
- VkDescriptorSetAllocateInfo allocInfo = {
+auto DescriptorAllocator::allocate(VkDevice device,
+ VkDescriptorSetLayout layout) const
+ -> VkDescriptorSet {
+ VkDescriptorSetAllocateInfo alloc_info = {
@@ -71,4 +74,4 @@ VkDescriptorSet DescriptorAllocator::allocate(
- allocInfo.pNext = nullptr;
- allocInfo.descriptorPool = pool;
- allocInfo.descriptorSetCount = 1;
- allocInfo.pSetLayouts = &layout;
+ alloc_info.pNext = nullptr;
+ alloc_info.descriptorPool = pool;
+ alloc_info.descriptorSetCount = 1;
+ alloc_info.pSetLayouts = &layout;
@@ -76,2 +79,2 @@ VkDescriptorSet DescriptorAllocator::allocate(
- VkDescriptorSet ds;
- VK_CHECK(vkAllocateDescriptorSets(device, &allocInfo, &ds));
+ VkDescriptorSet ds = nullptr;
+ VK_CHECK(vkAllocateDescriptorSets(device, &alloc_info, &ds));
@@ -82,5 +85,5 @@ VkDescriptorSet DescriptorAllocator::allocate(
-VkDescriptorPool DescriptorAllocatorGrowable::get_pool(VkDevice device) {
- VkDescriptorPool newPool;
- if (!readyPools.empty()) {
- newPool = readyPools.back();
- readyPools.pop_back();
+auto DescriptorAllocatorGrowable::getPool(VkDevice device) -> VkDescriptorPool {
+ VkDescriptorPool new_pool = nullptr;
+ if (!_readyPools.empty()) {
+ new_pool = _readyPools.back();
+ _readyPools.pop_back();
@@ -89 +92 @@ VkDescriptorPool DescriptorAllocatorGrowable::get_pool(VkDevice device) {
- newPool = create_pool(device, setsPerPool, ratios);
+ new_pool = create_pool(device, setsPerPool, ratios);
@@ -91 +94 @@ VkDescriptorPool DescriptorAllocatorGrowable::get_pool(VkDevice device) {
- setsPerPool = static_cast<uint32_t>(setsPerPool * 1.5);
+ _setsPerPool = static_cast<uint32_t>(_setsPerPool * 1.5);
@@ -93 +96 @@ VkDescriptorPool DescriptorAllocatorGrowable::get_pool(VkDevice device) {
- setsPerPool = 4092;
+ _setsPerPool = 4092;
@@ -97 +100 @@ VkDescriptorPool DescriptorAllocatorGrowable::get_pool(VkDevice device) {
- return newPool;
+ return new_pool;
@@ -100,4 +103,4 @@ VkDescriptorPool DescriptorAllocatorGrowable::get_pool(VkDevice device) {
-VkDescriptorPool DescriptorAllocatorGrowable::create_pool(
- VkDevice device, uint32_t setCount,
- std::span<PoolSizeRatio> poolRatios) {
- std::vector<VkDescriptorPoolSize> poolSizes;
+auto DescriptorAllocatorGrowable::createPool(
+ VkDevice device, uint32_t setCount, std::span<PoolSizeRatio> poolRatios)
+ -> VkDescriptorPool {
+ std::vector<VkDescriptorPoolSize> pool_sizes;
@@ -105 +108 @@ VkDescriptorPool DescriptorAllocatorGrowable::create_pool(
- poolSizes.emplace_back(VkDescriptorPoolSize{
+ pool_sizes.emplace_back(VkDescriptorPoolSize{
@@ -115,2 +118,2 @@ VkDescriptorPool DescriptorAllocatorGrowable::create_pool(
- pool_info.poolSizeCount = (uint32_t)poolSizes.size();
- pool_info.pPoolSizes = poolSizes.data();
+ pool_info.poolSizeCount = (uint32_t)pool_sizes.size();
+ pool_info.pPoolSizes = pool_sizes.data();
@@ -118,3 +121,3 @@ VkDescriptorPool DescriptorAllocatorGrowable::create_pool(
- VkDescriptorPool newPool;
- vkCreateDescriptorPool(device, &pool_info, nullptr, &newPool);
- return newPool;
+ VkDescriptorPool new_pool = nullptr;
+ vkCreateDescriptorPool(device, &pool_info, nullptr, &new_pool);
+ return new_pool;
@@ -125 +128 @@ void DescriptorAllocatorGrowable::init(VkDevice device, uint32_t initialSets,
- ratios.clear();
+ _ratios.clear();
@@ -128 +131 @@ void DescriptorAllocatorGrowable::init(VkDevice device, uint32_t initialSets,
- ratios.push_back(r);
+ _ratios.push_back(r);
@@ -131 +134 @@ void DescriptorAllocatorGrowable::init(VkDevice device, uint32_t initialSets,
- const VkDescriptorPool newPool =
+ const VkDescriptorPool new_pool =
@@ -140 +143 @@ void DescriptorAllocatorGrowable::init(VkDevice device, uint32_t initialSets,
-void DescriptorAllocatorGrowable::clear_pools(VkDevice device) {
+void DescriptorAllocatorGrowable::clearPools(VkDevice device) {
@@ -151 +154 @@ void DescriptorAllocatorGrowable::clear_pools(VkDevice device) {
-void DescriptorAllocatorGrowable::destroy_pools(VkDevice device) {
+void DescriptorAllocatorGrowable::destroyPools(VkDevice device) {
@@ -162,2 +165,4 @@ void DescriptorAllocatorGrowable::destroy_pools(VkDevice device) {
-VkDescriptorSet DescriptorAllocatorGrowable::allocate(
- VkDevice device, VkDescriptorSetLayout layout, const void* pNext) {
+auto DescriptorAllocatorGrowable::allocate(VkDevice device,
+ VkDescriptorSetLayout layout,
+ const void* pNext)
+ -> VkDescriptorSet {
@@ -165 +170 @@ VkDescriptorSet DescriptorAllocatorGrowable::allocate(
- VkDescriptorPool poolToUse = get_pool(device);
+ VkDescriptorPool pool_to_use = get_pool(device);
@@ -167,6 +172,6 @@ VkDescriptorSet DescriptorAllocatorGrowable::allocate(
- VkDescriptorSetAllocateInfo allocInfo = {};
- allocInfo.pNext = pNext;
- allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
- allocInfo.descriptorPool = poolToUse;
- allocInfo.descriptorSetCount = 1;
- allocInfo.pSetLayouts = &layout;
+ VkDescriptorSetAllocateInfo alloc_info = {};
+ alloc_info.pNext = pNext;
+ alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
+ alloc_info.descriptorPool = pool_to_use;
+ alloc_info.descriptorSetCount = 1;
+ alloc_info.pSetLayouts = &layout;
@@ -174,2 +179,2 @@ VkDescriptorSet DescriptorAllocatorGrowable::allocate(
- VkDescriptorSet ds;
- VkResult result = vkAllocateDescriptorSets(device, &allocInfo, &ds);
+ VkDescriptorSet ds = nullptr;
+ VkResult result = vkAllocateDescriptorSets(device, &alloc_info, &ds);
@@ -182,2 +187,2 @@ VkDescriptorSet DescriptorAllocatorGrowable::allocate(
-olSizes = pool_sizes.data();
@@ -118,3- +121,3 @@ VkDescriptorPool DescriptorAllocato+ pool_to_use = get_pool(device);
+ alloc_info.descriptorPool = pool_to_use;
@@ -185 +190 @@ VkDescriptorSet DescriptorAllocatorGrowable::allocate(
-Growable::create_pool(
- VkDescriptorPool newPool;
- vkCreateDe+ VK_CHECK(vkAllocateDescriptorSets(device, &alloc_info, &ds));
@@ -192,2 +197,2 @@ VkDescriptorSet DescriptorAllocatorGrowable::allocate(
-rn newPool;
+ VkDescriptorPool new_pool = nullptr;
+ vkCreateDescriptorPo-ol(device, &pool_info, nullptr, &new_pool);
+ return new_pool;
@@ -125 +1+void DescriptorWriter::writeBuffer(int binding, VkBuffer buffer, size_t size,
+ size_t offset, VkDescriptorType type) {
@@ -211,3 +216,3 @@ void DescriptorWriter::write_buffer(int binding, VkBuffer buffer, size_t size,
-DescriptorAllocatorGrowable::clear_pools(VkDevice device) {
+void D-escriptorAllocatorGrowable::clearPools(VkDevice device) {
@@ -151 +154 @@ vo-id DescriptorAllocatorGrowable::clear_pools(VkDevice device)+void DescriptorWriter::writeImage(int binding, VkImageView image,
+ VkSampler sampler, VkImageLayout layout,
+ VkDescriptorType type) {
@@ -238 +243 @@ void DescriptorWriter::clear() {
-VkDescriptorPool pool_to_use = get_pool(device);
@@ -167,6 +172,6 @@ VkDes+void DescriptorWriter::updateSet(VkDevice device, VkDescriptorSet set) {
diff --git a/src/graphics/vulkan/vk_images.cpp b/src/graphics/vulkan/vk_images.cpp
index bf361d6..b9f0e20 100644
--- a/src/graphics/vulkan/vk_images.cpp
+++ b/src/graphics/vulkan/vk_images.cpp
@@ -7,4 +7,4 @@
-void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- VkImageLayout currentLayout,
- VkImageLayout newLayout) {
- VkImageMemoryBarrier2 imageBarrier{
+void vkutil::transitionImage(VkCommandBuffer cmd, VkImage image,
+ VkImageLayout currentLayout,
+ VkImageLayout newLayout) {
+ VkImageMemoryBarrier2 image_barrier{
@@ -12 +12 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- imageBarrier.pNext = nullptr;
+ image_barrier.pNext = nullptr;
@@ -14,4 +14,4 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- imageBarrier.srcStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT;
- imageBarrier.srcAccessMask = VK_ACCESS_2_MEMORY_WRITE_BIT;
- imageBarrier.dstStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT;
- imageBarrier.dstAccessMask =
+ image_barrier.srcStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT;
+ image_barrier.srcAccessMask = VK_ACCESS_2_MEMORY_WRITE_BIT;
+ image_barrier.dstStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT;
+ image_barrier.dstAccessMask =
@@ -20,2 +20,2 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- imageBarrier.oldLayout = currentLayout;
- imageBarrier.newLayout = newLayout;
+ image_barrier.oldLayout = currentLayout;
+ image_barrier.newLayout = newLayout;
@@ -23 +23 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- const auto aspectMask = static_cast<VkImageAspectFlags>(
+ const auto aspect_mask = static_cast<VkImageAspectFlags>(
@@ -27,2 +27,2 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- imageBarrier.subresourceRange = vkinit::image_subresource_range(aspectMask);
- imageBarrier.image = image;
+ image_barrier.subresourceRange = vkinit::imageSubresourceRange(aspect_mask);
+ image_barrier.image = image;
@@ -30,3 +30,3 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- VkDependencyInfo depInfo{};
- depInfo.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO;
- depInfo.pNext = nullptr;
+ VkDependencyInfo dep_info{};
+ dep_info.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO;
+ dep_info.pNext = nullptr;
@@ -34,2 +34,2 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- depInfo.imageMemoryBarrierCount = 1;
- depInfo.pImageMemoryBarriers = &imageBarrier;
+ dep_info.imageMemoryBarrierCount = 1;
+ dep_info.pImageMemoryBarriers = &image_barrier;
@@ -37 +37 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
- vkCmdPipelineBarrier2(cmd, &depInfo);
+ vkCmdPipelineBarrier2(cmd, &dep_info);
@@ -40,35 +40,35 @@ void vkutil::transition_image(VkCommandBuffer cmd, VkImage image,
-void vkutil::copy_image_to_image(VkCommandBuffer cmd, VkImage source,
- VkImage destination, VkExtent2D srcSize,
- VkExtent2D dstSize) {
- VkImageBlit2 blitRegion{.sType = VK_STRUCTURE_TYPE_IMAGE_BLIT_2,
- .pNext = nullptr};
-
- blitRegion.srcOffsets[1].x = static_cast<int32_t>(srcSize.width);
- blitRegion.srcOffsets[1].y = static_cast<int32_t>(srcSize.height);
- blitRegion.srcOffsets[1].z = 1;
-
- blitRegion.dstOffsets[1].x = static_cast<int32_t>(dstSize.width);
- blitRegion.dstOffsets[1].y = static_cast<int32_t>(dstSize.height);
- blitRegion.dstOffsets[1].z = 1;
-
- blitRegion.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- blitRegion.srcSubresource.baseArrayLayer = 0;
- blitRegion.srcSubresource.layerCount = 1;
- blitRegion.srcSubresource.mipLevel = 0;
-
- blitRegion.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- blitRegion.dstSubresource.baseArrayLayer = 0;
- blitRegion.dstSubresource.layerCount = 1;
- blitRegion.dstSubresource.mipLevel = 0;
-
- VkBlitImageInfo2 blitInfo{.sType = VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2,
- .pNext = nullptr};
- blitInfo.dstImage = destination;
- blitInfo.dstImageLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
- blitInfo.srcImage = source;
- blitInfo.srcImageLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
- blitInfo.filter = VK_FILTER_LINEAR;
- blitInfo.regionCount = 1;
- blitInfo.pRegions = &blitRegion;
-
- vkCmdBlitImage2(cmd, &blitInfo);
+void vkutil::copyImageToImage(VkCommandBuffer cmd, VkImage source,
+ VkImage destination, VkExtent2D srcSize,
+ VkExtent2D dstSize) {
+ VkImageBlit2 blit_region{.sType = VK_STRUCTURE_TYPE_IMAGE_BLIT_2,
+ .pNext = nullptr};
+
+ blit_region.srcOffsets[1].x = static_cast<int32_t>(srcSize.width);
+ blit_region.srcOffsets[1].y = static_cast<int32_t>(srcSize.height);
+ blit_region.srcOffsets[1].z = 1;
+
+ blit_region.dstOffsets[1].x = static_cast<int32_t>(dstSize.width);
+ blit_region.dstOffsets[1].y = static_cast<int32_t>(dstSize.height);
+ blit_region.dstOffsets[1].z = 1;
+
+ blit_region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ blit_region.srcSubresource.baseArrayLayer = 0;
+ blit_region.srcSubresource.layerCount = 1;
+ blit_region.srcSubresource.mipLevel = 0;
+
+ blit_region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ blit_region.dstSubresource.baseArrayLayer = 0;
+ blit_region.dstSubresource.layerCount = 1;
+ blit_region.dstSubresource.mipLevel = 0;
+
+ VkBlitImageInfo2 blit_info{.sType = VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2,
+ .pNext = nullptr};
+ blit_info.dstImage = destination;
+ blit_info.dstImageLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
+ blit_info.srcImage = source;
+ blit_info.srcImageLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
+ blit_info.filter = VK_FILTER_LINEAR;
+ blit_info.regionCount = 1;
+ blit_info.pRegions = &blit_region;
+
+ vkCmdBlitImage2(cmd, &blit_info);
diff --git a/src/graphics/vulkan/vk_command_buffers_container.cpp b/src/graphics/vulkan/vk_command_buffers_container.cpp
index c1abcc6..0a4c12f 100644
--- a/src/graphics/vulkan/vk_command_buffers_container.cpp
+++ b/src/graphics/vulkan/vk_command_buffers_container.cpp
@@ -10,4 +10,5 @@ CommandBuffersContainer::CommandBuffersContainer() {
-void CommandBuffersContainer::init_sync_structures(VulkanEngine* vk_engine) {
- const VkFenceCreateInfo fenceCreateInfo =
- vkinit::fence_create_info(VK_FENCE_CREATE_SIGNALED_BIT);
- const VkSemaphoreCreateInfo semaphoreCreateInfo =
+static void CommandBuffersContainer::initSyncStructures(
+ VulkanEngine* vk_engine) {
+ const VkFenceCreateInfo fence_create_info =
+ vkinit::fenceCreateInfo(VK_FENCE_CREATE_SIGNALED_BIT);
+ const VkSemaphoreCreateInfo semaphore_create_info =
@@ -29,2 +30,3 @@ void CommandBuffersContainer::init_sync_structures(VulkanEngine* vk_engine) {
-����}�<���� ;`�����e;
- VK_CHECK(vkCreateFence(vk_engine->_device, &fenceCreateInfo, nullptr, &immFence));
+ VkFence imm_fence = nullptr;
+ VK_CHECK(vkCreateFence(vk_engine->_device, &fence_create_info, nullptr,
+ &imm_fence));
diff --git a/src/graphics/vulkan/GraphicsPipeline.cpp b/src/graphics/vulkan/GraphicsPipeline.cpp
index 64de296..82a5e68 100644
--- a/src/graphics/vulkan/GraphicsPipeline.cpp
+++ b/src/graphics/vulkan/GraphicsPipeline.cpp
@@ -3,3 +3,4 @@
-GraphicsPipeline::GraphicsPipeline(const GraphicsPipelineConfig& config)
- : _config(config) {
-}
+#include <utility>
+
+GraphicsPipeline::GraphicsPipeline(GraphicsPipelineConfig config)
+ : _config(std::move(config)) {}
@@ -9,6 +10,7 @@ void GraphicsPipeline::init(VkDevice device) {
-
- VkPipelineLayoutCreateInfo layoutInfo = vkinit::pipeline_layout_create_info();
-
- if (!_config.descriptorSetLayouts.empty()) {
- layoutInfo.setLayoutCount = static_cast<uint32_t>(_config.descriptorSetLayouts.size());
- layoutInfo.pSetLayouts = _config.descriptorSetLayouts.data();
+
+ VkPipelineLayoutCreateInfo layout_info = vkinit::pipelineLayoutCreateInfo();
+
+ if (!_config.descriptor_set_layouts.empty()) {
+ layout_info.setLayoutCount =
+ static_cast<uint32_t>(_config.descriptor_set_layouts.size());
+ layout_info.pSetLayouts = _config.descriptor_set_layouts.data();
@@ -16,4 +18,5 @@ void GraphicsPipeline::init(VkDevice device) {
-
- if (!_config.pushConstants.empty()) {
- layoutInfo.pushConstantRangeCount = static_cast<uint32_t>(_config.pushConstants.size());
- layoutInfo.pPushConstantRanges = _config.pushConstants.data();
+
+ if (!_config.push_constants.empty()) {
+ layout_info.pushConstantRangeCount =
+ static_cast<uint32_t>(_config.push_constants.size());
+ layout_info.pPushConstantRanges = _config.push_constants.data();
@@ -21,5 +24,7 @@ void GraphicsPipeline::init(VkDevice device) {
-youtI-nfo.pSetLayouts = _config.descriptorSetLayouts.data();
+
+ VkPipelineLayoutCreateIn-fo la-yout_info = vkinit::pipelineLayou-tCreateInfo();
+
+ if (!_config.descriptor_set_layouts.empty()) {
+ layout_info.setLayo+
+ VK_CHECK(vkCreatePipelineLayout(device, &layout_info, nullptr,
+ &_pipelineLayout));
+
+ VkShaderModule vertex_shader = nullptr;
+ if (!vkutil::loadShaderModule(_config.vertex_shader_path.c_str(), _device,
+ &vertex_shader)) {
@@ -29,3 +34,4 @@ void GraphicsPipeline::init(VkDevice device) {
-));
+- layout_info.pSetLayouts = _-config.descriptor_set_layouts.data();
@@ -16,4 +18,5 @@ void GraphicsPipeline::init(VkDevice device) +
+ VkShaderModule fragment_shader = nullptr;
+ if (!vkutil::loadShaderModule(_config.fragment_shader_path.c_str(), _device,
+ &fragment_shader)) {
@@ -33 +39 @@ void GraphicsPipeline::init(VkDevice device) {
-tInfo.pushConstantRangeCount = static_cast<uint32_t>(_config.pu+ vkDestroyShaderModule(_device, vertex_shader, nullptr);
@@ -36,8 +42,8 @@ void GraphicsPipeline::init(VkDevice device) {
- - layoutInfo.pPushConstantRanges = _-config.pushConstants.data();
+
+ if (!_config.push_constants-.empty()) {
+ layout_info.pushConstantRangeCount =
-+ static_cast<uint32_t>(_config.push_constant-s.size());
+ layout_info.pPushConstantRanges = _config.push_constants.d-ata();
@@ -21,5 +24,7 @@ void GraphicsPipeline-::ini+
+ PipelineBuilder pipeline_builder;
+ pipeline_builder.setShaders(vertex_shader, fragment_shader);
+ pipeline_builder.setInputTopology(_config.topology);
+ pipeline_builder.setPolygonMode(VK_POLYGON_MODE_FILL);
+ pipeline_builder.setCullMode(_config.cull_mode, VK_FRONT_FACE_CLOCKWISE);
+ pipeline_builder.setMultisamplingNone();
+
@@ -45 +51 @@ void GraphicsPipeline::init(VkDevice device) {
-nfo.pSetLayouts = _config.descriptorSetLayouts.data(+ pipeline_builder.enableBlendingAdditive();
@@ -47 +53 @@ void GraphicsPipeline::init(VkDevice device) {
-ipelineLayoutCreateIn-fo la-yout_info = vkin+ pipeline_builder.disable_blending();
@@ -51 +57 @@ void GraphicsPipeline::init(VkDevice device) {
-if (!_config.descriptor_set_layouts.empty()) {
+ layout_info.setL+ pipeline_builder.enable_depthtest(true, _config.depthCompareOp);
@@ -53 +59 @@ void GraphicsPipeline::init(VkDevice device) {
-CHECK(vkCreatePipelineLayout(device, &layout_+ pipeline_builder.disable_depthtest();
@@ -55,5 +61,5 @@ void GraphicsPipeline::init(VkDevice device) {
-nullp-tr,
+ &_pipelineLayout));
+
+ Vk-ShaderModule vertex_shader = nullptr;
+ if (!vkutil::loa-dShaderModule(_config.vertex_shader_path.c_str(), _devi-ce,
++
+ pipeline_builder.set_color_attachment_format(_config.colorFormat);
+ pipeline_builder.set_depth_format(_config.depthFormat);
+ pipeline_builder._pipelineLayout = _pipelineLayout;
+
@@ -61 +67 @@ void GraphicsPipeline::init(VkDevice device) {
-ex_shader)) {
@@ -29,3 +34,4 @@ void GraphicsPipeline:+ _config.customPipelineSetup(pipeline_builder);
@@ -63,5 +69,5 @@ void GraphicsPipeline::init(VkDevice device) {
-VkDev-ice device) {
-));
+- layout_info.pSetLayouts = _--confi-g.descriptor_set_layouts.data();
@@ -16,4 +18,5 @@ void Gra-phicsPipeline::init(VkDevice device) +
+ VkShaderModule fr+
+ _pipeline = pipeline_builder.build_pipeline(_device);
+
+ vkDestroyShaderModule(_device, vertex_shader, nullptr);
+ vkDestroyShaderModule(_device, fragment_shader, nullptr);
diff --git a/src/graphics/vulkan/vk_engine.cpp b/src/graphics/vulkan/vk_engine.cpp
index 99b9429..d4c6385 100644
--- a/src/graphics/vulkan/vk_engine.cpp
+++ b/src/graphics/vulkan/vk_engine.cpp
@@ -40 +40 @@
-VulkanEngine* loadedEngine = nullptr;
+VulkanEngine* loaded_engine = nullptr;
@@ -42,2 +42,2 @@ VulkanEngine* loadedEngine = nullptr;
-VulkanEngine& VulkanEngine::Get() {
- return *loadedEngine;
+auto VulkanEngine::Get() -> VulkanEngine& {
+ return *loaded_engine;
@@ -49 +49 @@ constexpr bool bUseValidationLayers = false;
-constexpr bool bUseValidationLayers = true;
+constexpr bool kBUseValidationLayers = true;
@@ -52 +52 @@ constexpr bool bUseValidationLayers = true;
-VKAPI_ATTR VkBool32 VKAPI_CALL VulkanEngine::debugCallback(
+VKAPI_ATTR auto VKAPI_CALL VulkanEngine::debugCallback(
@@ -56 +56 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanEngine::debugCallback(
- [[maybe_unused]] void* pUserData) {
+ [[maybe_unused]] void* pUserData) -> VkBool32 {
@@ -101 +101 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanEngine::debugCallback(
-void VulkanEngine::init_default_data() {
+static void VulkanEngine::initDefaultData() {
@@ -125 +125,2 @@ void VulkanEngine::init_default_data() {
- AllocatedImage whiteImageData = create_image(&white, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
+ AllocatedImage white_image_data =
+ create_image(&white, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
@@ -129,2 +130,3 @@ void VulkanEngine::init_default_data() {
- const uint32_t grey = glm::packUnorm4x8(glm::vec4(0.66f, 0.66f, 0.66f, 1));
- AllocatedImage greyImageData = create_image(&grey, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
+ const uint32_t grey = glm::packUnorm4x8(glm::vec4(0.66F, 0.66F, 0.66F, 1));
+ AllocatedImage grey_image_data =
+ create_image(&grey, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
@@ -135 +137,2 @@ void VulkanEngine::init_default_data() {
- AllocatedImage blackImageData = create_image(&black, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
+ AllocatedImage black_image_data =
+ create_image(&black, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
@@ -144 +147,2 @@ void VulkanEngine::init_default_data() {
- pixels[y * 16 + x] = ((x % 2) ^ (y % 2)) ? magenta : black;
+ pixels[(y * 16) + x] =
+ (((x % 2) ^ (y % 2)) != 0u) ? magenta : black;
@@ -147 +151,2 @@ void VulkanEngine::init_default_data() {
- AllocatedImage errorImageData = create_image(pixels.data(), VkExtent3D{16, 16, 1},
+ AllocatedImage error_image_data =
+ create_image(pixels.data(), VkExtent3D{16, 16, 1},
@@ -163 +168 @@ void VulkanEngine::init_default_data() {
- GLTFMetallic_Roughness::MaterialResources materialResources{};
+ GLTFMetallic_Roughness::MaterialResources material_resources{};
@@ -171 +176 @@ void VulkanEngine::init_default_data() {
- const AllocatedBuffer materialConstants = create_buffer(
+ const AllocatedBuffer material_constants = create_buffer(
@@ -176 +181 @@ void VulkanEngine::init_default_data() {
- auto* sceneUniformData =
+ auto* scene_uniform_data =
@@ -179,2 +184,2 @@ void VulkanEngine::init_default_data() {
- sceneUniformData->colorFactors = glm::vec4{1, 1, 1, 1};
- sceneUniformData->metal_rough_factors = glm::vec4{1, 0.5, 0, 0};
+ scene_uniform_data->colorFactors = glm::vec4{1, 1, 1, 1};
+ scene_uniform_data->metal_rough_factors = glm::vec4{1, 0.5, 0, 0};
@@ -185,2 +190,2 @@ void VulkanEngine::init_default_data() {
- materialResources.dataBuffer = materialConstants.buffer;
- materialResources.dataBufferOffset = 0;
+ material_resources.dataBuffer = material_constants.buffer;
+ material_resources.dataBufferOffset = 0;
@@ -193 +198 @@ void VulkanEngine::init_default_data() {
-void VulkanEngine::init_imgui() {
+static void VulkanEngine::initImgui() {
@@ -217 +222 @@ void VulkanEngine::init_imgui() {
- VkDescriptorPool imguiPool;
+ VkDescriptorPool imgui_pool = nullptr;
@@ -234 +239 @@ void VulkanEngine::init_imgui() {
- init_info.DescriptorPool = imguiPool;
+ init_info.DescriptorPool = imgui_pool;
@@ -257 +262 @@ void VulkanEngine::init_imgui() {
-void VulkanEngine::init_descriptors() {
+static void VulkanEngine::initDescriptors() {
@@ -315 +320 @@ void VulkanEngine::init_descriptors() {
-void VulkanEngine::init_pipelines() {
+void VulkanEngine::initPipelines() {
@@ -325,2 +330,2 @@ void VulkanEngine::init(SDL_Window* window) {
- assert(loadedEngine == nullptr);
- loadedEngine = this;
+ assert(loaded_engine == nullptr);
+ loaded_engine = this;
@@ -344,3 +349,3 @@ void VulkanEngine::init(SDL_Window* window) {
- const std::string structurePath = {std::string(ASSETS_DIR) +
- "/basicmesh.glb"};
- const auto structureFile = loadGltf(this, structurePath);
+ const std::string structure_path = {std::string(ASSETS_DIR) +
+ "/basicmesh.glb"};
+ const auto structure_file = loadGltf(this, structure_path);
@@ -354 +359 @@ void VulkanEngine::init(SDL_Window* window) {
-void VulkanEngine::init_vulkan() {
+static void VulkanEngine::initVulkan() {
@@ -379 +384 @@ void VulkanEngine::init_vulkan() {
- .request_validation_layers(bUseValidationLayers)
+ .request_validation_layers(kBUseValidationLayers)
@@ -396 +401 @@ void VulkanEngine::init_vulkan() {
- if (!err) {
+ if (err == 0u) {
@@ -402,2 +407,2 @@ void VulkanEngine::init_vulkan() {
- features.dynamicRendering = true;
- features.synchronization2 = true;
+ features.dynamicRendering = 1u;
+ features.synchronization2 = 1u;
@@ -407,2 +412,2 @@ void VulkanEngine::init_vulkan() {
- features12.bufferDeviceAddress = true;
- features12.descriptorIndexing = true;
+ features12.bufferDeviceAddress = 1u;
+ features12.descriptorIndexing = 1u;
@@ -426 +431 @@ void VulkanEngine::init_vulkan() {
- const vkb::PhysicalDevice& physicalDevice = physical_device_ret.value();
+ const vkb::PhysicalDevice& physical_device = physical_device_ret.value();
@@ -428 +433 @@ void VulkanEngine::init_vulkan() {
- vkb::DeviceBuilder deviceBuilder{physicalDevice};
+ vkb::DeviceBuilder device_builder{physical_device};
@@ -430 +435 @@ void VulkanEngine::init_vulkan() {
- auto dev_ret = deviceBuilder.build();
+ auto dev_ret = device_builder.build();
@@ -436 +441 @@ void VulkanEngine::init_vulkan() {
- const vkb::Device& vkbDevice = dev_ret.value();
+ const vkb::Device& vkb_device = dev_ret.value();
@@ -442 +447 @@ void VulkanEngine::init_vulkan() {
- auto queue_ret = vkbDevice.get_queue(vkb::QueueType::graphics);
+ auto queue_ret = vkb_device.get_queue(vkb::QueueType::graphics);
@@ -450 +455,2 @@ void VulkanEngine::init_vulkan() {
- auto queue_family_ret = vkbDevice.get_queue_index(vkb::QueueType::graphics);
+ auto queue_family_ret =
+ vkb_device.get_queue_index(vkb::QueueType::graphics);
@@ -459 +465 @@ void VulkanEngine::init_vulkan() {
- VmaAllocatorCreateInfo allocatorInfo = {};
+ VmaAllocatorCreateInfo allocator_info = {};
@@ -463 +469 @@ void VulkanEngine::init_vulkan() {
- allocatorInfo.flags = VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT;
+ allocator_info.flags = VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT;
@@ -469,3 +475,2 @@ void VulkanEngine::init_vulkan() {
-
-void VulkanEngine::create_swapchain(uint32_t width, uint32_t height) {
- vkb::SwapchainBuilder swapchainBuilder{_chosenGPU, _device, _surface};
+static void VulkanEngine::createSwapchain(uint32_t width, uint32_t height) {
+ vkb::SwapchainBuilder swapchain_builder{_chosenGPU, _device, _surface};
@@ -492 +497 @@ void VulkanEngine::create_swapchain(uint32_t width, uint32_t height) {
- vkb::Swapchain vkbSwapchain = swap_ret.value();
+ vkb::Swapchain vkb_swapchain = swap_ret.value();
@@ -501 +506 @@ void VulkanEngine::create_swapchain(uint32_t width, uint32_t height) {
-void VulkanEngine::init_swapchain() {
+static void VulkanEngine::initSwapchain() {
@@ -505,2 +510,2 @@ void VulkanEngine::init_swapchain() {
- const VkExtent3D drawImageExtent = {_windowExtent.width,
- _windowExtent.height, 1};
+ const VkExtent3D draw_image_extent = {_windowExtent.width,
+ _windowExtent.height, 1};
@@ -509 +514 @@ void VulkanEngine::init_swapchain() {
- VkFormat drawImageFormat = VK_FORMAT_R16G16B16A16_SFLOAT;
+ VkFormat draw_image_format = VK_FORMAT_R16G16B16A16_SFLOAT;
@@ -511,5 +516,5 @@ void VulkanEngine::init_swapchain() {
- VkImageUsageFlags drawImageUsages{};
- drawImageUsages |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
- drawImageUsages |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
- drawImageUsages |= VK_IMAGE_USAGE_STORAGE_BIT;
- drawImageUsages |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+ VkImageUsageFlags draw_image_usages{};
+ draw_image_usages |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+ draw_image_usages |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+ draw_image_usages |= VK_IMAGE_USAGE_STORAGE_BIT;
+ draw_image_usages |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
@@ -526,3 +531,3 @@ void VulkanEngine::init_swapchain() {
- AllocatedImage drawImageData{};
- drawImageData.imageFormat = drawImageFormat;
- drawImageData.imageExtent = drawImageExtent;
+ AllocatedImage draw_image_data{};
+ draw_image_data.imageFormat = draw_image_format;
+ draw_image_data.imageExtent = draw_image_extent;
@@ -546,5 +551,2 @@ void VulkanEngine::init_swapchain() {
- VkExtent3D depthImageExtent = {
- _windowExtent.width,
- _windowExtent.height,
- 1
- };
+ VkExtent3D depth_image_extent = {_windowExtent.width, _windowExtent.height,
+ 1};
@@ -552 +554 @@ void VulkanEngine::init_swapchain() {
- VkFormat depthFormat = VK_FORMAT_D32_SFLOAT;
+ VkFormat depth_format = VK_FORMAT_D32_SFLOAT;
@@ -564,3 +566,3 @@ void VulkanEngine::init_swapchain() {
- AllocatedImage depthImageData{};
- depthImageData.imageFormat = depthFormat;
- depthImageData.imageExtent = depthImageExtent;
+ AllocatedImage depth_image_data{};
+ depth_image_data.imageFormat = depth_format;
+ depth_image_data.imageExtent = depth_image_extent;
@@ -583 +585 @@ void VulkanEngine::init_swapchain() {
-void VulkanEngine::destroy_swapchain() {
+void VulkanEngine::destroySwapchain() {
@@ -625 +627 @@ void VulkanEngine::cleanup() {
- loadedEngine = nullptr;
+ loaded_engine = nullptr;
@@ -628,3 +630,3 @@ void VulkanEngine::cleanup() {
-AllocatedBuffer VulkanEngine::create_buffer(size_t allocSize,
- VkBufferUsageFlags usage,
- VmaMemoryUsage memoryUsage) const {
+static AllocatedBuffer VulkanEngine::createBuffer(size_t allocSize,
+ VkBufferUsageFlags usage,
+ VmaMemoryUsage memoryUsage) {
@@ -632 +634 @@ AllocatedBuffer VulkanEngine::create_buffer(size_t allocSize,
- VkBufferCreateInfo bufferInfo = {
+ VkBufferCreateInfo buffer_info = {
@@ -634,2 +636,2 @@ AllocatedBuffer VulkanEngine::create_buffer(size_t allocSize,
- bufferInfo.pNext = nullptr;
- bufferInfo.size = allocSize;
+ buffer_info.pNext = nullptr;
+ buffer_info.size = allocSize;
@@ -637 +639 @@ AllocatedBuffer VulkanEngine::create_buffer(size_t allocSize,
- bufferInfo.usage = usage;
+ buffer_info.usage = usage;
@@ -642 +644 @@ AllocatedBuffer VulkanEngine::create_buffer(size_t allocSize,
- AllocatedBuffer newBuffer{};
+ AllocatedBuffer new_buffer{};
@@ -649 +651 @@ AllocatedBuffer VulkanEngine::create_buffer(size_t allocSize,
- return newBuffer;
+ return new_buffer;
@@ -652 +654 @@ AllocatedBuffer VulkanEngine::create_buffer(size_t allocSize,
-void VulkanEngine::destroy_buffer(const AllocatedBuffer& buffer) const {
+void VulkanEngine::destroyBuffer(const AllocatedBuffer& buffer) const {
@@ -656,4 +658,4 @@ void VulkanEngine::destroy_buffer(const AllocatedBuffer& buffer) const {
-GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- std::span<Vertex> vertices) {
- const size_t vertexBufferSize = vertices.size() * sizeof(Vertex);
- const size_t indexBufferSize = indices.size() * sizeof(uint32_t);
+auto VulkanEngine::uploadMesh(std::span<uint32_t> indices,
+ std::span<Vertex> vertices) -> GPUMeshBuffers {
+ const size_t vertex_buffer_size = vertices.size() * sizeof(Vertex);
+ const size_t index_buffer_size = indices.size() * sizeof(uint32_t);
@@ -661 +663 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- GPUMeshBuffers newSurface{};
+ GPUMeshBuffers new_surface{};
@@ -672 +674 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- const VkBufferDeviceAddressInfo deviceAddressInfo{
+ const VkBufferDeviceAddressInfo device_address_info{
@@ -674 +676 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- .buffer = newSurface.vertexBuffer.buffer};
+ .buffer = new_surface.vertexBuffer.buffer};
@@ -691 +693 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- memcpy(data, vertices.data(), vertexBufferSize);
+ memcpy(data, vertices.data(), vertex_buffer_size);
@@ -693,18 +695,20 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- memcpy((char*)data + vertexBufferSize, indices.data(), indexBufferSize);
-
- command_buffers.immediate_submit([&](VkCommandBuffer cmd) {
- VkBufferCopy vertexCopy{0};
- vertexCopy.dstOffset = 0;
- vertexCopy.srcOffset = 0;
- vertexCopy.size = vertexBufferSize;
-
- vkCmdCopyBuffer(cmd, staging.buffer, newSurface.vertexBuffer.buffer, 1,
- &vertexCopy);
-
- VkBufferCopy indexCopy{0};
- indexCopy.dstOffset = 0;
- indexCopy.srcOffset = vertexBufferSize;
- indexCopy.size = indexBufferSize;
-
- vkCmdCopyBuffer(cmd, staging.buffer, newSurface.indexBuffer.buffer, 1,
- &indexCopy);
+ memcpy((char*)data + vertex_buffer_size, indices.data(), index_buffer_size);
+
+ command_buffers.immediate_submit(
+ [&](VkCommandBuffer cmd) {
+ VkBufferCopy vertex_copy{0};
+ vertex_copy.dstOffset = 0;
+ vertex_copy.srcOffset = 0;
+ vertex_copy.size = vertex_buffer_size;
+
+ vkCmdCopyBuffer(cmd, staging.buffer,
+ new_surface.vertexBuffer.buffer, 1,
+ &vertex_copy);
+
+ VkBufferCopy index_copy{0};
+ index_copy.dstOffset = 0;
+ index_copy.srcOffset = vertex_buffer_size;
+ index_copy.size = index_buffer_size;
+
+ vkCmdCopyBuffer(cmd, staging.buffer,
+ new_surface.indexBuffer.buffer, 1, &index_copy);
@@ -719 +723 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- return newSurface;
+ return new_surface;
@@ -722 +726 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
-void VulkanEngine::draw_background(VkCommandBuffer cmd) const {
+void VulkanEngine::drawBackground(VkCommandBuffer cmd) const {
@@ -737,3 +741,3 @@ void VulkanEngine::draw_background(VkCommandBuffer cmd) const {
-void VulkanEngine::draw_imgui(VkCommandBuffer cmd,
- VkImageView targetImageView) const {
- const VkRenderingAttachmentInfo colorAttachment = vkinit::attachment_info(
+static void VulkanEngine::drawImgui(VkCommandBuffer cmd,
+ VkImageView targetImageView) {
+ const VkRenderingAttachmentInfo color_attachment = vkinit::attachment_info(
@@ -741 +745 @@ void VulkanEngine::draw_imgui(VkCommandBuffer cmd,
- const VkRenderingInfo renderInfo =
+ const VkRenderingInfo render_info =
@@ -744 +748 @@ void VulkanEngine::draw_imgui(VkCommandBuffer cmd,
- vkCmdBeginRendering(cmd, &renderInfo);
+ vkCmdBeginRendering(cmd, &render_info);
@@ -751 +755 @@ void VulkanEngine::draw_imgui(VkCommandBuffer cmd,
-void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
+void VulkanEngine::drawGeometry(VkCommandBuffer cmd) {
@@ -753 +757 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- AllocatedBuffer gpuSceneDataBuffer = create_buffer(
+ AllocatedBuffer gpu_scene_data_buffer = create_buffer(
@@ -762,2 +766,2 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- auto* sceneUniformData =
- (GPUSceneData*)gpuSceneDataBuffer.allocation->GetMappedData();
+ auto* scene_uniform_data =
+ (GPUSceneData*)gpu_scene_data_buffer.allocation->GetMappedData();
@@ -767 +771 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- VkDescriptorSet globalDescriptor =
+ VkDescriptorSet global_descriptor = nullptr =
@@ -772,2 +776,2 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- writer.write_buffer(0, gpuSceneDataBuffer.buffer, sizeof(GPUSceneData), 0,
- VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
+ writer.write_buffer(0, gpu_scene_data_buffer.buffer, sizeof(GPUSceneData),
+ 0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
@@ -776 +780 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- VkRenderingAttachmentInfo colorAttachment = vkinit::attachment_info(
+ VkRenderingAttachmentInfo color_attachment = vkinit::attachment_info(
@@ -779 +783 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- VkRenderingInfo renderInfo =
+ VkRenderingInfo render_info =
@@ -781 +785 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- vkCmdBeginRendering(cmd, &renderInfo);
+ vkCmdBeginRendering(cmd, &render_info);
@@ -791,2 +795,2 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- viewport.minDepth = 0.f;
- viewport.maxDepth = 1.f;
+ viewport.minDepth = 0.F;
+ viewport.maxDepth = 1.F;
@@ -805,2 +809,3 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- VkDescriptorSet imageSet = get_current_frame()._frameDescriptors.allocate(
- _device, _singleImageDescriptorLayout);
+ VkDescriptorSet image_set = nullptr =
+ get_current_frame()._frameDescriptors.allocate(
+ _device, _singleImageDescriptorLayout);
@@ -814 +819 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- pipelines.meshPipeline->bindDescriptorSets(cmd, &imageSet, 1);
+ pipelines.meshPipeline->bindDescriptorSets(cmd, &image_set, 1);
@@ -857 +862 @@ void VulkanEngine::draw() {
- uint32_t swapchainImageIndex;
+ uint32_t swapchain_image_index = 0;
@@ -876 +881 @@ void VulkanEngine::draw() {
- const VkCommandBufferBeginInfo cmdBeginInfo =
+ const VkCommandBufferBeginInfo cmd_begin_info =
@@ -889 +894 @@ void VulkanEngine::draw() {
- VK_CHECK(vkBeginCommandBuffer(cmd, &cmdBeginInfo));
+ VK_CHECK(vkBeginCommandBuffer(cmd, &cmd_begin_info));
@@ -943 +948 @@ void VulkanEngine::draw() {
- const VkSemaphoreSubmitInfo waitInfo = vkinit::semaphore_submit_info(
+ const VkSemaphoreSubmitInfo wait_info = vkinit::semaphore_submit_info(
@@ -946,3 +951,3 @@ void VulkanEngine::draw() {
- const VkSemaphoreSubmitInfo signalInfo =
- vkinit::semaphore_submit_info(VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT,
- get_current_frame()._renderSemaphore->get());
+ const VkSemaphoreSubmitInfo signal_info = vkinit::semaphore_submit_info(
+ VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT,
+ get_current_frame()._renderSemaphore->get());
@@ -963,3 +968,3 @@ void VulkanEngine::draw() {
- VkPresentInfoKHR presentInfo = {};
- presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
- presentInfo.pNext = nullptr;
+ VkPresentInfoKHR present_info = {};
+ present_info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
+ present_info.pNext = nullptr;
@@ -967 +972 @@ void VulkanEngine::draw() {
- presentInfo.swapchainCount = 1;
+ present_info.swapchainCount = 1;
@@ -969,2 +974,3 @@ void VulkanEngine::draw() {
- presentInfo.pWaitSemaphores = get_current_frame()._renderSemaphore->getPtr();
- presentInfo.waitSemaphoreCount = 1;
+ present_info.pWaitSemaphores =
+ get_current_frame()._renderSemaphore->getPtr();
+ present_info.waitSemaphoreCount = 1;
@@ -972 +978 @@ void VulkanEngine::draw() {
- presentInfo.pImageIndices = &swapchainImageIndex;
+ present_info.pImageIndices = &swapchain_image_index;
@@ -974,2 +980,2 @@ void VulkanEngine::draw() {
- VkResult presentResult = vkQueuePresentKHR(_graphicsQueue, &presentInfo);
- if (presentResult == VK_ERROR_OUT_OF_DATE_KHR) {
+ VkResult present_result = vkQueuePresentKHR(_graphicsQueue, &presentInfo);
+ if (present_result == VK_ERROR_OUT_OF_DATE_KHR) {
@@ -983 +989 @@ void VulkanEngine::draw() {
-void VulkanEngine::resize_swapchain() {
+void VulkanEngine::resizeSwapchain() {
@@ -988 +994,2 @@ void VulkanEngine::resize_swapchain() {
- int w, h;
+ int w;
+ int h;
@@ -1006,6 +1013,7 @@ void VulkanEngine::update() {
-AllocatedImage VulkanEngine::create_image(VkExtent3D size, VkFormat format,
- VkImageUsageFlags usage,
- bool mipmapped) const {
- AllocatedImage newImage{};
- newImage.imageFormat = format;
- newImage.imageExtent = size;
+static AllocatedImage VulkanEngine::createImage(VkExtent3D size,
+ VkFormat format,
+ VkImageUsageFlags usage,
+ bool mipmapped) {
+ AllocatedImage new_image{};
+ new_image.imageFormat = format;
+ new_image.imageExtent = size;
@@ -1032 +1040 @@ AllocatedImage VulkanEngine::create_image(VkExtent3D size, VkFormat format,
- VkImageAspectFlags aspectFlag = VK_IMAGE_ASPECT_COLOR_BIT;
+ VkImageAspectFlags aspect_flag = VK_IMAGE_ASPECT_COLOR_BIT;
@@ -1034 +1042 @@ AllocatedImage VulkanEngine::create_image(VkExtent3D size, VkFormat format,
- aspectFlag = VK_IMAGE_ASPECT_DEPTH_BIT;
+ aspect_flag = VK_IMAGE_ASPECT_DEPTH_BIT;
@@ -1045 +1053 @@ AllocatedImage VulkanEngine::create_image(VkExtent3D size, VkFormat format,
- return newImage;
+ return new_image;
@@ -1048,4 +1056,3 @@ AllocatedImage VulkanEngine::create_image(VkExtent3D size, VkFormat format,
-AllocatedImage VulkanEngine::create_image(const void* data, VkExtent3D size,
- VkFormat format,
- VkImageUsageFlags usage,
- bool mipmapped) const {
+auto VulkanEngine::createImage(const void* data, VkExtent3D size,
+ VkFormat format, VkImageUsageFlags usage,
+ bool mipmapped) const -> AllocatedImage {
@@ -1070,4 +1077,4 @@ AllocatedImage VulkanEngine::create_image(const void* data, VkExtent3D size,
- VkBufferImageCopy copyRegion = {};
- copyRegion.bufferOffset = 0;
- copyRegion.bufferRowLength = 0;
- copyRegion.bufferImageHeight = 0;
+ VkBufferImageCopy copy_region = {};
+ copy_region.bufferOffset = 0;
+ copy_region.bufferRowLength = 0;
+ copy_region.bufferImageHeight = 0;
@@ -1075,5 +1082,5 @@ AllocatedImage VulkanEngine::create_image(const void* data, VkExtent3D size,
- copyRegion.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- copyRegion.imageSubresource.mipLevel = 0;
- copyRegion.imageSubresource.baseArrayLayer = 0;
- copyRegion.imageSubresource.layerCount = 1;
- copyRegion.imageExtent = size;
+ copy_region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ copy_region.imageSubresource.mipLevel = 0;
+ copy_region.imageSubresource.baseArrayLayer = 0;
+ copy_region.imageSubresource.layerCount = 1;
+ copy_region.imageExtent = size;
@@ -1084 +1091 @@ AllocatedImage VulkanEngine::create_image(const void* data, VkExtent3D size,
- ©Region);
+ ©_region);
@@ -1097 +1104 @@ AllocatedImage VulkanEngine::create_image(const void* data, VkExtent3D size,
-void VulkanEngine::destroy_image(const AllocatedImage& img) const {
+void VulkanEngine::destroyImage(const AllocatedImage& img) const {
@@ -1102,2 +1109,2 @@ void VulkanEngine::destroy_image(const AllocatedImage& img) const {
-void MeshNode::Draw(const glm::mat4& topMatrix, DrawContext& ctx) {
- const glm::mat4 nodeMatrix = topMatrix * worldTransform;
+static void MeshNode::draw(const glm::mat4& topMatrix, DrawContext& ctx) {
+ const glm::mat4 node_matrix = topMatrix * worldTransform;
@@ -1121 +1128 @@ void MeshNode::Draw(const glm::mat4& topMatrix, DrawContext& ctx) {
-void VulkanEngine::update_scene() {
+static void VulkanEngine::updateScene() {
@@ -1150 +1157 @@ void VulkanEngine::update_scene() {
-int64_t VulkanEngine::registerMesh(const std::string& filePath) {
+auto VulkanEngine::registerMesh(const std::string& filePath) -> int64_t {
@@ -1162,2 +1169,2 @@ int64_t VulkanEngine::registerMesh(const std::string& filePath) {
- const std::string structurePath = {std::string(ASSETS_DIR) + filePath};
- const auto structureFile = loadGltf(this, structurePath);
+ const std::string structure_path = {std::string(ASSETS_DIR) + filePath};
+ const auto structure_file = loadGltf(this, structure_path);
@@ -1168 +1175 @@ int64_t VulkanEngine::registerMesh(const std::string& filePath) {
- transforms[random_int64] = glm::mat4(1.0f);
+ transforms[random_int64] = glm::mat4(1.0F);
diff --git a/src/graphics/vulkan/vk_pipelines.cpp b/src/graphics/vulkan/vk_pipelines.cpp
index 40438f0..d2bf801 100644
--- a/src/graphics/vulkan/vk_pipelines.cpp
+++ b/src/graphics/vulkan/vk_pipelines.cpp
@@ -12,2 +12,2 @@
-bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- VkShaderModule* outShaderModule) {
+auto vkutil::loadShaderModule(const char* filePath, VkDevice device,
+ VkShaderModule* outShaderModule) -> bool {
@@ -31 +31 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- const auto fileSize = file.tellg();
+ const auto file_size = file.tellg();
@@ -33 +33 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- if (fileSize == -1) {
+ if (file_size == -1) {
@@ -40 +40 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- std::vector<uint32_t> buffer(static_cast<uint32_t>(fileSize) /
+ std::vector<uint32_t> buffer(static_cast<uint32_t>(file_size) /
@@ -47 +47 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- file.read(reinterpret_cast<char*>(buffer.data()), fileSize);
+ file.read(reinterpret_cast<char*>(buffer.data()), file_size);
@@ -53,3 +53,3 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- VkShaderModuleCreateInfo createInfo = {};
- createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
- createInfo.pNext = nullptr;
+ VkShaderModuleCreateInfo create_info = {};
+ create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
+ create_info.pNext = nullptr;
@@ -59,2 +59,2 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- createInfo.codeSize = buffer.size() * sizeof(uint32_t);
- createInfo.pCode = buffer.data();
+ create_info.codeSize = buffer.size() * sizeof(uint32_t);
+ create_info.pCode = buffer.data();
@@ -63 +63 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- VkShaderModule shaderModule;
+ VkShaderModule shader_module = nullptr;
@@ -65 +65 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- vkCreateShaderModule(device, &createInfo, nullptr, &shaderModule);
+ vkCreateShaderModule(device, &create_info, nullptr, &shader_module);
@@ -70 +70 @@ bool vkutil::load_shader_module(const char* filePath, VkDevice device,
- *outShaderModule = shaderModule;
+ *outShaderModule = shader_module;
@@ -77,5 +77,5 @@ void PipelineBuilder::clear() {
- _inputAssembly = {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
- .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
- .primitiveRestartEnable = VK_FALSE
- };
+ input_assembly = {
+ .sType =
+ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
+ .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
+ .primitiveRestartEnable = VK_FALSE};
@@ -84,12 +84,12 @@ void PipelineBuilder::clear() {
- _rasterizer = {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
- .depthClampEnable = VK_FALSE,
- .rasterizerDiscardEnable = VK_FALSE,
- .polygonMode = VK_POLYGON_MODE_FILL,
- .cullMode = VK_CULL_MODE_NONE,
- .frontFace = VK_FRONT_FACE_CLOCKWISE,
- .depthBiasEnable = VK_FALSE,
- .depthBiasConstantFactor = 0.0f,
- .depthBiasClamp = 0.0f,
- .depthBiasSlopeFactor = 0.0f,
- .lineWidth = 1.0f // CRITICAL: Must be 1.0f, not 0.0f
+ rasterizer = {
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
+ .depthClampEnable = VK_FALSE,
+ .rasterizerDiscardEnable = VK_FALSE,
+ .polygonMode = VK_POLYGON_MODE_FILL,
+ .cullMode = VK_CULL_MODE_NONE,
+ .frontFace = VK_FRONT_FACE_CLOCKWISE,
+ .depthBiasEnable = VK_FALSE,
+ .depthBiasConstantFactor = 0.0F,
+ .depthBiasClamp = 0.0F,
+ .depthBiasSlopeFactor = 0.0F,
+ .lineWidth = 1.0F // CRITICAL: Must be 1.0f, not 0.0f
@@ -99,5 +99,5 @@ void PipelineBuilder::clear() {
- _colorBlendAttachment = {
- .blendEnable = VK_FALSE,
- .colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
- VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT
- };
+ color_blend_attachment = {.blendEnable = VK_FALSE,
+ .colorWriteMask = VK_COLOR_COMPONENT_R_BIT |
+ VK_COLOR_COMPONENT_G_BIT |
+ VK_COLOR_COMPONENT_B_BIT |
+ VK_COLOR_COMPONENT_A_BIT};
@@ -106,11 +106,12 @@ void PipelineBuilder::clear() {
- _multisampling = {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
- .rasterizationSamples = VK_SAMPLE_COUNT_1_BIT, // CRITICAL: Must be valid sample count
- .sampleShadingEnable = VK_FALSE,
- .minSampleShading = 1.0f,
- .pSampleMask = nullptr,
- .alphaToCoverageEnable = VK_FALSE,
- .alphaToOneEnable = VK_FALSE
- };
-
- _pipelineLayout = {};
+ multisampling = {
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
+ .rasterizationSamples =
+ VK_SAMPLE_COUNT_1_BIT, // CRITICAL: Must be valid sample
+ // count
+ .sampleShadingEnable = VK_FALSE,
+ .minSampleShading = 1.0F,
+ .pSampleMask = nullptr,
+ .alphaToCoverageEnable = VK_FALSE,
+ .alphaToOneEnable = VK_FALSE};
+
+ pipeline_layout = {};
@@ -119,10 +120,9 @@ void PipelineBuilder::clear() {
-TICAL: Must be 1.0f, n-ot 0.0f
@@ -99,5 +99,5 @@ void PipelineBuilder::clear() {
- _colorBlendAtt-achment = {
- .blendEnable = V-K_FALSE,
- .colorWriteMask = VK-_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_-BIT |
- VK_COLOR_C-OMPONENT_B_BIT | VK_COLOR_COMPONENT_A_B-IT
- };
+ color_blend_atta-chment = {.blendEnable = VK_FAL-SE,
+ + depth_stencil = {
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
+ .depthTestEnable = VK_FALSE,
+ .depthWriteEnable = VK_FALSE,
+ .depthCompareOp = VK_COMPARE_OP_LESS,
+ .depthBoundsTestEnable = VK_FALSE,
+ .stencilTestEnable = VK_FALSE,
+ .minDepthBounds = 0.0F,
+ .maxDepthBounds = 1.0F};
@@ -131,4 +131,2 @@ void PipelineBuilder::clear() {
-COMPONENT_R_BIT |
+ - VK_COLOR_COMPONENT_G-_BIT |
+ - VK_C+ render_info = {.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO,
+ .depthAttachmentFormat = VK_FORMAT_UNDEFINED};
@@ -136 +134 @@ void PipelineBuilder::clear() {
-LOR_COMPONENT_B_BIT |
+ + shader_stages.clear();
@@ -139 +137 @@ void PipelineBuilder::clear() {
- VK_COLOR_COMPONENT_A_BIT};
+auto PipelineBuilder::buildPipeline(VkDevice device) const -> VkPipeline {
@@ -141 +139 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-ampling = {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_MUL+ VkPipelineRenderingCreateInfo render_info = render_info;
@@ -144 +142 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-hadingEnable = VK_FALSE,
- .minSampleShading = 1.0f,
- .pSamp+ VkPipelineInputAssemblyStateCreateInfo input_assembly = input_assembly;
@@ -147,2 +145,2 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-verageEnable = VK_FALSE,
- .alphaToOneEnab-le = VK_FALSE
- };
-
- _pipelineLayout = {};
+ multisam+ if (render_info.depthAttachmentFormat == 0) {
+ render_info.depthAttachmentFormat = VK_FORMAT_UNDEFINED;
@@ -152,2 +150,2 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-PELINE_MULTISAMPLE_STATE_CREATE_INFO,
+ - .rasterizationSamples =
+ + if (rasterizer.lineWidth <= 0.0F) {
+ rasterizer.lineWidth = 1.0F;
@@ -162,2 +160,2 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-ptr,
+ .alphaToCoverageEnable = VK_FALSE,
+ .alp-haToOneEnable = VK_FALSE};
+
+ pipeline_layout = {};
@@ -119,10 +12+ if (input_assembly.topology == VK_PRIMITIVE_TOPOLOGY_POINT_LIST) {
+ input_assembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
@@ -167,5 +165,6 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-@ -99,5 +99,5 @@ void PipelineBuilder::clear() {
- _col-orBlendAtt-achment = {
- .blendEnable = V-K_FALSE,
- .colorWriteMas-k = VK-_COLOR_COMPONENT_R_BIT | VK_-COLOR_COMPONENT_G_-BIT |
- - VK_COLOR_C-OMPONENT_B+ VkPipelineViewportStateCreateInfo viewport_state = {};
+ viewport_state.sType =
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
+ viewport_state.pNext = nullptr;
+ viewport_state.viewportCount = 1;
+ viewport_state.scissorCount = 1;
@@ -173,5 +172,6 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-
+ color_blend_atta-chment = {.blendEnable = VK_FAL-SE,
+ + depth_stencil = {
+ - .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_ST-ATE_CREATE_INFO,
+ .depthTestEnable = VK_FALSE,
+ .depthW-riteEnable = VK_FALSE,
+ .depthCompare-Op = VK_COMPARE_OP_LESS,
+ .d+ VkDynamicState dynamic_states[] = {VK_DYNAMIC_STATE_VIEWPORT,
+ VK_DYNAMIC_STATE_SCISSOR};
+ VkPipelineDynamicStateCreateInfo dynamic_state = {};
+ dynamic_state.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
+ dynamic_state.pDynamicStates = dynamic_states;
+ dynamic_state.dynamicStateCount = 2;
@@ -180,7 +180,8 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-SE,
+ .stencilTestEnable = VK_FALSE,
+ - .minDepthBounds = 0.0F,
+ .maxDepthBounds = 1.0F};
@@ -131,4 +131,2 @@ v-oid PipelineBuilder::clear() {
-COM-PONENT_R_BIT |
+ - - VK_COLOR_COMPONENT_G-_BIT- |
+ - - VK_C+ render_info = {.sType = VK_STRUCTU+ VkPipelineColorBlendStateCreateInfo color_blending = {};
+ color_blending.sType =
+ VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
+ color_blending.pNext = nullptr;
+ color_blending.logicOpEnable = VK_FALSE;
+ color_blending.logicOp = VK_LOGIC_OP_COPY;
+ color_blending.attachmentCount = 1;
+ color_blending.pAttachments = &color_blend_attachment;
@@ -189,3 +190,2 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
- .depthAttachmentFormat = VK_FORMAT_UNDEFINED};
@@ -136 +134- @@ void PipelineBuilder::clear() {
-LOR_COMPONENT_B_BIT |
+ + shader_sta-ges.cle+ const VkPipelineVertexInputStateCreateInfo vertex_input_info = {
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
@@ -194,4 +194,4 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-eBuilder::clear() {
- - VK_COLOR_COMPONENT_A_BIT};
+auto PipelineBuilder::buildPipeline(-VkDevice device) const -> VkPipeline {
@@ -141 +139 @@ VkPipe-line PipelineBuilder::build_pipeline(VkDevice device) const {
-ampling = {
+ VkGraphicsPipelineCreateInfo pipeline_info = {};
+ pipeline_info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
+ pipeline_info.pNext = &render_info; // Use our local copy
+ pipeline_info.stageCount = static_cast<uint32_t>(_shaderStages.size());
@@ -199,5 +199,5 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
- VkPipelineRenderingCreateInfo render_info = render_-info;
@@ -144 +142 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice dev-ice) const {
-hadingEnable = VK_FALSE,
- .m-inSampleShading = 1.0f,
- .pSamp+ VkPipelineInputAssemblyStateCre-ateInfo input_assembly = input_assembly;
@@ -147,2 +145,2 @@ VkPipeline Pipe+ pipeline_info.pVertexInputState = &vertex_input_info;
+ pipeline_info.pInputAssemblyState = &input_assembly; // Use our local copy
+ pipeline_info.pViewportState = &viewport_state;
+ pipeline_info.pRasterizationState = &rasterizer; // Use our local copy
+ pipeline_info.pMultisampleState = &multisampling; // Use our local copy
@@ -205,2 +205,2 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-verageEnable = VK_FALSE,
- .alphaToOneEnab-le- = VK_FALSE
- };
-
- _pipelineLayout = {};+ pipeline_info.pColorBlendState = &color_blending;
+ pipeline_info.pDynamicState = &dynamic_state;
@@ -208,7 +208,3 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-achmentFormat == 0) {
+ render_info.depthAttachmentFormat = VK_FORM-AT_UNDEFINED;
@@ -152,2 +150,2- @@ VkPipeline PipelineBuilder::build_pipeline(VkDevic-e- device) const {
-PELINE_MUL-TISAMPLE_STATE_CREATE_INFO,
+ - .rasterizationSamples =
+ + if -(rasterizer.lineWidth <= 0.0F) {
+ rasterizer.lineWidth = 1.0F;
@@ + pipeline_info.renderPass = VK_NULL_HANDLE; // We use dynamic rendering
+ pipeline_info.subpass = 0;
+ pipeline_info.basePipelineHandle = VK_NULL_HANDLE;
@@ -215,0 +212,3 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
+ VkPipeline new_pipeline = nullptr;
+ if (vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &pipeline_info,
+ nullptr, &new_pipeline) != VK_SUCCESS) {
@@ -220 +219 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-ToCoverageEnable = VK_FA+ return new_pipeline;
@@ -223,2 +222,2 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-,
+ .alp-haToOneEnable = VK_FALSE};
+
+ pipeline_-layout = {};
@@ -119,10 +12+ if (input_assembly.topology == VK_P+void PipelineBuilder::setShaders(VkShaderModule vertexShader,
+ VkShaderModule fragmentShader) {
@@ -234 +233 @@ void PipelineBuilder::set_shaders(VkShaderModule vertexShader,
- = V-K_FALSE,
- .colorWriteMas-k = VK-_COLOR_COMPONENT_R_BIT | VK_+static void PipelineBuilder::setInputTopology(VkPrimitiveTopology topology) {
@@ -246 +245 @@ void PipelineBuilder::set_input_topology(VkPrimitiveTopology topology) {
-kPipeline PipelineBuilder::build_pipeline(VkDevice device) co+void PipelineBuilder::setPolygonMode(VkPolygonMode mode) {
@@ -251,2 +250,2 @@ void PipelineBuilder::set_polygon_mode(VkPolygonMode mode) {
- - .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_S-T-ATE_CREATE_INFO,
+ .depthTestEnable = VK_FALSE,
+void PipelineBuilder::setCullMode(VkCullModeFlags cullMode,
+ VkFrontFace frontFace) {
@@ -257 +256 @@ void PipelineBuilder::set_cull_mode(VkCullModeFlags cullMode,
-COMPARE_OP_LESS,
+ .d+ VkDynamicSta+void PipelineBuilder::setMultisamplingNone() {
@@ -268 +267 @@ void PipelineBuilder::set_multisampling_none() {
-e) const {
-SE,
+ .stencilTestEn+void PipelineBuilder::disableBlending() {
@@ -277 +276 @@ void PipelineBuilder::disable_blending() {
- - - VK_C+ render_info = {.sType = VK_STRUCTU++void PipelineBuilder::setColorAttachmentFormat(VkFormat format) {
@@ -284 +283 @@ void PipelineBuilder::set_color_attachment_format(VkFormat format) {
-lor_blending.logicOpEnable = VK_FALSE;
+ color_blending+static void PipelineBuilder::setDepthFormat(VkFormat format) {
@@ -298 +297 @@ void PipelineBuilder::set_depth_format(VkFormat format) {
-CreateInfo vertex_input_info = {
+ +void PipelineBuilder::disableDepthtest() {
@@ -310 +309 @@ void PipelineBuilder::disable_depthtest() {
-vice device) const {
-ampling = {
+ VkGraphicsPipelineCreateInfo pipeline_inf+void PipelineBuilder::enableDepthtest(bool depthWriteEnable, VkCompareOp op) {
@@ -322 +321 @@ void PipelineBuilder::enable_depthtest(bool depthWriteEnable, VkCompareOp op) {
-44 +142 @@ VkPipeline PipelineBuilder::build_pipeli+void PipelineBuilder::enableBlendingAdditive() {
@@ -335 +334 @@ void PipelineBuilder::enable_blending_additive() {
-void PipelineBuilder::enable_blending_alphablend() {
+void PipelineBuilder::enableBlendingAlphablend() {
diff --git a/src/graphics/vulkan/vk_command_buffers.cpp b/src/graphics/vulkan/vk_command_buffers.cpp
index 9114b9e..f59aa46 100644
--- a/src/graphics/vulkan/vk_command_buffers.cpp
+++ b/src/graphics/vulkan/vk_command_buffers.cpp
@@ -5 +5 @@
-void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
+static void CommandBuffers::initCommands(VulkanEngine* vk_engine) {
@@ -9 +9 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- const VkCommandPoolCreateInfo commandPoolInfo =
+ const VkCommandPoolCreateInfo command_pool_info =
@@ -30,3 +30,3 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- VkCommandPool immCommandPool;
- VK_CHECK(vkCreateCommandPool(vk_engine->_device, &commandPoolInfo, nullptr,
- &immCommandPool));
+ VkCommandPool imm_command_pool = nullptr;
+ VK_CHECK(vkCreateCommandPool(vk_engine->_device, &command_pool_info,
+ nullptr, &imm_command_pool));
@@ -34 +34,3 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- vk_engine->command_buffers_container._immCommandPool = std::make_unique<VulkanCommandPool>(vk_engine->_device, immCommandPool);
+ vk_engine->command_buffers_container._immCommandPool =
+ std::make_unique<VulkanCommandPool>(vk_engine->_device,
+ imm_command_pool);
@@ -37,2 +39,4 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- const VkCommandBufferAllocateInfo cmdAllocInfo =
- vkinit::command_buffer_allocate_info(vk_engine->command_buffers_container._immCommandPool->get(), 1);
+ const VkCommandBufferAllocateInfo cmd_alloc_info =
+ vkinit::command_buffer_allocate_info(
+ vk_engine->command_buffers_container._immCommandPool->get(),
+ 1);
@@ -40,2 +44,3 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
-ffers::init_commands(VulkanEngine* vk_engine) {
-�device, &cmdAllocInfo,
-kanEngine* vk_engine) {
-�device, &cmdAllocInfo,
-�command_buffers_container._immCommandBuffer)));
+ VK_CHECK(vkAllocateCommandBuffers(
+ vk_engine->_device, &cmd_alloc_info,
+ &(vk_engine->command_buffers_container._immCommandBuffer)));
@@ -46 +51 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
-(
+ vk_engine->_device, &cmd+static void CommandBuffers::immediateSubmit(
@@ -48 +53 @@ void CommandBuffers::immediate_submit(
-ner._immCommandBuffer)));
@@ -46 +51 @@ v+ VulkanEngine* vk_engine) {
@@ -54 +59 @@ void CommandBuffers::immediate_submit(
-d CommandBuffers::immediate_submit(
-�BeginInfo =
+ const VkCommandBufferBeginInfo cmd_begin_info =
@@ -58 +63 @@ void CommandBuffers::immediate_submit(
-ndBuffers::immediate_submit(
-�er(cmd, &cmdBeginInfo));
+ VK_CHECK(vkBeginCommandBuffer(cmd, &cmd_begin_info));
diff --git a/src/graphics/vulkan/vk_loader.cpp b/src/graphics/vulkan/vk_loader.cpp
index 5c00e7b..4d246fa 100644
--- a/src/graphics/vulkan/vk_loader.cpp
+++ b/src/graphics/vulkan/vk_loader.cpp
@@ -43 +43 @@ std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(
- static constexpr auto supportedExtensions =
+ static constexpr auto kSupportedExtensions =
@@ -48 +48 @@ std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(
- fastgltf::Parser parser(supportedExtensions);
+ fastgltf::Parser parser(kSupportedExtensions);
@@ -52 +52 @@ std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(
- constexpr auto gltfOptions =
+ constexpr auto kGltfOptions =
@@ -67 +67 @@ std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(
- auto asset = parser.loadGltf(&data, path.parent_path(), gltfOptions);
+ auto asset = parser.loadGltf(&data, path.parent_path(), kGltfOptions);
@@ -178 +178 @@ std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(
-VkFilter extract_filter(fastgltf::Filter filter) {
+auto extractFilter(fastgltf::Filter filter) -> VkFilter {
@@ -195 +195 @@ VkFilter extract_filter(fastgltf::Filter filter) {
-VkSamplerMipmapMode extract_mipmap_mode(fastgltf::Filter filter) {
+auto extractMipmapMode(fastgltf::Filter filter) -> VkSamplerMipmapMode {
@@ -208,2 +208,2 @@ VkSamplerMipmapMode extract_mipmap_mode(fastgltf::Filter filter) {
-std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- std::string_view filePath) {
+auto loadGltf(VulkanEngine* engine, std::string_view filePath)
+ -> std::optional<std::shared_ptr<LoadedGLTF>> {
@@ -217 +217 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- constexpr auto gltfOptions =
+ constexpr auto kGltfOptions =
@@ -227 +227 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- auto load = parser.loadGltf(&data, path.parent_path(), gltfOptions);
+ auto load = parser.loadGltf(&data, path.parent_path(), kGltfOptions);
@@ -236 +236 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- parser.loadGltfBinary(&data, path.parent_path(), gltfOptions);
+ parser.loadGltfBinary(&data, path.parent_path(), kGltfOptions);
@@ -253 +253 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- file.descriptorPool.init(
+ file.descriptor_pool.init(
@@ -288 +288,2 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- size_t materialCount = gltf.materials.size() ? gltf.materials.size() : 1;
+ size_t material_count =
+ (!gltf.materials.empty() != 0u) ? gltf.materials.size() : 1;
@@ -294 +295 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- auto* sceneMaterialConstants =
+ auto* scene_material_constants =
@@ -348 +349 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- auto defaultMat = std::make_shared<GLTFMaterial>();
+ auto default_mat = std::make_shared<GLTFMaterial>();
@@ -352,2 +353,3 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- constants.colorFactors = glm::vec4(1.0f); // White base color
- constants.metal_rough_factors = glm::vec4(0.0f); // Non-metallic, smooth
+ constants.colorFactors = glm::vec4(1.0F); // White base color
+ constants.metal_rough_factors =
+ glm::vec4(0.0F); // Non-metallic, smooth
@@ -355 +357 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- sceneMaterialConstants[0] = constants;
+ scene_material_constants[0] = constants;
@@ -362 +364 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- resources.dataBuffer = file.materialDataBuffer.buffer;
+ resources.dataBuffer = file.material_data_buffer.buffer;
@@ -501 +503 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- std::shared_ptr<ENode>& sceneNode = nodes[i];
+ std::shared_ptr<ENode>& scene_node = nodes[i];
@@ -519 +521 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
-void LoadedGLTF::Draw(const glm::mat4& topMatrix, DrawContext& ctx) {
+void LoadedGLTF::draw(const glm::mat4& topMatrix, DrawContext& ctx) {
diff --git a/src/include/scene/Light.h b/src/include/scene/Light.h
index ecdcc2d..c66a588 100644
--- a/src/include/scene/Light.h
+++ b/src/include/scene/Light.h
@@ -28,2 +28,2 @@ private:
- float _radius{5.0f};
- float _strength{1.0f};
+ float _radius{5.0F};
+ float _strength{1.0F};
diff --git a/src/include/core/Defines.h b/src/include/core/Defines.h
index cbb7795..1a2d441 100644
--- a/src/include/core/Defines.h
+++ b/src/include/core/Defines.h
@@ -3 +3 @@
-#define BIT(x) (1 << x)
+#define BIT(x) (1 << (x))
diff --git a/src/include/core/Mesh.h b/src/include/core/Mesh.h
index 33b0e7b..c1df83f 100644
--- a/src/include/core/Mesh.h
+++ b/src/include/core/Mesh.h
@@ -15,2 +15,2 @@ public:
- void setModelconst std::string& filePath);
- void rremoveModel;
+ void set_modelconst std::string& filePath);
+ void rremove_model;
diff --git a/src/include/core/ModelImpl.h b/src/include/core/ModelImpl.h
index 2f2b6dc..a372b09 100644
--- a/src/include/core/ModelImpl.h
+++ b/src/include/core/ModelImpl.h
@@ -23 +23 @@ public:
- ModelImpl &operator=(const ModelImpl &) = delete;
+ auto operator=(const ModelImpl &) -> ModelImpl & = delete;
@@ -31 +31 @@ public:
- Camera *getCamera() override;
+ auto getCamera() -> Camera * override;
diff --git a/src/include/graphics/vulkan/vk_command_buffers_container.h b/src/include/graphics/vulkan/vk_command_buffers_container.h
index 4109074..996a193 100644
--- a/src/include/graphics/vulkan/vk_command_buffers_container.h
+++ b/src/include/graphics/vulkan/vk_command_buffers_container.h
@@ -53,2 +53 @@ public:
- autor(CommandBuffers);
- autotor->CommandBuffersContainer &=
+ autor(CommandBuffersommandBuffers autotor->CommandBuffersContainer &=
diff --git a/src/include/graphics/vulkan/ComputePipeline.h b/src/include/graphics/vulkan/ComputePipeline.h
index 59c6e56..d148337 100644
--- a/src/include/graphics/vulkan/ComputePipeline.h
+++ b/src/include/graphics/vulkan/ComputePipeline.h
@@ -23 +23 @@ public:
- nfig{} {};);
+ nfig{};);
diff --git a/src/include/graphics/vulkan/vk_loader.h b/src/include/graphics/vulkan/vk_loader.h
index 8c205c1..7471172 100644
--- a/src/include/graphics/vulkan/vk_loader.h
+++ b/src/include/graphics/vulkan/vk_loader.h
@@ -25 +25 @@ struct GeoSurface {
- uint32_t start_index {}
+ uint32_t start_index{};
@@ -27 +27 @@ struct GeoSurface {
- uint32_t coun {}
+ uint32_t coun{};
@@ -36 +36 @@ struct MeshAsset {
- GPUMeshBuffersmesh_buffers {}
+ gpu_mesh_buffersmesh_buffers{};
@@ -58 +58 @@ struct LoadedGLTF final : public IRenderable {
- DescriptorAllocatodescriptor_poolriptor_pool;
+ descriptor_allocatodescriptor_poolriptor_pool{};
@@ -60 +60 @@ struct LoadedGLTF final : public IRenderable {
- Allocmaterial_data_buffer {}
+ allocmaterial_data_buffer{};
@@ -63 +63 @@ struct LoadedGLTF final : public IRenderable {
- Vulkan {}
+ vulkan{};
@@ -74 +74 @@ private:
- voidautoe* engine, std::string_view filePath)
+ voidautoe *_engine{}, std::_string_view{}; filePath)
Used clang-format v19.1.1
Click here for the full clang-format patch
diff --git a/src/core/Mesh.cpp b/src/core/Mesh.cpp
index f496c69..bb02249 100644
--- a/src/core/Mesh.cpp
+++ b/src/core/Mesh.cpp
@@ -37 +36,0 @@ void Mesh::remove_model() {
-
diff --git a/src/graphics/vulkan/pipelines.cpp b/src/graphics/vulkan/pipelines.cpp
index 5926226..557d968 100644
--- a/src/graphics/vulkan/pipelines.cpp
+++ b/src/graphics/vulkan/pipelines.cpp
@@ -1,0 +2 @@
+
@@ -81 +82,2 @@ void GLTFMetallic_Roughness::build_opaque_pipeline(VulkanEngine* engine,
- pipelineBuilder.set_color_attachment_format(engine->_drawImage->get().imageFormat);
+ pipelineBuilder.set_color_attachment_format(
+ engine->_drawImage->get().imageFormat);
@@ -159 +161 @@ void Pipelines::init(VkDevice device,
-
+
@@ -170,2 +172,2 @@ void Pipelines::init(VkDevice device,
-
- // Explicitly setup pipeline details via callback
+
+ // Explicitly setup pipeline details via callback
@@ -177 +179 @@ void Pipelines::init(VkDevice device,
-
+
@@ -183 +185 @@ void Pipelines::init(VkDevice device,
-
+
@@ -188 +190 @@ void Pipelines::init(VkDevice device,
-
+
@@ -193 +195 @@ void Pipelines::init(VkDevice device,
-
+
@@ -204 +206 @@ void Pipelines::destroy() {
-
+
@@ -208 +210 @@ void Pipelines::destroy() {
-
+
diff --git a/src/graphics/vulkan/ComputePipeline.cpp b/src/graphics/vulkan/ComputePipeline.cpp
index 462ee47..882ef9e 100644
--- a/src/graphics/vulkan/ComputePipeline.cpp
+++ b/src/graphics/vulkan/ComputePipeline.cpp
@@ -1,0 +2 @@
+
@@ -4,3 +5,2 @@
-ComputePipeline::ComputePipeline(const ComputePipelineConfig& config)
- : _config(config) {
-}
+ComputePipeline::ComputePipeline(const ComputePipelineConfig& config)
+ : _config(config) {}
@@ -10 +10 @@ void ComputePipeline::init(VkDevice device) {
-
+
@@ -17,2 +17,3 @@ void ComputePipeline::init(VkDevice device) {
- VK_CHECK(vkCreatePipelineLayout(_device, &computeLayout, nullptr, &_pipelineLayout));
-
+ VK_CHECK(vkCreatePipelineLayout(_device, &computeLayout, nullptr,
+ &_pipelineLayout));
+
@@ -20 +21,2 @@ void ComputePipeline::init(VkDevice device) {
- if (!vkutil::load_shader_module(_config.shaderPath.c_str(), _device, &computeShader)) {
+ if (!vkutil::load_shader_module(_config.shaderPath.c_str(), _device,
+ &computeShader)) {
@@ -24 +26 @@ void ComputePipeline::init(VkDevice device) {
-
+
@@ -31 +33 @@ void ComputePipeline::init(VkDevice device) {
-
+
@@ -33 +35,2 @@ void ComputePipeline::init(VkDevice device) {
- computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
+ computePipelineCreateInfo.sType =
+ VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
@@ -37 +40 @@ void ComputePipeline::init(VkDevice device) {
-
+
@@ -39,3 +42,3 @@ void ComputePipeline::init(VkDevice device) {
- &computePipelineCreateInfo, nullptr,
-VkDevice device) {
- - + &computePipelineCreateInfo, nullptr,
+ &_pipeline));
+
@@ -45 +48 @@ void ComputePipeline::init(VkDevice device) {
- +
@@ -53,3 +56,6 @@ void ComputePipeline::bind(VkCommandBuffer cmd) {
- void ComputePipeline::bind(VkCommandBuffer cmd) {
-�fer cmd, const VkDescriptorSet* descriptorSets, uint32_t setCount) {
-DescriptorSet* descriptorSets, uint32_t setCount) {
-�T_COMPUTE, _pipelineLayout,
- uint32_t setCount) {
-�T_COMPUTE, _pipelineLayout,
-� 0, nullptr);
+void ComputePipeline::bindDescriptorSets(VkCommandBuffer cmd,
+ const VkDescriptorSet* descriptorSets,
+ uint32_t setCount) {
+ vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE,
+ _pipelineLayout, 0, setCount, descriptorSets, 0,
+ nullptr);
@@ -58 +64,2 @@ void ComputePipeline::bindDescriptorSets(VkCommandBuffer cmd, const VkDescriptor
-) {
-�T_COMPUTE, _pipelineLayout,
-� 0, nullptr);
+void ComputePipeline::bindDescriptorSe+void ComputePipeline::dispatch(VkCommandBuffer cmd, uint32_t x, uint32_t y,
+ uint32_t z) {
diff --git a/src/graphics/vulkan/vk_command_buffers_container.cpp b/src/graphics/vulkan/vk_command_buffers_container.cpp
index c1abcc6..2c49495 100644
--- a/src/graphics/vulkan/vk_command_buffers_container.cpp
+++ b/src/graphics/vulkan/vk_command_buffers_container.cpp
@@ -1,0 +2 @@
+
@@ -6 +7,2 @@ CommandBuffersContainer::CommandBuffersContainer() {
- // Initialize members - actual initialization happens in init_sync_structures
+ // Initialize members - actual initialization happens in
+ // init_sync_structures
@@ -18,2 +20,4 @@ void CommandBuffersContainer::init_sync_structures(VulkanEngine* vk_engine) {
- VK_CHECK(vkCreateFence(vk_engine->_device, &fenceCreateInfo, nullptr, &renderFence));
- _frame._renderFence = std::make_unique<VulkanFence>(vk_engine->_device, renderFence);
+ VK_CHECK(vkCreateFence(vk_engine->_device, &fenceCreateInfo, nullptr,
+ &renderFence));
+ _frame._renderFence =
+ std::make_unique<VulkanFence>(vk_engine->_device, renderFence);
@@ -22,5 +26,9 @@ void CommandBuffersContainer::init_sync_structures(VulkanEngine* vk_engine) {
-renderFence =
+ std::make_unique<VulkanFence>(vk_engine->_device, renderFence);
@@ -22,5 +26,9- @@ void CommandBuffersContainer::init_sync_structures(VulkanEngine* vk_engine) {
-renderFence =
+ - s-td::make_unique<VulkanFence>(vk_engine->_device, renderFence);
@@ -22,5 +26,9- @@ void CommandBuffersContainer::-init_sync_structures(VulkanEngine* vk_engine) {
-renderFence =
+ - s-�ce, renderSemaphore);
+ VK_CHECK(vkCreateSemaphore(vk_engine->_device, &semaphoreCreateInfo,
+ nullptr, &swapchainSemaphore));
+ VK_CHECK(vkCreateSemaphore(vk_engine->_device, &semaphoreCreateInfo,
+ nullptr, &renderSemaphore));
+
+ _frame._swapchainSemaphore = std::make_unique<VulkanSemaphore>(
+ vk_engine->_device, swapchainSemaphore);
+ _frame._renderSemaphore = std::make_unique<VulkanSemaphore>(
+ vk_engine->_device, renderSemaphore);
@@ -30 +38,2 @@ void CommandBuffersContainer::init_sync_structures(VulkanEngine* vk_engine) {
- VK_CHECK(vkCreateFence(vk_engine->_device, &fenceCreateInfo, nullptr, &immFence));
+ VK_CHECK(vkCreateFence(vk_engine->_device, &fenceCreateInfo, nullptr,
+ &immFence));
diff --git a/src/graphics/vulkan/GraphicsPipeline.cpp b/src/graphics/vulkan/GraphicsPipeline.cpp
index 64de296..c632e5b 100644
--- a/src/graphics/vulkan/GraphicsPipeline.cpp
+++ b/src/graphics/vulkan/GraphicsPipeline.cpp
@@ -3,3 +3,2 @@
-GraphicsPipeline::GraphicsPipeline(const GraphicsPipelineConfig& config)
- : _config(config) {
-}
+GraphicsPipeline::GraphicsPipeline(const GraphicsPipelineConfig& config)
+ : _config(config) {}
@@ -9,3 +8,4 @@ void GraphicsPipeline::init(VkDevice device) {
-
- VkPipelineLayoutCreateInfo layoutInfo = vkinit::pipeline_layout_create_info();
-
+
+ VkPipelineLayoutCreateInfo layoutInfo =
+ vkinit::pipeline_layout_create_info();
+
@@ -13 +13,2 @@ void GraphicsPipeline::init(VkDevice device) {
- layoutInfo.setLayoutCount = static_cast<uint32_t>(_config.descriptorSetLayouts.size());
+ layoutInfo.setLayoutCount =
+ static_cast<uint32_t>(_config.descriptorSetLayouts.size());
@@ -16 +17 @@ void GraphicsPipeline::init(VkDevice device) {
-
+
@@ -18 +19,2 @@ void GraphicsPipeline::init(VkDevice device) {
- layoutInfo.pushConstantRangeCount = static_cast<uint32_t>(_config.pushConstants.size());
+ layoutInfo.pushConstantRangeCount =
+ static_cast<uint32_t>(_config.pushConstants.size());
@@ -21,3 +23,4 @@ void GraphicsPipeline::init(VkDevice device) {
-
- VK_CHECK(vkCreatePipelineLayout(device, &layoutInfo, nullptr, &_pipelineLayout));
-
+
+ VK_CHECK(vkCreatePipelineLayout(device, &layoutInfo, nullptr,
+ &_pipelineLayout));
+
@@ -25 +28,2 @@ void GraphicsPipeline::init(VkDevice device) {
- static_cast<uint32_t>(_config.descriptorSetLayouts.size());
@@ -16 +17 @@ void GraphicsPipeline:+ if (!vkutil::load_shader_module(_config.vertexShaderPath.c_str(), _device,
+ &vertexShader)) {
@@ -29 +33 @@ void GraphicsPipeline::init(VkDevice device) {
- devi+
@@ -31 +35,2 @@ void GraphicsPipeline::init(VkDevice device) {
-antRangeCount = static_cast<uint32_t>(_config.pushConstants.size());
+ layoutInfo.pushConstant+ if (!vkutil::load_shader_module(_config.fragmentShaderPath.c_str(), _device,
+ &fragmentShader)) {
@@ -36 +41 @@ void GraphicsPipeline::init(VkDevice device) {
-
-+
@@ -43 +48 @@ void GraphicsPipeline::init(VkDevice device) {
-);
@@+
@@ -49 +54 @@ void GraphicsPipeline::init(VkDevice device) {
- +
@@ -55 +60 @@ void GraphicsPipeline::init(VkDevice device) {
-nt = +
@@ -59 +64 @@ void GraphicsPipeline::init(VkDevice device) {
- +
@@ -63 +68 @@ void GraphicsPipeline::init(VkDevice device) {
-
-+
+
@@ -65 +70 @@ void GraphicsPipeline::init(VkDevice device) {
-) {
-+
@@ -78,2 +83,3 @@ void GraphicsPipeline::bindDescriptorSets(VkCommandBuffer cmd,
- vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, _pipelineLayout,
- firstSet, setCount, descriptorSets, 0, nullptr);
+ vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS,
+ _pipelineLayout, firstSet, setCount, descriptorSets,
+ 0, nullptr);
@@ -82,2 +88,4 @@ void GraphicsPipeline::bindDescriptorSets(VkCommandBuffer cmd,
- _pipelineLayout, firstSet, setCount, descriptorSets,
+ - 0, nullptr);
@@ -82,2 +88,4 @@ void GraphicsPipeline::bindDescriptorSets(VkCommandBu+void GraphicsPipeline::pushConstants(VkCommandBuffer cmd,
+ VkShaderStageFlags stageFlags,
+ uint32_t offset, uint32_t size,
+ const void* data) {
diff --git a/src/graphics/vulkan/vk_engine.cpp b/src/graphics/vulkan/vk_engine.cpp
index 99b9429..edd3e19 100644
--- a/src/graphics/vulkan/vk_engine.cpp
+++ b/src/graphics/vulkan/vk_engine.cpp
@@ -32,0 +33 @@
+#include "graphics/vulkan/vk_command_buffers.h"
@@ -38 +38,0 @@
-#include "graphics/vulkan/vk_command_buffers.h"
@@ -125 +125,2 @@ void VulkanEngine::init_default_data() {
- AllocatedImage whiteImageData = create_image(&white, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
+ AllocatedImage whiteImageData =
+ create_image(&white, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
@@ -127 +128,2 @@ void VulkanEngine::init_default_data() {
- _whiteImage = std::make_unique<VulkanImage>(_allocator, _device, whiteImageData);
+ _whiteImage =
+ std::make_unique<VulkanImage>(_allocator, _device, whiteImageData);
@@ -130 +132,2 @@ void VulkanEngine::init_default_data() {
- AllocatedImage greyImageData = create_image(&grey, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
+ AllocatedImage greyImageData =
+ create_image(&grey, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
@@ -132 +135,2 @@ void VulkanEngine::init_default_data() {
- _greyImage = std::make_unique<VulkanImage>(_allocator, _device, greyImageData);
+ _greyImage =
+ std::make_unique<VulkanImage>(_allocator, _device, greyImageData);
@@ -135 +139,2 @@ void VulkanEngine::init_default_data() {
- AllocatedImage blackImageData = create_image(&black, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
+ AllocatedImage blackImageData =
+ create_image(&black, VkExtent3D{1, 1, 1}, VK_FORMAT_R8G8B8A8_UNORM,
@@ -137 +142,2 @@ void VulkanEngine::init_default_data() {
- _blackImage = std::make_unique<VulkanImage>(_allocator, _device, blackImageData);
+ _blackImage =
+ std::make_unique<VulkanImage>(_allocator, _device, blackImageData);
@@ -147 +153,2 @@ void VulkanEngine::init_default_data() {
- AllocatedImage errorImageData = create_image(pixels.data(), VkExtent3D{16, 16, 1},
+ AllocatedImage errorImageData =
+ create_image(pixels.data(), VkExtent3D{16, 16, 1},
@@ -149 +156,2 @@ void VulkanEngine::init_default_data() {
- _errorCheckerboardImage = std::make_unique<VulkanImage>(_allocator, _device, errorImageData);
+ _errorCheckerboardImage =
+ std::make_unique<VulkanImage>(_allocator, _device, errorImageData);
@@ -183 +191,2 @@ void VulkanEngine::init_default_data() {
- _managedBuffers.push_back(std::make_unique<VulkanBuffer>(_allocator, materialConstants));
+ _managedBuffers.push_back(
+ std::make_unique<VulkanBuffer>(_allocator, materialConstants));
@@ -252,3 +261,3 @@ void VulkanEngine::init_imgui() {
- // Store ImGui cleanup info - will be automatically handled when engine destructs
- // Note: ImGui cleanup is now handled by storing the descriptor pool
- // that will be automatically destroyed when the device is destroyed
+ // Store ImGui cleanup info - will be automatically handled when engine
+ // destructs Note: ImGui cleanup is now handled by storing the descriptor
+ // pool that will be automatically destroyed when the device is destroyed
@@ -311 +320,2 @@ void VulkanEngine::init_descriptors() {
- // No need for deletion queue - frame descriptors will be cleaned up in cleanup()
+ // No need for deletion queue - frame descriptors will be cleaned up in
+ // cleanup()
@@ -316 +326,2 @@ void VulkanEngine::init_pipelines() {
- pipelines.init(_device, _singleImageDescriptorLayout, _drawImageDescriptorLayout, _drawImage->get());
+ pipelines.init(_device, _singleImageDescriptorLayout,
+ _drawImageDescriptorLayout, _drawImage->get());
@@ -329 +340 @@ void VulkanEngine::init(SDL_Window* window) {
-
+
@@ -331 +342 @@ void VulkanEngine::init(SDL_Window* window) {
-
+
@@ -469 +479,0 @@ void VulkanEngine::init_vulkan() {
-
@@ -531,2 +541,2 @@ void VulkanEngine::init_swapchain() {
- vmaCreateImage(_allocator, &rimg_info, &rimg_allocinfo, &drawImageData.image,
- &drawImageData.allocation, nullptr);
+ vmaCreateImage(_allocator, &rimg_info, &rimg_allocinfo,
+ &drawImageData.image, &drawImageData.allocation, nullptr);
@@ -536,2 +546 @@ void VulkanEngine::init_swapchain() {
- drawImageFormat, drawImageData.image,
- VK_IMAGE_ASPECT_COLOR_BIT);
+ drawImageFormat, drawImageData.image, VK_IMAGE_ASPECT_COLOR_BIT);
@@ -543 +552,2 @@ void VulkanEngine::init_swapchain() {
- _drawImage = std::make_unique<VulkanImage>(_allocator, _device, drawImageData);
+ _drawImage =
+ std::make_unique<VulkanImage>(_allocator, _device, drawImageData);
@@ -546,5 +556,2 @@ void VulkanEngine::init_swapchain() {
- VkExtent3D depthImageExtent = {
- _windowExtent.width,
- _windowExtent.height,
- 1
- };
+ VkExtent3D depthImageExtent = {_windowExtent.width, _windowExtent.height,
+ 1};
@@ -555,3 +562,2 @@ void VulkanEngine::init_swapchain() {
- depthFormat,
- VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
- depthImageExtent);
+ depthFormat, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
+ depthImageExtent);
@@ -562 +568 @@ void VulkanEngine::init_swapchain() {
- VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
+ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
@@ -569,2 +575,2 @@ void VulkanEngine::init_swapchain() {
- vmaCreateImage(_allocator, &dimg_info, &dimg_allocinfo, &depthImageData.image,
- &depthImageData.allocation, nullptr);
+ vmaCreateImage(_allocator, &dimg_info, &dimg_allocinfo,
+ &depthImageData.image, &depthImageData.allocation, nullptr);
@@ -574 +580 @@ void VulkanEngine::init_swapchain() {
- depthFormat, depthImageData.image, VK_IMAGE_ASPECT_DEPTH_BIT);
+ depthFormat, depthImageData.image, VK_IMAGE_ASPECT_DEPTH_BIT);
@@ -580 +586,2 @@ void VulkanEngine::init_swapchain() {
- _depthImage = std::make_unique<VulkanImage>(_allocator, _device, depthImageData);
+ _depthImage =
+ std::make_unique<VulkanImage>(_allocator, _device, depthImageData);
@@ -605 +612,2 @@ void VulkanEngine::cleanup() {
- vkDestroyCommandPool(_device, _frame._commandPool->get(), nullptr);
+ vkDestroyCommandPool(_device, _frame._commandPool->get(),
+ nullptr);
@@ -695,5 +703,6 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- command_buffers.immediate_submit([&](VkCommandBuffer cmd) {
- VkBufferCopy vertexCopy{0};
- vertexCopy.dstOffset = 0;
- vertexCopy.srcOffset = 0;
- vertexCopy.size = vertexBufferSize;
+ command_buffers.immediate_submit(
+ [&](VkCommandBuffer cmd) {
+ VkBufferCopy vertexCopy{0};
+ vertexCopy.dstOffset = 0;
+ vertexCopy.srcOffset = 0;
+ vertexCopy.size = vertexBufferSize;
@@ -701,2 +710,2 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- vkCmdCopyBuffer(cmd, staging.buffer, newSurface.vertexBuffer.buffer, 1,
- &vertexCopy);
+ vkCmdCopyBuffer(cmd, staging.buffer,
+ newSurface.vertexBuffer.buffer, 1, &vertexCopy);
@@ -704,4 +713,4 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- VkBufferCopy indexCopy{0};
- indexCopy.dstOffset = 0;
- indexCopy.srcOffset = vertexBufferSize;
- indexCopy.size = indexBufferSize;
+ VkBufferCopy indexCopy{0};
+ indexCopy.dstOffset = 0;
+ indexCopy.srcOffset = vertexBufferSize;
+ indexCopy.size = indexBufferSize;
@@ -709,2 +718,2 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- vkCmdCopyBuffer(cmd, staging.buffer, newSurface.indexBuffer.buffer, 1,
- &indexCopy);
+ vkCmdCopyBuffer(cmd, staging.buffer,
+ newSurface.indexBuffer.buffer, 1, &indexCopy);
@@ -715,2 +724,4 @@ GPUMeshBuffers VulkanEngine::uploadMesh(std::span<uint32_t> indices,
- _managedBuffers.push_back(std::make_unique<VulkanBuffer>(_allocator, newSurface.vertexBuffer));
- _managedBuffers.push_back(std::make_unique<VulkanBuffer>(_allocator, newSurface.indexBuffer));
+ _managedBuffers.push_back(std::make_unique<VulkanBuffer>(
+ _allocator, newSurface.vertexBuffer));
+ _managedBuffers.push_back(
+ std::make_unique<VulkanBuffer>(_allocator, newSurface.indexBuffer));
@@ -728 +739,2 @@ void VulkanEngine::draw_background(VkCommandBuffer cmd) const {
- pipelines.gradientPipeline->bindDescriptorSets(cmd, &_drawImageDescriptors, 1);
+ pipelines.gradientPipeline->bindDescriptorSets(cmd, &_drawImageDescriptors,
+ 1);
@@ -731,4 +743,3 @@ void VulkanEngine::draw_background(VkCommandBuffer cmd) const {
- pipelines.gradientPipeline->dispatch(cmd,
- static_cast<uint32_t>(std::ceil(_drawExtent.width / 16.0)),
- static_cast<uint32_t>(std::ceil(_drawExtent.height / 16.0)),
- 1);
+ pipelines.gradientPipeline->dispatch(
+ cmd, static_cast<uint32_t>(std::ceil(_drawExtent.width / 16.0)),
+ static_cast<uint32_t>(std::ceil(_drawExtent.height / 16.0)), 1);
@@ -759 +770 @@ void VulkanEngine::draw_geometry(VkCommandBuffer cmd) {
- std::make_unique<VulkanBuffer>(_allocator, gpuSceneDataBuffer));
+ std::make_unique<VulkanBuffer>(_allocator, gpuSceneDataBuffer));
@@ -847,2 +858,3 @@ void VulkanEngine::draw() {
- VK_CHECK(vkWaitForFences(_device, 1, get_current_frame()._renderFence->getPtr(),
- true, 1000000000));
+ VK_CHECK(vkWaitForFences(_device, 1,
+ get_current_frame()._renderFence->getPtr(), true,
+ 1000000000));
@@ -854 +866,2 @@ void VulkanEngine::draw() {
- VK_CHECK(vkResetFences(_device, 1, get_current_frame()._renderFence->getPtr()));
+ VK_CHECK(vkResetFences(_device, 1,
+ get_current_frame()._renderFence->getPtr()));
@@ -858,4 +871,4 @@ void VulkanEngine::draw() {
- const VkResult e =
- vkAcquireNextImageKHR(_device, _swapchain, 1000000000,
- get_current_frame()._swapchainSemaphore->get(),
- nullptr, &swapchainImageIndex);
+ const VkResult e = vkAcquireNextImageKHR(
+ _device, _swapchain, 1000000000,
+ get_current_frame()._swapchainSemaphore->get(), nullptr,
+ &swapchainImageIndex);
@@ -894 +907,2 @@ void VulkanEngine::draw() {
- vkutil::transition_image(cmd, _drawImage->image(), VK_IMAGE_LAYOUT_UNDEFINED,
+ vkutil::transition_image(cmd, _drawImage->image(),
+ VK_IMAGE_LAYOUT_UNDEFINED,
@@ -946,3 +960,3 @@ void VulkanEngine::draw() {
- const VkSemaphoreSubmitInfo signalInfo =
- vkinit::semaphore_submit_info(VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT,
- get_current_frame()._renderSemaphore->get());
+ const VkSemaphoreSubmitInfo signalInfo = vkinit::semaphore_submit_info(
+ VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT,
+ get_current_frame()._renderSemaphore->get());
@@ -969 +983,2 @@ void VulkanEngine::draw() {
- presentInfo.pWaitSemaphores = get_current_frame()._renderSemaphore->getPtr();
+ presentInfo.pWaitSemaphores =
+ get_current_frame()._renderSemaphore->getPtr();
@@ -1065,24 +1080,27 @@ AllocatedImage VulkanEngine::create_image(const void* data, VkExtent3D size,
- command_buffers.immediate_submit([&](VkCommandBuffer cmd) {
- vkutil::transition_image(cmd, new_image.image,
- VK_IMAGE_LAYOUT_UNDEFINED,
- VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
-
- VkBufferImageCopy copyRegion = {};
- copyRegion.bufferOffset = 0;
- copyRegion.bufferRowLength = 0;
- copyRegion.bufferImageHeight = 0;
-
- copyRegion.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- copyRegion.imageSubresource.mipLevel = 0;
- copyRegion.imageSubresource.baseArrayLayer = 0;
- copyRegion.imageSubresource.layerCount = 1;
- copyRegion.imageExtent = size;
-
- // copy the buffer into the image
- vkCmdCopyBufferToImage(cmd, uploadbuffer.buffer, new_image.image,
- VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1,
- ©Region);
-
- vkutil::transition_image(cmd, new_image.image,
- VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
- VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
+ command_buffers.immediate_submit(
+ [&](VkCommandBuffer cmd) {
+ vkutil::transition_image(cmd, new_image.image,
+ VK_IMAGE_LAYOUT_UNDEFINED,
+ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
+
+ VkBufferImageCopy copyRegion = {};
+ copyRegion.bufferOffset = 0;
+ copyRegion.bufferRowLength = 0;
+ copyRegion.bufferImageHeight = 0;
+
+ copyRegion.imageSubresource.aspectMask =
+ VK_IMAGE_ASPECT_COLOR_BIT;
+ copyRegion.imageSubresource.mipLevel = 0;
+ copyRegion.imageSubresource.baseArrayLayer = 0;
+ copyRegion.imageSubresource.layerCount = 1;
+ copyRegion.imageExtent = size;
+
+ // copy the buffer into the image
+ vkCmdCopyBufferToImage(
+ cmd, uploadbuffer.buffer, new_image.image,
+ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ©Region);
+
+ vkutil::transition_image(
+ cmd, new_image.image,
+ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
diff --git a/src/graphics/vulkan/vk_pipelines.cpp b/src/graphics/vulkan/vk_pipelines.cpp
index 40438f0..7d2321d 100644
--- a/src/graphics/vulkan/vk_pipelines.cpp
+++ b/src/graphics/vulkan/vk_pipelines.cpp
@@ -3,0 +4 @@
+#include <filesystem>
@@ -7,2 +7,0 @@
-#include "core/Logging.h"
-#include <filesystem>
@@ -9,0 +9 @@
+#include "core/Logging.h"
@@ -78,4 +78,4 @@ void PipelineBuilder::clear() {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
- .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
- .primitiveRestartEnable = VK_FALSE
- };
+ .sType =
+ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
+ .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
+ .primitiveRestartEnable = VK_FALSE};
@@ -85,11 +85,11 @@ void PipelineBuilder::clear() {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
- .depthClampEnable = VK_FALSE,
- .rasterizerDiscardEnable = VK_FALSE,
- .polygonMode = VK_POLYGON_MODE_FILL,
- .cullMode = VK_CULL_MODE_NONE,
- .frontFace = VK_FRONT_FACE_CLOCKWISE,
- .depthBiasEnable = VK_FALSE,
- .depthBiasConstantFactor = 0.0f,
- .depthBiasClamp = 0.0f,
- .depthBiasSlopeFactor = 0.0f,
- .lineWidth = 1.0f // CRITICAL: Must be 1.0f, not 0.0f
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
+ .depthClampEnable = VK_FALSE,
+ .rasterizerDiscardEnable = VK_FALSE,
+ .polygonMode = VK_POLYGON_MODE_FILL,
+ .cullMode = VK_CULL_MODE_NONE,
+ .frontFace = VK_FRONT_FACE_CLOCKWISE,
+ .depthBiasEnable = VK_FALSE,
+ .depthBiasConstantFactor = 0.0f,
+ .depthBiasClamp = 0.0f,
+ .depthBiasSlopeFactor = 0.0f,
+ .lineWidth = 1.0f // CRITICAL: Must be 1.0f, not 0.0f
@@ -99,5 +99,5 @@ void PipelineBuilder::clear() {
- _colorBlendAttachment = {
- .blendEnable = VK_FALSE,
- .colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
- VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT
- };
+ _colorBlendAttachment = {.blendEnable = VK_FALSE,
+ .colorWriteMask = VK_COLOR_COMPONENT_R_BIT |
+ VK_COLOR_COMPONENT_G_BIT |
+ VK_COLOR_COMPONENT_B_BIT |
+ VK_COLOR_COMPONENT_A_BIT};
@@ -107,8 +107,9 @@ void PipelineBuilder::clear() {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
- .rasterizationSamples = VK_SAMPLE_COUNT_1_BIT, // CRITICAL: Must be valid sample count
- .sampleShadingEnable = VK_FALSE,
- .minSampleShading = 1.0f,
- .pSampleMask = nullptr,
- .alphaToCoverageEnable = VK_FALSE,
- .alphaToOneEnable = VK_FALSE
- };
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
+ .rasterizationSamples =
+ VK_SAMPLE_COUNT_1_BIT, // CRITICAL: Must be valid sample
+ // count
+ .sampleShadingEnable = VK_FALSE,
+ .minSampleShading = 1.0f,
+ .pSampleMask = nullptr,
+ .alphaToCoverageEnable = VK_FALSE,
+ .alphaToOneEnable = VK_FALSE};
@@ -120,9 +121,8 @@ void PipelineBuilder::clear() {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
- .depthTestEnable = VK_FALSE,
- .depthWriteEnable = VK_FALSE,
- .depthCompareOp = VK_COMPARE_OP_LESS,
- .depthBoundsTestEnable = VK_FALSE,
- .stencilTestEnable = VK_FALSE,
- .minDepthBounds = 0.0f,
- .maxDepthBounds = 1.0f
- };
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
+ .depthTestEnable = VK_FALSE,
+ .depthWriteEnable = VK_FALSE,
+ .depthCompareOp = VK_COMPARE_OP_LESS,
+ .depthBoundsTestEnable = VK_FALSE,
+ .stencilTestEnable = VK_FALSE,
+ .minDepthBounds = 0.0f,
+ .maxDepthBounds = 1.0f};
@@ -131,4 +131,2 @@ void PipelineBuilder::clear() {
- _renderInfo = {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO,
- .depthAttachmentFormat = VK_FORMAT_UNDEFINED
- };
+ _renderInfo = {.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO,
+ .depthAttachmentFormat = VK_FORMAT_UNDEFINED};
@@ -173 +171,2 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
- VkDynamicState dynamicStates[] = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
+ VkDynamicState dynamicStates[] = {VK_DYNAMIC_STATE_VIEWPORT,
+ VK_DYNAMIC_STATE_SCISSOR};
@@ -181 +180,2 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
- colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
+ colorBlending.sType =
+ VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
@@ -190,2 +190 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
- };
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
@@ -200 +199 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
- pipelineInfo.pInputAssemblyState = &inputAssembly; // Use our local copy
+ pipelineInfo.pInputAssemblyState = &inputAssembly; // Use our local copy
@@ -202 +201 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
- pipelineInfo.pRasterizationState = &rasterizer; // Use our local copy
+ pipelineInfo.pRasterizationState = &rasterizer; // Use our local copy
@@ -208 +207 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
- pipelineInfo.renderPass = VK_NULL_HANDLE; // We use dynamic rendering
+ pipelineInfo.renderPass = VK_NULL_HANDLE; // We use dynamic rendering
@@ -215 +213,0 @@ VkPipeline PipelineBuilder::build_pipeline(VkDevice device) const {
-
@@ -258 +256,2 @@ void PipelineBuilder::set_multisampling_none() {
- _multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
+ _multisampling.sType =
+ VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
@@ -286,2 +285 @@ void PipelineBuilder::set_depth_format(VkFormat format) {
- if (format != VK_FORMAT_D16_UNORM &&
- format != VK_FORMAT_D32_SFLOAT &&
+ if (format != VK_FORMAT_D16_UNORM && format != VK_FORMAT_D32_SFLOAT &&
diff --git a/src/graphics/vulkan/vk_command_buffers.cpp b/src/graphics/vulkan/vk_command_buffers.cpp
index 9114b9e..3547b0c 100644
--- a/src/graphics/vulkan/vk_command_buffers.cpp
+++ b/src/graphics/vulkan/vk_command_buffers.cpp
@@ -1,0 +2 @@
+
@@ -17,2 +18 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- nullptr,
- &commandPool));
+ nullptr, &commandPool));
@@ -20 +20,2 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- _frame._commandPool = std::make_unique<VulkanCommandPool>(vk_engine->_device, commandPool);
+ _frame._commandPool = std::make_unique<VulkanCommandPool>(
+ vk_engine->_device, commandPool);
@@ -24 +25,2 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- vkinit::command_buffer_allocate_info(_frame._commandPool->get(), 1);
+ vkinit::command_buffer_allocate_info(_frame._commandPool->get(),
+ 1);
@@ -34 +36,3 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- vk_engine->command_buffers_container._immCommandPool = std::make_unique<VulkanCommandPool>(vk_engine->_device, immCommandPool);
+ vk_engine->command_buffers_container._immCommandPool =
+ std::make_unique<VulkanCommandPool>(vk_engine->_device,
+ immCommandPool);
@@ -38 +42,3 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- vkinit::command_buffer_allocate_info(vk_engine->command_buffers_container._immCommandPool->get(), 1);
+ vkinit::command_buffer_allocate_info(
+ vk_engine->command_buffers_container._immCommandPool->get(),
+ 1);
@@ -40,2 +46,3 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- VK_CHECK(vkAllocateCommandBuffers(vk_engine->_device, &cmdAllocInfo,
- &(vk_engine->command_buffers_container._immCommandBuffer)));
+ VK_CHECK(vkAllocateCommandBuffers(
+ vk_engine->_device, &cmdAllocInfo,
+ &(vk_engine->command_buffers_container._immCommandBuffer)));
@@ -43 +50,2 @@ void CommandBuffers::init_commands(VulkanEngine* vk_engine) {
- // Smart pointer will automatically handle cleanup - no need for deletion queue
+ // Smart pointer will automatically handle cleanup - no need for deletion
+ // queue
@@ -49,2 +57,5 @@ void CommandBuffers::immediate_submit(
- VK_CHECK(vkResetFences(vk_engine->_device, 1, vk_engine->command_buffers_container._immFence->getPtr()));
-ed for deletion queue
+ // Smart pointer will automatically handle cleanup - no need for del+ VK_CHECK(vkResetFences(
+ vk_engine->_device, 1,
+ vk_engine->command_buffers_container._immFence->getPtr()));
+ VK_CHECK(vkResetCommandBuffer(
+ vk_engine->command_buffers_container._immCommandBuffer, 0));
@@ -52 +63,2 @@ void CommandBuffers::immediate_submit(
-tion
+ // queue
@@ -49,2 +57,5 @@ void CommandBuffers::immediate_submit(
- VK_CHEC+ const VkCommandBuffer cmd =
+ vk_engine->command_buffers_container._immCommandBuffer;
@@ -71,5 +83,8 @@ void CommandBuffers::immediate_submit(
-cmd =
+ vk_engine->command_buffers_container._immCommand-Buffer;
@@ -71,5 +83,8 @@ void CommandBuffers::immediate_submit(
-cmd =
+ -v-k_engine->command_buffers_container._immCommand-Buffer;
@@ -71,5 +83,8 @@ void CommandBuffers::immediate_submit(
-cm-d =
+ -v-k_engine->command_buffe+ VK_CHECK(vkQueueSubmit2(
+ vk_engine->_graphicsQueue, 1, &submit,
+ vk_engine->command_buffers_container._immFence->get()));
+
+ VK_CHECK(vkWaitForFences(
+ vk_engine->_device, 1,
+ vk_engine->command_buffers_container._immFence->getPtr(), true,
+ 9999999999));
diff --git a/src/graphics/vulkan/vk_loader.cpp b/src/graphics/vulkan/vk_loader.cpp
index 5c00e7b..5989c42 100644
--- a/src/graphics/vulkan/vk_loader.cpp
+++ b/src/graphics/vulkan/vk_loader.cpp
@@ -72,2 +72 @@ std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(
- LOGE("Failed to load glTF: {}",
- fastgltf::to_underlying(asset.error()));
+ LOGE("Failed to load glTF: {}", fastgltf::to_underlying(asset.error()));
@@ -210 +209,2 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- LOGI("Loading GLTF: {}", filePath);if (!std::filesystem::exists(filePath)) {
+ LOGI("Loading GLTF: {}", filePath);
+ if (!std::filesystem::exists(filePath)) {
@@ -231 +231,2 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- LOGE("Failed to load glTF: {} ", fastgltf::to_underlying(load.error()));
+ LOGE("Failed to load glTF: {} ",
+ fastgltf::to_underlying(load.error()));
@@ -240 +241,2 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- LOGE("Failed to load glTF: {} ", fastgltf::to_underlying(load.error()));
+ LOGE("Failed to load glTF: {} ",
+ fastgltf::to_underlying(load.error()));
@@ -353 +355,2 @@ std::optional<std::shared_ptr<LoadedGLTF>> loadGltf(VulkanEngine* engine,
- constants.metal_rough_factors = glm::vec4(0.0f); // Non-metallic, smooth
+ constants.metal_rough_factors =
+ glm::vec4(0.0f); // Non-metallic, smooth
diff --git a/src/include/interfaces/IModel.h b/src/include/interfaces/IModel.h
index d87ff29..71f3d3c 100644
--- a/src/include/interfaces/IModel.h
+++ b/src/include/interfaces/IModel.h
@@ -80 +80 @@ public:
-
+ ;
diff --git a/src/include/graphics/vulkan/vk_types.h b/src/include/graphics/vulkan/vk_types.h
index aeb7ae6..1e43298 100644
--- a/src/include/graphics/vulkan/vk_types.h
+++ b/src/include/graphics/vulkan/vk_types.h
@@ -2 +2,2 @@
- -> std::optional<std::shared_ptr<LoadedGLTF>>
+
+->std::optional<std::shared_ptr<LoadedGLTF>>
@@ -28 +29 @@
-struct AllocatedImage {
+ struct AllocatedImage {
diff --git a/src/include/graphics/vulkan/vk_command_buffers_container.h b/src/include/graphics/vulkan/vk_command_buffers_container.h
index 4109074..129a2b8 100644
--- a/src/include/graphics/vulkan/vk_command_buffers_container.h
+++ b/src/include/graphics/vulkan/vk_command_buffers_container.h
@@ -37 +37 @@ public:
- frames return frames[kFrameOverlap kFrameOverlap];
+ frames return frames[kFrameOverlap kFrameOverlap];
@@ -53 +53 @@ public:
- autor(CommandBuffers);
+ autor(_CommandBuffers);
diff --git a/src/include/graphics/vulkan/GraphicsPipeline.h b/src/include/graphics/vulkan/GraphicsPipeline.h
index 5da2acb..cf0eac4 100644
--- a/src/include/graphics/vulkan/GraphicsPipeline.h
+++ b/src/include/graphics/vulkan/GraphicsPipeline.h
@@ -3,4 +2,0 @@
-#include "IPipeline.h"
-#include "vk_types.h"
-#include "vk_initializers.h"
-#include "vk_pipelines.h"
@@ -10,0 +7,5 @@
+#include "IPipeline.h"
+#include "vk_initializers.h"
+#include "vk_pipelines.h"
+#include "vk_types.h"
+
@@ -47 +48,2 @@ public:
- void pushConstants(VkCommandBuffer cmd, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* data);
+ void pushConstants(VkCommandBuffer cmd, VkShaderStageFlags stageFlags,
+ uint32_t offset, uint32_t size, const void* data);
diff --git a/src/include/graphics/vulkan/IPipeline.h b/src/include/graphics/vulkan/IPipeline.h
index 3cc032b..993d7a9 100644
--- a/src/include/graphics/vulkan/IPipeline.h
+++ b/src/include/graphics/vulkan/IPipeline.h
@@ -8 +8 @@ public:
-
+
@@ -12 +12 @@ public:
-
+
diff --git a/src/include/graphics/vulkan/ComputePipeline.h b/src/include/graphics/vulkan/ComputePipeline.h
index 59c6e56..5f6f2de 100644
--- a/src/include/graphics/vulkan/ComputePipeline.h
+++ b/src/include/graphics/vulkan/ComputePipeline.h
@@ -2,0 +3,2 @@
+#include <functional>
+
@@ -4 +5,0 @@
-#include "vk_types.h"
@@ -7 +8 @@
-#include <functional>
+#include "vk_types.h"
@@ -23 +24 @@ public:
- nfig{} {};);
+ nfig;);
@@ -40 +41,3 @@ public:
- void bindDescriptorSets(VkCommandBuffer cmd, const VkDescriptorSet* descriptorSets, uint32_t setCount);
+ void bindDescriptorSets(VkCommandBuffer cmd,
+ const VkDescriptorSet* descriptorSets,
+ uint32_t setCount);
diff --git a/src/include/graphics/vulkan/vk_command_buffers.h b/src/include/graphics/vulkan/vk_command_buffers.h
index fa3a2cb..1f2f2df 100644
--- a/src/include/graphics/vulkan/vk_command_buffers.h
+++ b/src/include/graphics/vulkan/vk_command_buffers.h
@@ -3,3 +2,0 @@
-
-#include <vulkan/vulkan.h>
-#include <vector>
@@ -6,0 +4,2 @@
+#include <vector>
+#include <vulkan/vulkan.h>
@@ -18 +16,0 @@ private:
-
diff --git a/src/include/graphics/vulkan/pipelines.h b/src/include/graphics/vulkan/pipelines.h
index 14cf930..6017c86 100644
--- a/src/include/graphics/vulkan/pipelines.h
+++ b/src/include/graphics/vulkan/pipelines.h
@@ -4,0 +5,3 @@
+#include "ComputePipeline.h"
+#include "GraphicsPipeline.h"
+#include "IPipeline.h"
@@ -10,3 +12,0 @@
-#include "IPipeline.h"
-#include "GraphicsPipeline.h"
-#include "ComputePipeline.h"
diff --git a/src/include/graphics/vulkan/vk_smart_wrappers.h b/src/include/graphics/vulkan/vk_smart_wrappers.h
index 818f54a..f2a11b3 100644
--- a/src/include/graphics/vulkan/vk_smart_wrappers.h
+++ b/src/include/graphics/vulkan/vk_smart_wrappers.h
@@ -4 +3,0 @@
-#include <vulkan/vulkan_core.h>
@@ -5,0 +5,2 @@
+#include <vulkan/vulkan_core.h>
+
@@ -50,0 +52 @@ public:
+
@@ -100,0 +103 @@ public:
+
@@ -150,0 +154 @@ public:
+
@@ -200,0 +205 @@ public:
+
diff --git a/src/include/graphics/vulkan/vk_engine.h b/src/include/graphics/vulkan/vk_engine.h
index 1fe870a..de67e12 100644
--- a/src/include/graphics/vulkan/vk_engine.h
+++ b/src/include/graphics/vulkan/vk_engine.h
@@ -16,5 +15,0 @@
-#include "vk_descriptors.h"
-#include "vk_types.h"
-#include "vk_smart_wrappers.h"
-
-#include "pipelines.h"
@@ -22 +17 @@
-
+#include "pipelines.h"
@@ -24,0 +20,3 @@
+#include "vk_descriptors.h"
+#include "vk_smart_wrappers.h"
+#include "vk_types.h"
@@ -32 +29,0 @@ struct MeshAsset;
-
@@ -67 +63,0 @@ public:
-
diff --git a/src/include/graphics/vulkan/vk_loader.h b/src/include/graphics/vulkan/vk_loader.h
index 8c205c1..4f5e0e2 100644
--- a/src/include/graphics/vulkan/vk_loader.h
+++ b/src/include/graphics/vulkan/vk_loader.h
@@ -43,2 +43,2 @@ struct MeshAsset {
-struct LoadedGLTF final : public IRenderable {
- LoadedGLTF() = default;
+ struct LoadedGLTF final : public IRenderable {
+ LoadedGLTF() = default;
@@ -46,5 +46,5 @@ struct LoadedGLTF final : public IRenderable {
- // storage for all the data on a given glTF file
- std::unordered_map<std::string, std::shared_ptr<MeshAsset>> meshes;
- std::unordered_map<std::string, std::shared_ptr<ENode>> nodes;
- std::unordered_map<std::string, AllocatedImage> images;
- std::unordered_map<std::string, std::shared_ptr<GLTFMaterial>> materials;
+ // storage for all the data on a given glTF file
+ std::unordered_map<std::string, std::shared_ptr<MeshAsset>> meshes;
+ std::unordered_map<std::string, std::shared_ptr<ENode>> nodes;
+ std::unordered_map<std::string, AllocatedImage> images;
+ std::unordered_map<std::string, std::shared_ptr<GLTFMaterial>> materials;
@@ -52,3 +52,3 @@ struct LoadedGLTF final : public IRenderable {
- // nodes that dont have a parent, for iterating through the file in tree
- // order
- std::vector < std::shared_ptrtop_nodes top_nodes;
+ // nodes that dont have a parent, for iterating through the file in tree
+ // order
+ std::vector < std::shared_ptrtop_nodes top_nodes;
@@ -56 +56 @@ struct LoadedGLTF final : public IRenderable {
- a parent, for iterating through the + std::vector<VkSampler> samplers;
@@ -58 +58 @@ struct LoadedGLTF final : public IRenderable {
-ile in tree
+ // order
+ std::vector < s+ DescriptorAllocatodescriptor_poolriptor_pool;
@@ -60,2 +60,2 @@ struct LoadedGLTF final : public IRenderable {
-d::shared_ptrtop_nodes top_nodes;-
@@ -56 +56 @@ struct+ Allocmaterial_data_buffer {}
+ l_data_buffer{};
@@ -63,2 +63,2 @@ struct LoadedGLTF final : public IRenderable {
-LoadedGLTF fin-al : public IRenderable+ Vulkan {}
+ Engine* creator{};
@@ -66,4 +66,4 @@ struct LoadedGLTF final : public IRenderable {
-{
- a parent, for it-erating through the -+ std::v-ector<V+ ~LoadedGLTF() {
+ clearAll();
+ draw
+ };
@@ -71 +71 @@ struct LoadedGLTF final : public IRenderable {
-Sampler> samplers;
�glm::mat4& topMatrix, DrawContext& ctx);
+ void Draw(const glm::mat4& topMatrix, DrawContext& ctx);
@@ -73 +73 @@ struct LoadedGLTF final : public IRenderable {
-private:
+ private:
Have any feedback or feature suggestions? Share it here.
added manual run