first commit

This commit is contained in:
Greg Wells
2025-05-05 19:29:42 -04:00
commit 406d669de0
284 changed files with 32727 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
#include "gryphn_buffer.h"
void gnBufferSetSize(gnBuffer& buffer, gnSize size) {
buffer.size = size;
}
void gnBufferSetType(gnBuffer& buffer, gnBufferType type) {
buffer.bufferType = type;
}
void gnBufferSetDataType(gnBuffer& buffer, gnBufferDataType type) {
buffer.dataType = type;
}

View File

@@ -0,0 +1,34 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "core/output_device/gryphn_output_device.h"
struct gnPlatformBuffer;
typedef enum gnBufferType {
GN_VERTEX_BUFFER = 0, GN_INDEX_BUFFER = 1, GN_UNIFORM_BUFFER = 2
} gnBufferType;
typedef enum gnBufferDataType {
GN_UINT8, GN_UINT16, GN_UINT32
} gnBufferDataType;
struct gnBuffer {
ACCESS_LEVEL:
gnPlatformBuffer* buffer = nullptr;
gnSize size;
gnBufferType bufferType;
gnBufferDataType dataType;
public:
gnBuffer() {}
};
void gnBufferSetSize(gnBuffer& buffer, gnSize size);
void gnBufferSetType(gnBuffer& buffer, gnBufferType type);
void gnBufferSetDataType(gnBuffer& buffer, gnBufferDataType type);
inline gnErrorCode (*gnCreateBuffer)(gnBuffer* buffer, const gnOutputDevice& outputDevice);
inline void (*gnBufferData)(gnBuffer& buffer, void* data);
inline void (*gnBufferMapData)(gnBuffer& buffer, void** data); // used to map data to a pointer without copying
inline void (*gnBufferSubData)(gnBuffer& buffer, gnSize offset, gnSize size, void* data);
inline void (*gnBufferClearData)(gnBuffer& buffer);
inline void (*gnDestroyBuffer)(gnBuffer& buffer);

View File

@@ -0,0 +1,18 @@
#pragma once
#include <gryphn/gryphn_utils.h>
struct gnPlatformBufferDescription;
struct gnGraphicsPipeline;
// I have zero fucking clue what this class does?????
// I know I wrote it but there are zero references to it so i think that its some black magic thing I wrote
// Imma pretend that I doesnt exist for now and just not write a metal implementation for it
// This is going to end horribly but who fucking cares
struct gnBufferDescription {
ACCESS_LEVEL:
gnPlatformBufferDescription* bufferDescription;
public:
gnBufferDescription();
};
inline gnReturnCode (*gnCreateBufferDescription)(gnBufferDescription* bufferDescription, const gnGraphicsPipeline& graphicsPipeline);

View File

@@ -0,0 +1,10 @@
#pragma once
#include <gryphn/gryphn_utils.h>
struct gnBindingDescription {
public:
gnInt binding;
gnSize stride;
public:
gnBindingDescription() {};
};

View File

@@ -0,0 +1,18 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_binding_description.h"
#include "gryphn_vertex_property.h"
struct gnPlatformVertexDescription;
struct gnVertexDescription {
ACCESS_LEVEL:
gnPlatformVertexDescription* vertexDescription = nullptr;
gnBindingDescription* bindingDescription;
public:
gnVertexDescription() {}
};
inline void (*gnVertexDescriptionSetBindingDescription)(gnVertexDescription& vertexDescription, const gnBindingDescription& description);
inline void (*gnVertexDescriptionSetPropertiesCount)(gnVertexDescription& vertexDescription, int count);
inline void (*gnVertexDescriptionSetProperty)(gnVertexDescription& vertexDescription, int index, const gnVertexProperty& property);

View File

@@ -0,0 +1,18 @@
#pragma once
#include <gryphn/gryphn_utils.h>
enum gnVertexDataFormat {
GN_FLOAT, GN_FLOAT2, GN_FLOAT3, GN_FLOAT4, GN_UINT
};
struct gnVertexProperty {
ACCESS_LEVEL:
public:
int binding;
int location;
gnVertexDataFormat format;
size_t offset;
public:
gnVertexProperty() {}
};

View File

@@ -0,0 +1,38 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_command_buffer.h"
#include "core/graphics_pipeline/gryphn_render_pass_frame.h"
#include "core/graphics_pipeline/gryphn_graphics_pipeline.h"
#include "core/buffers/gryphn_buffer.h"
#include "core/buffers/uniform_buffer_descriptor/gryphn_buffer_description.h"
#include "core/push_constant/gryphn_push_constant.h"
#include "core/uniform_descriptor/uniform_buffer/gryphn_uniform_buffer.h"
#include "core/uniform_descriptor/sampler/gryphn_sampler.h"
#include "core/shaders/gryphn_shader.h"
struct gnViewportDescriptionData {
gnVec2 offset;
gnVec2 size;
gnVec2 depth;
};
struct gnScissorDescriptionData {
gnUInt2 offset;
gnUInt2 extent;
};
inline gnReturnCode (*gnCommandBufferStart)(gnCommandBuffer& commandBuffer);
inline void (*gnCommandBeginRenderPass)(gnCommandBuffer& commandBuffer, const gnRenderPassFrame& frame);
inline void (*gnCommandSetGraphicsPipeline)(gnCommandBuffer& commandBuffer, const gnGraphicsPipeline& graphicsPipeline);
inline void (*gnCommandSetViewport)(gnCommandBuffer& commandBuffer, gnViewportDescriptionData data);
inline void (*gnCommandSetScissor)(gnCommandBuffer& commandBuffer, gnScissorDescriptionData data);
inline void (*_gnCommandDraw)(gnCommandBuffer& commandBuffer, int vertexCount, int instanceCount, int firstVertex, int firstInstance);
inline void gnCommandDraw(gnCommandBuffer& commandBuffer, int vertexCount, int instanceCount, int firstVertex = 0, int firstInstance = 0) { _gnCommandDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); }
//void gnCommandDrawIndexedIndirect(const gnCommandBuffer &commandBuffer, const gnBuffer& buffer, gnSize offset, gnUInt drawCount, gnUInt stride);
inline void (*gnCommandDrawIndexed)(gnCommandBuffer& commandBuffer, gnUInt indexCount, gnUInt instanceCount, gnUInt firstIndex, gnInt vertexOffset, gnUInt firstInstance);
inline void (*gnCommandEndRenderPass)(gnCommandBuffer& commandBuffer);
inline void (*gnCommandBindBuffer)(gnCommandBuffer& commandBuffer, const gnBuffer& buffer);
inline void (*gnCommandBindBufferUniform)(gnCommandBuffer& commandBuffer, gnGraphicsPipeline& graphicsPipeline, gnBufferUniform& uniformBuffer, gnInt set);
inline void (*gnCommandBindSamplerUniform)(gnCommandBuffer& commandBuffer, const gnGraphicsPipeline& graphicsPipeline, const gnSamplerUniform& sampler, gnInt set);
inline void (*gnCommandPushConstant)(gnCommandBuffer& commandBuffer, const gnGraphicsPipeline& graphicsPipeline, const gnPushConstant& pushConstant, void* data);
inline gnReturnCode (*gnCommandBufferEnd)(gnCommandBuffer& commandBuffer);

View File

@@ -0,0 +1,21 @@
#pragma once
#include <gryphn/gryphn_utils.h>
struct gnPlatformCommandBuffer;
struct gnOutputDevice;
struct gnCommandBuffer {
ACCESS_LEVEL:
gnPlatformCommandBuffer* commandBuffer = nullptr;
public:
gnCommandBuffer() {}
};
inline gnReturnCode (*gnCreateCommandBuffer)(gnCommandBuffer* commandBuffer, const gnOutputDevice& outputDevice);
inline gnReturnCode (*_gnCreateCommandBuffers)(gnCommandBuffer* commandBuffers, gnUInt commandBufferCount, const gnOutputDevice& outputDevice);
inline void (*gnCommandBufferReset)(const gnCommandBuffer& commandBuffer);
inline void (*gnDestroyCommandBuffer)(const gnCommandBuffer& commandBuffer);
// because C doesnt support overloading this is how I am going to support overloading, fuck you
static inline gnReturnCode gnCreateCommandBuffers(gnList<gnCommandBuffer> *commandBuffers, const gnOutputDevice& outputDevice) { return _gnCreateCommandBuffers(gnListData(*commandBuffers), gnListLength(*commandBuffers), outputDevice); }
static inline gnReturnCode gnCreateCommandBuffers(std::vector<gnCommandBuffer>* commandBuffers, const gnOutputDevice &outputDevice) { return _gnCreateCommandBuffers(commandBuffers->data(), commandBuffers->size(), outputDevice); }

View File

@@ -0,0 +1,11 @@
#include "gryphn_command_present.h"
void gnCommandPresentDataSetSignalSemaphore(gnCommandPresentData& presentCommandData, gnSyncSemaphore& semaphore) {
presentCommandData.semaphore = &semaphore;
}
void gnCommandPresentDataSetPresentationQueue(gnCommandPresentData& presentCommandData, gnPresentationQueue& presentationQueue) {
presentCommandData.presentationQueue = &presentationQueue;
}
void gnCommandPresentDataSetImageIndex(gnCommandPresentData& presentCommandData, gnUInt* imageIndex) {
presentCommandData.imageIndex = imageIndex;
}

View File

@@ -0,0 +1,25 @@
#include <gryphn/gryphn_utils.h>
#include "core/sync_objects/gryphn_sync_semaphore.h"
#include "core/presentation_queue/gryphn_presentation_queue.h"
#include "core/presentation_queue/gryphn_present_queue_state.h"
struct gnPlatformCommandPresentData;
struct gnCommandBuffer;
struct gnCommandPresentData {
ACCESS_LEVEL:
gnPlatformCommandPresentData* commandPresentData = nullptr;
gnSyncSemaphore* semaphore;
gnPresentationQueue* presentationQueue;
gnUInt* imageIndex;
public:
gnCommandPresentData() {}
};
void gnCommandPresentDataSetSignalSemaphore(gnCommandPresentData& presentCommandData, gnSyncSemaphore& semaphore);
void gnCommandPresentDataSetPresentationQueue(gnCommandPresentData& presentCommandData, gnPresentationQueue& presentationQueue);
void gnCommandPresentDataSetImageIndex(gnCommandPresentData& presentCommandData, gnUInt* imageIndex);
inline gnPresentationQueueState (*gnCommandPresentGetValidPresentationQueue)(gnCommandPresentData& presentCommandData);
inline gnReturnCode (*gnCommandPresent)(gnCommandPresentData& presentCommandData);

View File

@@ -0,0 +1,11 @@
#include "gryphn_command_submit.h"
void gnCommandSubmitDataSetWaitSemaphore(gnCommandSubmitData& data, gnSyncSemaphore& semaphore) {
data.waitSemaphore = &semaphore;
}
void gnCommandSubmitDataSetCommandBuffer(gnCommandSubmitData& data, gnCommandBuffer& commandBuffer) {
data.commandBuffer = &commandBuffer;
}
void gnCommandSubmitDataSetSignalSemaphore(gnCommandSubmitData& data, gnSyncSemaphore& semaphore) {
data.signalSemaphore = &semaphore;
}

View File

@@ -0,0 +1,24 @@
#pragma once
#include <gryphn/gryphn_utils.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/presentation_queue/gryphn_present_queue_state.h"
struct gnPlatformCommandSubmitData;
struct gnCommandSubmitData {
ACCESS_LEVEL:
gnPlatformCommandSubmitData* commandSubmitData = nullptr;
gnSyncSemaphore *waitSemaphore = nullptr, *signalSemaphore = nullptr;
gnCommandBuffer* commandBuffer = nullptr;
public:
gnCommandSubmitData() {}
};
void gnCommandSubmitDataSetWaitSemaphore(gnCommandSubmitData& data, gnSyncSemaphore& semaphore);
void gnCommandSubmitDataSetCommandBuffer(gnCommandSubmitData& data, gnCommandBuffer& commandBuffer);
void gnCommandSubmitDataSetSignalSemaphore(gnCommandSubmitData& data, gnSyncSemaphore& semaphore);
inline gnPresentationQueueState (*gnCommandSubmitGetValidPresentationQueue)(gnCommandSubmitData& presentCommandData);
inline gnErrorCode (*gnCommandSubmit)(gnCommandSubmitData& data, const gnFence& fence);

View File

