• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2016 Red Hat.
3  * Copyright © 2016 Bas Nieuwenhuizen
4  *
5  * based in part on anv driver which is:
6  * Copyright © 2015 Intel Corporation
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice (including the next
16  * paragraph) shall be included in all copies or substantial portions of the
17  * Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25  * IN THE SOFTWARE.
26  */
27 
28 #include "radv_debug.h"
29 #include "radv_private.h"
30 
31 #include "util/driconf.h"
32 
33 #include "vk_instance.h"
34 #include "vk_util.h"
35 
36 static const struct debug_control radv_debug_options[] = {{"nofastclears", RADV_DEBUG_NO_FAST_CLEARS},
37                                                           {"nodcc", RADV_DEBUG_NO_DCC},
38                                                           {"shaders", RADV_DEBUG_DUMP_SHADERS},
39                                                           {"nocache", RADV_DEBUG_NO_CACHE},
40                                                           {"shaderstats", RADV_DEBUG_DUMP_SHADER_STATS},
41                                                           {"nohiz", RADV_DEBUG_NO_HIZ},
42                                                           {"nocompute", RADV_DEBUG_NO_COMPUTE_QUEUE},
43                                                           {"allbos", RADV_DEBUG_ALL_BOS},
44                                                           {"noibs", RADV_DEBUG_NO_IBS},
45                                                           {"spirv", RADV_DEBUG_DUMP_SPIRV},
46                                                           {"zerovram", RADV_DEBUG_ZERO_VRAM},
47                                                           {"syncshaders", RADV_DEBUG_SYNC_SHADERS},
48                                                           {"preoptir", RADV_DEBUG_PREOPTIR},
49                                                           {"nodynamicbounds", RADV_DEBUG_NO_DYNAMIC_BOUNDS},
50                                                           {"info", RADV_DEBUG_INFO},
51                                                           {"startup", RADV_DEBUG_STARTUP},
52                                                           {"checkir", RADV_DEBUG_CHECKIR},
53                                                           {"nobinning", RADV_DEBUG_NOBINNING},
54                                                           {"nongg", RADV_DEBUG_NO_NGG},
55                                                           {"metashaders", RADV_DEBUG_DUMP_META_SHADERS},
56                                                           {"nomemorycache", RADV_DEBUG_NO_MEMORY_CACHE},
57                                                           {"discardtodemote", RADV_DEBUG_DISCARD_TO_DEMOTE},
58                                                           {"llvm", RADV_DEBUG_LLVM},
59                                                           {"forcecompress", RADV_DEBUG_FORCE_COMPRESS},
60                                                           {"hang", RADV_DEBUG_HANG},
61                                                           {"img", RADV_DEBUG_IMG},
62                                                           {"noumr", RADV_DEBUG_NO_UMR},
63                                                           {"invariantgeom", RADV_DEBUG_INVARIANT_GEOM},
64                                                           {"splitfma", RADV_DEBUG_SPLIT_FMA},
65                                                           {"nodisplaydcc", RADV_DEBUG_NO_DISPLAY_DCC},
66                                                           {"notccompatcmask", RADV_DEBUG_NO_TC_COMPAT_CMASK},
67                                                           {"novrsflatshading", RADV_DEBUG_NO_VRS_FLAT_SHADING},
68                                                           {"noatocdithering", RADV_DEBUG_NO_ATOC_DITHERING},
69                                                           {"nonggc", RADV_DEBUG_NO_NGGC},
70                                                           {"prologs", RADV_DEBUG_DUMP_PROLOGS},
71                                                           {"nodma", RADV_DEBUG_NO_DMA_BLIT},
72                                                           {"epilogs", RADV_DEBUG_DUMP_EPILOGS},
73                                                           {"nofmask", RADV_DEBUG_NO_FMASK},
74                                                           {"shadowregs", RADV_DEBUG_SHADOW_REGS},
75                                                           {"extra_md", RADV_DEBUG_EXTRA_MD},
76                                                           {"nogpl", RADV_DEBUG_NO_GPL},
77                                                           {"videoarraypath", RADV_DEBUG_VIDEO_ARRAY_PATH},
78                                                           {"nort", RADV_DEBUG_NO_RT},
79                                                           {"nomeshshader", RADV_DEBUG_NO_MESH_SHADER},
80                                                           {"nongg_gs", RADV_DEBUG_NO_NGG_GS},
81                                                           {"nogsfastlaunch2", RADV_DEBUG_NO_GS_FAST_LAUNCH_2},
82                                                           {NULL, 0}};
83 
84 const char *
radv_get_debug_option_name(int id)85 radv_get_debug_option_name(int id)
86 {
87    assert(id < ARRAY_SIZE(radv_debug_options) - 1);
88    return radv_debug_options[id].string;
89 }
90 
91 static const struct debug_control radv_perftest_options[] = {{"localbos", RADV_PERFTEST_LOCAL_BOS},
92                                                              {"dccmsaa", RADV_PERFTEST_DCC_MSAA},
93                                                              {"bolist", RADV_PERFTEST_BO_LIST},
94                                                              {"cswave32", RADV_PERFTEST_CS_WAVE_32},
95                                                              {"pswave32", RADV_PERFTEST_PS_WAVE_32},
96                                                              {"gewave32", RADV_PERFTEST_GE_WAVE_32},
97                                                              {"nosam", RADV_PERFTEST_NO_SAM},
98                                                              {"sam", RADV_PERFTEST_SAM},
99                                                              {"nggc", RADV_PERFTEST_NGGC},
100                                                              {"emulate_rt", RADV_PERFTEST_EMULATE_RT},
101                                                              {"rtwave64", RADV_PERFTEST_RT_WAVE_64},
102                                                              {"video_decode", RADV_PERFTEST_VIDEO_DECODE},
103                                                              {"dmashaders", RADV_PERFTEST_DMA_SHADERS},
104                                                              {"transfer_queue", RADV_PERFTEST_TRANSFER_QUEUE},
105                                                              {"shader_object", RADV_PERFTEST_SHADER_OBJECT},
106                                                              {"nircache", RADV_PERFTEST_NIR_CACHE},
107                                                              {"rtwave32", RADV_PERFTEST_RT_WAVE_32},
108                                                              {NULL, 0}};
109 
110 const char *
radv_get_perftest_option_name(int id)111 radv_get_perftest_option_name(int id)
112 {
113    assert(id < ARRAY_SIZE(radv_perftest_options) - 1);
114    return radv_perftest_options[id].string;
115 }
116 
117 static const struct debug_control trace_options[] = {
118    {"rgp", RADV_TRACE_MODE_RGP},
119    {"rra", RADV_TRACE_MODE_RRA},
120    {"ctxroll", RADV_TRACE_MODE_CTX_ROLLS},
121    {NULL, 0},
122 };
123 
124 // clang-format off
125 static const driOptionDescription radv_dri_options[] = {
126    DRI_CONF_SECTION_PERFORMANCE
127       DRI_CONF_ADAPTIVE_SYNC(true)
128       DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
129       DRI_CONF_VK_X11_STRICT_IMAGE_COUNT(false)
130       DRI_CONF_VK_X11_ENSURE_MIN_IMAGE_COUNT(false)
131       DRI_CONF_VK_KHR_PRESENT_WAIT(false)
132       DRI_CONF_VK_XWAYLAND_WAIT_READY(false)
133       DRI_CONF_RADV_REPORT_LLVM9_VERSION_STRING(false)
134       DRI_CONF_RADV_ENABLE_MRT_OUTPUT_NAN_FIXUP(false)
135       DRI_CONF_RADV_DISABLE_SHRINK_IMAGE_STORE(false)
136       DRI_CONF_RADV_NO_DYNAMIC_BOUNDS(false)
137       DRI_CONF_RADV_OVERRIDE_UNIFORM_OFFSET_ALIGNMENT(0)
138       DRI_CONF_RADV_CLEAR_LDS(false)
139       DRI_CONF_RADV_DISABLE_NGG_GS(false)
140    DRI_CONF_SECTION_END
141 
142    DRI_CONF_SECTION_DEBUG
143       DRI_CONF_OVERRIDE_VRAM_SIZE()
144       DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST(false)
145       DRI_CONF_VK_WSI_FORCE_SWAPCHAIN_TO_CURRENT_EXTENT(false)
146       DRI_CONF_VK_X11_IGNORE_SUBOPTIMAL(false)
147       DRI_CONF_VK_REQUIRE_ETC2(false)
148       DRI_CONF_VK_REQUIRE_ASTC(false)
149       DRI_CONF_RADV_ZERO_VRAM(false)
150       DRI_CONF_RADV_LOWER_DISCARD_TO_DEMOTE(false)
151       DRI_CONF_RADV_INVARIANT_GEOM(false)
152       DRI_CONF_RADV_SPLIT_FMA(false)
153       DRI_CONF_RADV_DISABLE_TC_COMPAT_HTILE_GENERAL(false)
154       DRI_CONF_RADV_DISABLE_DCC(false)
155       DRI_CONF_RADV_DISABLE_ANISO_SINGLE_LEVEL(false)
156       DRI_CONF_RADV_DISABLE_TRUNC_COORD(false)
157       DRI_CONF_RADV_DISABLE_SINKING_LOAD_INPUT_FS(false)
158       DRI_CONF_RADV_DGC(false)
159       DRI_CONF_RADV_FLUSH_BEFORE_QUERY_COPY(false)
160       DRI_CONF_RADV_ENABLE_UNIFIED_HEAP_ON_APU(false)
161       DRI_CONF_RADV_TEX_NON_UNIFORM(false)
162       DRI_CONF_RADV_FLUSH_BEFORE_TIMESTAMP_WRITE(false)
163       DRI_CONF_RADV_RT_WAVE64(false)
164       DRI_CONF_RADV_LEGACY_SPARSE_BINDING(false)
165       DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION(false)
166       DRI_CONF_RADV_OVERRIDE_GRAPHICS_SHADER_VERSION(0)
167       DRI_CONF_RADV_OVERRIDE_COMPUTE_SHADER_VERSION(0)
168       DRI_CONF_RADV_OVERRIDE_RAY_TRACING_SHADER_VERSION(0)
169       DRI_CONF_RADV_SSBO_NON_UNIFORM(false)
170       DRI_CONF_RADV_FORCE_ACTIVE_ACCEL_STRUCT_LEAVES(false)
171       DRI_CONF_RADV_APP_LAYER()
172    DRI_CONF_SECTION_END
173 };
174 // clang-format on
175 
176 static void
radv_init_dri_options(struct radv_instance * instance)177 radv_init_dri_options(struct radv_instance *instance)
178 {
179    driParseOptionInfo(&instance->drirc.available_options, radv_dri_options, ARRAY_SIZE(radv_dri_options));
180    driParseConfigFiles(&instance->drirc.options, &instance->drirc.available_options, 0, "radv", NULL, NULL,
181                        instance->vk.app_info.app_name, instance->vk.app_info.app_version,
182                        instance->vk.app_info.engine_name, instance->vk.app_info.engine_version);
183 
184    instance->drirc.enable_mrt_output_nan_fixup =
185       driQueryOptionb(&instance->drirc.options, "radv_enable_mrt_output_nan_fixup");
186 
187    instance->drirc.disable_shrink_image_store =
188       driQueryOptionb(&instance->drirc.options, "radv_disable_shrink_image_store");
189 
190    instance->drirc.disable_tc_compat_htile_in_general =
191       driQueryOptionb(&instance->drirc.options, "radv_disable_tc_compat_htile_general");
192 
193    if (driQueryOptionb(&instance->drirc.options, "radv_no_dynamic_bounds"))
194       instance->debug_flags |= RADV_DEBUG_NO_DYNAMIC_BOUNDS;
195 
196    if (driQueryOptionb(&instance->drirc.options, "radv_lower_discard_to_demote"))
197       instance->debug_flags |= RADV_DEBUG_DISCARD_TO_DEMOTE;
198 
199    if (driQueryOptionb(&instance->drirc.options, "radv_invariant_geom"))
200       instance->debug_flags |= RADV_DEBUG_INVARIANT_GEOM;
201 
202    if (driQueryOptionb(&instance->drirc.options, "radv_split_fma"))
203       instance->debug_flags |= RADV_DEBUG_SPLIT_FMA;
204 
205    if (driQueryOptionb(&instance->drirc.options, "radv_disable_dcc"))
206       instance->debug_flags |= RADV_DEBUG_NO_DCC;
207 
208    if (driQueryOptionb(&instance->drirc.options, "radv_disable_ngg_gs"))
209       instance->debug_flags |= RADV_DEBUG_NO_NGG_GS;
210 
211    instance->drirc.clear_lds = driQueryOptionb(&instance->drirc.options, "radv_clear_lds");
212 
213    instance->drirc.zero_vram = driQueryOptionb(&instance->drirc.options, "radv_zero_vram");
214 
215    instance->drirc.disable_aniso_single_level =
216       driQueryOptionb(&instance->drirc.options, "radv_disable_aniso_single_level");
217 
218    instance->drirc.disable_trunc_coord = driQueryOptionb(&instance->drirc.options, "radv_disable_trunc_coord");
219 
220    instance->drirc.disable_sinking_load_input_fs =
221       driQueryOptionb(&instance->drirc.options, "radv_disable_sinking_load_input_fs");
222 
223    instance->drirc.flush_before_query_copy = driQueryOptionb(&instance->drirc.options, "radv_flush_before_query_copy");
224 
225    instance->drirc.enable_unified_heap_on_apu =
226       driQueryOptionb(&instance->drirc.options, "radv_enable_unified_heap_on_apu");
227 
228    instance->drirc.tex_non_uniform = driQueryOptionb(&instance->drirc.options, "radv_tex_non_uniform");
229 
230    instance->drirc.ssbo_non_uniform = driQueryOptionb(&instance->drirc.options, "radv_ssbo_non_uniform");
231 
232    instance->drirc.app_layer = driQueryOptionstr(&instance->drirc.options, "radv_app_layer");
233 
234    instance->drirc.flush_before_timestamp_write =
235       driQueryOptionb(&instance->drirc.options, "radv_flush_before_timestamp_write");
236 
237    instance->drirc.force_rt_wave64 = driQueryOptionb(&instance->drirc.options, "radv_rt_wave64");
238 
239    instance->drirc.dual_color_blend_by_location =
240       driQueryOptionb(&instance->drirc.options, "dual_color_blend_by_location");
241 
242    instance->drirc.legacy_sparse_binding = driQueryOptionb(&instance->drirc.options, "radv_legacy_sparse_binding");
243 
244    instance->drirc.override_graphics_shader_version =
245       driQueryOptioni(&instance->drirc.options, "radv_override_graphics_shader_version");
246    instance->drirc.override_compute_shader_version =
247       driQueryOptioni(&instance->drirc.options, "radv_override_compute_shader_version");
248    instance->drirc.override_ray_tracing_shader_version =
249       driQueryOptioni(&instance->drirc.options, "radv_override_ray_tracing_shader_version");
250 
251    instance->drirc.enable_dgc = driQueryOptionb(&instance->drirc.options, "radv_dgc");
252 
253    instance->drirc.override_vram_size = driQueryOptioni(&instance->drirc.options, "override_vram_size");
254 
255    instance->drirc.enable_khr_present_wait = driQueryOptionb(&instance->drirc.options, "vk_khr_present_wait");
256 
257    instance->drirc.override_uniform_offset_alignment =
258       driQueryOptioni(&instance->drirc.options, "radv_override_uniform_offset_alignment");
259 
260    instance->drirc.report_llvm9_version_string =
261       driQueryOptionb(&instance->drirc.options, "radv_report_llvm9_version_string");
262 
263    instance->drirc.vk_require_etc2 = driQueryOptionb(&instance->drirc.options, "vk_require_etc2");
264    instance->drirc.vk_require_astc = driQueryOptionb(&instance->drirc.options, "vk_require_astc");
265 
266    instance->drirc.force_active_accel_struct_leaves =
267       driQueryOptionb(&instance->drirc.options, "radv_force_active_accel_struct_leaves");
268 }
269 
270 static const struct vk_instance_extension_table radv_instance_extensions_supported = {
271    .KHR_device_group_creation = true,
272    .KHR_external_fence_capabilities = true,
273    .KHR_external_memory_capabilities = true,
274    .KHR_external_semaphore_capabilities = true,
275    .KHR_get_physical_device_properties2 = true,
276    .EXT_debug_report = true,
277    .EXT_debug_utils = true,
278 
279 #ifdef RADV_USE_WSI_PLATFORM
280    .KHR_get_surface_capabilities2 = true,
281    .KHR_surface = true,
282    .KHR_surface_protected_capabilities = true,
283    .EXT_surface_maintenance1 = true,
284    .EXT_swapchain_colorspace = true,
285 #endif
286 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
287    .KHR_wayland_surface = true,
288 #endif
289 #ifdef VK_USE_PLATFORM_XCB_KHR
290    .KHR_xcb_surface = true,
291 #endif
292 #ifdef VK_USE_PLATFORM_XLIB_KHR
293    .KHR_xlib_surface = true,
294 #endif
295 #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
296    .EXT_acquire_xlib_display = true,
297 #endif
298 #ifdef VK_USE_PLATFORM_DISPLAY_KHR
299    .KHR_display = true,
300    .KHR_get_display_properties2 = true,
301    .EXT_direct_mode_display = true,
302    .EXT_display_surface_counter = true,
303    .EXT_acquire_drm_display = true,
304 #endif
305 #ifndef VK_USE_PLATFORM_WIN32_KHR
306    .EXT_headless_surface = true,
307 #endif
308 };
309 
310 static void
radv_handle_legacy_sqtt_trigger(struct vk_instance * instance)311 radv_handle_legacy_sqtt_trigger(struct vk_instance *instance)
312 {
313    char *trigger_file = secure_getenv("RADV_THREAD_TRACE_TRIGGER");
314    if (trigger_file) {
315       instance->trace_trigger_file = trigger_file;
316       instance->trace_mode |= RADV_TRACE_MODE_RGP;
317       fprintf(stderr, "WARNING: RADV_THREAD_TRACE_TRIGGER is deprecated, please use MESA_VK_TRACE_TRIGGER instead.\n");
318    }
319 }
320 
321 VKAPI_ATTR VkResult VKAPI_CALL
radv_CreateInstance(const VkInstanceCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkInstance * pInstance)322 radv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
323                     VkInstance *pInstance)
324 {
325    struct radv_instance *instance;
326    VkResult result;
327 
328    if (!pAllocator)
329       pAllocator = vk_default_allocator();
330 
331    instance = vk_zalloc(pAllocator, sizeof(*instance), 8, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
332    if (!instance)
333       return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
334 
335    struct vk_instance_dispatch_table dispatch_table;
336    vk_instance_dispatch_table_from_entrypoints(&dispatch_table, &radv_instance_entrypoints, true);
337    vk_instance_dispatch_table_from_entrypoints(&dispatch_table, &wsi_instance_entrypoints, false);
338 
339    result =
340       vk_instance_init(&instance->vk, &radv_instance_extensions_supported, &dispatch_table, pCreateInfo, pAllocator);
341    if (result != VK_SUCCESS) {
342       vk_free(pAllocator, instance);
343       return vk_error(NULL, result);
344    }
345 
346    vk_instance_add_driver_trace_modes(&instance->vk, trace_options);
347    radv_handle_legacy_sqtt_trigger(&instance->vk);
348 
349    instance->debug_flags = parse_debug_string(getenv("RADV_DEBUG"), radv_debug_options);
350    instance->perftest_flags = parse_debug_string(getenv("RADV_PERFTEST"), radv_perftest_options);
351 
352    /* When RADV_FORCE_FAMILY is set, the driver creates a null
353     * device that allows to test the compiler without having an
354     * AMDGPU instance.
355     */
356    if (getenv("RADV_FORCE_FAMILY"))
357       instance->vk.physical_devices.enumerate = create_null_physical_device;
358    else
359       instance->vk.physical_devices.try_create_for_drm = create_drm_physical_device;
360 
361    instance->vk.physical_devices.destroy = radv_physical_device_destroy;
362 
363    if (instance->debug_flags & RADV_DEBUG_STARTUP)
364       fprintf(stderr, "radv: info: Created an instance.\n");
365 
366    VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
367 
368    radv_init_dri_options(instance);
369 
370    *pInstance = radv_instance_to_handle(instance);
371 
372    return VK_SUCCESS;
373 }
374 
375 VKAPI_ATTR void VKAPI_CALL
radv_DestroyInstance(VkInstance _instance,const VkAllocationCallbacks * pAllocator)376 radv_DestroyInstance(VkInstance _instance, const VkAllocationCallbacks *pAllocator)
377 {
378    RADV_FROM_HANDLE(radv_instance, instance, _instance);
379 
380    if (!instance)
381       return;
382 
383    VG(VALGRIND_DESTROY_MEMPOOL(instance));
384 
385    driDestroyOptionCache(&instance->drirc.options);
386    driDestroyOptionInfo(&instance->drirc.available_options);
387 
388    vk_instance_finish(&instance->vk);
389    vk_free(&instance->vk.alloc, instance);
390 }
391 
392 VKAPI_ATTR VkResult VKAPI_CALL
radv_EnumerateInstanceExtensionProperties(const char * pLayerName,uint32_t * pPropertyCount,VkExtensionProperties * pProperties)393 radv_EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount,
394                                           VkExtensionProperties *pProperties)
395 {
396    if (pLayerName)
397       return vk_error(NULL, VK_ERROR_LAYER_NOT_PRESENT);
398 
399    return vk_enumerate_instance_extension_properties(&radv_instance_extensions_supported, pPropertyCount, pProperties);
400 }
401 
402 VKAPI_ATTR VkResult VKAPI_CALL
radv_EnumerateInstanceVersion(uint32_t * pApiVersion)403 radv_EnumerateInstanceVersion(uint32_t *pApiVersion)
404 {
405    *pApiVersion = RADV_API_VERSION;
406    return VK_SUCCESS;
407 }
408 
409 VKAPI_ATTR VkResult VKAPI_CALL
radv_EnumerateInstanceLayerProperties(uint32_t * pPropertyCount,VkLayerProperties * pProperties)410 radv_EnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties)
411 {
412    if (pProperties == NULL) {
413       *pPropertyCount = 0;
414       return VK_SUCCESS;
415    }
416 
417    /* None supported at this time */
418    return vk_error(NULL, VK_ERROR_LAYER_NOT_PRESENT);
419 }
420 
421 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
radv_GetInstanceProcAddr(VkInstance _instance,const char * pName)422 radv_GetInstanceProcAddr(VkInstance _instance, const char *pName)
423 {
424    RADV_FROM_HANDLE(vk_instance, instance, _instance);
425    return vk_instance_get_proc_addr(instance, &radv_instance_entrypoints, pName);
426 }
427 
428 /* Windows will use a dll definition file to avoid build errors. */
429 #ifdef _WIN32
430 #undef PUBLIC
431 #define PUBLIC
432 #endif
433 
434 /* The loader wants us to expose a second GetInstanceProcAddr function
435  * to work around certain LD_PRELOAD issues seen in apps.
436  */
437 PUBLIC
438 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
vk_icdGetInstanceProcAddr(VkInstance instance,const char * pName)439 vk_icdGetInstanceProcAddr(VkInstance instance, const char *pName)
440 {
441    return radv_GetInstanceProcAddr(instance, pName);
442 }
443