rename to projects (DOES NOT COMPILE)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "gryphn_command_buffer.h"
|
||||
#include "gryphn_platform_functions.h"
|
||||
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFromPointer(gnCommandBufferHandle* buffers, uint32_t count, gnCommandPoolHandle commandPool) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
buffers[i] = malloc(sizeof(struct gnCommandBuffer_t));
|
||||
buffers[i]->commandPool = commandPool;
|
||||
}
|
||||
return commandPool->commandFunctions->_gnCommandPoolAllocateCommandBuffers(buffers, count, commandPool);
|
||||
}
|
||||
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFromList(gnCommandBufferArrayList buffers, uint32_t count, gnCommandPoolHandle commandPool) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
buffers.data[i] = malloc(sizeof(struct gnCommandBuffer_t));
|
||||
buffers.data[i]->commandPool = commandPool;
|
||||
}
|
||||
return gnCommandPoolAllocateCommandBuffersFromPointer(buffers.data, count, commandPool);
|
||||
}
|
||||
|
||||
void gnResetCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
commandBuffer->commandPool->commandFunctions->_gnResetCommandBuffer(commandBuffer);
|
||||
}
|
||||
|
||||
gnReturnCode gnBeginCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
return commandBuffer->commandPool->commandFunctions->_gnBeginCommandBuffer(commandBuffer);
|
||||
}
|
||||
|
||||
gnReturnCode gnEndCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
return commandBuffer->commandPool->commandFunctions->_gnEndCommandBuffer(commandBuffer);
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include "stdint.h"
|
||||
#include "utils/gryphn_error_code.h"
|
||||
#include "utils/lists/gryphn_array_list.h"
|
||||
#include "gryphn_handles.h"
|
||||
|
||||
#ifdef GN_REVEAL_IMPL
|
||||
struct gnCommandBuffer_t {
|
||||
struct gnPlatformCommandBuffer_t* commandBuffer;
|
||||
gnCommandPoolHandle commandPool;
|
||||
};
|
||||
#endif
|
||||
|
||||
GN_ARRAY_LIST(gnCommandBuffer);
|
||||
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFromPointer(gnCommandBufferHandle* buffers, uint32_t count, gnCommandPoolHandle commandPool);
|
||||
// will reserve the space for ${count} number of elements
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFromList(gnCommandBufferArrayList buffers, uint32_t count, gnCommandPoolHandle commandPool);
|
||||
|
||||
#define gnCommandPoolAllocateCommandBuffers(buffers, count, commandPool) \
|
||||
_Generic((buffers), \
|
||||
gnCommandBufferArrayList: gnCommandPoolAllocateCommandBuffersFromList, \
|
||||
default: gnCommandPoolAllocateCommandBuffersFromPointer \
|
||||
)(buffers, count, commandPool)
|
||||
|
||||
void gnResetCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
gnReturnCode gnBeginCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
gnReturnCode gnEndCommandBuffer(gnCommandBufferHandle commandBuffer);
|
20
projects/core/src/command/command_pool/gryphn_command_pool.c
Normal file
20
projects/core/src/command/command_pool/gryphn_command_pool.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "gryphn_command_pool.h"
|
||||
#include "gryphn_platform_functions.h"
|
||||
#include "instance/init/gryphn_init.h"
|
||||
|
||||
gnReturnCode gnCreateCommandPool(gnCommandPoolHandle* commandPool, gnOutputDeviceHandle device, struct gnCommandPoolInfo_t info) {
|
||||
*commandPool = malloc(sizeof(struct gnCommandPool_t));
|
||||
if (!device->instance->loadCommandFunctions) {
|
||||
device->instance->commandFunctions = malloc(sizeof(struct gnCommandFunctions_t));
|
||||
gnLoadCommandFunctions(device->instance->dynamicLib, device->instance->commandFunctions);
|
||||
device->instance->loadCommandFunctions = gnTrue;
|
||||
}
|
||||
(*commandPool)->commandFunctions = device->instance->commandFunctions;
|
||||
|
||||
(*commandPool)->device = device;
|
||||
return device->deviceFunctions->_gnCreateCommandPool((*commandPool), device, info);
|
||||
}
|
||||
|
||||
void gnDestroyCommandPool(gnCommandPoolHandle commandPool) {
|
||||
commandPool->device->deviceFunctions->_gnDestroyCommandPool(commandPool);
|
||||
}
|
19
projects/core/src/command/command_pool/gryphn_command_pool.h
Normal file
19
projects/core/src/command/command_pool/gryphn_command_pool.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "stdint.h"
|
||||
#include <utils/gryphn_error_code.h>
|
||||
#include "gryphn_handles.h"
|
||||
|
||||
typedef struct gnCommandPoolInfo_t {
|
||||
uint32_t queueIndex;
|
||||
} gnCommandPoolInfo;
|
||||
|
||||
#ifdef GN_REVEAL_IMPL
|
||||
struct gnCommandPool_t {
|
||||
struct gnPlatformCommandPool_t* commandPool;
|
||||
struct gnCommandFunctions_t* commandFunctions;
|
||||
struct gnOutputDevice_t* device;
|
||||
};
|
||||
#endif
|
||||
|
||||
gnReturnCode gnCreateCommandPool(gnCommandPoolHandle* commandPool, gnOutputDeviceHandle device, struct gnCommandPoolInfo_t info);
|
||||
void gnDestroyCommandPool(gnCommandPoolHandle commandPool);
|
36
projects/core/src/command/commands/gryphn_command.c
Normal file
36
projects/core/src/command/commands/gryphn_command.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "gryphn_command.h"
|
||||
#include "command/command_buffer/gryphn_command_buffer.h"
|
||||
#include "command/command_pool/gryphn_command_pool.h"
|
||||
#include "gryphn_platform_functions.h"
|
||||
|
||||
void gnCommandBeginRenderPass(struct gnCommandBuffer_t* buffer, struct gnRenderPassInfo_t passInfo) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandBeginRenderPass(buffer, passInfo);
|
||||
}
|
||||
void gnCommandEndRenderPass(struct gnCommandBuffer_t* buffer) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandEndRenderPass(buffer);
|
||||
}
|
||||
|
||||
void gnCommandBindGraphicsPipeline(struct gnCommandBuffer_t* buffer, struct gnGraphicsPipeline_t* graphicsPipeline) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandBindGraphicsPipeline(buffer, graphicsPipeline);
|
||||
}
|
||||
void gnCommandSetViewport(struct gnCommandBuffer_t* buffer, struct gnViewport_t viewport) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandSetViewport(buffer, viewport);
|
||||
}
|
||||
void gnCommandSetScissor(struct gnCommandBuffer_t* buffer, struct gnScissor_t scissor) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandSetScissor(buffer, scissor);
|
||||
}
|
||||
void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandBindUniform(buffer, uniform, set);
|
||||
}
|
||||
void gnCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandBindBuffer(buffer, bufferToBind, type);
|
||||
}
|
||||
void gnCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandPushConstant(buffer, layout, data);
|
||||
}
|
||||
void gnCommandDraw(struct gnCommandBuffer_t* buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandDraw(buffer, vertexCount, firstVertex, instanceCount, firstInstance);
|
||||
}
|
||||
void gnCommandDrawIndexed(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance) {
|
||||
buffer->commandPool->commandFunctions->_gnCommandDrawIndexed(buffer, type, indexCount, firstIndex, vertexOffset, instanceCount, firstInstance);
|
||||
}
|
18
projects/core/src/command/commands/gryphn_command.h
Normal file
18
projects/core/src/command/commands/gryphn_command.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "gryphn_handles.h"
|
||||
|
||||
#include "renderpass/gryphn_render_pass.h"
|
||||
void gnCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo);
|
||||
void gnCommandEndRenderPass(gnCommandBufferHandle buffer);
|
||||
|
||||
#include "pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
|
||||
void gnCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline);
|
||||
void gnCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport);
|
||||
void gnCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor);
|
||||
void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set);
|
||||
void gnCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data);
|
||||
|
||||
#include "buffers/gryphn_buffer.h"
|
||||
void gnCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type);
|
||||
|
||||
void gnCommandDraw(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance);
|
||||
void gnCommandDrawIndexed(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance);
|
Reference in New Issue
Block a user