header cleanup and more

This commit is contained in:
jacekpoz 2024-10-04 00:00:52 +02:00
parent f7b2644d00
commit ec513697f1
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
38 changed files with 127 additions and 137 deletions

View file

@ -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

View file

@ -1,9 +1,9 @@
#ifndef PTK_PTK_H_
#define PTK_PTK_H_
#include <ptk_color.h>
#include <ptk_list.h>
#include <ptk_vec.h>
#include "ptk_color.h"
#include "ptk_list.h"
#include "ptk_vec.h"
#include <stdbool.h>
#include <stdint.h>

View file

@ -1,14 +1,14 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk.h>
#include <ptk_log.h>
#include <ptk_list.h>
#include <ptk_option.h>
#include "ptk.h"
#include "ptk_list.h"
#include "ptk_log.h"
#include "ptk_option.h"
#include <ptk_vk/components.h>
#include <ptk_vk/device.h>
#include <ptk_vk/init.h>
#include <ptk_vk/utils.h>
#include "ptk_vk/components.h"
#include "ptk_vk/device.h"
#include "ptk_vk/init.h"
#include "ptk_vk/utils.h"
#include <vulkan/vulkan_core.h>
#ifndef GLFW_INCLUDE_VULKAN

View file

@ -1,4 +1,4 @@
#include <ptk_color.h>
#include "ptk_color.h"
#include <math.h>

View file

@ -1,6 +1,6 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_list.h>
#include "ptk_list.h"
#include <errno.h>
#include <stdlib.h>

View file

@ -4,8 +4,8 @@
#define PTK_PTK_LIST_H_
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdlib.h>
#define PTK_LIST(T) struct PtkList_##T

View file

@ -1,6 +1,6 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_log.h>
#include "ptk_log.h"
#include <stdio.h>

View file

@ -1,8 +1,8 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/buffer.h>
#include "ptk_vk/buffer.h"
#include <ptk_vk/utils.h>
#include "ptk_vk/utils.h"
#include <string.h>

View file

