Knoodle
Knoodle is a Free Open-Source alternative for graph-based texture designers. It is a tool for creating procedural textures using a node-based graph editor. It is designed to be easy to use, to be able to create complex textures with a minimum of effort, and to be pluggable to any game engine and front-end.
 
Loading...
Searching...
No Matches
vulkan_ghi.hpp
1/**************************************************************************/
2/**************************************************************************/
3/* vulkan_ghi.hpp */
4/**************************************************************************/
5/* This file is part of: */
6/* Knoodle */
7/* https://knoodlegraph.org */
8/**************************************************************************/
9/* Copyright (c) 2025 Knoodle contributors (vide AUTHORS.md) */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#pragma once
32
33#include <vulkan/vulkan.h>
34#include <vector>
36#include "vulkan-ghi_api.hpp"
37
38#ifndef KN_VULKAN_DEBUG
39#define KN_VULKAN_DEBUG 0
40#endif
41
42namespace kn {
43
44/**
45 * @brief Checks if the GHI is supported on the current platform.
46 */
47extern "C" KN_VULKAN_API bool is_supported();
48
49/**
50 * @brief Creates a new GHI instance.
51 */
52extern "C" KN_VULKAN_API IGHI* create_ghi();
53
54class VulkanGHI : public IGHI {
55 public:
56 KN_VULKAN_API bool initialize(const GHIDesc* desc) override;
57 KN_VULKAN_API void shutdown() override;
58
59 private:
60 bool create_instance(const GHIDesc* desc);
61 bool check_validation_layer_support();
62 bool setup_debug_messenger(const GHIDesc* desc);
63 bool setup_physical_device(const GHIDesc* desc);
64 bool setup_logical_device(const GHIDesc* desc);
65 bool setup_command_pool(const GHIDesc* desc);
66
67 private:
68 VkInstance _instance{VK_NULL_HANDLE};
69 VkDebugUtilsMessengerEXT _debugMessenger{VK_NULL_HANDLE};
70 VkPhysicalDevice _physicalDevice{VK_NULL_HANDLE};
71 VkSampleCountFlagBits _msaaSamples{VK_SAMPLE_COUNT_1_BIT};
72 VkDevice _device{VK_NULL_HANDLE};
73
74 VkQueue _graphicsQueue{VK_NULL_HANDLE};
75 VkQueue _computeQueue{VK_NULL_HANDLE};
76
77 int32_t _graphicsQueueFamilyIndex;
78 VkCommandPool _commandPool{VK_NULL_HANDLE};
79};
80
81} // namespace kn
Definition ghi_interface.hpp:42
Definition vulkan_ghi.hpp:54
KN_VULKAN_API void shutdown() override
Definition vulkan_ghi.cpp:114
KN_VULKAN_API bool initialize(const GHIDesc *desc) override
Definition vulkan_ghi.cpp:97
Definition ghi_interface.hpp:36