Heyo! I've been working on an SDL2 port using wut, and it's been acting rather strange. I was hoping decaf might shed some light on the graphics issues, but ran into what looks like an endian handling bug.
Here's a log from running the opentyrian.rpx on my Linux system, freshly compiled Decaf (commit 070e29c977c87ff05cce2fc29007d497a4b7cdcf): https://pastebin.com/Y6vDyXtF - skip to line 1993-ish. I'm using the OpenGL backend here since I can't get the Vulkan one to work right on my (AMD) machine. I've only really looked into the '_fs_out_0 redeclared' error, kinda hoping the pixel shader issue is something similar.
After much gdb-ing, it turns out that sq_vtx_semantic.SEMANTIC_ID() (used here) always comes back as 0. Specifically:
(gdb) s
1134 if (id == 0xff) {
(gdb) p sq_vtx_semantic
$24 = {value = 0x1000000}
(gdb) p sq_vtx_semantic.SEMANTIC_ID()
$25 = 0x0
(gdb) p id
$26 = 0x0
From what I understand, sq_vtx_semantic is supposed to be 0x01 here, so that .SEMANTIC_ID can take the rightmost 8 bits. I tried printing shader->regs.sq_vtx_semantic on a real Wii U and yeah, the 01 is on the right, not the left. This makes me think it's an endian issue! I went and checked places it might be swapped:
As soon as it's passed into GX2SetVertexShader, all the elements in shader->regs.sq_vtx_semantic have not been swapped (01, ff etc. on the left, according to GDB)
After the .value() call, the values in sq_vtx_semantic don't seem to have been swapped yet, the copy going on in be2_array never seems to be overridden with a swap function
This array goes into gsl::make_span still un-swapped, and presumably from there into the pm4 packets and GLSL codegen
It looks to me like there's something awry in the interactions between be2_array, be2_struct and be2_val; though I honestly couldn't follow it well enough to try and debug it. The other place be2_array gets used with vertex shaders is exports, which gives similar-looking issues in other apps (Health and Safety is a good/free example)
Sorry to dump a problem like this on you, hoping it's something fairly simple in the be2_ stuff. Thanks for all the awesome work! Happy to provide sources and other info if needed.
Heyo! I've been working on an SDL2 port using wut, and it's been acting rather strange. I was hoping decaf might shed some light on the graphics issues, but ran into what looks like an endian handling bug.
Here's a log from running the opentyrian.rpx on my Linux system, freshly compiled Decaf (commit 070e29c977c87ff05cce2fc29007d497a4b7cdcf): https://pastebin.com/Y6vDyXtF - skip to line 1993-ish. I'm using the OpenGL backend here since I can't get the Vulkan one to work right on my (AMD) machine. I've only really looked into the '_fs_out_0 redeclared' error, kinda hoping the pixel shader issue is something similar.
After much gdb-ing, it turns out that
sq_vtx_semantic.SEMANTIC_ID()
(used here) always comes back as 0. Specifically:From what I understand, sq_vtx_semantic is supposed to be 0x01 here, so that .SEMANTIC_ID can take the rightmost 8 bits. I tried printing
shader->regs.sq_vtx_semantic
on a real Wii U and yeah, the 01 is on the right, not the left. This makes me think it's an endian issue! I went and checked places it might be swapped:shader->regs.sq_vtx_semantic
have not been swapped (01, ff etc. on the left, according to GDB).value()
call, the values insq_vtx_semantic
don't seem to have been swapped yet, the copy going on in be2_array never seems to be overridden with a swap functiongsl::make_span
still un-swapped, and presumably from there into the pm4 packets and GLSL codegenIt looks to me like there's something awry in the interactions between be2_array, be2_struct and be2_val; though I honestly couldn't follow it well enough to try and debug it. The other place be2_array gets used with vertex shaders is exports, which gives similar-looking issues in other apps (Health and Safety is a good/free example)
Sorry to dump a problem like this on you, hoping it's something fairly simple in the be2_ stuff. Thanks for all the awesome work! Happy to provide sources and other info if needed.