finish new loader structure for vulkan
This commit is contained in:
31
projects/loader/src/gryphn_command_functions.h
Normal file
31
projects/loader/src/gryphn_command_functions.h
Normal 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;
|
@@ -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);
|
||||
|
@@ -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 };
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user