@@ -0,0 +1,9 @@
#include "gryphn_debugger.h"
void gnAddDebugLayer(gnDebugger& debugger, const gnString& layer) {
gnListAdd(debugger.debug_layers, layer);
}
const gnList<gnString>& gnDebuggerGetDebugLayers(gnDebugger& debugger) {
return debugger.debug_layers;
}

View File

@@ -0,0 +1,28 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include <iostream>
#include "gryphn_layers.h"
struct gnPlatformDebugger;
struct gnDebugger;
static gnDebugger* gnDebuggerInstance = nullptr;
inline void gnDebugError(gnString error);
struct gnDebugger {
ACCESS_LEVEL:
gnPlatformDebugger* debugger;
gnList<gnString> debug_layers = gnCreateList<gnString>();
public:
gnDebugger() {
if (debugger) gnDebugError("Debugger instance already created (you can only have one debugger)");
gnDebuggerInstance = this;
}
};
inline void gnDebugError(gnString error) { std::cout << gnToCString(error) << "\n"; }
void gnAddDebugLayer(gnDebugger& debugger, const gnString& layer);
const gnList<gnString>& gnDebuggerGetDebugLayers(gnDebugger& debugger);
inline gnReturnCode (*gnCreateDebugger)(gnDebugger* instance);
inline void (*gnDestroyDebugger)(gnDebugger& instance);

View File

@@ -0,0 +1,6 @@
#pragma once
#include <gryphn/gryphn_utils.h>
inline gnString (*gnGetPlatformLayerName)(const gnString& gnName);
#define GN_DEFAULT_DEBUG_LAYER gnGetPlatformLayerName("GN_DEFAULT_DEBUG_LAYER")

View File

@@ -0,0 +1,18 @@
#include "gryphn_framebuffer.h"
void gnFramebufferBindAtachment(gnFramebuffer& framebuffer, int index, gnFramebufferAttachment& attachment) {
if (index < gnListLength(framebuffer.framebufferAttachments)) {
gnListSet(framebuffer.framebufferAttachments, index, attachment);
} else {
gnListAdd(framebuffer.framebufferAttachments, attachment);
}
attachment.framebuffer = const_cast<gnFramebuffer*>(&framebuffer);
}
void gnFramebufferBindPresentationQueue(gnFramebuffer& framebuffer, gnPresentationQueue& queue) {
framebuffer.queue = &queue;
}
void gnFramebufferSetSize(gnFramebuffer& framebuffer, gnUInt2 size) {
framebuffer.size = {size.x, size.y};
}

View File

@@ -0,0 +1,24 @@
#pragma once
#include "gryphn_framebuffer_attachment.h"
#include <core/graphics_pipeline/gryphn_render_pass.h>
struct gnPlatformFramebuffer;
struct gnGraphicsPipeline;
struct gnFramebuffer {
ACCESS_LEVEL:
gnPlatformFramebuffer* framebuffer = nullptr;
gnList<gnFramebufferAttachment> framebufferAttachments = gnCreateList<gnFramebufferAttachment>(0);
gnPresentationQueue* queue;
gnUInt2 size;
public:
gnFramebuffer() {}
};
void gnFramebufferBindAtachment(gnFramebuffer& framebuffer, int index, gnFramebufferAttachment& attachment);
void gnFramebufferBindPresentationQueue(gnFramebuffer& framebuffer, gnPresentationQueue& queue);
void gnFramebufferSetSize(gnFramebuffer& framebuffer, gnUInt2 size);
inline gnReturnCode (*gnCreateFramebuffer)(gnFramebuffer* framebuffer, const gnRenderPass& pipeline);
inline void (*gnDestroyFramebuffer)(const gnFramebuffer& framebuffer);

View File

@@ -0,0 +1,17 @@
#include "gryphn_framebuffer_attachment.h"
void gnFramebufferAttachmentSetSize(gnFramebufferAttachment& framebuffer, gnUInt2 newSize) {
framebuffer.size = newSize;
}
void gnFramebufferAttachmentSetColorMode(gnFramebufferAttachment& framebuffer, gnColorMode newColorMode) {
framebuffer.colorMode = newColorMode;
}
void gnFramebufferAttachmentBindTexture(gnFramebufferAttachment& framebuffer, gnTexture* texture) {
framebuffer.texture = texture;
}
void gnFramebufferAttachmentSetBindPoint(gnFramebufferAttachment& framebuffer, gnFramebufferAttachmentBindPoint bindPoint) {
framebuffer.bindPoint = bindPoint;
}

View File

@@ -0,0 +1,31 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "core/presentation_queue/gryphn_presentation_queue.h"
#include <core/textures/gryphn_texture.h>
struct gnPlatformFramebufferAttachment;
struct gnFramebuffer;
enum gnFramebufferAttachmentBindPoint {
GN_COLOR_ATTACHMENT, GN_DEPTH_ATTACHMENT, GN_STENCIL_ATTACHMENT, GN_DEPTH_STENCIL_ATTACHMENT
};
struct gnFramebufferAttachment {
ACCESS_LEVEL:
gnPlatformFramebufferAttachment* framebufferAttachment = nullptr;
gnUInt2 size;
gnColorMode colorMode;
gnFramebufferAttachmentBindPoint bindPoint = GN_COLOR_ATTACHMENT;
gnTexture* texture;
gnFramebuffer* framebuffer;
public:
gnFramebufferAttachment() {}
};
void gnFramebufferAttachmentSetSize(gnFramebufferAttachment& framebuffer, gnUInt2 newSize);
void gnFramebufferAttachmentSetColorMode(gnFramebufferAttachment& framebuffer, gnColorMode newColorMode);
void gnFramebufferAttachmentSetBindPoint(gnFramebufferAttachment& framebuffer, gnFramebufferAttachmentBindPoint bindPoint);
void gnFramebufferAttachmentBindTexture(gnFramebufferAttachment& framebuffer, gnTexture* texture);
inline gnReturnCode (*gnCreateFramebufferAttachment)(gnFramebufferAttachment* attachment, gnPresentationQueue& queue);

View File

@@ -0,0 +1,35 @@
#pragma once
#include <gryphn/gryphn_utils.h>
// this shit is lowkey only supported in vulkan, I think, I know for sure that OpenGL does not support this
// - me in 2024
//
// Now that ive become a little more knowledgable I know that OpenGL automatically works with a dynamic pipeline and vulkan does not
// so im going to change this list of dynamic states and how all this shit works
typedef enum gnDynamicState {
GN_DYNAMIC_STATE_VIEWPORT = 0,
GN_DYNAMIC_STATE_SCISSOR = 1,
// GN_DYNAMIC_STATE_LINE_WIDTH = 2,
// GN_DYNAMIC_STATE_DEPTH_BIAS = 3,
// GN_DYNAMIC_STATE_BLEND_CONSTANTS = 4,
// GN_DYNAMIC_STATE_DEPTH_BOUNDS = 5,
// GN_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6,
// GN_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7,
// GN_DYNAMIC_STATE_STENCIL_REFERENCE = 8,
// GN_DYNAMIC_STATE_CULL_MODE = 9,
// GN_DYNAMIC_STATE_FRONT_FACE = 10,
// GN_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY = 11,
// GN_DYNAMIC_STATE_VIEWPORT_WITH_COUNT = 12,
// GN_DYNAMIC_STATE_SCISSOR_WITH_COUNT = 13,
// GN_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE = 14,
// GN_DYNAMIC_STATE_DEPTH_TEST_ENABLE = 15,
// GN_DYNAMIC_STATE_DEPTH_WRITE_ENABLE = 16,
// GN_DYNAMIC_STATE_DEPTH_COMPARE_OP = 17,
// GN_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE = 18,
// GN_DYNAMIC_STATE_STENCIL_TEST_ENABLE = 19,
// GN_DYNAMIC_STATE_STENCIL_OP = 20,
// GN_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE = 21,
// GN_DYNAMIC_STATE_DEPTH_BIAS_ENABLE = 22,
// GN_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE = 23
} gnDynamicState;

View File

@@ -0,0 +1,65 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_dynamic_state.h"
#include "gryphn_render_pass.h"
#include "core/shaders/gryphn_shader.h"
#include "core/buffers/vertex_descriptions/gryphn_vertex_description.h"
#include "core/push_constant/gryphn_push_constant.h"
#include <core/uniform_descriptor/gryphn_uniform.h>
// things that are needed for compilation
struct gnOutputDevice;
struct gnBufferDescription;
struct gnUniformLayout;
// thse are some dumb things that I figured that would make code look nicer
typedef enum {
GN_POINTS, GN_LINES, GN_LINE_STRIP, GN_TRIANGLES
} gnPrimative; // todo support more primative types
typedef enum {
GN_POLYGON_FILLMODE_FILL, GN_POLYGON_FILLMODE_LINES, GN_POLYGON_FILLMODE_POINTS
} gnFillMode;
typedef enum {
GN_CULL_NONE, GN_CULL_BACKFACE, GN_CULL_FRONTFACE
} gnCullMode; // idk why you would cull all but idk I added this
typedef enum {
GN_CLOCKWISE, GN_COUNTER_CLOCKWISE
} gnFrontFaceDirection;
struct gnPlatformGraphicsPipeline;
struct gnGraphicsPipeline {
ACCESS_LEVEL:
gnPlatformGraphicsPipeline* graphicsPipeline = nullptr;
gnPrimative primative;
gnRenderPass* renderPass;
std::vector<gnUniformLayout*> uniformLayouts = {};
std::vector<gnPushConstant*> pushConstants = {};
public:
gnGraphicsPipeline() {}
};
inline void (*gnGraphicsPipelineSetPrimative)(gnGraphicsPipeline& pipeline, gnPrimative primative);
inline void (*gnGraphicsPipelineEnableDynamicStates)(gnGraphicsPipeline& pipeline, const gnBool enable);
inline void (*gnGraphicsPipelineEnableDynamicState)(gnGraphicsPipeline& pipeline, const gnDynamicState state);
inline void (*_gnGraphicsPipelineSetViewport)(gnGraphicsPipeline& pipeline, gnUInt2 position, gnUInt2 size, gnFloat minDepth, gnFloat maxDepth);
inline static void gnGraphicsPipelineSetViewport(gnGraphicsPipeline& pipeline, gnUInt2 position, gnUInt2 size, gnFloat minDepth = 0.0f, gnFloat maxDepth = 1.0f) { _gnGraphicsPipelineSetViewport(pipeline, position, size, minDepth, maxDepth); }
inline void (*gnGraphicsPipelineSetCrop)(gnGraphicsPipeline& graphicsPipeline, gnInt2 position, gnUInt2 size);
inline void (*gnGraphicsPipelineSetDepthClamp)(gnGraphicsPipeline& graphicsPipeline, gnBool enableDepthClamp);
inline void (*gnGraphicsPipelineSetFillMode)(gnGraphicsPipeline& graphicsPipeline, gnFillMode fillMode);
inline void (*gnGraphicsPipelineSetLineWidth)(gnGraphicsPipeline& graphicsPipeline, gnFloat lineWidth);
inline void (*gnGraphicsPipelineSetCullMode)(gnGraphicsPipeline& graphicsPipeline, gnCullMode cullMode, gnFrontFaceDirection direction);
inline void (*gnGraphicsPipelineSetMultisampling)(gnGraphicsPipeline& graphicsPipeline, gnBool enableMultisampling);
inline void (*gnGraphicsPipelineEnableDepthTest)(gnGraphicsPipeline& graphicsPipeline, gnBool depthTest);
inline void (*gnGraphicsPipelineSetColorBlend)(gnGraphicsPipeline& graphicsPipeline, gnBool colorBlend);
inline void (*gnGraphicsPipelineSetVertexDescription)(gnGraphicsPipeline& graphicsPipeline, const gnVertexDescription& vertexDescription);
inline void (*gnGraphicsPipelineBindShader)(gnGraphicsPipeline& graphicsPipeline, const gnShader& shader);
inline void (*gnGraphicsPipelineSetRenderPass)(gnGraphicsPipeline& graphicsPipeline, gnRenderPass& renderpass);
inline void (*gnGraphicsPipelineAddUniformLayout)(gnGraphicsPipeline& graphicsPipeline, const gnUniformLayout& uniformLayout);
inline void (*gnGraphicsPipelineAddPushConstant)(gnGraphicsPipeline& graphicsPipeline, const gnPushConstant& pushConstant);
inline gnReturnCode (*gnCreateGraphicsPipeline)(gnGraphicsPipeline* graphicsPipeline, gnOutputDevice& outputDevice);
inline void (*gnDestroyGraphicsPipeline)(gnGraphicsPipeline& graphicsPipeline);

View File

