Skip to content
Open
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ vulkan_test(aliasing_3)
vulkan_test(aliasing_4)
vulkan_test(aliasing_5)
vulkan_test(aliasing_6)
vulkan_test(render_pass_striped)
vulkan_test(buffer_bind_lifetime)
vulkan_test(timeline_semaphore_1)
vulkan_test(external_fence_fd)
Expand Down
1 change: 1 addition & 0 deletions benchmarking/vulkan_render_pass_striped.bench
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "name": "vulkan_render_pass_striped", "description": "Exercise VK_ARM_render_pass_striped dynamic rendering stripes and stripe submit" }
27 changes: 27 additions & 0 deletions src/usagetracker/vulkan_feature_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ static bool submit_info_uses_ray_tracing_maintenance1(const VkSubmitInfo2* info)
return false;
}

static bool render_pass_striped_begin_used(const void* pNext)
{
return get_extension(pNext, VK_STRUCTURE_TYPE_RENDER_PASS_STRIPE_BEGIN_INFO_ARM) != nullptr;
}

static bool render_pass_striped_submit_used(const void* pNext)
{
return get_extension(pNext, VK_STRUCTURE_TYPE_RENDER_PASS_STRIPE_SUBMIT_INFO_ARM) != nullptr;
}

static bool uses_pre13_dynamic_rendering()
{
return instance->requested_instance_api_version.load() < VK_API_VERSION_1_3;
Expand Down Expand Up @@ -785,6 +795,7 @@ std::unordered_set<std::string> feature_detection::adjust_VkDeviceCreateInfo(VkD
check_prune_device({"VK_ARM_shader_instrumentation"}, info, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INSTRUMENTATION_FEATURES_ARM, enabled_exts, found);
check_prune_device({"VK_ARM_tensors"}, info, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TENSOR_FEATURES_ARM, enabled_exts, found);
check_prune_device({"VK_ARM_tensors"}, info, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_TENSOR_FEATURES_ARM, enabled_exts, found);
check_prune_device({"VK_ARM_render_pass_striped"}, info, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RENDER_PASS_STRIPED_FEATURES_ARM, enabled_exts, found);
return found;
}

Expand Down Expand Up @@ -821,6 +832,7 @@ std::unordered_set<std::string> feature_detection::adjust_device_extensions(std:
if (!has_VK_ARM_shader_core_builtins) removed.insert(exts.extract("VK_ARM_shader_core_builtins"));
if (!has_VK_ARM_shader_instrumentation) removed.insert(exts.extract("VK_ARM_shader_instrumentation"));
if (!has_VK_ARM_tensors) removed.insert(exts.extract("VK_ARM_tensors"));
if (!has_VK_ARM_render_pass_striped) removed.insert(exts.extract("VK_ARM_render_pass_striped"));
if (!has_VK_KHR_ray_tracing_pipeline) removed.insert(exts.extract("VK_KHR_ray_tracing_pipeline"));
if (!has_VK_KHR_ray_tracing_maintenance1) removed.insert(exts.extract("VK_KHR_ray_tracing_maintenance1"));
if (!has_VK_KHR_robustness2) removed.insert(exts.extract("VK_KHR_robustness2"));
Expand Down Expand Up @@ -1249,13 +1261,22 @@ VkResult check_vkCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateI
return check_vkCreateRenderPass2(device, pCreateInfo, pAllocator, pRenderPass);
}

void check_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents)
{
assert(pRenderPassBegin != nullptr);
if (render_pass_striped_begin_used(pRenderPassBegin->pNext)) instance->has_VK_ARM_render_pass_striped = true;
}

void check_vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo)
{
assert(pRenderPassBegin != nullptr);
if (render_pass_striped_begin_used(pRenderPassBegin->pNext)) instance->has_VK_ARM_render_pass_striped = true;
}

void check_vkCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo)
{
instance->has_VK_KHR_create_renderpass2 = true;
check_vkCmdBeginRenderPass2(commandBuffer, pRenderPassBegin, pSubpassBeginInfo);
}

void check_vkCmdNextSubpass2(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo* pSubpassBeginInfo, const VkSubpassEndInfo* pSubpassEndInfo)
Expand Down Expand Up @@ -1785,6 +1806,7 @@ VkResult check_vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmi
assert(submitCount == 0 || pSubmits != nullptr);
for (uint32_t i = 0; i < submitCount; i++)
{
assert(pSubmits[i].commandBufferInfoCount == 0 || pSubmits[i].pCommandBufferInfos != nullptr);
if (submit_info_uses_ray_tracing_maintenance1(&pSubmits[i])) instance->has_VK_KHR_ray_tracing_maintenance1 = true;
for (uint32_t j = 0; j < pSubmits[i].waitSemaphoreInfoCount; j++)
{
Expand All @@ -1794,6 +1816,10 @@ VkResult check_vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmi
{
if (uses_opacity_micromap_stage(pSubmits[i].pSignalSemaphoreInfos[j].stageMask)) instance->has_VK_EXT_opacity_micromap = true;
}
for (uint32_t j = 0; j < pSubmits[i].commandBufferInfoCount; j++)
{
if (render_pass_striped_submit_used(pSubmits[i].pCommandBufferInfos[j].pNext)) instance->has_VK_ARM_render_pass_striped = true;
}
if (submit_pnext_uses_tensors(pSubmits[i].pNext)) instance->has_VK_ARM_tensors = true;
}
return VK_SUCCESS;
Expand Down Expand Up @@ -2193,6 +2219,7 @@ void check_vkCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingI
instance->core13.dynamicRendering = true;
if (uses_pre13_dynamic_rendering()) instance->has_VK_KHR_dynamic_rendering = true;
if (pRenderingInfo->viewMask != 0) instance->core11.multiview = true;
if (render_pass_striped_begin_used(pRenderingInfo->pNext)) instance->has_VK_ARM_render_pass_striped = true;
}

