Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thoughts on potential dx12 support? #66

Open
Tracked by #3163
Elabajaba opened this issue Nov 4, 2022 · 3 comments
Open
Tracked by #3163

Thoughts on potential dx12 support? #66

Elabajaba opened this issue Nov 4, 2022 · 3 comments

Comments

@Elabajaba
Copy link

Elabajaba commented Nov 4, 2022

I've implemented dx12 suballocations in wgpu, but I was unable to use this crate for it due to the differences between vk and dx12's memory allocation strategies. Dx12 has you allocate an ID3D12Heap, but then you pass that into CreatePlacedResource which gives you an ID3D12Resource that you can then map/unmap/etc, vs Vulkan where you can do all that with just a DeviceMemory.

I haven't dug into what kind of changes enabling the dx12 method would entail, beyond the surface level of changing the MemoryDevice trait, but my initial impression is that it's probably better to just use a separate dx12 allocator instead of trying to duct tape dx12 support onto gpu-alloc.

I was wondering what your thoughts were on this, how difficult it might be, and if you even had any interest in including dx12 support in gpu-alloc?

@zakarumych
Copy link
Owner

zakarumych commented Nov 7, 2022

As I understand it, gpu-alloc should not create ID3D12Resources.
It should only work on the level of ID3D12Heap.
gpu-alloc allocation routine would simply return ID3D12Heap + offset + size for allocation requests and then user would create ID3D12Resources using CreatePlacedResource as needed, possibly suballocating from returned range.

@zakarumych
Copy link
Owner

zakarumych commented Nov 7, 2022

gpu-alloc mapping API should be changed to reflect that mapping of ranges from ID3D12Heap is now allowed directly.
Or maybe allow it using internal overlapping ID3D12Resources objects?

@Elabajaba
Copy link
Author

I made a gist of some of the current issues I've run into trying to use this with dx12, which include creating the allocator not mapping well to dx12, and the fact that gpu_alloc's map/unmap_memory and memory_range stuff don't seem to be useful currently for dx12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants