mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 15:24:34 +00:00
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.
This commit is contained in:
parent
ae05c97bdb
commit
3ad0388f1b
@ -102,6 +102,13 @@ commands = {}
|
|||||||
INSTANCE = 'instance'
|
INSTANCE = 'instance'
|
||||||
DEVICE = 'device'
|
DEVICE = 'device'
|
||||||
|
|
||||||
|
# No good way to detect incompatibilities with the macro defines and the actual functions. Just keep a list here
|
||||||
|
HEADER_VERSION_WORKAROUNDS = {
|
||||||
|
'vkGetLatencyTimingsNV': '271', # Changed API parameters
|
||||||
|
'vkCmdSetDiscardRectangleEnableEXT': '241', # new function in older extension
|
||||||
|
'vkCmdSetDiscardRectangleModeEXT': '241', # new function in older extension
|
||||||
|
}
|
||||||
|
|
||||||
def get_macro_guard(reqs_collection, command_name):
|
def get_macro_guard(reqs_collection, command_name):
|
||||||
guard = ''
|
guard = ''
|
||||||
count = len(reqs_collection)
|
count = len(reqs_collection)
|
||||||
@ -121,8 +128,9 @@ def get_macro_guard(reqs_collection, command_name):
|
|||||||
if count > 0:
|
if count > 0:
|
||||||
guard += ' || '
|
guard += ' || '
|
||||||
# API breaking change causes this function to fail compilation
|
# API breaking change causes this function to fail compilation
|
||||||
if command_name == 'vkGetLatencyTimingsNV':
|
for function, version in HEADER_VERSION_WORKAROUNDS.items():
|
||||||
guard = f'({guard}) && VK_HEADER_VERSION >= 271'
|
if command_name == function:
|
||||||
|
guard = f'({guard}) && VK_HEADER_VERSION >= {version}'
|
||||||
return guard
|
return guard
|
||||||
|
|
||||||
|
|
||||||
|
@ -1711,10 +1711,10 @@ struct DispatchTable {
|
|||||||
#if (defined(VK_EXT_discard_rectangles))
|
#if (defined(VK_EXT_discard_rectangles))
|
||||||
fp_vkCmdSetDiscardRectangleEXT = reinterpret_cast<PFN_vkCmdSetDiscardRectangleEXT>(procAddr(device, "vkCmdSetDiscardRectangleEXT"));
|
fp_vkCmdSetDiscardRectangleEXT = reinterpret_cast<PFN_vkCmdSetDiscardRectangleEXT>(procAddr(device, "vkCmdSetDiscardRectangleEXT"));
|
||||||
#endif
|
#endif
|
||||||
#if (defined(VK_EXT_discard_rectangles))
|
#if ((defined(VK_EXT_discard_rectangles))) && VK_HEADER_VERSION >= 241
|
||||||
fp_vkCmdSetDiscardRectangleEnableEXT = reinterpret_cast<PFN_vkCmdSetDiscardRectangleEnableEXT>(procAddr(device, "vkCmdSetDiscardRectangleEnableEXT"));
|
fp_vkCmdSetDiscardRectangleEnableEXT = reinterpret_cast<PFN_vkCmdSetDiscardRectangleEnableEXT>(procAddr(device, "vkCmdSetDiscardRectangleEnableEXT"));
|
||||||
#endif
|
#endif
|
||||||
#if (defined(VK_EXT_discard_rectangles))
|
#if ((defined(VK_EXT_discard_rectangles))) && VK_HEADER_VERSION >= 241
|
||||||
fp_vkCmdSetDiscardRectangleModeEXT = reinterpret_cast<PFN_vkCmdSetDiscardRectangleModeEXT>(procAddr(device, "vkCmdSetDiscardRectangleModeEXT"));
|
fp_vkCmdSetDiscardRectangleModeEXT = reinterpret_cast<PFN_vkCmdSetDiscardRectangleModeEXT>(procAddr(device, "vkCmdSetDiscardRectangleModeEXT"));
|
||||||
#endif
|
#endif
|
||||||
#if (defined(VK_EXT_sample_locations))
|
#if (defined(VK_EXT_sample_locations))
|
||||||
@ -3574,12 +3574,12 @@ struct DispatchTable {
|
|||||||
fp_vkCmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, discardRectangleCount, pDiscardRectangles);
|
fp_vkCmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, discardRectangleCount, pDiscardRectangles);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if (defined(VK_EXT_discard_rectangles))
|
#if ((defined(VK_EXT_discard_rectangles))) && VK_HEADER_VERSION >= 241
|
||||||
void cmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 discardRectangleEnable) const noexcept {
|
void cmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 discardRectangleEnable) const noexcept {
|
||||||
fp_vkCmdSetDiscardRectangleEnableEXT(commandBuffer, discardRectangleEnable);
|
fp_vkCmdSetDiscardRectangleEnableEXT(commandBuffer, discardRectangleEnable);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if (defined(VK_EXT_discard_rectangles))
|
#if ((defined(VK_EXT_discard_rectangles))) && VK_HEADER_VERSION >= 241
|
||||||
void cmdSetDiscardRectangleModeEXT(VkCommandBuffer commandBuffer, VkDiscardRectangleModeEXT discardRectangleMode) const noexcept {
|
void cmdSetDiscardRectangleModeEXT(VkCommandBuffer commandBuffer, VkDiscardRectangleModeEXT discardRectangleMode) const noexcept {
|
||||||
fp_vkCmdSetDiscardRectangleModeEXT(commandBuffer, discardRectangleMode);
|
fp_vkCmdSetDiscardRectangleModeEXT(commandBuffer, discardRectangleMode);
|
||||||
}
|
}
|
||||||
@ -5928,12 +5928,12 @@ struct DispatchTable {
|
|||||||
#else
|
#else
|
||||||
void * fp_vkCmdSetDiscardRectangleEXT{};
|
void * fp_vkCmdSetDiscardRectangleEXT{};
|
||||||
#endif
|
#endif
|
||||||
#if (defined(VK_EXT_discard_rectangles))
|
#if ((defined(VK_EXT_discard_rectangles))) && VK_HEADER_VERSION >= 241
|
||||||
PFN_vkCmdSetDiscardRectangleEnableEXT fp_vkCmdSetDiscardRectangleEnableEXT = nullptr;
|
PFN_vkCmdSetDiscardRectangleEnableEXT fp_vkCmdSetDiscardRectangleEnableEXT = nullptr;
|
||||||
#else
|
#else
|
||||||
void * fp_vkCmdSetDiscardRectangleEnableEXT{};
|
void * fp_vkCmdSetDiscardRectangleEnableEXT{};
|
||||||
#endif
|
#endif
|
||||||
#if (defined(VK_EXT_discard_rectangles))
|
#if ((defined(VK_EXT_discard_rectangles))) && VK_HEADER_VERSION >= 241
|
||||||
PFN_vkCmdSetDiscardRectangleModeEXT fp_vkCmdSetDiscardRectangleModeEXT = nullptr;
|
PFN_vkCmdSetDiscardRectangleModeEXT fp_vkCmdSetDiscardRectangleModeEXT = nullptr;
|
||||||
#else
|
#else
|
||||||
void * fp_vkCmdSetDiscardRectangleModeEXT{};
|
void * fp_vkCmdSetDiscardRectangleModeEXT{};
|
||||||
|
Loading…
Reference in New Issue
Block a user