Search
lxdream.org :: lxdream :: r405:570d93abb5b7
lxdream 0.9.1
released Jun 29
Download Now
changeset405:570d93abb5b7
parent404:c5ed3c8642a2
child406:9289b62f8f33
authornkeynes
dateFri Sep 28 07:24:14 2007 +0000 (12 years ago)
Add GLSL loader framework
src/Makefile.am
src/Makefile.in
src/drivers/fragment.glsl
src/drivers/gl_common.h
src/drivers/gl_sl.c
src/drivers/gl_slsrc.c
src/drivers/vertex.glsl
src/drivers/video_x11.c
src/tools/genglsl.c
1.1 --- a/src/Makefile.am Fri Sep 28 07:21:58 2007 +0000
1.2 +++ b/src/Makefile.am Fri Sep 28 07:24:14 2007 +0000
1.3 @@ -6,11 +6,12 @@
1.4 -Ish4 \
1.5 @PACKAGE_CFLAGS@
1.6
1.7 -bin_PROGRAMS = gendec lxdream
1.8 +bin_PROGRAMS = gendec genglsl lxdream
1.9
1.10 -BUILT_SOURCES = sh4/sh4core.c sh4/sh4dasm.c sh4/sh4x86.c
1.11 +BUILT_SOURCES = sh4/sh4core.c sh4/sh4dasm.c sh4/sh4x86.c drivers/gl_slsrc.c
1.12
1.13 gendec_SOURCES = tools/gendec.c tools/gendec.h tools/insparse.c tools/actparse.c
1.14 +genglsl_SOURCES = tools/genglsl.c
1.15
1.16 lxdream_SOURCES = \
1.17 main.c \
1.18 @@ -43,11 +44,13 @@
1.19 drivers/audio_null.c drivers/audio_esd.c \
1.20 drivers/video_null.c drivers/video_gtk.c drivers/video_gtk.h \
1.21 drivers/video_x11.c drivers/video_x11.h \
1.22 - drivers/gl_common.c drivers/gl_common.h drivers/gl_fbo.c
1.23 + drivers/gl_common.c drivers/gl_common.h drivers/gl_fbo.c \
1.24 + drivers/gl_sl.c drivers/gl_slsrc.c
1.25
1.26 lxdream_LDADD = @PACKAGE_LIBS@ $(INTLLIBS) -lesd
1.27
1.28 gendec_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
1.29 +genglsl_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
1.30
1.31 TESTS = test/testxlt
1.32
1.33 @@ -72,3 +75,5 @@
1.34 ./gendec sh4/sh4.def sh4/sh4x86.in -o sh4/sh4x86.c
1.35 sh4/sh4stat.c: gendec sh4/sh4.def sh4/sh4stat.in
1.36 ./gendec sh4/sh4.def sh4/sh4stat.in -o sh4/sh4stat.c
1.37 +drivers/gl_slsrc.c: genglsl drivers/vertex.glsl drivers/fragment.glsl
1.38 + ./genglsl drivers/vertex.glsl drivers/fragment.glsl drivers/gl_slsrc.c
2.1 --- a/src/Makefile.in Fri Sep 28 07:21:58 2007 +0000
2.2 +++ b/src/Makefile.in Fri Sep 28 07:24:14 2007 +0000
2.3 @@ -140,11 +140,12 @@
2.4 @PACKAGE_CFLAGS@
2.5
2.6
2.7 -bin_PROGRAMS = gendec lxdream
2.8 +bin_PROGRAMS = gendec genglsl lxdream
2.9
2.10 -BUILT_SOURCES = sh4/sh4core.c sh4/sh4dasm.c sh4/sh4x86.c
2.11 +BUILT_SOURCES = sh4/sh4core.c sh4/sh4dasm.c sh4/sh4x86.c drivers/gl_slsrc.c
2.12
2.13 gendec_SOURCES = tools/gendec.c tools/gendec.h tools/insparse.c tools/actparse.c
2.14 +genglsl_SOURCES = tools/genglsl.c
2.15
2.16 lxdream_SOURCES = \
2.17 main.c \
2.18 @@ -177,12 +178,14 @@
2.19 drivers/audio_null.c drivers/audio_esd.c \
2.20 drivers/video_null.c drivers/video_gtk.c drivers/video_gtk.h \
2.21 drivers/video_x11.c drivers/video_x11.h \
2.22 - drivers/gl_common.c drivers/gl_common.h drivers/gl_fbo.c
2.23 + drivers/gl_common.c drivers/gl_common.h drivers/gl_fbo.c \
2.24 + drivers/gl_sl.c drivers/gl_slsrc.c
2.25
2.26
2.27 lxdream_LDADD = @PACKAGE_LIBS@ $(INTLLIBS) -lesd
2.28
2.29 gendec_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
2.30 +genglsl_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
2.31
2.32 TESTS = test/testxlt
2.33
2.34 @@ -204,7 +207,7 @@
2.35 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
2.36 CONFIG_HEADER = $(top_builddir)/config.h
2.37 CONFIG_CLEAN_FILES =
2.38 -bin_PROGRAMS = gendec$(EXEEXT) lxdream$(EXEEXT)
2.39 +bin_PROGRAMS = gendec$(EXEEXT) genglsl$(EXEEXT) lxdream$(EXEEXT)
2.40 check_PROGRAMS = test/testxlt$(EXEEXT) test/testsh4x86$(EXEEXT)
2.41 PROGRAMS = $(bin_PROGRAMS)
2.42
2.43 @@ -213,6 +216,10 @@
2.44 gendec_OBJECTS = $(am_gendec_OBJECTS)
2.45 gendec_DEPENDENCIES =
2.46 gendec_LDFLAGS =
2.47 +am_genglsl_OBJECTS = genglsl.$(OBJEXT)
2.48 +genglsl_OBJECTS = $(am_genglsl_OBJECTS)
2.49 +genglsl_DEPENDENCIES =
2.50 +genglsl_LDFLAGS =
2.51 am_lxdream_OBJECTS = main.$(OBJEXT) mem.$(OBJEXT) watch.$(OBJEXT) \
2.52 asic.$(OBJEXT) syscall.$(OBJEXT) bios.$(OBJEXT) \
2.53 dcload.$(OBJEXT) ide.$(OBJEXT) gdimage.$(OBJEXT) \
2.54 @@ -234,7 +241,7 @@
2.55 bootstrap.$(OBJEXT) util.$(OBJEXT) display.$(OBJEXT) \
2.56 audio_null.$(OBJEXT) audio_esd.$(OBJEXT) video_null.$(OBJEXT) \
2.57 video_gtk.$(OBJEXT) video_x11.$(OBJEXT) gl_common.$(OBJEXT) \
2.58 - gl_fbo.$(OBJEXT)
2.59 + gl_fbo.$(OBJEXT) gl_sl.$(OBJEXT) gl_slsrc.$(OBJEXT)
2.60 lxdream_OBJECTS = $(am_lxdream_OBJECTS)
2.61 lxdream_DEPENDENCIES =
2.62 lxdream_LDFLAGS =
2.63 @@ -268,37 +275,39 @@
2.64 @AMDEP_TRUE@ ./$(DEPDIR)/dreamcast.Po ./$(DEPDIR)/dump_win.Po \
2.65 @AMDEP_TRUE@ ./$(DEPDIR)/eventq.Po ./$(DEPDIR)/gdimage.Po \
2.66 @AMDEP_TRUE@ ./$(DEPDIR)/gdrom.Po ./$(DEPDIR)/gendec.Po \
2.67 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_common.Po ./$(DEPDIR)/gl_fbo.Po \
2.68 -@AMDEP_TRUE@ ./$(DEPDIR)/gui.Po ./$(DEPDIR)/i386-dis.Po \
2.69 -@AMDEP_TRUE@ ./$(DEPDIR)/ide.Po ./$(DEPDIR)/insparse.Po \
2.70 -@AMDEP_TRUE@ ./$(DEPDIR)/intc.Po ./$(DEPDIR)/interface.Po \
2.71 -@AMDEP_TRUE@ ./$(DEPDIR)/linux.Po ./$(DEPDIR)/loader.Po \
2.72 -@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/maple.Po \
2.73 -@AMDEP_TRUE@ ./$(DEPDIR)/mem.Po ./$(DEPDIR)/mmr_win.Po \
2.74 -@AMDEP_TRUE@ ./$(DEPDIR)/nrg.Po ./$(DEPDIR)/pvr2.Po \
2.75 -@AMDEP_TRUE@ ./$(DEPDIR)/pvr2mem.Po ./$(DEPDIR)/rendbkg.Po \
2.76 -@AMDEP_TRUE@ ./$(DEPDIR)/rendcore.Po ./$(DEPDIR)/render.Po \
2.77 -@AMDEP_TRUE@ ./$(DEPDIR)/rendsave.Po ./$(DEPDIR)/rendsort.Po \
2.78 -@AMDEP_TRUE@ ./$(DEPDIR)/scif.Po ./$(DEPDIR)/sh4.Po \
2.79 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4core.Po ./$(DEPDIR)/sh4dasm.Po \
2.80 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4mem.Po ./$(DEPDIR)/sh4mmio.Po \
2.81 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4stat.Po ./$(DEPDIR)/sh4trans.Po \
2.82 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4x86.Po ./$(DEPDIR)/support.Po \
2.83 -@AMDEP_TRUE@ ./$(DEPDIR)/syscall.Po ./$(DEPDIR)/tacore.Po \
2.84 -@AMDEP_TRUE@ ./$(DEPDIR)/testsh4x86.Po ./$(DEPDIR)/testxlt.Po \
2.85 -@AMDEP_TRUE@ ./$(DEPDIR)/texcache.Po ./$(DEPDIR)/timer.Po \
2.86 -@AMDEP_TRUE@ ./$(DEPDIR)/util.Po ./$(DEPDIR)/video_gtk.Po \
2.87 -@AMDEP_TRUE@ ./$(DEPDIR)/video_null.Po ./$(DEPDIR)/video_x11.Po \
2.88 -@AMDEP_TRUE@ ./$(DEPDIR)/watch.Po ./$(DEPDIR)/x86dasm.Po \
2.89 -@AMDEP_TRUE@ ./$(DEPDIR)/xltcache.Po ./$(DEPDIR)/yuv.Po
2.90 +@AMDEP_TRUE@ ./$(DEPDIR)/genglsl.Po ./$(DEPDIR)/gl_common.Po \
2.91 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_fbo.Po ./$(DEPDIR)/gl_sl.Po \
2.92 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_slsrc.Po ./$(DEPDIR)/gui.Po \
2.93 +@AMDEP_TRUE@ ./$(DEPDIR)/i386-dis.Po ./$(DEPDIR)/ide.Po \
2.94 +@AMDEP_TRUE@ ./$(DEPDIR)/insparse.Po ./$(DEPDIR)/intc.Po \
2.95 +@AMDEP_TRUE@ ./$(DEPDIR)/interface.Po ./$(DEPDIR)/linux.Po \
2.96 +@AMDEP_TRUE@ ./$(DEPDIR)/loader.Po ./$(DEPDIR)/main.Po \
2.97 +@AMDEP_TRUE@ ./$(DEPDIR)/maple.Po ./$(DEPDIR)/mem.Po \
2.98 +@AMDEP_TRUE@ ./$(DEPDIR)/mmr_win.Po ./$(DEPDIR)/nrg.Po \
2.99 +@AMDEP_TRUE@ ./$(DEPDIR)/pvr2.Po ./$(DEPDIR)/pvr2mem.Po \
2.100 +@AMDEP_TRUE@ ./$(DEPDIR)/rendbkg.Po ./$(DEPDIR)/rendcore.Po \
2.101 +@AMDEP_TRUE@ ./$(DEPDIR)/render.Po ./$(DEPDIR)/rendsave.Po \
2.102 +@AMDEP_TRUE@ ./$(DEPDIR)/rendsort.Po ./$(DEPDIR)/scif.Po \
2.103 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4.Po ./$(DEPDIR)/sh4core.Po \
2.104 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4dasm.Po ./$(DEPDIR)/sh4mem.Po \
2.105 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4mmio.Po ./$(DEPDIR)/sh4stat.Po \
2.106 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4trans.Po ./$(DEPDIR)/sh4x86.Po \
2.107 +@AMDEP_TRUE@ ./$(DEPDIR)/support.Po ./$(DEPDIR)/syscall.Po \
2.108 +@AMDEP_TRUE@ ./$(DEPDIR)/tacore.Po ./$(DEPDIR)/testsh4x86.Po \
2.109 +@AMDEP_TRUE@ ./$(DEPDIR)/testxlt.Po ./$(DEPDIR)/texcache.Po \
2.110 +@AMDEP_TRUE@ ./$(DEPDIR)/timer.Po ./$(DEPDIR)/util.Po \
2.111 +@AMDEP_TRUE@ ./$(DEPDIR)/video_gtk.Po ./$(DEPDIR)/video_null.Po \
2.112 +@AMDEP_TRUE@ ./$(DEPDIR)/video_x11.Po ./$(DEPDIR)/watch.Po \
2.113 +@AMDEP_TRUE@ ./$(DEPDIR)/x86dasm.Po ./$(DEPDIR)/xltcache.Po \
2.114 +@AMDEP_TRUE@ ./$(DEPDIR)/yuv.Po
2.115 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
2.116 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
2.117 CCLD = $(CC)
2.118 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
2.119 -DIST_SOURCES = $(gendec_SOURCES) $(lxdream_SOURCES) \
2.120 +DIST_SOURCES = $(gendec_SOURCES) $(genglsl_SOURCES) $(lxdream_SOURCES) \
2.121 $(test_testsh4x86_SOURCES) $(test_testxlt_SOURCES)
2.122 DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
2.123 -SOURCES = $(gendec_SOURCES) $(lxdream_SOURCES) $(test_testsh4x86_SOURCES) $(test_testxlt_SOURCES)
2.124 +SOURCES = $(gendec_SOURCES) $(genglsl_SOURCES) $(lxdream_SOURCES) $(test_testsh4x86_SOURCES) $(test_testxlt_SOURCES)
2.125
2.126 all: $(BUILT_SOURCES)
2.127 $(MAKE) $(AM_MAKEFLAGS) all-am
2.128 @@ -340,6 +349,9 @@
2.129 gendec$(EXEEXT): $(gendec_OBJECTS) $(gendec_DEPENDENCIES)
2.130 @rm -f gendec$(EXEEXT)
2.131 $(LINK) $(gendec_LDFLAGS) $(gendec_OBJECTS) $(gendec_LDADD) $(LIBS)
2.132 +genglsl$(EXEEXT): $(genglsl_OBJECTS) $(genglsl_DEPENDENCIES)
2.133 + @rm -f genglsl$(EXEEXT)
2.134 + $(LINK) $(genglsl_LDFLAGS) $(genglsl_OBJECTS) $(genglsl_LDADD) $(LIBS)
2.135 lxdream$(EXEEXT): $(lxdream_OBJECTS) $(lxdream_DEPENDENCIES)
2.136 @rm -f lxdream$(EXEEXT)
2.137 $(LINK) $(lxdream_LDFLAGS) $(lxdream_OBJECTS) $(lxdream_LDADD) $(LIBS)
2.138 @@ -385,8 +397,11 @@
2.139 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdimage.Po@am__quote@
2.140 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdrom.Po@am__quote@
2.141 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gendec.Po@am__quote@
2.142 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genglsl.Po@am__quote@
2.143 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_common.Po@am__quote@
2.144 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_fbo.Po@am__quote@
2.145 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_sl.Po@am__quote@
2.146 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_slsrc.Po@am__quote@
2.147 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui.Po@am__quote@
2.148 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386-dis.Po@am__quote@
2.149 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ide.Po@am__quote@
2.150 @@ -520,6 +535,28 @@
2.151 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.152 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o actparse.obj `if test -f 'tools/actparse.c'; then $(CYGPATH_W) 'tools/actparse.c'; else $(CYGPATH_W) '$(srcdir)/tools/actparse.c'; fi`
2.153
2.154 +genglsl.o: tools/genglsl.c
2.155 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT genglsl.o -MD -MP -MF "$(DEPDIR)/genglsl.Tpo" \
2.156 +@am__fastdepCC_TRUE@ -c -o genglsl.o `test -f 'tools/genglsl.c' || echo '$(srcdir)/'`tools/genglsl.c; \
2.157 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/genglsl.Tpo" "$(DEPDIR)/genglsl.Po"; \
2.158 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/genglsl.Tpo"; exit 1; \
2.159 +@am__fastdepCC_TRUE@ fi
2.160 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tools/genglsl.c' object='genglsl.o' libtool=no @AMDEPBACKSLASH@
2.161 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/genglsl.Po' tmpdepfile='$(DEPDIR)/genglsl.TPo' @AMDEPBACKSLASH@
2.162 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.163 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o genglsl.o `test -f 'tools/genglsl.c' || echo '$(srcdir)/'`tools/genglsl.c
2.164 +
2.165 +genglsl.obj: tools/genglsl.c
2.166 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT genglsl.obj -MD -MP -MF "$(DEPDIR)/genglsl.Tpo" \
2.167 +@am__fastdepCC_TRUE@ -c -o genglsl.obj `if test -f 'tools/genglsl.c'; then $(CYGPATH_W) 'tools/genglsl.c'; else $(CYGPATH_W) '$(srcdir)/tools/genglsl.c'; fi`; \
2.168 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/genglsl.Tpo" "$(DEPDIR)/genglsl.Po"; \
2.169 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/genglsl.Tpo"; exit 1; \
2.170 +@am__fastdepCC_TRUE@ fi
2.171 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tools/genglsl.c' object='genglsl.obj' libtool=no @AMDEPBACKSLASH@
2.172 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/genglsl.Po' tmpdepfile='$(DEPDIR)/genglsl.TPo' @AMDEPBACKSLASH@
2.173 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.174 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o genglsl.obj `if test -f 'tools/genglsl.c'; then $(CYGPATH_W) 'tools/genglsl.c'; else $(CYGPATH_W) '$(srcdir)/tools/genglsl.c'; fi`
2.175 +
2.176 ide.o: gdrom/ide.c
2.177 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ide.o -MD -MP -MF "$(DEPDIR)/ide.Tpo" \
2.178 @am__fastdepCC_TRUE@ -c -o ide.o `test -f 'gdrom/ide.c' || echo '$(srcdir)/'`gdrom/ide.c; \
2.179 @@ -1708,6 +1745,50 @@
2.180 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.181 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_fbo.obj `if test -f 'drivers/gl_fbo.c'; then $(CYGPATH_W) 'drivers/gl_fbo.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_fbo.c'; fi`
2.182
2.183 +gl_sl.o: drivers/gl_sl.c
2.184 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_sl.o -MD -MP -MF "$(DEPDIR)/gl_sl.Tpo" \
2.185 +@am__fastdepCC_TRUE@ -c -o gl_sl.o `test -f 'drivers/gl_sl.c' || echo '$(srcdir)/'`drivers/gl_sl.c; \
2.186 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_sl.Tpo" "$(DEPDIR)/gl_sl.Po"; \
2.187 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_sl.Tpo"; exit 1; \
2.188 +@am__fastdepCC_TRUE@ fi
2.189 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_sl.c' object='gl_sl.o' libtool=no @AMDEPBACKSLASH@
2.190 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_sl.Po' tmpdepfile='$(DEPDIR)/gl_sl.TPo' @AMDEPBACKSLASH@
2.191 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.192 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_sl.o `test -f 'drivers/gl_sl.c' || echo '$(srcdir)/'`drivers/gl_sl.c
2.193 +
2.194 +gl_sl.obj: drivers/gl_sl.c
2.195 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_sl.obj -MD -MP -MF "$(DEPDIR)/gl_sl.Tpo" \
2.196 +@am__fastdepCC_TRUE@ -c -o gl_sl.obj `if test -f 'drivers/gl_sl.c'; then $(CYGPATH_W) 'drivers/gl_sl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_sl.c'; fi`; \
2.197 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_sl.Tpo" "$(DEPDIR)/gl_sl.Po"; \
2.198 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_sl.Tpo"; exit 1; \
2.199 +@am__fastdepCC_TRUE@ fi
2.200 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_sl.c' object='gl_sl.obj' libtool=no @AMDEPBACKSLASH@
2.201 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_sl.Po' tmpdepfile='$(DEPDIR)/gl_sl.TPo' @AMDEPBACKSLASH@
2.202 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.203 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_sl.obj `if test -f 'drivers/gl_sl.c'; then $(CYGPATH_W) 'drivers/gl_sl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_sl.c'; fi`
2.204 +
2.205 +gl_slsrc.o: drivers/gl_slsrc.c
2.206 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_slsrc.o -MD -MP -MF "$(DEPDIR)/gl_slsrc.Tpo" \
2.207 +@am__fastdepCC_TRUE@ -c -o gl_slsrc.o `test -f 'drivers/gl_slsrc.c' || echo '$(srcdir)/'`drivers/gl_slsrc.c; \
2.208 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_slsrc.Tpo" "$(DEPDIR)/gl_slsrc.Po"; \
2.209 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_slsrc.Tpo"; exit 1; \
2.210 +@am__fastdepCC_TRUE@ fi
2.211 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_slsrc.c' object='gl_slsrc.o' libtool=no @AMDEPBACKSLASH@
2.212 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_slsrc.Po' tmpdepfile='$(DEPDIR)/gl_slsrc.TPo' @AMDEPBACKSLASH@
2.213 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.214 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_slsrc.o `test -f 'drivers/gl_slsrc.c' || echo '$(srcdir)/'`drivers/gl_slsrc.c
2.215 +
2.216 +gl_slsrc.obj: drivers/gl_slsrc.c
2.217 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_slsrc.obj -MD -MP -MF "$(DEPDIR)/gl_slsrc.Tpo" \
2.218 +@am__fastdepCC_TRUE@ -c -o gl_slsrc.obj `if test -f 'drivers/gl_slsrc.c'; then $(CYGPATH_W) 'drivers/gl_slsrc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_slsrc.c'; fi`; \
2.219 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_slsrc.Tpo" "$(DEPDIR)/gl_slsrc.Po"; \
2.220 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_slsrc.Tpo"; exit 1; \
2.221 +@am__fastdepCC_TRUE@ fi
2.222 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_slsrc.c' object='gl_slsrc.obj' libtool=no @AMDEPBACKSLASH@
2.223 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_slsrc.Po' tmpdepfile='$(DEPDIR)/gl_slsrc.TPo' @AMDEPBACKSLASH@
2.224 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.225 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_slsrc.obj `if test -f 'drivers/gl_slsrc.c'; then $(CYGPATH_W) 'drivers/gl_slsrc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_slsrc.c'; fi`
2.226 +
2.227 testsh4x86.o: test/testsh4x86.c
2.228 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsh4x86.o -MD -MP -MF "$(DEPDIR)/testsh4x86.Tpo" \
2.229 @am__fastdepCC_TRUE@ -c -o testsh4x86.o `test -f 'test/testsh4x86.c' || echo '$(srcdir)/'`test/testsh4x86.c; \
2.230 @@ -2016,6 +2097,8 @@
2.231 ./gendec sh4/sh4.def sh4/sh4x86.in -o sh4/sh4x86.c
2.232 sh4/sh4stat.c: gendec sh4/sh4.def sh4/sh4stat.in
2.233 ./gendec sh4/sh4.def sh4/sh4stat.in -o sh4/sh4stat.c
2.234 +drivers/gl_slsrc.c: genglsl drivers/vertex.glsl drivers/fragment.glsl
2.235 + ./genglsl drivers/vertex.glsl drivers/fragment.glsl drivers/gl_slsrc.c
2.236 # Tell versions [3.59,3.63) of GNU make to not export all variables.
2.237 # Otherwise a system limit (for SysV at least) may be exceeded.
2.238 .NOEXPORT:
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/src/drivers/fragment.glsl Fri Sep 28 07:24:14 2007 +0000
3.3 @@ -0,0 +1,6 @@
3.4 +// Standard PVR2 fragment shader
3.5 +
3.6 +void main()
3.7 +{
3.8 + gl_FragColor = gl_Color;
3.9 +}
3.10 \ No newline at end of file
4.1 --- a/src/drivers/gl_common.h Fri Sep 28 07:21:58 2007 +0000
4.2 +++ b/src/drivers/gl_common.h Fri Sep 28 07:24:14 2007 +0000
4.3 @@ -1,5 +1,5 @@
4.4 /**
4.5 - * $Id: gl_common.h,v 1.1 2007-02-11 10:09:32 nkeynes Exp $
4.6 + * $Id: gl_common.h,v 1.2 2007-09-28 07:24:14 nkeynes Exp $
4.7 *
4.8 * Parent for all X11 display drivers.
4.9 *
4.10 @@ -54,4 +54,12 @@
4.11 void gl_fbo_shutdown();
4.12 void gl_fbo_init( display_driver_t driver );
4.13
4.14 +/****** Shader handling (gl_sl.c) *****/
4.15 +gboolean glsl_is_supported(void);
4.16 +gboolean glsl_load_shaders( const char *vert_shader, const char *frag_shader );
4.17 +void glsl_unload_shaders(void);
4.18 +
4.19 +extern const char *glsl_vertex_shader_src;
4.20 +extern const char *glsl_fragment_shader_src;
4.21 +
4.22 #endif /* !video_gl_common_H */
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/src/drivers/gl_sl.c Fri Sep 28 07:24:14 2007 +0000
5.3 @@ -0,0 +1,171 @@
5.4 +/**
5.5 + * $Id: gl_sl.c,v 1.1 2007-09-28 07:24:14 nkeynes Exp $
5.6 + *
5.7 + * GLSL shader loader/unloader. Current version assumes there's exactly
5.8 + * 1 shader program that's used globally. This may turn out not to be the
5.9 + * most efficient approach.
5.10 + *
5.11 + * Copyright (c) 2007 Nathan Keynes.
5.12 + *
5.13 + * This program is free software; you can redistribute it and/or modify
5.14 + * it under the terms of the GNU General Public License as published by
5.15 + * the Free Software Foundation; either version 2 of the License, or
5.16 + * (at your option) any later version.
5.17 + *
5.18 + * This program is distributed in the hope that it will be useful,
5.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.21 + * GNU General Public License for more details.
5.22 + */
5.23 +
5.24 +
5.25 +#include <GL/gl.h>
5.26 +#include <GL/glext.h>
5.27 +#include "drivers/gl_common.h"
5.28 +#include "display.h"
5.29 +
5.30 +#define MAX_ERROR_BUF 4096
5.31 +
5.32 +static GLuint glsl_program, glsl_vert_shader, glsl_frag_shader;
5.33 +
5.34 +gboolean glsl_is_supported()
5.35 +{
5.36 + return isGLExtensionSupported("GL_ARB_fragment_shader") &&
5.37 + isGLExtensionSupported("GL_ARB_vertex_shader") &&
5.38 + isGLExtensionSupported("GL_ARB_shading_language_100");
5.39 +}
5.40 +
5.41 +#ifdef GL_ARB_shader_objects
5.42 +void glsl_print_error( char *msg, GLhandleARB obj )
5.43 +{
5.44 + char buf[MAX_ERROR_BUF];
5.45 + GLsizei length;
5.46 + glGetInfoLogARB( obj, sizeof(buf), &length, buf );
5.47 + ERROR( "%s: %s", msg, buf );
5.48 +}
5.49 +
5.50 +gboolean glsl_check_shader_error( char *msg, GLhandleARB obj )
5.51 +{
5.52 + GLint value;
5.53 +
5.54 + glGetObjectParameterivARB(obj, GL_OBJECT_COMPILE_STATUS_ARB, &value);
5.55 + if( value == 0 ) {
5.56 + glsl_print_error(msg, obj);
5.57 + return FALSE;
5.58 + }
5.59 + return TRUE;
5.60 +}
5.61 +
5.62 +gboolean glsl_check_program_error( char *msg, GLhandleARB obj )
5.63 +{
5.64 + if( glGetError() != GL_NO_ERROR ) {
5.65 + glsl_print_error(msg, obj);
5.66 + }
5.67 + return TRUE;
5.68 +}
5.69 +
5.70 +
5.71 +gboolean glsl_load_shaders( const char *vertex_src, const char *fragment_src )
5.72 +{
5.73 + gboolean vsok, fsok, pok = FALSE;
5.74 + glsl_program = glCreateProgramObjectARB();
5.75 +
5.76 + glsl_vert_shader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
5.77 + glsl_frag_shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
5.78 + glShaderSourceARB( glsl_vert_shader, 1, &vertex_src, NULL );
5.79 + glCompileShaderARB(glsl_vert_shader);
5.80 + vsok = glsl_check_shader_error("Failed to compile vertex shader", glsl_vert_shader);
5.81 + glShaderSourceARB( glsl_frag_shader, 1, &fragment_src, NULL );
5.82 + glCompileShaderARB(glsl_frag_shader);
5.83 + fsok = glsl_check_shader_error("Failed to compile fragment shader", glsl_frag_shader);
5.84 +
5.85 + if( vsok && fsok ) {
5.86 + glAttachObjectARB(glsl_program, glsl_vert_shader);
5.87 + glAttachObjectARB(glsl_program, glsl_frag_shader);
5.88 + glLinkProgramARB(glsl_program);
5.89 + pok = glsl_check_program_error( "Failed to link shader program", glsl_program );
5.90 + }
5.91 + if( pok ) {
5.92 + glUseProgramObjectARB(glsl_program);
5.93 + pok = glsl_check_program_error( "Failed to apply shader program", glsl_program );
5.94 + } else {
5.95 + glsl_unload_shaders();
5.96 + }
5.97 + return pok;
5.98 +}
5.99 +
5.100 +void glsl_unload_shaders(void)
5.101 +{
5.102 + glUseProgramObjectARB(0);
5.103 + glDetachObjectARB(glsl_program, glsl_vert_shader);
5.104 + glDetachObjectARB(glsl_program, glsl_frag_shader);
5.105 + glDeleteObjectARB(glsl_program);
5.106 + glDeleteObjectARB(glsl_vert_shader);
5.107 + glDeleteObjectARB(glsl_frag_shader);
5.108 +}
5.109 +
5.110 +#else
5.111 +gboolean glsl_check_shader_error( char *msg, GLuint shader )
5.112 +{
5.113 + GLint value;
5.114 +
5.115 + glGetShaderiv( shader, GL_COMPILE_STATUS, &value );
5.116 + if( value == 0 ) {
5.117 + char buf[MAX_ERROR_BUF];
5.118 + GLsizei length;
5.119 + glGetShaderInfoLog( shader, sizeof(buf), &length, buf );
5.120 + ERROR( "%s: %s", msg, buf );
5.121 + return FALSE;
5.122 + }
5.123 + return TRUE;
5.124 +}
5.125 +gboolean glsl_check_program_error( char *msg, GLuint program )
5.126 +{
5.127 + if( glGetError() != GL_NO_ERROR ) {
5.128 + char buf[MAX_ERROR_BUF];
5.129 + GLsizei length;
5.130 + glGetProgramInfoLog( program, sizeof(buf), &length, buf );
5.131 + ERROR( "%s: %s", msg, buf );
5.132 + return FALSE;
5.133 + }
5.134 + return TRUE;
5.135 +}
5.136 +
5.137 +gboolean glsl_load_shaders( const char *vertex_src, const char *fragment_src )
5.138 +{
5.139 + gboolean vsok, fsok, pok = FALSE;
5.140 + glsl_program = glCreateProgram();
5.141 + glsl_vert_shader = glCreateShader(GL_VERTEX_SHADER);
5.142 + glsl_frag_shader = glCreateShader(GL_FRAGMENT_SHADER);
5.143 + glShaderSource( glsl_vert_shader, 1, &vertex_src, NULL );
5.144 + glCompileShader(glsl_vert_shader);
5.145 + vsok = glsl_check_shader_error( "Failed to compile vertex shader", glsl_vert_shader );
5.146 + glShaderSource( glsl_frag_shader, 1, &fragment_src, NULL );
5.147 + glCompileShader(glsl_frag_shader);
5.148 + fsok = glsl_check_shader_error( "Failed to compile fragment shader", glsl_frag_shader );
5.149 +
5.150 + if( vsok && fsok ) {
5.151 + glAttachShader(glsl_program, glsl_vert_shader);
5.152 + glAttachShader(glsl_program, glsl_frag_shader);
5.153 + glLinkProgram(glsl_program);
5.154 + pok = glsl_check_program_error( "Failed to link shader program", glsl_program );
5.155 + }
5.156 +
5.157 + if( pok ) {
5.158 + glUseProgram(glsl_program);
5.159 + } else {
5.160 + glsl_unload_shaders();
5.161 + }
5.162 + return pok;
5.163 +}
5.164 +
5.165 +void glsl_unload_shaders(void)
5.166 +{
5.167 + glUseProgram(0);
5.168 + glDetachShader(glsl_program, glsl_vert_shader);
5.169 + glDetachShader(glsl_program, glsl_frag_shader);
5.170 + glDeleteProgram(glsl_program);
5.171 + glDeleteShader(glsl_vert_shader);
5.172 + glDeleteShader(glsl_frag_shader);
5.173 +}
5.174 +#endif
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/src/drivers/gl_slsrc.c Fri Sep 28 07:24:14 2007 +0000
6.3 @@ -0,0 +1,19 @@
6.4 +/**
6.5 + * This file is automatically generated - do not edit
6.6 + */
6.7 +
6.8 +const char *glsl_vertex_shader_src = "// Standard PVR2 vertex shader\n\
6.9 +\n\
6.10 +void main()\n\
6.11 +{\n\
6.12 + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n\
6.13 +}\n\
6.14 +";
6.15 +
6.16 +const char *glsl_fragment_shader_src = "// Standard PVR2 fragment shader\n\
6.17 +\n\
6.18 +void main()\n\
6.19 +{\n\
6.20 + gl_FragColor = gl_Color;\n\
6.21 +}";
6.22 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/src/drivers/vertex.glsl Fri Sep 28 07:24:14 2007 +0000
7.3 @@ -0,0 +1,6 @@
7.4 +// Standard PVR2 vertex shader
7.5 +
7.6 +void main()
7.7 +{
7.8 + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
7.9 +}
8.1 --- a/src/drivers/video_x11.c Fri Sep 28 07:21:58 2007 +0000
8.2 +++ b/src/drivers/video_x11.c Fri Sep 28 07:24:14 2007 +0000
8.3 @@ -1,5 +1,5 @@
8.4 /**
8.5 - * $Id: video_x11.c,v 1.13 2007-09-08 04:05:35 nkeynes Exp $
8.6 + * $Id: video_x11.c,v 1.14 2007-09-28 07:24:14 nkeynes Exp $
8.7 *
8.8 * Shared functions for all X11-based display drivers.
8.9 *
8.10 @@ -20,6 +20,7 @@
8.11 #include <GL/glx.h>
8.12 #include "dream.h"
8.13 #include "drivers/video_x11.h"
8.14 +#include "drivers/gl_common.h"
8.15
8.16 extern uint32_t video_width, video_height;
8.17
8.18 @@ -30,6 +31,7 @@
8.19 static Display *video_x11_display = NULL;
8.20 static Screen *video_x11_screen = NULL;
8.21 static Window video_x11_window = 0;
8.22 +static gboolean glsl_loaded = FALSE;
8.23
8.24 /**
8.25 * GLX parameters.
8.26 @@ -51,6 +53,17 @@
8.27
8.28 if( gl_fbo_is_supported() ) {
8.29 gl_fbo_init(driver);
8.30 +
8.31 +#ifdef USE_GLSL
8.32 + if( glsl_is_supported() ) {
8.33 + glsl_loaded = glsl_load_shaders( glsl_vertex_shader_src, glsl_fragment_shader_src );
8.34 + if( !glsl_loaded ) {
8.35 + WARN( "Shaders failed to load" );
8.36 + }
8.37 + } else {
8.38 + WARN( "Shaders not supported" );
8.39 + }
8.40 +#endif
8.41 return TRUE;
8.42 } else {
8.43 /* Pbuffers? */
8.44 @@ -138,6 +151,9 @@
8.45
8.46 void video_glx_shutdown()
8.47 {
8.48 + if( glsl_loaded ) {
8.49 + glsl_unload_shaders();
8.50 + }
8.51 if( glx_window != None ) {
8.52 XDestroyWindow( video_x11_display, glx_window );
8.53 XFreeColormap( video_x11_display, win_attrs.colormap );
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/src/tools/genglsl.c Fri Sep 28 07:24:14 2007 +0000
9.3 @@ -0,0 +1,78 @@
9.4 +/**
9.5 + * $Id: genglsl.c,v 1.1 2007-09-28 07:24:14 nkeynes Exp $
9.6 + *
9.7 + * Trivial tool to take two shader source files and dump them out in
9.8 + * a C file with appropriate escaping.
9.9 + *
9.10 + * Copyright (c) 2007 Nathan Keynes.
9.11 + *
9.12 + * This program is free software; you can redistribute it and/or modify
9.13 + * it under the terms of the GNU General Public License as published by
9.14 + * the Free Software Foundation; either version 2 of the License, or
9.15 + * (at your option) any later version.
9.16 + *
9.17 + * This program is distributed in the hope that it will be useful,
9.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.20 + * GNU General Public License for more details.
9.21 + */
9.22 +
9.23 +#include <stdio.h>
9.24 +#include <stdlib.h>
9.25 +
9.26 +/**
9.27 + * Copy input to output, quoting " characters as we go.
9.28 + */
9.29 +void writeShader( FILE *out, FILE *in )
9.30 +{
9.31 + int ch;
9.32 +
9.33 + while( (ch = fgetc(in)) != EOF ) {
9.34 + if( ch == '\"' ) {
9.35 + fputc( '\\', out );
9.36 + } else if( ch == '\n') {
9.37 + fputs( "\\n\\", out );
9.38 + }
9.39 + fputc( ch, out );
9.40 + }
9.41 +}
9.42 +
9.43 +int main( int argc, char *argv[] )
9.44 +{
9.45 + if( argc != 4 ) {
9.46 + fprintf( stderr, "Usage: genglsl <vertex-shader-file> <fragment-shader-file> <output-file>\n");
9.47 + exit(1);
9.48 + }
9.49 +
9.50 + FILE *vsin = fopen( argv[1], "ro" );
9.51 + if( vsin == NULL ) {
9.52 + perror( "Unable to open vertex shader source" );
9.53 + exit(2);
9.54 + }
9.55 +
9.56 + FILE *fsin = fopen( argv[2], "ro" );
9.57 + if( fsin == NULL ) {
9.58 + perror( "Unable to open fragment shader source" );
9.59 + exit(2);
9.60 + }
9.61 +
9.62 + FILE *out = fopen( argv[3], "wo" );
9.63 + if( out == NULL ) {
9.64 + perror( "Unable to open output file" );
9.65 + exit(2);
9.66 + }
9.67 +
9.68 + fprintf( out, "/**\n * This file is automatically generated - do not edit\n */\n\n" );
9.69 + fprintf( out, "const char *glsl_vertex_shader_src = \"" );
9.70 +
9.71 + writeShader( out, vsin );
9.72 +
9.73 + fprintf( out, "\";\n\n" );
9.74 + fprintf( out, "const char *glsl_fragment_shader_src = \"" );
9.75 + writeShader( out, fsin );
9.76 + fprintf( out, "\";\n\n" );
9.77 + fclose( fsin );
9.78 + fclose( vsin );
9.79 + fclose( out );
9.80 + return 0;
9.81 +}
.