Commit Graph

274 Commits

Author SHA1 Message Date
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
n0F4x
fa75546109 Remove unnecessary feature checks 2024-06-13 10:25:28 -05:00
n0F4x
f238a7355f Fix typos in function documentation 2024-06-13 10:25:28 -05:00
n0F4x
92dc597184 Add are_extension_features_present to PhysicalDevice 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
Imad Laggoune
fbad8786a4 [Change] Pass by Pointer to Pass by Reference
-Update all arguments in supports_features to be passed by reference rather then pointers.
-Make necessary changes for all calls to supports_features.
2024-05-29 11:48:22 +01:00
Imad Laggoune
cf2830cd32 Work Around for SEGFAULT in supports_features
-Turn every argument in support_features into const pointers.

-Change support_fueatures calls to match the new arguments.

-Add checks for nullptr.
2024-05-29 11:48:22 +01:00
Charles Giessen
8320b691f7 Rename parameter in enable_extension_features_if_present
Prevents shadowing warnings from annoying users.
2024-05-29 10:05:10 +01: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
a78a7f38da Assert that set_required_features sTypes are set
This allows the set_required_features_11/12/13 to take a reference instead
of a value. Applications should set the sType, vk-bootstrap shouldn't be
doing that for apps.
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
Charles Giessen
c7e50426ba Add alternate for deprecated desired extension functions 2024-02-11 11:18:56 -06:00
Mxr
eab517912c Further fix 2024-02-05 21:16:15 -08:00
Mxr
df5d11fc25 Fix: dangling reference in the range-based for loop 2024-02-05 21:16:15 -08:00
sean
6119bfcb9a Fix: Move objects/vectors where applicable 2024-01-30 10:06:25 -07:00
charles-lunarg
dd6c02e8ab Update to latest Vulkan-Headers 2024-01-30 08:33:40 -07:00
Diamond-D0gs
0af4cb5055 implemented enable_extensions_if_present and tests 2024-01-18 15:15:00 -07:00
Charles Giessen
51cbe62371 Add const case to parameter parsing in autogen
This was missing, causing errors in user code due to not preserving const
2023-12-29 11:26:50 -06:00
Charles Giessen
8e23c8afda Manually guard vkCmdSetExclusiveScissorEnableNV
vkCmdSetExclusiveScissorEnableNV was added to an existing extension
in 1.3.241. Guard it against users with older headers.
2023-12-28 16:18:00 -06:00
Charles Giessen
25dc27c31c Make destroy_* functions pass by reference
The destroy_instance and destroy_device functions should be passed by
const reference to make it consistent with other destroy functions.
2023-12-28 16:01:44 -06:00
charles-lunarg
605c3f1712 Update to latest Vulkan-Headers 2023-12-28 15:56:47 -06:00
Charles Giessen
3ad0388f1b Workaround VK_EXT_discard_rectangles adding new functions
Generalize the mechanism to not enable function pointers based on the current header
version, due to VK_EXT_discard_rectangles adding functions not present in the original
extension.
2023-12-14 13:05:31 -07:00
Charles Giessen
c16df41166 Fix aliased types not being generated
Types that are promoted get turned into aliases, but the dispatch table was missing
these types. This was due to a simple mistake of mixing up the alias with the type
being aliased.
2023-12-12 20:15:31 -07:00
charles-lunarg
ee817ba3c8 Update to latest Vulkan-Headers 2023-12-11 17:56:49 -07:00
Charles Giessen
6ab5669064 Workaround breaking API change in vkGetLatencyTimingsNV
The API of vkGetLatencyTimingsNV changed, which causes compilation failure due to
the generated code using the newer API while the Vulkan-Headers may be for the old
API.

