d3d12: Use buffer pipe usage to inform allocation

For non-CPU-accessible pipe resource types (DEFAULT/IMMUTABLE),
allocate non-CPU-accessible buffers directly from the cache_bufmgr.
Update the d3d12_bo creation to handle nonmappable buffers.

For CPU-write-only (DYNAMIC/STREAM), use the upload slab_bufmgr.
Update this slab manager to use CPU_WRITE | GPU_READ PB usage.

For CPU-read-write (STAGING), use the readback_slab_bufmgr.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8095>
This commit is contained in:
Jesse Natalie
2020-12-14 11:53:13 -08:00
parent be19eb771a
commit ee1463db3c
4 changed files with 42 additions and 17 deletions

View File

@@ -863,7 +863,7 @@ d3d12_init_screen(struct d3d12_screen *screen, struct sw_winsys *winsys, IUnknow
struct pb_desc desc;
desc.alignment = D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT;
desc.usage = (pb_usage_flags)PB_USAGE_ALL;
desc.usage = (pb_usage_flags)(PB_USAGE_CPU_WRITE | PB_USAGE_GPU_READ);
screen->bufmgr = d3d12_bufmgr_create(screen);
screen->cache_bufmgr = pb_cache_manager_create(screen->bufmgr, 0xfffff, 2, 0, 64 * 1024 * 1024);