0

According to MSDN there are three types of memory in D3D12, commited resources, placed resources and reserved resources. I do not understand where they are. Are they in RAM? Are they in VRAM? Are they memory mapped somehow so they are both in RAM and VRAM at (approximately?) the same time?

Realised I might have misunderstood memory mapped memory, perhaps it is just an abstraction for sending things over PCIe, not something that goes to RAM and then somewhere else.

Emil
  • 135
  • 7

1 Answers1

3

They are not 3 types of memory. They're 2 different things (physical and virtual memory) and a 3rd that combines the first two for convenience.

Placed resources are blocks of physical memory that the GPU can access but are not mapped to virtual space (Your application can't access them yet). They can be anywhere in memory (GPU or CPU RAM) but you don't have a pointer to them to access it (yet) that's the job of a reserved resource.

Reserved resources are a virtual space windows that the program can access that isn't mapped (yet) to anything. This is the address your program has a pointer to but there's no actual memory at that spot until you map a placed resource.

Committed resources are BOTH a virtual memory space so the program can access it and physical memory large enough for it (may be larger due to driver limitations, we don't really care) that the GPU can access. It's both a placed resource and a reserved resource but you can't separate them, you can't remap the virtual memory to point to a different chunk of physical memory.

enter image description here

The mapping between what your app sees (Reserved resource) and the memory for the GPU (Placed resource) can be changed at any time and multiple sub-mappings can be created at the same time using the D3D12 UpdateTileMappings function.

Different sections of the reserved resource can be mapped to different parts of different placed resources.

For example you can create a 128KB virtual memory "window" and map the first 64KB of that virtual area at the 4th 64KB chunk of a 1MB placed resource and the second 64KB of your memory space mapped to the 1st 64KB of a different 256KB placed resource.

Then your application can access that 128KB area (the reserved resource) as once continuous chunk of memory even tho it's accessing two completely different areas of physical memory (placed resources).

This is to allow a 32bit application (limited to 2GB or 3GB of virtual space) to access large amount of graphic buffers (eg: a graphic card with 3GB when your app already needs 2GB of memory for it's own data and code).

Stephane Hockenhull
  • 11,962
  • 1
  • 25
  • 44
  • Read some more now but don't understand where the placed resource would go in updatetilemappings. I'm guessing the physical memory part of the call is pHeap [in, optional]? – Emil Nov 26 '17 at 09:09
  • Yes. The "heap" is the physical memory. You map a bunch of ranges specified in "tiles" (64KB) in order to access the resource's physical memory. – Stephane Hockenhull Nov 26 '17 at 17:30
  • Could you clarify "but you don't have a pointer to them to access it (yet) that's the job of a reserved resource."? The picture I am getting is 1a) heap creation 2a) placed resource as a kind of iterator that's fixed to a memory window in a heap, Map/Unmap can be used 2b) reserved resource as a kind of iterator whose window can be changed more freely and even point to several windows and Map/Unmap works. 1b) commited resource does it all automagically, Map/Unmap works. What do you think? – Emil Nov 26 '17 at 19:39