GPUDevice: Use suffixed shaderc libname

Avoids conflicts with other installations of shaderc, e.g. the Vulkan
SDK, which might be in the user's LD_LIBRARY_PATH.
This commit is contained in:
Stenzek 2024-09-13 23:05:01 +10:00
parent d28f0fa4e6
commit 350cf7ee32
No known key found for this signature in database
5 changed files with 14 additions and 7 deletions

View File

@ -41,7 +41,7 @@ declare -a MANUAL_LIBS=(
"libswresample.so.5" "libswresample.so.5"
"libdiscord-rpc.so" "libdiscord-rpc.so"
"libfreetype.so.6" "libfreetype.so.6"
"libshaderc_shared.so" "libshaderc_ds.so"
"libspirv-cross-c-shared.so.0" "libspirv-cross-c-shared.so.0"
) )

View File

@ -67,7 +67,7 @@ ZSTD=1.5.6
CPUINFO=7524ad504fdcfcf75a18a133da6abd75c5d48053 CPUINFO=7524ad504fdcfcf75a18a133da6abd75c5d48053
DISCORD_RPC=144f3a3f1209994d8d9e8a87964a989cb9911c1e DISCORD_RPC=144f3a3f1209994d8d9e8a87964a989cb9911c1e
LUNASVG=9af1ac7b90658a279b372add52d6f77a4ebb482c LUNASVG=9af1ac7b90658a279b372add52d6f77a4ebb482c
SHADERC=3a655d0f8d3c946efd690edea31e138d4efef417 SHADERC=3c12f7af773c547973138bee6d6ac70d91729479
SOUNDTOUCH=463ade388f3a51da078dc9ed062bf28e4ba29da7 SOUNDTOUCH=463ade388f3a51da078dc9ed062bf28e4ba29da7
SPIRV_CROSS=vulkan-sdk-1.3.290.0 SPIRV_CROSS=vulkan-sdk-1.3.290.0
@ -91,7 +91,7 @@ fd6f417fe9e3a071cf1424a5152d926a34c4a3c5070745470be6cf12a404ed79 $LIBBACKTRACE.
e1351218d270db49c3dddcba04fb2153b09731ea3fa6830e423f5952f44585be cpuinfo-$CPUINFO.tar.gz e1351218d270db49c3dddcba04fb2153b09731ea3fa6830e423f5952f44585be cpuinfo-$CPUINFO.tar.gz
3eea5ccce6670c126282f1ba4d32c19d486db49a1a5cbfb8d6f48774784d310c discord-rpc-$DISCORD_RPC.tar.gz 3eea5ccce6670c126282f1ba4d32c19d486db49a1a5cbfb8d6f48774784d310c discord-rpc-$DISCORD_RPC.tar.gz
3998b024b0d442614a9ee270e76e018bb37a17b8c6941212171731123cbbcac7 lunasvg-$LUNASVG.tar.gz 3998b024b0d442614a9ee270e76e018bb37a17b8c6941212171731123cbbcac7 lunasvg-$LUNASVG.tar.gz
93aa93c087aadd2d1e97db58399d5cc8aaca750fd5d9004520c7426a4eb1fa82 shaderc-$SHADERC.tar.gz 0663bf6dabbb86fc0e697a601ee0030af715c8c1fbfa6e2b2240bde332f479a0 shaderc-$SHADERC.tar.gz
fe45c2af99f6102d2704277d392c1c83b55180a70bfd17fb888cc84a54b70573 soundtouch-$SOUNDTOUCH.tar.gz fe45c2af99f6102d2704277d392c1c83b55180a70bfd17fb888cc84a54b70573 soundtouch-$SOUNDTOUCH.tar.gz
EOF EOF

View File

