Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary host query reset feature and flag #1238

Merged
merged 2 commits into from
Dec 2, 2024
Merged
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
6 changes: 0 additions & 6 deletions samples/api/hpp_timestamp_queries/hpp_timestamp_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
HPPTimestampQueries::HPPTimestampQueries()
{
title = "Timestamp queries";
// This sample uses vk::CommandBuffer::resetQueryPool to reset the timestamp query pool on the host, which requires VK_EXT_host_query_reset or Vulkan 1.2
add_device_extension(VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME);
// This also requires us to enable the feature in the appropriate feature struct, see request_gpu_features()
}

HPPTimestampQueries::~HPPTimestampQueries()
Expand Down Expand Up @@ -94,9 +91,6 @@ bool HPPTimestampQueries::resize(const uint32_t width, const uint32_t height)

void HPPTimestampQueries::request_gpu_features(vkb::core::HPPPhysicalDevice &gpu)
{
// We need to enable the command pool reset feature in the extension struct
HPP_REQUEST_REQUIRED_FEATURE(gpu, vk::PhysicalDeviceHostQueryResetFeaturesEXT, hostQueryReset);

// Enable anisotropic filtering if supported
if (gpu.get_features().samplerAnisotropy)
{
Expand Down
21 changes: 1 addition & 20 deletions samples/api/timestamp_queries/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,7 @@ For this sample we'll be using 6 time points, one for the start and one for the

== Resetting the query pool

Before we can start writing data to the query pool, we need to reset it.
When using Vulkan 1.0 or 1.1, this requires us to enable the `VK_EXT_host_query_reset` extension:

[,cpp]
----
add_device_extension(VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME);
----

With using Vulkan 1.2 this extension has become part of the core and we won't have to manually enable it.

Independent of this, we also need to enable the `hostQueryReset` physical device feature:

[,cpp]
----
auto &requested_extension_features= gpu.request_extension_features<VkPhysicalDeviceHostQueryResetFeaturesEXT>(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT);
requested_extension_features.hostQueryReset = VK_TRUE;
----

With features and extensions properly enabled, we can now reset the pool at the start of the command buffer, before writing the first timestamp.
This is done using `vkCmdResetQueryPool`:
Before we can start writing data to the query pool, we need to reset it. This is done using `vkCmdResetQueryPool` at the start of the command buffer:

[,cpp]
----
Expand Down
6 changes: 0 additions & 6 deletions samples/api/timestamp_queries/timestamp_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
TimestampQueries::TimestampQueries()
{
title = "Timestamp queries";
// This sample uses vkCmdResetQueryPool to reset the timestamp query pool on the host, which requires VK_EXT_host_query_reset or Vulkan 1.2
add_device_extension(VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME);
// This also requires us to enable the feature in the appropriate feature struct, see request_gpu_features()
}

TimestampQueries::~TimestampQueries()
Expand Down Expand Up @@ -72,9 +69,6 @@ TimestampQueries::~TimestampQueries()

void TimestampQueries::request_gpu_features(vkb::PhysicalDevice &gpu)
{
// We need to enable the command pool reset feature in the extension struct
REQUEST_REQUIRED_FEATURE(gpu, VkPhysicalDeviceHostQueryResetFeaturesEXT, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT, hostQueryReset);

// Enable anisotropic filtering if supported
if (gpu.get_features().samplerAnisotropy)
{
Expand Down
Loading