Skip to content

Commit be4cbbf

Browse files
authored
Merge pull request #4 from Esri/mbcoder/update-version
update version
2 parents b42ea33 + 12e45f8 commit be4cbbf

12 files changed

Lines changed: 1394 additions & 50 deletions

‎.github/workflows/run_autogen.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
PR_NUMBER: ${{ github.event.number }}
3131

3232
steps:
33-
- uses: actions/create-github-app-token@v2
33+
- uses: actions/create-github-app-token@v3
3434
id: generate-token
3535
with:
3636
app-id: ${{ vars.APP_ID }}

‎conanfile_rtc.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class VkBootstrapConan(ConanFile):
55
name = "vk-bootstrap"
6-
version = "1.4.341"
6+
version = "1.4.353"
77
url = "https://github.com/Esri/vk-bootstrap/blob/runtimecore/"
88
license = "https://github.com/Esri/vk-bootstrap/blob/runtimecore/LICENSE.md"
99
description = "A utility library that jump starts initialization of Vulkan"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
set(VK_BOOTSTRAP_SOURCE_HEADER_VERSION 1.4.341)
2-
set(VK_BOOTSTRAP_SOURCE_HEADER_VERSION_GIT_TAG v1.4.341)
1+
set(VK_BOOTSTRAP_SOURCE_HEADER_VERSION 1.4.353)
2+
set(VK_BOOTSTRAP_SOURCE_HEADER_VERSION_GIT_TAG v1.4.353)

‎script/generate_dispatch.py‎

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@
5050
'vkCmdDispatchGraphIndirectAMDX': '298', # Changed API parameters
5151
'vkCmdDispatchGraphIndirectCountAMDX': '298', # Changed API parameters
5252
'vkCmdDispatchTileQCOM': '316', # Changed API parameters
53+
'vkGetImageViewAddressNVX':'137', # Revision of extension added new function
54+
'vkGetImageViewHandle64NVX':'302', # Revision of extension added new function
55+
'vkGetDeviceCombinedImageSamplerIndexNVX':'340', # Revision of extension added new function
56+
'vkCmdSetDispatchParametersARM':'348', # Revision of extension added new function
57+
'VkDispatchParametersARM':'348', # Revision of extension added new function
58+
}
59+
60+
# Some functions use types other than what the commands vendor tag denotes. These are needed to correctly depromote all types
61+
TYPES_NOT_MATCHING_VENDOR_TAGS = {
62+
'vkGetAccelerationStructureMemoryRequirementsNV' : { 'pMemoryRequirements' : ['VkMemoryRequirements2', 'VkMemoryRequirements2KHR']}, # 1.4.348
5363
}
5464

5565
# License
@@ -80,7 +90,6 @@
8090
head = '\n#pragma once\n\n#include <vulkan/vulkan_core.h>\n\n'
8191
head += 'namespace vkb {\n\n'
8292

83-
8493
def get_command_guards(command):
8594
version_guard = f'defined({command.version.name})' if command.version is not None else ''
8695
ext_guard = ' || '.join([f'defined({e})' for e in command.extensions] )
@@ -131,20 +140,28 @@ def get_depromotion_map():
131140
type_alias_map[handle_name] = handle.aliases
132141

