Non-functional: Fix HLSL error message, and code formatting.

This commit is contained in:
John Kessenich 2018-01-08 11:41:59 -07:00
parent 99892d5a9a
commit adc33b23cc
3 changed files with 26 additions and 16 deletions

View File

@ -841,7 +841,8 @@ int TScanContext::tokenizeIdentifier()
case VOLATILE:
if (parseContext.profile == EEsProfile && parseContext.version >= 310)
return keyword;
if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || (parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile ||
(parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
reservedWord();
return keyword;
@ -985,8 +986,8 @@ int TScanContext::tokenizeIdentifier()
case U64VEC4:
afterType = true;
if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) &&
parseContext.profile != EEsProfile && parseContext.version >= 450))
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64)))
return keyword;
return identifierOrType();
@ -1001,8 +1002,8 @@ int TScanContext::tokenizeIdentifier()
case U16VEC4:
afterType = true;
if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) &&
parseContext.profile != EEsProfile && parseContext.version >= 450))
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16)))
return keyword;
return identifierOrType();
@ -1024,8 +1025,8 @@ int TScanContext::tokenizeIdentifier()
case F16MAT4X4:
afterType = true;
if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) &&
parseContext.profile != EEsProfile && parseContext.version >= 450))
(parseContext.profile != EEsProfile && parseContext.version >= 450 &&
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float)))
return keyword;
return identifierOrType();
#endif
@ -1115,7 +1116,7 @@ int TScanContext::tokenizeIdentifier()
case SAMPLER3D:
afterType = true;
if (parseContext.profile == EEsProfile && parseContext.version < 300) {
if (! parseContext.extensionTurnedOn(E_GL_OES_texture_3D))
if (!parseContext.extensionTurnedOn(E_GL_OES_texture_3D))
reservedWord();
}
return keyword;
@ -1403,7 +1404,8 @@ int TScanContext::dMat()
int TScanContext::firstGenerationImage(bool inEs310)
{
if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.profile != EEsProfile && (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) ||
(parseContext.profile != EEsProfile && (parseContext.version >= 420 ||
parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) ||
(inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310))
return keyword;

View File

@ -570,7 +570,8 @@ bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExte
//
void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc)
{
if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) return;
if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc))
return;
// If we get this far, give errors explaining what extensions are needed
if (numExtensions == 1)
@ -588,7 +589,8 @@ void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions,
//
void TParseVersions::ppRequireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc)
{
if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) return;
if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc))
return;
// If we get this far, give errors explaining what extensions are needed
if (numExtensions == 1)
@ -626,7 +628,8 @@ bool TParseVersions::extensionTurnedOn(const char* const extension)
bool TParseVersions::extensionsTurnedOn(int numExtensions, const char* const extensions[])
{
for (int i = 0; i < numExtensions; ++i) {
if (extensionTurnedOn(extensions[i])) return true;
if (extensionTurnedOn(extensions[i]))
return true;
}
return false;
}

View File

@ -565,10 +565,15 @@ EHlslTokenClass HlslScanContext::tokenizeClass(HlslToken& token)
case EndOfInput: return EHTokNone;
default:
char buf[2];
buf[0] = (char)token;
buf[1] = 0;
parseContext.error(loc, "unexpected token", buf, "");
if (token < PpAtomMaxSingle) {
char buf[2];
buf[0] = (char)token;
buf[1] = 0;
parseContext.error(loc, "unexpected token", buf, "");
} else if (tokenText[0] != 0)
parseContext.error(loc, "unexpected token", tokenText, "");
else
parseContext.error(loc, "unexpected token", "", "");
break;
}
} while (true);