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

@@ -0,0 +1,31 @@
#pragma once
#include "stdint.h"
#include "utils/gryphn_error_code.h"
#include "gryphn_handles.h"
typedef struct gnRenderPassInfo gnRenderPassInfo;
typedef struct gnViewport gnViewport;
typedef struct gnScissor gnScissor;
typedef struct gnPushConstantLayout gnPushConstantLayout;
typedef enum gnBufferType gnBufferType;
typedef enum gnIndexType gnIndexType;
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

@@ -58,7 +58,6 @@ typedef struct gnDeviceFunctions {
void (*_gnDestroyTexture)(gnTexture texture);
gnReturnCode (*_gnCreateFence)(gnFenceHandle fence, gnOutputDeviceHandle device);
void (*_gnSignalFence)(gnFenceHandle fence);
void (*_gnWaitForFence)(gnFenceHandle fence, uint64_t timeout);
void (*_gnResetFence)(gnFenceHandle fence);
void (*_gnDestroyFence)(gnFenceHandle fence);

View File

@@ -26,3 +26,16 @@ gnDeviceFunctions loadDeviceFunctions(loaderInfo info) {
case GN_RENDERINGAPI_METAL: return (gnDeviceFunctions){ NULL };
}
}
gnCommandFunctions loadCommandFunctions(loaderInfo info) {
switch (info.api) {
case GN_RENDERINGAPI_NONE: return (gnCommandFunctions){ NULL };
case GN_RENDERINGAPI_VULKAN: return loadVulkanCommandFunctions();
case GN_RENDERINGAPI_SOFTWARE: return (gnCommandFunctions){ NULL };
case GN_RENDERINGAPI_DIRECTX11: return (gnCommandFunctions){ NULL };
case GN_RENDERINGAPI_DIRECTX12: return (gnCommandFunctions){ NULL };
case GN_RENDERINGAPI_OPENGL: return (gnCommandFunctions){ NULL };
case GN_RENDERINGAPI_METAL: return (gnCommandFunctions){ NULL };
}
}

View File

@@ -2,6 +2,7 @@
#include "gryphn_rendering_api.h"
#include "gryphn_instance_functions.h"
#include "gryphn_device_functions.h"
#include "gryphn_command_functions.h"
typedef struct loaderInfo {
gnRenderingAPI api;
@@ -9,3 +10,4 @@ typedef struct loaderInfo {
gnInstanceFunctions loadInstanceFunctions(loaderInfo info);
gnDeviceFunctions loadDeviceFunctions(loaderInfo info);
gnCommandFunctions loadCommandFunctions(loaderInfo info);