Vkd3d is considered as work-in-progress, there are known issues that have to be resolved. Moreover, there are some incompatibilities between Vulkan and Direct3D 12 which are another source of issues.

+

Vkd3d is considered as work-in-progress, there are known issues that have to be resolved. Moreover, there are some incompatibilities between Vulkan and Direct3D 12.

{| class="wikitable"

{| class="wikitable"

Line 8:

Line 8:

!Possible solutions

!Possible solutions

|-

|-

−

|Device memory over-allocation

−

|Some apps doesn't seem to care much about memory budget and always allocates the same amount of memory. On Windows, it seem that drivers allows allocating more memory than available. In Vulkan, device memory allocations fails quite quickly. This issue is especially problematic for GPUs with low amount of memory.

−

|

−

| VK_AMD_memory_overallocation_behavior

|-

|-

|NULL descriptors

|NULL descriptors

Line 17:

Line 13:

|NULL descriptors are currently emulated using dummy resources. Sparse resources are used when '''residencyNonResidentStrict''' is supported. The current solution doesn't handle '''resinfo''' and '''bufinfo''' instructions correctly.

|NULL descriptors are currently emulated using dummy resources. Sparse resources are used when '''residencyNonResidentStrict''' is supported. The current solution doesn't handle '''resinfo''' and '''bufinfo''' instructions correctly.

|-

|-

−

|Dynamic states

−

|In Direct3D 12 the following states are dynamic: vertex buffer strides, the primitive topology and viewport/scissor counts. In Vulkan, those states require compiling a new pipeline. The primitive topology type is still specified when Direct3D 12 pipeline states are created (one of points, lines, triangles, or patches).

−

|Vulkan pipelines are created on draw call time when we know all parameters to compile the pipeline.

|In Vulkan the strip cut value is derived from the index format. In Direct3D 12 0xffff or 0xffffffff can be used as the strip cut value with 16-bit and 32-bit index buffer formats.

−

|Not supported in Vulkan.

|

|

|-

|-

Line 49:

Line 33:

|Texture array views and textures views are incompatible in Vulkan.

|Texture array views and textures views are incompatible in Vulkan.

|

|

−

|-

−

|Copy between depth-stencil and color formats.

−

|In Direct3D 12 it is possible to copy data between compatible color and depth-stencil resources.

−

|We currently use a temporary buffer to perform the copy operation.

−

|We should implement the copy operation in shaders for graphics and compute queues.

|-

|-

|Descriptor heaps

|Descriptor heaps

|Direct3D 12 and Vulkan binding models are largely different. It seems to be implied that Direct3D 12 CBV/SRV/UAV descriptor heaps exist in GPU memory, but there's no real equivalent for that in Vulkan. Vulkan descriptor sets are probably the closest match, but among others have the issue that the descriptor type (CBV, SRV or UAV) would need to be declared in advance, while in Direct3D 12 these can be mixed freely within the descriptor heap. Run-time translation from Direct3D 12 binding model to Vulkan binding model is expected to introduce a noticeable overhead.

|Direct3D 12 and Vulkan binding models are largely different. It seems to be implied that Direct3D 12 CBV/SRV/UAV descriptor heaps exist in GPU memory, but there's no real equivalent for that in Vulkan. Vulkan descriptor sets are probably the closest match, but among others have the issue that the descriptor type (CBV, SRV or UAV) would need to be declared in advance, while in Direct3D 12 these can be mixed freely within the descriptor heap. Run-time translation from Direct3D 12 binding model to Vulkan binding model is expected to introduce a noticeable overhead.

+

|

+

|

+

|-

+

|CPU descriptor heaps

+

|Direct3D 12 allows to create and prepare descriptors in CPU heaps. Descriptors from CPU descriptor heaps can be copied to shader-visible descriptor heaps. In Vulkan, there are only shared-visibile descriptor sets, and '''VkCopyDescriptorSet''' is implemented very inefficiently on some drivers.

+

|

+

|

+

|-

+

|Descriptor heaps concurrency

+

|Some apps appear to concurrently overwrite descriptors in descriptor heaps. We need to confirm that this works reliably on Windows. It might not be a problem on Windows because implementations might simply write or copy descriptors data in memory. However, in our translation layer we have to manage VkImageView objects and potentially reference count them.

+

|

+

|

+

|-

+

|Descriptors for destroyed resources

+

|Apps keep descriptors for destroyed resources in descriptor heaps. This is problematic and may lead to invalid usage in Vulkan.

|

|

|

|

Line 70:

Line 64:

|

|

|-

|-

−

| D3D discard

+

| Separate resource state for depth-stencil

+

| In Direct3D, the depth aspect and the stencil aspect of an image can be in different image layouts.

+

|

+

|Vulkan extension.

+

|-

+

| Out-of-bounds resource access

+

| Vulkan doesn't give the same guarantees as Direct3D 12 when it comes to out-of-bounds resource access.

|

|

|

|

+

|-

+

|D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT

+

|On radv with AMD Polaris GPUs, the required alignment for textures may be higher than 0x10000 (D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT), e.g. 0x20000 or 0x40000. World of Warcraft aligns only to D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT and ignores the alignment returned from '''GetResourceAllocationInfo()'''.

+

|We currently allocate additional device memory when the heap offset is misaligned.

|

|

|-

|-

−

| Separate resource state for depth-stencil

+

|Swapchain

−

| In Direct3D, the depth aspect and the stencil aspect of an image can be in different image layouts.

+

|

−

|

+

* sRGB views.

−

| Vulkan extension.

+

* Scaling.

+

* Present mode without recreating.

+

|We currently use additional set of images and blit from them to the real swapchain.

|Fake virtual addresses are allocated for buffers. Virtual addresses have to be resolved to VkBuffer and an offset. The resolving of GPU virtual address introduces unnecessary overhead.

+

|

+

* '''VK_EXT_device_buffer_address''' can be used for root descriptors. Unfortunately, the extension doesn't help with vertex, index and stream output buffers. The extension also introduces some complications, e.g. multiple buffers can be bound to the same virtual memory address.

+

* Ideally, we could bind vertex, index and stream output buffers using '''VkDeviceAddress''' in Vulkan.

|In Direct3D 12 it is possible to copy data between compatible color and depth-stencil resources.

+

|We currently use a temporary buffer to perform the copy operation.

+

|We should implement the copy operation in shaders for graphics and compute queues.

+

|-

+

|Dynamic states

+

|In Direct3D 12 the following states are dynamic: vertex buffer strides, the primitive topology and viewport/scissor counts. In Vulkan, those states require compiling a new pipeline. The primitive topology type is still specified when Direct3D 12 pipeline states are created (one of points, lines, triangles, or patches).

+

|Vulkan pipelines are created on draw call time when we know all parameters to compile the pipeline.

+

|

+

* Add pipeline cache.

+

* Compile pipelines speculatively.

|}

|}

+

+

[[Category:vkd3d]]

Latest revision as of 01:03, 6 July 2019

Vkd3d is considered as work-in-progress, there are known issues that have to be resolved. Moreover, there are some incompatibilities between Vulkan and Direct3D 12.

Issue

Description

Current implementation

Possible solutions

NULL descriptors

Vulkan doesn't support NULL descriptors.

NULL descriptors are currently emulated using dummy resources. Sparse resources are used when residencyNonResidentStrict is supported. The current solution doesn't handle resinfo and bufinfo instructions correctly.

Memory object residency management doesn't exist in Vulkan. In Direct3D 12 resources and heaps can be evicted. Resource descriptors are still valid after a resource is made resident again.

We can try to evict memory manually (e.g. using sparse bindings).

Queries initial state

Queries are initially in the available state in Direct3D 12. Results are all equal to zero.

We track the query state, and fill buffer with zeroes when a query wasn't issued. The current implementation doesn't handle command lists executed out-of-order.

Texture array views

Texture array views and textures views are incompatible in Vulkan.

Descriptor heaps

Direct3D 12 and Vulkan binding models are largely different. It seems to be implied that Direct3D 12 CBV/SRV/UAV descriptor heaps exist in GPU memory, but there's no real equivalent for that in Vulkan. Vulkan descriptor sets are probably the closest match, but among others have the issue that the descriptor type (CBV, SRV or UAV) would need to be declared in advance, while in Direct3D 12 these can be mixed freely within the descriptor heap. Run-time translation from Direct3D 12 binding model to Vulkan binding model is expected to introduce a noticeable overhead.

CPU descriptor heaps

Direct3D 12 allows to create and prepare descriptors in CPU heaps. Descriptors from CPU descriptor heaps can be copied to shader-visible descriptor heaps. In Vulkan, there are only shared-visibile descriptor sets, and VkCopyDescriptorSet is implemented very inefficiently on some drivers.

Descriptor heaps concurrency

Some apps appear to concurrently overwrite descriptors in descriptor heaps. We need to confirm that this works reliably on Windows. It might not be a problem on Windows because implementations might simply write or copy descriptors data in memory. However, in our translation layer we have to manage VkImageView objects and potentially reference count them.

Descriptors for destroyed resources

Apps keep descriptors for destroyed resources in descriptor heaps. This is problematic and may lead to invalid usage in Vulkan.

ID3D12Fence

ID3D12Fence have an associated UINT64 value (see also timeline semaphores). In addition, ID3D12Fence can be signaled by GPU or CPU, and can also be waited for on CPU or ID3D12CommandQueue. Moreover, it's possible to signal native Win32 events when a fence reaches a certain value. In Vulkan, there is no way to signal native synchronization objects (e.g. HANDLEs to Win32 events or file descriptors) when, e.g. VkFence is signaled.

Timeline semaphores.

Sampler border color

In Direct3D 12 the sampler border color is defined as a float4 vector. In Vulkan the border color is constrained by the values of the VkBorderColor enum. (It might not be that important because we haven't encountered application which needs this yet).

Separate resource state for depth-stencil

In Direct3D, the depth aspect and the stencil aspect of an image can be in different image layouts.

Vulkan extension.

Out-of-bounds resource access

Vulkan doesn't give the same guarantees as Direct3D 12 when it comes to out-of-bounds resource access.

D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT

On radv with AMD Polaris GPUs, the required alignment for textures may be higher than 0x10000 (D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT), e.g. 0x20000 or 0x40000. World of Warcraft aligns only to D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT and ignores the alignment returned from GetResourceAllocationInfo().

We currently allocate additional device memory when the heap offset is misaligned.

Swapchain

sRGB views.

Scaling.

Present mode without recreating.

We currently use additional set of images and blit from them to the real swapchain.

In Vulkan the strip cut value is derived from the index format. In Direct3D 12 0xffff or 0xffffffff can be used as the strip cut value with 16-bit and 32-bit index buffer formats.

Not supported in Vulkan.

GPU virtual addresses

In Direct3D 12, vertex buffers, index buffers, stream output buffers and root descriptors are bound using GPU virtual addresses. In Vulkan, VkBuffer objects with an offset are used instead.

Fake virtual addresses are allocated for buffers. Virtual addresses have to be resolved to VkBuffer and an offset. The resolving of GPU virtual address introduces unnecessary overhead.

VK_EXT_device_buffer_address can be used for root descriptors. Unfortunately, the extension doesn't help with vertex, index and stream output buffers. The extension also introduces some complications, e.g. multiple buffers can be bound to the same virtual memory address.

Ideally, we could bind vertex, index and stream output buffers using VkDeviceAddress in Vulkan.

GetResourceAllocationInfo()

In Vulkan, a resource needs to be created to get allocation info.

We create temporary resources to get allocation info.

SetEventOnCompletion() / SetEventOnMultipleFenceCompletion()

We have a separate thread that signals Win32 events.

Timeline semaphores.

Copy between depth-stencil and color formats

In Direct3D 12 it is possible to copy data between compatible color and depth-stencil resources.

We currently use a temporary buffer to perform the copy operation.

We should implement the copy operation in shaders for graphics and compute queues.

Dynamic states

In Direct3D 12 the following states are dynamic: vertex buffer strides, the primitive topology and viewport/scissor counts. In Vulkan, those states require compiling a new pipeline. The primitive topology type is still specified when Direct3D 12 pipeline states are created (one of points, lines, triangles, or patches).

Vulkan pipelines are created on draw call time when we know all parameters to compile the pipeline.