diff --git a/include/gryphn/gryphn.h b/include/gryphn/gryphn.h index 3f9e57d..3473383 100644 --- a/include/gryphn/gryphn.h +++ b/include/gryphn/gryphn.h @@ -8,31 +8,4 @@ #include #include #include - -// #pragma once - -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include -// #include +#include diff --git a/src/core/gryphn_platform_functions.h b/src/core/gryphn_platform_functions.h index 8c385c9..57406c2 100644 --- a/src/core/gryphn_platform_functions.h +++ b/src/core/gryphn_platform_functions.h @@ -7,6 +7,7 @@ #include "output_device/gryphn_output_device.h" #include "window_surface/gryphn_surface.h" #include "window_surface/gryphn_surface_create_functions.h" +#include "shader_module/gryphn_shader_module.h" typedef struct gnFunctions_t { gnReturnCode (*_gnCreateInstance)(gnInstance* instance, struct gnInstanceInfo_t info); @@ -50,4 +51,7 @@ typedef struct gnFunctions_t { typedef struct gnDeviceFunctions_t { gnReturnCode (*_gnCreatePresentationQueue)(gnPresentationQueue* presentationQueue, const gnOutputDevice* device, struct gnPresentationQueueInfo_t presentationInfo); void (*_gnDestroyPresentationQueue)(gnPresentationQueue *presentationQueue); + + gnReturnCode (*_gnCreateShaderModule)(struct gnShaderModule_t* module, struct gnOutputDevice_t* device, struct gnShaderModuleInfo_t shaderModuleInfo); + void (*_gnDestroyShaderModule)(struct gnShaderModuleInfo_t* module); } gnDeviceFunctions; diff --git a/src/core/instance/init/gryphn_init.c b/src/core/instance/init/gryphn_init.c index a1865bd..5a27d1b 100644 --- a/src/core/instance/init/gryphn_init.c +++ b/src/core/instance/init/gryphn_init.c @@ -71,4 +71,6 @@ void gnLoadFunctions(struct gnDynamicLibrary_t* lib, struct gnFunctions_t* funct void gnLoadDeviceFunctions(struct gnDynamicLibrary_t* lib, struct gnDeviceFunctions_t* functions) { gnLoadDLLFunction(lib, functions->_gnCreatePresentationQueue, "gnCreatePresentationQueueFn"); gnLoadDLLFunction(lib, functions->_gnDestroyPresentationQueue, "gnDestroyPresentationQueueFn"); + gnLoadDLLFunction(lib, functions->_gnCreateShaderModule, "gnCreateShaderModuleFn"); + gnLoadDLLFunction(lib, functions->_gnDestroyShaderModule, "gnDestroyShaderModuleFn"); } diff --git a/src/core/shader_module/gryphn_shader_module.c b/src/core/shader_module/gryphn_shader_module.c new file mode 100644 index 0000000..65a28f4 --- /dev/null +++ b/src/core/shader_module/gryphn_shader_module.c @@ -0,0 +1,7 @@ +#include +#include "gryphn_shader_module.h" + +gnReturnCode gnCreateShaderModule(struct gnShaderModule_t* module, struct gnOutputDevice_t* device, struct gnShaderModuleInfo_t shaderModuleInfo) { + module->device = device; + return device->deviceFunctions->_gnCreateShaderModule(module, device, shaderModuleInfo); +} diff --git a/src/core/shader_module/gryphn_shader_module.h b/src/core/shader_module/gryphn_shader_module.h new file mode 100644 index 0000000..a5d92c8 --- /dev/null +++ b/src/core/shader_module/gryphn_shader_module.h @@ -0,0 +1,24 @@ +#pragma once +#include "stdint.h" +#include "utils/strings/gryphn_string.h" +#include "core/output_device/gryphn_output_device.h" + +typedef enum gnShaderModuleStage_e { + GN_VERTEX_SHADER_MODULE, GN_FRAGMENT_SHADER_MODULE +} gnShaderModuleStage; + +typedef struct gnShaderModuleInfo_t { + enum gnShaderModuleStage_e stage; + unsigned char* code; + uint32_t size; + gnString entryPoint; +} gnShaderModuleInfo; + +struct gnPlatformShaderModule_t; + +typedef struct gnShaderModule_t { + struct gnPlatformShaderModule_t* shaderModule; + struct gnOutputDevice_t* device; +} gnShaderModule; + +gnReturnCode gnCreateShaderModule(struct gnShaderModule_t* module, struct gnOutputDevice_t* device, struct gnShaderModuleInfo_t shaderModuleInfo);