Skip to content

shader_debugging

Erik Abair edited this page Jan 16, 2022 · 1 revision

Raw notes on xemu shader debugging:

xemu generates glsl shaders to emulate the behavior of the nv2a hardware, both the fixed function pipeline and any custom shaders implemented by games.

Vertex shaders

Fixed function pipeline or custom?

You can determine which shader is in use at a given time by looking for NV097_SET_TRANSFORM_EXECUTION_MODE in the logs. When using the fixed function pipeline, the low 3 bits will be set to 0, when using a custom shader it will be 2.

Custom shaders

xemu generates glsl code to emulate the assembly instructions available in the DirectX

Input

The v0 to v12 vectors hold information about the incoming vertex. The values they represent are in this set of #defines:

  1. Position
  2. Weight
  3. Normal
  4. Diffuse
  5. Specular
  6. Fog
  7. Point size
  8. Back diffuse
  9. Back specular
  10. Texture 0 coordinates
  11. Texture 1 coordinates
  12. Texture 2 coordinates
  13. Texture 3 coordinates

Registers

There are 12 temporary registers (r0...r11) plus a special shadow register (r12) for the oPos (output position)

There are 192 constants, populated via a combination of NV097_SET_TRANSFORM_CONSTANT_LOAD and NV097_SET_TRANSFORM_CONSTANT.

Links