Recent

Author Topic: Accessing VRAM memory with CPU  (Read 399 times)

LemonParty

  • Hero Member
  • *****
  • Posts: 618
Accessing VRAM memory with CPU
« on: July 17, 2026, 03:00:10 pm »
I have a technical question.
Today we have a lot of systems with unified memory.
Is it possible to access VRAM part of RAM with CPU directly?
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12984
  • FPC developer.
Re: Accessing VRAM memory with CPU
« Reply #1 on: July 17, 2026, 03:51:59 pm »
You can map it into address space, this is commonly done for uploading textures. It might not be as fast (since it maybe has to go over the PCIe bus if it is an external card) though.

LemonParty

  • Hero Member
  • *****
  • Posts: 618
Re: Accessing VRAM memory with CPU
« Reply #2 on: July 17, 2026, 04:45:30 pm »
Understood. Thank you.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

JollyHong

  • New Member
  • *
  • Posts: 11
Re: Accessing VRAM memory with CPU
« Reply #3 on: July 21, 2026, 08:22:13 am »
On unified memory architectures (like Apple Silicon or modern APUs), CPU and GPU share the same physical RAM, so there isn't really a physical transfer over a PCIe bus. However, the OS and graphics API still enforce memory domain/mapping restrictions.
If you are using APIs like DirectX 12, Vulkan, or Metal, you can create staging buffers/resources flagged with host-visible (or CPU-accessible) memory properties. This lets the CPU write or read directly using mapped memory pointers without requiring an explicit copy command, though cache coherence rules still apply depending on the architecture.
What graphics API or OS framework are you using for your project?

LemonParty

  • Hero Member
  • *****
  • Posts: 618
Re: Accessing VRAM memory with CPU
« Reply #4 on: July 21, 2026, 01:07:04 pm »
JollyHong, currently I am not developing projects with graphics API. But I was curious if CPU can combine computational powers with GPU.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Thaddy

  • Hero Member
  • *****
  • Posts: 19625
  • Glad to be alive.
Re: Accessing VRAM memory with CPU
« Reply #5 on: July 21, 2026, 01:31:19 pm »
But it CAN: FreePascal supports OpenCL.
Any "programmer" that knows only one programming language is not a programmer

 

TinyPortal © 2005-2018