Skip to content

Commit 5ac16bd

Browse files
authored
Merge branch 'master' into cache_vk_devices
2 parents 0e48251 + c8d189b commit 5ac16bd

33 files changed

+342
-194
lines changed

.github/actions/common-setup/action.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,13 @@ runs:
2525
2626
- name: Set up MSVC dev tools on Windows
2727
uses: ilammy/msvc-dev-cmd@v1
28-
with:
29-
sdk: "10.0.19041.0"
3028

3129
- name: Install dependencies (Linux only)
30+
if: inputs.os == 'linux'
3231
shell: bash
3332
run: |
34-
if [[ "${{ inputs.os }}" == "linux" ]]; then
35-
sudo apt-get update
36-
sudo apt-get install -y libx11-dev
37-
fi
33+
sudo apt-get update
34+
sudo apt-get install -y libx11-dev
3835
3936
- name: Setup Node.js (Linux only)
4037
if: inputs.os == 'linux'

.github/workflows/ci.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,21 @@ jobs:
228228
echo "Linux Release x64: ${{ needs.test-linux-release-gcc-x86_64.result }}"
229229
echo "Linux Debug x64: ${{ needs.test-linux-debug-gcc-x86_64.result }}"
230230
231-
# Check if all required jobs succeeded
232-
if [[ "${{ needs.test-windows-release-cl-x86_64-gpu.result }}" != "success" ]] || \
233-
[[ "${{ needs.test-windows-debug-cl-x86_64-gpu.result }}" != "success" ]] || \
234-
[[ "${{ needs.test-macos-release-clang-aarch64.result }}" != "success" ]] || \
235-
[[ "${{ needs.test-macos-debug-clang-aarch64.result }}" != "success" ]] || \
236-
[[ "${{ needs.test-linux-release-gcc-x86_64.result }}" != "success" ]] || \
237-
[[ "${{ needs.test-linux-debug-gcc-x86_64.result }}" != "success" ]]; then
231+
# Check if any required jobs failed (allow success or skipped)
232+
if [[ "${{ needs.test-windows-release-cl-x86_64-gpu.result }}" == "failure" ]] || \
233+
[[ "${{ needs.test-windows-debug-cl-x86_64-gpu.result }}" == "failure" ]] || \
234+
[[ "${{ needs.test-macos-release-clang-aarch64.result }}" == "failure" ]] || \
235+
[[ "${{ needs.test-macos-debug-clang-aarch64.result }}" == "failure" ]] || \
236+
[[ "${{ needs.test-linux-release-gcc-x86_64.result }}" == "failure" ]] || \
237+
[[ "${{ needs.test-linux-debug-gcc-x86_64.result }}" == "failure" ]] || \
238+
[[ "${{ needs.test-windows-release-cl-x86_64-gpu.result }}" == "cancelled" ]] || \
239+
[[ "${{ needs.test-windows-debug-cl-x86_64-gpu.result }}" == "cancelled" ]] || \
240+
[[ "${{ needs.test-macos-release-clang-aarch64.result }}" == "cancelled" ]] || \
241+
[[ "${{ needs.test-macos-debug-clang-aarch64.result }}" == "cancelled" ]] || \
242+
[[ "${{ needs.test-linux-release-gcc-x86_64.result }}" == "cancelled" ]] || \
243+
[[ "${{ needs.test-linux-debug-gcc-x86_64.result }}" == "cancelled" ]]; then
238244
echo "❌ One or more CI jobs failed or were cancelled"
239245
exit 1
240246
fi
241247
242-
echo "✅ All CI jobs passed successfully!"
248+
echo "✅ All CI jobs completed successfully (passed or skipped)!"

.github/workflows/release.yml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ jobs:
3838
compiler: gcc,
3939
build-slang-llvm: false,
4040
}
41-
- { os: windows, runs-on: windows-latest, compiler: cl }
41+
- {
42+
os: windows,
43+
runs-on: ["Windows", "self-hosted", "GCP-T4"],
44+
compiler: cl,
45+
}
4246
- { os: macos, runs-on: macos-latest, compiler: clang }
4347

