Validator: TaskNV can use LocalSize or LocalSizeId (#1970)

Correponds to the update to Rev2 of SPV_NV_mesh_shader

Fixes #1968
This commit is contained in:
David Neto 2018-10-12 08:54:52 -04:00 committed by alan-baker
parent e545564887
commit bdecee8c86
2 changed files with 34 additions and 2 deletions

View File

@ -376,6 +376,7 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _,
case SpvExecutionModelKernel:
case SpvExecutionModelGLCompute:
return true;
case SpvExecutionModelTaskNV:
case SpvExecutionModelMeshNV:
return _.HasCapability(SpvCapabilityMeshShadingNV);
default:
@ -384,8 +385,8 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _,
})) {
if (_.HasCapability(SpvCapabilityMeshShadingNV)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Execution mode can only be used with a Kernel, GLCompute "
"or MeshNV execution model.";
<< "Execution mode can only be used with a Kernel, GLCompute, "
"MeshNV, or TaskNV execution model.";
} else {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Execution mode can only be used with a Kernel or "

View File

@ -720,6 +720,20 @@ OpExecutionMode %main LocalSize 1 1 1
EXPECT_THAT(SPV_SUCCESS, ValidateInstructions());
}
TEST_F(ValidateModeExecution, TaskNVLocalSize) {
const std::string spirv = R"(
OpCapability Shader
OpCapability MeshShadingNV
OpExtension "SPV_NV_mesh_shader"
OpMemoryModel Logical GLSL450
OpEntryPoint TaskNV %main "main"
OpExecutionMode %main LocalSize 1 1 1
)" + kVoidFunction;
CompileSuccessfully(spirv);
EXPECT_THAT(SPV_SUCCESS, ValidateInstructions());
}
TEST_F(ValidateModeExecution, MeshNVOutputPoints) {
const std::string spirv = R"(
OpCapability Shader
@ -765,6 +779,23 @@ OpExecutionModeId %main LocalSizeId %int_1 %int_1 %int_1
EXPECT_THAT(SPV_SUCCESS, ValidateInstructions(env));
}
TEST_F(ValidateModeExecution, TaskNVLocalSizeId) {
const std::string spirv = R"(
OpCapability Shader
OpCapability MeshShadingNV
OpExtension "SPV_NV_mesh_shader"
OpMemoryModel Logical GLSL450
OpEntryPoint TaskNV %main "main"
OpExecutionModeId %main LocalSizeId %int_1 %int_1 %int_1
%int = OpTypeInt 32 0
%int_1 = OpConstant %int 1
)" + kVoidFunction;
spv_target_env env = SPV_ENV_UNIVERSAL_1_3;
CompileSuccessfully(spirv, env);
EXPECT_THAT(SPV_SUCCESS, ValidateInstructions(env));
}
} // namespace
} // namespace val
} // namespace spvtools