Repository: KhronosGroup/Vulkan-Samples
Pull request #1304: Add slang support to the framework
Author: login: SaschaWillems
Created: 2025-03-16T18:10:08Z | Merged: 2025-03-24T15:44:25Z

## Description

This PR adds initial support to slang shaders to the framework, the same way our framework supports offline compiled glsl and hlsl shaders. 

* When running a sample one can select slang shaders using the shading language argument: `sample profiles --shading-language slang`
* If slang shaders are present for said sample, they are loaded (offline compiled SPIR-V)
* If slang shaders are present for samples, they're added to the project file
* Slang shaders are handled via CMake just like HLSL and GLSL shades
* This also means Slang shaders are off-line compiled similar to HLSL (requires an installation of slangc, e.g. from the LunarG SDK)
* Slang shaders are added via the CMakeLists.txt of a sample using `SHADER_FILES_SLANG`

**Note:** While slang supports mutltiple shaders in one entry point, adding that would be a big effort, and something we can tackle in another PR. So for this to work, samples still need to separate slang shaders just like we do for glsl and hlsl.

To make it easier to test, this PR adds slang shaders (almost carbon copy of hlsl, so there might be warnings) to the profiles sample.

Fixes #1234

## General Checklist:

Please ensure the following points are checked:

- [x] My code follows the [coding style](https://github.com/KhronosGroup/Vulkan-Samples/tree/main/CONTRIBUTING.adoc#Code-Style)
- [x] I have reviewed file [licenses](https://github.com/KhronosGroup/Vulkan-Samples/tree/main/CONTRIBUTING.adoc#Copyright-Notice-and-License-Template)
- [x] I have commented any added functions (in line with Doxygen)
- [x] I have commented any code that could be hard to understand
- [x] My changes do not add any new compiler warnings
- [x] My changes do not add any new validation layer errors or warnings
- [x] I have used existing framework/helper functions where possible
- [x] My changes do not add any regressions
- [x] I have tested every sample to ensure everything runs correctly
- [x] This PR describes the scope and expected impact of the changes I am making

 Note: The Samples CI runs a number of checks including:
 - [x] I have updated the header Copyright to reflect the current year (CI build will fail if Copyright is out of date)
 - [x] My changes build on Windows, Linux, macOS and Android. Otherwise I have [documented any exceptions](https://github.com/KhronosGroup/Vulkan-Samples/tree/main/CONTRIBUTING.adoc#General-Requirements)

 If this PR contains framework changes:
 - [x] I did a full batch run using the `batch` command line argument to make sure all samples still work properly

Linked issue #1234: Add support for slang shaders
With slang now in the hands of Khronos we should discuss if we want to add support for it along with glsl and hlsl. When we added hlsl support, we adjusted the build setup and framework in such a way that adding in another shading language is pretty straight-forward.

If we decide on doing this, I'd be willing to add support for slang to the framework ;)

Diff:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5cf5a0b56..d5836adefd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
-# Copyright (c) 2020-2024, Arm Limited and Contributors
-# Copyright (c) 2024, Mobica Limited
+# Copyright (c) 2020-2025, Arm Limited and Contributors
+# Copyright (c) 2024-2025, Mobica Limited
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -56,6 +56,20 @@ if(Vulkan_FOUND)
     else()
         message(STATUS "Couldn't find DirectX Shader Compiler executable, make sure it is present in Vulkan SDK or add it manually via Vulkan_dxc_EXECUTABLE cmake variable. HLSL shaders won't be compiled.")
     endif()
+    # slang compiler
+    if(NOT Vulkan_slang_exe_FOUND)
+        find_program(Vulkan_slang_EXECUTABLE
+                    NAMES slangc
+                    HINTS
+                    "$ENV{VULKAN_SDK}/Bin"
+                    "$ENV{VULKAN_SDK}/bin"
+                    )
+    endif()
+    if(Vulkan_slang_EXECUTABLE)
+        message(STATUS "Found slang Shader Compiler under ${Vulkan_slang_EXECUTABLE}")
+    else()
+        message(STATUS "Couldn't find slang Shader Compiler executable, make sure it is present in Vulkan SDK or add it manually via Vulkan_slang_EXECUTABLE cmake variable. Slang shaders won't be compiled.")
+    endif()
 endif()
 
 # globally add VKB_DEBUG for the debug build
diff --git a/app/plugins/shading_language_selection/shading_language_selection.cpp b/app/plugins/shading_language_selection/shading_language_selection.cpp
index c0b3ce7115..d7b63fa9b9 100644
--- a/app/plugins/shading_language_selection/shading_language_selection.cpp
+++ b/app/plugins/shading_language_selection/shading_language_selection.cpp
@@ -26,10 +26,10 @@ namespace plugins
 {
 ShadingLanguageSelection::ShadingLanguageSelection() :
     ShadingLanguageSelectionTags("Shading language selection",
-                                 "A collection of flags to select shader from different shading languages (glsl, hlsl)",
+                                 "A collection of flags to select shader from different shading languages (glsl, hlsl or slang)",
                                  {},
                                  {},
-                                 {{"shading-language", "Shading language to use (glsl or hlsl)"}})
+                                 {{"shading-language", "Shading language to use (glsl, hlsl or slang)"}})
 {
 }
 
@@ -55,9 +55,14 @@ bool ShadingLanguageSelection::handle_option(std::deque<std::string> &arguments)
 		}
 		else if (shading_language == "hlsl")
 		{
-			LOGI("Shading langauge selection: HLSL")
+			LOGI("Shading language selection: HLSL")
 			vkb::Application::set_shading_language(vkb::ShadingLanguage::HLSL);
 		}
+		else if (shading_language == "slang")
+		{
+			LOGI("Shading language selection: slang")
+			vkb::Application::set_shading_language(vkb::ShadingLanguage::SLANG);
+		}
 		else
 		{
 			LOGE("Invalid shading language selection, defaulting to glsl");
diff --git a/bldsys/cmake/sample_helper.cmake b/bldsys/cmake/sample_helper.cmake
index 2bd36e6d87..e12566e2d5 100644
--- a/bldsys/cmake/sample_helper.cmake
+++ b/bldsys/cmake/sample_helper.cmake
@@ -1,7 +1,7 @@
 #[[
- Copyright (c) 2019-2024, Arm Limited and Contributors
- Copyright (c) 2024, Mobica Limited
- Copyright (c) 2024, Sascha Willems
+ Copyright (c) 2019-2025, Arm Limited and Contributors
+ Copyright (c) 2024-2025, Mobica Limited
+ Copyright (c) 2024-2025, Sascha Willems
 
  SPDX-License-Identifier: Apache-2.0
 
@@ -24,7 +24,7 @@ set(SCRIPT_DIR ${CMAKE_CURRENT_LIST_DIR})
 function(add_sample)
     set(options)  
     set(oneValueArgs ID CATEGORY AUTHOR NAME DESCRIPTION DXC_ADDITIONAL_ARGUMENTS)
-    set(multiValueArgs FILES LIBS SHADER_FILES_GLSL SHADER_FILES_HLSL)
+    set(multiValueArgs FILES LIBS SHADER_FILES_GLSL SHADER_FILES_HLSL SHADER_FILES_SLANG)
 
     cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
 
@@ -45,13 +45,15 @@ function(add_sample)
             ${TARGET_SHADER_FILES_GLSL}
         SHADER_FILES_HLSL
             ${TARGET_SHADER_FILES_HLSL}
+        SHADER_FILES_SLANG
+            ${TARGET_SHADER_FILES_SLANG}
         DXC_ADDITIONAL_ARGUMENTS ${TARGET_DXC_ADDITIONAL_ARGUMENTS})
 endfunction()
 
 function(add_sample_with_tags)
     set(options)
     set(oneValueArgs ID CATEGORY AUTHOR NAME DESCRIPTION DXC_ADDITIONAL_ARGUMENTS)
-    set(multiValueArgs TAGS FILES LIBS SHADER_FILES_GLSL SHADER_FILES_HLSL)
+    set(multiValueArgs TAGS FILES LIBS SHADER_FILES_GLSL SHADER_FILES_HLSL SHADER_FILES_SLANG)
 
     cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
 
@@ -77,6 +79,11 @@ function(add_sample_with_tags)
         list(APPEND SHADERS_HLSL "${PROJECT_SOURCE_DIR}/shaders/${SHADER_FILE_HLSL}")
     endforeach()
 
+    # Add slang shader files for this sample
+    foreach(SHADER_FILE_SLANG ${TARGET_SHADER_FILES_SLANG})
+        list(APPEND SHADERS_SLANG "${PROJECT_SOURCE_DIR}/shaders/${SHADER_FILE_SLANG}")
+    endforeach()   
+
     add_project(
         TYPE "Sample"
         ID ${TARGET_ID}
@@ -94,6 +101,8 @@ function(add_sample_with_tags)
             ${SHADERS_GLSL}
         SHADERS_HLSL
             ${SHADERS_HLSL}
+        SHADERS_SLANG
+            ${SHADERS_SLANG}            
         DXC_ADDITIONAL_ARGUMENTS ${TARGET_DXC_ADDITIONAL_ARGUMENTS})
 
 endfunction()
@@ -125,7 +134,7 @@ endfunction()
 function(add_project)
     set(options)  
     set(oneValueArgs TYPE ID CATEGORY AUTHOR NAME DESCRIPTION DXC_ADDITIONAL_ARGUMENTS)
-    set(multiValueArgs TAGS FILES LIBS SHADERS_GLSL SHADERS_HLSL)
+    set(multiValueArgs TAGS FILES LIBS SHADERS_GLSL SHADERS_HLSL SHADERS_SLANG)
 
     cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
 
@@ -154,11 +163,14 @@ function(add_project)
         # Disable automatic compilation of HLSL shaders for MSVC
         set_source_files_properties(SOURCE ${SHADERS_HLSL} PROPERTIES VS_SETTINGS "ExcludedFromBuild=true")        
     endif()
+    if (TARGET_SHADERS_SLANG)
+        source_group("\\Shaders\\slang" FILES ${TARGET_SHADERS_SLANG})
+    endif()    
 
 if(${TARGET_TYPE} STREQUAL "Sample")
-    add_library(${PROJECT_NAME} OBJECT ${TARGET_FILES} ${SHADERS_GLSL} ${SHADERS_HLSL})
+    add_library(${PROJECT_NAME} OBJECT ${TARGET_FILES} ${SHADERS_GLSL} ${SHADERS_HLSL} ${SHADERS_SLANG})
 elseif(${TARGET_TYPE} STREQUAL "Test")
-    add_library(${PROJECT_NAME} STATIC ${TARGET_FILES} ${SHADERS_GLSL} ${SHADERS_HLSL})
+    add_library(${PROJECT_NAME} STATIC ${TARGET_FILES} ${SHADERS_GLSL} ${SHADERS_HLSL} ${SHADERS_SLANG})
 endif()
     set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
 
@@ -196,7 +208,8 @@ endif()
     if(VKB_DO_CLANG_TIDY)
         set_target_properties(${PROJECT_NAME} PROPERTIES CXX_CLANG_TIDY "${VKB_DO_CLANG_TIDY}")
     endif()
-
+   
+    # HLSL compilation via DXC
     if(Vulkan_dxc_EXECUTABLE AND DEFINED SHADERS_HLSL)
         foreach(SHADER_FILE_HLSL ${TARGET_SHADERS_HLSL})
             get_filename_component(HLSL_SPV_FILE ${SHADER_FILE_HLSL} NAME_WLE)
@@ -253,4 +266,38 @@ endif()
             set_property(TARGET ${bare_name}-${extension} PROPERTY FOLDER "HLSL_Shaders")
         endforeach()
     endif()
+
+    # Slang shader compilation
+    if(Vulkan_slang_EXECUTABLE AND DEFINED SHADERS_SLANG)
+        foreach(SHADER_FILE_SLANG ${TARGET_SHADERS_SLANG})
+            get_filename_component(SLANG_SPV_FILE ${SHADER_FILE_SLANG} NAME_WLE)
+            get_filename_component(bare_name ${SLANG_SPV_FILE} NAME_WLE)
+            get_filename_component(extension ${SLANG_SPV_FILE} LAST_EXT)
+            get_filename_component(directory ${SHADER_FILE_SLANG} DIRECTORY)
+            string(REGEX REPLACE "[.]+" "" extension ${extension})
+            set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/shader-slang-spv")
+            set(OUTPUT_FILE ${OUTPUT_DIR}/${bare_name}.${extension}.spv)
+            file(MAKE_DIRECTORY ${OUTPUT_DIR})
+
+            set(SLANG_PROFILE "spirv_1_4")
+            set(SLANG_ENTRY_POINT "main")
+            add_custom_command( PRE_BUILD
+                    OUTPUT ${OUTPUT_FILE}
+                    COMMAND ${Vulkan_slang_EXECUTABLE} ${SHADER_FILE_SLANG} -profile ${SLANG_PROFILE} -target spirv -o ${OUTPUT_FILE} -entry ${SLANG_ENTRY_POINT}
+                    COMMAND ${CMAKE_COMMAND} -E copy ${OUTPUT_FILE} ${directory}
+                    MAIN_DEPENDENCY ${SHADER_FILE_SLANG}
+                    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+            )
+            set(SLANG_SHADER_TARGET_NAME ${bare_name}-${extension}-slang)
+            if(NOT TARGET ${SLANG_SHADER_TARGET_NAME})
+                add_custom_target(${SLANG_SHADER_TARGET_NAME} DEPENDS ${OUTPUT_FILE})
+            endif()
+            add_dependencies(${PROJECT_NAME} ${SLANG_SHADER_TARGET_NAME})
+            set_source_files_properties(${OUTPUT_FILE} PROPERTIES
+                    MACOSX_PACKAGE_LOCATION Resources
+            )
+            set_property(TARGET ${SLANG_SHADER_TARGET_NAME} PROPERTY FOLDER "SLANG_Shaders")
+        endforeach()
+    endif()
+
 endfunction()
\ No newline at end of file
diff --git a/framework/api_vulkan_sample.cpp b/framework/api_vulkan_sample.cpp
index 1c092791f9..2afffb69ed 100644
--- a/framework/api_vulkan_sample.cpp
+++ b/framework/api_vulkan_sample.cpp
@@ -453,6 +453,13 @@ VkPipelineShaderStageCreateInfo ApiVulkanSample::load_shader(const std::string &
 		src_language     = vkb::ShaderSourceLanguage::SPV;
 		shader_extension = ".spv";
 	}
+	else if (get_shading_language() == vkb::ShadingLanguage::SLANG)
+	{
+		shader_folder = "slang";
+		// slang shaders are offline compiled to SPIR-V, so source is SPV
+		src_language     = vkb::ShaderSourceLanguage::SPV;
+		shader_extension = ".spv";
+	}
 
 	std::string full_file_name = sample_folder_name + "/" + shader_folder + "/" + shader_filename + shader_extension;
 
diff --git a/framework/common/vk_common.h b/framework/common/vk_common.h
index 16aca6aa58..5849a95a68 100644
--- a/framework/common/vk_common.h
+++ b/framework/common/vk_common.h
@@ -139,6 +139,7 @@ enum class ShadingLanguage
 {
 	GLSL,
 	HLSL,
+	SLANG,
 };
 
 /**
diff --git a/framework/hpp_api_vulkan_sample.cpp b/framework/hpp_api_vulkan_sample.cpp
index 0052444e00..e3e1df45d8 100644
--- a/framework/hpp_api_vulkan_sample.cpp
+++ b/framework/hpp_api_vulkan_sample.cpp
@@ -426,6 +426,13 @@ vk::PipelineShaderStageCreateInfo HPPApiVulkanSample::load_shader(const std::str
 		src_language     = vkb::ShaderSourceLanguage::SPV;
 		shader_extension = ".spv";
 	}
+	else if (get_shading_language() == vkb::ShadingLanguage::SLANG)
+	{
+		shader_folder = "slang";
+		// slang shaders are offline compiled to SPIR-V, so source is SPV
+		src_language     = vkb::ShaderSourceLanguage::SPV;
+		shader_extension = ".spv";
+	}
 
 	std::string full_file_name = sample_folder_name + "/" + shader_folder + "/" + shader_filename + shader_extension;
 
diff --git a/samples/tooling/profiles/CMakeLists.txt b/samples/tooling/profiles/CMakeLists.txt
index b2f233b21f..c0bcbba51c 100644
--- a/samples/tooling/profiles/CMakeLists.txt
+++ b/samples/tooling/profiles/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2022-2024, Sascha Willems
+# Copyright (c) 2022-2025, Sascha Willems
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -31,4 +31,7 @@ add_sample_with_tags(
     SHADER_FILES_HLSL
         "profiles/hlsl/profiles.vert.hlsl"
         "profiles/hlsl/profiles.frag.hlsl"
-    DXC_ADDITIONAL_ARGUMENTS "-fspv-extension=SPV_EXT_descriptor_indexing")
\ No newline at end of file
+    DXC_ADDITIONAL_ARGUMENTS "-fspv-extension=SPV_EXT_descriptor_indexing"
+    SHADER_FILES_SLANG
+        "profiles/slang/profiles.vert.slang"
+        "profiles/slang/profiles.frag.slang")
\ No newline at end of file
diff --git a/shaders/profiles/slang/profiles.frag.slang b/shaders/profiles/slang/profiles.frag.slang
new file mode 100644
index 0000000000..a43120569b
--- /dev/null
+++ b/shaders/profiles/slang/profiles.frag.slang
@@ -0,0 +1,32 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+[[vk::binding(1, 0)]]
+Sampler2D textures[] : register(t1, space0);
+
+struct VSOutput
+{
+    float4 Pos : SV_POSITION;
+    [[vk::location(0)]] float2 UV : TEXCOORD0;
+    [[vk::location(1)]] nointerpolation int TexIndex : TEXCOORD1;
+};
+
+[shader("fragment")]
+float4 main(VSOutput input) : SV_TARGET
+{
+    return textures[NonUniformResourceIndex(input.TexIndex)].Sample(input.UV);
+}
\ No newline at end of file
diff --git a/shaders/profiles/slang/profiles.vert.slang b/shaders/profiles/slang/profiles.vert.slang
new file mode 100644
index 0000000000..f918105474
--- /dev/null
+++ b/shaders/profiles/slang/profiles.vert.slang
@@ -0,0 +1,49 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+struct VSInput
+{
+    [[vk::location(0)]] float3 Pos : POSITION0;
+    [[vk::location(1)]] float2 UV : TEXCOORD0;
+    [[vk::location(2)]] int TexIndex : TEXCOORD1;
+};
+
+struct UBO
+{
+    float4x4 projection;
+    float4x4 view;
+};
+[[vk::binding(0, 0)]]
+ConstantBuffer<UBO> ubo : register(b0, space0);
+
+struct VSOutput
+{
+    float4 Pos : SV_POSITION;
+    [[vk::location(0)]] float2 UV : TEXCOORD0;
+    [[vk::location(1)]] nointerpolation int TexIndex : TEXCOORD1;
+};
+
+[shader("vertex")]
+VSOutput main(VSInput input)
+{
+    VSOutput output = (VSOutput) 0;
+    output.UV = input.UV;
+    output.TexIndex = input.TexIndex;
+    output.Pos = mul(ubo.projection, mul(ubo.view, float4(input.Pos.xyz, 1.0)));
+    return output;
+}
\ No newline at end of file


Reviews:
user: login: asuessenbach
body: Just some minor issues (besides the missing slang shaders, of course).
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-17T08:38:34Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-17T17:46:48Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:17:42Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:18:55Z
user: login: gpx1000
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:33:41Z
user: login: gpx1000
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:38:50Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:40:55Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:41:01Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:41:11Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:41:17Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:41:43Z
user: login: SaschaWillems
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-18T21:42:25Z
user: login: asuessenbach
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-19T08:38:50Z
user: login: asuessenbach
body: By the way: why have all those `*.spv` files changed?
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-03-19T08:41:34Z
user: login: asuessenbach
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-20T07:45:18Z
user: login: gary-sweet
body: Doesn't seem to cause any issues for me, though I don't have a slang compiler.
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-21T09:38:51Z

Review comments:
diff_hunk: @@ -1,4 +1,4 @@
-# Copyright (c) 2019-2024, Arm Limited and Contributors
+# Copyright (c) 2019-2025, Arm Limited and Contributors
path: app/CMakeLists.txt
user: login: asuessenbach
body: Changed nothing but the copyright here?
created_at: 2025-03-17T08:08:00Z
author_association: CONTRIBUTOR
diff_hunk: @@ -154,11 +163,15 @@ function(add_project)
         # Disable automatic compilation of HLSL shaders for MSVC
         set_source_files_properties(SOURCE ${SHADERS_HLSL} PROPERTIES VS_SETTINGS "ExcludedFromBuild=true")        
     endif()
+    if (TARGET_SHADERS_SLANG)
+        message(STATUS ${TARGET_SHADERS_SLANG})
path: bldsys/cmake/sample_helper.cmake
user: login: asuessenbach
body: Is this message still important?
created_at: 2025-03-17T08:11:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -454,6 +454,14 @@ VkPipelineShaderStageCreateInfo ApiVulkanSample::load_shader(const std::string &
 		shader_extension = ".spv";
 	}
 
+	if (get_shading_language() == vkb::ShadingLanguage::SLANG)
path: framework/api_vulkan_sample.cpp
user: login: asuessenbach
body: Maybe make it an `else if`
created_at: 2025-03-17T08:13:00Z
author_association: CONTRIBUTOR
diff_hunk: @@ -454,6 +454,14 @@ VkPipelineShaderStageCreateInfo ApiVulkanSample::load_shader(const std::string &
 		shader_extension = ".spv";
 	}
 
+	if (get_shading_language() == vkb::ShadingLanguage::SLANG)
+	{
+		shader_folder = "slang";
+		// slang shaders are offline compiled to SPIR-V, so source is SPV
+		src_language     = vkb::ShaderSourceLanguage::SPV;
+		shader_extension = ".spv";
+	}
+
path: framework/api_vulkan_sample.cpp
user: login: asuessenbach
body: As part of those two cases are identical, maybe it's better to have something like
```
auto shading_language = get_shading_language();
if ((shading_language == vkb::ShadingLanguage::HSLS) || (shading_language == vkb::ShadingLanguage::SLANG))
{
    shader_folder = (shading_language == HLSL) ? "hlsl" : "slang";
    ...
}
```
created_at: 2025-03-17T08:17:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -427,6 +427,14 @@ vk::PipelineShaderStageCreateInfo HPPApiVulkanSample::load_shader(const std::str
 		shader_extension = ".spv";
 	}
 
+	if (get_shading_language() == vkb::ShadingLanguage::SLANG)
+	{
+		shader_folder = "slang";
+		// slang shaders are offline compiled to SPIR-V, so source is SPV
+		src_language     = vkb::ShaderSourceLanguage::SPV;
+		shader_extension = ".spv";
+	}
+
path: framework/hpp_api_vulkan_sample.cpp
user: login: asuessenbach
body: Same comment as in api_vulkan_sample.cpp.
created_at: 2025-03-17T08:19:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,4 +1,4 @@
-# Copyright (c) 2019-2024, Arm Limited and Contributors
+# Copyright (c) 2019-2025, Arm Limited and Contributors
path: app/CMakeLists.txt
user: login: SaschaWillems
body: Yeah, that was a desparate try to fix CI. Will revert.
created_at: 2025-03-17T17:46:48Z
author_association: COLLABORATOR
diff_hunk: @@ -454,6 +454,14 @@ VkPipelineShaderStageCreateInfo ApiVulkanSample::load_shader(const std::string &
 		shader_extension = ".spv";
 	}
 
+	if (get_shading_language() == vkb::ShadingLanguage::SLANG)
+	{
+		shader_folder = "slang";
+		// slang shaders are offline compiled to SPIR-V, so source is SPV
+		src_language     = vkb::ShaderSourceLanguage::SPV;
+		shader_extension = ".spv";
+	}
+
path: framework/api_vulkan_sample.cpp
user: login: SaschaWillems
body: I'd prefer to have them separate for better readability and future flexibility. I'll rework the if blocks though as you hinted above.
created_at: 2025-03-18T21:17:42Z
author_association: COLLABORATOR
diff_hunk: @@ -454,6 +454,14 @@ VkPipelineShaderStageCreateInfo ApiVulkanSample::load_shader(const std::string &
 		shader_extension = ".spv";
 	}
 
+	if (get_shading_language() == vkb::ShadingLanguage::SLANG)
path: framework/api_vulkan_sample.cpp
user: login: SaschaWillems
body: Good point. I'll rework that part.
created_at: 2025-03-18T21:18:55Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,32 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+[[vk::binding(1, 0)]]
path: shaders/profiles/slang/profiles.frag.slang
user: login: gpx1000
body: Being explicit with the binding is likely not needed.  This is one of the cool differences between SLang and HLSL.
created_at: 2025-03-18T21:31:12Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,32 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+[[vk::binding(1, 0)]]
+Sampler2D textures[] : register(t1, space0);
+
+struct VSOutput
+{
+    float4 Pos : SV_POSITION;
+    [[vk::location(0)]] float2 UV : TEXCOORD0;
+    [[vk::location(1)]] nointerpolation int TexIndex : TEXCOORD1;
path: shaders/profiles/slang/profiles.frag.slang
user: login: gpx1000
body: explicit location designation here is also likely not needed.
created_at: 2025-03-18T21:31:52Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,49 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+struct VSInput
+{
+    [[vk::location(0)]] float3 Pos : POSITION0;
+    [[vk::location(1)]] float2 UV : TEXCOORD0;
+    [[vk::location(2)]] int TexIndex : TEXCOORD1;
path: shaders/profiles/slang/profiles.vert.slang
user: login: gpx1000
body: You likely can replace this with:
struct VSInput {
float3 Pos;
flaot2 UV;
int TexIndex;
}
created_at: 2025-03-18T21:33:07Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,49 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+struct VSInput
+{
+    [[vk::location(0)]] float3 Pos : POSITION0;
+    [[vk::location(1)]] float2 UV : TEXCOORD0;
+    [[vk::location(2)]] int TexIndex : TEXCOORD1;
+};
+
+struct UBO
+{
+    float4x4 projection;
+    float4x4 view;
+};
+[[vk::binding(0, 0)]]
+ConstantBuffer<UBO> ubo : register(b0, space0);
path: shaders/profiles/slang/profiles.vert.slang
user: login: gpx1000
body: don't need either the binding nor the register.
created_at: 2025-03-18T21:33:28Z
author_association: COLLABORATOR
diff_hunk: @@ -253,4 +266,38 @@ endif()
             set_property(TARGET ${bare_name}-${extension} PROPERTY FOLDER "HLSL_Shaders")
         endforeach()
     endif()
+
+    # Slang shader compilation
+    if(Vulkan_slang_EXECUTABLE AND DEFINED SHADERS_SLANG)
+        foreach(SHADER_FILE_SLANG ${TARGET_SHADERS_SLANG})
+            get_filename_component(SLANG_SPV_FILE ${SHADER_FILE_SLANG} NAME_WLE)
+            get_filename_component(bare_name ${SLANG_SPV_FILE} NAME_WLE)
+            get_filename_component(extension ${SLANG_SPV_FILE} LAST_EXT)
+            get_filename_component(directory ${SHADER_FILE_SLANG} DIRECTORY)
+            string(REGEX REPLACE "[.]+" "" extension ${extension})
+            set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/shader-slang-spv")
+            set(OUTPUT_FILE ${OUTPUT_DIR}/${bare_name}.${extension}.spv)
+            file(MAKE_DIRECTORY ${OUTPUT_DIR})
+
+            set(SLANG_PROFILE "glsl_460")
path: bldsys/cmake/sample_helper.cmake
user: login: gpx1000
body: Why limit to glsl?  Can just emit directly with spirv_1_4
created_at: 2025-03-18T21:36:12Z
author_association: COLLABORATOR
diff_hunk: @@ -253,4 +266,38 @@ endif()
             set_property(TARGET ${bare_name}-${extension} PROPERTY FOLDER "HLSL_Shaders")
         endforeach()
     endif()
+
+    # Slang shader compilation
+    if(Vulkan_slang_EXECUTABLE AND DEFINED SHADERS_SLANG)
+        foreach(SHADER_FILE_SLANG ${TARGET_SHADERS_SLANG})
+            get_filename_component(SLANG_SPV_FILE ${SHADER_FILE_SLANG} NAME_WLE)
+            get_filename_component(bare_name ${SLANG_SPV_FILE} NAME_WLE)
+            get_filename_component(extension ${SLANG_SPV_FILE} LAST_EXT)
+            get_filename_component(directory ${SHADER_FILE_SLANG} DIRECTORY)
+            string(REGEX REPLACE "[.]+" "" extension ${extension})
+            set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/shader-slang-spv")
+            set(OUTPUT_FILE ${OUTPUT_DIR}/${bare_name}.${extension}.spv)
+            file(MAKE_DIRECTORY ${OUTPUT_DIR})
+
+            set(SLANG_PROFILE "glsl_460")
+            set(SLANG_ENTRY_POINT "main")
+            add_custom_command( PRE_BUILD
+                    OUTPUT ${OUTPUT_FILE}
+                    COMMAND ${Vulkan_slang_EXECUTABLE} ${SHADER_FILE_SLANG} -profile ${SLANG_PROFILE} -target spirv -o ${OUTPUT_FILE} -entry ${SLANG_ENTRY_POINT}
+                    COMMAND ${CMAKE_COMMAND} -E copy ${OUTPUT_FILE} ${directory}
path: bldsys/cmake/sample_helper.cmake
user: login: gpx1000
body: You can have multiple entries in one spirv file.  So, instead of having 1 vert shader and 1 frag shader file, you can join them into one slang file and give each an entry point.
This is beneficial especially for ray tracing:
slangc shaders.slang -target spirv -profile spirv_1_4 -emit-spirv-directly -fvk-use-entrypoint-name  -entry vertMain -entry fragMain -o slang.spv
is an example of how to achieve that.
created_at: 2025-03-18T21:38:46Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,32 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+[[vk::binding(1, 0)]]
path: shaders/profiles/slang/profiles.frag.slang
user: login: SaschaWillems
body: Yeah, as noted in the description I only added those shaders so people can actually test the PR. They're mostly carbon copies of the HLSL ones.
created_at: 2025-03-18T21:40:55Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,32 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+[[vk::binding(1, 0)]]
+Sampler2D textures[] : register(t1, space0);
+
+struct VSOutput
+{
+    float4 Pos : SV_POSITION;
+    [[vk::location(0)]] float2 UV : TEXCOORD0;
+    [[vk::location(1)]] nointerpolation int TexIndex : TEXCOORD1;
path: shaders/profiles/slang/profiles.frag.slang
user: login: SaschaWillems
body: See comment above.
created_at: 2025-03-18T21:41:01Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,49 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+struct VSInput
+{
+    [[vk::location(0)]] float3 Pos : POSITION0;
+    [[vk::location(1)]] float2 UV : TEXCOORD0;
+    [[vk::location(2)]] int TexIndex : TEXCOORD1;
path: shaders/profiles/slang/profiles.vert.slang
user: login: SaschaWillems
body: See comment above.
created_at: 2025-03-18T21:41:11Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,49 @@
+/* Copyright (c) 2025, Sascha Willems
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 the "License";
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+struct VSInput
+{
+    [[vk::location(0)]] float3 Pos : POSITION0;
+    [[vk::location(1)]] float2 UV : TEXCOORD0;
+    [[vk::location(2)]] int TexIndex : TEXCOORD1;
+};
+
+struct UBO
+{
+    float4x4 projection;
+    float4x4 view;
+};
+[[vk::binding(0, 0)]]
+ConstantBuffer<UBO> ubo : register(b0, space0);
path: shaders/profiles/slang/profiles.vert.slang
user: login: SaschaWillems
body: See comment above.
created_at: 2025-03-18T21:41:17Z
author_association: COLLABORATOR
diff_hunk: @@ -253,4 +266,38 @@ endif()
             set_property(TARGET ${bare_name}-${extension} PROPERTY FOLDER "HLSL_Shaders")
         endforeach()
     endif()
+
+    # Slang shader compilation
+    if(Vulkan_slang_EXECUTABLE AND DEFINED SHADERS_SLANG)
+        foreach(SHADER_FILE_SLANG ${TARGET_SHADERS_SLANG})
+            get_filename_component(SLANG_SPV_FILE ${SHADER_FILE_SLANG} NAME_WLE)
+            get_filename_component(bare_name ${SLANG_SPV_FILE} NAME_WLE)
+            get_filename_component(extension ${SLANG_SPV_FILE} LAST_EXT)
+            get_filename_component(directory ${SHADER_FILE_SLANG} DIRECTORY)
+            string(REGEX REPLACE "[.]+" "" extension ${extension})
+            set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/shader-slang-spv")
+            set(OUTPUT_FILE ${OUTPUT_DIR}/${bare_name}.${extension}.spv)
+            file(MAKE_DIRECTORY ${OUTPUT_DIR})
+
+            set(SLANG_PROFILE "glsl_460")
path: bldsys/cmake/sample_helper.cmake
user: login: SaschaWillems
body: Thx, will take a look at that. I took that from glslangs official documentation ;)
created_at: 2025-03-18T21:41:43Z
author_association: COLLABORATOR
diff_hunk: @@ -253,4 +266,38 @@ endif()
             set_property(TARGET ${bare_name}-${extension} PROPERTY FOLDER "HLSL_Shaders")
         endforeach()
     endif()
+
+    # Slang shader compilation
+    if(Vulkan_slang_EXECUTABLE AND DEFINED SHADERS_SLANG)
+        foreach(SHADER_FILE_SLANG ${TARGET_SHADERS_SLANG})
+            get_filename_component(SLANG_SPV_FILE ${SHADER_FILE_SLANG} NAME_WLE)
+            get_filename_component(bare_name ${SLANG_SPV_FILE} NAME_WLE)
+            get_filename_component(extension ${SLANG_SPV_FILE} LAST_EXT)
+            get_filename_component(directory ${SHADER_FILE_SLANG} DIRECTORY)
+            string(REGEX REPLACE "[.]+" "" extension ${extension})
+            set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/shader-slang-spv")
+            set(OUTPUT_FILE ${OUTPUT_DIR}/${bare_name}.${extension}.spv)
+            file(MAKE_DIRECTORY ${OUTPUT_DIR})
+
+            set(SLANG_PROFILE "glsl_460")
+            set(SLANG_ENTRY_POINT "main")
+            add_custom_command( PRE_BUILD
+                    OUTPUT ${OUTPUT_FILE}
+                    COMMAND ${Vulkan_slang_EXECUTABLE} ${SHADER_FILE_SLANG} -profile ${SLANG_PROFILE} -target spirv -o ${OUTPUT_FILE} -entry ${SLANG_ENTRY_POINT}
+                    COMMAND ${CMAKE_COMMAND} -E copy ${OUTPUT_FILE} ${directory}
path: bldsys/cmake/sample_helper.cmake
user: login: SaschaWillems
body: Yeah, I am aware of that (and use it in my own projects). But that would've required additional work to our build setup and framework, so I stuck with separate shader files.
created_at: 2025-03-18T21:42:25Z
author_association: COLLABORATOR
diff_hunk: @@ -454,6 +454,14 @@ VkPipelineShaderStageCreateInfo ApiVulkanSample::load_shader(const std::string &
 		shader_extension = ".spv";
 	}
 
+	if (get_shading_language() == vkb::ShadingLanguage::SLANG)
+	{
+		shader_folder = "slang";
+		// slang shaders are offline compiled to SPIR-V, so source is SPV
+		src_language     = vkb::ShaderSourceLanguage::SPV;
+		shader_extension = ".spv";
+	}
+
path: framework/api_vulkan_sample.cpp
user: login: asuessenbach
body: Regarding the better readability: I find it better readable, if there are no identical code sequences for the different cases. You (as a human) have to carefully scan the two code sequences, just to realize they actually are identical. In such a case, I would always ask if that's correct
created_at: 2025-03-19T08:38:50Z
author_association: CONTRIBUTOR

PR comments:
user: login: asuessenbach
created_at: 2025-03-17T08:53:09Z
body: ... and in the description, you probably meant to say `sample hello_triangle --shading-language slang` (Note the `--` in front of the `shading-language`)

And maybe more important here: none of the `hello_triangle` flavours care about the shading language, they just use GLSL.
author_association: CONTRIBUTOR
user: login: SaschaWillems
created_at: 2025-03-17T17:54:20Z
body: > ... and in the description, you probably meant to say `sample hello_triangle --shading-language slang` (Note the `--` in front of the `shading-language`)
> 
> And maybe more important here: none of the `hello_triangle` flavours care about the shading language, they just use GLSL.

Updated the description. Though it would be nice if at some point the hello triangle samples could also support different shading languages ;)

author_association: COLLABORATOR
user: login: SaschaWillems
created_at: 2025-03-17T18:52:23Z
body: Added offline compilation and added slang shaders to the profiles sample (almost carbon copies from hlsl, so there might be some slang warning).

So people can actually test this. 
author_association: COLLABORATOR
user: login: SRSaunders
created_at: 2025-03-17T19:51:56Z
body: The iOS build may be failing due to an updated Xcode dev environment on the CI machine.  I suspect this can be corrected by changing `-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0` to `-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0` (for Xcode 15.3 or 15.4 used in this case) or `-DCMAKE_OSX_DEPLOYMENT_TARGET=14.5` (for XCode 16.x).  I don't know how the CI setups match to Xcode versions, so I can't say absolutely.  This change would have to be made in the iOS CI build setup in build.yml.

Note this build is also exhibiting the same cmake 3.31 issue solved in #1296.  The iOS CI is likely using an updated dev environment vs. before.
author_association: CONTRIBUTOR
user: login: SaschaWillems
created_at: 2025-03-17T20:48:42Z
body: I don't quite understand. Another build just a few minutes ago worked?
author_association: COLLABORATOR
user: login: SRSaunders
created_at: 2025-03-17T23:20:52Z
body: > I don't quite understand. Another build just a few minutes ago worked?

@SaschaWillems you are correct, I saw the Xcode error 65 and jumped to conclusions - my bad.

The iOS CI build failure is actually caused by Vulkan not being found in the cache, and then falling back to downloading and installing **SDK 1.3.290** (as per the logic in build.yml):

![Screenshot 2025-03-17 at 7 48 36 PM](https://github.com/user-attachments/assets/3af9f235-8ec9-4a39-adff-ee03cd905f64)


The actual failure (which I can duplicate in my dev environment using **SDK 1.3.290**) is :

_The following build commands failed:
	PhaseScriptExecution Generate\ samples/tooling/profiles/shader-slang-spv/profiles.vert.spv /Users/steve/XcodeProjects/Vulkan-Samples/build/ios/build/vulkan_samples.build/Release-iphoneos/profiles-vert-slang.build/Script-3A321516860A670084B67032.sh (in target 'profiles-vert-slang' from project 'vulkan_samples')
(1 failure)_

To correct this, the fallback for iOS Vulkan installs should be brought up to date.  I tested with **SDK 1.4.304** and this works fine with the iOS build commands.  The **build.yml** file needs to be updated with a more modern Vulkan SDK fallback if not found in the cache.  See below...

```
      - name: retrieve VulkanSDK
        if: steps.VulkanSDK.outputs.cache-hit != 'true'
        run: |
          wget https://sdk.lunarg.com/sdk/download/1.3.290.0/mac/vulkansdk-macos-1.3.290.0.dmg
          sudo hdiutil attach vulkansdk-macos-1.3.290.0.dmg
          sudo /Volumes/vulkansdk-macos-1.3.290.0/InstallVulkan.app/Contents/MacOS/InstallVulkan --root ~/VulkanSDK --accept-licenses --default-answer --confirm-command install com.lunarg.vulkan.ios
          sudo hdiutil detach /Volumes/vulkansdk-macos-1.3.290.0
```

author_association: CONTRIBUTOR
user: login: SaschaWillems
created_at: 2025-03-18T06:20:14Z
body: Is there a way to see more of that error? It tried to add slang in such a way that builds don't fail if the skang compiler isn't available (e.g. with older SDKs). Might have made an error though. Older SDK versions don't have slang, and I try to check for it's presence.

And thanks for looking into this 👍🏻 
author_association: COLLABORATOR
user: login: SRSaunders
created_at: 2025-03-18T20:30:01Z
body: > Is there a way to see more of that error?

I ran the build interactively in Xcode and here is the full error...

_PhaseScriptExecution Generate\ samples/tooling/profiles/shader-slang-spv/profiles.vert.spv /Users/steve/XcodeProjects/Vulkan-Samples/build/ios-sdk290/build/vulkan_samples.build/Debug-iphoneos/profiles-vert-slang.build/Script-3A321516860A670084B67032.sh (in target 'profiles-vert-slang' from project 'vulkan_samples')
    cd /Users/steve/XcodeProjects/Vulkan-Samples
    /bin/sh -c /Users/steve/XcodeProjects/Vulkan-Samples/build/ios-sdk290/build/vulkan_samples.build/Debug-iphoneos/profiles-vert-slang.build/Script-3A321516860A670084B67032.sh_

_/Users/steve/XcodeProjects/Vulkan-Samples/build/ios-sdk290/build/vulkan_samples.build/Debug-iphoneos/profiles-vert-slang.build/Script-3A321516860A670084B67032.sh: line 5: Vulkan_slang_EXECUTABLE-NOTFOUND: command not found
Command PhaseScriptExecution failed with a nonzero exit code_

And from cmake:

_-- Found Vulkan: /Users/steve/VulkanSDK/1.3.290.0/iOS/lib/vulkan.framework (found version "1.3.290") found components: glslc glslangValidator
-- Found DirectX Shader Compiler under /Users/steve/VulkanSDK/1.3.290.0/iOS/Bin/dxc
-- Couldn't find slang Shader Compiler executable, make sure it is present in Vulkan SDK or add it manually via Vulkan_slang_EXECUTABLE cmake variable. Slang shaders won't be compiled._

author_association: CONTRIBUTOR
user: login: SaschaWillems
created_at: 2025-03-18T20:32:13Z
body: Thanks a lot 👍🏻 

Slang shaders should only compile if slangc is found, so my code needs some fixing. Will take a look at that.

Edit: Fixed. I was checking for the wrong shader compiler.
author_association: COLLABORATOR
user: login: SRSaunders
created_at: 2025-03-18T20:47:29Z
body: @SaschaWillems note that depending on the CI machine you encounter (x86-based or arm-based), you may also run into problem #1294 for iOS CI builds.

If you do, then you will need to merge either PR #1295 or #1300 to fix.
author_association: CONTRIBUTOR
user: login: SaschaWillems
created_at: 2025-03-18T20:48:33Z
body: I only use the CI machine (?) from our CI setup here at github. So it should be fine now. I want to keep other changes out if this PR if possible.
author_association: COLLABORATOR
user: login: SRSaunders
created_at: 2025-03-18T20:50:44Z
body: No problem, this just a heads up if the iOS CI build fails again...  Hopefully they are arm-based and iOS CI will not fail.
author_association: CONTRIBUTOR
user: login: SRSaunders
created_at: 2025-03-19T00:34:29Z
body: @SaschaWillems I want to point out that iOS is the only CI build that uses the Vulkan SDK, and by extension, dxc and slangc.  That's the reason your "slangc not found" issue (now fixed) showed up only in context of the iOS CI.

For instance, here is what happens on Windows (Linux and macOS are similar):

![Screenshot 2025-03-18 at 8 27 37 PM](https://github.com/user-attachments/assets/211338e1-f460-46e9-9871-cd2001332d16)

As you can see, Vulkan SDK is not found (and dxc + slangc are not used).

And here is what happens on iOS:

![Screenshot 2025-03-18 at 8 29 44 PM](https://github.com/user-attachments/assets/570fb595-7ce0-4f89-919c-457af2b0b4fe)

Vulkan SDK is found and dxc is used.  slangc would be used if the SDK is up-versioned to 1.4.304 (as per my open PR).  

I just want you to be aware of this, in case you want to change the CI for Windows, Linux, macOS to actually use the Vulkan SDK and run the shader compilers (dxc, slangc) as part of the CI build process.  I am less familiar with Android so I won't comment on that.
author_association: CONTRIBUTOR
user: login: gpx1000
created_at: 2025-03-19T05:38:06Z
body: @SRSaunders You're almost correct in how our CI works.  All platforms use the Android NDK that is already installed on the runners by github.  If we were to waste time downloading the latest version like we used to when we used the docker build then we'd constantly be playing catch up.  We shovel that responsibility off to github as it stands to reason that most developers would use that version of the SDK.
Now the system installed SDK is ONLY used in CI and the build in general for things in the library, the validation layer or the binary directory on each of the platforms (shader compilers are heavy candidates here).  We have Vulkan headers in our repo so we control what is used for compiling.  This is useful for those that need to make changes to Vulkan library or use a specific version; as well as giving us complete control over the build itself.

Now, iOS is the odd duck out.  The reason why is when I wrote the CI, the SDK wasn't released yet that had iOS libraries in it, there was no way to get it to actually link.  Now that github Apple runners have the version of the SDK which has the iOS libs, it's in my TODO list to one day take out the SDK from being explicitly downloaded and instead rely upon the system runner's version of the SDK for the similar reasons mentioned above for moving away from the docker image files.  The only thing it really effects is what library things get linked against on a CI build that never actually runs.

It is somewhere in the back of my TODO icebox list to have CI actually run samples, and validate that everything works while also demonstrating how to do that with an AI able to check for buttons in the right spot etc.  Eventually I'll get around to it, just haven't gotten there yet.
author_association: COLLABORATOR
user: login: gpx1000
created_at: 2025-03-19T05:38:57Z
body: er, sorry I meant Vulkan SDK everywhere I say Android, I'm looking into an Android issue right now and have that on my brain.
author_association: COLLABORATOR
user: login: SaschaWillems
created_at: 2025-03-19T06:13:54Z
body: @SRSaunders : If at all we should disable shader compilation on all CI paths. We provide pre-compiled SPV for a reason. But that should be discussed outside of this PR.
author_association: COLLABORATOR
user: login: SaschaWillems
created_at: 2025-03-19T12:07:22Z
body: Argh. That's because HLSL files are always recompiled and I accidentally committed them while adding slang test shaders. Will try to revert those changes :(
author_association: COLLABORATOR
user: login: SRSaunders
created_at: 2025-03-19T13:23:43Z
body: > Now the system installed SDK is ONLY used in CI and the build in general for things in the library, the validation layer or the binary directory on each of the platforms (shader compilers are heavy candidates here). We have Vulkan headers in our repo so we control what is used for compiling.

@gpx1000 I totally agree with this, but I have noticed that iOS is still the _only_ CI build that activates and uses the GitHub cache for the Vulkan SDK, and downloads it as fallback if not found in the cache (note this cache failure is happening all the time now, which is a separate issue that should be looked into).

The concern I have is that none of the other CI builds access the Vulkan SDK at all (cache is not used), and the build logs show no evidence of shader compilation other than for iOS.  Perhaps this is intentional as mentioned by @SaschaWillems above, but I find it strange that you are relying on iOS alone to test the shader build path and ensure sanity.  I would have thought that at least one other platform and config (e.g. Win Rel or Linux Debug) should test for sanity here.  For instance, the only way that @SaschaWillems found the slangc compile issue on earlier SDKs was due to an iOS CI build failure.  It seems like an oversight to me that a least one standard platform is not sanity testing the shader compilation stuff via CI.
author_association: CONTRIBUTOR
user: login: SaschaWillems
created_at: 2025-03-19T13:28:55Z
body: Can I please ask to move that discussion to a separate issue?
author_association: COLLABORATOR
user: login: SRSaunders
created_at: 2025-03-19T13:33:56Z
body: > Can I please ask to move that discussion to a separate issue?

Yes, I was anticipating that.  I don't have anything further to say, so I will leave it up to @gpx1000 to open a new issue if he sees a problem here and wants to continue.  Thanks.
author_association: CONTRIBUTOR
user: login: SaschaWillems
created_at: 2025-03-19T16:51:26Z
body: > By the way: why have all those `*.spv` files changed?

I have replaced the changed with files with the ones from main, that seemed to have worked.
author_association: COLLABORATOR