Homebrew 3DS Shader Assembler and Disassembler: nihstro

neobrain

-
OP
Member
Joined
Apr 25, 2014
Messages
306
Trophies
0
XP
730
Country
Hi there,

tl;dr: Get nihstro 0.1 on 4dsdev and read the docs on GitHub

Ever since the release of ninjhax, only few homebrew applications have been developed, which to a large degree probably stems from the lack of tools for convenient GPU programming. This is a pity, especially since the PICA200 could achieve quite nice things given its unique feature set compared to other GPUs targeted at the mobile market: There are extensions for fragment lighting, procedural textures, gaseous object rendering, and other things. While none of these are understood by the homebrew community (yet!), you can see that there is a lot of potential.

Over the past months I've hence been working on a shader assembler (as part of my tool suite nihstro), which has now become advanced enough to be usable for the general 3DS homebrew development. By putting out a prerelease, I'm hoping to get some feedback on the used shader assembly syntax and ease of use.

The shader assembler currently supports most of the instructions listed on 3dbrew, excluding MOVA, MAD, EMIT and SETEMIT. I'm of course planning to add support for these in the future.

If you're interested, head over to the nihstro thread on our homebrew community board 4dsdev for more information and Windows binaries.

Other than that, any feedback on nihstro is welcome. Happy hacking!


NOTE: This is completely useless to you if you aren't into homebrew development. If you are, however, it should be fairly awesome)
 

neobrain

-
OP
Member
Joined
Apr 25, 2014
Messages
306
Trophies
0
XP
730
Country
is it better than aemstro?

In most aspects relevant to homebrew development: Yes, it is, and smea would probably agree.

Aemstro has mostly been a tool for smea to aid reverse-engineering and wasn't ever tailored towards usability, whereas nihstro's shader syntax has been designed to be easy to use from the beginning. For instance, compare a shader written for aemstro to the same shader ported to nihstro syntax.

Other than readability, nihstro provides lots of shortcuts to the programmer (where possible without sacrificing flexibility and power): For example you might have seen on 3dbrew that there are lots of different variants of the flow control instructions (ifc, ifu, jmpc, jmpu, call, callc, callu). This is an implementation detail though, hence nihstro lets you access all of these simply by "if", "jmp", and "call" and automatically chooses the correct variant.

Similarly, most arithmetic instructions (e.g. ADD) have certain restrictions on what inputs they can take. E.g. the second argument may never be a uniform register. Nihstro makes this a bit easier: If you accidently use a uniform register as the second argument, nihstro implicitly swaps the argument order such that the uniform gets used as the first argument.

All of this probably sounds more complicated than it really is, but what it boils down to is that nihstro abstracts away annoying implementation details and makes sure that the code that you write also compiles to what you intended to write. If this is not possible, it will usually give you a helpful error message (report it as a bug if it's not helpful!) - something which aemstro will usually not do currently, either.

For what it's worth, aemstro implements support for the shader instructions mova, mad, emit and setemit. nihstro doesn't support those yet, because I wanted to publish a polished release rather than including lots of experimental features. Support for those instructions will definitely be added in the future, though.
 
  • Like
Reactions: piratesephiroth

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.tomshardware.com/pc-components/cpus/intel-cpu-dispensing-vending-machine-game-spotted...