51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
////////////////////////////////////////////////////////////
|
|
//~ State types
|
|
|
|
Struct(G_Ctx)
|
|
{
|
|
// Common shared resources
|
|
G_IndexBufferDesc quad_indices;
|
|
G_Texture2DRef blank_tex;
|
|
G_Texture3DRef basic_noise;
|
|
G_SamplerStateRef basic_samplers[G_BasicSamplerKind_COUNT];
|
|
};
|
|
|
|
Struct(G_ThreadLocalCtx)
|
|
{
|
|
G_ArenaHandle gpu_perm;
|
|
};
|
|
|
|
extern G_Ctx G;
|
|
extern ThreadLocal G_ThreadLocalCtx G_tl;
|
|
|
|
////////////////////////////////////////////////////////////
|
|
//~ Bootstrap
|
|
|
|
void G_BootstrapCommon(void);
|
|
|
|
////////////////////////////////////////////////////////////
|
|
//~ Utils
|
|
|
|
//- Arena
|
|
G_ArenaHandle G_PermArena(void);
|
|
|
|
//- Push resource from cpu
|
|
G_ResourceHandle G_PushBufferFromCpuCopy_(G_ArenaHandle gpu_arena, G_CommandListHandle cl, String src, G_BufferDesc desc);
|
|
#define G_PushBufferFromCpuCopy(_arena, _cl, _src, ...) \
|
|
G_PushBufferFromCpuCopy_((_arena), (_cl), (_src), (G_BufferDesc) { .size = (_src).len, __VA_ARGS__ })
|
|
|
|
//- Mip
|
|
i32 G_DimsFromMip1D(i32 texture_dims, i32 mip);
|
|
Vec2I32 G_DimsFromMip2D(Vec2I32 texture_dims, i32 mip);
|
|
Vec3I32 G_DimsFromMip3D(Vec3I32 texture_dims, i32 mip);
|
|
|
|
//- Viewport / scissor
|
|
Rng3 G_ViewportFromTexture(G_ResourceHandle texture);
|
|
Rng2 G_ScissorFromTexture(G_ResourceHandle texture);
|
|
|
|
//- Shared resources
|
|
G_SamplerStateRef G_BasicSamplerFromKind(G_BasicSamplerKind kind);
|
|
G_IndexBufferDesc G_QuadIndices(void);
|
|
G_Texture2DRef G_BlankTexture2D(void);
|
|
G_Texture3DRef G_BasicNoiseTexture(void);
|