diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index 5ab522da959..e6792279577 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -1484,8 +1484,11 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceMemoryProperties2( VkPhysicalDeviceMemoryBudgetPropertiesEXT *props = vk_find_struct(pMemoryProperties, PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT); if (props) { props->heapBudget[0] = pMemoryProperties->memoryProperties.memoryHeaps[0].size; - os_get_available_system_memory(&props->heapUsage[0]); - props->heapUsage[0] = props->heapBudget[0] - props->heapUsage[0]; + if (os_get_available_system_memory(&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->heapUsage[1], 0, sizeof(props->heapUsage[0]) * (VK_MAX_MEMORY_HEAPS - 1)); } diff --git a/src/gallium/targets/lavapipe/meson.build b/src/gallium/targets/lavapipe/meson.build index a9926b5d808..999315c5d3b 100644 --- a/src/gallium/targets/lavapipe/meson.build +++ b/src/gallium/targets/lavapipe/meson.build @@ -9,16 +9,21 @@ libvulkan_lvp = shared_library( link_with : [libpipe_loader_static, libgallium, libwsw, libswdri, libws_null, libswkmsdri ], gnu_symbol_visibility : 'hidden', 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, name_prefix : host_machine.system() == 'windows' ? '' : [], install : true, ) -icd_lib_path = join_paths(get_option('prefix'), get_option('libdir')) -icd_file_name = 'libvulkan_lvp.so' if with_platform_windows icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir) 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 icd_command = [