Add support for loading compiled Slang shaders

This commit is contained in:
Sascha Willems 2025-02-06 21:25:43 +01:00
parent 3ecc0d2e1f
commit a87dfde9cc
5 changed files with 16 additions and 13 deletions

View file

@ -1,7 +1,7 @@
/*
* Vulkan Example base class
*
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
@ -790,7 +790,7 @@ VulkanExampleBase::VulkanExampleBase()
commandLineParser.add("fullscreen", { "-f", "--fullscreen" }, 0, "Start in fullscreen mode");
commandLineParser.add("width", { "-w", "--width" }, 1, "Set window width");
commandLineParser.add("height", { "-h", "--height" }, 1, "Set window height");
commandLineParser.add("shaders", { "-s", "--shaders" }, 1, "Select shader type to use (glsl or hlsl)");
commandLineParser.add("shaders", { "-s", "--shaders" }, 1, "Select shader type to use (gls, hlsl or slang)");
commandLineParser.add("gpuselection", { "-g", "--gpu" }, 1, "Select GPU to run on");
commandLineParser.add("gpulist", { "-gl", "--listgpus" }, 0, "Display a list of available Vulkan devices");
commandLineParser.add("benchmark", { "-b", "--benchmark" }, 0, "Run example in benchmark mode");
@ -828,8 +828,8 @@ VulkanExampleBase::VulkanExampleBase()
}
if (commandLineParser.isSet("shaders")) {
std::string value = commandLineParser.getValueAsString("shaders", "glsl");
if ((value != "glsl") && (value != "hlsl")) {
std::cerr << "Shader type must be one of 'glsl' or 'hlsl'\n";
if ((value != "glsl") && (value != "hlsl") && (value != "slang")) {
std::cerr << "Shader type must be one of 'glsl', 'hlsl' or 'slang'\n";
}
else {
shaderDir = value;

View file

@ -1,7 +1,7 @@
/*
* Vulkan Example base class
*
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
@ -92,7 +92,7 @@ private:
void destroyCommandBuffers();
std::string shaderDir = "glsl";
protected:
// Returns the path to the root of the glsl or hlsl shader directory.
// Returns the path to the root of the glsl, hlsl or slang shader directory.
std::string getShadersPath() const;
// Frame counter to display fps