Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash when loading gLTF model with multiple meshes #49

Open
ompadu opened this issue Oct 8, 2021 · 0 comments
Open

crash when loading gLTF model with multiple meshes #49

ompadu opened this issue Oct 8, 2021 · 0 comments

Comments

@ompadu
Copy link

ompadu commented Oct 8, 2021

The crash happens at gs.h:7000 listed below:

bool gs_util_load_gltf_data_from_file(const char* path, gs_asset_mesh_decl_t* decl, gs_asset_mesh_raw_data_t** out, uint32_t* mesh_count)
{
   // ...

    // Allocate memory for buffers
    *mesh_count = data->meshes_count;
    *out = (gs_asset_mesh_raw_data_t*)gs_malloc(data->meshes_count * sizeof(gs_asset_mesh_raw_data_t));
    memset(*out, 0, sizeof(gs_asset_mesh_raw_data_t) * data->meshes_count);

    // Iterate through meshes in data
    for (uint32_t i = 0; i < data->meshes_count; ++i)
    {
        // Initialize mesh data
        gs_asset_mesh_raw_data_t* mesh = out[i];
        mesh->prim_count = data->meshes[i].primitives_count; // (Crash)
   // ...

Exception thrown: read access violation.
**mesh** was 0xFFFFFFFFFFFFFFFF.

This gLTF model should reproduce it.

Maybe there's something wrong with out's pointer-fu or allocation? In the debugger it seems that out[1] and above contain garbage data. Only out[0] shows proper data and that would explain why is it working with this model or the included duck one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant