1

How I can preload updated managed 2D texture to GPU memory in Direct3D11?

In Direct3D9 I called IDirect3DBaseTexture9::PreLoad to guarantee that texture will be ready for rendering.

Igor
  • 355
  • 1
  • 4
  • 12

1 Answers1

2

Direct3D9Ex and Direct3D 10 through DirectX 12 has no concept of D3DPOOL_MANAGED. This is because these versions of Direct3D do not have "lost device" in the sense that Direct3D 9 did. They only have "device removed" which happens when the GPU crashes or the driver is updated while your game/app is running. See Microsoft Docs.

Starting in Windows Vista, Video Memory is managed by the OS. Textures are paged in and out of video memory, and backed by system memory automatically. You can provide hints by using the SetEvictionPriority method.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81
  • Thanks for your reply! My app loads a series of textures and they all should be copied to GPU memory. For example, I need to show a texture exactly at certain time. I load a texture in advance and then set it for rendering. If texture stays in CPU memory it means that OS should copy this texture just at the moment of rendering, it may cause a small delay (1-2 frames) when a texture is being presented on the screen. In Metal (macOS) I can call didModifyChange() function to force updated texture to GPU memory. It's very strange that I cannot do the same with DX11. – Igor Aug 01 '21 at 06:43
  • DirectX 12 has more direct control over residency, but also requires the application to explicitly handle 'over-commit' scenarios for video ram. See [Microsoft Docs](https://learn.microsoft.com/en-us/windows/win32/direct3d12/memory-management-strategies). – Chuck Walbourn Aug 01 '21 at 17:44