only load device functions once per instance
This commit is contained in:
@@ -13,3 +13,4 @@
|
|||||||
#include <core/renderpass/gryphn_render_pass_descriptor.h>
|
#include <core/renderpass/gryphn_render_pass_descriptor.h>
|
||||||
#include <core/framebuffer/gryphn_framebuffer.h>
|
#include <core/framebuffer/gryphn_framebuffer.h>
|
||||||
#include <core/textures/gryphn_texture.h>
|
#include <core/textures/gryphn_texture.h>
|
||||||
|
#include <core/command/command_pool/gryphn_command_pool.h>
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
gnReturnCode gnCreateInstance(gnInstance* instance, struct gnInstanceInfo_t info) {
|
gnReturnCode gnCreateInstance(gnInstance* instance, struct gnInstanceInfo_t info) {
|
||||||
if (!gnIsAPISupported(info.renderingAPI)) return GN_UNSUPPORTED_RENDERING_API;
|
if (!gnIsAPISupported(info.renderingAPI)) return GN_UNSUPPORTED_RENDERING_API;
|
||||||
|
instance->loadDeviceFunctions = gnFalse;
|
||||||
instance->debugger = NULL;
|
instance->debugger = NULL;
|
||||||
instance->dynamicLib = gnLoadRenderingDLL(info.renderingAPI);
|
instance->dynamicLib = gnLoadRenderingDLL(info.renderingAPI);
|
||||||
if (instance->dynamicLib == NULL) return GN_UNABLE_TO_LOAD_DYNAMIC_LIBARRY;
|
if (instance->dynamicLib == NULL) return GN_UNABLE_TO_LOAD_DYNAMIC_LIBARRY;
|
||||||
|
@@ -19,9 +19,10 @@ typedef struct gnInstanceInfo_t {
|
|||||||
|
|
||||||
typedef struct gnInstance_t {
|
typedef struct gnInstance_t {
|
||||||
struct gnPlatformInstance_t* instance;
|
struct gnPlatformInstance_t* instance;
|
||||||
gnBool valid;
|
gnBool valid, loadDeviceFunctions;
|
||||||
|
|
||||||
struct gnFunctions_t* functions;
|
struct gnFunctions_t* functions;
|
||||||
|
struct gnDeviceFunctions_t* deviceFunctions;
|
||||||
struct gnDynamicLibrary_t* dynamicLib;
|
struct gnDynamicLibrary_t* dynamicLib;
|
||||||
|
|
||||||
struct gnDebugger_t* debugger;
|
struct gnDebugger_t* debugger;
|
||||||
|
@@ -4,8 +4,14 @@
|
|||||||
#include "core/instance/init/gryphn_init.h"
|
#include "core/instance/init/gryphn_init.h"
|
||||||
|
|
||||||
gnReturnCode gnCreateOutputDevice(gnOutputDevice* outputDevice, gnInstance* instance, struct gnOutputDeviceInfo_t deviceInfo) {
|
gnReturnCode gnCreateOutputDevice(gnOutputDevice* outputDevice, gnInstance* instance, struct gnOutputDeviceInfo_t deviceInfo) {
|
||||||
outputDevice->deviceFunctions = malloc(sizeof(gnDeviceFunctions));
|
if (instance->loadDeviceFunctions == gnFalse) {
|
||||||
gnLoadDeviceFunctions(instance->dynamicLib, outputDevice->deviceFunctions);
|
instance->deviceFunctions = malloc(sizeof(struct gnDeviceFunctions_t));
|
||||||
|
gnLoadDeviceFunctions(instance->dynamicLib, instance->deviceFunctions);
|
||||||
|
instance->loadDeviceFunctions = gnTrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
outputDevice->deviceFunctions = instance->deviceFunctions;
|
||||||
|
|
||||||
outputDevice->instance = instance;
|
outputDevice->instance = instance;
|
||||||
outputDevice->physicalDevice = deviceInfo.physicalDevice;
|
outputDevice->physicalDevice = deviceInfo.physicalDevice;
|
||||||
outputDevice->deviceInfo = deviceInfo;
|
outputDevice->deviceInfo = deviceInfo;
|
||||||
|
Reference in New Issue
Block a user