void check_vkCmdBeginRenderingKHR(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo)
Expand Down
2 changes: 2 additions & 0 deletions src/usagetracker/vulkan_feature_detect.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ struct feature_detection
std::atomic_bool has_VK_ARM_shader_core_builtins { false };
std::atomic_bool has_VK_ARM_shader_instrumentation { false };
std::atomic_bool has_VK_ARM_tensors { false };
std::atomic_bool has_VK_ARM_render_pass_striped { false };
std::atomic_bool has_VK_KHR_ray_tracing_pipeline { false };
std::atomic_bool has_VK_KHR_ray_tracing_maintenance1 { false };
std::atomic_bool has_VK_KHR_robustness2 { false };
Expand Down Expand Up @@ -287,6 +288,7 @@ void check_vkDestroyMicromapEXT(VkDevice device, VkMicromapEXT micromap, const V
VkResult check_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
VkResult check_vkCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
VkResult check_vkCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
void check_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents);
void check_vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo);
void check_vkCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo);
void check_vkCmdNextSubpass2(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo* pSubpassBeginInfo, const VkSubpassEndInfo* pSubpassEndInfo);
Expand Down
64 changes: 64 additions & 0 deletions src/vulkan_feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,69 @@ static void test_dynamic_rendering_extension_adjustment()
assert(f->has_VK_KHR_dynamic_rendering == true);
}

static void test_render_pass_striped_extension_adjustment()
{
feature_detection* f = reset_detection();

std::unordered_set<std::string> exts = { "VK_ARM_render_pass_striped" };
assert(exts.size() == 1);
assert(f->has_VK_ARM_render_pass_striped == false);
assert_removed_device_extensions(f, exts, { "VK_ARM_render_pass_striped" });
assert(exts.empty());

const char* extname = "VK_ARM_render_pass_striped";
const char* namelist[] = { extname };
VkPhysicalDeviceRenderPassStripedFeaturesARM striped_features = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RENDER_PASS_STRIPED_FEATURES_ARM, nullptr, VK_TRUE
};
VkDeviceCreateInfo dci = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, &striped_features };
dci.ppEnabledExtensionNames = namelist;
dci.enabledExtensionCount = 1;
assert_adjusted_device_create_info(f, dci, exts, { "VK_ARM_render_pass_striped" }, false);

f = reset_detection();
VkRenderPassStripeInfoARM stripe_info = { VK_STRUCTURE_TYPE_RENDER_PASS_STRIPE_INFO_ARM, nullptr, { { 0, 0 }, { 32, 32 } } };
VkRenderPassStripeBeginInfoARM stripe_begin = {
VK_STRUCTURE_TYPE_RENDER_PASS_STRIPE_BEGIN_INFO_ARM, nullptr, 1, &stripe_info
};
VkRenderPassBeginInfo begin_render_pass = { VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, &stripe_begin };
VkSubpassBeginInfo begin_info = { VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO, nullptr, VK_SUBPASS_CONTENTS_INLINE };
check_vkCmdBeginRenderPass(VK_NULL_HANDLE, &begin_render_pass, VK_SUBPASS_CONTENTS_INLINE);
assert(f->has_VK_ARM_render_pass_striped == true);
exts.insert("VK_ARM_render_pass_striped");
assert_removed_device_extensions(f, exts, {});
assert(exts.size() == 1);

f = reset_detection();
check_vkCmdBeginRenderPass2(VK_NULL_HANDLE, &begin_render_pass, &begin_info);
assert(f->has_VK_ARM_render_pass_striped == true);
exts.insert("VK_ARM_render_pass_striped");
assert_removed_device_extensions(f, exts, {});
assert(exts.size() == 1);

f = reset_detection();
VkRenderingInfo rendering_info = {
VK_STRUCTURE_TYPE_RENDERING_INFO, &stripe_begin, 0, {}, 1, 0, 0, nullptr, nullptr, nullptr
};
check_vkCmdBeginRendering(VK_NULL_HANDLE, &rendering_info);
assert(f->has_VK_ARM_render_pass_striped == true);

f = reset_detection();
VkSemaphoreSubmitInfo stripe_semaphore_info = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO, nullptr };
VkRenderPassStripeSubmitInfoARM stripe_submit = {
VK_STRUCTURE_TYPE_RENDER_PASS_STRIPE_SUBMIT_INFO_ARM, nullptr, 1, &stripe_semaphore_info
};
VkCommandBufferSubmitInfo command_buffer_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO, &stripe_submit, VK_NULL_HANDLE, 0
};
VkSubmitInfo2 submit_info = { VK_STRUCTURE_TYPE_SUBMIT_INFO_2, nullptr };
submit_info.commandBufferInfoCount = 1;
submit_info.pCommandBufferInfos = &command_buffer_info;
VkResult result = check_vkQueueSubmit2(VK_NULL_HANDLE, 1, &submit_info, VK_NULL_HANDLE);
assert(result == VK_SUCCESS);
assert(f->has_VK_ARM_render_pass_striped == true);
}

static void test_synchronization2_extension_adjustment()
{
feature_detection* f = reset_detection();
Expand Down Expand Up @@ -2692,6 +2755,7 @@ int main()
test_copy_commands2_extension_adjustment();
test_create_renderpass2_extension_adjustment();
test_dynamic_rendering_extension_adjustment();
test_render_pass_striped_extension_adjustment();
test_synchronization2_extension_adjustment();
test_transform_feedback_extension_adjustment();
test_descriptor_indexing_extension_adjustment();
Expand Down
Loading