Commit Graph

199 Commits

Author SHA1 Message Date
Józef Kucia 10b04414e8 libs/vkd3d: Load libvulkan dynamically.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-18 16:21:51 +01:00
Józef Kucia fcc6846559 libs/vkd3d: Allow library user to load libvulkan.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-18 16:21:44 +01:00
Józef Kucia ae014a29c4 libs/vkd3d: Allow library user to select Vulkan physical device.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-16 20:11:23 +01:00
Józef Kucia d18e986b27 libs/vkd3d: Make GPU VA allocator thread-safe.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-15 17:51:35 +01:00
Józef Kucia db2e1d402e libs/vkd3d: Synchronize access to Vulkan queues.
Access to VkQueue must be externally synchronized.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-15 17:51:32 +01:00
Józef Kucia 0f46ae3e55 libs/vkd3d: Add API for creating vkd3d instances.
Makes possible to share a Vulkan instance between multiple devices.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-12 19:27:01 +01:00
Józef Kucia 604056daf4 libs/vkd3d: Allow library user to create internal threads.
We want to create Win32 threads when running under Wine.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-12 19:26:58 +01:00
Józef Kucia 5123feb750 libs/vkd3d: Remove unused prototype for vkEnumerateInstanceLayerProperties().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-09 20:37:08 +01:00
Józef Kucia b211df683e libs/vkd3d: Implement copying between depth/stencil and color textures.
This could be implemented more efficiently, but ideally we would get
a Vulkan extension for copying between depth/stencil and color textures.
2017-10-20 18:27:17 +02:00
Józef Kucia 5b5cffcf84 libs/vkd3d: Implement creating root signature from bytecode. 2017-10-10 16:02:09 +02:00
Józef Kucia 67aed755ab libs/vkd3d: Implement d3d12_command_list_ClearUnorderedAccessViewUint() for R32_UINT buffer views.
Ideally, we would store additional informations only in CPU descriptors.
2017-10-04 13:55:33 +02:00
Józef Kucia fecc94cebc libs/vkd3d: Add helpers for dereferencing descriptor handles. 2017-10-04 13:55:33 +02:00
Józef Kucia 8cb004bdc4 libs/vkd3d: Create single default sampler per device. 2017-09-21 15:12:13 +02:00
Józef Kucia eb8eba02bd libs/vkd3d: Implement d3d12_command_list_SetComputeRootShaderResourceView(). 2017-09-19 17:29:20 +02:00
Józef Kucia 90cf804d9b libs/vkd3d: Use Vulkan pipeline cache for graphics pipelines. 2017-09-19 10:58:04 +02:00
Józef Kucia acfd64c20e libs/vkd3d: Avoid copying descriptors for dirty root descriptor tables. 2017-09-18 15:40:42 +02:00
Józef Kucia 2ea8ffb554 libs/vkd3d: Avoid vkCmdCopyQueryPoolResults() for not issued queries.
The Vulkan spec states:

  * "If the query does not become available in a finite amount of time
    (e.g.  due to not issuing a query since the last reset), a
    VK_ERROR_DEVICE_LOST error may occur."

  * "If queries will never finish (e.g. due to being reset but not
    issued), then vkGetQueryPoolResults may not return in finite time."
2017-09-14 14:57:09 +02:00
Józef Kucia 8e802ed0af libs/vkd3d: Update descriptor table ranges only with matching descriptor types. 2017-09-11 22:35:16 +02:00
Józef Kucia 32966338df libs/vkd3d: Get rid of UAV counter count from d3d12_pipeline_state. 2017-09-08 15:30:48 +02:00
Józef Kucia 9afaed918d libs/vkd3d: Bind descriptor set for UAV counters. 2017-09-08 15:04:30 +02:00
Józef Kucia 19dc6c412e libs/vkd3d: Constify root signature pointers. 2017-09-08 15:04:30 +02:00
Józef Kucia 0d28036d2a libs/vkd3d: Add UAV counter support for compute pipelines.
UAV counter descriptors are stored in a separate VkDescriptorSet.
A VkPipelineLayout created for compute pipeline is compatible for all
other descriptor sets with the VkPipelineLayout created for the root
signature. This ensures that only UAV counter bindings in the last
descriptor set may be disturbed when switching between pipelines with
compatible root signatures.

