Fix ordering regression for VK_INSTANCE_LAYERS
authorCharles Giessen <charles@lunarg.com>
Fri, 31 Mar 2023 23:26:07 +0000 (17:26 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Thu, 6 Apr 2023 05:42:21 +0000 (23:42 -0600)
commit50df6bc578c851ddc7ec1f3b9f631918a4071b03
tree28dddfea2f83ad3e2e108c16ce6adbd4deb200c3
parentc3eb97de22e9e2eec061be897dcf13f2c0759788
Fix ordering regression for VK_INSTANCE_LAYERS

The commit to add VK_LOADER_LAYERS_ENABLE/DISABLE inadvertently broke the
ordering guarantees of VK_INSTANCE_LAYERS. This commit restores that order.
If both VK_INSTANCE_LAYERS and VK_LOADER_LAYERS_ENABLE add layers, the order
will be VK_INSTANCE_LAYERS enabled layers, in the order specified by the
env-var, followed by any layers enabled by VK_LOADER_LAYERS_ENABLED enabled in
the order they are found on the system.

In addition to this, the test framework receieved two changes:
* Make env-var folders report their contents in a deterministic order (aka the
order the items were added to the framework). This mirrors existing behavior
for redirected folders.
* Make platform shim resilient to shutdown ordering issues. Namely, set a flag
during shutdown so that any interception functions go straight to the real
version of the functoin. This works around an issue during the destruction of
the FolderManagers for the environment variables, where the readdir shim
function was trying to use the FolderManager's data but Address Sanitizer
declared that such a use was 'heap use after free'.
* Rename set_path to set_fake_path to better indicate its purpose
loader/loader.c
loader/loader_environment.c
loader/loader_environment.h
tests/framework/shim/shim.h
tests/framework/shim/shim_common.cpp
tests/framework/shim/unix_shim.cpp
tests/framework/test_environment.cpp
tests/framework/test_environment.h
tests/loader_layer_tests.cpp
tests/loader_regression_tests.cpp