fix a lot of things
This commit is contained in:
@@ -34,8 +34,7 @@ add_subdirectory(projects/core) # build gryphn core
|
|||||||
add_subdirectory(projects/extensions)
|
add_subdirectory(projects/extensions)
|
||||||
add_subdirectory(projects/platform) # build gryphn platform
|
add_subdirectory(projects/platform) # build gryphn platform
|
||||||
add_subdirectory(projects/validation_layers/function_loader/)
|
add_subdirectory(projects/validation_layers/function_loader/)
|
||||||
add_subdirectory(depends/Dispatcher/)
|
target_link_libraries(Gryphn INTERFACE GryphnCore GryphnLoader GryphnPlatform GryphnFunctionValidator GryphnExtensions)
|
||||||
target_link_libraries(Gryphn INTERFACE dispatcher GryphnCore GryphnLoader GryphnPlatform GryphnFunctionValidator GryphnExtensions)
|
|
||||||
|
|
||||||
if (VULKAN_BUILT)
|
if (VULKAN_BUILT)
|
||||||
target_link_libraries(Gryphn INTERFACE GryphnVulkanImpl)
|
target_link_libraries(Gryphn INTERFACE GryphnVulkanImpl)
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
#include "buffers/gryphn_buffer.h"
|
#include "buffers/gryphn_buffer.h"
|
||||||
#include "output_device/gryphn_output_device.h"
|
#include "output_device/gryphn_output_device.h"
|
||||||
#include "output_device/vulkan_output_devices.h"
|
#include "output_device/vulkan_output_devices.h"
|
||||||
#include "output_device/vulkan_physical_device.h"
|
|
||||||
#include <vulkan_result_converter.h>
|
#include <vulkan_result_converter.h>
|
||||||
|
|
||||||
VkBufferUsageFlags vkGryphnBufferType(gnBufferType type) {
|
VkBufferUsageFlags vkGryphnBufferType(gnBufferType type) {
|
||||||
@@ -49,7 +48,7 @@ gnReturnCode VkCreateBuffer(
|
|||||||
VkMemoryAllocateInfo memoryAllocateInfo = {
|
VkMemoryAllocateInfo memoryAllocateInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||||
.allocationSize = bufferRequirements.size,
|
.allocationSize = bufferRequirements.size,
|
||||||
.memoryTypeIndex = VkMemoryIndex(device->physicalDevice->physicalDevice->device, bufferRequirements.memoryTypeBits, flags, &foundMemory)
|
.memoryTypeIndex = VkMemoryIndex(device->outputDevice->physicalDevice, bufferRequirements.memoryTypeBits, flags, &foundMemory)
|
||||||
};
|
};
|
||||||
if (!foundMemory) return GN_FAILED_TO_ALLOCATE_MEMORY;
|
if (!foundMemory) return GN_FAILED_TO_ALLOCATE_MEMORY;
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo) {
|
gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo) {
|
||||||
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
||||||
|
|
||||||
vkSwapchainSupportDetails details = vkGetSwapchainSupport(device->physicalDevice->physicalDevice->device, presentationInfo.surface->windowSurface->surface);
|
vkSwapchainSupportDetails details = vkGetSwapchainSupport(device->outputDevice->physicalDevice, presentationInfo.surface->windowSurface->surface);
|
||||||
VkFormat convertedFormat = vkGryphnFormatToVulkanFormat(presentationInfo.format.format);
|
VkFormat convertedFormat = vkGryphnFormatToVulkanFormat(presentationInfo.format.format);
|
||||||
VkColorSpaceKHR convertedColorSpace = vkGryphnColorSpaceToVulkanColorSpace(presentationInfo.format.colorSpace);
|
VkColorSpaceKHR convertedColorSpace = vkGryphnColorSpaceToVulkanColorSpace(presentationInfo.format.colorSpace);
|
||||||
|
|
||||||
|
@@ -182,7 +182,7 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
|||||||
VkMemoryAllocateInfo allocInfo = {
|
VkMemoryAllocateInfo allocInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||||
.allocationSize = memRequirements.size,
|
.allocationSize = memRequirements.size,
|
||||||
.memoryTypeIndex = VkMemoryIndex(device->physicalDevice->physicalDevice->device, memRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &foundMemory)
|
.memoryTypeIndex = VkMemoryIndex(device->outputDevice->physicalDevice, memRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &foundMemory)
|
||||||
};
|
};
|
||||||
if (!foundMemory) return GN_FAILED_TO_ALLOCATE_MEMORY;
|
if (!foundMemory) return GN_FAILED_TO_ALLOCATE_MEMORY;
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
|||||||
if (image_view != VK_SUCCESS) return VkResultToGnReturnCode(image_view);
|
if (image_view != VK_SUCCESS) return VkResultToGnReturnCode(image_view);
|
||||||
|
|
||||||
VkPhysicalDeviceProperties properties = {};
|
VkPhysicalDeviceProperties properties = {};
|
||||||
vkGetPhysicalDeviceProperties(device->physicalDevice->physicalDevice->device, &properties);
|
vkGetPhysicalDeviceProperties(device->outputDevice->physicalDevice, &properties);
|
||||||
|
|
||||||
VkSamplerCreateInfo samplerInfo = {
|
VkSamplerCreateInfo samplerInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||||
|
@@ -139,6 +139,7 @@ loaderLayer null_layer() {
|
|||||||
|
|
||||||
loaderLayer api_loaded_layer(gnRenderingAPI api) {
|
loaderLayer api_loaded_layer(gnRenderingAPI api) {
|
||||||
return (loaderLayer){
|
return (loaderLayer){
|
||||||
|
.instanceFunctions = loadAPIInstanceFunctions(api),
|
||||||
.deviceFunctions = loadAPIDeviceFunctions(api),
|
.deviceFunctions = loadAPIDeviceFunctions(api),
|
||||||
.commandFunctions = loadAPICommandFunctions(api),
|
.commandFunctions = loadAPICommandFunctions(api),
|
||||||
};
|
};
|
||||||
@@ -146,6 +147,7 @@ loaderLayer api_loaded_layer(gnRenderingAPI api) {
|
|||||||
|
|
||||||
loaderLayer function_check_layer() {
|
loaderLayer function_check_layer() {
|
||||||
return (loaderLayer){
|
return (loaderLayer){
|
||||||
|
.instanceFunctions = loadFunctionLoaderInstanceFunctions(),
|
||||||
.deviceFunctions = loadFunctionLoaderDeviceFunctions(),
|
.deviceFunctions = loadFunctionLoaderDeviceFunctions(),
|
||||||
.commandFunctions = loadFunctionLoaderCommandFunctions(),
|
.commandFunctions = loadFunctionLoaderCommandFunctions(),
|
||||||
|
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
#include "gryphn_command_functions.h"
|
#include "gryphn_command_functions.h"
|
||||||
#include "gryphn_loader_info.h"
|
#include "gryphn_loader_info.h"
|
||||||
#include "utils/lists/gryphn_array_list.h"
|
#include "utils/lists/gryphn_array_list.h"
|
||||||
#include <Dispatcher/dispatcher.h>
|
|
||||||
|
|
||||||
#include "extensions/synchronization/loader/sync_functions.h"
|
#include "extensions/synchronization/loader/sync_functions.h"
|
||||||
#include "extensions/queues/queues_functions.h"
|
#include "extensions/queues/queues_functions.h"
|
||||||
@@ -25,8 +24,7 @@ typedef struct loaderLayer {
|
|||||||
// they used to be loaded seperatly but I guess there not anymore
|
// they used to be loaded seperatly but I guess there not anymore
|
||||||
// initlization is hard
|
// initlization is hard
|
||||||
|
|
||||||
// gnInstanceFunctions instanceFunctions;
|
gnInstanceFunctions instanceFunctions;
|
||||||
|
|
||||||
gnDeviceFunctions deviceFunctions;
|
gnDeviceFunctions deviceFunctions;
|
||||||
gnCommandFunctions commandFunctions;
|
gnCommandFunctions commandFunctions;
|
||||||
|
|
||||||
|
@@ -5,11 +5,15 @@
|
|||||||
#include "extensions/sync_functions.h"
|
#include "extensions/sync_functions.h"
|
||||||
#include "extensions/queue_functions.h"
|
#include "extensions/queue_functions.h"
|
||||||
|
|
||||||
|
gryphnInstanceFunctionLayers checkerLoadInstanceFunctions() {
|
||||||
|
return (gryphnInstanceFunctionLayers) {
|
||||||
|
.createInstance = { checkCreateInstance, NULL },
|
||||||
|
.destroyInstance = { checkDestroyInstance, NULL }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
gnInstanceFunctions loadFunctionLoaderInstanceFunctions() {
|
gnInstanceFunctions loadFunctionLoaderInstanceFunctions() {
|
||||||
return (gnInstanceFunctions){
|
return (gnInstanceFunctions){
|
||||||
._gnCreateInstance = checkCreateInstance,
|
|
||||||
._gnDestroyInstance = checkDestroyInstance,
|
|
||||||
|
|
||||||
._gnGetPhysicalDevices = checkGetPhysicalDevices,
|
._gnGetPhysicalDevices = checkGetPhysicalDevices,
|
||||||
._gnPhysicalDeviceCanPresentToSurface = checkCanDevicePresent,
|
._gnPhysicalDeviceCanPresentToSurface = checkCanDevicePresent,
|
||||||
|
|
||||||
|
@@ -4,12 +4,23 @@
|
|||||||
#include "core/src/output_device/gryphn_output_device.h"
|
#include "core/src/output_device/gryphn_output_device.h"
|
||||||
#include "core/src/window_surface/gryphn_surface.h"
|
#include "core/src/window_surface/gryphn_surface.h"
|
||||||
|
|
||||||
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info) {
|
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnFunctionLayer* next) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateInstance, instanceFunctions, instance, info);
|
if (next->function == NULL) {
|
||||||
|
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
|
||||||
|
.message = gnCreateString("Failed to load gnCreateInstance this indicates a bug within gryphn")
|
||||||
|
});
|
||||||
|
return GN_FAILED_TO_LOAD_FUNCTION;
|
||||||
|
}
|
||||||
|
return (*(PFN_gnCreateInstance*)next->function)(instance, info, next->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkDestroyInstance(gnInstance instance) {
|
void checkDestroyInstance(gnInstanceHandle instance, gryphnFunctionLayer* next) {
|
||||||
CHECK_VOID_FUNCTION(instance, _gnDestroyInstance, instanceFunctions, instance);
|
if (next->function == NULL) {
|
||||||
|
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
|
||||||
|
.message = gnCreateString("Failed to load gnDestroyInstance this indicates a bug within gryphn")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
(*(PFN_gnDestroyInstance*)next->function)(instance, next->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {
|
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {
|
||||||
@@ -19,11 +30,11 @@ gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle wind
|
|||||||
CHECK_RETURNED_FUNCTION(device->instance, _gnPhysicalDeviceCanPresentToSurface, instanceFunctions, GN_FALSE, device, windowSurface);
|
CHECK_RETURNED_FUNCTION(device->instance, _gnPhysicalDeviceCanPresentToSurface, instanceFunctions, GN_FALSE, device, windowSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateOutputDevice(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) {
|
gnReturnCode checkCreateOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateOutputDevice, instanceFunctions, device, instance, deviceInfo);
|
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateOutputDevice, instanceFunctions, instance, device, deviceInfo);
|
||||||
}
|
}
|
||||||
void checkDestroyOutputDevice(gnOutputDeviceHandle device) {
|
void checkDestroyOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device) {
|
||||||
CHECK_VOID_FUNCTION(device->instance, _gnDestroyOutputDevice, instanceFunctions, device);
|
CHECK_VOID_FUNCTION(device->instance, _gnDestroyOutputDevice, instanceFunctions, instance, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GN_PLATFORM_MACOS
|
#ifdef GN_PLATFORM_MACOS
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
#include "core/src/instance/gryphn_instance.h"
|
#include "core/src/instance/gryphn_instance.h"
|
||||||
#include <core/src/window_surface/gryphn_surface_create_functions.h>
|
#include <core/src/window_surface/gryphn_surface_create_functions.h>
|
||||||
|
|
||||||
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info);
|
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnFunctionLayer* next);
|
||||||
void checkDestroyInstance(gnInstance instance);
|
void checkDestroyInstance(gnInstanceHandle instance, gryphnFunctionLayer* next);
|
||||||
|
|
||||||
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count);
|
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count);
|
||||||
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
|
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
|
||||||
|
|
||||||
gnReturnCode checkCreateOutputDevice(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo);
|
gnReturnCode checkCreateOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo);
|
||||||
void checkDestroyOutputDevice(gnOutputDeviceHandle device);
|
void checkDestroyOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device);
|
||||||
|
|
||||||
#ifdef GN_PLATFORM_MACOS
|
#ifdef GN_PLATFORM_MACOS
|
||||||
gnReturnCode checkCreateSurfaceMacOS(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnMacOSWindowSurfaceInfo createInfo);
|
gnReturnCode checkCreateSurfaceMacOS(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnMacOSWindowSurfaceInfo createInfo);
|
||||||
|
Reference in New Issue
Block a user