Make a start on making a pure GLSL renderer.

For now, only nq-glslx will be built, but as there is no actual code, it
doesn't link. However, this gets the glsl stuff into the build system.
This commit is contained in:
Bill Currie 2011-12-23 12:19:13 +09:00
parent 890963423b
commit 497461b4c2
14 changed files with 382 additions and 17 deletions

View file

@ -28,6 +28,7 @@
libs/video/Makefile
libs/video/renderer/Makefile
libs/video/renderer/gl/Makefile
libs/video/renderer/glsl/Makefile
libs/video/renderer/sw/Makefile
libs/video/renderer/sw32/Makefile
libs/video/targets/Makefile

View file

@ -5,7 +5,7 @@ dnl ==================================================================
QF_WITH_TARGETS(
clients,
[ --with-clients=<list> compile clients in <list>:],
[3dfx,fbdev,glx,mgl,sdl,sdl32,sgl,svga,wgl,x11],dummy
[3dfx,fbdev,glx,glslx,mgl,sdl,sdl32,sgl,svga,wgl,x11],dummy
)
QF_WITH_TARGETS(
servers,
@ -27,9 +27,11 @@ QW_DESKTOP_DATA=""
NQ_DESKTOP_DATA=""
BUILD_GL=no
BUILD_GLSL=no
BUILD_SW32=no
BUILD_SW=no
CAN_BUILD_GL=no
CAN_BUILD_GLSL=no
CAN_BUILD_SW32=no
CAN_BUILD_SW=no
@ -58,6 +60,7 @@ if test "x$HAVE_FBDEV" = xyes; then
fi
if test "x$HAVE_X" = xyes; then
CAN_BUILD_GL=yes
CAN_BUILD_GLSL=yes
CAN_BUILD_SW=yes
if test "x$ENABLE_clients_glx" = xyes; then
QW_TARGETS="$QW_TARGETS qw-client-glx\$(EXEEXT)"
@ -72,6 +75,19 @@ if test "x$HAVE_X" = xyes; then
QF_NEED(nq, [client common])
QF_NEED(console, [client])
fi
if test "x$ENABLE_clients_glslx" = xyes; then
#QW_TARGETS="$QW_TARGETS qw-client-glslx\$(EXEEXT)"
NQ_TARGETS="$NQ_TARGETS nq-glslx\$(EXEEXT)"
#QW_DESKTOP_DATA="$QW_DESKTOP_DATA quakeforge-qw-glx.desktop"
NQ_DESKTOP_DATA="$NQ_DESKTOP_DATA quakeforge-nq-glslx.desktop"
CL_TARGETS="$CL_TARGETS GLSLX"
VID_TARGETS="$VID_TARGETS libQFglslx.la"
BUILD_GLSL=yes
QF_NEED(vid, [common glsl x11])
#QF_NEED(qw, [client common])
QF_NEED(nq, [client common])
QF_NEED(console, [client])
fi
if test "x$ENABLE_clients_x11" = xyes; then
QW_TARGETS="$QW_TARGETS qw-client-x11\$(EXEEXT)"
NQ_TARGETS="$NQ_TARGETS nq-x11\$(EXEEXT)"
@ -281,12 +297,17 @@ if test "x$BUILD_GL" = xyes; then
VID_REND_TARGETS="$VID_REND_TARGETS libQFrenderer_gl.la"
VID_MODEL_TARGETS="$VID_MODEL_TARGETS libQFmodels_gl.la"
fi
if test "x$BUILD_GL" = xyes; then
VID_REND_TARGETS="$VID_REND_TARGETS libQFrenderer_glsl.la"
VID_MODEL_TARGETS="$VID_MODEL_TARGETS libQFmodels_glsl.la"
fi
QF_PROCESS_NEED(vid, [asm common gl sdl sw sw32 svga x11])
QF_PROCESS_NEED(vid, [asm common gl glsl sdl sw sw32 svga x11])
QF_PROCESS_NEED(qw, [client common sdl server], a)
QF_PROCESS_NEED(nq, [client common sdl server], a)
AC_SUBST(CAN_BUILD_GL)
AC_SUBST(CAN_BUILD_GLSL)
AC_SUBST(CAN_BUILD_SW)
AC_SUBST(CAN_BUILD_SW32)
@ -587,6 +608,7 @@ QF_DEPS(WAV,
)
AM_CONDITIONAL(BUILD_GL, test "$BUILD_GL" = "yes")
AM_CONDITIONAL(BUILD_GLSL, test "$BUILD_GLSL" = "yes")
AM_CONDITIONAL(BUILD_SW, test "$BUILD_SW" = "yes")
AM_CONDITIONAL(BUILD_SW_ASM, test "$BUILD_SW" = "yes" -a "$ASM_ARCH" = "yes")
AM_CONDITIONAL(BUILD_SW_MOD, test "$BUILD_SW" = "yes" -o "$BUILD_SW32" = "yes")

View file

@ -5,7 +5,7 @@ AM_CFLAGS= @PREFER_PIC@
INCLUDES= -I$(top_srcdir)/include
lib_LTLIBRARIES= libQFmodels.la @VID_MODEL_TARGETS@
EXTRA_LTLIBRARIES= libQFmodels_gl.la libQFmodels_sw.la
EXTRA_LTLIBRARIES= libQFmodels_gl.la libQFmodels_glsl.la libQFmodels_sw.la
models_sources = clip_hull.c model.c portal.c trace.c winding.c
@ -21,6 +21,13 @@ libQFmodels_gl_la_LIBADD= $(gl_LIBS) $(top_builddir)/libs/util/libQFutil.la
libQFmodels_gl_la_SOURCES= $(models_sources) gl_model_fullbright.c
libQFmodels_gl_la_DEPENDENCIES= $(gl_LIBS)
glsl_LIBS= \
alias/libalias_glsl.la brush/libbrush_glsl.la sprite/libsprite_glsl.la
libQFmodels_glsl_la_LDFLAGS= -version-info $(QUAKE_LIBRARY_VERSION_INFO) -rpath $(libdir)
libQFmodels_glsl_la_LIBADD= $(glsl_LIBS) $(top_builddir)/libs/util/libQFutil.la
libQFmodels_glsl_la_SOURCES= $(models_sources) gl_model_fullbright.c
libQFmodels_glsl_la_DEPENDENCIES= $(glsl_LIBS)
sw_LIBS= \
alias/libalias_sw.la brush/libbrush_sw.la sprite/libsprite_sw.la
libQFmodels_sw_la_LDFLAGS= -version-info $(QUAKE_LIBRARY_VERSION_INFO) -rpath $(libdir) -no-undefined

View file

@ -9,20 +9,29 @@ else
gl=
endif
if BUILD_GLSL
glsl= libalias_glsl.la
else
glsl=
endif
if BUILD_SW_MOD
sw= libalias_sw.la
else
sw=
endif
noinst_LTLIBRARIES= $(gl) $(sw)
noinst_LTLIBRARIES= $(gl) $(glsl) $(sw)
alias_src= model_alias.c
gl_src= gl_mesh.c gl_model_alias.c
glsl_src= glsl_mesh.c glsl_model_alias.c
sw_src= sw_model_alias.c
libalias_gl_la_SOURCES= $(gl_src) $(alias_src)
libalias_glsl_la_SOURCES= $(glsl_src) $(alias_src)
libalias_sw_la_SOURCES= $(sw_src) $(alias_src)
EXTRA_DIST= $(gl_src) $(sw_src) $(alias_src)
EXTRA_DIST= $(gl_src) $(glsl_src) $(sw_src) $(alias_src)

View file

@ -0,0 +1,50 @@
/*
glsl_mesh.c
Alias model mesh processing for GLSL
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2011/12/23
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] = "$Id$";
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdio.h>
#include "QF/model.h"
void
Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s, int extra)
{
}

View file

@ -0,0 +1,74 @@
/*
glsl_model_alais.c
Alias model processing for GLSL
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2011/12/23
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] = "$Id$";
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "QF/model.h"
void *
Mod_LoadSkin (byte * skin, int skinsize, int snum, int gnum, qboolean group,
maliasskindesc_t *skindesc)
{
return 0;
}
void *
Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame,
int extra)
{
return 0;
}
void *
Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame,
int extra)
{
return 0;
}
void
Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
{
}
void
Mod_LoadExternalSkins (model_t *mod)
{
}

View file

@ -9,22 +9,31 @@ else
gl=
endif
if BUILD_GLSL
glsl= libbrush_glsl.la
else
glsl=
endif
if BUILD_SW_MOD
sw= libbrush_sw.la
else
sw=
endif
noinst_LTLIBRARIES= libbrush.la $(gl) $(sw)
noinst_LTLIBRARIES= libbrush.la $(gl) $(glsl) $(sw)
brush_src= model_brush.c
gl_src= gl_model_brush.c
glsl_src= glsl_model_brush.c
sw_src= sw_model_brush.c
libbrush_la_SOURCES= $(brush_src)
libbrush_gl_la_SOURCES= $(gl_src) $(brush_src)
libbrush_glsl_la_SOURCES= $(glsl_src) $(brush_src)
libbrush_sw_la_SOURCES= $(sw_src) $(brush_src)
EXTRA_DIST= $(gl_src) $(sw_src) $(brush_src)
EXTRA_DIST= $(gl_src) $(glsl_src) $(sw_src) $(brush_src)

View file

@ -0,0 +1,77 @@
/*
glsl_model_brush.c
Brush model mesh processing for GLSL
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2011/12/23
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
// models are the only shared resource between a client and server running
// on the same machine.
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] = "$Id$";
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "QF/cvar.h"
#include "QF/dstring.h"
#include "QF/image.h"
#include "QF/model.h"
#include "QF/qendian.h"
#include "QF/quakefs.h"
#include "QF/sys.h"
#include "QF/va.h"
#include "QF/vid.h"
#include "QF/GL/qf_textures.h"
#include "compat.h"
void
Mod_ProcessTexture (miptex_t *mt, texture_t *tx)
{
}
void
Mod_LoadExternalTextures (model_t *mod)
{
}
void
Mod_LoadLighting (bsp_t *bsp)
{
}
void
Mod_SubdivideSurface (msurface_t *fa)
{
}

View file

@ -9,20 +9,29 @@ else
gl=
endif
if BUILD_GLSL
glsl= libsprite_glsl.la
else
glsl=
endif
if BUILD_SW_MOD
sw= libsprite_sw.la
else
sw=
endif
noinst_LTLIBRARIES= $(gl) $(sw)
noinst_LTLIBRARIES= $(gl) $(glsl) $(sw)
sprite_src= model_sprite.c
gl_src= gl_model_sprite.c
glsl_src= glsl_model_sprite.c
sw_src= sw_model_sprite.c
libsprite_gl_la_SOURCES= $(gl_src) $(sprite_src)
libsprite_glsl_la_SOURCES= $(glsl_src) $(sprite_src)
libsprite_sw_la_SOURCES= $(sw_src) $(sprite_src)
EXTRA_DIST= $(gl_src) $(sw_src) $(sprite_src)
EXTRA_DIST= $(gl_src) $(glsl_src) $(sw_src) $(sprite_src)

View file

@ -0,0 +1,55 @@
/*
glsl_model_sprite.c
Sprite model mesh processing for GLSL
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2011/12/23
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "QF/image.h"
#include "QF/model.h"
#include "QF/quakefs.h"
#include "QF/va.h"
#include "QF/GL/qf_textures.h"
#include "compat.h"
void
Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
{
}

View file

@ -1,12 +1,13 @@
AUTOMAKE_OPTIONS= foreign
SUBDIRS= gl sw sw32
SUBDIRS= gl glsl sw sw32
INCLUDES= -I$(top_srcdir)/include
lib_LTLIBRARIES= @VID_REND_TARGETS@
noinst_LTLIBRARIES= @VID_REND_NOINST_TARGETS@
EXTRA_LTLIBRARIES= libQFrenderer_sw.la libQFrenderer_sw32.la libQFrenderer_gl.la
EXTRA_LTLIBRARIES= libQFrenderer_sw.la libQFrenderer_sw32.la \
libQFrenderer_gl.la libQFrenderer_glsl.la
common_sources= \
r_cvar.c r_efrag.c r_ent.c r_graph.c r_light.c r_main.c \
@ -17,6 +18,11 @@ libQFrenderer_gl_la_LIBADD= gl/libgl.la
libQFrenderer_gl_la_SOURCES= $(common_sources)
libQFrenderer_gl_la_DEPENDENCIES= gl/libgl.la
libQFrenderer_glsl_la_LDFLAGS= -version-info $(QUAKE_LIBRARY_VERSION_INFO) -rpath $(libdir)
libQFrenderer_glsl_la_LIBADD= glsl/libglsl.la
libQFrenderer_glsl_la_SOURCES= $(common_sources)
libQFrenderer_glsl_la_DEPENDENCIES= glsl/libglsl.la
libQFrenderer_sw_la_LDFLAGS= @STATIC@
libQFrenderer_sw_la_LIBADD= sw/libsw.la
libQFrenderer_sw_la_SOURCES= $(common_sources)

View file

@ -0,0 +1,16 @@
AUTOMAKE_OPTIONS= foreign
AM_CFLAGS= @PREFER_PIC@
INCLUDES= -I$(top_srcdir)/include $(GLX_CFLAGS)
if BUILD_GL
noinst_LTLIBRARIES= libglsl.la
else
noinst_LTLIBRARIES=
endif
glsl_src =
libglsl_la_SOURCES= $(glsl_src)
EXTRA_DIST = $(glsl_src)

View file

@ -13,10 +13,10 @@ lib_LTLIBRARIES= @JOY_TARGETS@
noinst_LTLIBRARIES= @VID_TARGETS@ @vid_libs@
EXTRA_LTLIBRARIES= \
libQFjs.la libQFfbdev.la libQFglx.la libQFsvga.la libQFtdfx.la \
libQFx11.la libQFsdl.la libQFsdl32.la libQFsgl.la libQFwgl.la \
libvid_asm.la libvid_common.la libvid_gl.la libvid_sdl.la \
libvid_sw.la libvid_sw32.la libvid_svga.la libvid_x11.la
libQFjs.la libQFfbdev.la libQFglx.la libQFglslx.la libQFsvga.la \
libQFtdfx.la libQFx11.la libQFsdl.la libQFsdl32.la libQFsgl.la \
libQFwgl.la libvid_asm.la libvid_common.la libvid_gl.la libvid_glsl.la \
libvid_sdl.la libvid_sw.la libvid_sw32.la libvid_svga.la libvid_x11.la
libvid_asm_la_SOURCES= d_copy.S
libvid_asm_la_CFLAGS= @PREFER_NON_PIC@
@ -56,6 +56,10 @@ libvid_gl_la_SOURCES= vid_common_gl.c qfgl_ext.c vtxarray.c
libvid_gl_la_CFLAGS= @PREFER_NON_PIC@
libvid_gl_la_LDFLAGS= @STATIC@
libvid_glsl_la_SOURCES= vid_common_gl.c qfgl_ext.c vtxarray.c
libvid_glsl_la_CFLAGS= @PREFER_NON_PIC@
libvid_glsl_la_LDFLAGS= @STATIC@
libvid_x11_la_SOURCES= in_x11.c context_x11.c dga_check.c
libvid_x11_la_CFLAGS= @PREFER_NON_PIC@ $(X_CFLAGS)
libvid_x11_la_LDFLAGS= @STATIC@
@ -92,6 +96,15 @@ libQFglx_la_LDFLAGS= @STATIC@
libQFglx_la_LIBADD= libvid_common.la libvid_gl.la libvid_x11.la
libQFglx_la_DEPENDENCIES= libvid_common.la libvid_gl.la libvid_x11.la
#
# OpenGL in X Window
#
libQFglslx_la_CFLAGS= @PREFER_NON_PIC@ $(X_CFLAGS)
libQFglslx_la_SOURCES= vid_glx.c
libQFglslx_la_LDFLAGS= @STATIC@
libQFglslx_la_LIBADD= libvid_common.la libvid_glsl.la libvid_x11.la
libQFglslx_la_DEPENDENCIES= libvid_common.la libvid_glsl.la libvid_x11.la
#
# Simple DirectMedia Library
#

View file

@ -36,8 +36,8 @@ AM_CFLAGS= @PTHREAD_CFLAGS@
bin_PROGRAMS= @NQ_TARGETS@
EXTRA_PROGRAMS= nq-fbdev nq-glx nq-mgl nq-sdl nq-sdl32 nq-sgl nq-svga nq-3dfx \
nq-wgl nq-x11 nq-server
EXTRA_PROGRAMS= nq-fbdev nq-glx nq-glslx nq-mgl nq-sdl nq-sdl32 nq-sgl \
nq-svga nq-3dfx nq-wgl nq-x11 nq-server
noinst_LIBRARIES= @nq_libs@
EXTRA_LIBRARIES=libnq_client.a libnq_common.a libnq_sdl.a libnq_server.a
@ -176,6 +176,10 @@ opengl_QFLIBS= \
$(top_builddir)/libs/video/renderer/libQFrenderer_gl.la \
$(top_builddir)/libs/models/libQFmodels_gl.la
glsl_QFLIBS= \
$(top_builddir)/libs/video/renderer/libQFrenderer_glsl.la \
$(top_builddir)/libs/models/libQFmodels_glsl.la
# ... Linux 3DFX
nq_3dfx_libs= \
$(client_libs) \
@ -202,6 +206,19 @@ nq_glx_LDADD= $(nq_glx_libs) \
nq_glx_LDFLAGS= $(common_ldflags)
nq_glx_DEPENDENCIES= $(nq_glx_libs)
nq_glslx_libs= \
$(client_libs) \
$(cl_plugin_LIBS) \
$(glsl_QFLIBS) \
$(top_builddir)/libs/video/targets/libQFglslx.la \
$(client_LIBS)
nq_glslx_SOURCES= sys_unix.c
nq_glslx_LDADD= $(nq_glslx_libs) \
$(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 \
-lXext $(X_EXTRA_LIBS) $(DL_LIBS) $(NET_LIBS)
nq_glslx_LDFLAGS= $(common_ldflags)
nq_glslx_DEPENDENCIES= $(nq_glslx_libs)
# ... Simple Directmedia Layer, version 1.2 and higher, in GL mode
nq_sgl_libs= \
libnq_sdl.a \