Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions runtime/shims/d3d12_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ struct VulkanDeviceInfo {
// VK_EXT_mesh_shader's meshShaderQueries feature is enabled on `device`, so the clipping invocations of a mesh
// segment come from a mesh-primitives query (D3D-MESH-CLIPPING-COUNTER). Without it they read 0.
bool mesh_shader_queries = false;
// VK_EXT_transform_feedback with its transformFeedback feature is enabled on `device` (D3D-302): a graphics PSO
// that declares StreamOutput is accepted, SOSetTargets binds real buffers, and draws between them are captured
// with vkCmdBeginTransformFeedbackEXT/EndTransformFeedbackEXT. Without it, StreamOutput PSOs stay refused.
bool transform_feedback = false;
// VK_EXT_transform_feedback's geometryStreams feature is enabled: a StreamOutput RasterizedStream other than the
// vertex/geometry shader's stream 0 can be rasterized. Without it, only RasterizedStream 0 is accepted.
bool transform_feedback_geometry_streams = false;
// The core features enabled on `device`. Graphics PSOs that need independentBlend, fillModeNonSolid,
// depthBiasClamp or dualSrcBlend are refused unless it is set here.
VkPhysicalDeviceFeatures features{};
Expand Down
23 changes: 23 additions & 0 deletions runtime/shims/d3d12_vulkan_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9476,6 +9476,8 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out, QueueTestSettin
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR};
VkPhysicalDeviceRayQueryFeaturesKHR rq_features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR};
VkPhysicalDeviceMeshShaderFeaturesEXT mesh_features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT};
VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback_features{
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT};
{
std::uint32_t extension_count = 0;
vkEnumerateDeviceExtensionProperties(info.physical, nullptr, &extension_count, nullptr);
Expand All @@ -9500,10 +9502,19 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out, QueueTestSettin
vkGetPhysicalDeviceFeatures2(info.physical, &features);
info.mesh_shader = mesh_features.meshShader == VK_TRUE;
info.mesh_shader_queries = mesh_features.meshShaderQueries == VK_TRUE;
} else if (!std::strcmp(e.extensionName, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME)) {
VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
&transform_feedback_features};
vkGetPhysicalDeviceFeatures2(info.physical, &features);
info.transform_feedback = transform_feedback_features.transformFeedback == VK_TRUE;
info.transform_feedback_geometry_streams = transform_feedback_features.geometryStreams == VK_TRUE;
}
}
if (!info.mesh_shader)
std::fprintf(stderr, "[rt] d3d12: the GPU has no VK_EXT_mesh_shader: mesh-shader PSOs are unsupported\n");
if (!info.transform_feedback)
std::fprintf(stderr,
"[rt] d3d12: the GPU has no VK_EXT_transform_feedback: StreamOutput PSOs are unsupported\n");
if (has_as && has_dho && has_rq && chosen12.bufferDeviceAddress) {
as_features.pNext = &rq_features;
VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &as_features};
Expand Down Expand Up @@ -9539,11 +9550,22 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out, QueueTestSettin
// The mesh-primitives query, which counts the primitives a mesh shader emits (D3D-MESH-CLIPPING-COUNTER).
enable_mesh.meshShaderQueries = info.mesh_shader_queries ? VK_TRUE : VK_FALSE;

// D3D-302: StreamOutput PSOs, SOSetTargets and real SO_STATISTICS queries need transformFeedback; geometryStreams
// is only requested when the device already offers it (RasterizedStream != 0 is the one thing it gates).
VkPhysicalDeviceTransformFeedbackFeaturesEXT enable_transform_feedback{
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT};
enable_transform_feedback.transformFeedback = VK_TRUE;
enable_transform_feedback.geometryStreams = info.transform_feedback_geometry_streams ? VK_TRUE : VK_FALSE;

void* ext_chain = nullptr;
if (info.mesh_shader) {
enable_mesh.pNext = ext_chain;
ext_chain = &enable_mesh;
}
if (info.transform_feedback) {
enable_transform_feedback.pNext = ext_chain;
ext_chain = &enable_transform_feedback;
}
if (info.ray_tracing) {
enable_rq.pNext = ext_chain;
enable_as.pNext = &enable_rq;
Expand Down Expand Up @@ -9932,6 +9954,7 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out, QueueTestSettin
if (has_swapchain && instance_has_surface) device_extensions.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
if (swapchain_m1_name) device_extensions.push_back(swapchain_m1_name);
if (info.mesh_shader) device_extensions.push_back(VK_EXT_MESH_SHADER_EXTENSION_NAME);
if (info.transform_feedback) device_extensions.push_back(VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME);
if (info.ray_tracing) {
device_extensions.push_back(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME);
device_extensions.push_back(VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME);
Expand Down
Loading