The implementation of vkd3d_popcount() is based on
https://graphics.stanford.edu/~seander/bithacks.html
2017-09-08 15:04:30 +02:00
Józef Kucia efdf2ec691 libs/vkd3d-shader: Rename vkd3d_shader_push_constant to vkd3d_shader_push_constant_buffer.
This should be clearer. Multiple constant buffers can be assigned to
a single push constant range.
2017-09-07 17:15:54 +02:00
Józef Kucia bd0c886281 libs/vkd3d: Store push constant ranges in root signatures.
In prep for UAV counters support.
2017-09-07 17:15:54 +02:00
Józef Kucia 22b019137b libs/vkd3d: Factor out vkd3d_create_descriptor_set_layout() function. 2017-09-07 17:15:53 +02:00
Józef Kucia 495bd6fddc libs/vkd3d: Create Vulkan buffer views for UAV counter resources. 2017-09-07 17:15:53 +02:00
Józef Kucia 23150f6050 libs/vkd3d: Update Vulkan descriptor sets just before draw call. 2017-09-05 11:53:55 +02:00
Józef Kucia 603a44fb46 libs/vkd3d: Implement d3d12_device_CopyDescriptors().
There is no easy way to duplicate or copy Vulkan views and samplers.
Therefore, we use reference counting for Vulkan views and samplers when
copying them between descriptor heaps.
2017-09-04 18:33:09 +02:00
Józef Kucia a780b7a11c libs/vkd3d: Implement reference counting for Vulkan views and samplers. 2017-09-04 18:33:09 +02:00
Józef Kucia 62bd4e6e63 libs/vkd3d: Add support for OffsetInDescriptorsFromTableStart. 2017-08-31 11:21:34 +02:00
Józef Kucia d8847aa462 libs/vkd3d: Fix texture region copying for miplevels other than 0. 2017-08-31 09:42:50 +02:00
Józef Kucia 0dca9909d9 libs/vkd3d: Copy single layer for array textures in d3d12_command_list_CopyTextureRegion(). 2017-08-31 09:42:50 +02:00
Józef Kucia f3862db04d libs/vkd3d: Use VK_PIPELINE_BIND_POINT_RANGE_SIZE. 2017-08-31 09:29:02 +02:00
Józef Kucia 904858f4a9 libs/vkd3d: Introduce d3d12_resource_is_texture() helper function.
Makes some code easier to read.
2017-08-30 18:31:52 +02:00
Henri Verbeet f1aa742569 libs/vkd3d: Support D3D12_FEATURE_D3D12_OPTIONS in d3d12_device_CheckFeatureSupport(). 2017-08-30 18:11:38 +02:00
Józef Kucia 489abe870c libs/vkd3d: Implement d3d12_resource_GetHeapProperties(). 2017-08-30 17:57:23 +02:00
Henri Verbeet 3019a3e8f1 libs/vkd3d: Support both native and Win32 wchar_t. 2017-08-29 16:36:05 +02:00
Sven Hesse 5b6bd40464 libs/vkd3d: Cache the number of valid bits in queue timestamp queries. 2017-08-29 15:16:41 +02:00
Henri Verbeet 7e5af314f1 libs/vkd3d: Validation should happen in the d3d12/Vulkan validation layers.
Unless we have tests that say otherwise.
2017-08-28 20:37:17 +02:00
Henri Verbeet e228d776be libs/vkd3d: Fix the d3d12_query_heap_create() argument order. 2017-08-28 20:37:03 +02:00
Henri Verbeet b000952e4f libs/vkd3d: Implement indirect draws. 2017-08-28 19:26:31 +02:00
Sven Hesse 988e1a96de libs/vkd3d: Implement EndQuery() for QUERY_TYPE_TIMESTAMP. 2017-08-25 15:16:05 +02:00
Sven Hesse 67587f81e4 libs/vkd3d: Remember the Query Heap creation properties. 2017-08-25 15:16:03 +02:00
Sven Hesse 79cbc900bc libs/vkd3d: Create Vulkan Query Pools for D3D12 Query Heaps. 2017-08-23 16:18:15 +02:00
Józef Kucia 92bb7969a5 libs/vkd3d: Create push descriptor set only if needed. 2017-08-18 17:08:56 +02:00
Józef Kucia 08284f0f85 libs/vkd3d: Fix draw calls with no framebuffer attachments. 2017-08-18 17:08:56 +02:00
Józef Kucia 1d5b8b7d32 libs/vkd3d: Implement depth/stencil resource views. 2017-08-16 17:38:33 +02:00
Józef Kucia f5515c46df libs/vkd3d: Create default sampler for each root signature.
We need a sampler for SpvOpImageFetch aka texelFetch().
2017-08-16 13:11:52 +02:00
Józef Kucia dc081f6f9e libs/vkd3d: Set VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT only for typeless formats. 2017-08-15 13:10:05 +02:00
Józef Kucia 32e69fa945 libs/vkd3d: Use KHR_push_descriptor for root descriptors.
Thanks to KHR_push_descriptor, we do not have to allocate descriptor
sets for subsequent root descriptor parameters updates.
2017-08-11 13:58:04 +02:00
Józef Kucia 4a767a8f11 libs/vkd3d: Enable VK_KHR_get_physical_device_properties2 instance extension.
Required for VK_KHR_push_descriptor. Validation layers complain when
required extensions are not enabled.
2017-08-11 13:58:04 +02:00
Józef Kucia 9b54e0df17 libs/vkd3d: Add VK_KHR_push_descriptor extension. 2017-08-11 13:58:04 +02:00
Józef Kucia 1261c7ea0f libs/vkd3d: Do not update bound descriptor sets. 2017-08-11 13:58:04 +02:00
Józef Kucia 6ae3f1ee29 libs/vkd3d: Introduce vkd3d_pipeline_bindings structure. 2017-08-11 13:58:04 +02:00
Józef Kucia b0e47baebf libs/vkd3d: Implement d3d12_command_list_Set{Compute,Graphics}RootUnorderedAccessView(). 2017-08-09 18:44:16 +02:00
Józef Kucia 074513dc4d libs/vkd3d: Add support for sampler descriptors in root descriptor tables. 2017-08-04 17:06:33 +02:00
Józef Kucia fa0a2eab21 libs/vkd3d: Store Vulkan bindings for descriptor table root parameters in root signature. 2017-08-04 17:06:33 +02:00
Józef Kucia 0859b94833 libs/vkd3d: Implement d3d12_device_CreateConstantBufferView(). 2017-08-04 17:06:33 +02:00
Józef Kucia 573460550e libs/vkd3d: Do not assume CBV root parameter index is equal to Vulkan descriptor binding. 2017-08-02 15:30:15 +02:00
Józef Kucia de2024d235 libs/vkd3d: Do not try to create buffer views for block-compressed formats. 2017-08-02 15:30:15 +02:00
Sven Hesse 1decba1a99 libs/vkd3d: Add block size information to the texture format array. 2017-08-02 14:03:39 +02:00
Józef Kucia e074c30dc7 libs/vkd3d: Pass push constants mapping to shader compiler. 2017-07-28 10:19:37 +02:00
Józef Kucia 72f723522e libs/vkd3d: Implement d3d12_command_list_SetComputeRoot32BitConstant(). 2017-07-28 10:19:37 +02:00
Henri Verbeet 605a02274e libs/vkd3d: Allocate GPU virtual addresses for resources.
Direct3D 12 resources, buffers in particular, are bound to the pipeline
by their GPU virtual address. In Vulkan, these addresses are not visible
to the application. We previously handled this by returning the VkBuffer
handle as virtual address, but this can't work when the application
binds anything other than the resource's base GPU VA. Instead, we
allocate ranges of GPU address space and associate resources with it.

