Vkd3d known 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.

Issue

Description

Current implementation

Possible solutions

Device memory over-allocation

Some apps don'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. The issue is amplified by the lack of eviction API in Vulkan.

VK_AMD_memory_overallocation_behavior might slightly help.

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

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.

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.

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.

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.

Strip cut value

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.

Texture array views

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

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.

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.

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).

D3D discard

Not implemented yet.

Vulkan extension.

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.

minTexelBufferOffsetAlignment on NVIDIA

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.

Conditional rendering

VK_EXT_conditional_rendering uses 32-bit values while D3D12 uses 64-bit values. There are more incompatibilities.

SetEventOnCompletion() / SetEventOnMultipleFenceCompletion()

Our current implementation of SetEventOnCompletion() is quite inefficient. SetEventOnMultipleFenceCompletion() is not implemented yet.

Timeline semaphores.

GetResourceAllocationInfo()

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

We create temporary resources to get allocation info.

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.