Kore
Loading...
Searching...
No Matches
constantbuffer.h File Reference

Provides support for managing buffers of constant-data for shaders. More...

#include <kinc/global.h>
#include <kinc/backend/graphics5/constantbuffer.h>
#include <kinc/math/matrix.h>
#include <kinc/math/vector.h>

Go to the source code of this file.

Data Structures

struct  kinc_g5_constant_buffer

Typedefs

typedef struct kinc_g5_constant_buffer kinc_g5_constant_buffer_t

Functions

KINC_FUNC void kinc_g5_constant_buffer_init (kinc_g5_constant_buffer_t *buffer, int size)
 Initializes a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_destroy (kinc_g5_constant_buffer_t *buffer)
 Destroys a buffer.
KINC_FUNC void kinc_g5_constant_buffer_lock_all (kinc_g5_constant_buffer_t *buffer)
 Locks all of a constant-buffer to modify its contents.
KINC_FUNC void kinc_g5_constant_buffer_lock (kinc_g5_constant_buffer_t *buffer, int start, int count)
 Locks part of a constant-buffer to modify its contents.
KINC_FUNC void kinc_g5_constant_buffer_unlock (kinc_g5_constant_buffer_t *buffer)
 Unlocks a constant-buffer so the changed contents can be used.
KINC_FUNC int kinc_g5_constant_buffer_size (kinc_g5_constant_buffer_t *buffer)
 Figures out the size of the constant-data in the buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_bool (kinc_g5_constant_buffer_t *buffer, int offset, bool value)
 Assigns a bool at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_int (kinc_g5_constant_buffer_t *buffer, int offset, int value)
 Assigns an integer at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_int2 (kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2)
 Assigns two integers at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_int3 (kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2, int value3)
 Assigns three integers at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_int4 (kinc_g5_constant_buffer_t *buffer, int offset, int value1, int value2, int value3, int value4)
 Assigns four integers at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_ints (kinc_g5_constant_buffer_t *buffer, int offset, int *values, int count)
 Assigns a bunch of integers at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_float (kinc_g5_constant_buffer_t *buffer, int offset, float value)
 Assigns a float at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_float2 (kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2)
 Assigns two floats at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_float3 (kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2, float value3)
 Assigns three floats at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_float4 (kinc_g5_constant_buffer_t *buffer, int offset, float value1, float value2, float value3, float value4)
 Assigns four floats at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_floats (kinc_g5_constant_buffer_t *buffer, int offset, float *values, int count)
 Assigns a bunch of floats at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_matrix3 (kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix3x3_t *value)
 Assigns a 3x3-matrix at an offset in a constant-buffer.
KINC_FUNC void kinc_g5_constant_buffer_set_matrix4 (kinc_g5_constant_buffer_t *buffer, int offset, kinc_matrix4x4_t *value)
 Assigns a 4x4-matrix at an offset in a constant-buffer.

Variables

KINC_FUNC bool kinc_g5_transposeMat3
KINC_FUNC bool kinc_g5_transposeMat4

Detailed Description

Provides support for managing buffers of constant-data for shaders.

Function Documentation

◆ kinc_g5_constant_buffer_destroy()

KINC_FUNC void kinc_g5_constant_buffer_destroy ( kinc_g5_constant_buffer_t * buffer)

Destroys a buffer.

Parameters
bufferThe buffer to destroy

◆ kinc_g5_constant_buffer_init()

KINC_FUNC void kinc_g5_constant_buffer_init ( kinc_g5_constant_buffer_t * buffer,
int size )

Initializes a constant-buffer.

Parameters
bufferThe buffer to initialize
sizeThe size of the constant-data in the buffer in bytes

◆ kinc_g5_constant_buffer_lock()

KINC_FUNC void kinc_g5_constant_buffer_lock ( kinc_g5_constant_buffer_t * buffer,
int start,
int count )

Locks part of a constant-buffer to modify its contents.

Parameters
bufferThe buffer to lock
startThe offset of where to start the lock in bytes
countThe number of bytes to lock
Returns
The contents of the buffer, starting at start

◆ kinc_g5_constant_buffer_lock_all()

KINC_FUNC void kinc_g5_constant_buffer_lock_all ( kinc_g5_constant_buffer_t * buffer)

Locks all of a constant-buffer to modify its contents.

Parameters
bufferThe buffer to lock
Returns
The contents of the buffer

◆ kinc_g5_constant_buffer_set_bool()

KINC_FUNC void kinc_g5_constant_buffer_set_bool ( kinc_g5_constant_buffer_t * buffer,
int offset,
bool value )

Assigns a bool at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
valueThe value to write into the buffer

◆ kinc_g5_constant_buffer_set_float()

KINC_FUNC void kinc_g5_constant_buffer_set_float ( kinc_g5_constant_buffer_t * buffer,
int offset,
float value )

