summaryrefslogtreecommitdiff
path: root/glsl.jam
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-13 23:06:39 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-13 23:06:39 +0100
commit1c8e84d9503237e7a308107a0a44fbc7f188c700 (patch)
tree60e80d7f4e91621bc62cb5fb2f6c61aae631b4d9 /glsl.jam
parentLoad assimp textures in parallel (diff)
parentFix typo in name SceneCPtr (diff)
downloadilt-1c8e84d9503237e7a308107a0a44fbc7f188c700.tar.bz2
ilt-1c8e84d9503237e7a308107a0a44fbc7f188c700.tar.xz
ilt-1c8e84d9503237e7a308107a0a44fbc7f188c700.zip
Merge branch 'materials' into assimp
Diffstat (limited to 'glsl.jam')
-rw-r--r--glsl.jam36
1 files changed, 36 insertions, 0 deletions
diff --git a/glsl.jam b/glsl.jam
new file mode 100644
index 0000000..87dee61
--- /dev/null
+++ b/glsl.jam
@@ -0,0 +1,36 @@
+import type : register ;
+import type : type ;
+import generators : register-standard ;
+import scanner : register ;
+
+type.register GL_VERTEX_SHADER : vs ;
+type.register GL_GEOMETRY_SHADER : gs ;
+type.register GL_FRAGMENT_SHADER : fs ;
+
+generators.register-standard glsl.embed : GL_VERTEX_SHADER : CPP(vs-%) H(vs-%) ;
+generators.register-standard glsl.embed : GL_GEOMETRY_SHADER : CPP(gs-%) H(gs-%) ;
+generators.register-standard glsl.embed : GL_FRAGMENT_SHADER : CPP(fs-%) H(fs-%) ;
+
+class m4-scanner : common-scanner {
+ rule pattern ( ) {
+ return "s?include\\(`([^']*)'\\)" ;
+ }
+}
+
+scanner.register m4-scanner : include ;
+
+type.set-scanner GL_VERTEX_SHADER : m4-scanner ;
+type.set-scanner GL_GEOMETRY_SHADER : m4-scanner ;
+type.set-scanner GL_FRAGMENT_SHADER : m4-scanner ;
+
+actions glsl.embed
+{
+ m4 -I$(2:D) -DNAME=$(2:B) -DTYPE=$(2:S) > $(1[2]) lib/embed-glsl.h.m4
+ m4 -I$(2:D) -DSOURCE=$(2) -DNAME=$(2:B) -DTYPE=$(2:S) -DGLTYPE=$(OPTIONS) > $(1[1]) lib/embed-glsl.cpp.m4
+}
+
+rule glsl.embed ( targets * : sources * : properties * )
+{
+ DEPENDS $(targets) : lib/embed-glsl.h.m4 lib/embed-glsl.cpp.m4 ;
+ OPTIONS on $(targets) = [ type.type $(sources) ] ;
+}