SPV/Vulkan: Add support for Vulkan 1.2, which defaults to SPIR-V 1.5.
diff --git a/SPIRV/SpvTools.cpp b/SPIRV/SpvTools.cpp
index 7c3b039..8db58c5 100644
--- a/SPIRV/SpvTools.cpp
+++ b/SPIRV/SpvTools.cpp
@@ -67,6 +67,8 @@
logger->missingFunctionality("Target version for SPIRV-Tools validator");
return spv_target_env::SPV_ENV_VULKAN_1_1;
}
+ case glslang::EShTargetVulkan_1_2:
+ return spv_target_env::SPV_ENV_UNIVERSAL_1_5; //?? should change to SPV_ENV_VULKAN_1_2, when available
default:
break;
}
diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp
index 28c5e15..6e4c8d3 100644
--- a/StandAlone/StandAlone.cpp
+++ b/StandAlone/StandAlone.cpp
@@ -608,6 +608,9 @@
} else if (strcmp(argv[1], "vulkan1.1") == 0) {
setVulkanSpv();
ClientVersion = glslang::EShTargetVulkan_1_1;
+ } else if (strcmp(argv[1], "vulkan1.2") == 0) {
+ setVulkanSpv();
+ ClientVersion = glslang::EShTargetVulkan_1_2;
} else if (strcmp(argv[1], "opengl") == 0) {
setOpenGlSpv();
ClientVersion = glslang::EShTargetOpenGL_450;
@@ -630,7 +633,7 @@
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_5;
} else
- Error("--target-env expected one of: vulkan1.0, vulkan1.1, opengl,\n"
+ Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2, opengl,\n"
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5");
}
bumpArg();
@@ -825,6 +828,10 @@
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_3;
break;
+ case glslang::EShTargetVulkan_1_2:
+ TargetLanguage = glslang::EShTargetSpv;
+ TargetVersion = glslang::EShTargetSpv_1_5;
+ break;
case glslang::EShTargetOpenGL_450:
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_0;
@@ -1640,16 +1647,17 @@
" --sep synonym for --source-entrypoint\n"
" --stdin read from stdin instead of from a file;\n"
" requires providing the shader stage using -S\n"
- " --target-env {vulkan1.0 | vulkan1.1 | opengl | \n"
+ " --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | opengl | \n"
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 | spirv1.5}\n"
- " set execution environment that emitted code\n"
- " will execute in (versus source language\n"
- " semantics selected by --client) defaults:\n"
- " * 'vulkan1.0' under '--client vulkan<ver>'\n"
- " * 'opengl' under '--client opengl<ver>'\n"
- " * 'spirv1.0' under --target-env vulkan1.0\n"
- " * 'spirv1.3' under --target-env vulkan1.1\n"
- " multiple --targen-env can be specified.\n"
+ " Set the execution environment that the\n"
+ " generated code will be executed in.\n"
+ " Defaults to:\n"
+ " * vulkan1.0 under --client vulkan<ver>\n"
+ " * opengl under --client opengl<ver>\n"
+ " * spirv1.0 under --target-env vulkan1.0\n"
+ " * spirv1.3 under --target-env vulkan1.1\n"
+ " * spirv1.5 under --target-env vulkan1.2\n"
+ " Multiple --target-env can be specified.\n"
" --variable-name <name>\n"
" --vn <name> creates a C header file that contains a\n"
" uint32_t array named <name>\n"
diff --git a/Test/runtests b/Test/runtests
index d1ca221..1a7c7c9 100755
--- a/Test/runtests
+++ b/Test/runtests
@@ -189,6 +189,7 @@
$EXE --client opengl100 spv.targetOpenGL.vert || HASERROR=1
$EXE --target-env vulkan1.0 spv.targetVulkan.vert || HASERROR=1
$EXE --target-env vulkan1.1 spv.targetVulkan.vert || HASERROR=1
+$EXE --target-env vulkan1.2 spv.targetVulkan.vert || HASERROR=1
$EXE --target-env opengl spv.targetOpenGL.vert || HASERROR=1
$EXE -V100 spv.targetVulkan.vert || HASERROR=1
$EXE -G100 spv.targetOpenGL.vert || HASERROR=1
diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h
index cb172e5..683290a 100644
--- a/glslang/MachineIndependent/localintermediate.h
+++ b/glslang/MachineIndependent/localintermediate.h
@@ -332,6 +332,9 @@
case EShTargetVulkan_1_1:
processes.addProcess("target-env vulkan1.1");
break;
+ case EShTargetVulkan_1_2:
+ processes.addProcess("target-env vulkan1.2");
+ break;
default:
processes.addProcess("target-env vulkanUnknown");
break;
diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h
index 4cc6c2f..4fe5c7d 100755
--- a/glslang/Public/ShaderLang.h
+++ b/glslang/Public/ShaderLang.h
@@ -145,6 +145,7 @@
typedef enum {
EShTargetVulkan_1_0 = (1 << 22), // Vulkan 1.0
EShTargetVulkan_1_1 = (1 << 22) | (1 << 12), // Vulkan 1.1
+ EShTargetVulkan_1_2 = (1 << 22) | (2 << 12), // Vulkan 1.2
EShTargetOpenGL_450 = 450, // OpenGL
} EShTargetClientVersion;