133142
for command_name, command in vk.commands.items():
134-
if command.alias is not None:
135-
command_tag = None
136-
for tag in vk.vendorTags:
137-
if tag in command_name:
138-
command_tag = tag
139-
if command_tag is None:
140-
continue
141-
142-
for param in command.params:
143-
if param.type in type_alias_map:
144-
best_alias_match = [x for x in type_alias_map[param.type] if x.endswith(command_tag)][0]
143+
command_tags = set()
144+
for ext in command.extensions:
145+
command_tags.add(vk.extensions[ext].vendorTag)
146+
147+
for param in command.params:
148+
if param.type in type_alias_map:
149+
alias_matches = []
150+
for type_alias in type_alias_map[param.type]:
151+
for tag in command_tags:
152+
if type_alias.endswith(tag):
153+
alias_matches.append(type_alias)
154+
155+
for alias_match in alias_matches:
145156
if command_name not in depromotion_map:
146157
depromotion_map[command_name] = []
147-
depromotion_map[command_name].append([param.type, best_alias_match])
158+
depromotion_map[command_name].append([param.type, alias_match])
159+
160+
for command_name, types in TYPES_NOT_MATCHING_VENDOR_TAGS.items():
161+
if command_name not in depromotion_map:
162+
depromotion_map[command_name] = []
163+
for param_types in types.values():
164+
depromotion_map[command_name].append([param_types[0], param_types[1]])
148165

149166
return depromotion_map
150167

