Commit Graph

78 Commits

Author SHA1 Message Date
Charles Giessen
2d6f7dea0a Add negative test for are_extension_feature_present
Didn't handle the case where some fields were supported but others weren't.
2024-06-13 10:25:28 -05:00
Charles Giessen
71a29a4b72 Make are_extension_features_present handle mismatched lists
The original implementation only worked if the requested features
had the same length. It'll now handle that properly.
2024-06-13 10:25:28 -05:00
Charles Giessen
91421d34b0 Set the sType for users to fix regression
Features 11, 12, and 13 structs used to set the sType manually for the user.
That was turned into an assert which inadvertently broke users code. This
is being reverted.
2024-06-13 09:21:58 -05:00
Charles Giessen
c9d94287a5 Add enable_features_if_present to PhysicalDevice
Allows users to enable features if they are present, getting back a bool
telling them whether the feature is supported and will be enabled on the
device.

Also:
* Removes redundant VkPhysicalDeviceFeatures2 struct in vkb::PhysicalDevice.
* Adds test copying of details when creating a VkDevice so that test can check
what features were actually enabled on the device.
* Creates GenericFeatureChain struct for managing pNext chains.
* Allow multiple calls to set_require_features by combining the fields
2024-04-26 16:02:25 -06:00
Charles Giessen
a330227666 Use vulkan/vulkan_core.h instead of vulkan/vulkan.h
vulkan.h includes platform specific headers that cause non trivial build
overhead. Because vk-bootstrap doesn't make use of any platform specific
API's, it can move over to vulkan_core.h.

This *MAY* break users of the library who were depending on vulkan/vulkan.h
including other headers, like windows.h. But because the benefits outweigh
the drawbacks, it is a good change.
2024-02-12 09:48:56 -06:00
Diamond-D0gs
0af4cb5055 implemented enable_extensions_if_present and tests 2024-01-18 15:15:00 -07:00
Charles Giessen
348e8bf796 Support tests on windows with clang & clang-cl
Required adding a .def file to properly export the required symbols and
disabling pointer cast warnings that are coming from Catch2.
2023-12-06 14:07:18 -07:00
Charles Giessen
f223c8d5ae Cleanup CMake finding of Vulkan & installation code
Adds extensive integration tests that exercise the various ways of finding
the Vulkan-Headers.

vk-bootstrap should now use the Vulkan-Headers or Vulkan::Headers targets if
they were already defined (such as is the case of FetchContent), and will
look for the VulkanHeaders package and Vulkan package as a fallback, and will
FetchContent Vulkan-Headers directly if that fails.

This should make integration seamless with the various ways vulkan-headers
is acquired.

The vk-bootstrap-vulkan-headers target was dropped in favor of directly
linking to Vulkan-Headers (creating a target by that name if none exists).
2023-12-02 19:49:54 -07:00
Charles Giessen
622e36a487 Small cleanup of tests 2023-12-02 11:32:03 -07:00
Charles Giessen
d2bc688552 Fix wrong parameter in Wayland function
Generator script was missing a case - causing incorrect code gen resulting in a
compiler errror for wayland.
2023-10-30 11:31:11 -06:00
Charles Giessen
9e36810a48 Add enable_extension_if_present to vkb::PhysicalDevice
If the given extension is present, enable_extension_if_present will make
the extension be enabled on the device.

This fixes a gap in capability due to the deprecation of add_desired_extension.
2023-10-23 10:05:39 -06:00
Charles Giessen
f9717f66bb Add PhysicalDevice::is_extension_present()
Convenience function to check if a given extension would be enabled on the
physical device.
2023-10-22 10:30:18 -06:00
Charles Giessen
09a220f026 Add deprecation notice to "desired" requests
The ability to request that some physical device or swapchain has certain features
but not require said features leads to confusion due to users having to manually
check if any desired request succeeded or not. Thus, this feature is being
deprecated, with eventual removal in the future.
2023-10-13 11:28:21 -06:00
Charles Giessen
1ab85e9e55 Run tests in CI scripts
Make use of CTest to manage running tests, and configure the project to
allow Catch2 to work with CTest
2023-10-09 13:24:09 -06:00
Nicholaus Clark
834960e58f Fix API of CustomQueueDescription 2023-10-09 11:52:18 -06:00
Charles Giessen
d759d3d575 Add VulkanMock for isolating tests from system
Allows the tests to set the exact values vk-bootstrap will receieve
rather than require a real vulkan driver to be present on the system.

