mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-14 01:59:19 +03:00
Use xcalloc_aligned for allocating structures containing mat4
This fixes #294. cglm's mat4 requires 32-byte alignment when __AVX__ is defined.
This commit is contained in:
+1
-1
@@ -518,7 +518,7 @@ struct model *model_load(struct archive *aar, const char *path)
|
|||||||
model->bone_map = ht_create(pol->nr_bones * 3 / 2);
|
model->bone_map = ht_create(pol->nr_bones * 3 / 2);
|
||||||
model->bone_name_map = ht_create(pol->nr_bones * 3 / 2);
|
model->bone_name_map = ht_create(pol->nr_bones * 3 / 2);
|
||||||
model->mot_cache = ht_create(16);
|
model->mot_cache = ht_create(16);
|
||||||
model->bones = xcalloc(pol->nr_bones, sizeof(struct bone));
|
model->bones = xcalloc_aligned(pol->nr_bones, struct bone);
|
||||||
for (uint32_t i = 0; i < pol->nr_bones; i++) {
|
for (uint32_t i = 0; i < pol->nr_bones; i++) {
|
||||||
add_bone(model, pol, &pol->bones[i]);
|
add_bone(model, pol, &pol->bones[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -38,7 +38,7 @@ enum RE_plugin_version re_plugin_version;
|
|||||||
|
|
||||||
static struct RE_instance *create_instance(struct RE_plugin *plugin)
|
static struct RE_instance *create_instance(struct RE_plugin *plugin)
|
||||||
{
|
{
|
||||||
struct RE_instance *instance = xcalloc(1, sizeof(struct RE_instance));
|
struct RE_instance *instance = xcalloc_aligned(1, struct RE_instance);
|
||||||
instance->plugin = plugin;
|
instance->plugin = plugin;
|
||||||
for (int i = 0; i < RE_NR_INSTANCE_TARGETS; i++)
|
for (int i = 0; i < RE_NR_INSTANCE_TARGETS; i++)
|
||||||
instance->target[i] = -1;
|
instance->target[i] = -1;
|
||||||
@@ -229,7 +229,7 @@ struct RE_plugin *RE_plugin_new(enum RE_plugin_version version)
|
|||||||
if (!aar)
|
if (!aar)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
struct RE_plugin *plugin = xcalloc(1, sizeof(struct RE_plugin));
|
struct RE_plugin *plugin = xcalloc_aligned(1, struct RE_plugin);
|
||||||
plugin->plugin.name = "ReignEngine";
|
plugin->plugin.name = "ReignEngine";
|
||||||
plugin->plugin.update = RE_render;
|
plugin->plugin.update = RE_render;
|
||||||
plugin->plugin.to_json = RE_to_json;
|
plugin->plugin.to_json = RE_to_json;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ struct dungeon_context *dungeon_get_context(int surface)
|
|||||||
|
|
||||||
struct dungeon_context *dungeon_context_create(enum draw_dungeon_version version, int width, int height)
|
struct dungeon_context *dungeon_context_create(enum draw_dungeon_version version, int width, int height)
|
||||||
{
|
{
|
||||||
struct dungeon_context *ctx = xcalloc(1, sizeof(struct dungeon_context));
|
struct dungeon_context *ctx = xcalloc_aligned(1, struct dungeon_context);
|
||||||
ctx->plugin.name = plugin_name;
|
ctx->plugin.name = plugin_name;
|
||||||
ctx->plugin.free = dungeon_context_free;
|
ctx->plugin.free = dungeon_context_free;
|
||||||
ctx->plugin.update = dungeon_render;
|
ctx->plugin.update = dungeon_render;
|
||||||
|
|||||||
+1
-1
@@ -153,7 +153,7 @@ static struct parts_flash_object *update_object(struct parts_flash_object *obj,
|
|||||||
{
|
{
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
if (tag->flags & PLACE_FLAG_HAS_CHARACTER) {
|
if (tag->flags & PLACE_FLAG_HAS_CHARACTER) {
|
||||||
obj = xcalloc(1, sizeof(struct parts_flash_object));
|
obj = xcalloc_aligned(1, struct parts_flash_object);
|
||||||
obj->depth = tag->depth;
|
obj->depth = tag->depth;
|
||||||
} else {
|
} else {
|
||||||
ERROR("no object to update (depth=%d)", tag->depth);
|
ERROR("no object to update (depth=%d)", tag->depth);
|
||||||
|
|||||||
Reference in New Issue
Block a user