创建着色器资源视图性能

Creating Shader Resource View performance

我想知道在将 ID3D12Resource 传递到 ID3D12GraphicsCommandList 之前为 ID3D12Resource 创建着色器资源视图并在帧完成后销毁它是否被认为是一种 "okay" 做法?

请注意,我只为所述资源创建了一次描述符视图。

这是一位微软工程师关于为什么 CreateShaderResourceView return 无效而不是错误代码的引用。

We intentionally don't have return codes on high frequency APIs since it would be a waste of CPU time to be checking for errors every call, which could be happening on the fly many thousands of times a frame.

他们在设计上假设它是一个api可以在一个框架中调用多次,你的问题的答案是,是的,你可以做到,这不是问题。

只要 gpu 在覆盖它之前可能需要它,您就必须小心保护描述符堆中的视图生命周期。