This is done by creating a `vulkan-1.dll` on windows that implements
all of the API functions, and on linux/macOS intercepts `dlsym` to
make it return the mock's functions.
2023-10-03 14:26:25 -06:00
Charles Giessen
83ef1035bf Add the Instance dispatch table
While not designed to be called by the user, it is common for other libraries to need
function pointers, including instance level functions.
2023-09-24 18:45:20 -06:00
Charles Giessen
04ec13b48d Update to latest headers & fix errors & cleanup generation script
VulkanSC was added to vk.xml and broke the generation script. This was an
easy fix, just needed to specify which API the version information should
use. Still, took the time to cleanup the code by running pylint and fixing
anything it warned about.
2023-09-19 15:52:27 -06:00
Charles Giessen
932b7794ac Refactor how GetPhysDevFeats2 works
Cleaned up the logic for handling when to use the core, the KHR, and when
not to use vkGetPhysicalDeviceFeatures2. This should make the logic easier
to follow with better names, and handle a few cases that were wrong, like
not caring if the extension is enabled by vulkan 1.1 is not.
2023-01-12 16:07:43 -07:00
Charles Giessen
9b3e648141 Tests: add missing swapchain destruction
In the swapchain recreation tests, the tests forgot to clean up the old
swapchains.
2023-01-12 16:07:43 -07:00
Odilon Vatonne
73295fed0b Revert behavior change with desired formats not being available 2022-10-28 15:33:33 -06:00
Odilon Vatonne
b9a98c61b3 Check image usage in SwapchainBuilder and stricter format feature verifications 2022-10-28 15:33:33 -06:00
Charles Giessen
c543dc104b Support VK_KHR_portability_enumeration
Also cleanup some warnings in the tests.
2022-04-25 18:34:44 -06:00
Nicholaus Clark
4a2984ad68 Added pNext chain support for swapchain::get_image_views 2022-03-19 12:24:57 -06:00
Charles Giessen
5f45b1019a Allow apps to query devices based on the name
This lets applications see all the devices which meet a set of requirements
then pick whichever of these devices is most appropriate for them. The intent
is for applications that want to find all the suitable devices and let the
user of the application pick the physical device from a list.
2022-03-01 21:17:10 -07:00
Danderaion
f6c262c3ab Add set_minimum_instance_version
Also deprecates InstanceBuilder::desire_api_version
and PhysicalDeviceSelector::set_desired_version
2022-02-27 13:46:15 -07:00
sean
d299f782e6 Use own Vulkan version macros 2022-02-15 20:20:42 -07:00
Charles Giessen
bd6a2e4311 Fix crashing when calling GetPhysDevFeaturesKHR
vk-bootstrap would attempt to call vkGetPhysDevFeaturesKHR without enabling
the appropriate extension first.
2021-12-31 11:38:07 -07:00
Charles Giessen
6bf383778b Don't pass an instance in for pre-instance functions.
A recent loader change results in NULL being returned for pre-instance functions
if the instance handle passed into vkGetInstanceProcAddr isn't NULL. This was
reverted but going forward this change will require updating applications.
2021-12-08 15:49:44 -07:00
spnda
f5f9b54f38 Add user-defined conversion operators 2021-09-10 14:29:40 -06:00
Andreas Pokorny
81f542e119 also fix typo in example and tests 2021-09-06 15:10:59 -06:00
Charles Giessen
867376d01e Move debug callback into header and allow adding user pointer 2021-06-14 15:17:37 -07:00
Charles Giessen
e511dfdbf9 test: Add 1.0 test for feature config selection 2021-06-10 10:06:14 -07:00
Cody Goodson
f49032f804 Internal table change.
- Internal tables are now populated through internal vkGetDeviceProcAddr rather than through passed dispatch table
- Device now has its own internal table as well.
- Cleaned up get_proc_addr functions and removed internal functions that are now held in a types internal tables.
2021-06-08 14:03:47 -07:00
Cody Goodson
f5d3061043 Added optional dispatch table usage to swapchain. 2021-06-08 14:03:47 -07:00
Charles Giessen
b3fdd554b4 Add vkb::destroy_surface helper function 2021-06-06 13:25:08 -07:00
Cody Goodson
10d88ae840 Reverted back to dispatch table creation function in device type
- Added noexcept modifier to proxys
- Change name of header to VkBoostrapDispatch.h
2021-06-06 12:49:23 -07:00
Cody Goodson
a61e221d59 Trimmed branching in script and modified usage in core lib. 2021-06-06 12:49:23 -07:00
Cody Goodson
8dc3c2aeee Proxys added to autogen. Updated test. 2021-06-06 12:49:23 -07:00
Cody Goodson
2445eb0b28 Loading looks good, but requires passing Device still; 2021-06-06 12:49:23 -07:00
Charles Giessen
bae94d9f47 example: Load vkDestroySurfaceKHR correctly.
vkDestroySurfaceKHR needs to be loaded with vkGetInstanceProcAddr, not vkGetDeviceProcAddr.
2021-05-21 14:04:28 -06:00
Charles Giessen
ab60522c9b Format internal queue selection functions 2021-05-21 14:04:28 -06:00
Charles Giessen
045b1e7b0f Add queue selection tests and refactor internal code a bit 2021-05-21 14:04:28 -06:00
Charles Giessen
a0d1ce5b39 Revert "Revert "Simplified structures and plugged into existing logic.""
This reverts commit 2a352b5a25.
2021-04-18 14:42:35 -06:00
Charles Giessen
5c85f3a796 Revert "Revert "Fixed Features11/12 break. Tests now pass.""
This reverts commit 299b36a3a4.
2021-04-18 14:42:35 -06:00
Charles Giessen
8a3c1ac6ed Revert "Revert "- Restored removed functions - Restored pNext chain to device (appends to the end of the ExtentionFeatures chain) - Style changes - Migrated ExtensionFeatures into detail""
This reverts commit 4bfc21f8be.
2021-04-18 14:42:35 -06:00
Charles Giessen
4bfc21f8be Revert "- Restored removed functions - Restored pNext chain to device (appends to the end of the ExtentionFeatures chain) - Style changes - Migrated ExtensionFeatures into detail"
This reverts commit 0359ceb3fb.
2021-04-18 14:09:56 -06:00
Charles Giessen
299b36a3a4 Revert "Fixed Features11/12 break. Tests now pass."
This reverts commit 632a42f5cd.
2021-04-18 14:09:56 -06:00
Charles Giessen
2a352b5a25 Revert "Simplified structures and plugged into existing logic."
This reverts commit 6ee81abdd3.
2021-04-18 14:09:56 -06:00
Cody Goodson
6ee81abdd3 Simplified structures and plugged into existing logic. 2021-04-18 14:04:27 -06:00