Gryphn API for shaders

This commit is contained in:
Greg Wells
2025-05-27 13:54:13 -04:00
parent 9099148be9
commit df977592df
5 changed files with 38 additions and 28 deletions

View File

@@ -8,31 +8,4 @@
#include <core/window_surface/gryphn_surface.h>
#include <core/window_surface/gryphn_surface_create_functions.h>
#include <core/presentation_queue/gryphn_presentation_queue.h>
// #pragma once
// #include <gryphn/gryphn_utils.h>
// #include <platform/gryphn_platform_include.h>
// #include <core/init/gryphn_init.h>
// #include <core/instance/gryphn_instance.h>
// #include <core/presentation_queue/gryphn_presentation_queue.h>
// #include <core/buffers/vertex_descriptions/gryphn_vertex_description.h>
// #include <core/buffers/gryphn_buffer.h>
// #include <core/textures/gryphn_texture.h>
// #include <core/uniform_descriptor/gryphn_uniform_layout_binding.h>
// #include <core/uniform_descriptor/gryphn_uniform_layout.h>
// #include <core/graphics_pipeline/gryphn_render_pass.h>
// #include <core/sync_objects/gryphn_sync_semaphore.h>
// #include <core/sync_objects/gryphn_fence.h>
// #include <core/commands/gryphn_command_buffer.h>
// #include <core/commands/gryphn_command.h>
// #include <core/commands/present_command/gryphn_command_present.h>
// #include <core/commands/submit_command/gryphn_command_submit.h>
// #include <core/buffers/gryphn_buffer.h>
// #include <core/uniform_descriptor/gryphn_uniform.h>
// #include <core/uniform_descriptor/uniform_buffer/gryphn_uniform_buffer.h>
// #include <core/uniform_descriptor/sampler/gryphn_sampler.h>
// #include <core/push_constant/gryphn_push_constant.h>
// #include <core/graphics_pipeline/gryphn_graphics_pipeline.h>
// #include <core/gryphn_support.h>
// #include <core/framebuffers/gryphn_framebuffer.h>
#include <core/shader_module/gryphn_shader_module.h>

View File

@@ -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;

View File

@@ -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");
}

View File

@@ -0,0 +1,7 @@
#include <core/gryphn_platform_functions.h>
#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);
}

View File

@@ -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);