Add a string 'StartsWith' helper function
This commit is contained in:
parent
48702616ec
commit
114dae9114
2 changed files with 15 additions and 10 deletions
|
|
@ -159,6 +159,11 @@ template<class T> inline T* NewPoolObject(T, int instances)
|
|||
return new(GetThreadPoolAllocator().allocate(instances * sizeof(T))) T[instances];
|
||||
}
|
||||
|
||||
inline bool StartsWith(TString const &str, const char *prefix)
|
||||
{
|
||||
return str.compare(0, strlen(prefix), prefix) == 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Pool allocator versions of vectors, lists, and maps
|
||||
//
|
||||
|
|
|
|||
|
|
@ -2527,23 +2527,23 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
|
|||
} else if(callNode.getType().getBasicType() == EbtFloat16 &&
|
||||
((callNode.getType().getVectorSize() == 2 && arg0->getType().getQualifier().getFormat() == ElfRg16f) ||
|
||||
(callNode.getType().getVectorSize() == 4 && arg0->getType().getQualifier().getFormat() == ElfRgba16f))) {
|
||||
if ((fnCandidate.getName().compare(0, 14, "imageAtomicAdd") == 0) ||
|
||||
(fnCandidate.getName().compare(0, 19, "imageAtomicExchange") == 0) ||
|
||||
(fnCandidate.getName().compare(0, 19, "imageAtomicMin") == 0) ||
|
||||
(fnCandidate.getName().compare(0, 19, "imageAtomicMax") == 0)) {
|
||||
if (StartsWith(fnCandidate.getName(), "imageAtomicAdd") ||
|
||||
StartsWith(fnCandidate.getName(), "imageAtomicExchange") ||
|
||||
StartsWith(fnCandidate.getName(), "imageAtomicMin") ||
|
||||
StartsWith(fnCandidate.getName(), "imageAtomicMax")) {
|
||||
requireExtensions(loc, 1, &E_GL_NV_shader_atomic_fp16_vector, fnCandidate.getName().c_str());
|
||||
} else {
|
||||
error(loc, "f16vec2/4 operation not supported on: ", fnCandidate.getName().c_str(), "");
|
||||
}
|
||||
} else if (imageType.getSampler().type == EbtFloat) {
|
||||
if (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") == 0) {
|
||||
if (StartsWith(fnCandidate.getName(), "imageAtomicExchange")) {
|
||||
// imageAtomicExchange doesn't require an extension
|
||||
} else if ((fnCandidate.getName().compare(0, 14, "imageAtomicAdd") == 0) ||
|
||||
(fnCandidate.getName().compare(0, 15, "imageAtomicLoad") == 0) ||
|
||||
(fnCandidate.getName().compare(0, 16, "imageAtomicStore") == 0)) {
|
||||
} else if (StartsWith(fnCandidate.getName(), "imageAtomicAdd") ||
|
||||
StartsWith(fnCandidate.getName(), "imageAtomicLoad") ||
|
||||
StartsWith(fnCandidate.getName(), "imageAtomicStore")) {
|
||||
requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_float, fnCandidate.getName().c_str());
|
||||
} else if ((fnCandidate.getName().compare(0, 14, "imageAtomicMin") == 0) ||
|
||||
(fnCandidate.getName().compare(0, 14, "imageAtomicMax") == 0)) {
|
||||
} else if (StartsWith(fnCandidate.getName(), "imageAtomicMin") ||
|
||||
StartsWith(fnCandidate.getName(), "imageAtomicMax")) {
|
||||
requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_float2, fnCandidate.getName().c_str());
|
||||
} else {
|
||||
error(loc, "only supported on integer images", fnCandidate.getName().c_str(), "");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue