d3d12/dozen: Use os_get_option_dup for passing to ID3D12SDKConfiguration_SetSDKVersion

consecutive calling to getenv or os_get_option is invalid usage, so convert to use os_get_option_dup instead

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Acked-by: Antonio Ospite <antonio.ospite@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38128>
This commit is contained in:
Yonggang Luo 2025-10-30 03:02:12 +08:00 committed by Marge Bot
parent eeb54aa92d
commit a8e8422170
2 changed files with 8 additions and 4 deletions

View file

@ -1421,11 +1421,13 @@ try_create_device_factory(util_dl_library *d3d12_mod)
/* It's possible there's a D3D12Core.dll next to the .exe, for development/testing purposes. If so, we'll be notified
* by environment variables what the relative path is and the version to use.
*/
const char *d3d12core_relative_path = getenv("D3D12_AGILITY_RELATIVE_PATH");
const char *d3d12core_sdk_version = getenv("D3D12_AGILITY_SDK_VERSION");
char *d3d12core_relative_path = os_get_option_dup("D3D12_AGILITY_RELATIVE_PATH");
char *d3d12core_sdk_version = os_get_option_dup("D3D12_AGILITY_SDK_VERSION");
if (d3d12core_relative_path && d3d12core_sdk_version) {
(void)sdk_config->SetSDKVersion(atoi(d3d12core_sdk_version), d3d12core_relative_path);
}
free(d3d12core_relative_path);
free(d3d12core_sdk_version);
sdk_config->Release();
}
#endif

View file

@ -315,11 +315,13 @@ try_create_device_factory(struct util_dl_library *d3d12_mod)
/* It's possible there's a D3D12Core.dll next to the .exe, for development/testing purposes. If so, we'll be notified
* by environment variables what the relative path is and the version to use.
*/
const char *d3d12core_relative_path = getenv("DZN_AGILITY_RELATIVE_PATH");
const char *d3d12core_sdk_version = getenv("DZN_AGILITY_SDK_VERSION");
char *d3d12core_relative_path = os_get_option_dup("DZN_AGILITY_RELATIVE_PATH");
char *d3d12core_sdk_version = os_get_option_dup("DZN_AGILITY_SDK_VERSION");
if (d3d12core_relative_path && d3d12core_sdk_version) {
ID3D12SDKConfiguration_SetSDKVersion(sdk_config, atoi(d3d12core_sdk_version), d3d12core_relative_path);
}
free(d3d12core_relative_path);
free(d3d12core_sdk_version);
ID3D12SDKConfiguration_Release(sdk_config);
}
#endif