get supported surface formats

This commit is contained in:
Greg Wells
2025-05-24 17:16:42 -04:00
parent 38799cb663
commit 410eab007e
118 changed files with 84 additions and 4217 deletions

View File

@@ -1,11 +0,0 @@
#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

@@ -1,34 +0,0 @@
#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

@@ -1,18 +0,0 @@
#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

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

View File

@@ -1,18 +0,0 @@
#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

@@ -1,18 +0,0 @@
#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

@@ -1,38 +0,0 @@
#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

@@ -1,22 +0,0 @@
#pragma once
#include <gryphn/gryphn_utils.h>
#include "vector"
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

@@ -1,11 +0,0 @@
#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

@@ -1,25 +0,0 @@
#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

@@ -1,11 +0,0 @@
#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

@@ -1,24 +0,0 @@
#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

@@ -1,18 +0,0 @@
#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

@@ -1,24 +0,0 @@
#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

@@ -1,17 +0,0 @@
#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

@@ -1,31 +0,0 @@
#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

@@ -1,35 +0,0 @@
#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

@@ -1,65 +0,0 @@
#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

@@ -1,22 +0,0 @@
#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

@@ -1,34 +0,0 @@
#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

@@ -1,15 +0,0 @@
#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

@@ -1,17 +0,0 @@
#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

@@ -1,24 +0,0 @@
#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

@@ -1,13 +0,0 @@
#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

@@ -42,6 +42,7 @@ typedef struct gnFunctions_t {
#endif
void (*_gnDestroyWindowSurface)(struct gnWindowSurface_t* windowSurface);
struct gnSurfaceFormat_t* (*_gnGetSupportedSurfaceFormats)(struct gnWindowSurface_t* windowSurface, struct gnPhysicalDevice_t device, uint32_t* formatCount);
} gnFunctions;
#include "core/presentation_queue/gryphn_presentation_queue.h"

View File

@@ -65,6 +65,7 @@ void gnLoadFunctions(struct gnDynamicLibrary_t* lib, struct gnFunctions_t* funct
#endif
gnLoadDLLFunction(lib, functions->_gnDestroyWindowSurface, "gnDestroyWindowSurfaceFn");
gnLoadDLLFunction(lib, functions->_gnGetSupportedSurfaceFormats, "gnGetSupportedSurfaceFormatsFn");
}
void gnLoadDeviceFunctions(struct gnDynamicLibrary_t* lib, struct gnDeviceFunctions_t* functions) {

View File

@@ -2,14 +2,13 @@
#include <gryphn/gryphn_utils.h>
#include "core/output_device/gryphn_output_device.h"
#include <core/window_surface/gryphn_surface.h>
// #include "core/sync_objects/gryphn_sync_semaphore.h"
// #include "core/textures/gryphn_texture.h"
// #include "gryphn_device_presentation_details.h"
#include <utils/types/gryphn_image_format.h>
typedef struct gnPresentationQueueInfo_t {
gnUInt ImageCount;
gnUInt2 ImageSize;
struct gnWindowSurface_t surface;
struct gnSurfaceFormat_t format;
} gnPresentationQueueInfo;
struct gnPlatformPresentationQueue_t;

View File

@@ -1,11 +0,0 @@
#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

@@ -1,19 +0,0 @@
#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

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

View File

@@ -1,18 +0,0 @@
#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

@@ -1,27 +0,0 @@
#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, gnByte* shaderModuleCode, size_t dataSize) {
module.codeSize = dataSize;
module.shaderData = shaderModuleCode;
}
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

@@ -1,43 +0,0 @@
#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, gnByte* shaderModuleCode, gnSize codeSize);
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

@@ -1,17 +0,0 @@
#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

@@ -1,15 +0,0 @@
#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

@@ -1,24 +0,0 @@
#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

@@ -1,48 +0,0 @@
#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

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

View File

@@ -1,19 +0,0 @@
#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

@@ -1,20 +0,0 @@
#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

@@ -1,18 +0,0 @@
#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

@@ -1,24 +0,0 @@
#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

@@ -1,17 +0,0 @@
#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

@@ -1,25 +0,0 @@
#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

@@ -1,35 +0,0 @@
#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

@@ -1,28 +0,0 @@
#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

@@ -32,3 +32,11 @@
void gnDestroyWindowSurface(struct gnWindowSurface_t *windowSurface) {
windowSurface->instance->functions->_gnDestroyWindowSurface(windowSurface);
}
struct gnSurfaceFormat_t* gnGetSupportedSurfaceFormats(
struct gnWindowSurface_t* windowSurface,
struct gnPhysicalDevice_t device,
uint32_t* formatCount
) {
return windowSurface->instance->functions->_gnGetSupportedSurfaceFormats(windowSurface, device, formatCount);
}

View File

@@ -1,14 +1,26 @@
#pragma once
#include <core/instance/gryphn_instance.h>
#include <platform/gryphn_platform_include.h>
#include <utils/types/gryphn_image_format.h>
#include "core/output_device/gryphn_physical_output_device.h"
struct gnPlatformWindowSurface_t;
typedef struct gnSurfaceFormat_t {
gnImageFormat format;
gnColorSpace colorSpace;
} gnSurfaceFormat;
typedef struct gnWindowSurface_t {
struct gnPlatformWindowSurface_t* windowSurface;
gnInstance* instance;
} gnWindowSurface;
void gnDestroyWindowSurface(struct gnWindowSurface_t* windowSurface);
struct gnSurfaceFormat_t* gnGetSupportedSurfaceFormats(
struct gnWindowSurface_t* windowSurface,
struct gnPhysicalDevice_t device,
uint32_t* formatCount
);
#ifdef GN_PLATFORM_LINUX
#ifdef GN_WINDOW_X11

View File

@@ -1,188 +1,9 @@
#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
typedef enum gnImageFormat_e {
GN_FORMAT_BGRA8_SRGB
} gnImageFormat;
typedef enum gnColorSpace_e {
GN_COLOR_SPACE_SRGB_NONLINEAR
} gnColorSpace;