The fix is to just disable the function if the headers are too old. While this does
limit the usage, because its from a new extension, there shouldn't be a huge impact.
2023-11-29 14:20:10 -07:00
charles-lunarg
9f613c2348 Update to latest Vulkan-Headers 2023-11-28 13:55:07 -06:00
Charles Giessen
7900b9afe7 Add size + ptr & vector overloads for add_extensions
The instance & physical device selector only allowed adding a single
extension at a time. This commit adds overloads for a vector of const
char*'s and a count + pointer pair.
2023-11-22 03:00:44 -07:00
Charles Giessen
9864d2b838 Cleanup internal class VulkanFunctions
Removes the subclassing of VulkanLibrary, bringing its logic into the VulkanFunctions
class. This resolves a weird linking issue which was causing hot-reloading of shared
libraries that statically linked vk-bootstrap to fail to unload correctly, preventing
reloading.
The commit also consolidates the logic in load_vulkan_funcs() into a single function
rather than having it be split in three, which only made the code harder to reason
about.

Also made vk-bootstrap look for `libMoltenVK.dylib` on apple platforms, in case the
application only has the MoltenVK shared library but not the loader (and the user
didn't manually load GetInstanceProcAddr from MoltenVK then give it to vk-bootstrap).
2023-11-12 19:51:48 -07:00
Charles Giessen
49491c28c7 Remove deprecation notice in SwapchainBuilder
Turns out that was me being over eager in removing anything with 'desire' in the
name, and that for Swapchains there is a direct way to see the properties of the
swapchain after its creation, as vkb::Swapchain contains image count, colorspace,
present mode, and many other properties.
2023-10-30 11:53:33 -06:00
Charles Giessen
2b07f01a15 Mark QUEUE_INDEX_MAX_VALUE as inline
Fixes issues putting VkBootstrap.h into modules.
2023-10-30 11:50:10 -06: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
ed31a4d1b1 Fix missing return *this in Result class 2023-10-30 11:13:12 -06:00
charles-lunarg
99be60aa19 Update to latest Vulkan-Headers 2023-10-23 18:50:54 -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
454fb23d52 Add padding to DispatchTables for undefined functions
This allows for a project with not-perfect use of macro defines across the
code base to not have different definitions for the dispatch tables.

For example:
```
    PFN_vkCreateAndroidSurfaceKHR fp_vkCreateAndroidSurfaceKHR = nullptr;
    void * fp_vkCreateAndroidSurfaceKHR{};
```
If VK_KHR_android_surface is not defined for whatever reason, the dispatch
table is still the same size, so other functions aren't affected.
2023-10-13 11:29:06 -06:00
Charles Giessen
72ba6954c9 Update to v1.3.268 & switch to spaces in VkBootstrapDispatch.h 2023-10-13 11:29:06 -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-lunarg
6be9ef9f46 Update to latest Vulkan-Headers 2023-10-09 18:46:37 -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
fd71b1dd82 Use spaces instead of tabs
Modify the .clang-format to format with spaces for indention instead of tabs
2023-09-19 16:13:11 -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
David Dubois
61f77612c7 Remove cringe whitespace 2023-02-28 16:57:17 -07:00
David Dubois
a4d4e0690e Remove new method, change debug utils enabling logic 2023-02-28 16:57:17 -07:00
David Dubois
82b7a0ed01 Provide a way to disable the debug callback 2023-02-28 16:57:17 -07:00
David Dubois
683d014241 Provide a way to disable the debug callback 2023-02-28 16:57:17 -07:00
charles-lunarg
2d7315eadf Update to latest Vulkan-Headers 2023-02-15 10:30:57 -07:00
Charles Giessen
8e61b2d81c Make Vulkan 1.1 Headers required
Previously, the code tried to make it possible to use vk-bootstrap with
Vulkan 1.0 headers. This makes the code complicated and left several paths
completly untested. Making Vulkan 1.1 headers allows for simpler code.

Note: This does NOT make a Vulkan 1.1 capable driver required to use
vk-bootstrap. This only requires that the headers used to build
vk-bootstrap are 1.1 or above.
2023-01-12 16:07:43 -07:00