This uses the (naive) approach of simply allocating subsequent ranges,
and never reclaiming them. Eventually we'll have to revisit that.
2017-07-27 16:28:46 +02:00
Henri Verbeet 1acd3d44b1 Implement d3d12_device_CreateQueryHeap(). 2017-07-27 16:28:29 +02:00
Henri Verbeet e9046a81cc Implement d3d12_device_CreateCommandSignature(). 2017-07-27 16:28:24 +02:00
Józef Kucia 6d569fcbc6 libs/vkd3d: Assign consecutive Vulkan bindings for D3D12 descriptors. 2017-07-26 13:45:25 +02:00
Józef Kucia 5ac8dbfc64 libs/vkd3d: Implement d3d12_device_CreateUnorderedAccessView(). 2017-07-25 12:50:14 +02:00
Józef Kucia 73cdf0164a libs/vkd3d: Implement d3d12_command_list_SetComputeRootSignature(). 2017-07-25 12:50:14 +02:00
Józef Kucia 055b27da12 libs/vkd3d: Rename current_descriptor_set to graphics_descriptor_set. 2017-07-25 12:50:14 +02:00
Sven Hesse dadce84a4b libs/vkd3d: Create a compute queue family. 2017-07-21 15:24:57 +02:00
Józef Kucia 593a13402d libs/vkd3d: Add support for static samplers.
We still do not implement any reasonable mapping between D3D registers
and Vulkan bindings.
2017-07-17 16:25:29 +02:00
Józef Kucia 1c79831873 libs/vkd3d: Implement d3d12_device_CreateShaderResourceView(). 2017-07-14 13:44:35 +02:00
Józef Kucia f3d297574a libs/vkd3d: Implement d3d12_device_CreateSampler(). 2017-07-12 13:10:44 +02:00
Józef Kucia eff8428c71 libs/vkd3d-common: Move vkd3d_array_reserve() from libvkd3d. 2017-06-19 18:05:53 +02:00
Józef Kucia 84889646f6 Update license to LGPL v2.1. 2017-06-16 22:11:21 +02:00
Henri Verbeet cd4f4a2976 libs/vkd3d: Implement d3d12_command_list_SetGraphicsRootConstantBufferView(). 2016-11-13 00:51:52 +01:00
Henri Verbeet 0b2702d96e libs/vkd3d: Implement d3d12_command_list_SetGraphicsRootSignature(). 2016-11-13 00:45:25 +01:00
Henri Verbeet 0f38858996 libs/vkd3d: Implement D3D12_ROOT_PARAMETER_TYPE_CBV root signature parameters. 2016-11-13 00:44:19 +01:00
Henri Verbeet d97df34093 libs/vkd3d: Implement depth/stencil pipeline state attachments. 2016-11-13 00:42:31 +01:00
Henri Verbeet f252d6cd31 libs/vkd3d: Implement d3d12_device_CreateDepthStencilView(). 2016-11-10 16:42:24 +01:00
Henri Verbeet 2e10db6f8e libs/vkd3d: Add support for D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA. 2016-11-10 16:41:01 +01:00
Józef Kucia 4aab207b56 libs/vkd3d: Fix initial state transtion for swapchain images. 2016-10-25 13:23:18 +02:00
Józef Kucia b9da47ebe2 libs/vkd3d: Implement naive initial state transition.
This is not a complete solution yet. In order to allow recording
multiple command list and executing them in any order we have to fix up
the current image layout when submitting a command list instead of when
a command list is being recorded.
2016-10-25 13:23:18 +02:00
Józef Kucia b011f0b972 libs/vkd3d: Introduce resource flags. 2016-10-25 13:23:18 +02:00
Józef Kucia e42a9da943 libs/vkd3d: Use VK_KHR_*_EXTENSION_NAME defines. 2016-10-24 15:28:08 +02:00
Henri Verbeet b760b52859 libs/vkd3d: Export a function to get the Vulkan physical device from a d3d12 device. 2016-10-24 13:57:05 +02:00
Henri Verbeet c79584ed92 libs/vkd3d: Export a function to get the Vulkan queue family index from a d3d12 command queue. 2016-10-24 13:57:05 +02:00
Józef Kucia eea8617b9b libs/vkd3d: GPU virtual address for texture resources is always 0. 2016-10-24 13:20:09 +02:00
Józef Kucia e19e428ed0 libs/vkd3d: Check if device memory is CPU accessible in d3d12_resource_Map(). 2016-10-24 13:20:09 +02:00
Józef Kucia 384bb26ea5 libs/vkd3d: Naming conventions. 2016-10-20 16:38:04 +02:00
Józef Kucia 52211e6c40 libs/vkd3d: Free command buffers on command allocator reset. 2016-10-20 16:38:04 +02:00
Józef Kucia 0944475c6a libs/vkd3d: Implement transition barriers. 2016-10-19 16:39:48 +02:00
Józef Kucia f2c980af56 libs/vkd3d: Validate resource state for resource barriers. 2016-10-19 16:39:48 +02:00
Józef Kucia 69cd100d48 libs/vkd3d: Validate initial resource state. 2016-10-19 13:10:12 +02:00
Henri Verbeet 2a49173b60 libs/vkd3d: Export a function to create a d3d12 resource from a Vulkan image. 2016-10-19 09:59:42 +02:00
Henri Verbeet fcc9f9b294 libs/vkd3d: Merge vkd3d_vulkan.h into vkd3d_private.h. 2016-10-19 09:58:53 +02:00
Henri Verbeet 4a558d5a4a libs/vkd3d: Implement d3d12_command_list_DrawInstanced(). 2016-10-10 17:26:46 +02:00
Henri Verbeet 5c9ea3ede3 libs/vkd3d: Implement d3d12_device_CreateGraphicsPipelineState(). 2016-10-10 17:26:38 +02:00
Henri Verbeet a0ccb1c581 libs/vkd3d: Implement d3d12_command_list_SetPipelineState(). 2016-10-10 17:26:13 +02:00