From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/6] opengl: add shader build infrastructure
Date: Wed, 29 Apr 2015 09:49:25 +0200 [thread overview]
Message-ID: <1430293770-1965-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1430293770-1965-1-git-send-email-kraxel@redhat.com>
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>
---
Makefile | 14 ++++++++++++++
scripts/shaderinclude.pl | 16 ++++++++++++++++
2 files changed, 30 insertions(+)
create mode 100644 scripts/shaderinclude.pl
diff --git a/Makefile b/Makefile
index 93af871..49e4567 100644
--- a/Makefile
+++ b/Makefile
@@ -296,6 +296,7 @@ clean:
rm -f fsdev/*.pod
rm -rf .libs */.libs
rm -f qemu-img-cmds.h
+ rm -f ui/shader/*-vert.h ui/shader/*-frag.h
@# May not be present in GENERATED_HEADERS
rm -f trace/generated-tracers-dtrace.dtrace*
rm -f trace/generated-tracers-dtrace.h*
@@ -441,6 +442,19 @@ cscope:
find "$(SRC_PATH)" -name "*.[chsS]" -print | sed 's,^\./,,' > ./cscope.files
cscope -b
+# opengl shader programs
+ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
+ @mkdir -p $(dir $@)
+ $(call quiet-command,\
+ perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
+ " VERT $@")
+
+ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclude.pl
+ @mkdir -p $(dir $@)
+ $(call quiet-command,\
+ perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
+ " FRAG $@")
+
# documentation
MAKEINFO=makeinfo
MAKEINFOFLAGS=--no-headers --no-split --number-sections
diff --git a/scripts/shaderinclude.pl b/scripts/shaderinclude.pl
new file mode 100644
index 0000000..81b5146
--- /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;
--
1.8.3.1
next prev parent reply other threads:[~2015-04-29 7:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 7:49 [Qemu-devel] [PATCH 0/6] sdl2: add opengl rendering support Gerd Hoffmann
2015-04-29 7:49 ` Gerd Hoffmann [this message]
2015-04-29 7:49 ` [Qemu-devel] [PATCH 2/6] opengl: add shader helper functions Gerd Hoffmann
2015-04-29 7:49 ` [Qemu-devel] [PATCH 3/6] console-gl: add opengl rendering " Gerd Hoffmann
2015-04-29 7:49 ` [Qemu-devel] [PATCH 4/6] sdl2: move SDL_* includes to sdl2.h Gerd Hoffmann
2015-04-29 7:49 ` [Qemu-devel] [PATCH 5/6] sdl2: add support for display rendering using opengl Gerd Hoffmann
2015-04-29 7:49 ` [Qemu-devel] [PATCH 6/6] sdl2: Fix RGB555 Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430293770-1965-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).