diff --git a/Makefile b/Makefile index 2b5d5b2..78bf421 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ CFLAGS += -DPTK_VERSION_PATCH=0 INCLUDE = include SRC = src -CFLAGS += -I$(INCLUDE) -I$(SRC) +CFLAGS += -I$(INCLUDE) -iquote$(SRC) BIN = target diff --git a/include/ptk.h b/include/ptk.h index d6e6e06..4877090 100644 --- a/include/ptk.h +++ b/include/ptk.h @@ -1,9 +1,9 @@ #ifndef PTK_PTK_H_ #define PTK_PTK_H_ -#include -#include -#include +#include "ptk_color.h" +#include "ptk_list.h" +#include "ptk_vec.h" #include #include diff --git a/src/ptk.c b/src/ptk.c index fc9df4a..7ca0938 100644 --- a/src/ptk.c +++ b/src/ptk.c @@ -1,14 +1,14 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include -#include -#include -#include +#include "ptk.h" +#include "ptk_list.h" +#include "ptk_log.h" +#include "ptk_option.h" -#include -#include -#include -#include +#include "ptk_vk/components.h" +#include "ptk_vk/device.h" +#include "ptk_vk/init.h" +#include "ptk_vk/utils.h" #include #ifndef GLFW_INCLUDE_VULKAN diff --git a/src/ptk_color.c b/src/ptk_color.c index 3c0abd2..e023a9a 100644 --- a/src/ptk_color.c +++ b/src/ptk_color.c @@ -1,4 +1,4 @@ -#include +#include "ptk_color.h" #include diff --git a/src/ptk_list.c b/src/ptk_list.c index 87547fa..5d24bda 100644 --- a/src/ptk_list.c +++ b/src/ptk_list.c @@ -1,6 +1,6 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_list.h" #include #include diff --git a/src/ptk_list.h b/src/ptk_list.h index 6fa8910..9c73651 100644 --- a/src/ptk_list.h +++ b/src/ptk_list.h @@ -4,8 +4,8 @@ #define PTK_PTK_LIST_H_ #include -#include #include +#include #define PTK_LIST(T) struct PtkList_##T diff --git a/src/ptk_log.c b/src/ptk_log.c index 7e3cbf5..70dffc5 100644 --- a/src/ptk_log.c +++ b/src/ptk_log.c @@ -1,6 +1,6 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_log.h" #include diff --git a/src/ptk_vk/buffer.c b/src/ptk_vk/buffer.c index afc5555..3e03c24 100644 --- a/src/ptk_vk/buffer.c +++ b/src/ptk_vk/buffer.c @@ -1,8 +1,8 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/buffer.h" -#include +#include "ptk_vk/utils.h" #include diff --git a/src/ptk_vk/buffer.h b/src/ptk_vk/buffer.h index 57d22d8..7a3d8a6 100644 --- a/src/ptk_vk/buffer.h +++ b/src/ptk_vk/buffer.h @@ -3,9 +3,9 @@ #ifndef PTK_PTK_VK_BUFFER_H_ #define PTK_PTK_VK_BUFFER_H_ -#include +#include "ptk_option.h" -#include +#include typedef struct { VkBuffer buffer; diff --git a/src/ptk_vk/command_buffers.c b/src/ptk_vk/command_buffers.c index bfa1246..937570f 100644 --- a/src/ptk_vk/command_buffers.c +++ b/src/ptk_vk/command_buffers.c @@ -1,8 +1,8 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/command_buffers.h" -#include +#include "ptk_vk/utils.h" PTK_OPTION(VkCommandBufferList) vk_allocate_command_buffers(VkDevice dev, VkCommandPool command_pool, uint32_t max_frames_in_flight) { VkCommandBufferList ret = PTK_LIST_NEW(VkCommandBuffer, max_frames_in_flight); diff --git a/src/ptk_vk/command_buffers.h b/src/ptk_vk/command_buffers.h index 9aef829..c05341c 100644 --- a/src/ptk_vk/command_buffers.h +++ b/src/ptk_vk/command_buffers.h @@ -3,10 +3,10 @@ #ifndef PTK_PTK_VK_COMMAND_BUFFERS_H_ #define PTK_PTK_VK_COMMAND_BUFFERS_H_ -#include +#include "ptk_list.h" +#include "ptk_option.h" -#include -#include +#include PTK_LIST_DEFINE(VkCommandBuffer); typedef PTK_LIST(VkCommandBuffer) VkCommandBufferList; diff --git a/src/ptk_vk/command_pool.c b/src/ptk_vk/command_pool.c index f4b1837..7e8dc87 100644 --- a/src/ptk_vk/command_pool.c +++ b/src/ptk_vk/command_pool.c @@ -1,9 +1,8 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/command_pool.h" -#include -#include +#include "ptk_vk/utils.h" PTK_OPTION(VkCommandPool) vk_create_command_pool(VkDevice dev, uint32_t graphics_queue_family_index) { VkCommandPool ret; diff --git a/src/ptk_vk/command_pool.h b/src/ptk_vk/command_pool.h index b5feeb3..8744a36 100644 --- a/src/ptk_vk/command_pool.h +++ b/src/ptk_vk/command_pool.h @@ -3,9 +3,9 @@ #ifndef PTK_PTK_VK_COMMAND_POOL_H_ #define PTK_PTK_VK_COMMAND_POOL_H_ -#include +#include "ptk_option.h" -#include +#include PTK_OPTION_DEFINE(VkCommandPool); diff --git a/src/ptk_vk/components.c b/src/ptk_vk/components.c index 78102ad..1057c2a 100644 --- a/src/ptk_vk/components.c +++ b/src/ptk_vk/components.c @@ -1,9 +1,9 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include -#include -#include -#include +#include "ptk_vk/components.h" +#include "ptk_vk/init.h" + +#include "ptk.h" #include #include diff --git a/src/ptk_vk/components.h b/src/ptk_vk/components.h index 3f793e4..81d8e8a 100644 --- a/src/ptk_vk/components.h +++ b/src/ptk_vk/components.h @@ -3,8 +3,8 @@ #ifndef PTK_PTK_VK_COMPONENTS_H_ #define PTK_PTK_VK_COMPONENTS_H_ -#include -#include +#include "ptk.h" +#include "ptk_list.h" typedef struct { PtkPos pos; diff --git a/src/ptk_vk/descriptors.c b/src/ptk_vk/descriptors.c index af4c6e3..9d94b6e 100644 --- a/src/ptk_vk/descriptors.c +++ b/src/ptk_vk/descriptors.c @@ -1,8 +1,8 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/descriptors.h" -#include +#include "ptk_vk/utils.h" PTK_OPTION(VkDescriptorSetLayout) vk_create_descriptor_set_layout(VkDevice dev) { VkDescriptorSetLayout ret; diff --git a/src/ptk_vk/descriptors.h b/src/ptk_vk/descriptors.h index d05d15b..faf9b6e 100644 --- a/src/ptk_vk/descriptors.h +++ b/src/ptk_vk/descriptors.h @@ -3,14 +3,13 @@ #ifndef PTK_PTK_VK_DESCRIPTORS_H_ #define PTK_PTK_VK_DESCRIPTORS_H_ +#include "ptk_vk/uniform_buffers.h" + +#include "ptk_list.h" +#include "ptk_option.h" + #include -#include - -#include -#include -#include - PTK_OPTION_DEFINE(VkDescriptorSetLayout); PTK_OPTION_DEFINE(VkDescriptorPool); PTK_LIST_DEFINE(VkDescriptorSet); diff --git a/src/ptk_vk/device.c b/src/ptk_vk/device.c index 522e0f2..d384531 100644 --- a/src/ptk_vk/device.c +++ b/src/ptk_vk/device.c @@ -1,19 +1,18 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/device.h" -#include -#include -#include +#include "ptk_vk/swapchain.h" +#include "ptk_vk/utils.h" + +#include "ptk_array.h" +#include "ptk_list.h" +#include "ptk_log.h" +#include "ptk_option.h" #include #include -#include -#include -#include -#include - VkQueue g_graphics_queue; VkQueue g_present_queue; diff --git a/src/ptk_vk/device.h b/src/ptk_vk/device.h index 44a42e8..ff3b89a 100644 --- a/src/ptk_vk/device.h +++ b/src/ptk_vk/device.h @@ -3,14 +3,14 @@ #ifndef PTK_PTK_VK_DEVICE_H_ #define PTK_PTK_VK_DEVICE_H_ -#include -#include +// for PTK_ARRAY(constcharptr) +#include "ptk_vk/instance.h" + +#include "ptk_array.h" +#include "ptk_option.h" #include -// for PTK_ARRAY(constcharptr) -#include - PTK_OPTION_DEFINE(uint32_t); typedef struct { diff --git a/src/ptk_vk/init.c b/src/ptk_vk/init.c index 39cebdb..c6d4a8f 100644 --- a/src/ptk_vk/init.c +++ b/src/ptk_vk/init.c @@ -1,24 +1,27 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/init.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ptk_vk/buffer.h" +#include "ptk_vk/command_buffers.h" +#include "ptk_vk/command_pool.h" +#include "ptk_vk/components.h" +#include "ptk_vk/descriptors.h" +#include "ptk_vk/device.h" +#include "ptk_vk/instance.h" +#include "ptk_vk/physical_device.h" +#include "ptk_vk/pipeline.h" +#include "ptk_vk/render_pass.h" +#include "ptk_vk/swapchain.h" +#include "ptk_vk/sync_objects.h" +#include "ptk_vk/uniform_buffers.h" +#include "ptk_vk/utils.h" + +#include "ptk_array.h" +#include "ptk_list.h" +#include "ptk_log.h" +#include "ptk_option.h" -#include -#include -#include -#include #include #include diff --git a/src/ptk_vk/init.h b/src/ptk_vk/init.h index 3d16708..47f61c4 100644 --- a/src/ptk_vk/init.h +++ b/src/ptk_vk/init.h @@ -3,15 +3,14 @@ #ifndef PTK_PTK_VK_INIT_H_ #define PTK_PTK_VK_INIT_H_ +#include "ptk.h" + #ifndef GLFW_INCLUDE_VULKAN #define GLFW_INCLUDE_VULKAN #endif #include -#include -#include -#include -#include +#include bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const char *title, const PtkVersion version); diff --git a/src/ptk_vk/instance.c b/src/ptk_vk/instance.c index 281486f..b164191 100644 --- a/src/ptk_vk/instance.c +++ b/src/ptk_vk/instance.c @@ -1,10 +1,10 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/instance.h" -#include +#include "ptk_vk/utils.h" -#include +#include "ptk_array.h" #ifndef GLFW_INCLUDE_VULKAN #define GLFW_INCLUDE_VULKAN @@ -86,4 +86,3 @@ PTK_OPTION(VkInstance) vk_instance_create(const char *title, const PtkVersion ve return PTK_OPTION_SOME(VkInstance, ret); } - diff --git a/src/ptk_vk/instance.h b/src/ptk_vk/instance.h index e1c627b..6c22dd4 100644 --- a/src/ptk_vk/instance.h +++ b/src/ptk_vk/instance.h @@ -3,11 +3,11 @@ #ifndef PTK_PTK_VK_INSTANCE_H_ #define PTK_PTK_VK_INSTANCE_H_ -#include +#include "ptk.h" +#include "ptk_array.h" +#include "ptk_option.h" -#include -#include -#include +#include PTK_OPTION_DEFINE(VkInstance); typedef const char *constcharptr; diff --git a/src/ptk_vk/physical_device.c b/src/ptk_vk/physical_device.c index a0fbef4..b32d429 100644 --- a/src/ptk_vk/physical_device.c +++ b/src/ptk_vk/physical_device.c @@ -1,8 +1,8 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/physical_device.h" -#include +#include "ptk_log.h" #include diff --git a/src/ptk_vk/physical_device.h b/src/ptk_vk/physical_device.h index 7c3ef8f..f6751ef 100644 --- a/src/ptk_vk/physical_device.h +++ b/src/ptk_vk/physical_device.h @@ -3,9 +3,9 @@ #ifndef PTK_PTK_VK_PHYSICAL_DEVICE_H_ #define PTK_PTK_VK_PHYSICAL_DEVICE_H_ -#include +#include "ptk_option.h" -#include +#include PTK_OPTION_DEFINE(VkPhysicalDevice); diff --git a/src/ptk_vk/pipeline.c b/src/ptk_vk/pipeline.c index 6bae682..c5f4581 100644 --- a/src/ptk_vk/pipeline.c +++ b/src/ptk_vk/pipeline.c @@ -1,15 +1,15 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/pipeline.h" -#include -#include -#include +#include "ptk_vk/components.h" +#include "ptk_vk/utils.h" -#include +#include "ptk_array.h" +#include "ptk_log.h" -#include -#include +#include "errno.h" +#include "stdio.h" PTK_OPTION_DEFINE(VkShaderModule); PTK_ARRAY_DEFINE(VkVertexInputAttributeDescription); diff --git a/src/ptk_vk/pipeline.h b/src/ptk_vk/pipeline.h index 5bd4ea5..c38ace9 100644 --- a/src/ptk_vk/pipeline.h +++ b/src/ptk_vk/pipeline.h @@ -3,11 +3,9 @@ #ifndef PTK_PTK_VK_PIPELINE_H_ #define PTK_PTK_VK_PIPELINE_H_ -#include +#include "ptk_option.h" -#include -#include -#include +#include typedef struct { VkPipeline pipeline; diff --git a/src/ptk_vk/render_pass.c b/src/ptk_vk/render_pass.c index 39fc0f2..b6310b4 100644 --- a/src/ptk_vk/render_pass.c +++ b/src/ptk_vk/render_pass.c @@ -1,10 +1,8 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include -#include +#include "ptk_vk/render_pass.h" -#include -#include +#include "ptk_vk/utils.h" PTK_OPTION(VkRenderPass) vk_create_render_pass(VkDevice dev, VkFormat format) { VkRenderPass ret; @@ -62,4 +60,3 @@ PTK_OPTION(VkRenderPass) vk_create_render_pass(VkDevice dev, VkFormat format) { return PTK_OPTION_SOME(VkRenderPass, ret); } - diff --git a/src/ptk_vk/render_pass.h b/src/ptk_vk/render_pass.h index 1ad380e..e2bafe5 100644 --- a/src/ptk_vk/render_pass.h +++ b/src/ptk_vk/render_pass.h @@ -3,11 +3,11 @@ #ifndef PTK_PTK_VK_RENDER_PASS_H_ #define PTK_PTK_VK_RENDER_PASS_H_ -#include +#include "ptk_option.h" #include -#include +#include PTK_OPTION_DEFINE(VkRenderPass); diff --git a/src/ptk_vk/swapchain.c b/src/ptk_vk/swapchain.c index e150d27..d09715c 100644 --- a/src/ptk_vk/swapchain.c +++ b/src/ptk_vk/swapchain.c @@ -1,12 +1,10 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/swapchain.h" -#include -#include -#include +#include "ptk_vk/utils.h" -#include +#include "ptk_list.h" #ifndef GLFW_INCLUDE_VULKAN #define GLFW_INCLUDE_VULKAN diff --git a/src/ptk_vk/swapchain.h b/src/ptk_vk/swapchain.h index 3f506fa..4ab7197 100644 --- a/src/ptk_vk/swapchain.h +++ b/src/ptk_vk/swapchain.h @@ -3,14 +3,13 @@ #ifndef PTK_PTK_VK_SWAPCHAIN_H_ #define PTK_PTK_VK_SWAPCHAIN_H_ +#include "ptk_vk/device.h" + +#include "ptk_list.h" + #include #include -#include - -#include -#include - PTK_LIST_DEFINE(VkFramebuffer); PTK_LIST_DEFINE(VkSurfaceFormatKHR); diff --git a/src/ptk_vk/sync_objects.c b/src/ptk_vk/sync_objects.c index 4552316..9cddaa0 100644 --- a/src/ptk_vk/sync_objects.c +++ b/src/ptk_vk/sync_objects.c @@ -1,8 +1,8 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/sync_objects.h" -#include +#include "ptk_vk/utils.h" PTK_OPTION(SyncObjects) vk_create_sync_objects(VkDevice dev, uint32_t max_frames_in_flight) { SyncObjects ret = { @@ -42,4 +42,3 @@ PTK_OPTION(SyncObjects) vk_create_sync_objects(VkDevice dev, uint32_t max_frames return PTK_OPTION_SOME(SyncObjects, ret); } - diff --git a/src/ptk_vk/sync_objects.h b/src/ptk_vk/sync_objects.h index 1026c48..d6c1a3d 100644 --- a/src/ptk_vk/sync_objects.h +++ b/src/ptk_vk/sync_objects.h @@ -3,10 +3,10 @@ #ifndef PTK_PTK_VK_SYNC_OBJECTS_H_ #define PTK_PTK_VK_SYNC_OBJECTS_H_ -#include +#include "ptk_list.h" +#include "ptk_option.h" -#include -#include +#include PTK_LIST_DEFINE(VkSemaphore); PTK_LIST_DEFINE(VkFence); diff --git a/src/ptk_vk/uniform_buffers.c b/src/ptk_vk/uniform_buffers.c index f3731f4..179af81 100644 --- a/src/ptk_vk/uniform_buffers.c +++ b/src/ptk_vk/uniform_buffers.c @@ -1,10 +1,10 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/uniform_buffers.h" -#include +#include "ptk_vk/buffer.h" -#include +#include "ptk_log.h" PTK_OPTION(UniformBufferStuff) vk_create_uniform_buffers(VkDevice dev, VkPhysicalDevice physical_dev, uint32_t max_frames_in_flight) { const VkDeviceSize buffer_size = sizeof(UniformBufferObject); @@ -37,4 +37,3 @@ PTK_OPTION(UniformBufferStuff) vk_create_uniform_buffers(VkDevice dev, VkPhysica return PTK_OPTION_SOME(UniformBufferStuff, ret); } - diff --git a/src/ptk_vk/uniform_buffers.h b/src/ptk_vk/uniform_buffers.h index d1d1912..194f005 100644 --- a/src/ptk_vk/uniform_buffers.h +++ b/src/ptk_vk/uniform_buffers.h @@ -3,11 +3,11 @@ #ifndef PTK_PTK_VK_UNIFORM_BUFFERS_H_ #define PTK_PTK_VK_UNIFORM_BUFFERS_H_ -#include +#include "ptk_list.h" +#include "ptk_option.h" +#include "ptk_vec.h" -#include -#include -#include +#include PTK_LIST_DEFINE(VkBuffer); PTK_LIST_DEFINE(VkDeviceMemory); diff --git a/src/ptk_vk/utils.c b/src/ptk_vk/utils.c index 8d1fa99..6c349b5 100644 --- a/src/ptk_vk/utils.c +++ b/src/ptk_vk/utils.c @@ -1,6 +1,6 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include +#include "ptk_vk/utils.h" const char *vk_result_string(VkResult res) { const char *str; diff --git a/src/ptk_vk/utils.h b/src/ptk_vk/utils.h index df9e214..2f2b5c5 100644 --- a/src/ptk_vk/utils.h +++ b/src/ptk_vk/utils.h @@ -3,8 +3,9 @@ #ifndef PTK_PTK_VK_UTILS_H_ #define PTK_PTK_VK_UTILS_H_ +#include "ptk_log.h" + #include -#include const char *vk_result_string(VkResult res); diff --git a/test/list.c b/test/list.c index 6d2d355..3ac6092 100644 --- a/test/list.c +++ b/test/list.c @@ -1,7 +1,8 @@ // Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later. -#include -#include +#include "test.h" + +#include "ptk_list.h" PTK_LIST_DEFINE(uint32_t);