Skip to main content

Assembler/disassembler for the Xbox nv2a vertex shader

Project description

Trivial assembler for the nv2a vertex shader.

The Cg -> vp20 path performs various optimizations that sometimes make it hard to force unusual test conditions. This assembler performs no optimizations, and simply translates operands into machine code.

Instructions

  • ADD
  • ARL
  • DP3
  • DP4
  • DPH
  • DST
  • EXPP
  • LIT
  • LOGP
  • MAD
  • MAX
  • MIN
  • MOV
  • MUL
  • RCC
  • RCP
  • RSQ
  • SGE
  • SLT

Registers

Temporary registers

  • r0 - r11

Constant/uniform registers

  • c0 - c191

Constant registers may also use relative addressing via bracket syntax. E.g., c[A0 + 12]

Address register

  • a0

May only be set via the ARL instruction. E.g., ARL a0, v12

Inputs

  • v0, iPos
  • v1, iWeight
  • v2, iNormal
  • v3, iDiffuse
  • v4, iSpecular
  • v5, iFog
  • v6, iPts
  • v7, iBackDiffuse
  • v8, iBackSpecular
  • v9, iTex0
  • v10, iTex1
  • v11, iTex2
  • v12, iTex3
  • v13
  • v14
  • v15

Outputs

  • oB0, oBackDiffuse
  • oB1, oBackSpecular
  • oD0, oDiffuse
  • oD1, oSpecular
  • oFog
  • oPos
  • oPts
  • oTex0, oT0
  • oTex1, oT1
  • oTex2, oT2
  • oTex3, oT3

Swizzle/destination masks

  • xyzw
  • rgba

Uniform macros

A simple macro syntax is supported to allow symbolic naming for c-register access. Two types are currently implemented, vector and matrix4.

A vector type aliases a single c register. E.g., to give a symbolic name to c10: #uniform_name vector 10. The macro can then be used in subsequent instructions; e.g., mov r0, #uniform_name.

A matrix4 type aliases a contiguous set of 4 c registers. E.g., to give a symbolic name to a model matrix passed at 'c96': #my_model_matrix matrix4 96. To access the second row: mul r0, v0.y, #my_model_matrix[1].

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nv2a_vsh-0.1.1.tar.gz (31.4 kB view hashes)

Uploaded Source

Built Distribution

nv2a_vsh-0.1.1-py3-none-any.whl (71.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page