From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnMkb-0007ZE-Rx for qemu-devel@nongnu.org; Wed, 29 Apr 2015 03:49:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnMkW-0008BT-Sv for qemu-devel@nongnu.org; Wed, 29 Apr 2015 03:49:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49950) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnMkW-0008BC-K7 for qemu-devel@nongnu.org; Wed, 29 Apr 2015 03:49:40 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3T7ndWV023347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 29 Apr 2015 03:49:40 -0400 From: Gerd Hoffmann Date: Wed, 29 Apr 2015 09:49:25 +0200 Message-Id: <1430293770-1965-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1430293770-1965-1-git-send-email-kraxel@redhat.com> References: <1430293770-1965-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 1/6] opengl: add shader build infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 Reviewed-by: Max Reitz --- 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 () { + chomp; + printf " \"%s\\n\"\n", $_; +} +print " \"\\n\";\n"; +close FILE; -- 1.8.3.1