diff --git a/rendering_api/vulkan/src/debugger/vulkan_debugger.c b/rendering_api/vulkan/src/debugger/vulkan_debugger.c index a1b277e..f39cf66 100644 --- a/rendering_api/vulkan/src/debugger/vulkan_debugger.c +++ b/rendering_api/vulkan/src/debugger/vulkan_debugger.c @@ -1,6 +1,7 @@ #include "vulkan_debugger.h" #include #include "core/instance/gryphn_instance.h" +#include "stdio.h" void populateDebugMessengerCreateInfo(VkDebugUtilsMessengerCreateInfoEXT* createInfo) { createInfo->sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; @@ -45,33 +46,35 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback( const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData) { - struct vk_userData_t userData = *(struct vk_userData_t*)pUserData; + printf("Debuggger: %s\n", pCallbackData->pMessage); - gnMessageSeverity severity; - gnMessageType type; - gnMessageData data = { - .message = gnCreateString(pCallbackData->pMessage) - }; + // struct vk_userData_t userData = *(struct vk_userData_t*)pUserData; - switch (messageSeverity) { - default: break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: severity = GN_MESSAGE_VERBOSE; break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: severity = GN_MESSAGE_INFO; break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: severity = GN_MESSAGE_WARNING; break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: severity = GN_MESSAGE_ERROR; break; - } + // gnMessageSeverity severity; + // gnMessageType type; + // gnMessageData data = { + // .message = gnCreateString(pCallbackData->pMessage) + // }; - switch (messageType) { - default: break; - case VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT: type = GN_DEBUG_MESSAGE_GENERAL; break; - case VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT: type = GN_DEBUG_MESSAGE_VALIDATION; break; - case VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT: type = GN_DEBUG_MESSAGE_PERFORMANCE; break; - } + // switch (messageSeverity) { + // default: break; + // case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: severity = GN_MESSAGE_VERBOSE; break; + // case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: severity = GN_MESSAGE_INFO; break; + // case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: severity = GN_MESSAGE_WARNING; break; + // case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: severity = GN_MESSAGE_ERROR; break; + // } - gnDebuggerCallback callback = *userData.debuggerCallback; - gnBool result = callback(severity, type, data, userData.userData); - if (result == gnFalse) return VK_FALSE; - else if (result == gnTrue) return VK_TRUE; + // switch (messageType) { + // default: break; + // case VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT: type = GN_DEBUG_MESSAGE_GENERAL; break; + // case VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT: type = GN_DEBUG_MESSAGE_VALIDATION; break; + // case VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT: type = GN_DEBUG_MESSAGE_PERFORMANCE; break; + // } + + // gnDebuggerCallback callback = *userData.debuggerCallback; + // gnBool result = callback(severity, type, data, userData.userData); + // if (result == gnFalse) return VK_FALSE; + // else if (result == gnTrue) return VK_TRUE; return VK_FALSE; } @@ -115,8 +118,8 @@ gnReturnCode gnCreateDebuggerFn(gnDebuggerHandle debugger, gnInstanceHandle inst } } + if (instance->instance->instanceMessageCount > 0) free(instance->instance->instanceMessages); instance->instance->instanceMessageCount = 0; - free(instance->instance->instanceMessages); const char* layers[] = { "VK_LAYER_KHRONOS_validation" diff --git a/rendering_api/vulkan/src/instance/vulkan_instance.c b/rendering_api/vulkan/src/instance/vulkan_instance.c index df88749..8b17d52 100644 --- a/rendering_api/vulkan/src/instance/vulkan_instance.c +++ b/rendering_api/vulkan/src/instance/vulkan_instance.c @@ -7,55 +7,57 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback( VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData) { + printf("Created instance: %s\n", pCallbackData->pMessage); - gnMessageSeverity severity; - gnMessageType type; - gnMessageData data = { - .message = gnCreateString(pCallbackData->pMessage) - }; - switch (messageSeverity) { - default: break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: severity = GN_MESSAGE_VERBOSE; break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: severity = GN_MESSAGE_INFO; break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: severity = GN_MESSAGE_WARNING; break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: severity = GN_MESSAGE_ERROR; break; - } + // gnMessageSeverity severity; + // gnMessageType type; + // gnMessageData data = { + // .message = gnCreateString(pCallbackData->pMessage) + // }; - switch (messageType) { - default: break; - case VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT: type = GN_DEBUG_MESSAGE_GENERAL; break; - case VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT: type = GN_DEBUG_MESSAGE_VALIDATION; break; - case VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT: type = GN_DEBUG_MESSAGE_PERFORMANCE; break; - } + // switch (messageSeverity) { + // default: break; + // case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: severity = GN_MESSAGE_VERBOSE; break; + // case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: severity = GN_MESSAGE_INFO; break; + // case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: severity = GN_MESSAGE_WARNING; break; + // case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: severity = GN_MESSAGE_ERROR; break; + // } - gnInstanceHandle instance = (gnInstanceHandle)pUserData; + // switch (messageType) { + // default: break; + // case VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT: type = GN_DEBUG_MESSAGE_GENERAL; break; + // case VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT: type = GN_DEBUG_MESSAGE_VALIDATION; break; + // case VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT: type = GN_DEBUG_MESSAGE_PERFORMANCE; break; + // } - if (instance->debugger) { - instance->debugger->info.callback( - severity, type, data, instance->debugger->info.userData - ); - } else { - instance->instance->instanceMessageCount++; - if (instance->instance->instanceMessageCount == 1) { - instance->instance->instanceMessages = malloc(sizeof(struct gnInstanceMessage) * instance->instance->instanceMessageCount); - } - else { - instance->instance->instanceMessages = realloc(instance->instance->instanceMessages, sizeof(struct gnInstanceMessage) * instance->instance->instanceMessageCount); - } - instance->instance->instanceMessages[instance->instance->instanceMessageCount - 1] = (struct gnInstanceMessage){ - .data = data, - .severity = severity, - .type = type - }; - } + // gnInstanceHandle instance = (gnInstanceHandle)pUserData; + + // if (instance->debugger) { + // instance->debugger->info.callback( + // severity, type, data, instance->debugger->info.userData + // ); + // } else { + // instance->instance->instanceMessageCount++; + // if (instance->instance->instanceMessageCount == 1) { + // instance->instance->instanceMessages = malloc(sizeof(struct gnInstanceMessage) * instance->instance->instanceMessageCount); + // } + // else { + // instance->instance->instanceMessages = realloc(instance->instance->instanceMessages, sizeof(struct gnInstanceMessage) * instance->instance->instanceMessageCount); + // } + // instance->instance->instanceMessages[instance->instance->instanceMessageCount - 1] = (struct gnInstanceMessage){ + // .data = data, + // .severity = severity, + // .type = type + // }; + // } return VK_FALSE; } gnReturnCode gnCreateInstanceFn(gnInstanceHandle instance, gnInstanceInfo instanceInfo) { instance->instance = malloc(sizeof(gnPlatformInstance)); - + instance->instance->instanceMessageCount = 0; #ifdef GN_PLATFORM_LINUX gnBool isX11 = gnTrue; @@ -89,6 +91,7 @@ gnReturnCode gnCreateInstanceFn(gnInstanceHandle instance, gnInstanceInfo instan }; #endif + VkApplicationInfo appInfo = { .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pApplicationName = gnToCString(instanceInfo.applicationName), diff --git a/rendering_api/vulkan/src/output_device/vulkan_device_extensions.h b/rendering_api/vulkan/src/output_device/vulkan_device_extensions.h index 3fa44c6..ba735cf 100644 --- a/rendering_api/vulkan/src/output_device/vulkan_device_extensions.h +++ b/rendering_api/vulkan/src/output_device/vulkan_device_extensions.h @@ -1,8 +1,15 @@ #pragma once #include +#ifdef GN_PLATFORM_MACOS static const uint32_t deviceExtensionCount = 2; static const char* deviceExtensions[2] = { VK_KHR_SWAPCHAIN_EXTENSION_NAME, "VK_KHR_portability_subset" }; +#else +static const uint32_t deviceExtensionCount = 1; +static const char* deviceExtensions[1] = { + VK_KHR_SWAPCHAIN_EXTENSION_NAME +}; +#endif diff --git a/rendering_api/vulkan/src/output_device/vulkan_output_device.c b/rendering_api/vulkan/src/output_device/vulkan_output_device.c index f4c5289..ada25ef 100644 --- a/rendering_api/vulkan/src/output_device/vulkan_output_device.c +++ b/rendering_api/vulkan/src/output_device/vulkan_output_device.c @@ -13,6 +13,7 @@ gnReturnCode gnCreateOutputDeviceFn(gnOutputDeviceHandle outputDevice, gnInstanc float queuePriority = 1.0f; for (int i = 0; i < deviceInfo.queueInfoCount; i++) { queueCreateInfos[i].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; + queueCreateInfos[i].flags = 0; queueCreateInfos[i].queueFamilyIndex = deviceInfo.queueInfos[i].queueIndex; queueCreateInfos[i].queueCount = deviceInfo.queueInfos[i].queueCount; queueCreateInfos[i].pQueuePriorities = &queuePriority; diff --git a/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c b/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c index 02171aa..87e5d00 100644 --- a/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c +++ b/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c @@ -73,9 +73,10 @@ gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueueHandle presentationQ createInfo.clipped = VK_TRUE; createInfo.oldSwapchain = VK_NULL_HANDLE; - if (vkCreateSwapchainKHR(device->outputDevice->device, &createInfo, NULL, &presentationQueue->presentationQueue->swapChain) != VK_SUCCESS) { + VkResult result = vkCreateSwapchainKHR(device->outputDevice->device, &createInfo, NULL, &presentationQueue->presentationQueue->swapChain); + if (result == VK_ERROR_NATIVE_WINDOW_IN_USE_KHR) return GN_WINDOW_IN_USE; + if (result != VK_SUCCESS) return GN_FAILED_TO_CREATE_PRESENTATION_QUEUE; - } vkGetSwapchainImagesKHR(device->outputDevice->device, presentationQueue->presentationQueue->swapChain, &presentationQueue->imageCount, NULL); presentationQueue->presentationQueue->swapChainImages = malloc(sizeof(VkImage) * presentationQueue->imageCount); diff --git a/rendering_api/vulkan/src/renderpass/vulkan_render_pass_descriptor.c b/rendering_api/vulkan/src/renderpass/vulkan_render_pass_descriptor.c index df41202..9128347 100644 --- a/rendering_api/vulkan/src/renderpass/vulkan_render_pass_descriptor.c +++ b/rendering_api/vulkan/src/renderpass/vulkan_render_pass_descriptor.c @@ -1,6 +1,7 @@ #include "vulkan_render_pass_descriptor.h" #include "vulkan_surface/vulkan_surface.h" #include "output_device/vulkan_output_devices.h" +#include "stdio.h" VkAttachmentLoadOp vkGryphnLoadOperation(gnLoadOperation loadOperation) { switch(loadOperation) { @@ -32,6 +33,7 @@ gnReturnCode gnCreateRenderPassDescriptorFn(struct gnRenderPassDescriptor_t* ren VkAttachmentDescription* attachments = malloc(sizeof(VkAttachmentDescription) * info.attachmentCount); for (int i = 0; i < info.attachmentCount; i++) { attachments[i].format = vkGryphnFormatToVulkanFormat(info.attachmentInfos[i].format); + attachments[i].flags = 0; attachments[i].samples = VK_SAMPLE_COUNT_1_BIT; attachments[i].loadOp = vkGryphnLoadOperation(info.attachmentInfos[i].loadOperation); @@ -45,16 +47,30 @@ gnReturnCode gnCreateRenderPassDescriptorFn(struct gnRenderPassDescriptor_t* ren } VkSubpassDescription* subpasses = malloc(sizeof(VkSubpassDescription) * info.subpassCount); + VkAttachmentReference** colorAttachments = malloc(sizeof(VkAttachmentReference*) * info.subpassCount); + + VkAttachmentReference ref = { + .attachment = 0, + .layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL + }; for (int i = 0; i < info.subpassCount; i++) { - subpasses[i].pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; - subpasses[i].colorAttachmentCount = info.subpassInfos[i].colorAttachmentCount; - VkAttachmentReference* colorAttachments = malloc(sizeof(VkAttachmentReference) * info.subpassInfos[i].colorAttachmentCount); + colorAttachments[i] = malloc(sizeof(VkAttachmentReference) * info.subpassInfos[i].colorAttachmentCount); + for (int c = 0; c < info.subpassInfos[i].colorAttachmentCount; c++) { - colorAttachments[c].attachment = info.subpassInfos[i].colorAttachments[c].index; - colorAttachments[c].layout = vkGryphnImageLayout(info.subpassInfos[i].colorAttachments[c].imageLayout); + colorAttachments[i][c] = (VkAttachmentReference){ + .attachment = info.subpassInfos[i].colorAttachments[c].index, + .layout = vkGryphnImageLayout(info.subpassInfos[i].colorAttachments[c].imageLayout) + }; } - subpasses[i].pColorAttachments = colorAttachments; + + + subpasses[i] = (VkSubpassDescription){ + .flags = 0, + .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, + .colorAttachmentCount = info.subpassInfos[i].colorAttachmentCount, + .pColorAttachments = colorAttachments[i] + }; } VkSubpassDependency* dependencies = malloc(sizeof(VkSubpassDependency) * info.dependencyCount); @@ -69,22 +85,24 @@ gnReturnCode gnCreateRenderPassDescriptorFn(struct gnRenderPassDescriptor_t* ren }; } - VkRenderPassCreateInfo renderPassInfo = (VkRenderPassCreateInfo){ + VkRenderPassCreateInfo renderPassInfo = (VkRenderPassCreateInfo) { .sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, + .pNext = NULL, + .flags = 0, .attachmentCount = info.attachmentCount, .pAttachments = attachments, .subpassCount = info.subpassCount, .pSubpasses = subpasses, .dependencyCount = info.dependencyCount, - .pDependencies = dependencies + .pDependencies = dependencies, }; - if (vkCreateRenderPass(device->outputDevice->device, &renderPassInfo, NULL, &renderPass->renderPassDescriptor->renderPass) != VK_SUCCESS) { + if (vkCreateRenderPass(device->outputDevice->device, &renderPassInfo, NULL, &renderPass->renderPassDescriptor->renderPass) != VK_SUCCESS) return GN_FAILED_TO_CREATE_RENDER_PASS; - } free(attachments); free(subpasses); + free(dependencies); return GN_SUCCESS; } diff --git a/rendering_api/vulkan/src/shader_module/vulkan_shader_module.c b/rendering_api/vulkan/src/shader_module/vulkan_shader_module.c index 42cf1d6..5e8787b 100644 --- a/rendering_api/vulkan/src/shader_module/vulkan_shader_module.c +++ b/rendering_api/vulkan/src/shader_module/vulkan_shader_module.c @@ -1,5 +1,6 @@ #include "vulkan_shader_module.h" #include "output_device/vulkan_output_devices.h" +#include "stdio.h" VkShaderStageFlagBits vkGryphnShaderModuleStage(gnShaderModuleStage stage) { VkShaderStageFlagBits outStage = 0; @@ -11,17 +12,17 @@ VkShaderStageFlagBits vkGryphnShaderModuleStage(gnShaderModuleStage stage) { return outStage; } -gnReturnCode gnCreateShaderModuleFn(struct gnShaderModule_t *module, struct gnOutputDevice_t *device, struct gnShaderModuleInfo_t shaderModuleInfo) { +gnReturnCode gnCreateShaderModuleFn(gnShaderModule module, gnDevice device, gnShaderModuleInfo shaderModuleInfo) { module->shaderModule = malloc(sizeof(struct gnPlatformShaderModule_t)); - VkShaderModuleCreateInfo createInfo = {}; - createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; - createInfo.codeSize = shaderModuleInfo.size; - createInfo.pCode = shaderModuleInfo.code; + VkShaderModuleCreateInfo createInfo = { + .sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, + .codeSize = shaderModuleInfo.size, + .pCode = shaderModuleInfo.code + }; - if (vkCreateShaderModule(device->outputDevice->device, &createInfo, NULL, &module->shaderModule->shaderModule) != VK_SUCCESS) { + if (vkCreateShaderModule(device->outputDevice->device, &createInfo, NULL, &module->shaderModule->shaderModule) != VK_SUCCESS) return GN_FAILED_TO_CREATE_SHADER_MODULE; - } module->shaderModule->shaderStageInfo = (VkPipelineShaderStageCreateInfo){ .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, diff --git a/src/core/command/command_buffer/gryphn_command_buffer.c b/src/core/command/command_buffer/gryphn_command_buffer.c index 31ed452..0206440 100644 --- a/src/core/command/command_buffer/gryphn_command_buffer.c +++ b/src/core/command/command_buffer/gryphn_command_buffer.c @@ -7,6 +7,7 @@ gnReturnCode gnCommandPoolAllocateCommandBuffers(gnCommandBufferHandle* buffers, buffers[i] = malloc(sizeof(struct gnCommandBuffer_t)); buffers[i]->commandPool = commandPool; } + printf("Created the graphics pipeline: %p\n", commandPool->commandFunctions->_gnCommandBindGraphicsPipeline); return commandPool->commandFunctions->_gnCommandPoolAllocateCommandBuffers(buffers, count, commandPool); } diff --git a/src/core/gryphn_platform_functions.h b/src/core/gryphn_platform_functions.h index fecf2c4..9f05a40 100644 --- a/src/core/gryphn_platform_functions.h +++ b/src/core/gryphn_platform_functions.h @@ -6,7 +6,7 @@ #include "output_device/gryphn_physical_output_device.h" #include "output_device/gryphn_output_device.h" #include "window_surface/gryphn_surface.h" -#include "window_surface/gryphn_surface_create_functions.h" +#include #include "shader_module/gryphn_shader_module.h" #include "renderpass/gryphn_render_pass_descriptor.h" #include "pipelines/graphics_pipeline/gryphn_graphics_pipeline.h" @@ -34,10 +34,9 @@ typedef struct gnFunctions_t { void (*_gnDestroyOutputDevice)(gnOutputDeviceHandle device); - #ifdef GN_PLATFORM_LINUX #ifdef GN_WINDOW_X11 - gnReturnCode (*_gnCreateX11WindowSurface)(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, struct gnX11WindowSurfaceInfo_t createInfo); + gnReturnCode (*_gnCreateX11WindowSurface)(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnX11WindowSurfaceInfo createInfo); #endif #ifdef GN_WINDOW_WAYLAND gnReturnCode (*_gnCreateWaylandWindowSurface)(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, struct gnWaylandWindowSurfaceInfo_t createInfo); diff --git a/src/core/instance/gryphn_instance.c b/src/core/instance/gryphn_instance.c index f1f848f..4402e3f 100644 --- a/src/core/instance/gryphn_instance.c +++ b/src/core/instance/gryphn_instance.c @@ -3,8 +3,10 @@ #include #include "core/debugger/gryphn_debugger.h" #include "core/instance/gryphn_instance.h" +#include "stdio.h" gnReturnCode gnCreateInstance(gnInstanceHandle* instanceHandlePtr, struct gnInstanceInfo_t info) { + *instanceHandlePtr = malloc(sizeof(struct gnInstance_t)); gnInstanceHandle instance = *instanceHandlePtr; @@ -14,10 +16,14 @@ gnReturnCode gnCreateInstance(gnInstanceHandle* instanceHandlePtr, struct gnInst instance->dynamicLib = gnLoadRenderingDLL(info.renderingAPI); if (instance->dynamicLib == NULL) return GN_UNABLE_TO_LOAD_DYNAMIC_LIBARRY; instance->functions = malloc(sizeof(struct gnFunctions_t)); + instance->loadCommandFunctions = gnFalse; + instance->loadDeviceFunctions = gnFalse; gnLoadFunctions(instance->dynamicLib, instance->functions); return instance->functions->_gnCreateInstance(instance, info); } void gnInstanceAttachDebugger(gnInstanceHandle instance, struct gnDebugger_t *debugger) { + + if (instance->debugger != NULL) { gnDebuggerSetErrorMessage(debugger, (gnMessageData){ .message = gnCreateString("Debugger already attached to instance") diff --git a/src/core/renderpass/gryphn_render_pass_descriptor.c b/src/core/renderpass/gryphn_render_pass_descriptor.c index 89655f7..4b3409b 100644 --- a/src/core/renderpass/gryphn_render_pass_descriptor.c +++ b/src/core/renderpass/gryphn_render_pass_descriptor.c @@ -3,7 +3,6 @@ gnReturnCode gnCreateRenderPassDescriptor(gnRenderPassDescriptorHandle* renderPass, gnOutputDeviceHandle device, struct gnRenderPassDescriptorInfo_t info) { *renderPass = malloc(sizeof(struct gnRenderPassDescriptor_t)); - (*renderPass)->device = device; (*renderPass)->info = info; return device->deviceFunctions->_gnCreateRenderPassDescriptor(*renderPass, device, info); diff --git a/src/core/renderpass/gryphn_render_pass_descriptor.h b/src/core/renderpass/gryphn_render_pass_descriptor.h index f59c698..5f09c6d 100644 --- a/src/core/renderpass/gryphn_render_pass_descriptor.h +++ b/src/core/renderpass/gryphn_render_pass_descriptor.h @@ -1,7 +1,7 @@ #pragma once -#include "utils/gryphn_image_format.h" #include "stdint.h" -#include "core/output_device/gryphn_output_device.h" +#include "utils/gryphn_image_format.h" +#include "utils/gryphn_error_code.h" #include "core/gryphn_handles.h" typedef enum gnRenderPassStage_e { diff --git a/src/core/window_surface/gryphn_surface_create_functions.c b/src/core/window_surface/gryphn_surface_create_functions.c index 433e92b..ee67caf 100644 --- a/src/core/window_surface/gryphn_surface_create_functions.c +++ b/src/core/window_surface/gryphn_surface_create_functions.c @@ -1,12 +1,10 @@ -#define GN_WINDOW_X11 #include "gryphn_surface_create_functions.h" #include "core/instance/gryphn_instance.h" #include "core/gryphn_platform_functions.h" -#include "stdio.h" #ifdef GN_PLATFORM_LINUX #ifdef GN_WINDOW_X11 - gnReturnCode gnCreateX11WindowSurface(gnWindowSurfaceHandle* windowSurface, gnInstanceHandle instance, struct gnX11WindowSurfaceInfo_t createInfo) { + gnReturnCode gnCreateX11WindowSurface(gnWindowSurfaceHandle* windowSurface, gnInstanceHandle instance, gnX11WindowSurfaceInfo createInfo) { *windowSurface = malloc(sizeof(struct gnWindowSurface_t)); (*windowSurface)->instance = instance; return instance->functions->_gnCreateX11WindowSurface(*windowSurface, instance, createInfo); diff --git a/src/core/window_surface/gryphn_surface_create_functions.h b/src/core/window_surface/gryphn_surface_create_functions.h index b434653..fdbae65 100644 --- a/src/core/window_surface/gryphn_surface_create_functions.h +++ b/src/core/window_surface/gryphn_surface_create_functions.h @@ -1,11 +1,15 @@ #pragma once +#ifndef GN_WINDOW_X11 +#define GN_WINDOW_X11 +#endif #include -#include "core/gryphn_handles.h" -#include "utils/gryphn_error_code.h" +#include +#include + #ifdef GN_PLATFORM_LINUX #ifdef GN_WINDOW_X11 - typedef struct gnX11WindowSurfaceInfo_t { + typedef struct gnX11WindowSurfaceInfo { Display* display; Window window; } gnX11WindowSurfaceInfo; diff --git a/src/platform/gryphn_platform_include.h b/src/platform/gryphn_platform_include.h index 1b85afc..8caaab3 100644 --- a/src/platform/gryphn_platform_include.h +++ b/src/platform/gryphn_platform_include.h @@ -2,7 +2,7 @@ #include "core/gryphn_rendering_api.h" #ifdef GN_PLATFORM_LINUX -#include "platform_linux/gryphn_platform_linux.h" +#include #endif #ifdef GN_PLATFORM_MACOS diff --git a/src/platform/platform_linux/gryphn_platform_linux.h b/src/platform/platform_linux/gryphn_platform_linux.h index 4a2123a..496bfd3 100644 --- a/src/platform/platform_linux/gryphn_platform_linux.h +++ b/src/platform/platform_linux/gryphn_platform_linux.h @@ -1,7 +1,8 @@ -#ifdef GN_WINDOW_X11 +#pragma once #include -#endif +// #ifdef GN_WINDOW_X11 +// #endif -#ifdef GN_WINDOW_WAYLAND -#include -#endif +// #ifdef GN_WINDOW_WAYLAND +// #include +// #endif