Homebrew Can't figure out the cause of this Citro3D crash

Pikachuk

Well-Known Member
OP
Member
Joined
Mar 19, 2016
Messages
768
Trophies
0
Age
23
Location
Bordeaux
XP
758
Country
France
Hi,
I have been working on getting the old godot 2.1 port for 3ds updated and continuing the port for it to become usable. I have been able to upgrade it to Godot 2.1.7 RC and to build it for 3DS, however I am having some trouble, and while I am not yet too experienced with Citro3D, I don't really see anything that could be the issue

here's the part where the code crashes

C++:
VertexArray *varray = memnew(VertexArray(4));
  
    Vertex v[4] = {
        {
            Vector3( p_rect.pos.x, p_rect.pos.y, 0.5f),
            Vector2( p_src_region.pos.x/p_tex_size.width, p_src_region.pos.y/p_tex_size.height)
        },{
            Vector3( p_rect.pos.x+p_rect.size.width, p_rect.pos.y, 0.5f),
            Vector2((p_src_region.pos.x+p_src_region.size.width)/p_tex_size.width, p_src_region.pos.y/p_tex_size.height)
        },{
            Vector3( p_rect.pos.x+p_rect.size.width, p_rect.pos.y+p_rect.size.height, 0.5f),
            Vector2( (p_src_region.pos.x+p_src_region.size.width)/p_tex_size.width, (p_src_region.pos.y+p_src_region.size.height)/p_tex_size.height)
        },{
            Vector3( p_rect.pos.x,p_rect.pos.y+p_rect.size.height, 0.5f),
            Vector2( p_src_region.pos.x/p_tex_size.width, (p_src_region.pos.y+p_src_region.size.height)/p_tex_size.height)
        },
    };
  
    memcpy(varray->vertices, v, sizeof(v));
  
    C3D_BufInfo* bufInfo = C3D_GetBufInfo();
    BufInfo_Init(bufInfo);
    BufInfo_Add(bufInfo, varray->vertices, sizeof(Vertex), 2, 0x10);
  
    C3D_DrawArrays(GPU_TRIANGLE_FAN, 0, 4);

the code seems to crash on C3D_DrawArrays and more specifically when C3D_DrawArrays ends up internally calling GPUCMD_AddSingleParam
Do you have any idea of the possible cause ?

if you want to see more of the code and check, the github repository is public : https://github.com/SeleDreams/godot-3ds/blob/3ds_update/drivers/3ds/citro3d/rasterizer_citro3d.cpp
 
Last edited by Pikachuk,

Pikachuk

Well-Known Member
OP
Member
Joined
Mar 19, 2016
Messages
768
Trophies
0
Age
23
Location
Bordeaux
XP
758
Country
France
I was able to fix it, I can't tell if it was due to C3D_FrameBegin or due to the C3D_Init that used a wrong value but I changed both and it doesn't crash anymore
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    S @ salazarcosplay: where you can wirte your thoughts, opinions, reflections episode by episode