lavapipe: fixes for macOS support

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29900>
This commit is contained in:
Aleksi Sapon 2024-06-25 11:45:50 -04:00 committed by Marge Bot
parent 51e56c6c7b
commit 13e7a39f49
2 changed files with 12 additions and 4 deletions

View file

@ -1484,8 +1484,11 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceMemoryProperties2(
VkPhysicalDeviceMemoryBudgetPropertiesEXT *props = vk_find_struct(pMemoryProperties, PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT); VkPhysicalDeviceMemoryBudgetPropertiesEXT *props = vk_find_struct(pMemoryProperties, PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT);
if (props) { if (props) {
props->heapBudget[0] = pMemoryProperties->memoryProperties.memoryHeaps[0].size; props->heapBudget[0] = pMemoryProperties->memoryProperties.memoryHeaps[0].size;
os_get_available_system_memory(&props->heapUsage[0]); if (os_get_available_system_memory(&props->heapUsage[0])) {
props->heapUsage[0] = props->heapBudget[0] - props->heapUsage[0]; props->heapUsage[0] = props->heapBudget[0] - props->heapUsage[0];
} else {
props->heapUsage[0] = 0;
}
memset(&props->heapBudget[1], 0, sizeof(props->heapBudget[0]) * (VK_MAX_MEMORY_HEAPS - 1)); memset(&props->heapBudget[1], 0, sizeof(props->heapBudget[0]) * (VK_MAX_MEMORY_HEAPS - 1));
memset(&props->heapUsage[1], 0, sizeof(props->heapUsage[0]) * (VK_MAX_MEMORY_HEAPS - 1)); memset(&props->heapUsage[1], 0, sizeof(props->heapUsage[0]) * (VK_MAX_MEMORY_HEAPS - 1));
} }

View file

@ -9,16 +9,21 @@ libvulkan_lvp = shared_library(
link_with : [libpipe_loader_static, libgallium, libwsw, libswdri, libws_null, libswkmsdri ], link_with : [libpipe_loader_static, libgallium, libwsw, libswdri, libws_null, libswkmsdri ],
gnu_symbol_visibility : 'hidden', gnu_symbol_visibility : 'hidden',
link_args : [ld_args_bsymbolic, ld_args_gc_sections], link_args : [ld_args_bsymbolic, ld_args_gc_sections],
# On Apple systems, "weak" is actually "weak_import", which is slightly different.
# The linker still expects a definition for weak symbols at build time, just not at runtime.
# We have to forcibly ignore undefined symbols, which unfortunately applies to all symbols.
override_options : ['b_lundef=@0@'.format(host_machine.system() == 'darwin' ? 'false' : get_option('b_lundef').to_string())],
dependencies : driver_swrast, dependencies : driver_swrast,
name_prefix : host_machine.system() == 'windows' ? '' : [], name_prefix : host_machine.system() == 'windows' ? '' : [],
install : true, install : true,
) )
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = 'libvulkan_lvp.so'
if with_platform_windows if with_platform_windows
icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir) icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
icd_file_name = 'vulkan_lvp.dll' icd_file_name = 'vulkan_lvp.dll'
else
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = 'libvulkan_lvp.@0@'.format(host_machine.system() == 'darwin' ? 'dylib' : 'so')
endif endif
icd_command = [ icd_command = [