taisei/src/resource
Andrei Alexeyev b6978178b1
memory: use custom memory allocation wrappers
Introduces wrappers around memory allocation functions in `memory.h`
that should be used instead of the standard C ones.

These never return NULL and, with the exception of `mem_realloc()`,
zero-initialize the allocated memory like `calloc()` does.

All allocations made with the memory.h API must be deallocated with
`mem_free()`. Although standard `free()` will work on some platforms,
it's not portable (currently it won't work on Windows). Likewise,
`mem_free()` must not be used to free foreign allocations.

The standard C allocation functions are now diagnosed as deprecated.
They are, however, available with the `libc_` prefix in case interfacing
with foreign APIs is required. So far they are only used to implement
`memory.h`.

Perhaps the most important change is the introduction of the `ALLOC()`,
`ALLOC_ARRAY()`, and `ALLOC_FLEX()` macros. They take a type as a
parameter, and allocate enough memory with the correct alignment for
that type. That includes overaligned types as well. In most
circumstances you should prefer to use these macros. See the `memory.h`
header for some usage examples.
2023-01-18 13:23:22 +01:00
..
texture_loader memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
animation.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
animation.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
bgm.c Audio rewrite (#236) 2020-06-22 17:41:03 +03:00
bgm.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
font.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
font.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
iqm.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
material.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
material.h pbr: support ambient occlusion maps 2021-09-01 00:48:59 +03:00
meson.build pbr: refactor material management and shader 2021-09-01 00:21:50 +03:00
model.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
model.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
postprocess.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
postprocess.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
resource.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
resource.h resource: groundwork for live reload support 2022-01-02 08:28:11 +02:00
sfx.c audio: partial refactor 2021-09-01 19:55:36 +03:00
sfx.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
sfxbgm_common.c Audio rewrite (#236) 2020-06-22 17:41:03 +03:00
sfxbgm_common.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
shader_object.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
shader_object.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
shader_program.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
shader_program.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
sprite.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
sprite.h sprite: handle virtual paddings transparently 2022-11-27 20:14:05 +01:00
texture.c resource: partial support for resource reloading 2022-01-02 08:28:02 +02:00
texture.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00