get supported surface formats
This commit is contained in:
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -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);
|
@@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
#include <gryphn/gryphn_utils.h>
|
||||
|
||||
struct gnBindingDescription {
|
||||
public:
|
||||
gnInt binding;
|
||||
gnSize stride;
|
||||
public:
|
||||
gnBindingDescription() {};
|
||||
};
|
@@ -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);
|
@@ -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() {}
|
||||
};
|
@@ -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);
|
@@ -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); }
|
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -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};
|
||||
}
|
@@ -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);
|
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -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;
|
@@ -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);
|
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -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);
|
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -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() {}
|
||||
};
|
@@ -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"
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -1,3 +0,0 @@
|
||||
#include "gryphn_shader.h"
|
||||
|
||||
void gnShaderAddModule(gnShader& shader, gnShaderModule& module) { gnListAdd(shader.shaderModules, module); }
|
@@ -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);
|
@@ -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);
|
@@ -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);
|
@@ -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);
|
@@ -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);
|
@@ -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; }
|
@@ -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);
|
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -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;
|
||||
}
|
@@ -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);
|
@@ -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);
|
@@ -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);
|
||||
}
|
@@ -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);
|
@@ -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);
|
||||
// }
|
@@ -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);
|
@@ -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);
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user