在directx中,如果重用一个插槽,gpu是否会将先前的资源保留在其内存中?原始处理器资源也可以安全地改变吗?
我正在写这个问题关于directx 和以下问题是其中的一部分,但我意识到我需要将它们分开。
如果某些东西不在 GPU 上的“槽”(寄存器)中,是否必须将其重新传输到 GPU 才能再次使用,即,如果将纹理 A 放入寄存器 t0,然后将纹理 B 放入寄存器 t0,则纹理 t0 在 GPU 上不再可用?或者它仍然驻留在 GPU 内存中,但我必须调用将其加载到纹理寄存器中才能获取它?或者完全是别的什么?
以类似的方式,调用 PSSetShaders、PSSetShaderResource 或 IASetVertexBuffers 等...在返回之前阻止数据并将数据复制到 GPU,因此在调用之后,可以更改甚至释放它们所基于的资源,因为它现在是驻留在GPU上?
我想这不仅仅是一个问题,但是如果我尝试在一天内问太多的 directx 问题,我预计我会遇到麻烦(我认为这些都是诚实的体面问题,msdn 文档对这些问题仍然保持沉默,即使它们是所有新手问题)。
I was writing this question about directx and the following questions were part of it, but I realized I needed to separate them out.
If something isn't in a "slot" (register) on the GPU, will it have to be retransferred to the GPU to be used again, i.e. if put texture A in register t0, then later put texture B in register t0, is texture t0 no longer available on the GPU? Or is it still resident in the GPU memory, but I will have to place a call to load it into a texture register to get at it? Or something else entirely?
In a similar vein do calls to PSSetShaders, or PSSetShaderResource, or IASetVertexBuffers, etc.... block and copy data to the GPU before returning, so after the call one can alter or even free the resources they were based on because it is now resident on the GPU?
I guess this is more than one question, but I expect I'll get trouble if I try asking too many directx questions in one day (thought I think these are honestly decent questions about which the msdn documentation remains pretty silent, even if they are all newbie questions).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果将纹理 A 放入寄存器 t0,然后将纹理 B 放入寄存器 t0,纹理 t0 在 GPU 上不再可用吗?
它不再绑定到纹理寄存器,因此不会应用于任何纹理寄存器多边形。您必须将其再次绑定到纹理寄存器才能使用它。
或者它仍然驻留在 GPU 内存中,但我必须调用将其加载到纹理寄存器中才能获取它?
通常它们会保留在视频内存中,直到有足够的其他资源为止加载它需要回收内存。在 DirectX 9 中,当您必须指定要放置资源的内存池时,这一点更为明显。现在,所有内容都有效地位于 Direct3D 9 中的 D3DPOOL_MANAGED 内存池中。当您设置纹理寄存器以使用纹理时,速度会像只要纹理仍在视频内存中。
以类似的方式调用 PSSetShaders、PSSetShaderResource 或 IASetVertexBuffers 等...在返回之前阻止并将数据复制到 GPU,因此在调用之后可以更改甚至释放它们所基于的资源,因为它现在驻留在 GPU 上?
DirectX 会为您管理资源,并尝试尽可能长时间地将它们保留在视频内存中。
if put texture A in regsiter t0, then later put texture B in register t0, is texture t0 no longer available on the GPU?
It is no longer bound to the texture register so will not get applied to any polygons. You will have to bind it to a texture register again to use it.
Or is it still resident in the GPU memory, but I will have to place a call to load it into a texture register to get at it?
Typically they will stay in video memory until enough other resources have been loaded in that it needs to reclaim the memory. This was more obvious in DirectX 9 when you had to specify which memory pool to place resource in. Now everything is effectively in what was the D3DPOOL_MANAGED memory pool in Direct3D 9. When you set the texture register to use the texture it will be fast as long as the textures is still in video memory.
In a similar vein do calls to PSSetShaders, or PSSetShaderResource, or IASetVertexBuffers, etc.... block and copy data to the GPU before returning, so after the call one can alter or even free the resources they were based on because it is now resident on the GPU?
DirectX manages the resources for you and tries to keep them in video memory as long as it can.