[D3D12] ID3D12Resource::Map on a default resource

Started by
4 comments, last by SoldierOfLight 7 years, 11 months ago

It seems like it's valid usage, the docs don't seem to mention it. However, isn't the point of a DEFAULT resource that it's not visible to the host? You would have to use an upload heap to stage it.

Advertisement

You can only use Map() on resources which do not have CPU page properties of NONE (must be write-back or write-combined). The HEAP_TYPE_DEFAULT implies CPU page properties of NONE, so it is not mappable. If you try, you'll get a failure and the debug layer will complain.

That makes sense, and I it's what I figured would happen. Thanks!

Yeah, it's clearly stated in the official document, that only the UPLOAD type of resource can Map(), which means a relatively low performance along with its access continence.

"default" is misleading, it actually means device local memory. It's video memory in case of discrete gpu and not all gpu allows cpu to write to their memory.

"Default" follows in the tradition of D3D, coming from D3DPOOL_DEFAULT and continuing with D3D11_USAGE_DEFAULT. I agree it's not the best name, but it works well enough. Basically, for discrete GPUs, "default" = video memory with no CPU access, and for integrated GPUs, "default" = system memory with no CPU access.

Note that with D3D12, you can you explicitly control the properties of the memory you request along two axes (location, CPU access) by using D3D12_HEAP_TYPE_CUSTOM and specifying appropriate properties. You can even translate from the well-defined heap types (default, upload, readback) to their appropriate properties with GetCustomHeapProperties. There's currently no way to create video memory heaps with CPU access though.

This topic is closed to new replies.

Advertisement