Merge pull request #2058 from KhronosGroup/vulkan-1.2

SPV/Vulkan: Add support for Vulkan 1.2, which defaults to SPIR-V 1.5.
This commit is contained in:
John Kessenich 2020-01-15 10:48:58 -07:00 committed by GitHub
commit 4fc7a33910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 11 deletions

View File

@ -67,6 +67,8 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
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_VULKAN_1_2;
default:
break;
}

View File

@ -608,6 +608,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
} 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 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
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 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
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 @@ void usage()
" --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"

View File

@ -189,6 +189,7 @@ $EXE --client vulkan100 spv.targetVulkan.vert || HASERROR=1
$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

View File

@ -332,6 +332,9 @@ public:
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;

View File

@ -145,6 +145,7 @@ typedef enum {
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;

View File

@ -5,7 +5,7 @@
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Tools",
"subdir" : "External/spirv-tools",
"commit" : "5c019b5923c1f6bf00a3ac28114ec4a7b1faa0e2"
"commit" : "323a81fc5e30e43a04e5e22af4cba98ca2a161e6"
},
{
"name" : "spirv-tools/external/spirv-headers",