gryphn graphics pipelines (create baisc objects)

This commit is contained in:
Greg Wells
2025-05-28 11:53:06 -04:00
parent 08ec48f6a9
commit 21ec113824
7 changed files with 279 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#include "window_surface/gryphn_surface.h"
#include "window_surface/gryphn_surface_create_functions.h"
#include "shader_module/gryphn_shader_module.h"
#include "pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
typedef struct gnFunctions_t {
gnReturnCode (*_gnCreateInstance)(gnInstance* instance, struct gnInstanceInfo_t info);
@@ -54,4 +55,7 @@ typedef struct gnDeviceFunctions_t {
gnReturnCode (*_gnCreateShaderModule)(struct gnShaderModule_t* module, struct gnOutputDevice_t* device, struct gnShaderModuleInfo_t shaderModuleInfo);
void (*_gnDestroyShaderModule)(struct gnShaderModule_t* module);
gnReturnCode (*_gnCreateGraphicsPipeline)(struct gnGraphicsPipeline_t* pipeline, struct gnOutputDevice_t* device, struct gnGraphicsPipelineInfo_t pipelineInfo);
void (*_gnDestroyGraphicsPipeline)(struct gnGraphicsPipeline_t* pipeline);
} gnDeviceFunctions;

View File

@@ -73,4 +73,6 @@ void gnLoadDeviceFunctions(struct gnDynamicLibrary_t* lib, struct gnDeviceFuncti
gnLoadDLLFunction(lib, functions->_gnDestroyPresentationQueue, "gnDestroyPresentationQueueFn");
gnLoadDLLFunction(lib, functions->_gnCreateShaderModule, "gnCreateShaderModuleFn");
gnLoadDLLFunction(lib, functions->_gnDestroyShaderModule, "gnDestroyShaderModuleFn");
gnLoadDLLFunction(lib, functions->_gnCreateGraphicsPipeline, "gnCreateGraphicsPipelineFn");
gnLoadDLLFunction(lib, functions->_gnDestroyGraphicsPipeline, "gnDestroyGraphicsPipelineFn");
}

View File

@@ -0,0 +1,11 @@
#include "gryphn_graphics_pipeline.h"
#include "core/gryphn_platform_functions.h"
gnReturnCode gnCreateGraphicsPipeline(struct gnGraphicsPipeline_t* graphicsPipeline, struct gnOutputDevice_t* device, struct gnGraphicsPipelineInfo_t info) {
graphicsPipeline->device = device;
return graphicsPipeline->device->deviceFunctions->_gnCreateGraphicsPipeline(graphicsPipeline, device, info);
}
void gnDestroyGraphicsPipeline(struct gnGraphicsPipeline_t* graphicsPipeline) {
graphicsPipeline->device->deviceFunctions->_gnDestroyGraphicsPipeline(graphicsPipeline);
}

View File

@@ -0,0 +1,89 @@
#pragma once
#include <core/output_device/gryphn_output_device.h>
typedef enum gnDynamicState_e {
GN_DYNAMIC_VIEWPORT,
GN_DYNAMIC_SCISSOR,
GN_DYNAMIC_STATE_MAX
} gnDynamicState;
typedef struct gnDynamicStateInfo_t {
uint32_t dynamicStateCount;
enum gnDynamicState_e* dynamicStates;
} gnDynamicStateInfo;
typedef enum gnPrimitiveType_e {
GN_PRIMITIVE_POINTS, GN_PRIMITIVE_LINES, GN_PRIMITIVE_LINE_STRIP, GN_PRIMITIVE_TRIANGLES, GN_PRIMITIVE_TRIANGLE_STRIP
} gnPrimativeType;
typedef struct gnViewport_t {
gnVec2 position;
gnVec2 size;
float minDepth;
float maxDepth;
} gnViewport;
typedef struct gnScissor_t {
gnInt2 position;
gnUInt2 size;
} gnScissor;
typedef enum gnFillMode_e {
GN_FILL_MODE_FILL, GN_FILL_MODE_LINE, GN_FILL_MODE_POINT
} gnFillMode;
typedef enum gnCullFace_e {
GN_CULL_FACE_NONE, GN_CULL_FACE_BACK, GN_CULL_FACE_FRONT
} gnCullFace;
typedef enum gnCullDirection_e {
GN_DIRECTION_CLOCK_WISE, GN_DIRECTION_COUNTER_CLOCK_WISE
} gnCullDirection;
typedef struct gnCullMode_t {
enum gnCullFace_e face;
enum gnCullDirection_e direction;
} gnCullMode;
typedef enum gnBlendFactor_e {
GN_BLEND_FACTOR_ZERO,
GN_BLEND_FACTOR_ONE,
GN_BLEND_FACTOR_SRC_ALPHA,
GN_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
} gnBlendFactor;
typedef enum gnBlendOperation_e {
GN_OPERATION_ADD
} gnBlendOperation;
typedef struct gnColorBlending_t {
gnBool enable;
enum gnBlendFactor_e sourceColorBlendFactor;
enum gnBlendFactor_e sourceAlphaBlendFactor;
enum gnBlendFactor_e destinationColorBlendFactor;
enum gnBlendFactor_e destinationAlphaBlendFactor;
enum gnBlendOperation_e colorBlendOperation;
enum gnBlendOperation_e alphaBlendOperation;
} gnColorBlending;
typedef struct gnGraphicsPipelineInfo_t {
struct gnDynamicStateInfo_t dynamicState;
enum gnPrimitiveType_e primitiveType;
struct gnViewport_t viewport;
struct gnScissor_t scissor;
enum gnFillMode_e fillMode;
struct gnCullMode_t cullMode;
struct gnColorBlending_t colorBlending;
} gnGraphicsPipelineInfo;
struct gnPlatformGraphicsPipeline_t;
typedef struct gnGraphicsPipeline_t {
struct gnPlatformGraphicsPipeline_t* graphicsPipeline;
struct gnOutputDevice_t* device;
} gnGraphicsPipeline;
gnReturnCode gnCreateGraphicsPipeline(struct gnGraphicsPipeline_t* graphicsPipeline, struct gnOutputDevice_t* device, struct gnGraphicsPipelineInfo_t info);
void gnDestroyGraphicsPipeline(struct gnGraphicsPipeline_t* graphicsPipeline);