4448
- { build-slang-llvm: false }
@@ -58,12 +62,7 @@ jobs:
5862
with:
5963
submodules: "recursive"
6064
fetch-depth: "0"
61-
- name: Install dependencies
62-
run: |
63-
if [[ "${{ matrix.os }}" == "linux" ]]; then
64-
sudo apt-get update
65-
sudo apt-get install -y libx11-dev
66-
fi
65+
6766
- name: Setup
6867
uses: ./.github/actions/common-setup
6968
with:
@@ -79,25 +78,6 @@ jobs:
7978
mkdir build-platform-generators
8079
cmake --install build --config Release --component generators --prefix build-platform-generators
8180
82-
- name: Change dev tools to host arch (windows)
83-
uses: ilammy/msvc-dev-cmd@v1
84-
with:
85-
arch: ${{matrix.platform == 'aarch64' && 'amd64_arm64' || 'amd64'}}
86-
sdk: "10.0.19041.0"
87-
88-
- name: Change dev tools to host arch (linux and macos)
89-
run: |
90-
if [[ "${{matrix.os}}" == linux* && "${{matrix.platform}}" == "aarch64" && "$(uname -m)" != "aarch64" ]]; then
91-
export CC=aarch64-linux-gnu-gcc
92-
export CXX=aarch64-linux-gnu-g++
93-
fi
94-
CMAKE_OSX_ARCHITECTURES="${{matrix.platform}}"
95-
CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES//aarch64/arm64}
96-
97-
echo "CC=$CC" >> "$GITHUB_ENV"
98-
echo "CXX=$CXX" >> "$GITHUB_ENV"
99-
echo "CMAKE_OSX_ARCHITECTURES=$CMAKE_OSX_ARCHITECTURES" >> "$GITHUB_ENV"
100-
10181
- name: Build Slang
10282
run: |
10383
if [[ "${{ matrix.platform }}" == "wasm" ]]; then

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,16 @@ advanced_option(
185185
"Build using system glslang library"
186186
OFF
187187
)
188+
if(WIN32)
189+
set(SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC_DEFAULT ON)
190+
else()
191+
set(SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC_DEFAULT OFF)
192+
endif()
193+
188194
advanced_option(
189195
SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC
190196
"Enable mimalloc for SPIRV-Tools to improve compilation performance"
191-
OFF
197+
${SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC_DEFAULT}
192198
)
193199

194200
option(

external/CMakeLists.txt

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ if(NOT SLANG_ENABLE_EXTERNAL_COMPILER_WARNINGS)
2525
endif()
2626
endif()
2727

28-
# Option to enable mimalloc for SPIRV-Tools to improve compilation performance
29-
if(WIN32)
30-
option(
31-
SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC
32-
"Enable mimalloc for SPIRV-Tools to improve compilation performance"
33-
ON
34-
)
35-
endif()
36-
3728
# Unordered dense
3829
if(NOT ${SLANG_USE_SYSTEM_UNORDERED_DENSE})
3930
if(NOT SLANG_OVERRIDE_UNORDERED_DENSE_PATH)
@@ -114,6 +105,8 @@ target_include_directories(
114105
)
115106

116107
# SPIRV-Headers
108+
# Avoid using ${system} intentionally in `add_subdirectory`, because if we do, it will end up using
109+
# spirv.h installed in the system directory on MacOS.
117110
if(NOT TARGET SPIRV-Headers)
118111
if(SLANG_USE_SYSTEM_SPIRV_HEADERS)
119112
if(SLANG_OVERRIDE_SPIRV_HEADERS_PATH)
@@ -127,10 +120,9 @@ if(NOT TARGET SPIRV-Headers)
127120
${SLANG_OVERRIDE_SPIRV_HEADERS_PATH}/spirv-headers
128121
spirv-headers
129122
EXCLUDE_FROM_ALL
130-
${system}
131123
)
132124
else()
133-
add_subdirectory(spirv-headers EXCLUDE_FROM_ALL ${system})
125+
add_subdirectory(spirv-headers EXCLUDE_FROM_ALL)
134126
endif()
135127
endif()
136128

@@ -214,13 +206,12 @@ if(SLANG_ENABLE_SLANG_GLSLANG)
214206

215207
# Tools
216208
if(NOT SLANG_OVERRIDE_SPIRV_TOOLS_PATH)
217-
add_subdirectory(spirv-tools EXCLUDE_FROM_ALL ${system})
209+
add_subdirectory(spirv-tools EXCLUDE_FROM_ALL)
218210
else()
219211
add_subdirectory(
220212
${SLANG_OVERRIDE_SPIRV_TOOLS_PATH}/spirv-tools
221213
spirv-tools
222214
EXCLUDE_FROM_ALL
223-
${system}
224215
)
225216
endif()
226217
endif()

external/unordered_dense

Submodule unordered_dense updated 4576 files

source/core/slang-platform.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#endif
2121

2222
#if SLANG_LINUX_FAMILY
23+
#include <limits.h>
2324
#include <unistd.h>
2425
#endif
2526

@@ -128,19 +129,24 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY);
128129
}
129130

130131
// We try to search the DLL in two different attempts.
131-
// First attempt tries on the directories explicitly specified with AddDllDirectory(),
132-
// If it failed to find one, we will search over all PATH.
133-
// Windows API made two approaches mutually exclusive and we need to try two times.
132+
// First attempt - LoadLibraryExW()
133+
// If it failed to find one, we will use LoadLibraryW() to search over all PATH.
134+
// Search order: 1) The directory that contains the DLL (LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR).
135+
// This directory is searched only for dependencies of the DLL being loaded.
136+
// 2) Application directory
137+
// 3) User directories (AddDllDirectory/SetDllDirectory)
138+
// 4) System32
139+
// 5) PATH environment variable (by the 2nd attempt with LoadLibraryW())
134140
// https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw
135-
String platformFileNameStr(platformFileName);
136-
HMODULE h =
137-
LoadLibraryExW(platformFileNameStr.toWString(), nullptr, LOAD_LIBRARY_SEARCH_USER_DIRS);
138-
// If LoadLibraryExW failed, try again with LoadLibraryW.
139141
// https://docs.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-loadlibraryw
140-
if (!h)
141-
h = LoadLibraryW(platformFileNameStr.toWString());
142+
String platformFileNameStr(platformFileName);
143+
OSString wideFileName = platformFileNameStr.toWString();
144+
HMODULE handle = LoadLibraryExW(wideFileName, nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
145+
146+
if (!handle)
147+
handle = LoadLibraryW(wideFileName);
142148
// If still not found, return an error.
143-
if (!h)
149+
if (!handle)
144150
{
145151
const DWORD lastError = GetLastError();
146152
switch (lastError)
@@ -163,7 +169,7 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY);
163169
// Turn to Result, if not one of the well known errors
164170
return HRESULT_FROM_WIN32(lastError);
165171
}
166-
handleOut = (Handle)h;
172+
handleOut = (Handle)handle;
167173
return SLANG_OK;
168174
}
169175

