GX indirect data shows only in Dolphin but not on the Wii
Posted: Sat Sep 23, 2017 12:46 am
I want to load a model from a custom file format into something that I can pass to GX. I have confirmed this code to be working, however nothing is displayed on the Wii when I give the loaded data to GX. I think I have narrowed down the problem to the fact that I am dynamically allocating the arrays with the data. I put together a test to confirm this.
Not dynamic:
Dynamic:
The first code works but second one doesn't.
I am guessing this has something to do with the way the Wii handles dynamic memory compared to Dolphin.
How would I make this work on the Wii?
Not dynamic:
Code: Select all
...
f32 verts[] ATTRIBUTE_ALIGN(32) = {
-1.0F, 0.0F, -1.5F,
1.0F, -0.0F, -1.0F,
-1.0F, -0.6F, 0.0F
};
u8 colors[] ATTRIBUTE_ALIGN(32) = {
0, 255, 255, 255
};
GX_SetArray(GX_VA_POS, verts, 3 * sizeof(f32));
GX_SetArray(GX_VA_CLR0, colors, 4 * sizeof(u8));
...
Code: Select all
...
u8 *vertsp = (f32*)(memalign(32, 9 * sizeof(f32)));
u8 *colorsp = (u8*)(memalign(32, 4 * sizeof(u8)));
for(int i = 0; i < 9; i++) {
vertsp[i] = verts[i];
}
for(int i = 0; i < 4; i++) {
colorsp[i] = colors[i];
}
GX_SetArray(GX_VA_POS, vertsp, 3 * sizeof(f32));
GX_SetArray(GX_VA_CLR0, colorsp, 4 * sizeof(u8));
...
I am guessing this has something to do with the way the Wii handles dynamic memory compared to Dolphin.
How would I make this work on the Wii?