aboutsummaryrefslogtreecommitdiff
path: root/scripts/shaderinclude.pl
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2015-01-16 13:59:17 +0100
committerGerd Hoffmann <kraxel@redhat.com>2015-05-05 09:03:32 +0200
commitd98bc0b654b97d130338e76e0928296f84e6d6fd (patch)
tree50f2539275c0dd5e544152e83e274980e947db27 /scripts/shaderinclude.pl
parent5bccbb04a4abba7af4398de992bf06d585fd1333 (diff)
opengl: add shader build infrastructure
perl script to transform shader programs into c include files with static string constands containing the shader programs, so we can easily embed them into qemu. Also some Makefile logic for them. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'scripts/shaderinclude.pl')
-rw-r--r--scripts/shaderinclude.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/shaderinclude.pl b/scripts/shaderinclude.pl
new file mode 100644
index 0000000000..81b5146332
--- /dev/null
+++ b/scripts/shaderinclude.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my $file = shift;
+open FILE, "<", $file or die "open $file: $!";
+my $name = $file;
+$name =~ s|.*/||;
+$name =~ s/[-.]/_/g;
+print "static GLchar ${name}_src[] =\n";
+while (<FILE>) {
+ chomp;
+ printf " \"%s\\n\"\n", $_;
+}
+print " \"\\n\";\n";
+close FILE;