Changes

no edit summary
Line 18: Line 18:     
It is a common technique to read or write subsequent registers with a single instruction. For example TEXS (used to sample a texture) reads the texture coordinates from Ra and Ra+1, although it gets more complex with other layouts like 3D textures (it's not Ra+2). The result of the sample is given in an Rd and their subsequent registers.
 
It is a common technique to read or write subsequent registers with a single instruction. For example TEXS (used to sample a texture) reads the texture coordinates from Ra and Ra+1, although it gets more complex with other layouts like 3D textures (it's not Ra+2). The result of the sample is given in an Rd and their subsequent registers.
  −
TODO Add nvdisasm example
      
== Predicates ==
 
== Predicates ==
Line 25: Line 23:     
Most of the time predicates can be negated.
 
Most of the time predicates can be negated.
  −
TODO Add nvdisasm example
      
== Condition codes ==
 
== Condition codes ==
Line 34: Line 30:     
= Analysis Tools =
 
= Analysis Tools =
   
== Disassembling ==
 
== Disassembling ==
 
To disassemble a Maxwell shader or compute kernel there are two applications:
 
To disassemble a Maxwell shader or compute kernel there are two applications:
Line 61: Line 56:     
Since it's the product of reverse engineering the GPU and ''nvdisasm'' itself, it might contain errors.
 
Since it's the product of reverse engineering the GPU and ''nvdisasm'' itself, it might contain errors.
  −
== Dumping existing shaders ==
  −
One method to dump shaders from commercial games and homebrew applications is running it on an emulator.
  −
  −
Ryujinx[https://ryujinx.org/#/] offers in its configuration file an entry to dump the encountered shaders in two directories. ''Code'' contains shader dumps that are compatible with 'nvdisasm' and 'envydis' as they are. ''Full'' is the same as ''Code'' but it includes the header, it's intended to be decompiled with ''Ryujinx.ShaderTools''.
  −
  −
yuzu[https://yuzu-emu.org/] can dump shaders using its disk-based shader cache with an external tool. ''maxwell-dump''[https://gist.github.com/ReinUsesLisp/7ba72d3162e60cab283194fcca3474b2] is a small C application for this, it follows the same convention as Ryujinx for ''Code'' and ''Full''. To find the shader file dumped by the emulator, right click the game from the Qt front-end and select the option to view the transferable cache file. It's important to highlight that the file format might change in the future leaving this tool unable to extract the binaries until it's updated.
  −
  −
= Maxwell Instruction Set Architecture =
  −
TODO Define instructions