c++ - DirectX 11 缓冲区位置

标签 c++ windows directx directx-11

在 DirectX 中,当您想要创建 VertexBuffer、IndexBuffer 或 ConstantBuffer 时,您需要依赖 ID3D11Buffer interfaceID3D11Device::CreateBuffer

我想知道这个缓冲区是在哪里创建的?

是在系统内存还是显存

以及当您使用 ID3D11DeviceContext::IASetVertexBuffers 设置顶点缓冲区以及 IndexBuffer 和 ConstantBuffer 的相应方法时究竟发生了什么。

最佳答案

From the documentation :

In Direct3D 10/11, an application no longer specifies what type of memory (the pool) to create a resource in. Instead, you specify the intended usage of the resource, and let the runtime (in concert with the driver and a memory manager) choose the type of memory that will achieve the best performance.

无法保证缓冲区等资源的存储位置。 您可以“控制”在何处创建资源的唯一方法是为它们选择正确的 D3D11_USAGED3D11_USAGE_DEFAULTD3D11_USAGE_IMMUTABLE 资源可能最终会出现在 VRAM 中,D3D11_USAGE_DYNAMICD3D11_USAGE_STAGING 会出现在一些内存区域中,这两个区域都可以访问到 CPU 和 GPU。

只需确保根据资源需求选择最快的资源使用方式 D3D11_USAGE_IMMUTABLE > D3D11_USAGE_DEFAULT > D3D11_USAGE_DYNAMIC > D3D11_USAGE_STAGING

关于c++ - DirectX 11 缓冲区位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20563391/

相关文章:

c++ - 将整数舍入到另一个整数的最接近倍数

C++ if语句比较字符串不起作用

c# - Windows Phone 8.1 应用程序在不调试 Async Await 时崩溃

C++ 这个 do while 循环有什么问题

c++ - 如何在使用 TensorRT C++ API 编写的 TensorRT 模型上运行半精度推理?

c++ - 您如何试用小型/简单的 C 或 C++ 源代码?

php - 如何使用 WAMP 登录 phpMyAdmin,用户名和密码是什么?

graphics - 如何将此 HLSL 像素着色器校正为四边形的圆角?

c# - 使用 C# 截取任何外部应用程序的屏幕截图

Directx 11 骨骼动画