VRAM

From dreamcast.wiki
Jump to navigation Jump to search

Introduction

Video RAM (sometimes called texture memory) is RAM which can be referenced by the PowerVR2 GPU. It is used to store textures for 3D rendering, the framebuffer, and display lists.

Dreamcast has 8MB of VRAM, while Katana and NAOMI both have 16MB of VRAM. Dreamcast's VRAM consists of two separate modules which are both 4MB long.

On Dreamcast VRAM is accessible to the SH4's memory map in the address range 0x04000000-0x07FFFFFF.

Memory Map

Physical Address Contents
0x04000000-0x047FFFFF 64-bit access area
0x04800000-0x04FFFFFF Unused
0x05000000-0x057FFFFF 32-bit access area
0x05800000-0x05FFFFFF Unused
0x06000000-0x067FFFFF 64-bit access area (mirror)
0x06800000-0x06FFFFFF Unused
0x07000000-0x077FFFFF 32-bit access area (mirror)
0x07800000-0x07FFFFFF Unused

64-bit and 32-bit access areas

VRAM can be accessed through one of two areas: the 64-bit area or the 32-bit area. Both areas are backed by the same physical memory. Physical VRAM consists of two separate 4MB modules, and the difference between the 32-bit and 64-bit areas is in how those two modules are mapped to addresses. The 32-bit area is used to store the framebuffer, and the 64-bit area is used to store textures.

Although these two areas are referred to as "32-bit" and "64-bit" areas, there is no restriction on what sizes may be used for read and write operations. The names reflect the fact that the 64-bit area's interleaving allows it to be accessed faster than the 32-bit area since each consecutive set of four bytes comes from alternating RAM modules [1].

The 32-bit area allows for sequential access across all 8MB of VRAM, with the entirety of the second 4MB module placed after the first 4MB module. The 64-bit memory interleaves the first 4MB module with the second 4MB module, alternating between the two modules every four bytes [1]. So, every second set of four bytes in 64-bit area is offset by 4MB in the 32-bit area as illustrated in the table below.

Example Address Mapping between 32-bit and 64-bit areas

64-bit Area Address 32-bit Area Address
0x04000000 0x05000000
0x04000004 0x05400000
0x04000008 0x05000004
0x0400000c 0x05400004
0x04000010 0x05000008
0x04000014 0x05400008
0x04000018 0x0500000C
0x0400001C 0x0540000C

Mirrors of 64-bit and 32-bit access areas

These are alternate ranges of addresses that can be used to access VRAM. There is no difference between using these and the above sets of addresses. They both access the exact same memory in the exact same way.

Unused areas

These 8MB ranges represent where the extra memory in NAOMI and Katana would go. In Dreamcast there is nothing here. Reading from these ranges will always return all bits set. They can be written to, but the values written will be discarded.

References

  1. 1.0 1.1 [1],Dreamcast Programming - PowerVR