source/slang-wasm/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ if(EMSCRIPTEN)
2424
# To generate binding code
2525
target_link_options(
2626
slang-wasm
27-
PUBLIC "--bind" "--emit-tsd" "interface.d.ts" "-s" "EXPORT_ES6=1"
27+
PUBLIC
28+
"--bind"
29+
"--emit-tsd" "interface.d.ts"
30+
"-sEXPORT_ES6=1"
31+
"-sMODULARIZE=1"
32+
"-sEXPORTED_RUNTIME_METHODS=['FS']"
2833
)
2934
endif()

source/slang/core.meta.slang

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,18 +1278,16 @@ struct __none_t
12781278
{
12791279
};
12801280

1281-
// @hidden: this type is a BaseType since we want it to work with
1282-
// `registerBuiltinDecl`
1283-
__builtin_type($((int)BaseType::AddressSpace))
1281+
/// @category misc_types
1282+
__magic_enum(AddressSpace)
12841283
enum AddressSpace : uint64_t
12851284
{
12861285
Device = $((uint64_t)AddressSpace::UserPointer),
12871286
GroupShared = $((uint64_t)AddressSpace::GroupShared),
12881287
};
12891288

1290-
// @hidden: this type is a BaseType since we want it to work with
1291-
// `registerBuiltinDecl`
1292-
__builtin_type($((int)BaseType::MemoryScope))
1289+
/// @category misc_types
1290+
__magic_enum(MemoryScope)
12931291
enum MemoryScope : int32_t
12941292
{
12951293
CrossDevice = $((int32_t)MemoryScope::CrossDevice),
@@ -1300,9 +1298,8 @@ enum MemoryScope : int32_t
13001298
QueueFamily = $((int32_t)MemoryScope::QueueFamily),
13011299
}
13021300

1303-
// @hidden: this type is a BaseType since we want it to work with
1304-
// `registerBuiltinDecl`
1305-
__builtin_type($((int)BaseType::AccessQualifier))
1301+
/// @category misc_types
1302+
__magic_enum(AccessQualifier)
13061303
enum Access : uint64_t
13071304
{
13081305
ReadWrite = $((uint64_t)AccessQualifier::ReadWrite),

source/slang/glsl.meta.slang

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,7 @@ public vector<T.Element,4> texture(Sampler1D<T> sampler, float p)
19141914
__generic<T:ITexelElement>
19151915
[ForceInline]
19161916
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
1917-
public vector<T.Element,4> texture(Sampler1D<T> sampler, float p, constexpr float bias)
1917+
public vector<T.Element,4> texture(Sampler1D<T> sampler, float p, float bias)
19181918
{
19191919
return __vectorReshape2<T.Element, 4>(sampler.SampleBias(p, bias));
19201920
}
@@ -1950,7 +1950,7 @@ public vector<T.Element,4> texture(_Texture<
19501950
0, // isShadow
19511951
1, // isCombined
19521952
format
1953-
> sampler, vector<float,Shape.dimensions+isArray> p, constexpr float bias)
1953+
> sampler, vector<float,Shape.dimensions+isArray> p, float bias)
19541954
{
19551955
return __vectorReshape2<T.Element,4>(sampler.SampleBias(p, bias));
19561956
}
@@ -3891,7 +3891,7 @@ public vector<T.Element,4> textureGatherOffset(_Texture<
38913891
0, // isShadow
38923892
1, // isCombined
38933893
format
3894-
> sampler, vector<float,2+isArray> p, constexpr vector<int,2> offset, int comp = 0)
3894+
> sampler, vector<float,2+isArray> p, vector<int,2> offset, int comp = 0)
38953895
{
38963896
switch (comp)
38973897
{
@@ -3915,11 +3915,12 @@ public vec4 textureGatherOffset(_Texture<
39153915
1, // isShadow
39163916
1, // isCombined
39173917
format
3918-
> sampler, vector<float,2+isArray> p, float refZ, constexpr vector<int,2> offset)
3918+
> sampler, vector<float,2+isArray> p, float refZ, vector<int,2> offset)
39193919
{
39203920
return sampler.GatherCmp(p, refZ, offset);
39213921
}
39223922

3923+
39233924
// -------------------
39243925
// textureGatherOffsets
39253926
// -------------------

0 commit comments

Comments
 (0)