indexed drawing and index buffers

This commit is contained in:
Greg Wells
2025-06-06 17:35:37 -04:00
parent 5dec8b9005
commit e66075beaf
10 changed files with 32 additions and 4 deletions

View File

@@ -3,8 +3,13 @@
#include "utils/gryphn_error_code.h"
#include <core/gryphn_handles.h>
typedef enum gnIndexType {
GN_UINT16, GN_UINT32
} gnIndexType;
typedef enum gnBufferType {
GN_VERTEX_BUFFER = 0x00000001
GN_VERTEX_BUFFER = 0x00000001f,
GN_INDEX_BUFFER = 0x00000002f,
} gnBufferType;
typedef enum gnBufferUsage {

View File

@@ -23,3 +23,6 @@ void gnCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBi
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);
}

View File

@@ -13,3 +13,4 @@ void gnCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor);
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);

View File

@@ -113,4 +113,5 @@ typedef struct gnCommandFunctions_t {
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);
} gnCommandFunctions;

View File

@@ -109,4 +109,5 @@ void gnLoadCommandFunctions(struct gnDynamicLibrary_t* lib, struct gnCommandFunc
gnLoadDLLFunction(lib, functions->_gnCommandSetScissor, "gnCommandSetScissorFn");
gnLoadDLLFunction(lib, functions->_gnCommandBindBuffer, "gnCommandBindBufferFn");
gnLoadDLLFunction(lib, functions->_gnCommandDraw, "gnCommandDrawFn");
gnLoadDLLFunction(lib, functions->_gnCommandDrawIndexed, "gnCommandDrawIndexedFn");
}