actually get it to work

This commit is contained in:
Greg Wells
2025-06-26 18:04:14 -04:00
parent ab3bd566d2
commit f98dc5fead
23 changed files with 81 additions and 68 deletions

View File

@@ -1,12 +1,14 @@
#include "gryphn_command_buffer.h"
#include "command/command_pool/gryphn_command_pool.h"
#include "instance/gryphn_instance.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;
buffers[i]->instance = commandPool->instance;
}
return commandPool->commandFunctions->_gnCommandPoolAllocateCommandBuffers(buffers, count, commandPool);
return commandPool->instance->callingLayer->commandFunctions._gnCommandPoolAllocateCommandBuffers(buffers, count, commandPool);
}
gnReturnCode gnCommandPoolAllocateCommandBuffersFromList(gnCommandBufferArrayList buffers, uint32_t count, gnCommandPoolHandle commandPool) {
@@ -18,13 +20,13 @@ gnReturnCode gnCommandPoolAllocateCommandBuffersFromList(gnCommandBufferArrayLis
}
void gnResetCommandBuffer(gnCommandBufferHandle commandBuffer) {
commandBuffer->commandPool->commandFunctions->_gnResetCommandBuffer(commandBuffer);
commandBuffer->commandPool->instance->callingLayer->commandFunctions._gnResetCommandBuffer(commandBuffer);
}
gnReturnCode gnBeginCommandBuffer(gnCommandBufferHandle commandBuffer) {
return commandBuffer->commandPool->commandFunctions->_gnBeginCommandBuffer(commandBuffer);
return commandBuffer->commandPool->instance->callingLayer->commandFunctions._gnBeginCommandBuffer(commandBuffer);
}
gnReturnCode gnEndCommandBuffer(gnCommandBufferHandle commandBuffer) {
return commandBuffer->commandPool->commandFunctions->_gnEndCommandBuffer(commandBuffer);
return commandBuffer->commandPool->instance->callingLayer->commandFunctions._gnEndCommandBuffer(commandBuffer);
}

View File

@@ -8,6 +8,7 @@
struct gnCommandBuffer_t {
struct gnPlatformCommandBuffer_t* commandBuffer;
gnCommandPoolHandle commandPool;
gnInstance instance;
};
#endif

View File

@@ -5,12 +5,12 @@
gnReturnCode gnCreateCommandPool(gnCommandPoolHandle* commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info) {
*commandPool = malloc(sizeof(struct gnCommandPool_t));
(*commandPool)->commandFunctions = &device->instance->commandFunctions;
(*commandPool)->instance = device->instance;
(*commandPool)->device = device;
return device->deviceFunctions->_gnCreateCommandPool((*commandPool), device, info);
return device->instance->callingLayer->deviceFunctions._gnCreateCommandPool((*commandPool), device, info);
}
void gnDestroyCommandPool(gnCommandPoolHandle commandPool) {
commandPool->device->deviceFunctions->_gnDestroyCommandPool(commandPool);
commandPool->instance->callingLayer->deviceFunctions._gnDestroyCommandPool(commandPool);
}

View File

@@ -2,7 +2,6 @@
#include "stdint.h"
#include <utils/gryphn_error_code.h>
#include "gryphn_handles.h"
#include "loader/src/gryphn_command_functions.h"
typedef struct gnCommandPoolInfo {
uint32_t queueIndex;
@@ -11,8 +10,8 @@ typedef struct gnCommandPoolInfo {
#ifdef GN_REVEAL_IMPL
struct gnCommandPool_t {
struct gnPlatformCommandPool_t* commandPool;
gnCommandFunctions* commandFunctions;
gnDevice device;
gnInstance instance;
};
#endif

View File

@@ -1,35 +1,36 @@
#include "gryphn_command.h"
#include "command/command_buffer/gryphn_command_buffer.h"
#include "command/command_pool/gryphn_command_pool.h"
#include "instance/gryphn_instance.h"
void gnCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo) {
buffer->commandPool->commandFunctions->_gnCommandBeginRenderPass(buffer, passInfo);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandBeginRenderPass(buffer, passInfo);
}
void gnCommandEndRenderPass(gnCommandBufferHandle buffer) {
buffer->commandPool->commandFunctions->_gnCommandEndRenderPass(buffer);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandEndRenderPass(buffer);
}
void gnCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipeline graphicsPipeline) {
buffer->commandPool->commandFunctions->_gnCommandBindGraphicsPipeline(buffer, graphicsPipeline);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandBindGraphicsPipeline(buffer, graphicsPipeline);
}
void gnCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport) {
buffer->commandPool->commandFunctions->_gnCommandSetViewport(buffer, viewport);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandSetViewport(buffer, viewport);
}
void gnCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor) {
buffer->commandPool->commandFunctions->_gnCommandSetScissor(buffer, scissor);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandSetScissor(buffer, scissor);
}
void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) {
buffer->commandPool->commandFunctions->_gnCommandBindUniform(buffer, uniform, set);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandBindUniform(buffer, uniform, set);
}
void gnCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type) {
buffer->commandPool->commandFunctions->_gnCommandBindBuffer(buffer, bufferToBind, type);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandBindBuffer(buffer, bufferToBind, type);
}
void gnCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data) {
buffer->commandPool->commandFunctions->_gnCommandPushConstant(buffer, layout, data);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandPushConstant(buffer, layout, data);
}
void gnCommandDraw(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance) {
buffer->commandPool->commandFunctions->_gnCommandDraw(buffer, vertexCount, firstVertex, instanceCount, firstInstance);
buffer->commandPool->instance->callingLayer->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);
buffer->commandPool->instance->callingLayer->commandFunctions._gnCommandDrawIndexed(buffer, type, indexCount, firstIndex, vertexOffset, instanceCount, firstInstance);
}