first vulkan function loaded with new loader
This commit is contained in:
@@ -3,12 +3,13 @@ project(GryphnVulkanImpl)
|
||||
add_compile_definitions(GN_REVEAL_IMPL)
|
||||
|
||||
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS "src/*.c" "src/*.h")
|
||||
file(GLOB_RECURSE LOADER_FILES CONFIGURE_DEPENDS "loader/*.c" "loader/*.h")
|
||||
if (APPLE)
|
||||
file(GLOB_RECURSE METAL_FILES CONFIGURE_DEPENDS "src/*.m")
|
||||
endif()
|
||||
|
||||
find_package(Vulkan REQUIRED)
|
||||
add_library(GryphnVulkanImpl STATIC ${SOURCE_FILES} ${METAL_FILES})
|
||||
add_library(GryphnVulkanImpl STATIC ${SOURCE_FILES} ${METAL_FILES} ${LOADER_FILES})
|
||||
target_link_libraries(GryphnVulkanImpl ${Vulkan_LIBRARY})
|
||||
|
||||
target_include_directories(GryphnVulkanImpl PUBLIC
|
||||
|
8
projects/apis/vulkan/loader/vulkan_instance_loader.c
Normal file
8
projects/apis/vulkan/loader/vulkan_instance_loader.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "vulkan_loader.h"
|
||||
#include "instance/vulkan_instance.h"
|
||||
|
||||
gnInstanceFunctions loadVulkanFunctions(gnRenderingAPI api) {
|
||||
return (gnInstanceFunctions){
|
||||
._gnCreateInstance = createInstance
|
||||
};
|
||||
}
|
5
projects/apis/vulkan/loader/vulkan_loader.h
Normal file
5
projects/apis/vulkan/loader/vulkan_loader.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#include "loader/src/gryphn_instance_functions.h"
|
||||
#include "core/src/gryphn_rendering_api.h"
|
||||
|
||||
gnInstanceFunctions loadVulkanFunctions(gnRenderingAPI api);
|
@@ -41,9 +41,8 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback(
|
||||
return VK_TRUE;
|
||||
}
|
||||
|
||||
gnReturnCode gnCreateInstanceFn(gnInstanceHandle instance, gnInstanceInfo instanceInfo) {
|
||||
gnReturnCode createInstance(gnInstanceHandle instance, gnInstanceInfo instanceInfo) {
|
||||
instance->instance = malloc(sizeof(gnPlatformInstance));
|
||||
instance->instance->instanceMessageCount = 0;
|
||||
|
||||
#ifdef GN_PLATFORM_LINUX
|
||||
gnBool isX11 = gnTrue;
|
||||
|
@@ -1,18 +1,10 @@
|
||||
#pragma once
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "debugger/gryphn_debugger.h"
|
||||
#include "instance/gryphn_instance.h"
|
||||
|
||||
struct gnInstanceMessage {
|
||||
gnMessageSeverity severity;
|
||||
gnMessageType type;
|
||||
gnMessageData data;
|
||||
};
|
||||
|
||||
typedef struct gnPlatformInstance_t {
|
||||
VkInstance vk_instance;
|
||||
VkApplicationInfo appInfo;
|
||||
|
||||
uint16_t instanceMessageCount;
|
||||
struct gnInstanceMessage* instanceMessages;
|
||||
} gnPlatformInstance;
|
||||
|
||||
gnReturnCode createInstance(gnInstanceHandle instance, gnInstanceInfo instanceInfo);
|
||||
|
@@ -7,14 +7,7 @@
|
||||
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
|
||||
*instance = malloc(sizeof(struct gnInstance_t));
|
||||
(*instance)->instanceFunctions = loadInstanceFunctions(info.renderingAPI);
|
||||
|
||||
// instance->dynamicLib = gnLoadRenderingDLL(info.renderingAPI);
|
||||
// if (instance->dynamicLib == NULL) return GN_UNABLE_TO_LOAD_DYNAMIC_LIBARRY;
|
||||
// instance->functions = gnLoadFunctions(instance);
|
||||
|
||||
// if (info.debugger)
|
||||
// instance->debugger = info.debugger;
|
||||
|
||||
(*instance)->debugger = info.debugger;
|
||||
return (*instance)->instanceFunctions._gnCreateInstance((*instance), info);
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
#include "gryphn_loader.h"
|
||||
#include "stdio.h"
|
||||
#include <apis/vulkan/loader/vulkan_loader.h>
|
||||
|
||||
gnInstanceFunctions loadInstanceFunctions(gnRenderingAPI api) {
|
||||
printf("Loading instance functions");
|
||||
return (gnInstanceFunctions){ NULL };
|
||||
switch (api) {
|
||||
case GN_RENDERINGAPI_NONE: return (gnInstanceFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_VULKAN: return loadVulkanFunctions(api);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user