@ -48,7 +48,7 @@ QT=6.7.2
CPUINFO=7524ad504fdcfcf75a18a133da6abd75c5d48053 CPUINFO=7524ad504fdcfcf75a18a133da6abd75c5d48053
DISCORD_RPC=144f3a3f1209994d8d9e8a87964a989cb9911c1e DISCORD_RPC=144f3a3f1209994d8d9e8a87964a989cb9911c1e
LUNASVG=9af1ac7b90658a279b372add52d6f77a4ebb482c LUNASVG=9af1ac7b90658a279b372add52d6f77a4ebb482c
SHADERC=3a655d0f8d3c946efd690edea31e138d4efef417 SHADERC=3c12f7af773c547973138bee6d6ac70d91729479
SOUNDTOUCH=463ade388f3a51da078dc9ed062bf28e4ba29da7 SOUNDTOUCH=463ade388f3a51da078dc9ed062bf28e4ba29da7
SPIRV_CROSS=vulkan-sdk-1.3.290.0 SPIRV_CROSS=vulkan-sdk-1.3.290.0
@ -88,7 +88,7 @@ fb0d1286a35be3583fee34aeb5843c94719e07193bdf1d4d8b0dc14009caef01 qtsvg-everywhe
e1351218d270db49c3dddcba04fb2153b09731ea3fa6830e423f5952f44585be cpuinfo-$CPUINFO.tar.gz e1351218d270db49c3dddcba04fb2153b09731ea3fa6830e423f5952f44585be cpuinfo-$CPUINFO.tar.gz
3eea5ccce6670c126282f1ba4d32c19d486db49a1a5cbfb8d6f48774784d310c discord-rpc-$DISCORD_RPC.tar.gz 3eea5ccce6670c126282f1ba4d32c19d486db49a1a5cbfb8d6f48774784d310c discord-rpc-$DISCORD_RPC.tar.gz
3998b024b0d442614a9ee270e76e018bb37a17b8c6941212171731123cbbcac7 lunasvg-$LUNASVG.tar.gz 3998b024b0d442614a9ee270e76e018bb37a17b8c6941212171731123cbbcac7 lunasvg-$LUNASVG.tar.gz
93aa93c087aadd2d1e97db58399d5cc8aaca750fd5d9004520c7426a4eb1fa82 shaderc-$SHADERC.tar.gz 0663bf6dabbb86fc0e697a601ee0030af715c8c1fbfa6e2b2240bde332f479a0 shaderc-$SHADERC.tar.gz
fe45c2af99f6102d2704277d392c1c83b55180a70bfd17fb888cc84a54b70573 soundtouch-$SOUNDTOUCH.tar.gz fe45c2af99f6102d2704277d392c1c83b55180a70bfd17fb888cc84a54b70573 soundtouch-$SOUNDTOUCH.tar.gz
EOF EOF

View File

@ -14,7 +14,7 @@ build-options:
sources: sources:
- type: git - type: git
url: "https://github.com/stenzek/shaderc.git" url: "https://github.com/stenzek/shaderc.git"
commit: "3a655d0f8d3c946efd690edea31e138d4efef417" commit: "3c12f7af773c547973138bee6d6ac70d91729479"
cleanup: cleanup:
- /bin - /bin
- /include - /include

View File

@ -1210,6 +1210,13 @@ std::unique_ptr<GPUDevice> GPUDevice::CreateDeviceForAPI(RenderAPI api)
} }
} }
#ifndef _WIN32
// Use a duckstation-suffixed shaderc name to avoid conflicts and loading another shaderc, e.g. from the Vulkan SDK.
#define SHADERC_LIB_NAME "shaderc_ds"
#else
#define SHADERC_LIB_NAME "shaderc_shared"
#endif
#define SHADERC_FUNCTIONS(X) \ #define SHADERC_FUNCTIONS(X) \
X(shaderc_compiler_initialize) \ X(shaderc_compiler_initialize) \
X(shaderc_compiler_release) \ X(shaderc_compiler_release) \
@ -1285,7 +1292,7 @@ bool dyn_libs::OpenShaderc(Error* error)
if (s_shaderc_library.IsOpen()) if (s_shaderc_library.IsOpen())
return true; return true;
const std::string libname = DynamicLibrary::GetVersionedFilename("shaderc_shared"); const std::string libname = DynamicLibrary::GetVersionedFilename(SHADERC_LIB_NAME);
if (!s_shaderc_library.Open(libname.c_str(), error)) if (!s_shaderc_library.Open(libname.c_str(), error))
{ {
Error::AddPrefix(error, "Failed to load shaderc: "); Error::AddPrefix(error, "Failed to load shaderc: ");