Assigns a float at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
valueThe value to write into the buffer

◆ kinc_g5_constant_buffer_set_float2()

KINC_FUNC void kinc_g5_constant_buffer_set_float2 ( kinc_g5_constant_buffer_t * buffer,
int offset,
float value1,
float value2 )

Assigns two floats at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
value1The first value to write into the buffer
value2The second value to write into the buffer

◆ kinc_g5_constant_buffer_set_float3()

KINC_FUNC void kinc_g5_constant_buffer_set_float3 ( kinc_g5_constant_buffer_t * buffer,
int offset,
float value1,
float value2,
float value3 )

Assigns three floats at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
value1The first value to write into the buffer
value2The second value to write into the buffer
value3The third value to write into the buffer/param>

◆ kinc_g5_constant_buffer_set_float4()

KINC_FUNC void kinc_g5_constant_buffer_set_float4 ( kinc_g5_constant_buffer_t * buffer,
int offset,
float value1,
float value2,
float value3,
float value4 )

Assigns four floats at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
value1The first value to write into the buffer
value2The second value to write into the buffer
value3The third value to write into the buffer/param>
Parameters
value4The fourth value to write into the buffer

◆ kinc_g5_constant_buffer_set_floats()

KINC_FUNC void kinc_g5_constant_buffer_set_floats ( kinc_g5_constant_buffer_t * buffer,
int offset,
float * values,
int count )

Assigns a bunch of floats at an offset in a constant-buffer.

Parameters
locationThe location of the constant/uniform to assign the values to
valueThe values to write into the buffer
valueThe number of values to write into the buffer

◆ kinc_g5_constant_buffer_set_int()

KINC_FUNC void kinc_g5_constant_buffer_set_int ( kinc_g5_constant_buffer_t * buffer,
int offset,
int value )

Assigns an integer at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
valueThe value to assign to the constant/uniform

◆ kinc_g5_constant_buffer_set_int2()

KINC_FUNC void kinc_g5_constant_buffer_set_int2 ( kinc_g5_constant_buffer_t * buffer,
int offset,
int value1,
int value2 )

Assigns two integers at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
value1The first value to write into the buffer
value2The second value to write into the buffer

◆ kinc_g5_constant_buffer_set_int3()

KINC_FUNC void kinc_g5_constant_buffer_set_int3 ( kinc_g5_constant_buffer_t * buffer,
int offset,
int value1,
int value2,
int value3 )

Assigns three integers at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
value1The first value to write into the buffer
value2The second value to write into the buffer
value3The third value to write into the buffer/param>

◆ kinc_g5_constant_buffer_set_int4()

KINC_FUNC void kinc_g5_constant_buffer_set_int4 ( kinc_g5_constant_buffer_t * buffer,
int offset,
int value1,
int value2,
int value3,
int value4 )

Assigns four integers at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
value1The first value to write into the buffer
value2The second value to write into the buffer
value3The third value to write into the buffer/param>
Parameters
value4The fourth value to write into the buffer

◆ kinc_g5_constant_buffer_set_ints()

KINC_FUNC void kinc_g5_constant_buffer_set_ints ( kinc_g5_constant_buffer_t * buffer,
int offset,
int * values,
int count )

Assigns a bunch of integers at an offset in a constant-buffer.

Parameters
locationThe location of the constant/uniform to assign the values to
valueThe values to write into the buffer
valueThe number of values to write into the buffer

◆ kinc_g5_constant_buffer_set_matrix3()

KINC_FUNC void kinc_g5_constant_buffer_set_matrix3 ( kinc_g5_constant_buffer_t * buffer,
int offset,
kinc_matrix3x3_t * value )

Assigns a 3x3-matrix at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
valueThe value to write into the buffer

◆ kinc_g5_constant_buffer_set_matrix4()

KINC_FUNC void kinc_g5_constant_buffer_set_matrix4 ( kinc_g5_constant_buffer_t * buffer,
int offset,
kinc_matrix4x4_t * value )

Assigns a 4x4-matrix at an offset in a constant-buffer.

Parameters
offsetThe offset at which to write the data
valueThe value to write into the buffer

◆ kinc_g5_constant_buffer_size()

KINC_FUNC int kinc_g5_constant_buffer_size ( kinc_g5_constant_buffer_t * buffer)

Figures out the size of the constant-data in the buffer.

Parameters
bufferThe buffer to figure out the size for
Returns
Returns the size of the constant-data in the buffer in bytes

◆ kinc_g5_constant_buffer_unlock()

KINC_FUNC void kinc_g5_constant_buffer_unlock ( kinc_g5_constant_buffer_t * buffer)

Unlocks a constant-buffer so the changed contents can be used.

Parameters
bufferThe buffer to unlock