mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Revert "(glslang) Syntax cleanups, other cleanups"
This reverts commit e480ebd29f
.
This commit is contained in:
parent
7a9679c7fd
commit
9ec7eaeb8b
@ -191,9 +191,9 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
||||
break;
|
||||
|
||||
case EbtUint8:
|
||||
if (rightUnionArray[i] == 0)
|
||||
if (rightUnionArray[i] == 0) {
|
||||
newConstArray[i].setU8Const(0xFF);
|
||||
else
|
||||
} else
|
||||
newConstArray[i].setU8Const(leftUnionArray[i].getU8Const() / rightUnionArray[i].getU8Const());
|
||||
break;
|
||||
|
||||
@ -207,9 +207,9 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
||||
break;
|
||||
|
||||
case EbtUint16:
|
||||
if (rightUnionArray[i] == 0)
|
||||
if (rightUnionArray[i] == 0) {
|
||||
newConstArray[i].setU16Const(0xFFFF);
|
||||
else
|
||||
} else
|
||||
newConstArray[i].setU16Const(leftUnionArray[i].getU16Const() / rightUnionArray[i].getU16Const());
|
||||
break;
|
||||
|
||||
|
@ -104,8 +104,7 @@ protected:
|
||||
return true; // traverse all code
|
||||
|
||||
TIntermConstantUnion* constant = node->getCondition()->getAsConstantUnion();
|
||||
if (constant)
|
||||
{
|
||||
if (constant) {
|
||||
// cull the path that is dead
|
||||
if (constant->getConstArray()[0].getBConst() == true && node->getTrueBlock())
|
||||
node->getTrueBlock()->traverse(this);
|
||||
@ -113,7 +112,7 @@ protected:
|
||||
node->getFalseBlock()->traverse(this);
|
||||
|
||||
return false; // don't traverse any more, we did it all above
|
||||
}
|
||||
} else
|
||||
return true; // traverse the whole subtree
|
||||
}
|
||||
|
||||
|
@ -81,26 +81,22 @@ bool TInputScanner::consumeComment()
|
||||
|
||||
get(); // consume the '/'
|
||||
int c = peek();
|
||||
if (c == '/')
|
||||
{
|
||||
if (c == '/') {
|
||||
|
||||
// a '//' style comment
|
||||
get(); // consume the second '/'
|
||||
c = get();
|
||||
for (;;)
|
||||
{
|
||||
for (;;) {
|
||||
while (c != EndOfInput && c != '\\' && c != '\r' && c != '\n')
|
||||
c = get();
|
||||
|
||||
if (c == EndOfInput || c == '\r' || c == '\n')
|
||||
{
|
||||
if (c == EndOfInput || c == '\r' || c == '\n') {
|
||||
while (c == '\r' || c == '\n')
|
||||
c = get();
|
||||
|
||||
// we reached the end of the comment
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// it's a '\', so we need to keep going, after skipping what's escaped
|
||||
|
||||
// read the skipped character
|
||||
@ -111,30 +107,26 @@ bool TInputScanner::consumeComment()
|
||||
get();
|
||||
c = get();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// put back the last non-comment character
|
||||
if (c != EndOfInput)
|
||||
unget();
|
||||
}
|
||||
else if (c == '*')
|
||||
{
|
||||
} else if (c == '*') {
|
||||
// a '/*' style comment
|
||||
get(); // consume the '*'
|
||||
c = get();
|
||||
for (;;)
|
||||
{
|
||||
for (;;) {
|
||||
while (c != EndOfInput && c != '*')
|
||||
c = get();
|
||||
if (c == '*')
|
||||
{
|
||||
if (c == '*') {
|
||||
c = get();
|
||||
if (c == '/')
|
||||
break; // end of comment
|
||||
// not end of comment
|
||||
} else // end of input
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -149,8 +141,7 @@ bool TInputScanner::consumeComment()
|
||||
// skip whitespace, then skip a comment, rinse, repeat
|
||||
void TInputScanner::consumeWhitespaceComment(bool& foundNonSpaceTab)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
for (;;) {
|
||||
consumeWhiteSpace(foundNonSpaceTab);
|
||||
|
||||
// if not starting a comment now, then done
|
||||
@ -162,7 +153,7 @@ void TInputScanner::consumeWhitespaceComment(bool& foundNonSpaceTab)
|
||||
foundNonSpaceTab = true;
|
||||
if (!consumeComment())
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Returns true if there was non-white space (e.g., a comment, newline) before the #version
|
||||
@ -320,10 +311,11 @@ namespace glslang {
|
||||
|
||||
void TScanContext::fillInKeywordMap()
|
||||
{
|
||||
if (KeywordMap != NULL) {
|
||||
// this is really an error, as this should called only once per process
|
||||
// but, the only risk is if two threads called simultaneously
|
||||
if (KeywordMap)
|
||||
return;
|
||||
}
|
||||
KeywordMap = new std::unordered_map<const char*, int, str_hash, str_eq>;
|
||||
|
||||
(*KeywordMap)["const"] = CONST;
|
||||
@ -836,13 +828,13 @@ int TScanContext::tokenizeIdentifier()
|
||||
return reservedWord();
|
||||
|
||||
auto it = KeywordMap->find(tokenText);
|
||||
if (it == KeywordMap->end()) {
|
||||
// Should have an identifier of some sort
|
||||
if (it == KeywordMap->end())
|
||||
return identifierOrType();
|
||||
}
|
||||
keyword = it->second;
|
||||
|
||||
switch (keyword)
|
||||
{
|
||||
switch (keyword) {
|
||||
case CONST:
|
||||
case UNIFORM:
|
||||
case IN:
|
||||
@ -865,17 +857,15 @@ int TScanContext::tokenizeIdentifier()
|
||||
return keyword;
|
||||
|
||||
case NONUNIFORM:
|
||||
if (_parseContext.extensionTurnedOn(
|
||||
E_GL_EXT_nonuniform_qualifier))
|
||||
if (_parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier))
|
||||
return keyword;
|
||||
else
|
||||
return identifierOrType();
|
||||
|
||||
case SWITCH:
|
||||
case DEFAULT:
|
||||
if (( _parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 130))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < 130))
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
@ -909,24 +899,19 @@ int TScanContext::tokenizeIdentifier()
|
||||
|
||||
case ATTRIBUTE:
|
||||
case VARYING:
|
||||
if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 300)
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version >= 300)
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
case BUFFER:
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 310)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 430))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version < 310) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < 430))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case ATOMIC_UINT:
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 310)
|
||||
|| _parseContext.extensionTurnedOn(
|
||||
E_GL_ARB_shader_atomic_counters))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 310) ||
|
||||
_parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(420);
|
||||
|
||||
@ -934,20 +919,15 @@ int TScanContext::tokenizeIdentifier()
|
||||
case RESTRICT:
|
||||
case READONLY:
|
||||
case WRITEONLY:
|
||||
if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 310)
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version >= 310)
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(_parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420);
|
||||
|
||||
case VOLATILE:
|
||||
if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 310)
|
||||
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;
|
||||
|
||||
@ -956,20 +936,15 @@ int TScanContext::tokenizeIdentifier()
|
||||
const int numLayoutExts = 2;
|
||||
const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack,
|
||||
E_GL_ARB_explicit_attrib_location };
|
||||
if ( ( _parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
|| ( _parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 140
|
||||
&& ! _parseContext.extensionsTurnedOn(
|
||||
numLayoutExts, layoutExts)))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < 140 &&
|
||||
! _parseContext.extensionsTurnedOn(numLayoutExts, layoutExts)))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
}
|
||||
case SHARED:
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 140))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < 140))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
@ -984,10 +959,8 @@ int TScanContext::tokenizeIdentifier()
|
||||
return es30ReservedFromGLSL(400);
|
||||
|
||||
case SAMPLE:
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 320)
|
||||
|| _parseContext.extensionsTurnedOn(1,
|
||||
&E_GL_OES_shader_multisample_interpolation))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 320) ||
|
||||
_parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(400);
|
||||
|
||||
@ -999,6 +972,7 @@ int TScanContext::tokenizeIdentifier()
|
||||
case LOW_PRECISION:
|
||||
case PRECISION:
|
||||
return precisionKeyword();
|
||||
|
||||
case MAT2X2:
|
||||
case MAT2X3:
|
||||
case MAT2X4:
|
||||
@ -1009,6 +983,7 @@ int TScanContext::tokenizeIdentifier()
|
||||
case MAT4X3:
|
||||
case MAT4X4:
|
||||
return matNxM();
|
||||
|
||||
case DMAT2:
|
||||
case DMAT3:
|
||||
case DMAT4:
|
||||
@ -1022,6 +997,7 @@ int TScanContext::tokenizeIdentifier()
|
||||
case DMAT4X3:
|
||||
case DMAT4X4:
|
||||
return dMat();
|
||||
|
||||
case IMAGE1D:
|
||||
case IIMAGE1D:
|
||||
case UIMAGE1D:
|
||||
@ -1033,14 +1009,13 @@ int TScanContext::tokenizeIdentifier()
|
||||
case UIMAGE2DRECT:
|
||||
afterType = true;
|
||||
return firstGenerationImage(false);
|
||||
|
||||
case IMAGEBUFFER:
|
||||
case IIMAGEBUFFER:
|
||||
case UIMAGEBUFFER:
|
||||
afterType = true;
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 320)
|
||||
|| _parseContext.extensionsTurnedOn(
|
||||
Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 320) ||
|
||||
_parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
return keyword;
|
||||
return firstGenerationImage(false);
|
||||
|
||||
@ -1063,11 +1038,8 @@ int TScanContext::tokenizeIdentifier()
|
||||
case IIMAGECUBEARRAY:
|
||||
case UIMAGECUBEARRAY:
|
||||
afterType = true;
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 320)
|
||||
|| _parseContext.extensionsTurnedOn(
|
||||
Num_AEP_texture_cube_map_array,
|
||||
AEP_texture_cube_map_array))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 320) ||
|
||||
_parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
|
||||
return keyword;
|
||||
return secondGenerationImage();
|
||||
|
||||
@ -1085,8 +1057,7 @@ int TScanContext::tokenizeIdentifier()
|
||||
case DVEC3:
|
||||
case DVEC4:
|
||||
afterType = true;
|
||||
if (_parseContext.profile == EEsProfile
|
||||
|| _parseContext.version < 400)
|
||||
if (_parseContext.profile == EEsProfile || _parseContext.version < 400)
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
@ -1239,16 +1210,10 @@ int TScanContext::tokenizeIdentifier()
|
||||
case ISAMPLERCUBEARRAY:
|
||||
case USAMPLERCUBEARRAY:
|
||||
afterType = true;
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 320)
|
||||
|| _parseContext.extensionsTurnedOn(
|
||||
Num_AEP_texture_cube_map_array,
|
||||
AEP_texture_cube_map_array))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 320) ||
|
||||
_parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
|
||||
return keyword;
|
||||
if ( _parseContext.profile == EEsProfile
|
||||
|| ( _parseContext.version < 400
|
||||
&& ! _parseContext.extensionTurnedOn(
|
||||
E_GL_ARB_texture_cube_map_array)))
|
||||
if (_parseContext.profile == EEsProfile || (_parseContext.version < 400 && ! _parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array)))
|
||||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
@ -1285,20 +1250,16 @@ int TScanContext::tokenizeIdentifier()
|
||||
|
||||
case SAMPLERBUFFER:
|
||||
afterType = true;
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 320)
|
||||
|| _parseContext.extensionsTurnedOn(
|
||||
Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 320) ||
|
||||
_parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(130);
|
||||
|
||||
case ISAMPLERBUFFER:
|
||||
case USAMPLERBUFFER:
|
||||
afterType = true;
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 320)
|
||||
|| _parseContext.extensionsTurnedOn(
|
||||
Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 320) ||
|
||||
_parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(140);
|
||||
|
||||
@ -1306,8 +1267,7 @@ int TScanContext::tokenizeIdentifier()
|
||||
case ISAMPLER2DMS:
|
||||
case USAMPLER2DMS:
|
||||
afterType = true;
|
||||
if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 310)
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version >= 310)
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(150);
|
||||
|
||||
@ -1315,10 +1275,8 @@ int TScanContext::tokenizeIdentifier()
|
||||
case ISAMPLER2DMSARRAY:
|
||||
case USAMPLER2DMSARRAY:
|
||||
afterType = true;
|
||||
if ((_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 320)
|
||||
|| _parseContext.extensionsTurnedOn(1,
|
||||
&E_GL_OES_texture_storage_multisample_2d_array))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 320) ||
|
||||
_parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array))
|
||||
return keyword;
|
||||
return es30ReservedFromGLSL(150);
|
||||
|
||||
@ -1331,22 +1289,16 @@ int TScanContext::tokenizeIdentifier()
|
||||
|
||||
case SAMPLER3D:
|
||||
afterType = true;
|
||||
if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
{
|
||||
if (!_parseContext.extensionTurnedOn(
|
||||
E_GL_OES_texture_3D))
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version < 300) {
|
||||
if (!_parseContext.extensionTurnedOn(E_GL_OES_texture_3D))
|
||||
reservedWord();
|
||||
}
|
||||
return keyword;
|
||||
|
||||
case SAMPLER2DSHADOW:
|
||||
afterType = true;
|
||||
if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
{
|
||||
if (!_parseContext.extensionTurnedOn(
|
||||
E_GL_EXT_shadow_samplers))
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version < 300) {
|
||||
if (!_parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers))
|
||||
reservedWord();
|
||||
}
|
||||
return keyword;
|
||||
@ -1356,11 +1308,7 @@ int TScanContext::tokenizeIdentifier()
|
||||
afterType = true;
|
||||
if (_parseContext.profile == EEsProfile)
|
||||
reservedWord();
|
||||
else if (_parseContext.version < 140
|
||||
&& ! _parseContext.symbolTable.atBuiltInLevel()
|
||||
&& ! _parseContext.extensionTurnedOn(
|
||||
E_GL_ARB_texture_rectangle))
|
||||
{
|
||||
else if (_parseContext.version < 140 && ! _parseContext.symbolTable.atBuiltInLevel() && ! _parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) {
|
||||
if (_parseContext.relaxedErrors())
|
||||
_parseContext.requireExtensions(loc, 1, &E_GL_ARB_texture_rectangle, "texture-rectangle sampler keyword");
|
||||
else
|
||||
@ -1370,23 +1318,18 @@ int TScanContext::tokenizeIdentifier()
|
||||
|
||||
case SAMPLER1DARRAY:
|
||||
afterType = true;
|
||||
if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version == 300)
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version == 300)
|
||||
reservedWord();
|
||||
else if ( (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 130))
|
||||
else if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < 130))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case SAMPLEREXTERNALOES:
|
||||
afterType = true;
|
||||
if ( _parseContext.symbolTable.atBuiltInLevel()
|
||||
|| _parseContext.extensionTurnedOn(
|
||||
E_GL_OES_EGL_image_external)
|
||||
|| _parseContext.extensionTurnedOn(
|
||||
E_GL_OES_EGL_image_external_essl3))
|
||||
if (_parseContext.symbolTable.atBuiltInLevel() ||
|
||||
_parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external) ||
|
||||
_parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external_essl3))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
@ -1427,6 +1370,7 @@ int TScanContext::tokenizeIdentifier()
|
||||
case SAMPLERSHADOW:
|
||||
if (_parseContext.spvVersion.vulkan > 0)
|
||||
return keyword;
|
||||
else
|
||||
return identifierOrType();
|
||||
|
||||
case SUBPASSINPUT:
|
||||
@ -1437,6 +1381,7 @@ int TScanContext::tokenizeIdentifier()
|
||||
case USUBPASSINPUTMS:
|
||||
if (_parseContext.spvVersion.vulkan > 0)
|
||||
return keyword;
|
||||
else
|
||||
return identifierOrType();
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
@ -1486,49 +1431,39 @@ int TScanContext::tokenizeIdentifier()
|
||||
case F16SUBPASSINPUT:
|
||||
case F16SUBPASSINPUTMS:
|
||||
afterType = true;
|
||||
if ( _parseContext.symbolTable.atBuiltInLevel()
|
||||
|| (_parseContext.extensionTurnedOn(
|
||||
E_GL_AMD_gpu_shader_half_float_fetch)
|
||||
&& _parseContext.profile != EEsProfile
|
||||
&& _parseContext.version >= 450))
|
||||
if (_parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(_parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) &&
|
||||
_parseContext.profile != EEsProfile && _parseContext.version >= 450))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
case NOPERSPECTIVE:
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 300
|
||||
&& _parseContext.extensionTurnedOn(
|
||||
E_GL_NV_shader_noperspective_interpolation))
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version >= 300 &&
|
||||
_parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation))
|
||||
return keyword;
|
||||
#endif
|
||||
return es30ReservedFromGLSL(130);
|
||||
|
||||
case SMOOTH:
|
||||
if ( (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 130))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < 130))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case __EXPLICITINTERPAMD:
|
||||
if ( _parseContext.profile != EEsProfile
|
||||
&& _parseContext.version >= 450
|
||||
&& _parseContext.extensionTurnedOn(
|
||||
E_GL_AMD_shader_explicit_vertex_parameter))
|
||||
if (_parseContext.profile != EEsProfile && _parseContext.version >= 450 &&
|
||||
_parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
case FLAT:
|
||||
if ( _parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version < 300)
|
||||
reservedWord();
|
||||
else if (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 130)
|
||||
else if (_parseContext.profile != EEsProfile && _parseContext.version < 130)
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
@ -1538,42 +1473,31 @@ int TScanContext::tokenizeIdentifier()
|
||||
return keyword;
|
||||
|
||||
case PRECISE:
|
||||
if ( (_parseContext.profile == EEsProfile
|
||||
&& (_parseContext.version >= 320
|
||||
|| _parseContext.extensionsTurnedOn(
|
||||
Num_AEP_gpu_shader5, AEP_gpu_shader5)))
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version >= 400))
|
||||
if ((_parseContext.profile == EEsProfile &&
|
||||
(_parseContext.version >= 320 || _parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version >= 400))
|
||||
return keyword;
|
||||
if ( _parseContext.profile == EEsProfile
|
||||
&& _parseContext.version == 310)
|
||||
{
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version == 310) {
|
||||
reservedWord();
|
||||
return keyword;
|
||||
}
|
||||
return identifierOrType();
|
||||
|
||||
case INVARIANT:
|
||||
if ( _parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 120)
|
||||
if (_parseContext.profile != EEsProfile && _parseContext.version < 120)
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case PACKED:
|
||||
if ( (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < 330))
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < 330))
|
||||
return reservedWord();
|
||||
return identifierOrType();
|
||||
|
||||
case RESOURCE:
|
||||
{
|
||||
bool reserved =
|
||||
(_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 300)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version >= 420);
|
||||
bool reserved = (_parseContext.profile == EEsProfile && _parseContext.version >= 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version >= 420);
|
||||
return identifierOrReserved(reserved);
|
||||
}
|
||||
case SUPERP:
|
||||
@ -1584,32 +1508,27 @@ int TScanContext::tokenizeIdentifier()
|
||||
|
||||
default:
|
||||
_parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int TScanContext::identifierOrType()
|
||||
{
|
||||
parserToken->sType.lex.string = NewPoolTString(tokenText);
|
||||
if (!field)
|
||||
{
|
||||
if (field)
|
||||
return IDENTIFIER;
|
||||
|
||||
parserToken->sType.lex.symbol = _parseContext.symbolTable.find(*parserToken->sType.lex.string);
|
||||
if ((afterType == false
|
||||
&& afterStruct == false)
|
||||
&& parserToken->sType.lex.symbol)
|
||||
{
|
||||
if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable())
|
||||
{
|
||||
if (variable->isUserType())
|
||||
{
|
||||
if ((afterType == false && afterStruct == false) && parserToken->sType.lex.symbol != NULL) {
|
||||
if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) {
|
||||
if (variable->isUserType()) {
|
||||
afterType = true;
|
||||
|
||||
return TYPE_NAME;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return IDENTIFIER;
|
||||
}
|
||||
|
||||
@ -1626,9 +1545,9 @@ int TScanContext::reservedWord()
|
||||
|
||||
int TScanContext::identifierOrReserved(bool reserved)
|
||||
{
|
||||
if (reserved)
|
||||
{
|
||||
if (reserved) {
|
||||
reservedWord();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1645,20 +1564,13 @@ int TScanContext::es30ReservedFromGLSL(int version)
|
||||
if (_parseContext.symbolTable.atBuiltInLevel())
|
||||
return keyword;
|
||||
|
||||
if ( (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < 300)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < version))
|
||||
{
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version < 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < version)) {
|
||||
if (_parseContext.forwardCompatible)
|
||||
_parseContext.warn(loc,
|
||||
"future reserved word in ES 300 and keyword in GLSL",
|
||||
tokenText, "");
|
||||
_parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, "");
|
||||
|
||||
return identifierOrType();
|
||||
}
|
||||
else if (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 300)
|
||||
} else if (_parseContext.profile == EEsProfile && _parseContext.version >= 300)
|
||||
reservedWord();
|
||||
|
||||
return keyword;
|
||||
@ -1668,11 +1580,8 @@ int TScanContext::es30ReservedFromGLSL(int version)
|
||||
// showed up, both in an es version and a non-ES version.
|
||||
int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion)
|
||||
{
|
||||
if ( ( _parseContext.profile == EEsProfile
|
||||
&& _parseContext.version < esVersion)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version < nonEsVersion))
|
||||
{
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version < esVersion) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version < nonEsVersion)) {
|
||||
if (_parseContext.forwardCompatible)
|
||||
_parseContext.warn(loc, "using future keyword", tokenText, "");
|
||||
|
||||
@ -1710,15 +1619,13 @@ int TScanContext::dMat()
|
||||
{
|
||||
afterType = true;
|
||||
|
||||
if ( _parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 300)
|
||||
{
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version >= 300) {
|
||||
reservedWord();
|
||||
|
||||
return keyword;
|
||||
}
|
||||
|
||||
if ( _parseContext.profile != EEsProfile
|
||||
&& _parseContext.version >= 400)
|
||||
if (_parseContext.profile != EEsProfile && _parseContext.version >= 400)
|
||||
return keyword;
|
||||
|
||||
if (_parseContext.forwardCompatible)
|
||||
@ -1729,19 +1636,16 @@ 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)))
|
||||
|| (inEs310 && _parseContext.profile == EEsProfile && _parseContext.version >= 310))
|
||||
if (_parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(_parseContext.profile != EEsProfile && (_parseContext.version >= 420 ||
|
||||
_parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) ||
|
||||
(inEs310 && _parseContext.profile == EEsProfile && _parseContext.version >= 310))
|
||||
return keyword;
|
||||
|
||||
if ( (_parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 300)
|
||||
|| (_parseContext.profile != EEsProfile
|
||||
&& _parseContext.version >= 130))
|
||||
{
|
||||
if ((_parseContext.profile == EEsProfile && _parseContext.version >= 300) ||
|
||||
(_parseContext.profile != EEsProfile && _parseContext.version >= 130)) {
|
||||
reservedWord();
|
||||
|
||||
return keyword;
|
||||
}
|
||||
|
||||
@ -1753,18 +1657,14 @@ int TScanContext::firstGenerationImage(bool inEs310)
|
||||
|
||||
int TScanContext::secondGenerationImage()
|
||||
{
|
||||
if ( _parseContext.profile == EEsProfile
|
||||
&& _parseContext.version >= 310)
|
||||
{
|
||||
if (_parseContext.profile == EEsProfile && _parseContext.version >= 310) {
|
||||
reservedWord();
|
||||
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))))
|
||||
return keyword;
|
||||
|
||||
if (_parseContext.forwardCompatible)
|
||||
|
@ -107,13 +107,13 @@ public:
|
||||
// N.B. Sources can have a length of 0.
|
||||
int sourceToRead = currentSource;
|
||||
size_t charToRead = currentChar;
|
||||
while(charToRead >= lengths[sourceToRead])
|
||||
{
|
||||
while(charToRead >= lengths[sourceToRead]) {
|
||||
charToRead = 0;
|
||||
sourceToRead += 1;
|
||||
if (sourceToRead >= numSources)
|
||||
if (sourceToRead >= numSources) {
|
||||
return EndOfInput;
|
||||
}
|
||||
}
|
||||
|
||||
// Here, we care about making negative valued characters positive
|
||||
return sources[sourceToRead][charToRead];
|
||||
@ -130,16 +130,15 @@ public:
|
||||
--currentChar;
|
||||
--loc[currentSource].column;
|
||||
--logicalSourceLoc.column;
|
||||
if (loc[currentSource].column < 0)
|
||||
{
|
||||
if (loc[currentSource].column < 0) {
|
||||
// We've moved back past a new line. Find the
|
||||
// previous newline (or start of the file) to compute
|
||||
// the column count on the now current line.
|
||||
size_t chIndex = currentChar;
|
||||
while (chIndex > 0)
|
||||
{
|
||||
if (sources[currentSource][chIndex] == '\n')
|
||||
while (chIndex > 0) {
|
||||
if (sources[currentSource][chIndex] == '\n') {
|
||||
break;
|
||||
}
|
||||
--chIndex;
|
||||
}
|
||||
logicalSourceLoc.column = (int)(currentChar - chIndex);
|
||||
@ -149,10 +148,10 @@ public:
|
||||
do {
|
||||
--currentSource;
|
||||
} while (currentSource > 0 && lengths[currentSource] == 0);
|
||||
if (lengths[currentSource] == 0)
|
||||
if (lengths[currentSource] == 0) {
|
||||
// set to 0 if we've backed up to the start of an empty string
|
||||
currentChar = 0;
|
||||
else
|
||||
} else
|
||||
currentChar = lengths[currentSource] - 1;
|
||||
}
|
||||
if (peek() == '\n') {
|
||||
@ -208,10 +207,12 @@ public:
|
||||
|
||||
const TSourceLoc& getSourceLoc() const
|
||||
{
|
||||
if (singleLogical)
|
||||
if (singleLogical) {
|
||||
return logicalSourceLoc;
|
||||
} else {
|
||||
return loc[std::max(0, std::min(currentSource, numSources - finale - 1))];
|
||||
}
|
||||
}
|
||||
// Returns the index (starting from 0) of the most recent valid source string we are reading from.
|
||||
int getLastValidSourceIndex() const { return std::min(currentSource, numSources - 1); }
|
||||
|
||||
|
@ -65,24 +65,21 @@ namespace { // anonymous namespace for file-local functions and symbols
|
||||
|
||||
// Total number of successful initializers of glslang: a refcount
|
||||
// Shared global; access should be protected by a global mutex/critical section.
|
||||
static int NumberOfClients = 0;
|
||||
int NumberOfClients = 0;
|
||||
|
||||
using namespace glslang;
|
||||
|
||||
// Create a language specific version of parseables.
|
||||
TBuiltInParseables* CreateBuiltInParseables(
|
||||
TInfoSink& infoSink, EShSource source)
|
||||
TBuiltInParseables* CreateBuiltInParseables(TInfoSink& infoSink, EShSource source)
|
||||
{
|
||||
switch (source)
|
||||
{
|
||||
case EShSourceGlsl:
|
||||
return new TBuiltIns(); // GLSL builtIns
|
||||
switch (source) {
|
||||
case EShSourceGlsl: return new TBuiltIns(); // GLSL builtIns
|
||||
|
||||
default:
|
||||
infoSink.info.message(EPrefixInternalError, "Unable to determine source language");
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a language specific version of a parse context.
|
||||
TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TIntermediate& intermediate,
|
||||
@ -1236,7 +1233,7 @@ void ShDestruct(ShHandle handle)
|
||||
//
|
||||
// Cleanup symbol tables
|
||||
//
|
||||
int __fastcall ShFinalize(void)
|
||||
int __fastcall ShFinalize()
|
||||
{
|
||||
glslang::GetGlobalLock();
|
||||
--NumberOfClients;
|
||||
@ -1319,15 +1316,15 @@ int ShCompile(
|
||||
|
||||
TIntermediate intermediate(compiler->getLanguage());
|
||||
TShader::ForbidIncluder includer;
|
||||
bool success = CompileDeferred(compiler, shaderStrings, numStrings, inputLengths, NULL, "", optLevel, resources, defaultVersion, ENoProfile, false,
|
||||
bool success = CompileDeferred(compiler, shaderStrings, numStrings, inputLengths, NULL,
|
||||
"", optLevel, resources, defaultVersion, ENoProfile, false,
|
||||
forwardCompatible, messages, intermediate, includer);
|
||||
|
||||
//
|
||||
// Call the machine dependent compiler
|
||||
if ( success
|
||||
&& intermediate.getTreeRoot()
|
||||
&& optLevel != EShOptNoGeneration)
|
||||
success = compiler->compile(intermediate.getTreeRoot(),
|
||||
intermediate.getVersion(), intermediate.getProfile());
|
||||
//
|
||||
if (success && intermediate.getTreeRoot() && optLevel != EShOptNoGeneration)
|
||||
success = compiler->compile(intermediate.getTreeRoot(), intermediate.getVersion(), intermediate.getProfile());
|
||||
|
||||
intermediate.removeTree();
|
||||
|
||||
@ -1354,13 +1351,13 @@ int ShLinkExt(
|
||||
|
||||
THandleList cObjects;
|
||||
|
||||
for (int i = 0; i < numHandles; ++i)
|
||||
{
|
||||
for (int i = 0; i < numHandles; ++i) {
|
||||
if (compHandles[i] == 0)
|
||||
return 0;
|
||||
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(compHandles[i]);
|
||||
if (base->getAsLinker())
|
||||
if (base->getAsLinker()) {
|
||||
cObjects.push_back(base->getAsLinker());
|
||||
}
|
||||
if (base->getAsCompiler())
|
||||
cObjects.push_back(base->getAsCompiler());
|
||||
|
||||
@ -1378,28 +1375,33 @@ int ShLinkExt(
|
||||
|
||||
linker->infoSink.info.erase();
|
||||
|
||||
for (int i = 0; i < numHandles; ++i)
|
||||
{
|
||||
if (cObjects[i]->getAsCompiler())
|
||||
{
|
||||
if (! cObjects[i]->getAsCompiler()->linkable())
|
||||
{
|
||||
for (int i = 0; i < numHandles; ++i) {
|
||||
if (cObjects[i]->getAsCompiler()) {
|
||||
if (! cObjects[i]->getAsCompiler()->linkable()) {
|
||||
linker->infoSink.info.message(EPrefixError, "Not all shaders have valid object code.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return linker->link(cObjects) ? 1 : 0;
|
||||
bool ret = linker->link(cObjects);
|
||||
|
||||
return ret ? 1 : 0;
|
||||
}
|
||||
|
||||
//
|
||||
// ShSetEncrpytionMethod is a place-holder for specifying
|
||||
// how source code is encrypted.
|
||||
//
|
||||
void ShSetEncryptionMethod(ShHandle handle) { }
|
||||
void ShSetEncryptionMethod(ShHandle handle)
|
||||
{
|
||||
if (handle == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Return any compiler/linker/uniformmap log of messages for the application.
|
||||
//
|
||||
const char* ShGetInfoLog(const ShHandle handle)
|
||||
{
|
||||
if (handle == 0)
|
||||
@ -1534,19 +1536,30 @@ namespace glslang {
|
||||
#define QUOTE(s) #s
|
||||
#define STR(n) QUOTE(n)
|
||||
|
||||
const char* GetEsslVersionString(void)
|
||||
const char* GetEsslVersionString()
|
||||
{
|
||||
return "OpenGL ES GLSL 3.20 glslang Khronos. " STR(GLSLANG_MINOR_VERSION) "." STR(GLSLANG_PATCH_LEVEL);
|
||||
}
|
||||
|
||||
const char* GetGlslVersionString(void)
|
||||
const char* GetGlslVersionString()
|
||||
{
|
||||
return "4.60 glslang Khronos. " STR(GLSLANG_MINOR_VERSION) "." STR(GLSLANG_PATCH_LEVEL);
|
||||
}
|
||||
|
||||
int GetKhronosToolId(void) { return 8; }
|
||||
bool InitializeProcess(void) { return ShInitialize() != 0; }
|
||||
void FinalizeProcess(void) { ShFinalize(); }
|
||||
int GetKhronosToolId()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
bool InitializeProcess()
|
||||
{
|
||||
return ShInitialize() != 0;
|
||||
}
|
||||
|
||||
void FinalizeProcess()
|
||||
{
|
||||
ShFinalize();
|
||||
}
|
||||
|
||||
class TDeferredCompiler : public TCompiler {
|
||||
public:
|
||||
@ -1585,8 +1598,7 @@ void TShader::setStrings(const char* const* s, int n)
|
||||
lengths = NULL;
|
||||
}
|
||||
|
||||
void TShader::setStringsWithLengths(
|
||||
const char* const* s, const int* l, int n)
|
||||
void TShader::setStringsWithLengths(const char* const* s, const int* l, int n)
|
||||
{
|
||||
strings = s;
|
||||
numStrings = n;
|
||||
@ -1659,9 +1671,7 @@ void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode
|
||||
//
|
||||
// Returns true for success.
|
||||
//
|
||||
bool TShader::parse(const TBuiltInResource* builtInResources,
|
||||
int defaultVersion, EProfile defaultProfile,
|
||||
bool forceDefaultVersionAndProfile,
|
||||
bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile,
|
||||
bool forwardCompatible, EShMessages messages, Includer& includer)
|
||||
{
|
||||
if (! InitThread())
|
||||
@ -1694,20 +1704,18 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources,
|
||||
if (! preamble)
|
||||
preamble = "";
|
||||
|
||||
return PreprocessDeferred(
|
||||
compiler, strings, numStrings, lengths, stringNames, preamble,
|
||||
return PreprocessDeferred(compiler, strings, numStrings, lengths, stringNames, preamble,
|
||||
EShOptNone, builtInResources, defaultVersion,
|
||||
defaultProfile, forceDefaultVersionAndProfile,
|
||||
forwardCompatible, message, includer,
|
||||
*intermediate, output_string);
|
||||
forwardCompatible, message, includer, *intermediate, output_string);
|
||||
}
|
||||
|
||||
const char* TShader::getInfoLog(void)
|
||||
const char* TShader::getInfoLog()
|
||||
{
|
||||
return infoSink->info.c_str();
|
||||
}
|
||||
|
||||
const char* TShader::getInfoDebugLog(void)
|
||||
const char* TShader::getInfoDebugLog()
|
||||
{
|
||||
return infoSink->debug.c_str();
|
||||
}
|
||||
@ -1716,8 +1724,7 @@ TProgram::TProgram() : reflection(0), ioMapper(NULL), linked(false)
|
||||
{
|
||||
pool = new TPoolAllocator;
|
||||
infoSink = new TInfoSink;
|
||||
for (int s = 0; s < EShLangCount; ++s)
|
||||
{
|
||||
for (int s = 0; s < EShLangCount; ++s) {
|
||||
intermediate[s] = 0;
|
||||
newedIntermediate[s] = false;
|
||||
}
|
||||
@ -1781,32 +1788,28 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
|
||||
numNonEsShaders++;
|
||||
}
|
||||
|
||||
if (numEsShaders > 0 && numNonEsShaders > 0)
|
||||
{
|
||||
if (numEsShaders > 0 && numNonEsShaders > 0) {
|
||||
infoSink->info.message(EPrefixError, "Cannot mix ES profile with non-ES profile shaders");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (numEsShaders > 1)
|
||||
{
|
||||
} else if (numEsShaders > 1) {
|
||||
infoSink->info.message(EPrefixError, "Cannot attach multiple ES shaders of the same type to a single program");
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Be efficient for the common single compilation unit per stage case,
|
||||
// reusing it's TIntermediate instead of merging into a new one.
|
||||
//
|
||||
TIntermediate *firstIntermediate = stages[stage].front()->intermediate;
|
||||
if (stages[stage].size() == 1)
|
||||
intermediate[stage] = firstIntermediate;
|
||||
else
|
||||
{
|
||||
else {
|
||||
intermediate[stage] = new TIntermediate(stage,
|
||||
firstIntermediate->getVersion(),
|
||||
firstIntermediate->getProfile());
|
||||
|
||||
|
||||
// The new TIntermediate must use the same
|
||||
// origin as the original TIntermediates.
|
||||
// The new TIntermediate must use the same origin as the original TIntermediates.
|
||||
// Otherwise linking will fail due to different coordinate systems.
|
||||
if (firstIntermediate->getOriginUpperLeft())
|
||||
intermediate[stage]->setOriginUpperLeft();
|
||||
@ -1853,10 +1856,8 @@ bool TProgram::buildReflection(void)
|
||||
|
||||
reflection = new TReflection;
|
||||
|
||||
for (int s = 0; s < EShLangCount; ++s)
|
||||
{
|
||||
if (intermediate[s])
|
||||
{
|
||||
for (int s = 0; s < EShLangCount; ++s) {
|
||||
if (intermediate[s]) {
|
||||
if (! reflection->addStage((EShLanguage)s, *intermediate[s]))
|
||||
return false;
|
||||
}
|
||||
@ -1894,10 +1895,8 @@ bool TProgram::mapIO(TIoMapResolver* resolver)
|
||||
|
||||
ioMapper = new TIoMapper;
|
||||
|
||||
for (int s = 0; s < EShLangCount; ++s)
|
||||
{
|
||||
if (intermediate[s])
|
||||
{
|
||||
for (int s = 0; s < EShLangCount; ++s) {
|
||||
if (intermediate[s]) {
|
||||
if (! ioMapper->addStage((EShLanguage)s, *intermediate[s], *infoSink, resolver))
|
||||
return false;
|
||||
}
|
||||
|
@ -173,8 +173,9 @@ void TType::buildMangledName(TString& mangledName) const
|
||||
void TVariable::dump(TInfoSink& infoSink) const
|
||||
{
|
||||
infoSink.debug << getName().c_str() << ": " << type.getStorageQualifierString() << " " << type.getBasicTypeString();
|
||||
if (type.isArray())
|
||||
if (type.isArray()) {
|
||||
infoSink.debug << "[0]";
|
||||
}
|
||||
infoSink.debug << "\n";
|
||||
}
|
||||
|
||||
@ -298,13 +299,15 @@ TVariable::TVariable(const TVariable& copyOf) : TSymbol(copyOf)
|
||||
|
||||
TVariable* TVariable::clone() const
|
||||
{
|
||||
return new TVariable(*this);
|
||||
TVariable *variable = new TVariable(*this);
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf)
|
||||
{
|
||||
for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {
|
||||
TParameter param = {};
|
||||
TParameter param;
|
||||
parameters.push_back(param);
|
||||
parameters.back().copyParam(copyOf.parameters[i]);
|
||||
}
|
||||
|
@ -129,8 +129,10 @@ protected:
|
||||
int numExtensions;
|
||||
const char** extensions; // an array of pointers to existing constant char strings
|
||||
|
||||
//
|
||||
// N.B.: Non-const functions that will be generally used should assert on this,
|
||||
// to avoid overwriting shared symbol-table information.
|
||||
//
|
||||
bool writable;
|
||||
};
|
||||
|
||||
@ -398,6 +400,7 @@ public:
|
||||
// Only supporting amend of anonymous blocks so far.
|
||||
if (IsAnonymous(symbol.getName()))
|
||||
return insertAnonymousMembers(symbol, firstNewMember);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -418,6 +421,7 @@ public:
|
||||
tLevel::const_iterator it = level.find(name);
|
||||
if (it == level.end())
|
||||
return 0;
|
||||
else
|
||||
return (*it).second;
|
||||
}
|
||||
|
||||
@ -529,8 +533,12 @@ protected:
|
||||
|
||||
class TSymbolTable {
|
||||
public:
|
||||
TSymbolTable() : uniqueId(0), noBuiltInRedeclarations(false), separateNameSpaces(false), adoptedLevels(0)
|
||||
{
|
||||
//
|
||||
// This symbol table cannot be used until push() is called.
|
||||
TSymbolTable() : uniqueId(0), noBuiltInRedeclarations(false), separateNameSpaces(false), adoptedLevels(0) { }
|
||||
//
|
||||
}
|
||||
~TSymbolTable()
|
||||
{
|
||||
// this can be called explicitly; safest to code it so it can be called multiple times
|
||||
@ -669,9 +677,11 @@ public:
|
||||
table[globalLevel]->insert(*copy, separateNameSpaces);
|
||||
if (shared->getAsVariable())
|
||||
return copy;
|
||||
else {
|
||||
// return the copy of the anonymous member
|
||||
return table[globalLevel]->find(shared->getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Normal find of a symbol, that can optionally say whether the symbol was found
|
||||
// at a built-in level or the current top-scope level.
|
||||
|
@ -253,26 +253,27 @@ struct TResolverUniformAdaptor
|
||||
ent.newBinding = -1;
|
||||
ent.newSet = -1;
|
||||
ent.newIndex = -1;
|
||||
const bool isValid = resolver.validateBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live);
|
||||
|
||||
if (isValid)
|
||||
{
|
||||
ent.newBinding = resolver.resolveBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live);
|
||||
const bool isValid = resolver.validateBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(),
|
||||
ent.live);
|
||||
if (isValid) {
|
||||
ent.newBinding = resolver.resolveBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(),
|
||||
ent.live);
|
||||
ent.newSet = resolver.resolveSet(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live);
|
||||
ent.newLocation = resolver.resolveUniformLocation(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live);
|
||||
ent.newLocation = resolver.resolveUniformLocation(stage, ent.symbol->getName().c_str(),
|
||||
ent.symbol->getType(), ent.live);
|
||||
|
||||
if (ent.newBinding != -1) {
|
||||
if (ent.newBinding >= int(TQualifier::layoutBindingEnd)) {
|
||||
TString err = "mapped binding out of range: "
|
||||
+ ent.symbol->getName();
|
||||
TString err = "mapped binding out of range: " + ent.symbol->getName();
|
||||
|
||||
infoSink.info.message(EPrefixInternalError, err.c_str());
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
if (ent.newSet != -1) {
|
||||
if (ent.newSet >= int(TQualifier::layoutSetEnd)) {
|
||||
TString err = "mapped set out of range: "
|
||||
+ ent.symbol->getName();
|
||||
TString err = "mapped set out of range: " + ent.symbol->getName();
|
||||
|
||||
infoSink.info.message(EPrefixInternalError, err.c_str());
|
||||
error = true;
|
||||
}
|
||||
@ -329,9 +330,7 @@ struct TResolverInOutAdaptor
|
||||
ent.symbol->getName().c_str(),
|
||||
ent.symbol->getType(),
|
||||
ent.live);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
TString errorMsg = "Invalid shader In/Out variable semantic: ";
|
||||
errorMsg += ent.symbol->getType().getQualifier().semanticName;
|
||||
infoSink.info.message(EPrefixInternalError, errorMsg.c_str());
|
||||
@ -360,33 +359,37 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
{ }
|
||||
|
||||
int getBaseBinding(TResourceType res, unsigned int set) const {
|
||||
// Return descriptor set specific base if
|
||||
// there is one, and the generic base otherwise.
|
||||
int base = intermediate.getShiftBinding(res);
|
||||
int descriptorSetBase = intermediate.getShiftBindingForSet(res, set);
|
||||
return descriptorSetBase != -1 ? descriptorSetBase : base;
|
||||
return selectBaseBinding(intermediate.getShiftBinding(res),
|
||||
intermediate.getShiftBindingForSet(res, set));
|
||||
}
|
||||
|
||||
const std::vector<std::string>& getResourceSetBinding() const { return intermediate.getResourceSetBinding(); }
|
||||
|
||||
bool doAutoBindingMapping() const { return intermediate.getAutoMapBindings(); }
|
||||
bool doAutoLocationMapping() const { return intermediate.getAutoMapLocations(); }
|
||||
|
||||
typedef std::vector<int> TSlotSet;
|
||||
typedef std::unordered_map<int, TSlotSet> TSlotSetMap;
|
||||
TSlotSetMap slots;
|
||||
|
||||
TSlotSet::iterator findSlot(int set, int slot)
|
||||
{
|
||||
return std::lower_bound(slots[set].begin(), slots[set].end(), slot);
|
||||
}
|
||||
|
||||
bool checkEmpty(int set, int slot)
|
||||
{
|
||||
TSlotSet::iterator at = std::lower_bound(slots[set].begin(), slots[set].end(), slot);
|
||||
TSlotSet::iterator at = findSlot(set, slot);
|
||||
return !(at != slots[set].end() && *at == slot);
|
||||
}
|
||||
|
||||
int reserveSlot(int set, int slot, int size = 1)
|
||||
{
|
||||
TSlotSet::iterator at = std::lower_bound(slots[set].begin(), slots[set].end(), slot);
|
||||
TSlotSet::iterator at = findSlot(set, slot);
|
||||
|
||||
// tolerate aliasing, by not double-recording aliases
|
||||
// (policy about appropriateness of the alias is higher up)
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (at == slots[set].end() || *at != slot + i)
|
||||
at = slots[set].insert(at, slot + i);
|
||||
++at;
|
||||
@ -397,13 +400,12 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
|
||||
int getFreeSlot(int set, int base, int size = 1)
|
||||
{
|
||||
TSlotSet::iterator at = std::lower_bound(slots[set].begin(), slots[set].end(), base);
|
||||
TSlotSet::iterator at = findSlot(set, base);
|
||||
if (at == slots[set].end())
|
||||
return reserveSlot(set, base, size);
|
||||
|
||||
// look for a big enough gap
|
||||
for (; at != slots[set].end(); ++at)
|
||||
{
|
||||
for (; at != slots[set].end(); ++at) {
|
||||
if (*at - base >= size)
|
||||
break;
|
||||
base = *at + 1;
|
||||
@ -415,7 +417,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
|
||||
virtual int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override = 0;
|
||||
|
||||
int resolveSet(EShLanguage stage, const char* name, const glslang::TType& type, bool is_live) override
|
||||
int resolveSet(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
|
||||
{
|
||||
if (type.getQualifier().hasSet())
|
||||
return type.getQualifier().layoutSet;
|
||||
@ -426,24 +428,21 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
|
||||
return 0;
|
||||
}
|
||||
int resolveUniformLocation(EShLanguage stage, const char* name, const glslang::TType& type, bool is_live) override
|
||||
int resolveUniformLocation(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
|
||||
{
|
||||
// kick out of not doing this
|
||||
if (!intermediate.getAutoMapLocations())
|
||||
if (!doAutoLocationMapping())
|
||||
return -1;
|
||||
|
||||
// no locations added if already present,
|
||||
// a built-in variable, a block, or an opaque
|
||||
if ( type.getQualifier().hasLocation()
|
||||
|| type.isBuiltIn()
|
||||
|| type.getBasicType() == EbtBlock
|
||||
|| type.getBasicType() == EbtAtomicUint
|
||||
|| (type.containsOpaque() && intermediate.getSpv().openGl == 0))
|
||||
// no locations added if already present, a built-in variable, a block, or an opaque
|
||||
if (type.getQualifier().hasLocation() || type.isBuiltIn() ||
|
||||
type.getBasicType() == EbtBlock ||
|
||||
type.getBasicType() == EbtAtomicUint ||
|
||||
(type.containsOpaque() && intermediate.getSpv().openGl == 0))
|
||||
return -1;
|
||||
|
||||
// no locations on blocks of built-in variables
|
||||
if (type.isStruct())
|
||||
{
|
||||
if (type.isStruct()) {
|
||||
if (type.getStruct()->size() < 1)
|
||||
return -1;
|
||||
if ((*type.getStruct())[0].type->isBuiltIn())
|
||||
@ -456,16 +455,14 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
bool validateInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) override
|
||||
bool validateInOut(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int resolveInOutLocation(EShLanguage stage, const char* name, const TType& type, bool is_live) override
|
||||
int resolveInOutLocation(EShLanguage stage, const char* /*name*/, const TType& type, bool /*is_live*/) override
|
||||
{
|
||||
// kick out of not doing this
|
||||
if (!intermediate.getAutoMapLocations())
|
||||
if (!doAutoLocationMapping())
|
||||
return -1;
|
||||
|
||||
// no locations added if already present, or a built-in variable
|
||||
@ -473,8 +470,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
return -1;
|
||||
|
||||
// no locations on blocks of built-in variables
|
||||
if (type.isStruct())
|
||||
{
|
||||
if (type.isStruct()) {
|
||||
if (type.getStruct()->size() < 1)
|
||||
return -1;
|
||||
if ((*type.getStruct())[0].type->isBuiltIn())
|
||||
@ -490,30 +486,27 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
|
||||
int typeLocationSize;
|
||||
// Don’t take into account the outer-most array if the stage’s
|
||||
// interface is automatically an array.
|
||||
if (type.getQualifier().isArrayedIo(stage))
|
||||
{
|
||||
if (type.getQualifier().isArrayedIo(stage)) {
|
||||
TType elementType(type, 0);
|
||||
typeLocationSize = TIntermediate::computeTypeLocationSize(elementType, stage);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
typeLocationSize = TIntermediate::computeTypeLocationSize(type, stage);
|
||||
}
|
||||
nextLocation += typeLocationSize;
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
int resolveInOutComponent(EShLanguage stage, const char* name, const TType& type, bool is_live) override
|
||||
int resolveInOutComponent(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int resolveInOutIndex(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int resolveInOutIndex(EShLanguage stage, const char* name, const TType& type, bool is_live) override
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void notifyBinding(EShLanguage, const char* name, const TType&, bool is_live) override {}
|
||||
void notifyInOut(EShLanguage, const char* name, const TType&, bool is_live) override {}
|
||||
void notifyBinding(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {}
|
||||
void notifyInOut(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {}
|
||||
void endNotifications(EShLanguage) override {}
|
||||
void beginNotifications(EShLanguage) override {}
|
||||
void beginResolve(EShLanguage) override {}
|
||||
@ -525,10 +518,30 @@ protected:
|
||||
int nextInputLocation;
|
||||
int nextOutputLocation;
|
||||
|
||||
// Return descriptor set specific base if there is one, and the generic base otherwise.
|
||||
int selectBaseBinding(int base, int descriptorSetBase) const {
|
||||
return descriptorSetBase != -1 ? descriptorSetBase : base;
|
||||
}
|
||||
|
||||
static int getLayoutSet(const glslang::TType& type) {
|
||||
if (type.getQualifier().hasSet())
|
||||
return type.getQualifier().layoutSet;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool isSamplerType(const glslang::TType& type) {
|
||||
return type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler();
|
||||
}
|
||||
|
||||
static bool isTextureType(const glslang::TType& type) {
|
||||
return (type.getBasicType() == glslang::EbtSampler &&
|
||||
(type.getSampler().isTexture() || type.getSampler().isSubpass()));
|
||||
}
|
||||
|
||||
static bool isUboType(const glslang::TType& type) {
|
||||
return type.getQualifier().storage == EvqUniform;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
@ -545,57 +558,63 @@ struct TDefaultIoResolver : public TDefaultIoResolverBase
|
||||
{
|
||||
TDefaultIoResolver(const TIntermediate &intermediate) : TDefaultIoResolverBase(intermediate) { }
|
||||
|
||||
bool validateBinding(EShLanguage stage, const char* name, const glslang::TType& type, bool is_live) override
|
||||
bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& /*type*/, bool /*is_live*/) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int resolveBinding(EShLanguage stage, const char* name, const glslang::TType& type, bool is_live) override
|
||||
int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override
|
||||
{
|
||||
const int set = (type.getQualifier().hasSet()) ? type.getQualifier().layoutSet : 0;
|
||||
const int set = getLayoutSet(type);
|
||||
// On OpenGL arrays of opaque types take a seperate binding for each element
|
||||
int numBindings = intermediate.getSpv().openGl != 0 && type.isSizedArray() ? type.getCumulativeArraySize() : 1;
|
||||
|
||||
if (type.getQualifier().hasBinding())
|
||||
{
|
||||
if (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage())
|
||||
if (type.getQualifier().hasBinding()) {
|
||||
if (isImageType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResImage, set) + type.getQualifier().layoutBinding, numBindings);
|
||||
|
||||
if (isTextureType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding, numBindings);
|
||||
|
||||
if (type.getQualifier().storage == EvqBuffer)
|
||||
if (isSsboType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResSsbo, set) + type.getQualifier().layoutBinding, numBindings);
|
||||
|
||||
if (type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler())
|
||||
if (isSamplerType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding, numBindings);
|
||||
|
||||
if (type.getQualifier().storage == EvqUniform)
|
||||
if (isUboType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding, numBindings);
|
||||
}
|
||||
else if (is_live && intermediate.getAutoMapBindings())
|
||||
{
|
||||
} else if (is_live && doAutoBindingMapping()) {
|
||||
// find free slot, the caller did make sure it passes all vars with binding
|
||||
// first and now all are passed that do not have a binding and needs one
|
||||
|
||||
if (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage())
|
||||
if (isImageType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResImage, set), numBindings);
|
||||
|
||||
if (isTextureType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResTexture, set), numBindings);
|
||||
|
||||
if (type.getQualifier().storage == EvqBuffer)
|
||||
if (isSsboType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResSsbo, set), numBindings);
|
||||
|
||||
if (type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler())
|
||||
if (isSamplerType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResSampler, set), numBindings);
|
||||
|
||||
if (type.getQualifier().storage == EvqUniform)
|
||||
if (isUboType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResUbo, set), numBindings);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected:
|
||||
static bool isImageType(const glslang::TType& type) {
|
||||
return type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage();
|
||||
}
|
||||
|
||||
static bool isSsboType(const glslang::TType& type) {
|
||||
return type.getQualifier().storage == EvqBuffer;
|
||||
}
|
||||
};
|
||||
|
||||
/********************************************************************************
|
||||
@ -652,37 +671,34 @@ struct TDefaultHlslIoResolver : public TDefaultIoResolverBase
|
||||
|
||||
int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override
|
||||
{
|
||||
const int set = (type.getQualifier().hasSet()) ? type.getQualifier().layoutSet : 0;
|
||||
const int set = getLayoutSet(type);
|
||||
|
||||
if (type.getQualifier().hasBinding())
|
||||
{
|
||||
if (type.getQualifier().hasBinding()) {
|
||||
if (isUavType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResUav, set) + type.getQualifier().layoutBinding);
|
||||
|
||||
if (isTextureType(type) || type.getQualifier().storage == EvqBuffer)
|
||||
if (isSrvType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding);
|
||||
|
||||
if (type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler())
|
||||
if (isSamplerType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding);
|
||||
|
||||
if (type.getQualifier().storage == EvqUniform)
|
||||
if (isUboType(type))
|
||||
return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding);
|
||||
}
|
||||
else if (is_live && intermediate.getAutoMapBindings())
|
||||
{
|
||||
} else if (is_live && doAutoBindingMapping()) {
|
||||
// find free slot, the caller did make sure it passes all vars with binding
|
||||
// first and now all are passed that do not have a binding and needs one
|
||||
|
||||
if (isUavType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResUav, set));
|
||||
|
||||
if (isTextureType(type) || type.getQualifier().storage == EvqBuffer)
|
||||
if (isSrvType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResTexture, set));
|
||||
|
||||
if (type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler())
|
||||
if (isSamplerType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResSampler, set));
|
||||
|
||||
if (type.getQualifier().storage == EvqUniform)
|
||||
if (isUboType(type))
|
||||
return getFreeSlot(set, getBaseBinding(EResUbo, set));
|
||||
}
|
||||
|
||||
@ -690,13 +706,18 @@ struct TDefaultHlslIoResolver : public TDefaultIoResolverBase
|
||||
}
|
||||
|
||||
protected:
|
||||
// Return true if this is a SRV (shader resource view) type:
|
||||
static bool isSrvType(const glslang::TType& type) {
|
||||
return isTextureType(type) || type.getQualifier().storage == EvqBuffer;
|
||||
}
|
||||
|
||||
// Return true if this is a UAV (unordered access view) type:
|
||||
static bool isUavType(const glslang::TType& type) {
|
||||
if (type.getQualifier().readonly)
|
||||
return false;
|
||||
return ( type.getBasicType() == glslang::EbtSampler
|
||||
&& type.getSampler().isImage())
|
||||
|| (type.getQualifier().storage == EvqBuffer);
|
||||
|
||||
return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) ||
|
||||
(type.getQualifier().storage == EvqBuffer);
|
||||
}
|
||||
};
|
||||
|
||||
@ -707,16 +728,14 @@ protected:
|
||||
// Returns false if the input is too malformed to do this.
|
||||
bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSink &infoSink, TIoMapResolver *resolver)
|
||||
{
|
||||
bool somethingToDo =
|
||||
!intermediate.getResourceSetBinding().empty()
|
||||
|| intermediate.getAutoMapBindings()
|
||||
|| intermediate.getAutoMapLocations();
|
||||
bool somethingToDo = !intermediate.getResourceSetBinding().empty() ||
|
||||
intermediate.getAutoMapBindings() ||
|
||||
intermediate.getAutoMapLocations();
|
||||
|
||||
for (int res = 0; res < EResCount; ++res)
|
||||
{
|
||||
somethingToDo = somethingToDo
|
||||
|| (intermediate.getShiftBinding(TResourceType(res)) != 0)
|
||||
|| intermediate.hasShiftBindingForSet(TResourceType(res));
|
||||
for (int res = 0; res < EResCount; ++res) {
|
||||
somethingToDo = somethingToDo ||
|
||||
(intermediate.getShiftBinding(TResourceType(res)) != 0) ||
|
||||
intermediate.hasShiftBindingForSet(TResourceType(res));
|
||||
}
|
||||
|
||||
if (!somethingToDo && resolver == NULL)
|
||||
|
@ -267,7 +267,7 @@ public:
|
||||
shiftBinding[res] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name)
|
||||
if (name != NULL)
|
||||
processes.addIfNonZero(name, shift);
|
||||
}
|
||||
|
||||
|
@ -104,9 +104,10 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
_parseContext.ppError(ppToken->loc, "must be followed by macro name", "#define", "");
|
||||
return token;
|
||||
}
|
||||
if (ppToken->loc.string >= 0) {
|
||||
// We are in user code; check for reserved name use:
|
||||
if (ppToken->loc.string >= 0)
|
||||
_parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#define");
|
||||
}
|
||||
|
||||
// save the macro name
|
||||
const int defAtom = atomStrings.getAddAtom(ppToken->name);
|
||||
@ -119,22 +120,18 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
token = scanToken(ppToken);
|
||||
if (mac.args.size() == 0 && token == ')')
|
||||
break;
|
||||
if (token != PpAtomIdentifier)
|
||||
{
|
||||
if (token != PpAtomIdentifier) {
|
||||
_parseContext.ppError(ppToken->loc, "bad argument", "#define", "");
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
mac.emptyArgs = 0;
|
||||
const int argAtom = atomStrings.getAddAtom(ppToken->name);
|
||||
|
||||
// check for duplication of parameter name
|
||||
bool duplicate = false;
|
||||
for (size_t a = 0; a < mac.args.size(); ++a)
|
||||
{
|
||||
if (mac.args[a] == argAtom)
|
||||
{
|
||||
for (size_t a = 0; a < mac.args.size(); ++a) {
|
||||
if (mac.args[a] == argAtom) {
|
||||
_parseContext.ppError(ppToken->loc, "duplicate macro parameter", "#define", "");
|
||||
duplicate = true;
|
||||
break;
|
||||
@ -144,9 +141,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
mac.args.push_back(argAtom);
|
||||
token = scanToken(ppToken);
|
||||
} while (token == ',');
|
||||
|
||||
if (token != ')')
|
||||
{
|
||||
if (token != ')') {
|
||||
_parseContext.ppError(ppToken->loc, "missing parenthesis", "#define", "");
|
||||
|
||||
return token;
|
||||
@ -157,8 +152,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
|
||||
// record the definition of the macro
|
||||
TSourceLoc defineLoc = ppToken->loc; // because ppToken is going to go to the next line before we report errors
|
||||
while (token != '\n' && token != EndOfInput)
|
||||
{
|
||||
while (token != '\n' && token != EndOfInput) {
|
||||
mac.body.putToken(token, ppToken);
|
||||
token = scanToken(ppToken);
|
||||
if (token != '\n' && ppToken->space)
|
||||
@ -167,17 +161,14 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
|
||||
// check for duplicate definition
|
||||
MacroSymbol* existing = lookupMacroDef(defAtom);
|
||||
if (existing != NULL)
|
||||
{
|
||||
if (! existing->undef)
|
||||
{
|
||||
if (existing != NULL) {
|
||||
if (! existing->undef) {
|
||||
// Already defined -- need to make sure they are identical:
|
||||
// "Two replacement lists are identical if and only if the preprocessing tokens in both have the same number,
|
||||
// ordering, spelling, and white-space separation, where all white-space separations are considered identical."
|
||||
if (existing->args.size() != mac.args.size() || existing->emptyArgs != mac.emptyArgs)
|
||||
_parseContext.ppError(defineLoc, "Macro redefined; different number of arguments:", "#define", atomStrings.getString(defAtom));
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (existing->args != mac.args)
|
||||
_parseContext.ppError(defineLoc, "Macro redefined; different argument names:", "#define", atomStrings.getString(defAtom));
|
||||
existing->body.reset();
|
||||
@ -189,8 +180,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
TPpToken newPpToken;
|
||||
oldToken = existing->body.getToken(_parseContext, &oldPpToken);
|
||||
newToken = mac.body.getToken(_parseContext, &newPpToken);
|
||||
if (oldToken != newToken || oldPpToken != newPpToken)
|
||||
{
|
||||
if (oldToken != newToken || oldPpToken != newPpToken) {
|
||||
_parseContext.ppError(defineLoc, "Macro redefined; different substitutions:", "#define", atomStrings.getString(defAtom));
|
||||
break;
|
||||
}
|
||||
@ -208,8 +198,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
int TPpContext::CPPundef(TPpToken* ppToken)
|
||||
{
|
||||
int token = scanToken(ppToken);
|
||||
if (token != PpAtomIdentifier)
|
||||
{
|
||||
if (token != PpAtomIdentifier) {
|
||||
_parseContext.ppError(ppToken->loc, "must be followed by macro name", "#undef", "");
|
||||
|
||||
return token;
|
||||
@ -218,7 +207,7 @@ int TPpContext::CPPundef(TPpToken* ppToken)
|
||||
_parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#undef");
|
||||
|
||||
MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name));
|
||||
if (macro)
|
||||
if (macro != NULL)
|
||||
macro->undef = 1;
|
||||
token = scanToken(ppToken);
|
||||
if (token != '\n')
|
||||
@ -237,10 +226,8 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
||||
int depth = 0;
|
||||
int token = scanToken(ppToken);
|
||||
|
||||
while (token != EndOfInput)
|
||||
{
|
||||
if (token != '#')
|
||||
{
|
||||
while (token != EndOfInput) {
|
||||
if (token != '#') {
|
||||
while (token != '\n' && token != EndOfInput)
|
||||
token = scanToken(ppToken);
|
||||
|
||||
@ -255,25 +242,20 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
||||
continue;
|
||||
|
||||
int nextAtom = atomStrings.getAtom(ppToken->name);
|
||||
if (nextAtom == PpAtomIf || nextAtom == PpAtomIfdef || nextAtom == PpAtomIfndef)
|
||||
{
|
||||
if (nextAtom == PpAtomIf || nextAtom == PpAtomIfdef || nextAtom == PpAtomIfndef) {
|
||||
depth++;
|
||||
if (ifdepth >= maxIfNesting || elsetracker >= maxIfNesting)
|
||||
{
|
||||
if (ifdepth >= maxIfNesting || elsetracker >= maxIfNesting) {
|
||||
_parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#if/#ifdef/#ifndef", "");
|
||||
return EndOfInput;
|
||||
}
|
||||
|
||||
} else {
|
||||
ifdepth++;
|
||||
elsetracker++;
|
||||
}
|
||||
else if (nextAtom == PpAtomEndif)
|
||||
{
|
||||
} else if (nextAtom == PpAtomEndif) {
|
||||
token = extraTokenCheck(nextAtom, ppToken, scanToken(ppToken));
|
||||
elseSeen[elsetracker] = false;
|
||||
--elsetracker;
|
||||
if (depth == 0)
|
||||
{
|
||||
if (depth == 0) {
|
||||
// found the #endif we are looking for
|
||||
if (ifdepth > 0)
|
||||
--ifdepth;
|
||||
@ -281,24 +263,18 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
||||
}
|
||||
--depth;
|
||||
--ifdepth;
|
||||
}
|
||||
else if (matchelse && depth == 0)
|
||||
{
|
||||
if (nextAtom == PpAtomElse)
|
||||
{
|
||||
} else if (matchelse && depth == 0) {
|
||||
if (nextAtom == PpAtomElse) {
|
||||
elseSeen[elsetracker] = true;
|
||||
token = extraTokenCheck(nextAtom, ppToken, scanToken(ppToken));
|
||||
// found the #else we are looking for
|
||||
break;
|
||||
}
|
||||
else if (nextAtom == PpAtomElif)
|
||||
{
|
||||
} else if (nextAtom == PpAtomElif) {
|
||||
if (elseSeen[elsetracker])
|
||||
_parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", "");
|
||||
/* we decrement ifdepth here, because CPPif will increment
|
||||
* it and we really want to leave it alone */
|
||||
if (ifdepth > 0)
|
||||
{
|
||||
if (ifdepth > 0) {
|
||||
--ifdepth;
|
||||
elseSeen[elsetracker] = false;
|
||||
--elsetracker;
|
||||
@ -306,17 +282,13 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
||||
|
||||
return CPPif(ppToken);
|
||||
}
|
||||
}
|
||||
else if (nextAtom == PpAtomElse)
|
||||
{
|
||||
} else if (nextAtom == PpAtomElse) {
|
||||
if (elseSeen[elsetracker])
|
||||
_parseContext.ppError(ppToken->loc, "#else after #else", "#else", "");
|
||||
else
|
||||
elseSeen[elsetracker] = true;
|
||||
token = extraTokenCheck(nextAtom, ppToken, scanToken(ppToken));
|
||||
}
|
||||
else if (nextAtom == PpAtomElif)
|
||||
{
|
||||
} else if (nextAtom == PpAtomElif) {
|
||||
if (elseSeen[elsetracker])
|
||||
_parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", "");
|
||||
}
|
||||
@ -328,9 +300,9 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
||||
// Call when there should be no more tokens left on a line.
|
||||
int TPpContext::extraTokenCheck(int contextAtom, TPpToken* ppToken, int token)
|
||||
{
|
||||
if (token != '\n' && token != EndOfInput)
|
||||
{
|
||||
if (token != '\n' && token != EndOfInput) {
|
||||
static const char* message = "unexpected tokens following directive";
|
||||
|
||||
const char* label;
|
||||
if (contextAtom == PpAtomElse)
|
||||
label = "#else";
|
||||
@ -593,24 +565,20 @@ int TPpContext::CPPif(TPpToken* ppToken)
|
||||
int TPpContext::CPPifdef(int defined, TPpToken* ppToken)
|
||||
{
|
||||
int token = scanToken(ppToken);
|
||||
if (ifdepth > maxIfNesting || elsetracker > maxIfNesting)
|
||||
{
|
||||
if (ifdepth > maxIfNesting || elsetracker > maxIfNesting) {
|
||||
_parseContext.ppError(ppToken->loc, "maximum nesting depth exceeded", "#ifdef", "");
|
||||
return EndOfInput;
|
||||
}
|
||||
|
||||
} else {
|
||||
elsetracker++;
|
||||
ifdepth++;
|
||||
}
|
||||
|
||||
if (token != PpAtomIdentifier)
|
||||
{
|
||||
if (token != PpAtomIdentifier) {
|
||||
if (defined)
|
||||
_parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifdef", "");
|
||||
else
|
||||
_parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifndef", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name));
|
||||
token = scanToken(ppToken);
|
||||
if (token != '\n') {
|
||||
@ -764,18 +732,18 @@ int TPpContext::CPPerror(TPpToken* ppToken)
|
||||
std::string message;
|
||||
TSourceLoc loc = ppToken->loc;
|
||||
|
||||
while (token != '\n' && token != EndOfInput)
|
||||
{
|
||||
while (token != '\n' && token != EndOfInput) {
|
||||
if (token == PpAtomConstInt16 || token == PpAtomConstUint16 ||
|
||||
token == PpAtomConstInt || token == PpAtomConstUint ||
|
||||
token == PpAtomConstInt64 || token == PpAtomConstUint64 ||
|
||||
token == PpAtomConstFloat16 ||
|
||||
token == PpAtomConstFloat || token == PpAtomConstDouble)
|
||||
token == PpAtomConstFloat || token == PpAtomConstDouble) {
|
||||
message.append(ppToken->name);
|
||||
else if (token == PpAtomIdentifier || token == PpAtomConstString)
|
||||
} else if (token == PpAtomIdentifier || token == PpAtomConstString) {
|
||||
message.append(ppToken->name);
|
||||
else
|
||||
} else {
|
||||
message.append(atomStrings.getString(token));
|
||||
}
|
||||
message.append(" ");
|
||||
token = scanToken(ppToken);
|
||||
}
|
||||
@ -839,8 +807,7 @@ int TPpContext::CPPversion(TPpToken* ppToken)
|
||||
}
|
||||
versionSeen = true;
|
||||
|
||||
if (token == '\n')
|
||||
{
|
||||
if (token == '\n') {
|
||||
_parseContext.ppError(ppToken->loc, "must be followed by version number", "#version", "");
|
||||
|
||||
return token;
|
||||
@ -854,13 +821,10 @@ int TPpContext::CPPversion(TPpToken* ppToken)
|
||||
int line = ppToken->loc.line;
|
||||
token = scanToken(ppToken);
|
||||
|
||||
if (token == '\n')
|
||||
{
|
||||
if (token == '\n') {
|
||||
_parseContext.notifyVersion(line, versionNumber, NULL);
|
||||
return token;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int profileAtom = atomStrings.getAtom(ppToken->name);
|
||||
if (profileAtom != PpAtomCore &&
|
||||
profileAtom != PpAtomCompatibility &&
|
||||
@ -871,6 +835,7 @@ int TPpContext::CPPversion(TPpToken* ppToken)
|
||||
|
||||
if (token == '\n')
|
||||
return token;
|
||||
else
|
||||
_parseContext.ppError(ppToken->loc, "bad tokens following profile -- expected newline", "#version", "");
|
||||
}
|
||||
|
||||
@ -895,15 +860,13 @@ int TPpContext::CPPextension(TPpToken* ppToken)
|
||||
strcpy(extensionName, ppToken->name);
|
||||
|
||||
token = scanToken(ppToken);
|
||||
if (token != ':')
|
||||
{
|
||||
if (token != ':') {
|
||||
_parseContext.ppError(ppToken->loc, "':' missing after extension name", "#extension", "");
|
||||
return token;
|
||||
}
|
||||
|
||||
token = scanToken(ppToken);
|
||||
if (token != PpAtomIdentifier)
|
||||
{
|
||||
if (token != PpAtomIdentifier) {
|
||||
_parseContext.ppError(ppToken->loc, "behavior for extension not specified", "#extension", "");
|
||||
return token;
|
||||
}
|
||||
@ -914,7 +877,7 @@ int TPpContext::CPPextension(TPpToken* ppToken)
|
||||
token = scanToken(ppToken);
|
||||
if (token == '\n')
|
||||
return token;
|
||||
|
||||
else
|
||||
_parseContext.ppError(ppToken->loc, "extra tokens -- expected newline", "#extension","");
|
||||
|
||||
return token;
|
||||
@ -1017,19 +980,16 @@ int TPpContext::scanHeaderName(TPpToken* ppToken, char delimit)
|
||||
|
||||
int len = 0;
|
||||
ppToken->name[0] = '\0';
|
||||
for (;;)
|
||||
{
|
||||
do {
|
||||
int ch = inputStack.back()->getch();
|
||||
|
||||
// done yet?
|
||||
if (ch == delimit)
|
||||
{
|
||||
if (ch == delimit) {
|
||||
ppToken->name[len] = '\0';
|
||||
if (tooLong)
|
||||
_parseContext.ppError(ppToken->loc, "header name too long", "", "");
|
||||
return PpAtomConstString;
|
||||
}
|
||||
else if (ch == EndOfInput)
|
||||
} else if (ch == EndOfInput)
|
||||
return EndOfInput;
|
||||
|
||||
// found a character to expand the name with
|
||||
@ -1037,7 +997,7 @@ int TPpContext::scanHeaderName(TPpToken* ppToken, char delimit)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
else
|
||||
tooLong = true;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
// Macro-expand a macro argument 'arg' to create 'expandedArg'.
|
||||
@ -1050,8 +1010,7 @@ TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream& arg, TPpToken*
|
||||
pushInput(new tMarkerInput(this));
|
||||
pushTokenStreamInput(arg);
|
||||
int token;
|
||||
while ((token = scanToken(ppToken)) != tMarkerInput::marker && token != EndOfInput)
|
||||
{
|
||||
while ((token = scanToken(ppToken)) != tMarkerInput::marker && token != EndOfInput) {
|
||||
token = tokenPaste(token, *ppToken);
|
||||
if (token == tMarkerInput::marker || token == EndOfInput)
|
||||
break;
|
||||
@ -1060,14 +1019,14 @@ TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream& arg, TPpToken*
|
||||
expandedArg->putToken(token, ppToken);
|
||||
}
|
||||
|
||||
if (token == EndOfInput)
|
||||
{
|
||||
if (token == EndOfInput) {
|
||||
// MacroExpand ate the marker, so had bad input, recover
|
||||
delete expandedArg;
|
||||
expandedArg = NULL;
|
||||
}
|
||||
else // remove the marker
|
||||
} else {
|
||||
// remove the marker
|
||||
popInput();
|
||||
}
|
||||
|
||||
return expandedArg;
|
||||
}
|
||||
@ -1097,15 +1056,13 @@ int TPpContext::tMacroInput::scan(TPpToken* ppToken)
|
||||
// corresponding argument's preprocessing token sequence."
|
||||
|
||||
bool pasting = false;
|
||||
if (postpaste)
|
||||
{
|
||||
if (postpaste) {
|
||||
// don't expand next token
|
||||
pasting = true;
|
||||
postpaste = false;
|
||||
}
|
||||
|
||||
if (prepaste)
|
||||
{
|
||||
if (prepaste) {
|
||||
// already know we should be on a ##, verify
|
||||
prepaste = false;
|
||||
postpaste = true;
|
||||
|
@ -164,8 +164,7 @@ TStringAtomMap::TStringAtomMap()
|
||||
char t[2];
|
||||
|
||||
t[1] = '\0';
|
||||
while (*s)
|
||||
{
|
||||
while (*s) {
|
||||
t[0] = *s;
|
||||
addAtomFixed(t, s[0]);
|
||||
s++;
|
||||
|
@ -334,6 +334,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||
return PpAtomConstDouble;
|
||||
else if (isFloat16)
|
||||
return PpAtomConstFloat16;
|
||||
else
|
||||
return PpAtomConstFloat;
|
||||
}
|
||||
|
||||
@ -348,9 +349,10 @@ int TPpContext::characterLiteral(TPpToken* ppToken)
|
||||
ppToken->name[0] = 0;
|
||||
ppToken->ival = 0;
|
||||
|
||||
if (_parseContext.intermediate.getSource() != EShSourceHlsl) {
|
||||
// illegal, except in macro definition, for which case we report the character
|
||||
if (_parseContext.intermediate.getSource() != EShSourceHlsl)
|
||||
return '\'';
|
||||
}
|
||||
|
||||
int ch = getChar();
|
||||
switch (ch) {
|
||||
@ -444,8 +446,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
ppToken->i64val = 0;
|
||||
ppToken->space = false;
|
||||
ch = getch();
|
||||
for (;;)
|
||||
{
|
||||
for (;;) {
|
||||
while (ch == ' ' || ch == '\t') {
|
||||
ppToken->space = true;
|
||||
ch = getch();
|
||||
@ -849,37 +850,49 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
}
|
||||
case '*':
|
||||
ch = getch();
|
||||
if (ch == '=')
|
||||
if (ch == '=') {
|
||||
return PPAtomMulAssign;
|
||||
} else {
|
||||
ungetch();
|
||||
return '*';
|
||||
}
|
||||
case '%':
|
||||
ch = getch();
|
||||
if (ch == '=')
|
||||
if (ch == '=') {
|
||||
return PPAtomModAssign;
|
||||
} else {
|
||||
ungetch();
|
||||
return '%';
|
||||
}
|
||||
case '^':
|
||||
ch = getch();
|
||||
if (ch == '^')
|
||||
if (ch == '^') {
|
||||
return PpAtomXor;
|
||||
} else {
|
||||
if (ch == '=')
|
||||
return PpAtomXorAssign;
|
||||
else{
|
||||
ungetch();
|
||||
return '^';
|
||||
}
|
||||
}
|
||||
|
||||
case '=':
|
||||
ch = getch();
|
||||
if (ch == '=')
|
||||
if (ch == '=') {
|
||||
return PpAtomEQ;
|
||||
} else {
|
||||
ungetch();
|
||||
return '=';
|
||||
}
|
||||
case '!':
|
||||
ch = getch();
|
||||
if (ch == '=')
|
||||
if (ch == '=') {
|
||||
return PpAtomNE;
|
||||
} else {
|
||||
ungetch();
|
||||
return '!';
|
||||
}
|
||||
case '|':
|
||||
ch = getch();
|
||||
if (ch == '|') {
|
||||
@ -1030,18 +1043,14 @@ int TPpContext::tokenize(TPpToken& ppToken)
|
||||
return EndOfInput;
|
||||
}
|
||||
if (token == '#') {
|
||||
if (previous_token == '\n')
|
||||
{
|
||||
if (previous_token == '\n') {
|
||||
token = readCPPline(&ppToken);
|
||||
if (token == EndOfInput)
|
||||
{
|
||||
if (token == EndOfInput) {
|
||||
missingEndifCheck();
|
||||
return EndOfInput;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_parseContext.ppError(ppToken.loc, "preprocessor directive cannot be preceded by another token", "#", "");
|
||||
return EndOfInput;
|
||||
}
|
||||
@ -1096,8 +1105,7 @@ int TPpContext::tokenize(TPpToken& ppToken)
|
||||
int TPpContext::tokenPaste(int token, TPpToken& ppToken)
|
||||
{
|
||||
// starting with ## is illegal, skip to next token
|
||||
if (token == PpAtomPaste)
|
||||
{
|
||||
if (token == PpAtomPaste) {
|
||||
_parseContext.ppError(ppToken.loc, "unexpected location", "##", "");
|
||||
return scanToken(&ppToken);
|
||||
}
|
||||
@ -1105,16 +1113,14 @@ int TPpContext::tokenPaste(int token, TPpToken& ppToken)
|
||||
int resultToken = token; // "foo" pasted with "35" is an identifier, not a number
|
||||
|
||||
// ## can be chained, process all in the chain at once
|
||||
while (peekPasting())
|
||||
{
|
||||
while (peekPasting()) {
|
||||
TPpToken pastedPpToken;
|
||||
|
||||
// next token has to be ##
|
||||
token = scanToken(&pastedPpToken);
|
||||
|
||||
// This covers end of macro expansion
|
||||
if (endOfReplacementList())
|
||||
{
|
||||
if (endOfReplacementList()) {
|
||||
_parseContext.ppError(ppToken.loc, "unexpected location; end of replacement list", "##", "");
|
||||
break;
|
||||
}
|
||||
@ -1129,8 +1135,7 @@ int TPpContext::tokenPaste(int token, TPpToken& ppToken)
|
||||
}
|
||||
|
||||
// get the token text
|
||||
switch (resultToken)
|
||||
{
|
||||
switch (resultToken) {
|
||||
case PpAtomIdentifier:
|
||||
// already have the correct text in token.names
|
||||
break;
|
||||
@ -1168,8 +1173,7 @@ int TPpContext::tokenPaste(int token, TPpToken& ppToken)
|
||||
strncat(ppToken.name, pastedPpToken.name, MaxTokenLength - strlen(ppToken.name));
|
||||
|
||||
// correct the kind of token we are making, if needed (identifiers stay identifiers)
|
||||
if (resultToken != PpAtomIdentifier)
|
||||
{
|
||||
if (resultToken != PpAtomIdentifier) {
|
||||
int newToken = atomStrings.getAtom(ppToken.name);
|
||||
if (newToken > 0)
|
||||
resultToken = newToken;
|
||||
|
@ -105,8 +105,7 @@ namespace {
|
||||
// be saved (restored)?
|
||||
bool SaveName(int atom)
|
||||
{
|
||||
switch (atom)
|
||||
{
|
||||
switch (atom) {
|
||||
case PpAtomIdentifier:
|
||||
case PpAtomConstString:
|
||||
case PpAtomConstInt:
|
||||
@ -122,17 +121,15 @@ namespace {
|
||||
case PpAtomConstFloat16:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// When recording (and playing back) should the numeric value
|
||||
// be saved (restored)?
|
||||
bool SaveValue(int atom)
|
||||
{
|
||||
switch (atom)
|
||||
{
|
||||
switch (atom) {
|
||||
case PpAtomConstInt:
|
||||
case PpAtomConstUint:
|
||||
case PpAtomConstInt64:
|
||||
@ -146,11 +143,10 @@ namespace {
|
||||
case PpAtomConstFloat16:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// push onto back of stream
|
||||
void TPpContext::TokenStream::putSubtoken(char subtoken)
|
||||
@ -182,8 +178,7 @@ void TPpContext::TokenStream::putToken(int atom, TPpToken* ppToken)
|
||||
putSubtoken(static_cast<char>(atom));
|
||||
|
||||
// save the backing name string
|
||||
if (SaveName(atom))
|
||||
{
|
||||
if (SaveName(atom)) {
|
||||
const char* s = ppToken->name;
|
||||
while (*s)
|
||||
putSubtoken(*s++);
|
||||
@ -191,8 +186,7 @@ void TPpContext::TokenStream::putToken(int atom, TPpToken* ppToken)
|
||||
}
|
||||
|
||||
// save the numeric value
|
||||
if (SaveValue(atom))
|
||||
{
|
||||
if (SaveValue(atom)) {
|
||||
const char* n = reinterpret_cast<const char*>(&ppToken->i64val);
|
||||
for (size_t i = 0; i < sizeof(ppToken->i64val); ++i)
|
||||
putSubtoken(*n++);
|
||||
@ -213,20 +207,15 @@ int TPpContext::TokenStream::getToken(TParseContextBase& _parseContext, TPpToken
|
||||
ppToken->loc = _parseContext.getCurrentLoc();
|
||||
|
||||
// get the backing name string
|
||||
if (SaveName(atom))
|
||||
{
|
||||
if (SaveName(atom)) {
|
||||
int ch = getSubtoken();
|
||||
int len = 0;
|
||||
while (ch != 0 && ch != EndOfInput)
|
||||
{
|
||||
if (len < MaxTokenLength)
|
||||
{
|
||||
while (ch != 0 && ch != EndOfInput) {
|
||||
if (len < MaxTokenLength) {
|
||||
ppToken->name[len] = (char)ch;
|
||||
len++;
|
||||
ch = getSubtoken();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_parseContext.error(ppToken->loc, "token too long", "", "");
|
||||
break;
|
||||
}
|
||||
@ -235,17 +224,13 @@ int TPpContext::TokenStream::getToken(TParseContextBase& _parseContext, TPpToken
|
||||
}
|
||||
|
||||
// Check for ##, unless the current # is the last character
|
||||
if (atom == '#')
|
||||
{
|
||||
if (current < data.size())
|
||||
{
|
||||
if (getSubtoken() == '#')
|
||||
{
|
||||
if (atom == '#') {
|
||||
if (current < data.size()) {
|
||||
if (getSubtoken() == '#') {
|
||||
_parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
|
||||
_parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
|
||||
atom = PpAtomPaste;
|
||||
}
|
||||
else
|
||||
} else
|
||||
ungetSubtoken();
|
||||
}
|
||||
}
|
||||
@ -288,17 +273,15 @@ bool TPpContext::TokenStream::peekTokenizedPasting(bool lastTokenPastes)
|
||||
// Are we at the last non-whitespace token?
|
||||
savePos = current;
|
||||
bool moreTokens = false;
|
||||
for (;;)
|
||||
{
|
||||
do {
|
||||
subtoken = getSubtoken();
|
||||
if (subtoken == EndOfInput)
|
||||
break;
|
||||
if (subtoken != ' ')
|
||||
{
|
||||
if (subtoken != ' ') {
|
||||
moreTokens = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
current = savePos;
|
||||
|
||||
return !moreTokens;
|
||||
|
@ -93,10 +93,9 @@ bool isDereferenceOperation(glslang::TOperator op)
|
||||
case glslang::EOpMatrixSwizzle:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true if the opcode leads to an assignment operation.
|
||||
bool isAssignOperation(glslang::TOperator op)
|
||||
@ -124,10 +123,9 @@ bool isAssignOperation(glslang::TOperator op)
|
||||
case glslang::EOpPreDecrement:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// A helper function to get the unsigned int from a given constant union node.
|
||||
// Note the node should only hold a uint scalar.
|
||||
@ -182,10 +180,9 @@ bool isArithmeticOperation(glslang::TOperator op)
|
||||
case glslang::EOpPreDecrement:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// A helper class to help manage the populating_initial_no_contraction_ flag.
|
||||
template <typename T> class StateSettingGuard {
|
||||
@ -235,8 +232,7 @@ ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain& chain,
|
||||
//
|
||||
class TSymbolDefinitionCollectingTraverser : public glslang::TIntermTraverser {
|
||||
public:
|
||||
TSymbolDefinitionCollectingTraverser(
|
||||
NodeMapping* symbol_definition_mapping,
|
||||
TSymbolDefinitionCollectingTraverser(NodeMapping* symbol_definition_mapping,
|
||||
AccessChainMapping* accesschain_mapping,
|
||||
ObjectAccesschainSet* precise_objects,
|
||||
ReturnBranchNodeSet* precise_return_nodes);
|
||||
@ -316,11 +312,9 @@ bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit,
|
||||
bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit,
|
||||
glslang::TIntermBranch* node)
|
||||
{
|
||||
if ( node->getFlowOp() == glslang::EOpReturn
|
||||
&& node->getExpression()
|
||||
&& current_function_definition_node_
|
||||
&& current_function_definition_node_->getType().getQualifier().noContraction)
|
||||
{
|
||||
if (node->getFlowOp() == glslang::EOpReturn && node->getExpression() &&
|
||||
current_function_definition_node_ &&
|
||||
current_function_definition_node_->getType().getQualifier().noContraction) {
|
||||
// This node is a return node with an expression, and its function has a
|
||||
// precise return value. We need to find the involved objects in its
|
||||
// expression and add them to the set of initial precise objects.
|
||||
@ -331,20 +325,17 @@ bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit,
|
||||
}
|
||||
|
||||
// Visits a unary node. This might be an implicit assignment like i++, i--. etc.
|
||||
bool TSymbolDefinitionCollectingTraverser::visitUnary(
|
||||
glslang::TVisit visit,
|
||||
bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit */,
|
||||
glslang::TIntermUnary* node)
|
||||
{
|
||||
current_object_.clear();
|
||||
node->getOperand()->traverse(this);
|
||||
if (isAssignOperation(node->getOp()))
|
||||
{
|
||||
if (isAssignOperation(node->getOp())) {
|
||||
// We should always be able to get an access chain of the operand node.
|
||||
|
||||
// If the operand node object is 'precise', we collect its access chain
|
||||
// for the initial set of 'precise' objects.
|
||||
if (isPreciseObjectNode(node->getOperand()))
|
||||
{
|
||||
if (isPreciseObjectNode(node->getOperand())) {
|
||||
// The operand node is an 'precise' object node, add its
|
||||
// access chain to the set of 'precise' objects. This is to collect
|
||||
// the initial set of 'precise' objects.
|
||||
@ -363,7 +354,7 @@ bool TSymbolDefinitionCollectingTraverser::visitUnary(
|
||||
|
||||
// Visits a binary node and updates the mapping from symbol IDs to the definition
|
||||
// nodes. Also collects the access chains for the initial precise objects.
|
||||
bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit visit,
|
||||
bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit */,
|
||||
glslang::TIntermBinary* node)
|
||||
{
|
||||
// Traverses the left node to build the access chain info for the object.
|
||||
@ -423,8 +414,9 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit visit,
|
||||
std::tuple<NodeMapping, AccessChainMapping, ObjectAccesschainSet, ReturnBranchNodeSet>
|
||||
getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& intermediate)
|
||||
{
|
||||
auto result_tuple = std::make_tuple(NodeMapping(), AccessChainMapping(),
|
||||
ObjectAccesschainSet(), ReturnBranchNodeSet());
|
||||
auto result_tuple = std::make_tuple(NodeMapping(), AccessChainMapping(), ObjectAccesschainSet(),
|
||||
ReturnBranchNodeSet());
|
||||
|
||||
TIntermNode* root = intermediate.getTreeRoot();
|
||||
if (root == 0)
|
||||
return result_tuple;
|
||||
@ -435,7 +427,8 @@ getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& in
|
||||
ReturnBranchNodeSet& precise_return_nodes = std::get<3>(result_tuple);
|
||||
|
||||
// Traverses the AST and populate the results.
|
||||
TSymbolDefinitionCollectingTraverser collector(&symbol_definition_mapping, &accesschain_mapping, &precise_objects, &precise_return_nodes);
|
||||
TSymbolDefinitionCollectingTraverser collector(&symbol_definition_mapping, &accesschain_mapping,
|
||||
&precise_objects, &precise_return_nodes);
|
||||
root->traverse(&collector);
|
||||
|
||||
return result_tuple;
|
||||
|
@ -389,24 +389,24 @@ public:
|
||||
switch ((int)sampler.dim) {
|
||||
case Esd1D:
|
||||
switch ((int)sampler.shadow) {
|
||||
case 0: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY : GL_SAMPLER_1D;
|
||||
case 1: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY_SHADOW : GL_SAMPLER_1D_SHADOW;
|
||||
case false: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY : GL_SAMPLER_1D;
|
||||
case true: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY_SHADOW : GL_SAMPLER_1D_SHADOW;
|
||||
}
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
case 0:
|
||||
case false:
|
||||
switch ((int)sampler.shadow) {
|
||||
case 0: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY : GL_SAMPLER_2D;
|
||||
case 1: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY_SHADOW : GL_SAMPLER_2D_SHADOW;
|
||||
case false: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY : GL_SAMPLER_2D;
|
||||
case true: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY_SHADOW : GL_SAMPLER_2D_SHADOW;
|
||||
}
|
||||
case 1: return sampler.arrayed ? GL_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_SAMPLER_2D_MULTISAMPLE;
|
||||
case true: return sampler.arrayed ? GL_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_SAMPLER_2D_MULTISAMPLE;
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_SAMPLER_3D;
|
||||
case EsdCube:
|
||||
switch ((int)sampler.shadow) {
|
||||
case 0: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY : GL_SAMPLER_CUBE;
|
||||
case 1: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW : GL_SAMPLER_CUBE_SHADOW;
|
||||
case false: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY : GL_SAMPLER_CUBE;
|
||||
case true: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW : GL_SAMPLER_CUBE_SHADOW;
|
||||
}
|
||||
case EsdRect:
|
||||
return sampler.shadow ? GL_SAMPLER_2D_RECT_SHADOW : GL_SAMPLER_2D_RECT;
|
||||
@ -418,24 +418,24 @@ public:
|
||||
switch ((int)sampler.dim) {
|
||||
case Esd1D:
|
||||
switch ((int)sampler.shadow) {
|
||||
case 0: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_AMD : GL_FLOAT16_SAMPLER_1D_AMD;
|
||||
case 1: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_1D_SHADOW_AMD;
|
||||
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_AMD : GL_FLOAT16_SAMPLER_1D_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_1D_SHADOW_AMD;
|
||||
}
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
case 0:
|
||||
case false:
|
||||
switch ((int)sampler.shadow) {
|
||||
case 0: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_AMD;
|
||||
case 1: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_SHADOW_AMD;
|
||||
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_SHADOW_AMD;
|
||||
}
|
||||
case 1: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD;
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_FLOAT16_SAMPLER_3D_AMD;
|
||||
case EsdCube:
|
||||
switch ((int)sampler.shadow) {
|
||||
case 0: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD : GL_FLOAT16_SAMPLER_CUBE_AMD;
|
||||
case 1: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD;
|
||||
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD : GL_FLOAT16_SAMPLER_CUBE_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD;
|
||||
}
|
||||
case EsdRect:
|
||||
return sampler.shadow ? GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_RECT_AMD;
|
||||
@ -449,8 +449,8 @@ public:
|
||||
return sampler.arrayed ? GL_INT_SAMPLER_1D_ARRAY : GL_INT_SAMPLER_1D;
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
case 0: return sampler.arrayed ? GL_INT_SAMPLER_2D_ARRAY : GL_INT_SAMPLER_2D;
|
||||
case 1: return sampler.arrayed ? GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
|
||||
case false: return sampler.arrayed ? GL_INT_SAMPLER_2D_ARRAY : GL_INT_SAMPLER_2D;
|
||||
case true: return sampler.arrayed ? GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
|
||||
: GL_INT_SAMPLER_2D_MULTISAMPLE;
|
||||
}
|
||||
case Esd3D:
|
||||
@ -468,8 +468,8 @@ public:
|
||||
return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_1D_ARRAY : GL_UNSIGNED_INT_SAMPLER_1D;
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
case 0: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D;
|
||||
case 1: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
|
||||
case false: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D;
|
||||
case true: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
|
||||
: GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE;
|
||||
}
|
||||
case Esd3D:
|
||||
@ -493,8 +493,8 @@ public:
|
||||
return sampler.arrayed ? GL_IMAGE_1D_ARRAY : GL_IMAGE_1D;
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
case 0: return sampler.arrayed ? GL_IMAGE_2D_ARRAY : GL_IMAGE_2D;
|
||||
case 1: return sampler.arrayed ? GL_IMAGE_2D_MULTISAMPLE_ARRAY : GL_IMAGE_2D_MULTISAMPLE;
|
||||
case false: return sampler.arrayed ? GL_IMAGE_2D_ARRAY : GL_IMAGE_2D;
|
||||
case true: return sampler.arrayed ? GL_IMAGE_2D_MULTISAMPLE_ARRAY : GL_IMAGE_2D_MULTISAMPLE;
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_IMAGE_3D;
|
||||
@ -512,8 +512,8 @@ public:
|
||||
return sampler.arrayed ? GL_FLOAT16_IMAGE_1D_ARRAY_AMD : GL_FLOAT16_IMAGE_1D_AMD;
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
case 0: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_AMD;
|
||||
case 1: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD;
|
||||
case false: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD;
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_FLOAT16_IMAGE_3D_AMD;
|
||||
@ -531,8 +531,8 @@ public:
|
||||
return sampler.arrayed ? GL_INT_IMAGE_1D_ARRAY : GL_INT_IMAGE_1D;
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
case 0: return sampler.arrayed ? GL_INT_IMAGE_2D_ARRAY : GL_INT_IMAGE_2D;
|
||||
case 1: return sampler.arrayed ? GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY : GL_INT_IMAGE_2D_MULTISAMPLE;
|
||||
case false: return sampler.arrayed ? GL_INT_IMAGE_2D_ARRAY : GL_INT_IMAGE_2D;
|
||||
case true: return sampler.arrayed ? GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY : GL_INT_IMAGE_2D_MULTISAMPLE;
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_INT_IMAGE_3D;
|
||||
@ -549,8 +549,8 @@ public:
|
||||
return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_1D_ARRAY : GL_UNSIGNED_INT_IMAGE_1D;
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
case 0: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_ARRAY : GL_UNSIGNED_INT_IMAGE_2D;
|
||||
case 1: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY
|
||||
case false: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_ARRAY : GL_UNSIGNED_INT_IMAGE_2D;
|
||||
case true: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY
|
||||
: GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE;
|
||||
}
|
||||
case Esd3D:
|
||||
|
Loading…
Reference in New Issue
Block a user