citro3d/include/c3d/uniforms.h

44 lines
1.1 KiB
C
Raw Normal View History

2014-12-20 21:34:19 +01:00
#pragma once
#include "types.h"
#define C3D_FVUNIF_COUNT 96
#define C3D_IVUNIF_COUNT 4
2015-03-05 23:05:14 +01:00
extern C3D_FVec C3D_FVUnif[2][C3D_FVUNIF_COUNT];
extern C3D_IVec C3D_IVUnif[2][C3D_IVUNIF_COUNT];
extern u16 C3D_BoolUnifs[2];
2014-12-20 21:34:19 +01:00
2015-03-05 23:05:14 +01:00
extern bool C3D_FVUnifDirty[2][C3D_FVUNIF_COUNT];
extern bool C3D_IVUnifDirty[2][C3D_IVUNIF_COUNT];
extern bool C3D_BoolUnifsDirty[2];
2014-12-20 21:34:19 +01:00
2015-03-05 23:05:14 +01:00
static inline C3D_FVec* C3D_FVUnifWritePtr(GPU_SHADER_TYPE type, int id, int size)
2014-12-20 21:34:19 +01:00
{
int i;
for (i = 0; i < size; i ++)
2015-03-05 23:05:14 +01:00
C3D_FVUnifDirty[type][id+i] = true;
return &C3D_FVUnif[type][id];
2014-12-20 21:34:19 +01:00
}
2015-03-05 23:05:14 +01:00
static inline C3D_IVec* C3D_IVUnifWritePtr(GPU_SHADER_TYPE type, int id)
2014-12-20 21:34:19 +01:00
{
2015-03-05 23:05:14 +01:00
C3D_IVUnifDirty[type][id] = true;
return &C3D_IVUnif[type][id];
2014-12-20 21:34:19 +01:00
}
2015-03-05 23:05:14 +01:00
static inline void C3D_FVUnifSet(GPU_SHADER_TYPE type, int id, float x, float y, float z, float w)
2014-12-20 21:34:19 +01:00
{
2015-03-05 23:05:14 +01:00
C3D_FVec* ptr = C3D_FVUnifWritePtr(type, id, 1);
2014-12-20 21:34:19 +01:00
ptr->x = x;
ptr->y = y;
ptr->z = z;
ptr->w = w;
}
2015-03-05 23:05:14 +01:00
static inline void C3D_IVUnifSet(GPU_SHADER_TYPE type, int id, int x, int y, int z, int w)
2014-12-20 21:34:19 +01:00
{
2015-03-05 23:05:14 +01:00
C3D_IVec* ptr = C3D_IVUnifWritePtr(type, id);
2014-12-20 21:34:19 +01:00
*ptr = IVec_Pack(x, y, z, w);
}
2015-03-05 23:05:14 +01:00
void C3D_UpdateUniforms(GPU_SHADER_TYPE type);