@ -3,9 +3,9 @@
#ifndef PTK_PTK_VK_BUFFER_H_
#define PTK_PTK_VK_BUFFER_H_
#include <vulkan/vulkan_core.h>
#include "ptk_option.h"
#include <ptk_option.h>
#include <vulkan/vulkan_core.h>
typedef struct {
VkBuffer buffer;

View file

@ -1,8 +1,8 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/command_buffers.h>
#include "ptk_vk/command_buffers.h"
#include <ptk_vk/utils.h>
#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);

View file

@ -3,10 +3,10 @@
#ifndef PTK_PTK_VK_COMMAND_BUFFERS_H_
#define PTK_PTK_VK_COMMAND_BUFFERS_H_
#include <vulkan/vulkan_core.h>
#include "ptk_list.h"
#include "ptk_option.h"
#include <ptk_list.h>
#include <ptk_option.h>
#include <vulkan/vulkan_core.h>
PTK_LIST_DEFINE(VkCommandBuffer);
typedef PTK_LIST(VkCommandBuffer) VkCommandBufferList;

View file

@ -1,9 +1,8 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/command_pool.h>
#include "ptk_vk/command_pool.h"
#include <ptk_vk/device.h>
#include <ptk_vk/utils.h>
#include "ptk_vk/utils.h"
PTK_OPTION(VkCommandPool) vk_create_command_pool(VkDevice dev, uint32_t graphics_queue_family_index) {
VkCommandPool ret;

View file

@ -3,9 +3,9 @@
#ifndef PTK_PTK_VK_COMMAND_POOL_H_
#define PTK_PTK_VK_COMMAND_POOL_H_
#include <vulkan/vulkan_core.h>
#include "ptk_option.h"
#include <ptk_option.h>
#include <vulkan/vulkan_core.h>
PTK_OPTION_DEFINE(VkCommandPool);

View file

@ -1,9 +1,9 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk.h>
#include <ptk_log.h>
#include <ptk_vk/components.h>
#include <ptk_vk/init.h>
#include "ptk_vk/components.h"
#include "ptk_vk/init.h"
#include "ptk.h"
#include <GLFW/glfw3.h>
#include <string.h>

View file

@ -3,8 +3,8 @@
#ifndef PTK_PTK_VK_COMPONENTS_H_
#define PTK_PTK_VK_COMPONENTS_H_
#include <ptk.h>
#include <ptk_list.h>
#include "ptk.h"
#include "ptk_list.h"
typedef struct {
PtkPos pos;

View file

@ -1,8 +1,8 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/descriptors.h>
#include "ptk_vk/descriptors.h"
#include <ptk_vk/utils.h>
#include "ptk_vk/utils.h"
PTK_OPTION(VkDescriptorSetLayout) vk_create_descriptor_set_layout(VkDevice dev) {
VkDescriptorSetLayout ret;

View file

@ -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 <vulkan/vulkan_core.h>
#include <ptk_vk/uniform_buffers.h>
#include <ptk.h>
#include <ptk_list.h>
#include <ptk_option.h>
PTK_OPTION_DEFINE(VkDescriptorSetLayout);
PTK_OPTION_DEFINE(VkDescriptorPool);
PTK_LIST_DEFINE(VkDescriptorSet);

View file

@ -1,19 +1,18 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/device.h>
#include "ptk_vk/device.h"
#include <ptk_vk/init.h>
#include <ptk_vk/swapchain.h>
#include <ptk_vk/utils.h>
#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 <stdbool.h>
#include <string.h>
#include <ptk_array.h>
#include <ptk_list.h>
#include <ptk_log.h>
#include <ptk_option.h>
VkQueue g_graphics_queue;
VkQueue g_present_queue;

View file

@ -3,14 +3,14 @@
#ifndef PTK_PTK_VK_DEVICE_H_
#define PTK_PTK_VK_DEVICE_H_
#include <ptk_array.h>
#include <ptk_option.h>
// for PTK_ARRAY(constcharptr)
#include "ptk_vk/instance.h"
#include "ptk_array.h"
#include "ptk_option.h"
#include <vulkan/vulkan_core.h>
// for PTK_ARRAY(constcharptr)
#include <ptk_vk/instance.h>
PTK_OPTION_DEFINE(uint32_t);
typedef struct {

View file

@ -1,24 +1,27 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/init.h>
#include "ptk_vk/init.h"
#include <ptk_vk/buffer.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/uniform_buffers.h>
#include <ptk_vk/utils.h>
#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 <ptk_log.h>
#include <ptk_option.h>
#include <ptk_array.h>
#include <ptk_list.h>
#include <stdio.h>
#include <string.h>

View file

@ -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 <GLFW/glfw3.h>
#include <ptk.h>
#include <ptk_list.h>
#include <ptk_vk/command_buffers.h>
#include <ptk_vk/sync_objects.h>
#include <stdbool.h>
bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const char *title, const PtkVersion version);

View file

@ -1,10 +1,10 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/instance.h>
#include "ptk_vk/instance.h"
#include <ptk_vk/utils.h>
#include "ptk_vk/utils.h"
#include <ptk_array.h>
#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);
}

View file

@ -3,11 +3,11 @@
#ifndef PTK_PTK_VK_INSTANCE_H_
#define PTK_PTK_VK_INSTANCE_H_
#include <vulkan/vulkan_core.h>
#include "ptk.h"
#include "ptk_array.h"
#include "ptk_option.h"
#include <ptk.h>
#include <ptk_array.h>
#include <ptk_option.h>
#include <vulkan/vulkan_core.h>
PTK_OPTION_DEFINE(VkInstance);
typedef const char *constcharptr;

View file

@ -1,8 +1,8 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/physical_device.h>
#include "ptk_vk/physical_device.h"
#include <ptk_log.h>
#include "ptk_log.h"
#include <vulkan/vulkan.h>

View file

@ -3,9 +3,9 @@
#ifndef PTK_PTK_VK_PHYSICAL_DEVICE_H_
#define PTK_PTK_VK_PHYSICAL_DEVICE_H_
#include <vulkan/vulkan_core.h>
#include "ptk_option.h"
#include <ptk_option.h>
#include <vulkan/vulkan_core.h>
PTK_OPTION_DEFINE(VkPhysicalDevice);

View file

@ -1,15 +1,15 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/pipeline.h>
#include "ptk_vk/pipeline.h"
#include <ptk_vk/components.h>
#include <ptk_vk/swapchain.h>
#include <ptk_vk/utils.h>
#include "ptk_vk/components.h"
#include "ptk_vk/utils.h"
#include <ptk_log.h>
#include "ptk_array.h"
#include "ptk_log.h"
#include <errno.h>
#include <stdio.h>
#include "errno.h"
#include "stdio.h"
PTK_OPTION_DEFINE(VkShaderModule);
PTK_ARRAY_DEFINE(VkVertexInputAttributeDescription);

View file

@ -3,11 +3,9 @@
#ifndef PTK_PTK_VK_PIPELINE_H_
#define PTK_PTK_VK_PIPELINE_H_
#include <vulkan/vulkan_core.h>
#include "ptk_option.h"
#include <ptk.h>
#include <ptk_array.h>
#include <ptk_option.h>
#include <vulkan/vulkan_core.h>
typedef struct {
VkPipeline pipeline;

View file

@ -1,10 +1,8 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/render_pass.h>
#include <ptk_vk/swapchain.h>
#include "ptk_vk/render_pass.h"
#include <ptk_vk/device.h>
#include <ptk_vk/utils.h>
#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);
}

View file

@ -3,11 +3,11 @@
#ifndef PTK_PTK_VK_RENDER_PASS_H_
#define PTK_PTK_VK_RENDER_PASS_H_
#include <stdbool.h>
#include "ptk_option.h"
#include <vulkan/vulkan.h>
#include <ptk_option.h>
#include <stdbool.h>
PTK_OPTION_DEFINE(VkRenderPass);

View file

@ -1,12 +1,10 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/swapchain.h>
#include "ptk_vk/swapchain.h"
#include <ptk_vk/physical_device.h>
#include <ptk_vk/render_pass.h>
#include <ptk_vk/utils.h>
#include "ptk_vk/utils.h"
#include <ptk_list.h>
#include "ptk_list.h"
#ifndef GLFW_INCLUDE_VULKAN
#define GLFW_INCLUDE_VULKAN

View file

@ -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 <vulkan/vulkan_core.h>
#include <GLFW/glfw3.h>
#include <ptk_vk/device.h>
#include <ptk_list.h>
#include <ptk_option.h>
PTK_LIST_DEFINE(VkFramebuffer);
PTK_LIST_DEFINE(VkSurfaceFormatKHR);

View file

@ -1,8 +1,8 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/sync_objects.h>
#include "ptk_vk/sync_objects.h"
#include <ptk_vk/utils.h>
#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);
}

View file

@ -3,10 +3,10 @@
#ifndef PTK_PTK_VK_SYNC_OBJECTS_H_
#define PTK_PTK_VK_SYNC_OBJECTS_H_
#include <vulkan/vulkan_core.h>
#include "ptk_list.h"
#include "ptk_option.h"
#include <ptk_list.h>
#include <ptk_option.h>
#include <vulkan/vulkan_core.h>
PTK_LIST_DEFINE(VkSemaphore);
PTK_LIST_DEFINE(VkFence);

View file

@ -1,10 +1,10 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/uniform_buffers.h>
#include "ptk_vk/uniform_buffers.h"
#include <ptk_vk/buffer.h>
#include "ptk_vk/buffer.h"
#include <ptk_log.h>
#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);
}

View file

@ -3,11 +3,11 @@
#ifndef PTK_PTK_VK_UNIFORM_BUFFERS_H_
#define PTK_PTK_VK_UNIFORM_BUFFERS_H_
#include <vulkan/vulkan_core.h>
#include "ptk_list.h"
#include "ptk_option.h"
#include "ptk_vec.h"
#include <ptk_list.h>
#include <ptk_option.h>
#include <ptk_vec.h>
#include <vulkan/vulkan_core.h>
PTK_LIST_DEFINE(VkBuffer);
PTK_LIST_DEFINE(VkDeviceMemory);

View file

@ -1,6 +1,6 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <ptk_vk/utils.h>
#include "ptk_vk/utils.h"
const char *vk_result_string(VkResult res) {
const char *str;

View file

@ -3,8 +3,9 @@
#ifndef PTK_PTK_VK_UTILS_H_
#define PTK_PTK_VK_UTILS_H_
#include "ptk_log.h"
#include <vulkan/vulkan_core.h>
#include <ptk_log.h>
const char *vk_result_string(VkResult res);

View file

@ -1,7 +1,8 @@
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
#include <test.h>
#include <ptk_list.h>
#include "test.h"
#include "ptk_list.h"
PTK_LIST_DEFINE(uint32_t);