redo some instance funcions stuff
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,6 +4,3 @@
|
|||||||
[submodule "projects/apis/metal/depends/SPIRV-Cross"]
|
[submodule "projects/apis/metal/depends/SPIRV-Cross"]
|
||||||
path = projects/apis/metal/depends/SPIRV-Cross
|
path = projects/apis/metal/depends/SPIRV-Cross
|
||||||
url = https://github.com/KhronosGroup/SPIRV-Cross.git
|
url = https://github.com/KhronosGroup/SPIRV-Cross.git
|
||||||
[submodule "depends/Dispatcher"]
|
|
||||||
path = depends/Dispatcher
|
|
||||||
url = https://github.com/GregoryWells2007/Dispatcher.git
|
|
||||||
|
@@ -19,7 +19,6 @@ target_include_directories(GryphnMetalImpl PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../platform/
|
${CMAKE_CURRENT_SOURCE_DIR}/../../platform/
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../depends/
|
${CMAKE_CURRENT_SOURCE_DIR}/../../../depends/
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/
|
${CMAKE_CURRENT_SOURCE_DIR}/src/
|
||||||
depends/SPIRV-Cross/
|
|
||||||
)
|
)
|
||||||
add_compile_definitions(GN_REVEAL_IMPL)
|
add_compile_definitions(GN_REVEAL_IMPL)
|
||||||
add_subdirectory(depends/SPIRV-Cross)
|
add_subdirectory(depends/SPIRV-Cross)
|
||||||
|
@@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
gnInstanceFunctions loadVulkanInstanceFunctions() {
|
gnInstanceFunctions loadVulkanInstanceFunctions() {
|
||||||
return (gnInstanceFunctions){
|
return (gnInstanceFunctions){
|
||||||
._gnCreateInstance = createInstance,
|
.createInstance = (PFN_gnCreateInstance)createVulkanInstance,
|
||||||
._gnDestroyInstance = destroyInstance,
|
.destroyInstance = (PFN_gnDestroyInstance)destroyVulkanInstance,
|
||||||
|
|
||||||
._gnGetPhysicalDevices = getPhysicalDevices,
|
._gnGetPhysicalDevices = getPhysicalDevices,
|
||||||
._gnPhysicalDeviceCanPresentToSurface = deviceCanPresentToSurface,
|
._gnPhysicalDeviceCanPresentToSurface = deviceCanPresentToSurface,
|
||||||
|
|
||||||
._gnCreateOutputDevice = createOutputDevice,
|
._gnCreateOutputDevice = createVulkanOutputDevice,
|
||||||
._gnDestroyOutputDevice = destroyOutputDevice,
|
._gnDestroyOutputDevice = destroyVulkanOutputDevice,
|
||||||
|
|
||||||
|
|
||||||
#ifdef GN_PLATFORM_LINUX
|
#ifdef GN_PLATFORM_LINUX
|
||||||
|
@@ -35,7 +35,7 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback(
|
|||||||
return VK_TRUE;
|
return VK_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode createInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo) {
|
gnReturnCode createVulkanInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, PFN_gnCreateInstance* next) {
|
||||||
instance->instance = malloc(sizeof(gnPlatformInstance));
|
instance->instance = malloc(sizeof(gnPlatformInstance));
|
||||||
|
|
||||||
vkStringArrayList extensions = vkStringArrayListCreate();
|
vkStringArrayList extensions = vkStringArrayListCreate();
|
||||||
@@ -101,6 +101,6 @@ gnReturnCode createInstance(gnInstanceHandle instance, gnInstanceCreateInfo* ins
|
|||||||
return VkResultToGnReturnCode(vkCreateInstance(&createInfo, NULL, &instance->instance->vk_instance));
|
return VkResultToGnReturnCode(vkCreateInstance(&createInfo, NULL, &instance->instance->vk_instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyInstance(gnInstanceHandle instance) {
|
void destroyVulkanInstance(gnInstanceHandle instance, PFN_gnDestroyInstance* next) {
|
||||||
vkDestroyInstance(instance->instance->vk_instance, NULL);
|
vkDestroyInstance(instance->instance->vk_instance, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "instance/gryphn_instance.h"
|
#include "instance/gryphn_instance.h"
|
||||||
#include "utils/lists/gryphn_array_list.h"
|
#include "utils/lists/gryphn_array_list.h"
|
||||||
|
#include "loader/src/gryphn_instance_functions.h"
|
||||||
|
|
||||||
typedef struct vkUserData {
|
typedef struct vkUserData {
|
||||||
gnDebuggerCallback debuggerCallback;
|
gnDebuggerCallback debuggerCallback;
|
||||||
@@ -13,9 +14,8 @@ typedef struct gnPlatformInstance_t {
|
|||||||
vkUserData userData;
|
vkUserData userData;
|
||||||
} gnPlatformInstance;
|
} gnPlatformInstance;
|
||||||
|
|
||||||
gnReturnCode createInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo);
|
gnReturnCode createVulkanInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, PFN_gnCreateInstance* next);
|
||||||
void destroyInstance(gnInstanceHandle instance);
|
void destroyVulkanInstance(gnInstanceHandle instance, PFN_gnDestroyInstance* next);
|
||||||
|
|
||||||
typedef const char* vkString;
|
typedef const char* vkString;
|
||||||
|
|
||||||
GN_ARRAY_LIST(vkString);
|
GN_ARRAY_LIST(vkString);
|
||||||
|
@@ -4,20 +4,24 @@
|
|||||||
#define GN_NULL_HANDLE 0
|
#define GN_NULL_HANDLE 0
|
||||||
typedef uint32_t gnFlags;
|
typedef uint32_t gnFlags;
|
||||||
|
|
||||||
|
// The value of this handle is defined by the gryphn spec
|
||||||
#define GN_HANDLE(type) \
|
#define GN_HANDLE(type) \
|
||||||
typedef struct type##_t* type##Handle; \
|
typedef struct type##_t* type##Handle; \
|
||||||
typedef struct type##_t* type
|
typedef struct type##_t* type
|
||||||
|
|
||||||
|
// The value of this handle is defined by the implementation
|
||||||
#define GN_IMPLEMENTATION_HANDLE(type) \
|
#define GN_IMPLEMENTATION_HANDLE(type) \
|
||||||
typedef uint64_t type##Handle; \
|
typedef uint64_t type##Handle; \
|
||||||
typedef uint64_t type
|
typedef uint64_t type
|
||||||
|
|
||||||
|
// can be used to alias a normal handle or an implementation handle
|
||||||
#define GN_HANDLE_ALIAS(handle, alias) \
|
#define GN_HANDLE_ALIAS(handle, alias) \
|
||||||
typedef struct handle##_t* alias##Handle; \
|
typedef struct handle##_t* alias##Handle; \
|
||||||
typedef struct handle##_t* alias
|
typedef struct handle##_t* alias
|
||||||
|
|
||||||
GN_HANDLE(gnInstance);
|
GN_HANDLE(gnInstance);
|
||||||
GN_HANDLE(gnDebugger);
|
|
||||||
|
|
||||||
GN_HANDLE(gnWindowSurface);
|
GN_HANDLE(gnWindowSurface);
|
||||||
GN_HANDLE(gnPresentationQueue);
|
GN_HANDLE(gnPresentationQueue);
|
||||||
GN_HANDLE(gnTexture);
|
GN_HANDLE(gnTexture);
|
||||||
|
@@ -29,7 +29,6 @@ struct gnInstance_t {
|
|||||||
struct gnPlatformInstance_t* instance;
|
struct gnPlatformInstance_t* instance;
|
||||||
gnDebuggerCreateInfo debugger;
|
gnDebuggerCreateInfo debugger;
|
||||||
gnBool enabledExtensions[GN_EXT_MAX];
|
gnBool enabledExtensions[GN_EXT_MAX];
|
||||||
dispatcher dispatch;
|
|
||||||
|
|
||||||
loaderLayerArrayList layers;
|
loaderLayerArrayList layers;
|
||||||
loaderLayer* callingLayer;
|
loaderLayer* callingLayer;
|
||||||
|
@@ -18,15 +18,18 @@ typedef struct gnOutputDeviceInfo gnOutputDeviceInfo;
|
|||||||
typedef struct gnMacOSWindowSurfaceInfo gnMacOSWindowSurfaceInfo;
|
typedef struct gnMacOSWindowSurfaceInfo gnMacOSWindowSurfaceInfo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef gnReturnCode (*PFN_gnCreateInstance)(gnInstanceHandle instance, gnInstanceCreateInfo* info, void* next);
|
||||||
|
typedef gnReturnCode (*PFN_gnDestroyInstance)(gnInstanceHandle instance, void* next);
|
||||||
|
|
||||||
typedef struct gnInstanceFunctions {
|
typedef struct gnInstanceFunctions {
|
||||||
gnReturnCode (*_gnCreateInstance)(gnInstanceHandle instance, gnInstanceCreateInfo* info);
|
PFN_gnCreateInstance createInstance;
|
||||||
void (*_gnDestroyInstance)(gnInstanceHandle instance);
|
PFN_gnDestroyInstance destroyInstance;
|
||||||
|
|
||||||
gnPhysicalDevice* (*_gnGetPhysicalDevices)(gnInstanceHandle instance, uint32_t* count);
|
gnPhysicalDevice* (*_gnGetPhysicalDevices)(gnInstanceHandle instance, uint32_t* count);
|
||||||
gnBool (*_gnPhysicalDeviceCanPresentToSurface)(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
|
gnBool (*_gnPhysicalDeviceCanPresentToSurface)(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
|
||||||
|
|
||||||
gnReturnCode (*_gnCreateOutputDevice)(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo);
|
gnReturnCode (*_gnCreateOutputDevice)(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo);
|
||||||
void (*_gnDestroyOutputDevice)(gnOutputDeviceHandle device);
|
void (*_gnDestroyOutputDevice)(gnInstanceHandle handle, gnOutputDeviceHandle device);
|
||||||
|
|
||||||
|
|
||||||
#ifdef GN_PLATFORM_LINUX
|
#ifdef GN_PLATFORM_LINUX
|
||||||
|
Reference in New Issue
Block a user