dusk/src/duskgl/display/shader/shaderbuffer.h

61 lines
1.2 KiB
C

/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "duskgl.h"
typedef struct {
GLuint id;
size_t size;
} shaderbuffer_t;
/**
* Initializes a shader buffer.
*
* @param shaderBuffer The shader buffer to initialize.
* @param size The size of the buffer.
*/
void shaderBufferInit(
shaderbuffer_t *shaderBuffer,
const size_t size
);
/**
* Binds a shader buffer.
*
* @param shaderBuffer The shader buffer to bind.
*/
void shaderBufferBind(shaderbuffer_t *shaderBuffer);
/**
* Sets the data of a shader buffer.
*
* @param shaderBuffer The shader buffer to set the data of.
* @param data The data to set.
*/
void shaderBufferSetData(
shaderbuffer_t *shaderBuffer,
const void *data
);
/**
* Binds a shader buffer to a block.
*
* @param shaderBuffer The shader buffer to bind.
* @param blockIndex The block index to bind to.
*/
void shaderBufferBindToBlock(
shaderbuffer_t *shaderBuffer,
const GLuint blockIndex
);
/**
* Disposes of a shader buffer.
*
* @param shaderBuffer The shader buffer to dispose of.
*/
void shaderBufferDispose(shaderbuffer_t *shaderBuffer);