Pick up a shader slice only after a newline

Otherwise a workaround such as "#define slice(x)" would not work for non-OC
shader code.
issue1247
Armin Burgmeier 2014-12-22 20:23:46 +01:00
parent 5c98fdccec
commit 574149e289
1 changed files with 5 additions and 2 deletions

View File

@ -109,8 +109,11 @@ void C4Shader::AddSlices(ShaderSliceList& slices, const char *szWhat, const char
continue;
}
// New slice? We need a newline followed by "slice"
if (iDepth < 0 && isspace(*pPos)) {
// New slice? We need a newline followed by "slice". Don't do
// the depth check, so that we also recognize slices inside
// an ifdefed-out "void main() {" block.
//if (iDepth < 0 && *pPos == '\n') {
if (*pPos == '\n') {
if (SEqual2(pPos+1, "slice") && !isalnum(*(pPos+6))) {
const char *pSliceEnd = pPos; pPos += 6;
while(isspace(*pPos)) pPos++;