Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- libs/vkd3d/device.c | 23 +++++++++++++++++++++++ libs/vkd3d/vkd3d_private.h | 3 +++ libs/vkd3d/vulkan_procs.h | 3 +++ 3 files changed, 29 insertions(+)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 757d4ac8..3f99ef9a 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -127,6 +127,7 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] = VK_EXTENSION(KHR_IMAGE_FORMAT_LIST, KHR_image_format_list), VK_EXTENSION(KHR_MAINTENANCE3, KHR_maintenance3), VK_EXTENSION(KHR_PUSH_DESCRIPTOR, KHR_push_descriptor), + VK_EXTENSION(KHR_TIMELINE_SEMAPHORE, KHR_timeline_semaphore), /* EXT extensions */ VK_EXTENSION(EXT_CONDITIONAL_RENDERING, EXT_conditional_rendering), VK_EXTENSION(EXT_DEBUG_MARKER, EXT_debug_marker), @@ -664,6 +665,7 @@ struct vkd3d_physical_device_info VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT texel_buffer_alignment_properties; VkPhysicalDeviceTransformFeedbackPropertiesEXT xfb_properties; VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_divisor_properties; + VkPhysicalDeviceTimelineSemaphorePropertiesKHR timeline_semaphore_properties;
VkPhysicalDeviceProperties2KHR properties2;
@@ -675,6 +677,7 @@ struct vkd3d_physical_device_info VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT texel_buffer_alignment_features; VkPhysicalDeviceTransformFeedbackFeaturesEXT xfb_features; VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_divisor_features; + VkPhysicalDeviceTimelineSemaphoreFeaturesKHR timeline_semaphore_features;
VkPhysicalDeviceFeatures2 features2; }; @@ -693,8 +696,10 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i VkPhysicalDeviceDepthClipEnableFeaturesEXT *depth_clip_features; VkPhysicalDeviceMaintenance3Properties *maintenance3_properties; VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb_properties; + VkPhysicalDeviceTimelineSemaphorePropertiesKHR *timeline_semaphore_properties; VkPhysicalDevice physical_device = device->vk_physical_device; VkPhysicalDeviceTransformFeedbackFeaturesEXT *xfb_features; + VkPhysicalDeviceTimelineSemaphoreFeaturesKHR *timeline_semaphore_features; struct vkd3d_vulkan_info *vulkan_info = &device->vk_info;
memset(info, 0, sizeof(*info)); @@ -710,6 +715,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vertex_divisor_properties = &info->vertex_divisor_properties; xfb_features = &info->xfb_features; xfb_properties = &info->xfb_properties; + timeline_semaphore_properties = &info->timeline_semaphore_properties; + timeline_semaphore_features = &info->timeline_semaphore_features;
info->features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
@@ -727,6 +734,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vk_prepend_struct(&info->features2, xfb_features); vertex_divisor_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; vk_prepend_struct(&info->features2, vertex_divisor_features); + timeline_semaphore_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR; + vk_prepend_struct(&info->features2, timeline_semaphore_features);
if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &info->features2)); @@ -745,6 +754,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vk_prepend_struct(&info->properties2, xfb_properties); vertex_divisor_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; vk_prepend_struct(&info->properties2, vertex_divisor_properties); + timeline_semaphore_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES_KHR; + vk_prepend_struct(&info->properties2, timeline_semaphore_properties);
if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceProperties2KHR(physical_device, &info->properties2)); @@ -817,6 +828,7 @@ static void vkd3d_trace_physical_device_limits(const struct vkd3d_physical_devic const VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *buffer_alignment; const VkPhysicalDeviceMaintenance3Properties *maintenance3; const VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb; + const VkPhysicalDeviceTimelineSemaphorePropertiesKHR *timeline_semaphore;
TRACE("Device limits:\n"); TRACE(" maxImageDimension1D: %u.\n", limits->maxImageDimension1D); @@ -1021,6 +1033,10 @@ static void vkd3d_trace_physical_device_limits(const struct vkd3d_physical_devic divisor_properties = &info->vertex_divisor_properties; TRACE(" VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT:\n"); TRACE(" maxVertexAttribDivisor: %u.\n", divisor_properties->maxVertexAttribDivisor); + + timeline_semaphore = &info->timeline_semaphore_properties; + TRACE(" VkPhysicalDeviceTimelineSemaphorePropertiesKHR:\n"); + TRACE(" maxTimelineSemaphoreValueDifference: %u.\n", timeline_semaphore->maxTimelineSemaphoreValueDifference); }
static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_device_info *info) @@ -1033,6 +1049,7 @@ static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_dev const VkPhysicalDeviceDepthClipEnableFeaturesEXT *depth_clip_features; const VkPhysicalDeviceFeatures *features = &info->features2.features; const VkPhysicalDeviceTransformFeedbackFeaturesEXT *xfb; + const VkPhysicalDeviceTimelineSemaphoreFeaturesKHR *timeline_semaphore;
TRACE("Device features:\n"); TRACE(" robustBufferAccess: %#x.\n", features->robustBufferAccess); @@ -1165,6 +1182,10 @@ static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_dev divisor_features->vertexAttributeInstanceRateDivisor); TRACE(" vertexAttributeInstanceRateZeroDivisor: %#x.\n", divisor_features->vertexAttributeInstanceRateZeroDivisor); + + timeline_semaphore = &info->timeline_semaphore_features; + TRACE(" VkPhysicalDeviceTimelineSemaphoreFeaturesKHR:\n"); + TRACE(" timelineSemaphore: %#x.\n", timeline_semaphore->timelineSemaphore); }
static void vkd3d_init_feature_level(struct vkd3d_vulkan_info *vk_info, @@ -1294,6 +1315,8 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, vulkan_info->transform_feedback_queries = physical_device_info->xfb_properties.transformFeedbackQueries; vulkan_info->max_vertex_attrib_divisor = max(physical_device_info->vertex_divisor_properties.maxVertexAttribDivisor, 1);
+ vulkan_info->max_timeline_semaphore_value_difference = max(physical_device_info->timeline_semaphore_properties.maxTimelineSemaphoreValueDifference, 1); + device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64; device->feature_options.OutputMergerLogicOp = features->logicOp; /* SPV_KHR_16bit_storage */ diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 0c031d20..84abcb8d 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -100,6 +100,7 @@ struct vkd3d_vulkan_info bool KHR_image_format_list; bool KHR_maintenance3; bool KHR_push_descriptor; + bool KHR_timeline_semaphore; /* EXT device extensions */ bool EXT_conditional_rendering; bool EXT_debug_marker; @@ -116,6 +117,8 @@ struct vkd3d_vulkan_info bool vertex_attrib_zero_divisor; unsigned int max_vertex_attrib_divisor;
+ uint64_t max_timeline_semaphore_value_difference; + VkPhysicalDeviceLimits device_limits; VkPhysicalDeviceSparseProperties sparse_properties;
diff --git a/libs/vkd3d/vulkan_procs.h b/libs/vkd3d/vulkan_procs.h index ec29eb45..d080278a 100644 --- a/libs/vkd3d/vulkan_procs.h +++ b/libs/vkd3d/vulkan_procs.h @@ -206,6 +206,9 @@ VK_DEVICE_EXT_PFN(vkCmdBindTransformFeedbackBuffersEXT) VK_DEVICE_EXT_PFN(vkCmdEndQueryIndexedEXT) VK_DEVICE_EXT_PFN(vkCmdEndTransformFeedbackEXT)
+/* VK_KHR_timeline_semaphore */ +VK_DEVICE_EXT_PFN(vkSignalSemaphoreKHR) + #undef VK_INSTANCE_PFN #undef VK_INSTANCE_EXT_PFN #undef VK_DEVICE_PFN
This fixes some fixme messages when playing The Turing Test.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- libs/vkd3d/command.c | 142 ++++++++++++++++++++++++++++++++----- libs/vkd3d/vkd3d_private.h | 1 + 2 files changed, 125 insertions(+), 18 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 8a7ff668..48b5d4f2 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -623,6 +623,34 @@ create_fence: return vr; }
+static VkResult d3d12_fence_create_vk_timeline_semaphore(struct d3d12_fence *fence, VkSemaphore *vk_semaphore, + uint64_t initial_value) +{ + struct d3d12_device *device = fence->device; + const struct vkd3d_vk_device_procs *vk_procs; + VkSemaphoreCreateInfo semaphore_info; + VkSemaphoreTypeCreateInfoKHR semaphore_type_info; + VkResult vr; + + vk_procs = &device->vk_procs; + + semaphore_type_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR; + semaphore_type_info.pNext = NULL; + semaphore_type_info.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE_KHR; + semaphore_type_info.initialValue = initial_value; + + semaphore_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + semaphore_info.pNext = &semaphore_type_info; + semaphore_info.flags = 0; + if ((vr = VK_CALL(vkCreateSemaphore(device->vk_device, &semaphore_info, NULL, vk_semaphore))) < 0) + { + WARN("Failed to create Vulkan semaphore, vr %d.\n", vr); + *vk_semaphore = VK_NULL_HANDLE; + } + + return vr; +} + static void d3d12_fence_garbage_collect_vk_semaphores_locked(struct d3d12_fence *fence, bool destroy_all) { @@ -682,6 +710,9 @@ static void d3d12_fence_destroy_vk_objects(struct d3d12_fence *fence) fence->old_vk_fences[i] = VK_NULL_HANDLE; }
+ if (fence->vk_timeline_semaphore) + VK_CALL(vkDestroySemaphore(device->vk_device, fence->vk_timeline_semaphore, NULL)); + d3d12_fence_garbage_collect_vk_semaphores_locked(fence, true);
pthread_mutex_unlock(&fence->mutex); @@ -1044,9 +1075,26 @@ static HRESULT STDMETHODCALLTYPE d3d12_fence_SetEventOnCompletion(ID3D12Fence *i static HRESULT STDMETHODCALLTYPE d3d12_fence_Signal(ID3D12Fence *iface, UINT64 value) { struct d3d12_fence *fence = impl_from_ID3D12Fence(iface); + const struct vkd3d_vk_device_procs *vk_procs = &fence->device->vk_procs; + VkSemaphoreSignalInfoKHR signal_info; + VkResult vr;
TRACE("iface %p, value %#"PRIx64".\n", iface, value);
+ if (fence->vk_timeline_semaphore) + { + signal_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO_KHR; + signal_info.pNext = NULL; + signal_info.semaphore = fence->vk_timeline_semaphore; + signal_info.value = value; + + if ((vr = VK_CALL(vkSignalSemaphoreKHR(fence->device->vk_device, &signal_info))) < 0) + { + ERR("Failed to signal semaphore, vr %d.\n", vr); + return hresult_from_vk_result(vr); + } + } + return d3d12_fence_signal(fence, value, VK_NULL_HANDLE); }
@@ -1081,6 +1129,7 @@ static HRESULT d3d12_fence_init(struct d3d12_fence *fence, struct d3d12_device * UINT64 initial_value, D3D12_FENCE_FLAGS flags) { HRESULT hr; + VkResult vr; int rc;
fence->ID3D12Fence_iface.lpVtbl = &d3d12_fence_vtbl; @@ -1116,6 +1165,16 @@ static HRESULT d3d12_fence_init(struct d3d12_fence *fence, struct d3d12_device *
d3d12_device_add_ref(fence->device = device);
+ if (!device->vk_info.KHR_timeline_semaphore) + { + fence->vk_timeline_semaphore = VK_NULL_HANDLE; + } + else if ((vr = d3d12_fence_create_vk_timeline_semaphore(fence, &fence->vk_timeline_semaphore, initial_value)) < 0) + { + ERR("Failed to create Vulkan timeline semaphore, vr %d.\n", vr); + return hresult_from_vk_result(vr); + } + return S_OK; }
@@ -5904,6 +5963,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue * struct d3d12_device *device; struct d3d12_fence *fence; VkSubmitInfo submit_info; + VkTimelineSemaphoreSubmitInfoKHR timeline_info; uint64_t sequence_number; VkQueue vk_queue; VkResult vr; @@ -5930,7 +5990,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue * goto fail; }
- if ((vr = vkd3d_queue_create_vk_semaphore_locked(vkd3d_queue, device, &vk_semaphore)) < 0) + if (fence->vk_timeline_semaphore) + { + vk_semaphore = fence->vk_timeline_semaphore; + } + else if ((vr = vkd3d_queue_create_vk_semaphore_locked(vkd3d_queue, device, &vk_semaphore)) < 0) { ERR("Failed to create Vulkan semaphore, vr %d.\n", vr); vk_semaphore = VK_NULL_HANDLE; @@ -5946,6 +6010,18 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue * submit_info.signalSemaphoreCount = vk_semaphore ? 1 : 0; submit_info.pSignalSemaphores = &vk_semaphore;
+ if (vk_semaphore == fence->vk_timeline_semaphore) + { + timeline_info.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR; + timeline_info.pNext = NULL; + timeline_info.waitSemaphoreValueCount = 0; + timeline_info.pWaitSemaphoreValues = NULL; + timeline_info.signalSemaphoreValueCount = 1; + timeline_info.pSignalSemaphoreValues = &value; + + submit_info.pNext = &timeline_info; + } + if ((vr = VK_CALL(vkQueueSubmit(vk_queue, 1, &submit_info, vk_fence))) >= 0) { sequence_number = ++vkd3d_queue->submitted_sequence_number; @@ -5963,7 +6039,9 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue * goto fail_vkresult; }
- if (vk_semaphore && SUCCEEDED(hr = d3d12_fence_add_vk_semaphore(fence, vk_semaphore, vk_fence, value))) + if (vk_semaphore == fence->vk_timeline_semaphore) + vk_semaphore = VK_NULL_HANDLE; + else if (vk_semaphore && SUCCEEDED(hr = d3d12_fence_add_vk_semaphore(fence, vk_semaphore, vk_fence, value))) vk_semaphore = VK_NULL_HANDLE;
vr = VK_CALL(vkGetFenceStatus(device->vk_device, vk_fence)); @@ -6013,6 +6091,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Wait(ID3D12CommandQueue *if struct vkd3d_queue *queue; struct d3d12_fence *fence; VkSubmitInfo submit_info; + VkTimelineSemaphoreSubmitInfoKHR timeline_info; + VkSemaphore vk_semaphore; VkQueue vk_queue; VkResult vr; HRESULT hr; @@ -6024,23 +6104,30 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Wait(ID3D12CommandQueue *if
fence = unsafe_impl_from_ID3D12Fence(fence_iface);
- semaphore = d3d12_fence_acquire_vk_semaphore(fence, value, &completed_value); - if (!semaphore && completed_value >= value) + if ((vk_semaphore = fence->vk_timeline_semaphore)) { - /* We don't get a Vulkan semaphore if the fence was signaled on CPU. */ - TRACE("Already signaled %p, value %#"PRIx64".\n", fence, completed_value); - return S_OK; + semaphore = NULL; } - - if (!(vk_queue = vkd3d_queue_acquire(queue))) + else if ((semaphore = d3d12_fence_acquire_vk_semaphore(fence, value, &completed_value))) { - ERR("Failed to acquire queue %p.\n", queue); - hr = E_FAIL; - goto fail; + vk_semaphore = semaphore->vk_semaphore; } - - if (!semaphore) + else { + if (completed_value >= value) + { + /* We don't get a Vulkan semaphore if the fence was signaled on CPU. */ + TRACE("Already signaled %p, value %#"PRIx64".\n", fence, completed_value); + return S_OK; + } + + if (!(vk_queue = vkd3d_queue_acquire(queue))) + { + ERR("Failed to acquire queue %p.\n", queue); + hr = E_FAIL; + goto fail; + } + if (command_queue->last_waited_fence == fence && command_queue->last_waited_fence_value >= value) { WARN("Already waited on fence %p, value %#"PRIx64".\n", fence, value); @@ -6055,16 +6142,35 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Wait(ID3D12CommandQueue *if return S_OK; }
+ if (!(vk_queue = vkd3d_queue_acquire(queue))) + { + ERR("Failed to acquire queue %p.\n", queue); + hr = E_FAIL; + goto fail; + } + submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submit_info.pNext = NULL; submit_info.waitSemaphoreCount = 1; - submit_info.pWaitSemaphores = &semaphore->vk_semaphore; + submit_info.pWaitSemaphores = &vk_semaphore; submit_info.pWaitDstStageMask = &wait_stage_mask; submit_info.commandBufferCount = 0; submit_info.pCommandBuffers = NULL; submit_info.signalSemaphoreCount = 0; submit_info.pSignalSemaphores = NULL;
+ if (vk_semaphore == fence->vk_timeline_semaphore) + { + timeline_info.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR; + timeline_info.pNext = NULL; + timeline_info.waitSemaphoreValueCount = 1; + timeline_info.pWaitSemaphoreValues = &value; + timeline_info.signalSemaphoreValueCount = 0; + timeline_info.pSignalSemaphoreValues = NULL; + + submit_info.pNext = &timeline_info; + } + if (!vkd3d_array_reserve((void **)&queue->semaphores, &queue->semaphores_size, queue->semaphore_count + 1, sizeof(*queue->semaphores))) { @@ -6074,7 +6180,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Wait(ID3D12CommandQueue *if goto fail; }
- if ((vr = VK_CALL(vkQueueSubmit(vk_queue, 1, &submit_info, VK_NULL_HANDLE))) >= 0) + if ((vr = VK_CALL(vkQueueSubmit(vk_queue, 1, &submit_info, VK_NULL_HANDLE))) >= 0 && semaphore) { queue->semaphores[queue->semaphore_count].vk_semaphore = semaphore->vk_semaphore; queue->semaphores[queue->semaphore_count].sequence_number = queue->submitted_sequence_number + 1; @@ -6093,11 +6199,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Wait(ID3D12CommandQueue *if goto fail; }
- d3d12_fence_remove_vk_semaphore(fence, semaphore); + if (semaphore) d3d12_fence_remove_vk_semaphore(fence, semaphore); return S_OK;
fail: - d3d12_fence_release_vk_semaphore(fence, semaphore); + if (semaphore) d3d12_fence_release_vk_semaphore(fence, semaphore); return hr; }
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 84abcb8d..d9290db7 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -357,6 +357,7 @@ struct d3d12_fence LONG pending_worker_operation_count;
VkFence old_vk_fences[VKD3D_MAX_VK_SYNC_OBJECTS]; + VkSemaphore vk_timeline_semaphore;
struct d3d12_device *device;
On Fri, Dec 13, 2019 at 5:03 AM Rémi Bernon rbernon@codeweavers.com wrote:
- timeline_semaphore = &info->timeline_semaphore_properties;
- TRACE(" VkPhysicalDeviceTimelineSemaphorePropertiesKHR:\n");
- TRACE(" maxTimelineSemaphoreValueDifference: %u.\n",
timeline_semaphore->maxTimelineSemaphoreValueDifference); }
maxTimelineSemaphoreValueDifference is declared as uint64_t, so this causes a format argument warning.
Conor
On 12.12.2019 20:02, Rémi Bernon wrote:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
libs/vkd3d/device.c | 23 +++++++++++++++++++++++ libs/vkd3d/vkd3d_private.h | 3 +++ libs/vkd3d/vulkan_procs.h | 3 +++ 3 files changed, 29 insertions(+)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 757d4ac8..3f99ef9a 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -127,6 +127,7 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] = VK_EXTENSION(KHR_IMAGE_FORMAT_LIST, KHR_image_format_list), VK_EXTENSION(KHR_MAINTENANCE3, KHR_maintenance3), VK_EXTENSION(KHR_PUSH_DESCRIPTOR, KHR_push_descriptor),
- VK_EXTENSION(KHR_TIMELINE_SEMAPHORE, KHR_timeline_semaphore), /* EXT extensions */ VK_EXTENSION(EXT_CONDITIONAL_RENDERING, EXT_conditional_rendering), VK_EXTENSION(EXT_DEBUG_MARKER, EXT_debug_marker),
@@ -664,6 +665,7 @@ struct vkd3d_physical_device_info VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT texel_buffer_alignment_properties; VkPhysicalDeviceTransformFeedbackPropertiesEXT xfb_properties; VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_divisor_properties;
VkPhysicalDeviceTimelineSemaphorePropertiesKHR timeline_semaphore_properties;
VkPhysicalDeviceProperties2KHR properties2;
@@ -675,6 +677,7 @@ struct vkd3d_physical_device_info VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT texel_buffer_alignment_features; VkPhysicalDeviceTransformFeedbackFeaturesEXT xfb_features; VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_divisor_features;
VkPhysicalDeviceTimelineSemaphoreFeaturesKHR timeline_semaphore_features;
VkPhysicalDeviceFeatures2 features2; };
@@ -693,8 +696,10 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i VkPhysicalDeviceDepthClipEnableFeaturesEXT *depth_clip_features; VkPhysicalDeviceMaintenance3Properties *maintenance3_properties; VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb_properties;
VkPhysicalDeviceTimelineSemaphorePropertiesKHR *timeline_semaphore_properties; VkPhysicalDevice physical_device = device->vk_physical_device; VkPhysicalDeviceTransformFeedbackFeaturesEXT *xfb_features;
VkPhysicalDeviceTimelineSemaphoreFeaturesKHR *timeline_semaphore_features; struct vkd3d_vulkan_info *vulkan_info = &device->vk_info;
memset(info, 0, sizeof(*info));
@@ -710,6 +715,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vertex_divisor_properties = &info->vertex_divisor_properties; xfb_features = &info->xfb_features; xfb_properties = &info->xfb_properties;
timeline_semaphore_properties = &info->timeline_semaphore_properties;
timeline_semaphore_features = &info->timeline_semaphore_features;
info->features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
@@ -727,6 +734,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vk_prepend_struct(&info->features2, xfb_features); vertex_divisor_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; vk_prepend_struct(&info->features2, vertex_divisor_features);
timeline_semaphore_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR;
vk_prepend_struct(&info->features2, timeline_semaphore_features);
if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &info->features2));
@@ -745,6 +754,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vk_prepend_struct(&info->properties2, xfb_properties); vertex_divisor_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; vk_prepend_struct(&info->properties2, vertex_divisor_properties);
timeline_semaphore_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES_KHR;
vk_prepend_struct(&info->properties2, timeline_semaphore_properties);
if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceProperties2KHR(physical_device, &info->properties2));
@@ -817,6 +828,7 @@ static void vkd3d_trace_physical_device_limits(const struct vkd3d_physical_devic const VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *buffer_alignment; const VkPhysicalDeviceMaintenance3Properties *maintenance3; const VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb;
const VkPhysicalDeviceTimelineSemaphorePropertiesKHR *timeline_semaphore;
TRACE("Device limits:\n"); TRACE(" maxImageDimension1D: %u.\n", limits->maxImageDimension1D);
@@ -1021,6 +1033,10 @@ static void vkd3d_trace_physical_device_limits(const struct vkd3d_physical_devic divisor_properties = &info->vertex_divisor_properties; TRACE(" VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT:\n"); TRACE(" maxVertexAttribDivisor: %u.\n", divisor_properties->maxVertexAttribDivisor);
- timeline_semaphore = &info->timeline_semaphore_properties;
- TRACE(" VkPhysicalDeviceTimelineSemaphorePropertiesKHR:\n");
- TRACE(" maxTimelineSemaphoreValueDifference: %u.\n", timeline_semaphore->maxTimelineSemaphoreValueDifference);
Should it be %lu? (Atleast seems to compile fine when changed to %lu.)
libs/vkd3d/device.c:1039:11: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘const long unsigned int’} [-Wformat=] 1039 | TRACE(" maxTimelineSemaphoreValueDifference: %u.\n", timeline_semaphore->maxTimelineSemaphoreValueDifference); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | uint64_t {aka const long unsigned int}
}
static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_device_info *info) @@ -1033,6 +1049,7 @@ static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_dev const VkPhysicalDeviceDepthClipEnableFeaturesEXT *depth_clip_features; const VkPhysicalDeviceFeatures *features = &info->features2.features; const VkPhysicalDeviceTransformFeedbackFeaturesEXT *xfb;
const VkPhysicalDeviceTimelineSemaphoreFeaturesKHR *timeline_semaphore;
TRACE("Device features:\n"); TRACE(" robustBufferAccess: %#x.\n", features->robustBufferAccess);
@@ -1165,6 +1182,10 @@ static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_dev divisor_features->vertexAttributeInstanceRateDivisor); TRACE(" vertexAttributeInstanceRateZeroDivisor: %#x.\n", divisor_features->vertexAttributeInstanceRateZeroDivisor);
timeline_semaphore = &info->timeline_semaphore_features;
TRACE(" VkPhysicalDeviceTimelineSemaphoreFeaturesKHR:\n");
TRACE(" timelineSemaphore: %#x.\n", timeline_semaphore->timelineSemaphore); }
static void vkd3d_init_feature_level(struct vkd3d_vulkan_info *vk_info,
@@ -1294,6 +1315,8 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, vulkan_info->transform_feedback_queries = physical_device_info->xfb_properties.transformFeedbackQueries; vulkan_info->max_vertex_attrib_divisor = max(physical_device_info->vertex_divisor_properties.maxVertexAttribDivisor, 1);
- vulkan_info->max_timeline_semaphore_value_difference = max(physical_device_info->timeline_semaphore_properties.maxTimelineSemaphoreValueDifference, 1);
device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64; device->feature_options.OutputMergerLogicOp = features->logicOp; /* SPV_KHR_16bit_storage */
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 0c031d20..84abcb8d 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -100,6 +100,7 @@ struct vkd3d_vulkan_info bool KHR_image_format_list; bool KHR_maintenance3; bool KHR_push_descriptor;
- bool KHR_timeline_semaphore; /* EXT device extensions */ bool EXT_conditional_rendering; bool EXT_debug_marker;
@@ -116,6 +117,8 @@ struct vkd3d_vulkan_info bool vertex_attrib_zero_divisor; unsigned int max_vertex_attrib_divisor;
- uint64_t max_timeline_semaphore_value_difference;
VkPhysicalDeviceLimits device_limits; VkPhysicalDeviceSparseProperties sparse_properties;
diff --git a/libs/vkd3d/vulkan_procs.h b/libs/vkd3d/vulkan_procs.h index ec29eb45..d080278a 100644 --- a/libs/vkd3d/vulkan_procs.h +++ b/libs/vkd3d/vulkan_procs.h @@ -206,6 +206,9 @@ VK_DEVICE_EXT_PFN(vkCmdBindTransformFeedbackBuffersEXT) VK_DEVICE_EXT_PFN(vkCmdEndQueryIndexedEXT) VK_DEVICE_EXT_PFN(vkCmdEndTransformFeedbackEXT)
+/* VK_KHR_timeline_semaphore */ +VK_DEVICE_EXT_PFN(vkSignalSemaphoreKHR)
- #undef VK_INSTANCE_PFN #undef VK_INSTANCE_EXT_PFN #undef VK_DEVICE_PFN
On 13.12.2019 17:25, Sveinar Søpler wrote:
On 12.12.2019 20:02, Rémi Bernon wrote:
+ timeline_semaphore = &info->timeline_semaphore_properties; + TRACE(" VkPhysicalDeviceTimelineSemaphorePropertiesKHR:\n"); + TRACE(" maxTimelineSemaphoreValueDifference: %u.\n", timeline_semaphore->maxTimelineSemaphoreValueDifference);
Should it be %lu? (Atleast seems to compile fine when changed to %lu.)
libs/vkd3d/device.c:1039:11: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘const long unsigned int’} [-Wformat=] 1039 | TRACE(" maxTimelineSemaphoreValueDifference: %u.\n", timeline_semaphore->maxTimelineSemaphoreValueDifference); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| uint64_t {aka const long unsigned int}
Or rather it could be:
+ + timeline_semaphore = &info->timeline_semaphore_properties; + TRACE(" VkPhysicalDeviceTimelineSemaphorePropertiesKHR:\n"); + TRACE(" maxTimelineSemaphoreValueDifference: %" PRIu64 ".\n", timeline_semaphore->maxTimelineSemaphoreValueDifference); }
since it seems as "compile fine" was not correct for 32-bit... 64-bit was fine with %lu, but 32-bit seems to want this to be %llu. For some reason uint64_t is "long unsigned int" for 64-bit and "long long unsigned int" for 32-bit for my compiler. Dunno if this is some weird "ubuntu spesific" thing, or actually correct?
Sveinar
This patch requires the usage of vulkan-headers >= 1.1.126, so you should probably add a patch somewhere in the lines of:
--- README | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README b/README index 3c70ede..16535f4 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ similar, but not identical, to Direct3D 12. Building vkd3d ==============
-Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.1.113). +Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.1.126).
Vkd3d generates some of its headers from IDL files. If you are using the release tarballs, then these headers are pre-generated and are included. If diff --git a/configure.ac b/configure.ac index 355aaab..7ff3207 100644 --- a/configure.ac +++ b/configure.ac @@ -69,7 +69,7 @@ AS_IF([test "x$ac_cv_header_spirv_unified1_GLSL_std_450_h" != "xyes" \ -a "x$ac_cv_header_vulkan_GLSL_std_450_h" != "xyes"], [AC_MSG_ERROR([GLSL.std.450.h not found.])])
-VKD3D_CHECK_VULKAN_HEADER_VERSION([113], [AC_MSG_ERROR([Vulkan headers are too old, 1.1.113 is required.])]) +VKD3D_CHECK_VULKAN_HEADER_VERSION([126], [AC_MSG_ERROR([Vulkan headers are too old, 1.1.126 is required.])])
AC_CHECK_DECL([SpvCapabilityDemoteToHelperInvocationEXT],, [AC_MSG_ERROR([SPIR-V headers are too old.])], [ #ifdef HAVE_SPIRV_UNIFIED1_SPIRV_H
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62752
Your paranoid android.
=== debian10 (build log) ===
error: patch failed: README:9 error: patch failed: configure.ac:69 Task: Patch failed to apply
=== debian10 (build log) ===
error: patch failed: README:9 error: patch failed: configure.ac:69 Task: Patch failed to apply