‎script/generate_features_chain.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@
5858
namespace vkb::detail {
5959
6060
'''
61+
62+
# Structures that used to have a protect (like beta ext being moved to non-beta
63+
HEADER_VERSION_MISSING_DEFINES = {
64+
'VkPhysicalDevicePresentMeteringFeaturesNV': {'promoted_version' : '345', 'protect' : 'VK_ENABLE_BETA_EXTENSIONS'},
65+
}
66+
6167
feature_struct_ext_map = {}
6268
feature_struct_ext_stype_map = {}
6369

@@ -78,6 +84,10 @@ def get_struct_guards(struct, struct_name):
7884
reqs = []
7985
if struct.protect is not None:
8086
reqs.append( f'defined({struct.protect})')
87+
if struct_name in HEADER_VERSION_MISSING_DEFINES:
88+
version = HEADER_VERSION_MISSING_DEFINES[struct_name]['promoted_version']
89+
protect = HEADER_VERSION_MISSING_DEFINES[struct_name]['protect']
90+
reqs.append(f'(VK_HEADER_VERSION >= {version} || defined({protect}))')
8191
enablement = []
8292
if struct.version is not None:
8393
enablement.append(f'defined({struct.version.name})')

‎src/VkBootstrap.cpp‎

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ std::vector<vkb::detail::FeaturesChain::StructInfo>::const_iterator FeaturesChai
138138
});
139139
}
140140

141+
void add_all_pnext_structures(std::vector<void*>& pNext_chain, void* structure_to_add) {
142+
auto pNext_iter = structure_to_add;
143+
while (pNext_iter != nullptr) {
144+
pNext_chain.push_back(pNext_iter);
145+
VkBaseOutStructure out_structure{};
146+
memcpy(&out_structure, pNext_iter, sizeof(VkBaseOutStructure));
147+
pNext_iter = out_structure.pNext;
148+
}
149+
}
150+
141151

142152
class VulkanFunctions {
143153
private:
@@ -455,6 +465,17 @@ template <typename T> void setup_pNext_chain(T& structure, std::vector<void*> co
455465
structure.pNext = nullptr;
456466
if (structs.empty()) return;
457467
for (size_t i = 0; i < structs.size() - 1; i++) {
468+
// Make sure we aren't adding the same struct more than once. We do not care about duplicate sTypes here.
469+
bool is_duplicate = false;
470+
for (size_t j = 0; j != i; j++) {
471+
if (structs.at(i) == structs.at(j)) {
472+
is_duplicate = true;
473+
break;
474+
}
475+
}
476+
if (is_duplicate) {
477+
continue;
478+
}
458479
VkBaseOutStructure out_structure{};
459480
memcpy(&out_structure, structs.at(i), sizeof(VkBaseOutStructure));
460481
#if !defined(NDEBUG)
@@ -1568,11 +1589,17 @@ Result<uint32_t> Device::get_queue_index(QueueType type) const {
15681589
break;
15691590
case QueueType::compute:
15701591
index = detail::get_separate_queue_index(queue_families, VK_QUEUE_COMPUTE_BIT, VK_QUEUE_TRANSFER_BIT);
1571-
if (index == detail::QUEUE_INDEX_MAX_VALUE) return Result<uint32_t>{ QueueError::compute_unavailable };
1592+
if (index == detail::QUEUE_INDEX_MAX_VALUE) {
1593+
index = detail::get_first_queue_index(queue_families, VK_QUEUE_COMPUTE_BIT);
1594+
if (index == detail::QUEUE_INDEX_MAX_VALUE) return Result<uint32_t>{ QueueError::compute_unavailable };
1595+
}
15721596
break;
15731597
case QueueType::transfer:
15741598
index = detail::get_separate_queue_index(queue_families, VK_QUEUE_TRANSFER_BIT, VK_QUEUE_COMPUTE_BIT);
1575-
if (index == detail::QUEUE_INDEX_MAX_VALUE) return Result<uint32_t>{ QueueError::transfer_unavailable };
1599+
if (index == detail::QUEUE_INDEX_MAX_VALUE) {
1600+
index = detail::get_first_queue_index(queue_families, VK_QUEUE_TRANSFER_BIT);
1601+
if (index == detail::QUEUE_INDEX_MAX_VALUE) return Result<uint32_t>{ QueueError::transfer_unavailable };
1602+
}
15761603
break;
15771604
default:
15781605
return Result<uint32_t>{ QueueError::invalid_queue_family_index };
@@ -1611,6 +1638,22 @@ Result<VkQueue> Device::get_dedicated_queue(QueueType type) const {
16111638
return out_queue;
16121639
}
16131640

1641+
Result<std::pair<VkQueue, uint32_t>> Device::get_queue_and_index(QueueType type) const {
1642+
auto index = get_queue_index(type);
1643+
if (!index.has_value()) return { index.error() };
1644+
VkQueue out_queue;
1645+
internal_table.fp_vkGetDeviceQueue(device, index.value(), 0, &out_queue);
1646+
return std::pair<VkQueue, uint32_t>(out_queue, index.value());
1647+
}
1648+
1649+
Result<std::pair<VkQueue, uint32_t>> Device::get_dedicated_queue_and_index(QueueType type) const {
1650+
auto index = get_dedicated_queue_index(type);
1651+
if (!index.has_value()) return { index.error() };
1652+
VkQueue out_queue;
1653+
internal_table.fp_vkGetDeviceQueue(device, index.value(), 0, &out_queue);
1654+
return std::pair<VkQueue, uint32_t>(out_queue, index.value());
1655+
}
1656+
16141657
// ---- Dispatch ---- //
16151658

16161659
DispatchTable Device::make_table() const { return { device, fp_vkGetDeviceProcAddr }; }
@@ -1691,8 +1734,8 @@ Result<Device> DeviceBuilder::build() const {
16911734
}
16921735
}
16931736

1694-
for (auto& pnext : info.pNext_chain) {
1695-
final_pnext_chain.push_back(pnext);
1737+
for (auto& pNext : info.pNext_chain) {
1738+
final_pnext_chain.push_back(pNext);
16961739
}
16971740

16981741
detail::setup_pNext_chain(device_create_info, final_pnext_chain);
@@ -1744,6 +1787,10 @@ DeviceBuilder& DeviceBuilder::custom_queue_setup(std::span<const CustomQueueDesc
17441787
return *this;
17451788
}
17461789
#endif
1790+
DeviceBuilder& DeviceBuilder::add_pNext(void* structure_to_add) {
1791+
detail::add_all_pnext_structures(info.pNext_chain, structure_to_add);
1792+
return *this;
1793+
}
17471794

17481795
// ---- Swapchain ---- //
17491796

@@ -1875,8 +1922,8 @@ SwapchainBuilder::SwapchainBuilder(Device const& device) {
18751922
auto present = device.get_queue_index(QueueType::present);
18761923
auto graphics = device.get_queue_index(QueueType::graphics);
18771924
assert(graphics.has_value() && present.has_value() && "Graphics and Present queue indexes must be valid");
1878-
info.graphics_queue_index = present.value();
1879-
info.present_queue_index = graphics.value();
1925+
info.graphics_queue_index = graphics.value();
1926+
info.present_queue_index = present.value();
18801927
}
18811928
SwapchainBuilder::SwapchainBuilder(Device const& device, VkSurfaceKHR const surface) {
18821929
info.physical_device = device.physical_device.physical_device;
@@ -2146,6 +2193,10 @@ SwapchainBuilder& SwapchainBuilder::set_allocation_callbacks(VkAllocationCallbac
21462193
info.allocation_callbacks = callbacks;
21472194
return *this;
21482195
}
2196+
SwapchainBuilder& SwapchainBuilder::add_pNext(void* structure_to_add) {
2197+
detail::add_all_pnext_structures(info.pNext_chain, structure_to_add);
2198+
return *this;
2199+
}
21492200
SwapchainBuilder& SwapchainBuilder::set_image_usage_flags(VkImageUsageFlags usage_flags) {
21502201
info.image_usage_flags = usage_flags;
21512202
return *this;

‎src/VkBootstrap.h‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <string>
3838
#include <system_error>
3939
#include <variant>
40+
#include <utility>
4041

4142
#include <vulkan/vulkan_core.h>
4243

@@ -760,6 +761,10 @@ struct Device {
760761
// Only a compute or transfer queue type is valid. All other queue types do not support a 'dedicated' queue
761762
Result<VkQueue> get_dedicated_queue(QueueType type) const;
762763

764+
Result<std::pair<VkQueue, uint32_t>> get_queue_and_index(QueueType type) const;
765+
// Only a compute or transfer queue type is valid. All other queue types do not support a 'dedicated' queue
766+
Result<std::pair<VkQueue, uint32_t>> get_dedicated_queue_and_index(QueueType type) const;
767+
763768
// Return a loaded dispatch table
764769
DispatchTable make_table() const;
765770

@@ -815,12 +820,11 @@ class DeviceBuilder {
815820
DeviceBuilder& custom_queue_setup(std::span<const CustomQueueDescription> queue_descriptions);
816821
#endif
817822

818-
// Add a structure to the pNext chain of VkDeviceCreateInfo.
823+
// Add a pNext chain structure to the pNext chain of VkDeviceCreateInfo.
819824
// The structure must be valid when DeviceBuilder::build() is called.
820-
template <typename T> DeviceBuilder& add_pNext(T* structure) {
821-
info.pNext_chain.push_back(structure);
822-
return *this;
823-
}
825+
// The structure must be a type that is valid to add to the pNext chain of VkDeviceCreateInfo
826+
// Any structures chained through the pNext pointer will also be added
827+
DeviceBuilder& add_pNext(void* structure_to_add);
824828

825829
// Provide custom allocation callbacks.
826830
DeviceBuilder& set_allocation_callbacks(VkAllocationCallbacks* callbacks);
@@ -973,10 +977,9 @@ class SwapchainBuilder {
973977

974978
// Add a structure to the pNext chain of VkSwapchainCreateInfoKHR.
975979
// The structure must be valid when SwapchainBuilder::build() is called.
976-
template <typename T> SwapchainBuilder& add_pNext(T* structure) {
977-
info.pNext_chain.push_back(structure);
978-
return *this;
979-
}
980+
// The structure must be a type that is valid to add to the pNext chain of VkSwapchainCreateInfoKHR
981+
// Any structures chained through the pNext pointer will also be added
982+
SwapchainBuilder& add_pNext(void* structure_to_add);
980983

981984
// Provide custom allocation callbacks.
982985
SwapchainBuilder& set_allocation_callbacks(VkAllocationCallbacks* callbacks);

0 commit comments

Comments
 (0)