@@ -0,0 +1,22 @@
#include "gryphn_render_pass.h"
void gnRenderPassAddSubpass(gnRenderPass& renderPass, gnSubpass& subpass) {
gnListAdd(renderPass.subpasses, &subpass);
}
void gnRenderPassSetPresentationQueue(gnRenderPass& renderPass, gnPresentationQueue& presentationQueue) {
renderPass.presentationQueue = &presentationQueue;
gnRenderPassSetTarget(renderPass, GN_PRESENTATION_QUEUE);
}
void gnRenderPassSetAttachments(gnRenderPass& renderPass, int count, gnRenderpassAttachment* attachments) {
renderPass.attachments = attachments;
renderPass.attachmentCount = count;
}
void gnRenderPassSetTarget(gnRenderPass& renderPass, gnRenderPassTarget target) {
renderPass.target = target;
}
void gnRenderpassAttachmentSetColorMode(gnRenderpassAttachment& attachment, gnColorMode colorMode) {
attachment.colorMode = colorMode;
}

View File

@@ -0,0 +1,34 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_subpass.h"
#include "gryphn_render_pass_attchment.h"
#include "core/presentation_queue/gryphn_presentation_queue.h"
struct gnPlatformRenderPass;
struct gnOutputDevice;
typedef enum {
GN_SHADER_READ, GN_PRESENTATION_QUEUE
} gnRenderPassTarget;
struct gnRenderPass {
ACCESS_LEVEL:
gnPlatformRenderPass* renderpass = nullptr;
gnList<gnSubpass*> subpasses;
gnPresentationQueue* presentationQueue = nullptr;
gnRenderpassAttachment* attachments = nullptr;
int attachmentCount = 0;
gnRenderPassTarget target;
public:
gnRenderPass() {}
};
void gnRenderPassAddSubpass(gnRenderPass& renderPass, gnSubpass& subpass);
void gnRenderPassSetPresentationQueue(gnRenderPass& renderPass, gnPresentationQueue& presentationQueue);
void gnRenderPassSetAttachments(gnRenderPass& renderPass, int count, gnRenderpassAttachment* attachments);
void gnRenderPassSetTarget(gnRenderPass& renderPass, gnRenderPassTarget target);
inline gnReturnCode (*gnCreateRenderPass)(gnRenderPass* renderPass, const gnOutputDevice& outputDevice);
inline void (*gnDestroyRenderPass)(gnRenderPass& renderPass);

View File

@@ -0,0 +1,15 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include <core/textures/gryphn_texture.h>
struct gnPlatformRenderpassAttachment;
struct gnRenderpassAttachment {
ACCESS_LEVEL:
gnPlatformRenderpassAttachment* renderpassAttachment = nullptr;
gnColorMode colorMode;
public:
gnRenderpassAttachment() {}
};
void gnRenderpassAttachmentSetColorMode(gnRenderpassAttachment& attachment, gnColorMode colorMode);

View File

@@ -0,0 +1,17 @@
#include "gryphn_render_pass_frame.h"
void gnRenderPassFrameSetRenderPass(gnRenderPassFrame& frame, gnRenderPass& renderPass) {
frame.renderPass = &renderPass;
}
void gnRenderPassFrameSetFramebuffer(gnRenderPassFrame& frame, gnFramebuffer& framebuffer) {
frame.framebuffer = &framebuffer;
}
void gnRenderPassFrameSetOffset(gnRenderPassFrame& frame, gnUInt2 offset) {
frame.offset = offset;
}
void gnRenderPassFrameSetRenderArea(gnRenderPassFrame& frame, gnUInt2 area) {
frame.area = area;
}
void gnRenderPassFrameSetClearColor(gnRenderPassFrame& frame, gnColor& clearColor) {
frame.clearColor = clearColor;
}

View File

@@ -0,0 +1,24 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_render_pass.h"
struct gnPlatformRenderPassFrame;
struct gnFramebuffer;
struct gnRenderPassFrame {
ACCESS_LEVEL:
gnPlatformRenderPassFrame* renderPassFrame = nullptr;
gnRenderPass* renderPass;
gnFramebuffer* framebuffer;
gnUInt2 offset;
gnUInt2 area;
gnColor clearColor;
public:
gnRenderPassFrame() {}
};
void gnRenderPassFrameSetRenderPass(gnRenderPassFrame& frame, gnRenderPass& renderPass);
void gnRenderPassFrameSetFramebuffer(gnRenderPassFrame& frame, gnFramebuffer& framebuffer);
void gnRenderPassFrameSetOffset(gnRenderPassFrame& frame, gnUInt2 offset);
void gnRenderPassFrameSetRenderArea(gnRenderPassFrame& frame, gnUInt2 area);
void gnRenderPassFrameSetClearColor(gnRenderPassFrame& frame, gnColor& clearColor);

View File

@@ -0,0 +1,13 @@
#pragma once
#include <gryphn/gryphn_utils.h>
struct gnPlatformSubpass;
// I only think that this is a thing in vulkan
// - greg, march 11th 7:15
struct gnSubpass {
ACCESS_LEVEL:
gnPlatformSubpass* subpass = nullptr;
public:
gnSubpass() {}
};

View File

