mesa/src/compiler
Xinju Li 0319be8b02 nir: resolve functions: only resolve functions that are reachable from main
Use DFS traversal from main to resolve reachable functions. Avoid spurious
"unresolved reference" linker errors for dead helper functions.
It avoid reporting linking error for following shader test. The shader test used
to pass before merge_requests/31137:

[require]
GLSL >= 1.50

[vertex shader]
/* declared but not defined */
vec4 transform_color(vec3 color, float alpha);

/* calls transform_color — but this function is never called from main */
vec4 apply_transform(vec3 color, float alpha)
{
    return transform_color(color, alpha);
}

[vertex shader]
in vec4 piglit_vertex;

void main()
{
    /* apply_transform is never called here */
    gl_Position = piglit_vertex;
}

Signed-off-by: Xinju Li <xinju.li@broadcom.com>

use pass_flags to mark function as reachable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41065>
2026-04-28 23:35:17 +00:00
..
clc spirv,treewide: rework specialization constant 2026-04-22 06:57:55 +00:00
glsl nir: resolve functions: only resolve functions that are reachable from main 2026-04-28 23:35:17 +00:00
isaspec isaspec: Use %g format for float display to ensure round-trip fidelity 2026-03-04 22:42:27 +00:00
libcl libcl_vk: Add VkCopyMemoryIndirectCommandKHR 2026-02-13 20:53:47 +00:00
nir nir/opt_reassociate: fix exactness bug 2026-04-28 21:14:56 +00:00
rust nir: add nvidias shared memory non unform address shift 2026-02-11 03:41:23 +01:00
spirv spirv: add support for SPV_KHR_constant_data 2026-04-23 11:12:06 +00:00
builtin_types.py compiler: add float8 glsl types 2025-06-23 07:59:24 +00:00
builtin_types_c.py
builtin_types_h.py compiler: Generate files with newline at end 2025-06-24 14:01:04 +00:00
glsl_types.c compiler: Add FP8 types to GLSL type decoder 2025-12-19 00:09:53 +00:00
glsl_types.h spirv: Fix spec constant to handle Select for non-native floats 2026-03-04 22:04:45 +00:00
list.h nir: remove unused stuff from list.h 2025-07-31 20:23:04 +00:00
meson.build nir, glsl: Add support for softfloat32 2025-11-14 19:31:17 +00:00
shader_enums.c compiler: Add missing MESA_SHADER_KERNEL case for SPIR-V dump 2026-04-23 20:36:55 +00:00
shader_enums.h nir: add back color0/1 system values and VARYING_SLOT_PARAM_GEN_AMD 2026-04-15 18:12:07 +00:00
shader_info.h nir: Add tex sources for descriptor heaps 2026-03-30 06:51:22 +00:00