Implement the extension GL_ARB_shader_ballot

Add new built-in variables and functions to the parser (SPIR-V tokens are missing).
This commit is contained in:
Rex Xu
2016-04-14 16:53:07 +08:00
parent 97f4e0fe19
commit 574ab04caa
11 changed files with 537 additions and 6 deletions

View File

@@ -433,7 +433,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case glslang::EbvBaseInstance:
case glslang::EbvDrawId:
// TODO: Add SPIR-V builtin ID.
spv::MissingFunctionality("Draw parameters");
spv::MissingFunctionality("shader draw parameters");
return (spv::BuiltIn)spv::BadValue;
case glslang::EbvPrimitiveId: return spv::BuiltInPrimitiveId;
case glslang::EbvInvocationId: return spv::BuiltInInvocationId;
@@ -453,6 +453,16 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId;
case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex;
case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId;
case glslang::EbvSubGroupSize:
case glslang::EbvSubGroupInvocation:
case glslang::EbvSubGroupEqMask:
case glslang::EbvSubGroupGeMask:
case glslang::EbvSubGroupGtMask:
case glslang::EbvSubGroupLeMask:
case glslang::EbvSubGroupLtMask:
// TODO: Add SPIR-V builtin ID.
spv::MissingFunctionality("shader ballot");
return (spv::BuiltIn)spv::BadValue;
default: return (spv::BuiltIn)spv::BadValue;
}
}
@@ -3234,6 +3244,12 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
libCall = spv::GLSLstd450FindSMsb;
break;
case glslang::EOpBallot:
case glslang::EOpReadFirstInvocation:
spv::MissingFunctionality("shader ballot");
libCall = spv::GLSLstd450Bad;
break;
default:
return 0;
}
@@ -3687,6 +3703,11 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
libCall = spv::GLSLstd450Ldexp;
break;
case glslang::EOpReadInvocation:
spv::MissingFunctionality("shader ballot");
libCall = spv::GLSLstd450Bad;
break;
default:
return 0;
}