I took a quick peek into the source code of the new texture2D example and I am sorry to say that but changing the attribute during the render process on each frame, flushing it and passing it over to the GPU isn't very efficient. I don't think it is intended to be used like that. I am not sure how much you can scale that concept up and how many textures you would be able to draw at the same time before frame rate starts to drop quickly. The problem in that are mainly the GX2Invalidate calls which halt the CPU until the memory is flushed out and the GPU can't use that memory before its out of the CPU cache either and you cant go around those calls. But texture2D.gsh does not offer a uniform for it so I understand why you have to do it that way. Though I think I found a better shader that can be freely used and it's right under our nose in mii maker. I think it could offer us all we need judging by the shader parameter names and types. I did not yet use it though so I can't say I am 100% sure but it looks promising.
Anyway. I had a bit of time on the weekend and ported the HBL source code to use the WUT toolchain and be build as RPX. I had to modify several parts of the toolchain though. Mostly small things though.
The first thing that went wrong is that the LIBPATH gets overwritten by WUT, so I made a workaround that with a 2nd env variable.
The second thing that went wrong is the following part:
Code:
/opt/devkitPPC/bin/../lib/gcc/powerpc-eabi/4.8.2/../../../../powerpc-eabi/bin/ld: section .gcc_except_table loaded at [01000000,010015a3] overlaps section .lib.rplLibs loaded at [01000000,0100003b]
/opt/devkitPPC/bin/../lib/gcc/powerpc-eabi/4.8.2/../../../../powerpc-eabi/bin/ld: section .got loaded at [01000040,0100004f] overlaps section .gcc_except_table loaded at [01000000,010015a3]
/opt/devkitPPC/bin/../lib/gcc/powerpc-eabi/4.8.2/../../../../powerpc-eabi/bin/ld: section .gcc_except_table._ZN7CThreadD2Ev loaded at [010015a4,010015a7] overlaps section .rela.dyn loaded at [010002a0,01004dc3]
/opt/devkitPPC/bin/../lib/gcc/powerpc-eabi/4.8.2/../../../../powerpc-eabi/bin/ld: section .rela.rodata loaded at [01004de0,010111cf] overlaps section .gcc_except_table._ZNSt13basic_fstreamIwSt11char_traitsIwEEC1ERKSsSt13_Ios_Openmode loaded at [01004dc9,01004de8]
/opt/devkitPPC/bin/../lib/gcc/powerpc-eabi/4.8.2/../../../../powerpc-eabi/bin/ld: section .gcc_except_table._ZNSt13basic_fstreamIwSt11char_traitsIwEED2Ev loaded at [01004de9,01004dec] overlaps section .rela.rodata loaded at [01004de0,010111cf]
The C++ exception table section is missing. That isnt very surprising as you already said that you only use C. So that could happen of course. Once I added that section to the linker file the ELF file compiled and I got an elf2rpl issue. Paddings of libs or C++ were causing issues and i get unexpected rela.dyn type errors. So I added an ignore in there for the elf::R_PPC_NONE case. That made the RPX finally compile. Once I tried to load it I had loader issues, mainly 160-2203, linking issues. Checking what's wrong I found out that nsysnet has several bugs in it. Fixing those finally got the RPX to boot.
I will fork WUT and do a pull request tommorow in the evening as I didnt have time for it today. All in all I must say the way that the libraries are linked is really nice made and the elf2rpl tool is some great tool exjam made. No more 3 instructions function calls
! Though there are some changes I would like to suggest in the linker file and the default/include make files. For example I am not sure why it does not discard unneeded sections and does a garbage collection or why the header dependencies are not activated and you have clean to recompile changes done in headers. Those parts I would rather discuss elsewhere though.
So thats about it and now I have HBL as RPX which works great. The next step is to add actual RPX booting from the RPX HBL ;-).