简体   繁体   English

Direct3D11在哪里分配资源对象?

[英]Where Does Direct3D11 Allocate Resource Objects?

I've been reading up on Direct3D11 a lot (including right here on stack overflow!) and in all my research I haven't been able to conclusively answer this question: 我已经阅读了很多有关Direct3D11的文章(包括堆栈溢出!),在我的所有研究中,我都无法最终回答以下问题:

When a Resource object (ie a Buffer or a Texture object) is created, for example with pDevice->CreateBuffer(), where is it stored? 当创建资源对象(例如Buffer或Texture对象)时,例如使用pDevice-> CreateBuffer(),它将存储在哪里? On system RAM or on the GPU's Video-RAM? 在系统RAM还是GPU的Video-RAM上? Or am I entirely misunderstanding the fundamental nature of what a Resource object is? 还是我完全误解了资源对象的基本性质?

Obviously whatever data you populate the resource with (such as vertex and index arrays) is stored wherever you - the programmer - placed it, but once you map that data to the Resource where is it copied? 显然,您用来填充资源的任何数据(例如顶点和索引数组)都存储在您(程序员)放置在任何地方的位置,但是一旦将数据映射到Resource上后,该数据将复制到哪里? (I'm assuming that, since Resources have to be mapped and unmapped for read/write protection the mapped data is in fact copied, perhaps to VRAM). (我假设,由于必须对资源进行映射和取消映射以进行读/写保护,因此实际上将映射的数据复制到了VRAM中)。 Moreover, where is the Resource object itself instantiated? 此外,资源对象本身在哪里实例化?

Thanks in advance for any and all help! 在此先感谢您提供的所有帮助!

During resource creation, your Create* call goes through D3D run time, UMD (user mode graphics driver) & KMD (kernel mode). 在创建资源期间,您的Create *调用将遍历D3D运行时,UMD(用户模式图形驱动程序)和KMD(内核模式)。 The KMD takes care of page table management (it could talk to the OS in the case of shared virtual memory, but lets ignore that). KMD负责页表管理(在共享虚拟内存的情况下,它可以与OS通讯,但是可以忽略它)。 If your resource doesn't use SVM, then it is blitted to the graphics memory. 如果您的资源不使用SVM,则将其渗入图形内存。

The graphics memory for processor graphics (such as Intel Iris) is your system RAM. 用于处理器图形的图形内存(例如Intel Iris)是您的系统RAM。 So, its really just a copy from the applications virtual address space to the KMD. 因此,它实际上只是从应用程序虚拟地址空间到KMD的副本。

For discrete graphics cards, the data resides on the video RAM of your card. 对于独立显卡,数据驻留在显卡的视频RAM中。 The GPU can work only with data it the video RAM. GPU只能处理视频RAM中的数据。 (I'm not sure how shared virtual memory works for discrete graphics) (我不确定共享虚拟内存如何用于离散图形)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM