NV3 Getting Started

From NvWiki
Revision as of 00:30, 16 June 2025 by Starfrost (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You can program your completely obsolete GPU the way that the company intended, using boring APIs such as Direct3D and OpenGL. Or you can do it in the cool way. The choice is yours.

Introduction

Most of the pages on this website are for people interested in how Nvidia's hardware works. You don't need to know everything about how the RIVA 128 works in order to actually program the hardware; you just need to be able to understand the interfaces to it and some of the registers. This is not for the faint of hearted. You are directly programming complex graphics hardware (old does not mean simple - the RIVA 128 has 3.5 million transistors, far more than any human can individually comprehend) that is not yet fully understood, but advances are being made all the time, so check back to this page for new updates. Eventually versions of this page will be made for the NV1 and RIVA TNT, and hopefully the Riva TNT2 and maybe, one day, even the GeForce 256 and its Celsius/NV1x brethren, such as the GeForce 2 and the GeForce 4 MX. If you want to write a game or other software in this way, you will be effectively writing a mini-GPU driver to manage the GPU hardware resources combined with whatever software you may wish to develop. If you want to write raw-NV software for Windows, Linux or any other operating system you will need to write a kernel driver that exposes the GPU's raw interface to usermode before you can write anything at all (this driver may be done in the future). You can get around this by using something like DJGPP in order to write a DOS application using a 32-bit memory model, without any of DOS's 16-bit segmented cruft. This is the recommended approach as it has the minimum amount of overhead and boilerplate code, plus workin under a DOS box such as the Windows 9x DOS box. An emulator like 86Box and its emulated nVIDIA RIVA support can be used for testing without access to a real system, although it has not been merged into mainline as of yet and still may not be entirely accurate to how the real hardware may behave.

Environment Setup

Even before beginning to learn NV3 programming you must initialise the card. There are several steps for initialising an NV card:

1. Mapping the MMIO and VRAM of the card into memory (using either the PCI BIOS or the main API) 2. Determining the revision, straps, manufacture-time configuration and VRAM amount on the card 3. Configuring the card for graphics operation 4. Creating the objects that will be used for graphics operation (you can do this later, but in many cases objects are reused, so it is a good idea to do this)

For now, copy nv3_api.h and nv3_ref.h from here to get started. This isn't yet a complete reference, but it's enough to do basic work. This will be formalised into a real SDK later.

Concepts

Before we start programming, there are many concepts, some that are more general to raw-level GPU development and other very specific to Nvidia, that need to be explained.