Vulkan-Samples icon indicating copy to clipboard operation
Vulkan-Samples copied to clipboard

Requesting extension features also enables all available features

Open SaschaWillems opened this issue 1 year ago • 1 comments

In a lot of samples we do something like this:

auto &requested_extension_features = gpu.request_extension_features<VkPhysicalDeviceSomeExtensionFeaturesKHR>(VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SOME_EXTENSION_FEATURES_KHR);
requested_extension_features.someFeature = VK_TRUE;

But the call to gpu.request_extension_features already sets all supported features to true by calling vkGetPhysicalDeviceFeatures2KHR, which makes the second line (enabling a feature) superfluous.

This doesn't do any harm, but it might confuse people trying to write or debug samples.

SaschaWillems avatar Feb 23 '24 15:02 SaschaWillems

One could introduce a new function vkb::PhysicalDevice::get_extension_features<ExtensionFeatureStruct> that could be used like this:

	if (gpu.get_extension_features<VkPhysicalDeviceHostQueryResetFeaturesEXT>().hostQueryReset)
	{
		gpu.request_extension_features<VkPhysicalDeviceHostQueryResetFeaturesEXT>().hostQueryReset= VK_TRUE;
	}

... and would need to adjust all usages of request_extension_features accordingly! ... and modify request_extension_features such that it returns either an empty features struct, or the one already requested before.

asuessenbach avatar Mar 11 '24 13:03 asuessenbach