DirectX 纹理是否共享/减少(32 位)应用程序的地址空间?
想象一下:
- 一个 32 位应用程序,具有 2 GB 地址空间,因此最多可以分配 2 GB 内存(不考虑碎片)
- 具有 1 GB 图形内存的图形卡
当应用程序使用例如 1.5 GB 内存时,它可以分配另外 1 GB 纹理?它将总共使用 2.5 GB 内存,这对于 32 位应用程序本身来说是不可能的。
据我所知,只有当应用程序“锁定”纹理以获得指向内存的指针时,纹理才会映射到应用程序的地址空间。所以我的假设是仅在锁定期间才需要地址空间。由于只有一些纹理被锁定,因此它不应该消耗整个地址空间。
Imagine this:
- a 32 bit application which has 2 GB address space and can therefore allocate at max 2 GB of memory (let fragmentation beside)
- a Graphic card with 1 GB of graphics memory
When the application uses e.g. 1.5 GB of memory, can it allocate another 1 GB of textures? It would use in sum 2.5 GB of memory which is not possible for the 32 bit application itself.
AFAIK textures are only mapped into the address space of the application when it "locks" the texture to get a pointer to the memory. So my assumption is the address space is only needed during the lock. As only some textures are locked it shouldn't consume the whole address space.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对此没有简单的答案,因为纹理可以在视频内存中分配,但它们也可以在系统内存上。
所以这取决于用途。
使用此构造函数并注意 Pool 参数:
如果选择 Pool.VideoMemory,则数据将放置在视频内存中,并且只有少数使用几个字节的成员存储在系统内存中。如果您选择 Pool.SystemMemory 那么您当然会使用内存分配空间。
当您获取视频内存纹理的表面指针并使用锁定位时:
您实际上是在本地内存中分配一个称为位的新变量。所以对于这种纹理类型的答案仍然是否定的。另一个变量使用内存分配空间,这就是您重新获取位的变量。
在视频内存池上分配的 DX 纹理仅使用几个字节的系统内存进行分配。
希望有帮助,
火星。
There is no simple answer to this because textures can be allocated in video memory but they can be on system memory too.
So it depends on the usage.
Take this constructor and note the Pool parameter:
If you choose Pool.VideoMemory then the data is placed in video memory and only a few members using a few bytes are stored in system memory. If you choose Pool.SystemMemory then of course you use memory allocation space.
When you get the surface pointer of a video memory texture and use lock bits:
You are actually allocating a new variable in local memory called bits. So the answer to this type of texture is still no. Another variable uses memory allocation space and that is the variable you get bits back into.
DX textures allocated on the VideoMemory Pool use only a few bytes of system memory for allocation.
Hope that helps,
Mars.