【发布时间】:2014-10-10 01:12:43
【问题描述】:
有些人报告了我们客户端软件中着色器的错误。报告如下所示:
ERROR: 0:63: error#71) Syntax error incorrect preprocessor directive
WARNING: 0:63: warning#64) Unexpected tokens following the preprocessor directive - expected a newline(#if )
ERROR: 0:67: error#71) Syntax error incorrect preprocessor directive
WARNING: 0:67: warning#64) Unexpected tokens following the preprocessor directive - expected a newline(#if )
ERROR: 0:71: error#71) Syntax error incorrect preprocessor directive
WARNING: 0:71: warning#64) Unexpected tokens following the preprocessor directive - expected a newline(#if )
ERROR: 0:75: error#71) Syntax error incorrect preprocessor directive
WARNING: 0:75: warning#64) Unexpected tokens following the preprocessor directive - expected a newline(#if )
还有更多。每个错误都是这样在线的:
#if ATLAS_MAG_MIN_FILTER == 7 // Here goes the comment
我们尝试将所有这些 if 更改为以下格式:
#if (ATLAS_MAG_MIN_FILTER == 7) // Comment
但错误仍在发生。我找不到任何关于我们应该如何在 GLSL 中编写 #ifs 的文档。谁能告诉我如何正确使用它们?
添加: ATLAS_MAG_MIN_FILTER 定义为:
#define ATLAS_MAG_MIN_FILTER (ATLAS_FILTER_MODE & 0x7)
ATLAS_FILTER_MODE 定义为:
#define ATLAS_FILTER_MODE 5
所有换行符都已到位。
没有cmets的行也有错误。
我上传了shader的完整代码here,错误出现在第63、67、71、75、79、83、87、91、111、114、115、122、125、126行。
【问题讨论】:
-
由于错误表明它需要换行符:这些行的末尾是否有换行符?
-
也许
ATLAS_MAG_MIN_FILTER被定义为一个空字符串? -
它们在大文件中,应该有明显的换行符,加载器会自动在文件末尾添加换行符。
-
ATLAS_MAG_MIN_FILTER已定义并且是一个数字。每个用户都会发生其他方式的错误。 -
我忘了 cmets,他们也在这条线上。可能是这个问题,我会尽快检查。