@@ -0,0 +1,25 @@
#pragma once
#include "gryphn/gryphn_utils.h"
enum gnRenderingAPI {
GN_RENDERINGAPI_NONE, // idk why im putting this
GN_RENDERINGAPI_SOFTWARE, // i kinda wanna write a software renderer
GN_RENDERINGAPI_OPENGL,
GN_RENDERINGAPI_VULKAN,
GN_RENDERINGAPI_DIRECTX11, GN_RENDERINGAPI_DIRECTX12,
GN_RENDERINGAPI_METAL
};
inline gnString gnRenderingAPIName(gnRenderingAPI api) {
switch (api) {
case GN_RENDERINGAPI_NONE: return "GN_RENDERINGAPI_NONE";
case GN_RENDERINGAPI_SOFTWARE: return "GN_RENDERINGAPI_SOFTWARE";
case GN_RENDERINGAPI_OPENGL: return "GN_RENDERINGAPI_OPENGL";
case GN_RENDERINGAPI_VULKAN: return "GN_RENDERINGAPI_VULKAN";
case GN_RENDERINGAPI_DIRECTX11: return "GN_RENDERINGAPI_DIRECTX11";
case GN_RENDERINGAPI_DIRECTX12: return "GN_RENDERINGAPI_DIRECTX12";
case GN_RENDERINGAPI_METAL: return "GN_RENDERINGAPI_METAL";
}
return "GN_INVALID_API";
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include <gryphn/gryphn_utils.h>
typedef enum gnFeature {
GN_DYNAMIC_STATES, GN_SYNC_OBJECTS
} gnFeature;
inline gnBool (*gnAPISupports)(gnFeature feature);

View File

@@ -0,0 +1,154 @@
#include <core/init/gryphn_init.h>
#include <dlfcn.h>
#include <platform/gryphn_platform_include.h>
#include <algorithm>
#include <gryphn/gryphn.h>
bool RenderingAPISupported(gnRenderingAPI api) {
std::vector<gnRenderingAPI> supportedRenderingAPIS = gnGetSupportedRenderingAPIS();
return std::find(supportedRenderingAPIS.begin(), supportedRenderingAPIS.end(), api) != supportedRenderingAPIS.end();
}
static void* gnRenderingAPILIB;
//#define LOAD_FUNC(dll, func) gnPlatformLoadDLLFunction(dll, func, gnString(#func) + "Fn")
#define gnLoadDLLFunction(dll, func, func_name) \
gnPlatformLoadDLLFunction(dll, func, func_name); \
if (func == nullptr) return gnReturnError(gnString("GN_FUNC_(") + gnString(#func) + ")_NOT_LOADED")
gnReturnCode gnInit(gnRenderingAPI RenderingAPI) {
gnString libName = "";
switch (RenderingAPI) {
case GN_RENDERINGAPI_NONE: {
return { GN_FAILED, "GN_ERROR_RENDERINGAPI_NONE_UNSUPPORTED" };
}
case GN_RENDERINGAPI_SOFTWARE: {
return { GN_FAILED, "GN_ERROR_SOFRWARE_UNSUPPORTED" };
}
case GN_RENDERINGAPI_OPENGL: {
return { GN_FAILED, "GN_ERROR_OPENGL_UNSUPPORTED" };
}
case GN_RENDERINGAPI_VULKAN: {
if (!RenderingAPISupported(GN_RENDERINGAPI_VULKAN)) return { GN_FAILED, "GN_ERROR_VUKAN_UNSUPPORTED" };
libName = "GryphnVulkanImpl";
break;
}
case GN_RENDERINGAPI_DIRECTX11: {
return { GN_FAILED, "GN_ERROR_DIRECTX11_UNSUPPORTED" };
}
case GN_RENDERINGAPI_DIRECTX12: {
return { GN_FAILED, "GN_ERROR_DIRECTX12_UNSUPPORTED" };
}
case GN_RENDERINGAPI_METAL: {
if (!RenderingAPISupported(GN_RENDERINGAPI_METAL)) return { GN_FAILED, "GN_ERROR_METAL_UNSUPPORTED" };
libName = "GryphnMetalImpl";
break;
}
}
gnRenderingAPILIB = gnPlatformLoadDLL(gnString("gryphn/rendering_apis/") + libName);
if (!gnRenderingAPILIB) { return gnReturnError("GN_ERROR_UNABLE_TO_LOAD_DLL"); }
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateInstance, "gnCreateInstanceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyInstance, "gnDestroyInstanceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGetPlatformLayerName, "gnGetPlatformLayerNameFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnInstanceSetWindow, "gnInstanceSetWindowFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateDebugger, "gnCreateDebuggerFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyDebugger, "gnDestroyDebuggerFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGetPhysicalOutputDevices, "gnGetPhysicalOutputDevicesFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDeviceSupportsAPI, "gnDeviceSupportsAPIFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnRegisterOutputDevice, "gnRegisterOutputDeviceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnWaitForDevice, "gnWaitForDeviceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyOutputDevice, "gnDestroyOutputDeviceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGetDevicePresentationDetails, "gnGetDevicePresentationDetailsFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnPresentationQueueGetNextImageAsync, "gnPresentationQueueGetNextImageAsyncFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnPresentationQueueGetState, "gnPresentationQueueGetStateFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreatePresentationQueue, "gnCreatePresentationQueueFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyPresentationQueue, "gnDestroyPresentationQueueFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnVertexDescriptionSetBindingDescription, "gnVertexDescriptionSetBindingDescriptionFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnVertexDescriptionSetPropertiesCount, "gnVertexDescriptionSetPropertiesCountFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnVertexDescriptionSetProperty, "gnVertexDescriptionSetPropertyFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateBuffer, "gnCreateBufferFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnBufferData, "gnBufferDataFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnBufferMapData, "gnBufferMapDataFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyBuffer, "gnDestroyBufferFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnBufferSubData, "gnBufferSubDataFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnBufferClearData, "gnBufferClearDataFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnTextureData, "gnTextureDataFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnTextureCubeMapData, "gnTextureCubeMapDataFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateTexture, "gnCreateTextureFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyTexture, "gnDestroyTextureFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateUniformLayout, "gnCreateUniformLayoutFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyUniformLayout, "gnDestroyUniformLayoutFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateRenderPass, "gnCreateRenderPassFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyRenderPass, "gnDestroyRenderPassFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateFence, "gnCreateFenceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnWaitForFence, "gnWaitForFenceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnResetFence, "gnResetFenceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyFence, "gnDestroyFenceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateCommandBuffer, "gnCreateCommandBufferFn");
gnLoadDLLFunction(gnRenderingAPILIB, _gnCreateCommandBuffers, "_gnCreateCommandBuffersFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandBufferReset, "gnCommandBufferResetFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyCommandBuffer, "gnDestroyCommandBufferFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnBuildShaderModule, "gnBuildShaderModuleFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyShaderModule, "gnDestroyShaderModuleFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnBuildShader, "gnBuildShaderFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateUniform, "gnCreateUniformFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyUniform, "gnDestroyUniformFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnUpdateSamplerUniform, "gnUpdateSamplerUniformFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnUpdateBufferUniform, "gnUpdateBufferUniformFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnAPISupports, "gnAPISupportsFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetPrimative, "gnGraphicsPipelineSetPrimativeFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineEnableDynamicStates, "gnGraphicsPipelineEnableDynamicStatesFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineEnableDynamicState, "gnGraphicsPipelineEnableDynamicStateFn");
gnLoadDLLFunction(gnRenderingAPILIB, _gnGraphicsPipelineSetViewport, "_gnGraphicsPipelineSetViewportFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetCrop, "gnGraphicsPipelineSetCropFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetDepthClamp, "gnGraphicsPipelineSetDepthClampFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetFillMode, "gnGraphicsPipelineSetFillModeFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetLineWidth, "gnGraphicsPipelineSetLineWidthFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetCullMode, "gnGraphicsPipelineSetCullModeFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetMultisampling, "gnGraphicsPipelineSetMultisamplingFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineEnableDepthTest, "gnGraphicsPipelineEnableDepthTestFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetColorBlend, "gnGraphicsPipelineSetColorBlendFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetVertexDescription, "gnGraphicsPipelineSetVertexDescriptionFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineBindShader, "gnGraphicsPipelineBindShaderFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineSetRenderPass, "gnGraphicsPipelineSetRenderPassFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineAddUniformLayout, "gnGraphicsPipelineAddUniformLayoutFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGraphicsPipelineAddPushConstant, "gnGraphicsPipelineAddPushConstantFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateGraphicsPipeline, "gnCreateGraphicsPipelineFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyGraphicsPipeline, "gnDestroyGraphicsPipelineFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateFramebuffer, "gnCreateFramebufferFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyFramebuffer, "gnDestroyFramebufferFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateFramebufferAttachment, "gnCreateFramebufferAttachmentFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateSyncSemaphore, "gnCreateSyncSemaphoreFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroySyncSemaphore, "gnDestroySyncSemaphoreFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandBufferStart, "gnCommandBufferStartFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandBufferEnd, "gnCommandBufferEndFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandBeginRenderPass, "gnCommandBeginRenderPassFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandSetGraphicsPipeline, "gnCommandSetGraphicsPipelineFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandBindSamplerUniform, "gnCommandBindSamplerUniformFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandBindBuffer, "gnCommandBindBufferFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandBindBufferUniform, "gnCommandBindBufferUniformFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandPushConstant, "gnCommandPushConstantFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandDrawIndexed, "gnCommandDrawIndexedFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandSetViewport, "gnCommandSetViewportFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandSetScissor, "gnCommandSetScissorFn");
gnLoadDLLFunction(gnRenderingAPILIB, _gnCommandDraw, "gnCommandDrawFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandEndRenderPass, "gnCommandEndRenderPassFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandSubmitGetValidPresentationQueue, "gnCommandSubmitGetValidPresentationQueueFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandSubmit, "gnCommandSubmitFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandPresentGetValidPresentationQueue, "gnCommandPresentGetValidPresentationQueueFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnCommandPresent, "gnCommandPresentFn");
// fucking hell I just realized that I do have to load in all the commands
// I hate the way I chose to do this
return GN_SUCCESS;
}
void gnDestroy() {
dlclose(gnRenderingAPILIB);
}

View File

@@ -0,0 +1,10 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include <core/gryphn_rendering_api.h>
gnErrorCode gnInit(gnRenderingAPI RenderingAPI);
void gnDestroy();
inline gnString cachePath;
static void gnSetCachePath(const gnString& path) { cachePath = path; }
static const gnString& gnGetCachePath() { return cachePath; }

View File

@@ -0,0 +1,10 @@
#pragma once
#include <gryphn/gryphn_utils.h>
struct gnAppInfo {
public:
gnString ApplicationName;
gnString EngineName;
gnVersion ApplicationVersion;
gnVersion EngineVersion;
};

View File

@@ -0,0 +1,9 @@
#include "gryphn_instance.h"
void gnInstanceSetDebugger(gnInstance& instance, gnDebugger& debugger) {
instance.debugger = &debugger;
}
void gnInstanceSetAppInfo(gnInstance& instance, const gnAppInfo info) {
instance.AppInfo = info;
}

View File

@@ -0,0 +1,29 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "application_information/gryphn_app_info.h"
#include "core/debugger/gryphn_debugger.h"
#include <core/output_device/gryphn_output_device.h>
class GLFWwindow;
struct gnPlatformInstanceData;
struct gnInstance {
ACCESS_LEVEL:
bool valid = false;
gnPlatformInstanceData* instance = nullptr;
gnAppInfo AppInfo;
gnDebugger* debugger;
public:
gnInstance() {}
};
void gnInstanceSetAppInfo(gnInstance& instance, const gnAppInfo info);
void gnInstanceSetDebugger(gnInstance& instance, gnDebugger& debugger);
inline gnReturnCode (*gnCreateInstance)(gnInstance* instance);
inline void (*gnDestroyInstance)(gnInstance& instance);
inline gnReturnCode (*gnInstanceSetWindow)(gnInstance& instance, GLFWwindow* window);
// TODO: if instance creation fails add in a query to why the instance creation failed
// Lowkey thats a lot of work tho and I dont really want to do alllllll that

View File

@@ -0,0 +1,19 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_physical_output_device.h"
struct gnPlatformOutputDevice;
struct gnPhysicalOutputDevice;
struct gnInstance;
struct gnOutputDevice {
ACCESS_LEVEL:
gnPlatformOutputDevice* outputDevice = nullptr;
gnPhysicalOutputDevice* physicalOutputDevice;
public:
gnOutputDevice() {}
};
inline gnReturnCode (*gnRegisterOutputDevice)(gnOutputDevice* outputDevice, const gnInstance& instance, const gnPhysicalOutputDevice& physicalDevice);
inline void (*gnWaitForDevice)(const gnOutputDevice& device);
inline void (*gnDestroyOutputDevice)(gnOutputDevice& device);

View File

@@ -0,0 +1,3 @@
#include "gryphn_physical_output_device.h"
gnString gnGetPhysicalOutputDeviceName(const gnPhysicalOutputDevice& device) { return device.outputDeviceName; }

View File

@@ -0,0 +1,19 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "core/instance/gryphn_instance.h"
struct gnPlatformPhysicalOutputDevice;
struct gnInstance;
struct gnPhysicalOutputDevice {
ACCESS_LEVEL:
bool valid = false;
gnPlatformPhysicalOutputDevice* physicalOutputDevice = nullptr;
gnString outputDeviceName;
public:
gnPhysicalOutputDevice() {}
};
gnString gnGetPhysicalOutputDeviceName(const gnPhysicalOutputDevice& device);
inline bool (*gnDeviceSupportsAPI)(const gnPhysicalOutputDevice& device);
inline gnList<gnPhysicalOutputDevice> (*gnGetPhysicalOutputDevices)(const gnInstance& instance);

View File

@@ -0,0 +1,9 @@
#pragma once
#include "../output_device/gryphn_physical_output_device.h"
struct gnDevicePresentationDetails {
public:
int MinimumImageCount, MaximumImageCount;
};
inline gnDevicePresentationDetails (*gnGetDevicePresentationDetails)(const gnPhysicalOutputDevice& physicalOutputDevice);

View File

@@ -0,0 +1,5 @@
#pragma once
enum gnPresentationQueueState {
GN_OUT_OF_DATE, GN_SUBOPTIMAL, GN_VALID
};

View File

@@ -0,0 +1,7 @@
#pragma once
#include <gryphn/gryphn_utils.h>
struct gnPresentationDetails {
gnUInt ImageCount;
gnUInt2 ImageSize;
};

View File

@@ -0,0 +1,6 @@
#include "gryphn_presentation_queue.h"
gnTexture* gnGetPresentationQueueImage(gnPresentationQueue& presentationQueue, int index) {
// if (index < gnListLength(presentationQueue.images))
return gnListGetPtr(presentationQueue.images, index); // zero fucking error checking in this file, im not doing that shit
}

View File

@@ -0,0 +1,31 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_presentation_details.h"
#include "core/output_device/gryphn_output_device.h"
#include "core/sync_objects/gryphn_sync_semaphore.h"
#include "gryphn_present_queue_state.h"
#include "core/textures/gryphn_texture.h"
#include "gryphn_device_presentation_details.h"
struct gnPlatformPresentationQueue;
struct gnPresentationQueue {
ACCESS_LEVEL:
gnPlatformPresentationQueue* presentationQueue;
bool valid = false;
gnList<gnTexture> images = gnCreateList<gnTexture>();
public:
gnPresentationQueue() {}
};
gnTexture* gnGetPresentationQueueImage(gnPresentationQueue& presentationQueue, int index);
inline gnReturnCode (*gnCreatePresentationQueue)(gnPresentationQueue* presentationQueue, const gnOutputDevice& device, gnPresentationDetails& details);
inline void (*gnDestroyPresentationQueue)(gnPresentationQueue& queue);
inline gnImageFormat (*_gnPresentationQueueGetImageFormat)(gnPresentationQueue& presentationQueue);
inline gnImageFormat gnPresentationQueueGetImageFormat(gnPresentationQueue& presentationQueue) {
std::cout << "gnPresentationQueueGetImageFormat should lowkey become supported\n";
return _gnPresentationQueueGetImageFormat(presentationQueue);
}
inline gnPresentationQueueState (*gnPresentationQueueGetState)(gnPresentationQueue& presentationQueue);
inline gnReturnCode (*gnPresentationQueueGetNextImageAsync)(gnPresentationQueue& presentationQueue, const gnSyncSemaphore& semaphore, gnUInt* imageIndex);

View File

@@ -0,0 +1,11 @@
#include "gryphn_push_constant.h"
void gnPushConstantSetShaderStage(gnPushConstant& pushConstant, gnShaderModuleStage stage) {
pushConstant.stage = stage;
}
void gnPushConstantSetOffset(gnPushConstant& pushConstant, gnSize offset){
pushConstant.offset = offset;
}
void gnPushConstantSetSize(gnPushConstant& pushConstant, gnSize size) {
pushConstant.size = size;
}

View File

@@ -0,0 +1,19 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "core/shaders/gryphn_shader_module.h"
struct gnPlatformPushConstant;
struct gnPushConstant {
ACCESS_LEVEL:
gnPlatformPushConstant* pushConstant = nullptr;
gnShaderModuleStage stage = 0;
gnSize offset = 0;
gnSize size = 0;
public:
gnPushConstant() {}
};
void gnPushConstantSetShaderStage(gnPushConstant& pushConstant, gnShaderModuleStage stage);
void gnPushConstantSetOffset(gnPushConstant& pushConstant, gnSize offset);
void gnPushConstantSetSize(gnPushConstant& pushConstant, gnSize size);

View File

@@ -0,0 +1,3 @@
#include "gryphn_shader.h"
void gnShaderAddModule(gnShader& shader, gnShaderModule& module) { gnListAdd(shader.shaderModules, module); }

View File

@@ -0,0 +1,18 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_shader_module.h"
struct gnPlatformShader;
struct gnShader {
ACCESS_LEVEL:
gnPlatformShader* shader;
gnList<gnShaderModule> shaderModules = gnCreateList<gnShaderModule>();
public:
gnShader() {}
};
void gnShaderAddModule(gnShader& shader, gnShaderModule& module);
inline gnReturnCode (*gnBuildShader)(gnShader* shader);
inline void (*gnShaderDestroyModules)(gnShader& shader);

View File

@@ -0,0 +1,23 @@
#include "gryphn_shader_module.h"
void gnSetShaderModuleType(gnShaderModule& module, gnShaderModuleStage shaderModuleType) {
module.shaderType = shaderModuleType;
}
void gnSetShaderModuleUse(gnShaderModule& module, gnShaderUse shaderUse) {
module.shaderUse = shaderUse;
}
void gnSetShaderModuleCode(gnShaderModule& module, gnList<gnByte>& shaderModuleCode) {
module.codeSize = gnListLength(shaderModuleCode);
module.shaderData = gnListData(shaderModuleCode);
}
void gnSetShaderModuleCode(gnShaderModule& module, gnList<gnByte> shaderModuleCode) {
module.codeSize = gnListLength(shaderModuleCode);
module.shaderData = gnListData(shaderModuleCode);
}
void gnSetShaderModuleCode(gnShaderModule& module, const std::vector<char>& shaderModuleCode) {
module.codeSize = shaderModuleCode.size();
module.shaderData = const_cast<gnChar*>(shaderModuleCode.data());
}
gnBool gnContainsShaderStage(gnShaderModuleStage stage, gnShaderModuleStage stageToContain);

View File

@@ -0,0 +1,42 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "core/output_device/gryphn_output_device.h"
#include <vector>
typedef gnUByte gnShaderModuleStage;
#define GN_VERTEX_SHADER_MODULE 0x01
#define GN_FRAGMENT_SHADER_MODULE 0x10
typedef gnUInt gnShaderUse;
#define GN_GRAPHICS_PIPELINE 0
inline gnBool gnContainsShaderStage(gnShaderModuleStage stage, gnShaderModuleStage stageToContain) {
if ((stage & stageToContain) == stageToContain) return true;
return false;
}
struct gnPlatformShaderModule;
struct gnShaderModule {
ACCESS_LEVEL:
gnPlatformShaderModule* shaderModule = nullptr;
gnShaderModuleStage shaderType;
gnShaderUse shaderUse = GN_GRAPHICS_PIPELINE;
int codeSize = -1;
gnByte* shaderData = nullptr;
bool valid = false;
public:
gnShaderModule() {}
};
void gnSetShaderModuleType(gnShaderModule& module, gnShaderModuleStage shaderModuleType);
void gnSetShaderModuleUse(gnShaderModule& module, gnShaderUse shaderUse);
void gnSetShaderModuleCode(gnShaderModule& module, gnList<gnByte>& shaderModuleCode);
void gnSetShaderModuleCode(gnShaderModule& module, gnList<gnByte> shaderModuleCode);
void gnSetShaderModuleCode(gnShaderModule& module, const std::vector<char>& shaderModuleCode);
inline gnReturnCode (*gnBuildShaderModule)(gnShaderModule* module, const gnOutputDevice& outputDevice);
inline void (*gnDestroyShaderModule)(gnShaderModule& module);

View File

@@ -0,0 +1,17 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "core/output_device/gryphn_output_device.h"
struct gnPlatformFence;
struct gnFence {
ACCESS_LEVEL:
gnPlatformFence* fence = nullptr;
public:
gnFence() {}
};
inline gnReturnCode (*gnCreateFence)(gnFence* fence, const gnOutputDevice& device);
inline void (*gnWaitForFence)(const gnFence& fence);
inline void (*gnResetFence)(gnFence& fence);
inline void (*gnDestroyFence)(gnFence& fence);

View File

@@ -0,0 +1,15 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "core/output_device/gryphn_output_device.h"
struct gnPlatformSyncSemaphore;
struct gnSyncSemaphore {
ACCESS_LEVEL:
gnPlatformSyncSemaphore* semaphore = nullptr;
public:
gnSyncSemaphore() {}
};
inline gnReturnCode (*gnCreateSyncSemaphore)(gnSyncSemaphore* semaphore, const gnOutputDevice& device);
inline void (*gnDestroySyncSemaphore)(const gnSyncSemaphore& semaphore);

View File

@@ -0,0 +1,24 @@
#include "gryphn_texture.h"
void gnTextureSetType(gnTexture& texture, gnTextureType type) {
texture.textureType = type;
}
void gnTextureSetFormat(gnTexture& texture, gnColorMode format) {
texture.textureColorFormat = format;
}
void gnTextureSetExtent(gnTexture& texture, gnUInt2 extent) {
texture.textureExtent = extent;
}
void gnTextureSetDataSize(gnTexture& texture, gnUInt dataSize) {
texture.dataSize = dataSize;
}
void gnTextureSetMinFilter(gnTexture& texture, gnTextureFilter filter) {
texture.minFilter = filter;
}
void gnTextureSetMagFilter(gnTexture& texture, gnTextureFilter filter) {
texture.magFilter = filter;
}
// int gnTexture::currentTextureID = 0;
gnUInt gnGetTextureID(const gnTexture& texture) { return texture.TextureID; }

View File

@@ -0,0 +1,48 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "core/output_device/gryphn_output_device.h"
enum gnTextureType {
GN_TEXTURE_2D = 0, GN_TEXTURE_CUBE_MAP = 1
};
enum gnTextureFilter {
GN_FILTER_LINEAR = 0, GN_FILTER_NEAREST = 1
};
struct gnPlatformTexture;
static int currentTextureID = 0;
struct gnTexture {
ACCESS_LEVEL:
gnPlatformTexture* texture = nullptr;
gnTextureType textureType;
gnColorMode textureColorFormat;
gnUInt2 textureExtent;
gnTextureFilter minFilter = GN_FILTER_LINEAR;
gnTextureFilter magFilter = GN_FILTER_LINEAR;
gnUInt dataSize;
gnUInt TextureID;
public:
gnTexture() {
// I should handle this somewhere else but im not going to
TextureID = currentTextureID;
currentTextureID++;
}
};
void gnTextureSetType(gnTexture& texture, gnTextureType type);
void gnTextureSetFormat(gnTexture& texture, gnColorMode format);
void gnTextureSetExtent(gnTexture& texture, gnUInt2 extent);
inline void gnTextureSetSize(gnTexture& texture, gnUInt2 size) { gnTextureSetExtent(texture, size); }
void gnTextureSetMinFilter(gnTexture& texture, gnTextureFilter filter);
void gnTextureSetMagFilter(gnTexture& texture, gnTextureFilter filter);
gnUInt gnGetTextureID(gnTexture& texture);
inline void (*gnTextureData)(gnTexture& texture, gnSize dataSize, const void* data);
inline void (*gnTextureCubeMapData)(gnTexture& texture, gnSize imageDataSize, void* face1, void* face2, void* face3, void* face4, void* face5, void* face6);
inline gnErrorCode (*gnCreateTexture)(gnTexture* texture, const gnOutputDevice& outputDevice);
inline void (*gnDestroyTexture)(gnTexture& texture);

View File

@@ -0,0 +1,8 @@
#include "gryphn_uniform.h"
void gnUniformSetCount(gnUniform& uniform, gnUInt count) {
uniform.descriptorCount = count;
}
void gnUniformSetLayout(gnUniform& uniform, gnUniformLayout* uniformLayout) {
uniform.uniformLayout = uniformLayout;
}

View File

@@ -0,0 +1,19 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_uniform_layout.h"
struct gnPlatformUniform;
struct gnUniform {
ACCESS_LEVEL:
gnPlatformUniform* uniform = nullptr;
gnUniformLayout* uniformLayout;
int descriptorCount;
public:
gnUniform() {}
};
void gnUniformSetCount(gnUniform& uniform, gnUInt count);
void gnUniformSetLayout(gnUniform& uniform, gnUniformLayout* uniformLayout);
inline gnReturnCode (*gnCreateUniform)(gnUniform* uniform, gnOutputDevice& outputDevice);
inline void (*gnDestroyUniform)(gnUniform& uniform);

View File

@@ -0,0 +1,20 @@
#include "gryphn_uniform_layout.h"
void gnUniformLayoutBindingSetBinding(gnUniformLayoutBinding& uniformLayoutBinding, gnUInt binding) {
uniformLayoutBinding.binding = binding;
}
void gnUniformLayoutBindingSetShaderStage(gnUniformLayoutBinding& uniformLayoutBinding, gnShaderModuleStage stage) {
uniformLayoutBinding.stage = stage;
}
void gnUniformLayoutBindingSetType(gnUniformLayoutBinding& uniformLayoutBinding, gnUniformLayoutBindingType type) {
uniformLayoutBinding.type = type;
}
void gnUniformLayoutAddBinding(gnUniformLayout& uniformLayout, gnUniformLayoutBinding binding) {
uniformLayout.bindings.push_back(binding);
}
std::vector<gnUniformLayoutBinding> gnUniformLayoutGetBindings(gnUniformLayout& uniformLayout) {
return uniformLayout.bindings;
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "gryphn_uniform_layout_binding.h"
struct gnPlatformUniformLayout;
struct gnUniformLayout {
ACCESS_LEVEL:
gnPlatformUniformLayout* uniformLayout = nullptr;
std::vector<gnUniformLayoutBinding> bindings;
public:
gnUniformLayout() {}
};
void gnUniformLayoutAddBinding(gnUniformLayout& uniformLayout, gnUniformLayoutBinding binding);
std::vector<gnUniformLayoutBinding> gnUniformLayoutGetBindings(gnUniformLayout& uniformLayout);
inline gnReturnCode (*gnCreateUniformLayout)(gnUniformLayout* uniformLayout, gnOutputDevice& device);
inline void (*gnDestroyUniformLayout)(gnUniformLayout& uniformLayout);

View File

@@ -0,0 +1,24 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include <core/shaders/gryphn_shader.h>
struct gnPlatformUniformLayoutBinding;
typedef int gnUniformLayoutBindingType;
#define GN_UNIFORM_BUFFER_DESCRIPTOR 0
#define GN_SAMPLER_DESCRIPTOR 1
struct gnUniformLayoutBinding {
ACCESS_LEVEL:
gnPlatformUniformLayoutBinding* uniformLayoutBinding;
gnUInt binding = 0;
gnShaderModuleStage stage = GN_VERTEX_SHADER_MODULE;
gnUniformLayoutBindingType type = GN_UNIFORM_BUFFER_DESCRIPTOR;
public:
gnUniformLayoutBinding() {}
};
void gnUniformLayoutBindingSetBinding(gnUniformLayoutBinding& uniformLayoutBinding, gnUInt binding);
void gnUniformLayoutBindingSetShaderStage(gnUniformLayoutBinding& uniformLayoutBinding, gnShaderModuleStage stage);
void gnUniformLayoutBindingSetType(gnUniformLayoutBinding& uniformLayoutBinding, gnUniformLayoutBindingType type);

View File

@@ -0,0 +1,17 @@
#include "gryphn_sampler.h"
void gnSamplerUniformSetTexture(gnSamplerUniform& samplerUniform, const gnTexture& texture) {
samplerUniform.texture = const_cast<gnTexture*>(&texture);
}
void gnSamplerUniformSetTexture(gnSamplerUniform& samplerUniform, const gnTexture* texture) {
samplerUniform.texture = texture;
}
void gnSamplerUniformSetBinding(gnSamplerUniform& samplerUniform, gnUInt binding) {
samplerUniform.binding = binding;
}
void gnSamplerUniformSetUniformIndex(gnSamplerUniform& samplerUniform, gnUInt index) {
samplerUniform.index = index;
}
void gnSamplerUniformSetUniform(gnSamplerUniform& samplerUniform, const gnUniform& uniformDescriptor) {
samplerUniform.uniform = const_cast<gnUniform*>(&uniformDescriptor);
}

View File

@@ -0,0 +1,25 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "../gryphn_uniform.h"
#include "core/textures/gryphn_texture.h"
struct gnPlatformSamplerUniform;
struct gnSamplerUniform {
ACCESS_LEVEL:
gnPlatformSamplerUniform* samplerUniform = nullptr;
const gnTexture* texture;
gnUInt binding = 0;
gnUInt index = 0;
gnUniform* uniform;
public:
gnSamplerUniform() {}
};
void gnSamplerUniformSetTexture(gnSamplerUniform& samplerUniform, const gnTexture& texture);
void gnSamplerUniformSetTexture(gnSamplerUniform& samplerUniform, const gnTexture* texture);
void gnSamplerUniformSetBinding(gnSamplerUniform& samplerUniform, gnUInt binding);
void gnSamplerUniformSetUniformIndex(gnSamplerUniform& samplerUniform, gnUInt index);
void gnSamplerUniformSetUniform(gnSamplerUniform& samplerUniform, const gnUniform& uniformDescriptor);
inline void (*gnUpdateSamplerUniform)(gnSamplerUniform& samplerUniform, const gnOutputDevice& outputDevice);

View File

@@ -0,0 +1,35 @@
#include "gryphn_uniform_buffer.h"
void gnBufferUniformBindBuffer(gnBufferUniform& uniformBuffer, const gnBuffer& buffer) { uniformBuffer.buffer = const_cast<gnBuffer*>(&buffer); }
void gnBufferUniformSetSize(gnBufferUniform& uniformBuffer, gnSize size) { uniformBuffer.size = size; }
void gnBufferUniformSetOffset(gnBufferUniform& uniformBuffer, gnSize offset) { uniformBuffer.offset = offset; }
void gnBufferUniformSetBinding(gnBufferUniform& uniformBuffer, gnUInt binding) { uniformBuffer.binding = binding; }
void gnBufferUniformSetUniformIndex(gnBufferUniform& uniformBuffer, gnUInt index) { uniformBuffer.index = index; }
void gnBufferUniformSetUniform(gnBufferUniform& uniformBuffer, const gnUniform& uniform) { uniformBuffer.uniform = const_cast<gnUniform*>(&uniform); }
// void gnUniformBufferBindBuffer(const gnUniformBuffer& uniformBuffer, const gnBuffer& buffer) {
// const_cast<gnUniformBuffer*>(&uniformBuffer)->buffer = const_cast<gnBuffer*>(&buffer);
// }
// void gnUniformBufferSetSize(const gnUniformBuffer& uniformBuffer, gnSize size) {
// const_cast<gnUniformBuffer*>(&uniformBuffer)->size = size;
// }
// void gnUniformBufferSetOffset(const gnUniformBuffer& uniformBuffer, gnSize offset) {
// const_cast<gnUniformBuffer*>(&uniformBuffer)->offset = offset;
// }
// void gnUniformBufferSetBinding(const gnUniformBuffer& uniformBuffer, gnUInt binding) {
// const_cast<gnUniformBuffer*>(&uniformBuffer)->binding = binding;
// }
// void gnUniformBufferSetDescriptorIndex(const gnUniformBuffer& uniformBuffer, gnUInt index) {
// const_cast<gnUniformBuffer*>(&uniformBuffer)->index = index;
// }
// void gnUniformBufferSetDescriptorSet(const gnUniformBuffer& uniformBuffer, const gnDescriptorSet& descriptorSet) {
// const_cast<gnUniformBuffer*>(&uniformBuffer)->descriptorSet = const_cast<gnDescriptorSet*>(&descriptorSet);
// }
// /// I HAVE NO FUCKING CLUE WHAT THIS GOD DAMN FUNCITON EVER DID AND IF IT WILL EVER DO ANYTHING AGAIN
// void gnUniformBufferSetDescriptor(const gnUniformBuffer& uniformBuffer, const gnBufferDescription& bufferDescription) {
// //const_cast<gnUniformBuffer*>(&uniformBuffer)->bufferDescription = const_cast<gnBufferDescription*>(&bufferDescription);
// }

View File

@@ -0,0 +1,28 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "../gryphn_uniform.h"
#include "core/buffers/gryphn_buffer.h"
struct gnPlatformBufferUniform;
struct gnBufferUniform {
ACCESS_LEVEL:
gnPlatformBufferUniform* bufferUniform = nullptr;
gnSize size = 0;
gnSize offset = 0;
gnUInt binding = 0;
gnUInt index = 0;
gnBuffer* buffer = nullptr;
gnUniform* uniform;
public:
gnBufferUniform() {}
};
void gnBufferUniformBindBuffer(gnBufferUniform& uniformBuffer, const gnBuffer& buffer);
void gnBufferUniformSetSize(gnBufferUniform& uniformBuffer, gnSize size);
void gnBufferUniformSetOffset(gnBufferUniform& uniformBuffer, gnSize offset);
void gnBufferUniformSetBinding(gnBufferUniform& uniformBuffer, gnUInt binding);
void gnBufferUniformSetUniformIndex(gnBufferUniform& uniformBuffer, gnUInt index);
void gnBufferUniformSetUniform(gnBufferUniform& uniformBuffer, const gnUniform& uniform);
inline void (*gnUpdateBufferUniform)(gnBufferUniform& uniformBuffer, const gnOutputDevice& outputDevice);

View File

@@ -0,0 +1,20 @@
#pragma once
#ifdef GN_PLATFORM_LINUX
#include <platform/platform_linux/gryphn_platform_linux.h>
#elif GN_PLATFORM_MACOS
#include <platform/platform_macos/gryphn_platform_macos.h>
#elif GN_PLATFORM_WINDOWS
#include <platform/platform_windows/gryphn_platform_windows.h>
#endif
#include <core/gryphn_rendering_api.h>
std::vector<gnRenderingAPI> gnGetSupportedRenderingAPIS();
void* gnPlatformLoadDLL(gnString name);
void* gnLoadFunctionPtr(void* dll, gnString name);
template <typename function>
void gnPlatformLoadDLLFunction(void *dll, function& func, gnString name) {
func = (function)gnLoadFunctionPtr(dll, name);
}

View File

@@ -0,0 +1,17 @@
#ifdef GN_PLATFORM_MACOS
#include <platform/platform_macos/gryphn_platform_macos.h>
#include <dlfcn.h>
std::vector<gnRenderingAPI> gnGetSupportedRenderingAPIS() {
return { GN_RENDERINGAPI_METAL, GN_RENDERINGAPI_VULKAN };
}
void* gnPlatformLoadDLL(gnString name) {
return dlopen(gnToCString(name + ".dylib"), RTLD_LAZY);
}
void* gnLoadFunctionPtr(void *dll, gnString name) {
return dlsym(dll, gnToCString(name));
}
#endif

View File

@@ -0,0 +1,5 @@
#pragma once
#include <core/gryphn_rendering_api.h>
#include <utils/strings/gryphn_string.h>
#include <vector>
#include <dlfcn.h>

View File

@@ -0,0 +1,49 @@
#include "gryphn_file.h"
#include "fstream"
#include "iostream"
gnFile gnLoadFile(const gnString& path, gnFileType type) {
gnFile new_file = gnFile();
if (type == gnFileType::Text) {
std::ifstream file(gnToCString(path));
if (!file.is_open()) throw std::runtime_error("failed to open text file!"); // thats right I wont use std::vector but il use std::runtime_error my priorities are straight
// not as straight as me around ethan mooney, il see myself out now. (PS i actually did go to bed these will stop now)
std::string line;
while(std::getline(file, line)) {
gnListAdd(new_file.lines, gnCreateString(line.c_str()));
}
} else if (type == gnFileType::Binary) {
std::ifstream file(gnToCString(path), std::ios::ate | std::ios::binary);
if (!file.is_open()) throw std::runtime_error("failed to open file!");
size_t file_size = (size_t)file.tellg();
new_file.bytes = gnCreateList<gnChar>(file_size);
file.seekg(0);
file.read(gnListData(new_file.bytes), file_size);
file.close(); // straight from vulkan-tutorial.com, not as strai, imma stop myself now
}
new_file.path = path;
return new_file;
}
gnString gnGetFileData(const gnFile& file) {
gnString file_data;
for (int i = 0; i < gnListLength(file.lines); i++) {
file_data += gnListGet(file.lines, i) + '\n';
}
return file_data;
} // why I dont just return the file as a list of lines, cuz thats the easy way this way revealed so many errors in my string class,
// dont you love it when you dont actually copy a string and then the data gets lost and you dont know why because your an idiot
// thats never happened to me...... yea so im an idiot shouve actually copied the bytes over not just haphazardly asigned them to a string.
gnString gnGetFilePath(const gnFile& file) {
return file.path;
}
gnList<gnChar> gnGetFileBytes(const gnFile& file) { return file.bytes; }

View File

@@ -0,0 +1,44 @@
#pragma once
#include <utils/gryphn_access_level.h>
// TODO: this file API is shit
// have you ever wanted to write a file, well too bad cuz that shits a lot of work and im not doing allllll that
// also like im pretty sure something is fucked up in the reading of binary files, what, I dont know but something is
// other than that im pretty happy with it cuz like I still have zero fuckcking clue how it works
// the binary part that is
#include "../strings/gryphn_string.h"
#include "../lists/gryphn_list.h"
enum class gnFileType {
Text, Binary
};
struct gnFile {
ACCESS_LEVEL:
gnList<gnString> lines = gnCreateList<gnString>(); // if file type is string
gnList<gnChar> bytes = gnCreateList<gnChar>(); // if file type is binary
// ofc dumbass they should know what file type there loading
// wellllllll actually this is horrible cuz im storing the like 4 bytes it take for an empty list in every loaded file
// regardless of if there is actually any data in the list
// buttttt as code astetic once said "premature optimization is like totally the root of all evil bro *procedes to hit bong*"
// i think i remember that right, i need to fix this but templates are hard and im not
gnString path = gnCreateString();
gnFileType type = gnFileType::Text; // who loads binary files anyway *silence*, i do I guess thats why I wrote this
public:
gnFile() {}
};
gnFile gnLoadFile(const gnString& path, gnFileType type = gnFileType::Text);
// gnFile gnCreateFile(const gnString& path);
// gnFile gnCreateFile();
// gnFile gnWriteFile(const gnFile& file);
// which fucking loser thought they were writing a file writing API
// ...... that was me, im lazy, its 10:30, 2.5 hours after I go to sleep, imma go to sleep.
gnString gnGetFilePath(const gnFile& file);
gnString gnGetFileData(const gnFile& file); // i should rename this
gnList<gnChar> gnGetFileBytes(const gnFile& file); // fuck object oriented code
// and fuck error detection the user can get the bytes of a text file if they want to cuz its slow to do error checking, its also smart but im slow
// so me and this project are one in the same

View File

@@ -0,0 +1,7 @@
#pragma once
#ifdef GN_REVEAL_IMPL
#define ACCESS_LEVEL public
#else
#define ACCESS_LEVEL protected
#endif

5
src/utils/gryphn_bool.h Normal file
View File

@@ -0,0 +1,5 @@
#pragma once
typedef int gnBool;
#define gnFalse 0;
#define gnTrue 1;

View File

@@ -0,0 +1,5 @@
#include <utils/gryphn_error_code.h>
gnString gnGetErrorString() {
return lastReturnCode;
}

View File

@@ -0,0 +1,22 @@
#include <utils/gryphn_bool.h>
#include <utils/gryphn_access_level.h>
#include <vector>
#include <utils/strings/gryphn_string.h>
enum gnReturnCodeLevel { GN_FAILED = 0, GN_SUCCESS = 1 };
inline gnString lastReturnCode = gnCreateString();
typedef struct gnReturnCode {
ACCESS_LEVEL:
gnBool success;
gnString returnCodeMessage = "";
public:
bool operator==(gnReturnCodeLevel level) { return success; }
gnReturnCode(gnReturnCodeLevel level, gnString message) : success(level), returnCodeMessage(message) { lastReturnCode = returnCodeMessage; }
gnReturnCode(gnReturnCodeLevel level) : success(level) { lastReturnCode = returnCodeMessage; }
gnReturnCode() { lastReturnCode = returnCodeMessage; }
} gnErrorCode;
gnString gnGetErrorString();
static gnReturnCode gnReturnError(gnString errorMessage) { return { GN_FAILED, errorMessage }; }

View File

@@ -0,0 +1 @@
#define GN_PLATFORM_FUNCTION(RETURN_TYPE, NAME, __ARGS__) (RETURN_TYPE (*NAME)(__ARGS__))

View File

@@ -0,0 +1,85 @@
#pragma once
#include "math.h"
#include "stdio.h"
// TODO: Wack ass list class, needs some serious refactoring, buttttt it works for what I need it to do
// Imma touch this later cuz like I dont like working with C code cuz its wierd but like its also fun
// who needs std::vector when you've got malloc, calloc, and free
// shit just forgot that I dont clean any of this up, imma do this later cuz like its boring
// ive decided to do it now, I hate this, I hate coding, C is fun, this is a Cpp file, what am I doing with life
// I never did it id be super easy just like one anitconstructor????? i dont remeber what is called its the one with the squigly bracked
// TODO: future me rewirte these comments to be less stupid
// TODO: Add insert function, also remove function, orrrrrr i could have people copy lists whever they wanna remove stuff, nah thats gunna piss me off too
#define GRYPHN_LIST_GROWTH_RATE 2 // number straight from my ass I wanted to use 1.5f cuz thats what STL does but like it complained
// im in an abbusive relationship with the compiler, I need to get out of this
// but like I also kinda like it imma pick of drinking (not actually imma just play minecraft)
template <typename Type> // fuck templates
struct gnList {
protected:
Type* items = nullptr;
int size = 0, max_size = 0;
public:
gnList() {}
// why did I make shit protected
// theres gotta be a better way to do this with compiler macros but like that sounds hard
// im never touching this wack ass code ever again
template <typename T>
friend gnList<T> gnCreateList(int size);
template <typename T>
friend void gnListAdd(gnList<T>& list, T item);
template <typename T>
friend int gnListLength(const gnList<T>& list);
template <typename T>
friend T& gnListGet(const gnList<T>& list, int index);
template <typename T>
friend T* gnListGetPtr(const gnList<T>& list, int index);
template <typename T>
friend void gnListSet(const gnList<T>& list, int index, T item);
template <typename T>
friend T* gnListData(const gnList<T>& list);
public:
Type operator[](int index) const { return items[index]; } // idfk what that const is doin there but the compiler complained I was tryna change a const value
// .... I was not, I really am in an abusive relationship
Type& operator[](int index) { return items[index]; }
};
template <typename T>
gnList<T> gnCreateList(int size = 0) {
gnList<T> new_list = gnList<T>();
new_list.size = size;
if (size == 0) size = round(GRYPHN_LIST_GROWTH_RATE);
new_list.items = (T*)malloc(sizeof(T) * size);
new_list.max_size = size;
return new_list;
}
template <typename T>
void gnListAdd(gnList<T>& list, T item) {
if (gnListLength(list) == list.max_size) {
list.max_size = list.max_size * GRYPHN_LIST_GROWTH_RATE;
list.items = (T*)realloc(list.items, sizeof(T) * list.max_size);
}
list.items[list.size] = item;
list.size++;
}
template <typename T>
int gnListLength(const gnList<T>& list) { return list.size; }
template <typename T>
T& gnListGet(const gnList<T>& list, int index) { return list.items[index]; }
template <typename T>
T* gnListGetPtr(const gnList<T>& list, int index) { return &list.items[index]; }
template <typename T>
void gnListSet(const gnList<T>& list, int index, T item) { list.items[index] = item; }
template <typename T>
T* gnListData(const gnList<T>& list) { return list.items; } // wack ass function for binary shit
// if this ever breaks change it to return &list.items[0] cuz that might work
// I have zero clue what any of this shit does

View File

@@ -0,0 +1,44 @@
#pragma once
#include <unordered_map>
#include <string>
// very shitty vec2 class
#include "stdint.h"
template <typename T>
struct gnType2 {
union {
struct { T a, b; };
struct { T x, y; };
};
public:
gnType2(T a, T b) { this->a = a; this->b = b; }
gnType2() {};
gnType2 operator-(const gnType2& other) {
gnType2 returnGnVec2;
returnGnVec2.x = this->x - other.x;
returnGnVec2.y = this->y - other.y;
return returnGnVec2;
}
bool operator==(const gnType2& other) const {
return this->a == other.a && this->b == other.b;
}
};
typedef gnType2<float> gnVec2;
typedef gnType2<float> gnFloat2;
typedef gnType2<uint32_t> gnUInt2;
typedef gnType2<int32_t> gnInt2;
namespace std {
template<>
struct hash<gnUInt2> {
std::size_t operator()(const gnUInt2& k) const {
return std::hash<uint32_t>()(k.x) ^ (std::hash<uint32_t>()(k.y) << 1);
}
};
}

View File

@@ -0,0 +1,37 @@
#pragma once
// very shitty vec3 class
// i really want to write some math for this shit but im a lazy little cunt and im not doing all that shit
#include "stdint.h"
template <typename T>
struct gnType3 {
union {
struct { T a, b, c; };
struct { T x, y, z; };
};
public:
gnType3(T a, T b, T c) { this->a = a; this->b = b; this->c = c; }
gnType3() {};
bool operator==(const gnType3& other) const {
return this->a == other.a && this->b == other.b && this->c == other.c;
}
};
template <typename T1, typename T2, typename T3>
struct gnMultiType3 {
union {
struct { T1 a; T2 b; T3 c; };
struct { T1 x; T2 y; T3 z; };
};
public:
gnMultiType3(T1 a, T2 b, T3 c) { this->a = a; this->b = b; this->c = c; }
gnMultiType3() {};
};
typedef gnType3<float> gnVec3;
typedef gnVec3 gnFloat3;
typedef gnType3<uint32_t> gnUInt3;
typedef gnType3<int32_t> gnInt3;

View File

@@ -0,0 +1,33 @@
#pragma once
// very shitty vec4 class
// I also use this same thing to make my color class dont worry abt it
#include "stdint.h"
template <typename T>
struct gnType4 {
union {
struct { T a, b, c, d; };
struct { T x, y, z, w; };
};
public:
gnType4(T a, T b, T c, T d) { this->a = a; this->b = b; this->c = c; this->d = d; }
gnType4() {};
};
template <typename T1, typename T2, typename T3, typename T4>
struct gnMultiType4 {
union {
struct { T1 r; T2 g; T3 b; T4 a; };
struct { T1 x; T2 y; T3 z; T4 w; };
};
public:
gnMultiType4(T1 r, T2 g, T3 b, T4 a) { this->r = r; this->g = g; this->b = b; this->a = a; }
gnMultiType4() {};
};
typedef gnType4<float> gnVec4;
typedef gnVec4 gnFloat4;
typedef gnType4<uint32_t> gnUInt4;
typedef gnType4<int32_t> gnInt4;

View File

@@ -0,0 +1 @@
//#include "gryphn_string.h"

View File

@@ -0,0 +1,181 @@
#pragma once
#include <utils/gryphn_access_level.h>
#include <utils/gryphn_bool.h>
#include <cstring>
typedef char gnChar; // OpenGL does it so I do it
struct gnString;
static const char* gnToCString(const gnString& string);
// apis for char buffers togethers
// wack ass name idk what it means but im keepin it
// this just adds to char buffers into one big buffer
static char* add_string(char* str1, char* str2) {
char* buffer = new char[strlen(str1) + strlen(str2) + 1];
strcpy(buffer, str1);
strcat(buffer, str2);
buffer[strlen(str1) + strlen(str2)] = '\0';
return buffer;
}
// add char to char buffer
// better name
static char* add_string(char* str1, char str2) {
char* buffer = new char[strlen(str1) + 2];
strcpy(buffer, str1);
buffer[strlen(str1)] = str2;
buffer[strlen(str1) + 1] = '\0';
return buffer;
}
struct gnString {
ACCESS_LEVEL:
gnChar* value = new gnChar[1]{ '\0' };
public:
gnString(const gnChar* input) {
this->value = new gnChar[strlen(input) + 1]; // so like my dumbass forgot to put this earlier and some shit was broken but now it fixed
// I was wondering why one specific string crashed my program, it was my fault
char* converted_input = const_cast<char*>(input); // yea un const that const value, this line cost me hours cuz I cant read error codes
strcpy(this->value, input);
this->value[strlen(input)] = '\0';
}
gnString(gnChar* input) {
this->value = new gnChar[strlen(input) + 1];
strcpy(this->value, input);
this->value[strlen(input)] = '\0';
}
gnString(gnChar input) {
this->value = new char[2];
this->value[0] = input;
this->value[1] = '\0';
}
gnString() {
this->value = new char[1];
this->value[0] = '\0';
}
friend int gnStringLength(const gnString& length);
friend int gnStringFind(const gnString& string, const gnChar& letter);
friend int gnStringFind(const gnString& string, const gnString& value);
friend const char* gnToCString(const gnString& string); // dumb ass name but this shit gets used so much
friend gnString gnSubstring(const gnString& string, int index1, int index2);
friend int gnLetterCount(const gnString& string, const gnChar& letter);
friend gnChar gnGetCharAt(const gnString& string, int index);
friend void gnSetCharAt(gnString& string, int index, gnChar letter);
friend void gnAddToString(gnString& string, char val);
friend void gnAddToString(gnString& string, char* val);
friend void gnAddToString(gnString& string, const char* val);
friend void gnAddToString(gnString& string, const gnString& val);
friend gnString gnCombineStrings(const gnString& string, char val); // this shit is not combining a string but im lazy, fuck off
friend gnString gnCombineStrings(const gnString& string, char* val);
friend gnString gnCombineStrings(const gnString& string, const char* val);
friend gnString gnCombineStrings(const gnString& string, const gnString& val);
friend gnBool gnStringEquals(const gnString& string, char* val);
friend gnBool gnStringEquals(const gnString& string, const char* val);
friend gnBool gnStringEquals(const gnString& string, const gnString& val);
friend void gnSetString(gnString& string, const gnString& input);
friend void gnSetString(gnString& string, const gnChar* input);
friend void gnSetString(gnString& string, gnChar* input);
friend void gnSetString(gnString& string, gnChar input);
public:
char operator[](int index) { return value [index]; }
const char operator[](int index) const { return value [index]; }
void operator +=(char val) { value = add_string(value, val); }
void operator +=(char* val) { value = add_string(value, val); }
void operator +=(const char* val) { value = add_string(value, const_cast<char*>(val)); }
void operator +=(const gnString& string) { value = add_string(value, const_cast<char*>(gnToCString(string))); }
gnString operator +(char val) { return gnString(add_string(value, val)); }
gnString operator +(char* val){ return gnString(add_string(value, val)); }
gnString operator +(const char* val) { return gnString(add_string(value, const_cast<char*>(val))); }
gnString operator +(const gnString& val) { return gnString(add_string(value, const_cast<char*>(val.value))); }
gnBool operator ==(char* val) { return (strcmp(value, val) == 0); }
gnBool operator ==(const char* val) { return (strcmp(value, const_cast<char*>(val)) == 0); }
gnBool operator ==(const gnString& val) { return (strcmp(value, const_cast<char*>(val.value)) == 0); }
void operator =(char val) {
this->value = new char[2];
this->value[0] = val;
this->value[1] = '\0';
}
void operator =(char* val) { this->value = val; }
void operator =(const char* val) { this->value = const_cast<char*>(val); }
void operator =(const gnString& val) { this->value = val.value; }
};
inline gnString gnCreateString(const gnChar* input) { return gnString(input); }
inline gnString gnCreateString(gnChar* input) { return gnString(input); }
inline gnString gnCreateString(gnChar input) { return gnString(input); }
inline gnString gnCreateString() { return gnString(); }
inline int gnStringLength(const gnString& string) { return strlen(string.value); }
inline const char* gnToCString(const gnString& string) { return string.value; } // this is what Bjarne Stroustrup Sausage man intented me to do with his language
inline int gnStringFind(const gnString& string, const gnChar& letter) {
for (int i = 0; i < strlen(string.value); i++)
if (string.value[i] == letter)
return i;
return -1;
}
inline int gnStringFind(const gnString& string, const gnString& value) {
char first_char = value.value[0];
for (int i = 0; i < strlen(string.value); i++)
if (string.value[i] == first_char) {
bool same = true;
for (int c = 1; c < strlen(value.value); c++)
if (string.value[i + c] != value.value[c]) {
same = false;
break;
}
if (same)
return i;
}
return -1;
}
inline gnString gnSubstring(const gnString& string, int index1, int index2) {
if (index2 == -1) index2 = gnStringLength(string);
char* out_value = new char[(index2 - index1) + 1];
for (int i = 0; i < (index2 - index1); i++)
out_value[i] = string.value[i + index1];
out_value[(index2 - index1)] = '\0';
return gnCreateString(out_value); // zero error checking on this function should really add that in later but like I dont have a logging library that I want to use
// my code never breaks either so I dont need error checks, il just not make errors cuz im not tim
}
inline int gnLetterCount(const gnString& string, const gnChar& letter) {
int count = 0;
for (int i = 0; i < gnStringLength(string); i++) if (string.value[i] == letter) count++;
return count;
}
inline void gnAddToString(gnString& string, char val) { string += val; }
inline void gnAddToString(gnString& string, char* val) { string += val; }
inline void gnAddToString(gnString& string, const char* val) { string += val; }
inline void gnAddToString(gnString& string, const gnString& val) { string += val; }
inline gnString gnCombineStrings(const gnString& string, char val) { return gnCreateString(add_string(string.value, val)); }
inline gnString gnCombineStrings(const gnString& string, char* val) { return gnCreateString(add_string(string.value, val)); }
inline gnString gnCombineStrings(const gnString& string, const char* val) { return gnCreateString(add_string(string.value, const_cast<char*>(val))); }
inline gnString gnCombineStrings(const gnString& string, const gnString& val) { return gnCreateString(add_string(string.value, const_cast<char*>(val.value))); }
inline gnBool gnStringEquals(const gnString& string, char* val) { return (strcmp(string.value, val) == 0); }
inline gnBool gnStringEquals(const gnString& string,const char* val) { return (strcmp(string.value, const_cast<char*>(val)) == 0); }
inline gnBool gnStringEquals(const gnString& string, const gnString& val) { return (strcmp(string.value, const_cast<char*>(val.value)) == 0); }
inline gnChar gnGetCharAt(const gnString& string, int index) { return string.value[0]; }
inline void gnSetCharAt(gnString& string, int index, gnChar letter) { string.value[0] = letter; }
inline void gnSetString(gnString& string, const gnString& input) { string.value = input.value; }
inline void gnSetString(gnString& string, const gnChar* input) { string.value = const_cast<char*>(input); }
inline void gnSetString(gnString& string, gnChar* input) { string.value = input; }
inline void gnSetString(gnString& string, gnChar input) { string = input; }

View File

@@ -0,0 +1,3 @@
#include "../math/gryphn_vec4.h"
typedef gnMultiType4<int, int, int, float> gnColor;

View File

@@ -0,0 +1,7 @@
#pragma once
enum gnColorMode {
GN_RED, GN_RGB8, GN_RGBA8, GN_BGRA8,
GN_DEPTH8_STENCIL24,
GN_DEPTH_STENCIL = GN_DEPTH8_STENCIL24
};

View File

@@ -0,0 +1,188 @@
#pragma once
typedef int gnImageFormat;
#define GN_FORMAT_UNDEFINED 0
#define GN_FORMAT_R4G4_UNORM_PACK8 1
#define GN_FORMAT_R4G4B4A4_UNORM_PACK16 2
#define GN_FORMAT_B4G4R4A4_UNORM_PACK16 3
#define GN_FORMAT_R5G6B5_UNORM_PACK16 4
#define GN_FORMAT_B5G6R5_UNORM_PACK16 5
#define GN_FORMAT_R5G5B5A1_UNORM_PACK16 6
#define GN_FORMAT_B5G5R5A1_UNORM_PACK16 7
#define GN_FORMAT_A1R5G5B5_UNORM_PACK16 8
#define GN_FORMAT_R8_UNORM 9
#define GN_FORMAT_R8_SNORM 10
#define GN_FORMAT_R8_USCALED 11
#define GN_FORMAT_R8_SSCALED 12
#define GN_FORMAT_R8_UINT 13
#define GN_FORMAT_R8_SINT 14
#define GN_FORMAT_R8_SRGB 15
#define GN_FORMAT_R8G8_UNORM 16
#define GN_FORMAT_R8G8_SNORM 17
#define GN_FORMAT_R8G8_USCALED 18
#define GN_FORMAT_R8G8_SSCALED 19
#define GN_FORMAT_R8G8_UINT 20
#define GN_FORMAT_R8G8_SINT 21
#define GN_FORMAT_R8G8_SRGB 22
#define GN_FORMAT_R8G8B8_UNORM 23
#define GN_FORMAT_R8G8B8_SNORM 24
#define GN_FORMAT_R8G8B8_USCALED 25
#define GN_FORMAT_R8G8B8_SSCALED 26
#define GN_FORMAT_R8G8B8_UINT 27
#define GN_FORMAT_R8G8B8_SINT 28
#define GN_FORMAT_R8G8B8_SRGB 29
#define GN_FORMAT_B8G8R8_UNORM 30
#define GN_FORMAT_B8G8R8_SNORM 31
#define GN_FORMAT_B8G8R8_USCALED 32
#define GN_FORMAT_B8G8R8_SSCALED 33
#define GN_FORMAT_B8G8R8_UINT 34
#define GN_FORMAT_B8G8R8_SINT 35
#define GN_FORMAT_B8G8R8_SRGB 36
#define GN_FORMAT_R8G8B8A8_UNORM 37
#define GN_FORMAT_R8G8B8A8_SNORM 38
#define GN_FORMAT_R8G8B8A8_USCALED 39
#define GN_FORMAT_R8G8B8A8_SSCALED 40
#define GN_FORMAT_R8G8B8A8_UINT 41
#define GN_FORMAT_R8G8B8A8_SINT 42
#define GN_FORMAT_R8G8B8A8_SRGB 43
#define GN_FORMAT_B8G8R8A8_UNORM 44
#define GN_FORMAT_B8G8R8A8_SNORM 45
#define GN_FORMAT_B8G8R8A8_USCALED 46
#define GN_FORMAT_B8G8R8A8_SSCALED 47
#define GN_FORMAT_B8G8R8A8_UINT 48
#define GN_FORMAT_B8G8R8A8_SINT 49
#define GN_FORMAT_B8G8R8A8_SRGB 50
#define GN_FORMAT_A8B8G8R8_UNORM_PACK32 51
#define GN_FORMAT_A8B8G8R8_SNORM_PACK32 52
#define GN_FORMAT_A8B8G8R8_USCALED_PACK32 53
#define GN_FORMAT_A8B8G8R8_SSCALED_PACK32 54
#define GN_FORMAT_A8B8G8R8_UINT_PACK32 55
#define GN_FORMAT_A8B8G8R8_SINT_PACK32 56
#define GN_FORMAT_A8B8G8R8_SRGB_PACK32 57
#define GN_FORMAT_A2R10G10B10_UNORM_PACK32 58
#define GN_FORMAT_A2R10G10B10_SNORM_PACK32 59
#define GN_FORMAT_A2R10G10B10_USCALED_PACK32 60
#define GN_FORMAT_A2R10G10B10_SSCALED_PACK32 61
#define GN_FORMAT_A2R10G10B10_UINT_PACK32 62
#define GN_FORMAT_A2R10G10B10_SINT_PACK32 63
#define GN_FORMAT_A2B10G10R10_UNORM_PACK32 64
#define GN_FORMAT_A2B10G10R10_SNORM_PACK32 65
#define GN_FORMAT_A2B10G10R10_USCALED_PACK32 66
#define GN_FORMAT_A2B10G10R10_SSCALED_PACK32 67
#define GN_FORMAT_A2B10G10R10_UINT_PACK32 68
#define GN_FORMAT_A2B10G10R10_SINT_PACK32 69
#define GN_FORMAT_R16_UNORM 70
#define GN_FORMAT_R16_SNORM 71
#define GN_FORMAT_R16_USCALED 72
#define GN_FORMAT_R16_SSCALED 73
#define GN_FORMAT_R16_UINT 74
#define GN_FORMAT_R16_SINT 75
#define GN_FORMAT_R16_SFLOAT 76
#define GN_FORMAT_R16G16_UNORM 77
#define GN_FORMAT_R16G16_SNORM 78
#define GN_FORMAT_R16G16_USCALED 79
#define GN_FORMAT_R16G16_SSCALED 80
#define GN_FORMAT_R16G16_UINT 81
#define GN_FORMAT_R16G16_SINT 82
#define GN_FORMAT_R16G16_SFLOAT 83
#define GN_FORMAT_R16G16B16_UNORM 84
#define GN_FORMAT_R16G16B16_SNORM 85
#define GN_FORMAT_R16G16B16_USCALED 86
#define GN_FORMAT_R16G16B16_SSCALED 87
#define GN_FORMAT_R16G16B16_UINT 88
#define GN_FORMAT_R16G16B16_SINT 89
#define GN_FORMAT_R16G16B16_SFLOAT 90
#define GN_FORMAT_R16G16B16A16_UNORM 91
#define GN_FORMAT_R16G16B16A16_SNORM 92
#define GN_FORMAT_R16G16B16A16_USCALED 93
#define GN_FORMAT_R16G16B16A16_SSCALED 94
#define GN_FORMAT_R16G16B16A16_UINT 95
#define GN_FORMAT_R16G16B16A16_SINT 96
#define GN_FORMAT_R16G16B16A16_SFLOAT 97
#define GN_FORMAT_R32_UINT 98
#define GN_FORMAT_R32_SINT 99
#define GN_FORMAT_R32_SFLOAT 100
#define GN_FORMAT_R32G32_UINT 101
#define GN_FORMAT_R32G32_SINT 102
#define GN_FORMAT_R32G32_SFLOAT 103
#define GN_FORMAT_R32G32B32_UINT 104
#define GN_FORMAT_R32G32B32_SINT 105
#define GN_FORMAT_R32G32B32_SFLOAT 106
#define GN_FORMAT_R32G32B32A32_UINT 107
#define GN_FORMAT_R32G32B32A32_SINT 108
#define GN_FORMAT_R32G32B32A32_SFLOAT 109
#define GN_FORMAT_R64_UINT 110
#define GN_FORMAT_R64_SINT 111
#define GN_FORMAT_R64_SFLOAT 112
#define GN_FORMAT_R64G64_UINT 113
#define GN_FORMAT_R64G64_SINT 114
#define GN_FORMAT_R64G64_SFLOAT 115
#define GN_FORMAT_R64G64B64_UINT 116
#define GN_FORMAT_R64G64B64_SINT 117
#define GN_FORMAT_R64G64B64_SFLOAT 118
#define GN_FORMAT_R64G64B64A64_UINT 119
#define GN_FORMAT_R64G64B64A64_SINT 120
#define GN_FORMAT_R64G64B64A64_SFLOAT 121
#define GN_FORMAT_B10G11R11_UFLOAT_PACK32 122
#define GN_FORMAT_E5B9G9R9_UFLOAT_PACK32 123
#define GN_FORMAT_D16_UNORM 124
#define GN_FORMAT_X8_D24_UNORM_PACK32 125
#define GN_FORMAT_D32_SFLOAT 126
#define GN_FORMAT_S8_UINT 127
#define GN_FORMAT_D16_UNORM_S8_UINT 128
#define GN_FORMAT_D24_UNORM_S8_UINT 129
#define GN_FORMAT_D32_SFLOAT_S8_UINT 130
#define GN_FORMAT_BC1_RGB_UNORM_BLOCK 131
#define GN_FORMAT_BC1_RGB_SRGB_BLOCK 132
#define GN_FORMAT_BC1_RGBA_UNORM_BLOCK 133
#define GN_FORMAT_BC1_RGBA_SRGB_BLOCK 134
#define GN_FORMAT_BC2_UNORM_BLOCK 135
#define GN_FORMAT_BC2_SRGB_BLOCK 136
#define GN_FORMAT_BC3_UNORM_BLOCK 137
#define GN_FORMAT_BC3_SRGB_BLOCK 138
#define GN_FORMAT_BC4_UNORM_BLOCK 139
#define GN_FORMAT_BC4_SNORM_BLOCK 140
#define GN_FORMAT_BC5_UNORM_BLOCK 141
#define GN_FORMAT_BC5_SNORM_BLOCK 142
#define GN_FORMAT_BC6H_UFLOAT_BLOCK 143
#define GN_FORMAT_BC6H_SFLOAT_BLOCK 144
#define GN_FORMAT_BC7_UNORM_BLOCK 145
#define GN_FORMAT_BC7_SRGB_BLOCK 146
#define GN_FORMAT_ETC2_R8G8B8_UNORM_BLOCK 147
#define GN_FORMAT_ETC2_R8G8B8_SRGB_BLOCK 148
#define GN_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK 149
#define GN_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK 150
#define GN_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK 151
#define GN_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK 152
#define GN_FORMAT_EAC_R11_UNORM_BLOCK 153
#define GN_FORMAT_EAC_R11_SNORM_BLOCK 154
#define GN_FORMAT_EAC_R11G11_UNORM_BLOCK 155
#define GN_FORMAT_EAC_R11G11_SNORM_BLOCK 156
#define GN_FORMAT_ASTC_4x4_UNORM_BLOCK 157
#define GN_FORMAT_ASTC_4x4_SRGB_BLOCK 158
#define GN_FORMAT_ASTC_5x4_UNORM_BLOCK 159
#define GN_FORMAT_ASTC_5x4_SRGB_BLOCK 160
#define GN_FORMAT_ASTC_5x5_UNORM_BLOCK 161
#define GN_FORMAT_ASTC_5x5_SRGB_BLOCK 162
#define GN_FORMAT_ASTC_6x5_UNORM_BLOCK 163
#define GN_FORMAT_ASTC_6x5_SRGB_BLOCK 164
#define GN_FORMAT_ASTC_6x6_UNORM_BLOCK 165
#define GN_FORMAT_ASTC_6x6_SRGB_BLOCK 166
#define GN_FORMAT_ASTC_8x5_UNORM_BLOCK 167
#define GN_FORMAT_ASTC_8x5_SRGB_BLOCK 168
#define GN_FORMAT_ASTC_8x6_UNORM_BLOCK 169
#define GN_FORMAT_ASTC_8x6_SRGB_BLOCK 170
#define GN_FORMAT_ASTC_8x8_UNORM_BLOCK 171
#define GN_FORMAT_ASTC_8x8_SRGB_BLOCK 172
#define GN_FORMAT_ASTC_10x5_UNORM_BLOCK 173
#define GN_FORMAT_ASTC_10x5_SRGB_BLOCK 174
#define GN_FORMAT_ASTC_10x6_UNORM_BLOCK 175
#define GN_FORMAT_ASTC_10x6_SRGB_BLOCK 176
#define GN_FORMAT_ASTC_10x8_UNORM_BLOCK 177
#define GN_FORMAT_ASTC_10x8_SRGB_BLOCK 178
#define GN_FORMAT_ASTC_10x10_UNORM_BLOCK 179
#define GN_FORMAT_ASTC_10x10_SRGB_BLOCK 180
#define GN_FORMAT_ASTC_12x10_UNORM_BLOCK 181
#define GN_FORMAT_ASTC_12x10_SRGB_BLOCK 182
#define GN_FORMAT_ASTC_12x12_UNORM_BLOCK 183
#define GN_FORMAT_ASTC_12x12_SRGB_BLOCK 184

View File

@@ -0,0 +1,6 @@
#pragma once
#include "stdint.h"
typedef uint32_t gnVersion; // uint32_t is the loser way to right this I can write it anyway I want
#define gnCreateVersion(major, minor, patch) ((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch)))