print warning for texture2d usage
This commit is contained in:
parent
009b84bb1a
commit
c0b6427b12
1 changed files with 9 additions and 0 deletions
|
|
@ -134,6 +134,8 @@ FString RemoveLegacyUserUniforms(FString code)
|
|||
DPrintf(DMSG_WARNING, TEXTCOLOR_ORANGE "timer and tex uniforms should not be explicitly declared.\n");
|
||||
}
|
||||
|
||||
bool foundtexture2d = false;
|
||||
|
||||
// Also remove all occurences of the token 'texture2d'. Some shaders may still use this deprecated function to access a sampler.
|
||||
// Modern GLSL only allows use of 'texture'.
|
||||
while (true)
|
||||
|
|
@ -142,6 +144,8 @@ FString RemoveLegacyUserUniforms(FString code)
|
|||
if (matchIndex == -1)
|
||||
break;
|
||||
|
||||
foundtexture2d = true;
|
||||
|
||||
// Check if this is a real token.
|
||||
bool isKeywordStart = matchIndex == 0 || !isalnum(chars[matchIndex - 1] & 255);
|
||||
bool isKeywordEnd = matchIndex + 9 == len || !isalnum(chars[matchIndex + 9] & 255);
|
||||
|
|
@ -152,6 +156,11 @@ FString RemoveLegacyUserUniforms(FString code)
|
|||
startIndex = matchIndex + 9;
|
||||
}
|
||||
|
||||
if(foundtexture2d)
|
||||
{
|
||||
DPrintf(DMSG_WARNING, TEXTCOLOR_ORANGE "texture2d is deprecated, use texture instead.\n");
|
||||
}
|
||||
|
||||
code.UnlockBuffer();
|
||||
|
||||
return code;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue