finish new loader structure for vulkan

This commit is contained in:
Gregory Wells
2025-06-24 14:43:59 -04:00
parent 4ec3d62146
commit 8cc44c709e
40 changed files with 178 additions and 93 deletions

View File

@@ -1,6 +1,5 @@
#include "gryphn_buffer.h"
#include "output_device/gryphn_output_device.h"
#include "gryphn_platform_functions.h"
gnReturnCode gnCreateBuffer(gnBufferHandle* buffer, gnOutputDeviceHandle device, gnBufferInfo info) {
*buffer = malloc(sizeof(struct gnBuffer_t));

View File

@@ -1,8 +1,11 @@
#include "gryphn_command_pool.h"
#include "stdlib.h"
#include "output_device/gryphn_output_device.h"
#include "instance/gryphn_instance.h"
gnReturnCode gnCreateCommandPool(gnCommandPoolHandle* commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info) {
*commandPool = malloc(sizeof(struct gnCommandPool_t));
(*commandPool)->commandFunctions = device->instance->commandFunctions;
(*commandPool)->commandFunctions = &device->instance->commandFunctions;
(*commandPool)->device = device;
return device->deviceFunctions->_gnCreateCommandPool((*commandPool), device, info);

View File

@@ -2,7 +2,7 @@
#include "stdint.h"
#include <utils/gryphn_error_code.h>
#include "gryphn_handles.h"
#include <gryphn_platform_functions.h>
#include "loader/src/gryphn_command_functions.h"
typedef struct gnCommandPoolInfo {
uint32_t queueIndex;
@@ -11,8 +11,8 @@ typedef struct gnCommandPoolInfo {
#ifdef GN_REVEAL_IMPL
struct gnCommandPool_t {
struct gnPlatformCommandPool_t* commandPool;
struct gnCommandFunctions_t* commandFunctions;
struct gnOutputDevice_t* device;
gnCommandFunctions* commandFunctions;
gnDevice device;
};
#endif

View File

@@ -1,7 +1,6 @@
#include "gryphn_command.h"
#include "command/command_buffer/gryphn_command_buffer.h"
#include "command/command_pool/gryphn_command_pool.h"
#include "gryphn_platform_functions.h"
void gnCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo) {
buffer->commandPool->commandFunctions->_gnCommandBeginRenderPass(buffer, passInfo);

View File

@@ -1,5 +1,4 @@
#include "gryphn_debugger.h"
#include <gryphn_platform_functions.h>
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info) {
*debugger = malloc(sizeof(struct gnDebugger_t));

View File

@@ -1,5 +1,6 @@
#include "gryphn_framebuffer.h"
#include "gryphn_platform_functions.h"
#include "stdlib.h"
#include "output_device/gryphn_output_device.h"
gnReturnCode gnCreateFramebuffer(gnFramebuffer* framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo) {
*framebuffer = malloc(sizeof(struct gnFramebuffer_t));

View File

@@ -1,29 +0,0 @@
#pragma once
// theoretically you could have multible gryphn instances running in one application,
// why I dont know
#include "instance/gryphn_instance.h"
#include <debugger/gryphn_debugger.h>
#include <window_surface/gryphn_surface_create_functions.h>
#include "pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
#include "renderpass/gryphn_render_pass.h"
#include "buffers/gryphn_buffer.h"
typedef struct gnCommandFunctions_t {
gnReturnCode (*_gnCommandPoolAllocateCommandBuffers)(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPoolHandle pool);
gnReturnCode (*_gnBeginCommandBuffer)(gnCommandBufferHandle commandBuffer);
void (*_gnResetCommandBuffer)(gnCommandBufferHandle commandBuffer);
gnReturnCode (*_gnEndCommandBuffer)(gnCommandBufferHandle commandBuffer);
void (*_gnCommandBeginRenderPass)(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo);
void (*_gnCommandEndRenderPass)(gnCommandBufferHandle buffer);
void (*_gnCommandBindGraphicsPipeline)(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline);
void (*_gnCommandSetViewport)(gnCommandBufferHandle buffer, gnViewport viewport);
void (*_gnCommandSetScissor)(gnCommandBufferHandle buffer, gnScissor scissor);
void (*_gnCommandBindUniform)(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set);
void (*_gnCommandPushConstant)(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data);
void (*_gnCommandBindBuffer)(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type);
void (*_gnCommandDraw)(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance);
void (*_gnCommandDrawIndexed)(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance);
} gnCommandFunctions;

View File

@@ -1,5 +1,4 @@
#include "gryphn_instance.h"
#include <gryphn_platform_functions.h>
#include "instance/gryphn_instance.h"
#include <loader/src/gryphn_instance_functions.h>
#include "loader/src/gryphn_loader.h"
@@ -13,6 +12,7 @@ gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
(*instance)->instanceFunctions = loadInstanceFunctions(loadInfo);
(*instance)->deviceFunctions = loadDeviceFunctions(loadInfo);
(*instance)->commandFunctions = loadCommandFunctions(loadInfo);
(*instance)->debugger = info.debugger;
return (*instance)->instanceFunctions._gnCreateInstance((*instance), info);
}

View File

@@ -5,6 +5,7 @@
#include "utils/gryphn_error_code.h"
#include "loader/src/gryphn_instance_functions.h"
#include "loader/src/gryphn_device_functions.h"
#include "loader/src/gryphn_command_functions.h"
typedef struct gnInstanceInfo {
gnString applicationName;
@@ -24,7 +25,7 @@ struct gnInstance_t {
gnInstanceFunctions instanceFunctions;
gnDeviceFunctions deviceFunctions;
struct gnCommandFunctions_t* commandFunctions;
gnCommandFunctions commandFunctions;
gnDebuggerHandle debugger;
};

View File

@@ -1,5 +1,4 @@
#include "gryphn_graphics_pipeline.h"
#include "gryphn_platform_functions.h"
gnReturnCode gnCreateGraphicsPipeline(gnGraphicsPipelineHandle* graphicsPipeline, gnDevice device, gnGraphicsPipelineInfo info) {
*graphicsPipeline = malloc(sizeof(struct gnGraphicsPipeline_t));

View File

@@ -3,7 +3,7 @@
#include "utils/math/gryphn_vec2.h"
#include "gryphn_handles.h"
typedef struct gnRenderPassInfo_t {
typedef struct gnRenderPassInfo {
gnRenderPassDescriptorHandle renderPassDescriptor;
gnFramebuffer framebuffer;
gnUInt2 offset;

View File

@@ -1,5 +1,5 @@
#include "gryphn_render_pass_descriptor.h"
#include "gryphn_platform_functions.h"
#include "output_device/gryphn_output_device.h"
gnReturnCode gnCreateRenderPassDescriptor(gnRenderPassDescriptorHandle* renderPass, gnOutputDeviceHandle device, gnRenderPassDescriptorInfo info) {
*renderPass = malloc(sizeof(struct gnRenderPassDescriptor_t));

View File

@@ -1,5 +1,5 @@
#include <gryphn_platform_functions.h>
#include "gryphn_shader_module.h"
#include "output_device/gryphn_output_device.h"
gnReturnCode gnCreateShaderModule(gnShaderModuleHandle* module, gnOutputDeviceHandle device, struct gnShaderModuleInfo shaderModuleInfo) {
*module = malloc(sizeof(struct gnShaderModule_t));

View File

@@ -1,5 +1,5 @@
#include "gryphn_fence.h"
#include "gryphn_platform_functions.h"
#include "output_device/gryphn_output_device.h"
gnReturnCode gnCreateFence(gnFenceHandle* fence, struct gnOutputDevice_t* device) {
*fence = malloc(sizeof(struct gnFence_t));
@@ -9,7 +9,6 @@ gnReturnCode gnCreateFence(gnFenceHandle* fence, struct gnOutputDevice_t* device
}
void gnSignalFence(gnFenceHandle fence) {
fence->signaled = gnTrue;
// fence->device->deviceFunctions->_gnSignalFence(fence);
}
void gnWaitForFence(gnFenceHandle fence, uint64_t timeout) {
if (fence->signaled == gnTrue) return;

View File

@@ -1,5 +1,5 @@
#include "gryphn_semaphore.h"
#include "gryphn_platform_functions.h"
#include "output_device/gryphn_output_device.h"
gnReturnCode gnCreateSemaphore(gnSemaphore* semaphore, struct gnOutputDevice_t* device) {
*semaphore = malloc(sizeof(struct gnSemaphore_t));

View File

@@ -1,5 +1,5 @@
#include "gryphn_texture.h"
#include "gryphn_platform_functions.h"
#include "output_device/gryphn_output_device.h"
gnReturnCode gnCreateTexture(gnTexture* texture, gnDevice device, const gnTextureInfo info) {
*texture = malloc(sizeof(struct gnTexture_t));

View File

@@ -1,7 +1,6 @@
#include "gryphn_uniform.h"
#include "gryphn_uniform_pool.h"
#include "output_device/gryphn_output_device.h"
#include "gryphn_platform_functions.h"
void gnUpdateBufferUniform(gnUniform uniform, gnBufferUniformInfo bufferInfo) {
uniform->pool->device->deviceFunctions->_gnUpdateBufferUniform(uniform, &bufferInfo);

View File

@@ -1,6 +1,5 @@
#include "gryphn_uniform_pool.h"
#include "output_device/gryphn_output_device.h"
#include "gryphn_platform_functions.h"
#include "gryphn_uniform.h"
#include "stdlib.h"