aboutsummaryrefslogtreecommitdiff
path: root/include/RenderBackend/OpenGL/CommonShader.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/RenderBackend/OpenGL/CommonShader.hpp')
-rw-r--r--include/RenderBackend/OpenGL/CommonShader.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/RenderBackend/OpenGL/CommonShader.hpp b/include/RenderBackend/OpenGL/CommonShader.hpp
new file mode 100644
index 0000000..a67aa68
--- /dev/null
+++ b/include/RenderBackend/OpenGL/CommonShader.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+namespace amalgine
+{
+ static bool isAlpha(char c)
+ {
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+ }
+
+ static bool isDigit(char c)
+ {
+ return c >= '0' && c <= '9';
+ }
+
+ static bool isShaderVariableNameValid(const char *variableName)
+ {
+ const char *p = &variableName[0];
+ if(isAlpha(*p) || *p == '_')
+ {
+ ++p;
+ while(true)
+ {
+ char c = *p;
+ if(c == '\0')
+ return true;
+ else if(isAlpha(c) || isDigit(c) || c == '_')
+ ++p;
+ }
+ }
+
+ return false;
+ }
+}