Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions layersvt/VkLayer_api_dump.def
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ vkGetInstanceProcAddr
vkGetDeviceProcAddr
vkEnumerateInstanceLayerProperties
vkEnumerateInstanceExtensionProperties
vkEnumerateDeviceExtensionProperties
vkEnumerateDeviceLayerProperties
48 changes: 47 additions & 1 deletion layersvt/api_dump_handwritten_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,56 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, c

extern "C" {

VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_layerGetPhysicalDeviceProcAddr(VkInstance instance, const char* funcName) {
return instance_dispatch_table(instance)->GetPhysicalDeviceProcAddr(instance, funcName);
}

EXPORT_FUNCTION VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface* pVersionStruct) {
assert(pVersionStruct != NULL);
assert(pVersionStruct->sType == LAYER_NEGOTIATE_INTERFACE_STRUCT);

// Fill in the function pointers if our version is at least capable of having the structure contain them.
if (pVersionStruct->loaderLayerInterfaceVersion >= 2) {
pVersionStruct->pfnGetInstanceProcAddr = vkGetInstanceProcAddr;
pVersionStruct->pfnGetDeviceProcAddr = vkGetDeviceProcAddr;
pVersionStruct->pfnGetPhysicalDeviceProcAddr = vk_layerGetPhysicalDeviceProcAddr;
}

if (pVersionStruct->loaderLayerInterfaceVersion > CURRENT_LOADER_LAYER_INTERFACE_VERSION) {
pVersionStruct->loaderLayerInterfaceVersion = CURRENT_LOADER_LAYER_INTERFACE_VERSION;
}

return VK_SUCCESS;
}

EXPORT_FUNCTION VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties) {
return util_GetExtensionProperties(0, NULL, pPropertyCount, pProperties);
static const VkExtensionProperties extensionProperties[] = {{
"VK_EXT_layer_settings",
2,
}};
if (pLayerName && strcmp(pLayerName, "VK_LAYER_LUNARG_api_dump") == 0) {
return util_GetExtensionProperties(ARRAY_SIZE(extensionProperties), extensionProperties, pPropertyCount, pProperties);
} else {
return VK_ERROR_LAYER_NOT_PRESENT;
}
}

EXPORT_FUNCTION VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties) {
static const VkExtensionProperties extensionProperties[] = {{
"VK_EXT_tooling_info",
1,
}};
if (pLayerName && strcmp(pLayerName, "VK_LAYER_LUNARG_api_dump") == 0) {
return util_GetExtensionProperties(ARRAY_SIZE(extensionProperties), extensionProperties, pPropertyCount, pProperties);
} else {
return instance_dispatch_table(physicalDevice)
->EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, pProperties);
}
}

EXPORT_FUNCTION VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount,
Expand Down
2 changes: 2 additions & 0 deletions layersvt/generated/api_dump_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -15372,6 +15372,8 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL api_dump_known_instance_functions(VkIns
return reinterpret_cast<PFN_vkVoidFunction>(vkCreateDevice<Format>);
if (strcmp(pName, "vkEnumerateInstanceExtensionProperties") == 0)
return reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateInstanceExtensionProperties);
if (strcmp(pName, "vkEnumerateDeviceExtensionProperties") == 0)
return reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateDeviceExtensionProperties);
if (strcmp(pName, "vkEnumerateInstanceLayerProperties") == 0)
return reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateInstanceLayerProperties);
if (strcmp(pName, "vkEnumerateDeviceLayerProperties") == 0)
Expand Down
6 changes: 3 additions & 3 deletions scripts/generators/api_dump_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def generate_dispatch_codegen(self):
self.write('VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL api_dump_known_instance_functions(VkInstance instance, const char* pName)')
self.write('{\n')
for command in self.vk.commands.values():
if command.name in ['vkEnumerateDeviceExtensionProperties', 'vkEnumerateInstanceVersion'] or (command.device and 'VK_EXT_debug_utils' not in command.extensions):
if command.name in ['vkEnumerateInstanceVersion'] or (command.device and 'VK_EXT_debug_utils' not in command.extensions):
continue
protect.add_guard(self, command.protect)
self.write(f'if(strcmp(pName, "{command.name}") == 0)')
Expand Down Expand Up @@ -898,7 +898,7 @@ def get_is_array(self, var):
if var.fullType == 'const char*' or (len(var.fixedSizeArray) > 0 and var.type == 'char'):
return False

# Function poitners are considered poitners, but we want to print them as values
# Function pointers are considered pointers, but we want to print them as values
if var.type in self.vk.funcPointers.keys():
return False

Expand Down Expand Up @@ -937,7 +937,7 @@ def write_value(self, var, parent):
}}''')

elif len(var.fixedSizeArray) > 2:
raise RuntimeError("Unhandled fixed array dimentionality")
raise RuntimeError("Unhandled fixed array dimensionality")
elif len(var.fixedSizeArray) == 2:
self.write(f'dump_double_array<Format>({value}, {var.fixedSizeArray[0]}, {var.fixedSizeArray[1]}, settings, "{custom_fullType}", "{var.name}", "{custom_type}", {indent}, {element_type});')

Expand Down