Merge master into csqc-improvements

That was a mess
This commit is contained in:
Bill Currie 2021-03-25 22:01:31 +09:00
commit c9f1d770e0
1330 changed files with 76887 additions and 82690 deletions

1
.gitignore vendored
View file

@ -37,6 +37,7 @@ core
/mkinstalldirs /mkinstalldirs
/quakeforge-config /quakeforge-config
/quakeforge.lsm /quakeforge.lsm
/test-driver
/ylwrap /ylwrap
# /RPM/ # /RPM/

View file

@ -1,15 +1,9 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
SUBDIRS=desktop pkg-config include @top_dirs@ EXTRA_DIST = \
DIST_SUBDIRS=desktop pkg-config include \ ChangeLog configure.ac bootstrap \
libs hw nq qtv qw tools ruamoko\
RPM debian doc vc2005 vc2008
## configure.ac needs to be listed here for older autoconfs
EXTRA_DIST= ChangeLog configure.ac bootstrap \
$(top_srcdir)/.version \ $(top_srcdir)/.version \
config.d/git-version-gen \ config.d/git-version-gen \
tools/cross/droid/cross-configure.sh \ tools/cross/droid/cross-configure.sh \
@ -26,9 +20,142 @@ EXTRA_DIST= ChangeLog configure.ac bootstrap \
tools/gas2masm/gas2masm.dsp tools/gas2masm/gas2masm.dsw \ tools/gas2masm/gas2masm.dsp tools/gas2masm/gas2masm.dsw \
tools/gas2masm/gas2masm.mak tools/gas2masm/gas2masm.mdp tools/gas2masm/gas2masm.mak tools/gas2masm/gas2masm.mdp
NOCONV_DIST= $(distdir)/include/win32/resources/icon1Vista.ico \ NOCONV_DIST= \
$(distdir)/include/win32/resources/icon1Vista.ico \
$(distdir)/include/win32/resources/icon1XP.ico $(distdir)/include/win32/resources/icon1XP.ico
BUILT_SOURCES = $(top_srcdir)/.version
#AM_CFLAGS= @PREFER_NON_PIC@
AM_CPPFLAGS= -I$(top_srcdir)/include $(PTHREAD_CFLAGS)
common_ldflags= -export-dynamic @PTHREAD_LDFLAGS@
TESTS =
XFAIL_TESTS =
bin_PROGRAMS =
bin_SCRIPTS =
check_PROGRAMS =
lib_LTLIBRARIES =
man_MANS =
noinst_LTLIBRARIES =
noinst_LIBRARIES =
noinst_PROGRAMS =
noinst_HEADERS =
plugin_LTLIBRARIES =
RANLIB=touch
ARFLAGS=cr
EXTRA_HEADERS =
EXTRA_LTLIBRARIES =
EXTRA_PROGRAMS =
EXTRA_LIBRARIES =
CLEANFILES =
DISTCLEANFILES =
YFLAGS = -v -d -Wno-yacc -Werror
PTHREAD_LDFLAGS=@PTHREAD_LDFLAGS@
PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
lib_ldflags=-version-info $(QUAKE_LIBRARY_VERSION_INFO) \
-rpath $(libdir) -no-undefined
plugin_ldflags= @plugin_ldflags@ -avoid-version -module -rpath $(plugindir)
plugin_libadd= @plugin_libadd@
SDL_LIBS= @SDL_LIBS@
XMMS_LIBS= @XMMS_LIBS@
PAK=$(top_builddir)/pak$(EXEEXT)
QFCC_DEP=qfcc$(EXEEXT)
QFCC=$(top_builddir)/$(QFCC_DEP)
GZ=@progs_gz@
V_QFCC = $(V_QFCC_@AM_V@)
V_QFCC_ = $(V_QFCC_@AM_DEFAULT_V@)
V_QFCC_0 = @echo " QFCC " $@;
V_QFCC_1 =
V_QFCCLD = $(V_QFCCLD_@AM_V@)
V_QFCCLD_ = $(V_QFCCLD_@AM_DEFAULT_V@)
V_QFCCLD_0 = @echo " QFCCLD " $@;
V_QFCCLD_1 =
QCSYSTEM=--no-default-paths -I$(top_srcdir) -I$(top_srcdir)/ruamoko/include -I$(top_srcdir)/include
QCFLAGS=-qq -O -g -Werror -Wall -Wno-integer-divide
QCPPFLAGS=$(QCSYSTEM)
QCLINKFLAGS=--no-default-paths -Lruamoko/lib
QCOMPILE=$(QFCC) $(QCFLAGS) $(QCPPFLAGS)
QLINK=$(QFCC) $(QCFLAGS) $(QCLINKFLAGS)
MKDIR_P = @MKDIR_P@
am__mv = mv -f
SUFFIXES=.o .r .pas
.r.o:
$(V_QFCC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
$(QCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tqo -c -o $@ $< &&\
sed -i -e '1s@:@: $(QFCC_DEP)@' $$depbase.Tqo &&\
$(am__mv) $$depbase.Tqo $$depbase.Qo
.pas.o:
$(V_QFCC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
$(QCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tqo -c -o $@ $< &&\
sed -i -e '1s@:@: $(QFCC_DEP)@' $$depbase.Tqo &&\
$(am__mv) $$depbase.Tqo $$depbase.Qo
qcautodep = $(join $(addsuffix $(DEPDIR)/,$(dir $(basename $(1)))),$(addsuffix .Qo,$(notdir $(basename $(basename $(1))))))
r_depfiles_remade=
pas_depfiles_remade=
V_GLSLANG = $(V_GLSLANG_@AM_V@)
V_GLSLANG_ = $(V_GLSLANG_@AM_DEFAULT_V@)
V_GLSLANG_0 = @echo " GLSLANG " $@;
V_GLSLANG_1 =
V_XXD = $(V_XXD_@AM_V@)
V_XXD_ = $(V_XXD_@AM_DEFAULT_V@)
V_XXD_0 = @echo " XXD " $@;
V_XXD_1 =
%.spv: %
@$(mkdir_p) $(builddir)/`dirname $@`
$(V_GLSLANG)(((($(GLSLANGVALIDATOR) -V $< -o $@; echo $$? >&3) | sed -e '1d' 1>&2) 3>&1) | (read xs; exit $$xs))
%.spvc: %
@$(mkdir_p) $(builddir)/`dirname $@`
$(V_GLSLANG)(((($(GLSLANGVALIDATOR) --vn `basename $< | tr . _` -V $< -o $@; echo $$? >&3) | sed -e '1d' 1>&2) 3>&1) | (read xs; exit $$xs))
shaderdir = @shaderdir@
shader_DATA =
include doc/Makemodule.am
include RPM/Makemodule.am
include debian/Makemodule.am
include desktop/Makemodule.am
include pkg-config/Makemodule.am
include include/Makemodule.am
include libs/Makemodule.am
include hw/Makemodule.am
include nq/Makemodule.am
include qtv/Makemodule.am
include qw/Makemodule.am
include tools/Makemodule.am
include ruamoko/Makemodule.am
DISTCLEANFILES += $(r_depfiles_remade) $(pas_depfiles_remade)
CLEANFILES += $(shader_DATA)
$(r_depfiles_remade):
$(MKDIR_P) $(@D)
echo '$@' | sed -e 's@\$(DEPDIR)/@@' -e 's@\(.*\)\.Qo$$@\1.o: $(top_srcdir)/\1.r qfcc@' >$@-t && $(am__mv) $@-t $@
$(pas_depfiles_remade):
$(MKDIR_P) $(@D)
echo '$@' | sed -e 's@\$(DEPDIR)/@@' -e 's@\(.*\)\.Qo$$@\1.o: $(top_srcdir)/\1.pas qfcc@' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade) $(r_depfiles_remade) $(pas_depfiles_remade)
echo findme $(ruamoko_gui_libgui_a_dep)
changelog: ChangeLog changelog: ChangeLog
ChangeLog: FORCE ChangeLog: FORCE
@if test -d "$(top_srcdir)/.git"; then \ @if test -d "$(top_srcdir)/.git"; then \
@ -63,7 +190,6 @@ dist-all-local: distdir
ZIP="-r9ql" zip $(distdir).zip $(distdir) ZIP="-r9ql" zip $(distdir).zip $(distdir)
-rm -rf $(distdir) -rm -rf $(distdir)
BUILT_SOURCES = $(top_srcdir)/.version
$(top_srcdir)/.version: $(top_srcdir)/.version:
echo $(VERSION) > $@-t && mv $@-t $@ echo $(VERSION) > $@-t && mv $@-t $@
dist-hook: dist-hook:

View file

@ -1,9 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign
EXTRA_DIST= build_rpm.in quakeforge.conf.in quakeforge.spec.in
rpm: build_rpm quakeforge.conf quakeforge.spec
./build_rpm
CLEANFILES = *.rpm

6
RPM/Makemodule.am Normal file
View file

@ -0,0 +1,6 @@
EXTRA_DIST += RPM/build_rpm.in RPM/quakeforge.conf.in RPM/quakeforge.spec.in
rpm: RPM/build_rpm RPM/quakeforge.conf RPM/quakeforge.spec
cd RPM && ./build_rpm
CLEANFILES += rpm/*.rpm

View file

@ -18,7 +18,7 @@ if test "$1" = "clean"; then
find . -name '*.orig' -type f -print0 | xargs $ARGS rm -f find . -name '*.orig' -type f -print0 | xargs $ARGS rm -f
rm -f aclocal.m4 build-stamp changelog-stamp config.cache config.log \ rm -f aclocal.m4 build-stamp changelog-stamp config.cache config.log \
config.status configure configure-stamp install-sh libtool missing \ config.status configure configure-stamp install-sh libtool missing \
mkinstalldirs quakeforge-config quakeforge.lsm mkinstalldirs quakeforge-config quakeforge.lsm test-driver
rm -f compile config.guess config.sub depcomp ltmain.sh ylwrap rm -f compile config.guess config.sub depcomp ltmain.sh ylwrap
rm -rf autom4te.cache rm -rf autom4te.cache
rm -f m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ rm -f m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \
@ -100,7 +100,7 @@ else
fi fi
if test -n "$errors" ; then if test -n "$errors" ; then
echo -e $errors echo "$errors"
exit 1 exit 1
fi fi

View file

@ -1,103 +1,4 @@
Makefile Makefile
include/Makefile
include/QF/Makefile
libs/Makefile
libs/audio/Makefile
libs/audio/targets/Makefile
libs/audio/renderer/Makefile
libs/audio/test/Makefile
libs/console/Makefile
libs/client/Makefile
libs/gamecode/Makefile
libs/gib/Makefile
libs/image/Makefile
libs/models/Makefile
libs/models/alias/Makefile
libs/models/brush/Makefile
libs/models/iqm/Makefile
libs/models/sprite/Makefile
libs/models/test/Makefile
libs/net/Makefile
libs/net/nc/Makefile
libs/net/nm/Makefile
libs/qw/Makefile
libs/ruamoko/Makefile
libs/util/Makefile
libs/util/test/Makefile
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
hw/Makefile
hw/include/Makefile
hw/source/Makefile
nq/Makefile
nq/include/Makefile
nq/source/Makefile
qtv/Makefile
qtv/include/Makefile
qtv/source/Makefile
qw/Makefile
qw/include/Makefile
qw/source/Makefile
tools/Makefile
tools/bsp2img/Makefile
tools/carne/Makefile
tools/pak/Makefile
tools/qfbsp/Makefile
tools/qfbsp/include/Makefile
tools/qfbsp/source/Makefile
tools/qfcc/Makefile
tools/qfcc/doc/Makefile
tools/qfcc/doc/man/Makefile
tools/qfcc/include/Makefile
tools/qfcc/source/Makefile
tools/qfcc/test/Makefile
tools/qflight/Makefile
tools/qflight/include/Makefile
tools/qflight/source/Makefile
tools/qflmp/Makefile
tools/qfmodelgen/Makefile
tools/qfmodelgen/include/Makefile
tools/qfmodelgen/source/Makefile
tools/qfspritegen/Makefile
tools/qfvis/Makefile
tools/qfvis/include/Makefile
tools/qfvis/source/Makefile
tools/qwaq/Makefile
tools/qwaq/progs.src
tools/wad/Makefile
tools/wav/Makefile
ruamoko/Makefile
ruamoko/Doxyfile
ruamoko/include/Makefile
ruamoko/lib/Makefile
ruamoko/game/Makefile
ruamoko/gui/Makefile
ruamoko/cl_menu/Makefile
ruamoko/scheme/Makefile
pkg-config/Makefile
pkg-config/qfcc.pc pkg-config/qfcc.pc
pkg-config/quakeforge.pc pkg-config/quakeforge.pc
doc/Makefile
doc/quakeforge.dox.conf doc/quakeforge.dox.conf
doc/man/Makefile
debian/Makefile
desktop/Makefile
vc2005/Makefile
vc2008/Makefile

View file

@ -39,8 +39,9 @@ if test "x$HAVE_FBDEV" = xyes; then
QW_TARGETS="$QW_TARGETS qw-client-fbdev\$(EXEEXT)" QW_TARGETS="$QW_TARGETS qw-client-fbdev\$(EXEEXT)"
NQ_TARGETS="$NQ_TARGETS nq-fbdev\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-fbdev\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS FBDEV" CL_TARGETS="$CL_TARGETS FBDEV"
VID_TARGETS="$VID_TARGETS libQFfbdev.la" VID_TARGETS="$VID_TARGETS libs/video/targets/libQFfbdev.la"
QF_NEED(vid_render, [sw]) QF_NEED(vid_render, [sw])
QF_NEED(render, [sw])
QF_NEED(models, [sw]) QF_NEED(models, [sw])
QF_NEED(alias, [sw]) QF_NEED(alias, [sw])
QF_NEED(brush, [sw]) QF_NEED(brush, [sw])
@ -66,12 +67,22 @@ if test "x$HAVE_X" = xyes; then
if test "x$ENABLE_clients_x11" = xyes; then if test "x$ENABLE_clients_x11" = xyes; then
QW_TARGETS="$QW_TARGETS qw-client-x11\$(EXEEXT)" QW_TARGETS="$QW_TARGETS qw-client-x11\$(EXEEXT)"
NQ_TARGETS="$NQ_TARGETS nq-x11\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-x11\$(EXEEXT)"
QWAQ_TARGETS="$QWAQ_TARGETS qwaq-x11\$(EXEEXT)" QWAQ_TARGETS="$QWAQ_TARGETS ruamoko/qwaq/qwaq-x11\$(EXEEXT)"
QW_DESKTOP_DATA="$QW_DESKTOP_DATA quakeforge-qw-x11.desktop" QW_DESKTOP_DATA="$QW_DESKTOP_DATA desktop/quakeforge-qw-x11.desktop"
NQ_DESKTOP_DATA="$NQ_DESKTOP_DATA quakeforge-nq-x11.desktop" NQ_DESKTOP_DATA="$NQ_DESKTOP_DATA desktop/quakeforge-nq-x11.desktop"
CL_TARGETS="$CL_TARGETS X11" CL_TARGETS="$CL_TARGETS X11"
VID_TARGETS="$VID_TARGETS libQFx11.la" VID_TARGETS="$VID_TARGETS libs/video/targets/libQFx11.la"
if test "$HAVE_VULKAN" = "yes"; then
QF_NEED(vid_render, [vulkan])
QF_NEED(render, [vulkan])
QF_NEED(models, [vulkan])
QF_NEED(alias, [vulkan])
QF_NEED(brush, [vulkan])
QF_NEED(iqm, [vulkan])
QF_NEED(sprite, [vulkan])
fi
QF_NEED(vid_render, [sw sw32 gl glsl]) QF_NEED(vid_render, [sw sw32 gl glsl])
QF_NEED(render, [sw sw32 gl glsl])
QF_NEED(models, [sw gl glsl]) QF_NEED(models, [sw gl glsl])
QF_NEED(alias, [sw gl glsl]) QF_NEED(alias, [sw gl glsl])
QF_NEED(brush, [sw gl glsl]) QF_NEED(brush, [sw gl glsl])
@ -91,11 +102,20 @@ if test "x$HAVE_SDL" = xyes; then
if test "x$ENABLE_clients_sdl" = xyes; then if test "x$ENABLE_clients_sdl" = xyes; then
QW_TARGETS="$QW_TARGETS qw-client-sdl\$(EXEEXT)" QW_TARGETS="$QW_TARGETS qw-client-sdl\$(EXEEXT)"
NQ_TARGETS="$NQ_TARGETS nq-sdl\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-sdl\$(EXEEXT)"
QW_DESKTOP_DATA="$QW_DESKTOP_DATA quakeforge-qw-sdl.desktop" QW_DESKTOP_DATA="$QW_DESKTOP_DATA desktop/quakeforge-qw-sdl.desktop"
NQ_DESKTOP_DATA="$NQ_DESKTOP_DATA quakeforge-nq-sdl.desktop" NQ_DESKTOP_DATA="$NQ_DESKTOP_DATA desktop/quakeforge-nq-sdl.desktop"
CL_TARGETS="$CL_TARGETS SDL" CL_TARGETS="$CL_TARGETS SDL"
VID_TARGETS="$VID_TARGETS libQFsdl.la" VID_TARGETS="$VID_TARGETS libs/video/targets/libQFsdl.la"
if test "$HAVE_VULKAN" = "yes"; then
QF_NEED(vid_render, [vulkan])
QF_NEED(render, [vulkan])
QF_NEED(alias, [vulkan])
QF_NEED(brush, [vulkan])
QF_NEED(iqm, [vulkan])
QF_NEED(sprite, [vulkan])
fi
QF_NEED(vid_render, [sw sw32 gl glsl]) QF_NEED(vid_render, [sw sw32 gl glsl])
QF_NEED(render, [sw sw32 gl glsl])
QF_NEED(models, [sw gl glsl]) QF_NEED(models, [sw gl glsl])
QF_NEED(alias, [sw gl glsl]) QF_NEED(alias, [sw gl glsl])
QF_NEED(brush, [sw gl glsl]) QF_NEED(brush, [sw gl glsl])
@ -116,8 +136,9 @@ if test "x$HAVE_SVGA" = xyes; then
QW_TARGETS="$QW_TARGETS qw-client-svga\$(EXEEXT)" QW_TARGETS="$QW_TARGETS qw-client-svga\$(EXEEXT)"
NQ_TARGETS="$NQ_TARGETS nq-svga\$(EXEEXT)" NQ_TARGETS="$NQ_TARGETS nq-svga\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS SVGAlib" CL_TARGETS="$CL_TARGETS SVGAlib"
VID_TARGETS="$VID_TARGETS libQFsvga.la" VID_TARGETS="$VID_TARGETS libs/video/targets/libQFsvga.la"
QF_NEED(vid_render, [sw]) QF_NEED(vid_render, [sw])
QF_NEED(render, [sw])
QF_NEED(models, [sw]) QF_NEED(models, [sw])
QF_NEED(alias, [sw]) QF_NEED(alias, [sw])
QF_NEED(brush, [sw]) QF_NEED(brush, [sw])
@ -138,8 +159,9 @@ fi
# QW_TARGETS="$QW_TARGETS qw-client-wgl\$(EXEEXT)" # QW_TARGETS="$QW_TARGETS qw-client-wgl\$(EXEEXT)"
# NQ_TARGETS="$NQ_TARGETS nq-wgl\$(EXEEXT)" # NQ_TARGETS="$NQ_TARGETS nq-wgl\$(EXEEXT)"
# CL_TARGETS="$CL_TARGETS WGL" # CL_TARGETS="$CL_TARGETS WGL"
# VID_TARGETS="$VID_TARGETS libQFwgl.la" # VID_TARGETS="$VID_TARGETS libs/video/targets/libQFwgl.la"
# QF_NEED(vid_render, [gl]) # QF_NEED(vid_render, [gl])
# QF_NEED(render, [gl])
# QF_NEED(models, [gl]) # QF_NEED(models, [gl])
# QF_NEED(alias, [gl]) # QF_NEED(alias, [gl])
# QF_NEED(brush, [gl]) # QF_NEED(brush, [gl])
@ -163,8 +185,8 @@ if test "x$ENABLE_servers_nq" = xyes; then
QF_NEED(libs,[util gamecode ruamoko gib image models console net]) QF_NEED(libs,[util gamecode ruamoko gib image models console net])
fi fi
if test "x$ENABLE_servers_qtv" = xyes; then if test "x$ENABLE_servers_qtv" = xyes; then
QTV_TARGETS="qtv\$(EXEEXT) $QTV_TARGETS" QTV_TARGETS="qtv-server\$(EXEEXT) $QTV_TARGETS"
SV_TARGETS="$SV_TARGETS qtv" SV_TARGETS="$SV_TARGETS qtv-server"
# QF_NEED(qtv, [common server]) # QF_NEED(qtv, [common server])
QF_NEED(console, [server]) QF_NEED(console, [server])
QF_NEED(top, [qtv]) QF_NEED(top, [qtv])
@ -227,7 +249,11 @@ if test "x$ENABLE_tools_qfvis" = xyes; then
QF_NEED(libs,[util]) QF_NEED(libs,[util])
fi fi
if test "x$ENABLE_tools_qwaq" = xyes; then if test "x$ENABLE_tools_qwaq" = xyes; then
QF_NEED(tools,[qwaq]) if test "x$HAVE_PANEL" = xyes -a "x$HAVE_PTHREAD" = xyes; then
QWAQ_TARGETS="$QWAQ_TARGETS ruamoko/qwaq/qwaq-curses\$(EXEEXT)"
fi
QF_NEED(tools,[qfcc])
QF_NEED(ruamoko,[qwaq])
QF_NEED(libs,[ruamoko gamecode util]) QF_NEED(libs,[ruamoko gamecode util])
fi fi
if test "x$ENABLE_tools_wad" = xyes; then if test "x$ENABLE_tools_wad" = xyes; then
@ -241,39 +267,52 @@ fi
QF_NEED(top, [libs hw nq qtv qw]) QF_NEED(top, [libs hw nq qtv qw])
QF_PROCESS_NEED_DIRS(tools,[bsp2img carne pak qfbsp qfcc qflight qflmp qfmodelgen qfspritegen qfvis qwaq wad wav]) QF_PROCESS_NEED_FUNC(tools,[bsp2img carne pak qfbsp qfcc qflight qflmp qfmodelgen qfspritegen qfvis wad wav], QF_NEED(top,tools))
QF_PROCESS_NEED_FUNC(tools,[bsp2img carne pak qfbsp qfcc qflight qflmp qfmodelgen qfspritegen qfvis qwaq wad wav], QF_NEED(top,tools))
QF_PROCESS_NEED_DIRS(libs,[util gamecode ruamoko gib audio image models video console net qw client])
if test "$ENABLE_tools_qfcc" = "yes" -a "$ENABLE_tools_pak" = "yes"; then if test "$ENABLE_tools_qfcc" = "yes" -a "$ENABLE_tools_pak" = "yes"; then
QF_NEED(top, [ruamoko]) QF_NEED(top, [ruamoko])
qfac_qfcc_include_qf="\$(qfcc_include_qf)"
fi fi
QF_SUBST(qfac_qfcc_include_qf)
if test x"${top_need_libs}" = xyes; then
qfac_include_qf="\$(include_qf)"
qfac_include_qf_gl="\$(include_qf_gl)"
qfac_include_qf_glsl="\$(include_qf_glsl)"
qfac_include_qf_math="\$(include_qf_math)"
qfac_include_qf_plugin="\$(include_qf_plugin)"
qfac_include_qf_vulkan="\$(include_qf_vulkan)"
fi
QF_SUBST(qfac_include_qf)
QF_SUBST(qfac_include_qf_gl)
QF_SUBST(qfac_include_qf_glsl)
QF_SUBST(qfac_include_qf_math)
QF_SUBST(qfac_include_qf_plugin)
QF_SUBST(qfac_include_qf_vulkan)
progs_gz= progs_gz=
if test "$HAVE_ZLIB" = "yes"; then if test "$HAVE_ZLIB" = "yes"; then
progs_gz=".gz" progs_gz=".gz"
fi fi
QF_SUBST(progs_gz) QF_SUBST(progs_gz)
QF_PROCESS_NEED_DIRS(top, [libs hw nq qtv qw tools ruamoko])
QF_PROCESS_NEED_LIBS(swrend, [asm]) QF_PROCESS_NEED_LIBS(swrend, [asm])
QF_PROCESS_NEED_DIRS(vid_render, [gl glsl sw sw32]) QF_PROCESS_NEED_LIBS(render, [gl glsl sw sw32 vulkan], [libs/video/renderer])
QF_PROCESS_NEED_LIBS(models, [gl glsl sw]) QF_PROCESS_NEED_LIBS(models, [gl glsl sw vulkan], [libs/models])
QF_PROCESS_NEED_LIBS(alias, [gl glsl sw]) QF_PROCESS_NEED_LIBS(alias, [gl glsl sw vulkan], [libs/models/alias])
QF_PROCESS_NEED_LIBS(brush, [gl glsl sw]) QF_PROCESS_NEED_LIBS(brush, [gl glsl sw vulkan], [libs/models/brush])
QF_PROCESS_NEED_LIBS(iqm, [gl glsl sw]) QF_PROCESS_NEED_LIBS(iqm, [gl glsl sw vulkan], [libs/models/iqm])
QF_PROCESS_NEED_LIBS(sprite, [gl glsl sw]) QF_PROCESS_NEED_LIBS(sprite, [gl glsl sw vulkan], [libs/models/sprite])
QF_PROCESS_NEED_LIBS(vid, [common sdl svga x11]) QF_PROCESS_NEED_LIBS(vid, [common sdl svga x11], [libs/video/targets])
QF_PROCESS_NEED_LIBS(qw, [client common sdl server], a) QF_PROCESS_NEED_LIBS(qw, [client common sdl server], [qw/source], a)
QF_PROCESS_NEED_LIBS(nq, [client common sdl server], a) QF_PROCESS_NEED_LIBS(nq, [client common sdl server], [nq/source], a)
if test -n "$CL_TARGETS"; then if test -n "$CL_TARGETS"; then
CD_TARGETS="libQFcd.la" CD_TARGETS="libs/audio/libQFcd.la"
SND_TARGETS="libQFsound.la" SND_TARGETS="libs/audio/libQFsound.la"
AUDIO_TARGETS="testsound\$(EXEEXT)" AUDIO_TARGETS="testsound\$(EXEEXT)"
JOY_TARGETS="libQFjs.la" JOY_TARGETS="libs/video/targets/libQFjs.la"
else else
unset CDTYPE unset CDTYPE
unset SOUND_TYPES unset SOUND_TYPES
@ -308,13 +347,13 @@ if test "x$static_plugins" = xauto; then
fi fi
fi fi
if test "x$static_plugins" = xyes; then if test "x$static_plugins" = xyes; then
QF_PROCESS_NEED_STATIC_PLUGINS(vid_render, [sw sw32 glsl gl]) QF_PROCESS_NEED_STATIC_PLUGINS(vid_render, [sw sw32 glsl gl vulkan], [libs/video/renderer])
QF_PROCESS_NEED_STATIC_PLUGINS(console, [server], [\$(top_builddir)/libs/console], [server]) QF_PROCESS_NEED_STATIC_PLUGINS(console, [server], [libs/console], [server])
QF_PROCESS_NEED_STATIC_PLUGINS(console, [client], [\$(top_builddir)/libs/console], [client]) QF_PROCESS_NEED_STATIC_PLUGINS(console, [client], [libs/console], [client])
QF_PROCESS_NEED_STATIC_PLUGINS(snd_output, [sdl mme sgi sun win dx oss alsa], [targets]) QF_PROCESS_NEED_STATIC_PLUGINS(snd_output, [sdl mme sgi sun win dx oss alsa], [libs/audio/targets])
QF_PROCESS_NEED_STATIC_PLUGINS(snd_render, [jack default], [renderer]) QF_PROCESS_NEED_STATIC_PLUGINS(snd_render, [jack default], [libs/audio/renderer])
QF_PROCESS_NEED_STATIC_PLUGINS(cd, [xmms sdl sgi win linux file]) QF_PROCESS_NEED_STATIC_PLUGINS(cd, [xmms sdl sgi win linux file], [libs/audio])
AC_DEFINE(STATIC_PLUGINS, 1, [Define this if you are building static plugins]) AC_DEFINE(STATIC_PLUGINS, 1, [Define this if you are building static plugins])
if test -n "$SOUND_TYPES"; then if test -n "$SOUND_TYPES"; then
SOUND_TYPES="$SOUND_TYPES (static)" SOUND_TYPES="$SOUND_TYPES (static)"
@ -323,12 +362,12 @@ if test "x$static_plugins" = xyes; then
CDTYPE="$CDTYPE (static)" CDTYPE="$CDTYPE (static)"
fi fi
else else
QF_PROCESS_NEED_PLUGINS(vid_render, [sw sw32 glsl gl]) QF_PROCESS_NEED_PLUGINS(vid_render, [sw sw32 glsl gl vulkan], [libs/video/renderer])
QF_PROCESS_NEED_PLUGINS(console, [server], [server]) QF_PROCESS_NEED_PLUGINS(console, [server], [libs/console], [server])
QF_PROCESS_NEED_PLUGINS(console, [client], [client]) QF_PROCESS_NEED_PLUGINS(console, [client], [libs/console], [client])
QF_PROCESS_NEED_PLUGINS(snd_output, [sdl mme sgi sun win dx oss alsa]) QF_PROCESS_NEED_PLUGINS(snd_output, [sdl mme sgi sun win dx oss alsa], [libs/audio/targets])
QF_PROCESS_NEED_PLUGINS(snd_render, [jack default]) QF_PROCESS_NEED_PLUGINS(snd_render, [jack default], [libs/audio/renderer])
QF_PROCESS_NEED_PLUGINS(cd, [xmms sdl sgi win linux file]) QF_PROCESS_NEED_PLUGINS(cd, [xmms sdl sgi win linux file], [libs/audio])
fi fi
dnl Do not use -module here, it belongs in makefile.am due to automake dnl Do not use -module here, it belongs in makefile.am due to automake
@ -372,6 +411,7 @@ QF_DEPS(QFCC,
QF_DEPS(QFCC_TEST, QF_DEPS(QFCC_TEST,
[], [],
[$(top_builddir)/libs/ruamoko/libQFruamoko.la [$(top_builddir)/libs/ruamoko/libQFruamoko.la
$(top_builddir)/libs/gamecode/libQFgamecode.la
$(top_builddir)/libs/util/libQFutil.la], $(top_builddir)/libs/util/libQFutil.la],
[$(WIN32_LIBS)], [$(WIN32_LIBS)],
) )
@ -404,8 +444,9 @@ QF_DEPS(QFVIS,
[$(WIN32_LIBS)], [$(WIN32_LIBS)],
) )
QF_DEPS(QWAQ, QF_DEPS(QWAQ,
[], [-I$(top_srcdir)/ruamoko/qwaq],
[$(top_builddir)/libs/ruamoko/libQFruamoko.la [$(top_builddir)/libs/ruamoko/libQFruamoko.la
$(top_builddir)/libs/gamecode/libQFgamecode.la
$(top_builddir)/libs/util/libQFutil.la], $(top_builddir)/libs/util/libQFutil.la],
[$(WIN32_LIBS)], [$(WIN32_LIBS)],
) )
@ -413,6 +454,7 @@ QF_DEPS(CARNE,
[], [],
[$(top_builddir)/libs/gib/libQFgib.la [$(top_builddir)/libs/gib/libQFgib.la
$(top_builddir)/libs/ruamoko/libQFruamoko.la $(top_builddir)/libs/ruamoko/libQFruamoko.la
$(top_builddir)/libs/gamecode/libQFgamecode.la
$(top_builddir)/libs/util/libQFutil.la], $(top_builddir)/libs/util/libQFutil.la],
[$(WIN32_LIBS)], [$(WIN32_LIBS)],
) )

View file

@ -14,6 +14,27 @@ if test "x$CFLAGS" != "x"; then
fi fi
AC_MSG_RESULT([$leave_cflags_alone]) AC_MSG_RESULT([$leave_cflags_alone])
AC_MSG_CHECKING(for C99 inline)
c99_inline=no
AC_TRY_LINK(
[inline int foo (int x) { return x * x; }
int (*bar) (int) = foo;],
[],
c99_inline=no
AC_MSG_RESULT(no),
c99_inline=yes
AC_DEFINE(HAVE_C99INLINE, extern, [define this if using c99 inline])
AC_MSG_RESULT(yes)
)
AH_VERBATIM([HAVE_C99INLINE],
[/* Define this if the GCC __attribute__ keyword is available */
#undef HAVE_C99INLINE
#ifdef HAVE_C99INLINE
# define GNU89INLINE
#else
# define GNU89INLINE extern
#endif])
if test "x$GCC" = xyes; then if test "x$GCC" = xyes; then
set $CC set $CC
shift shift
@ -61,6 +82,11 @@ AC_ARG_ENABLE(optimize,
optimize=yes optimize=yes
) )
QF_CC_OPTION(-mavx2)
dnl fma is not used as it is the equivalent of turning on
dnl -funsafe-math-optimizations
dnl QF_CC_OPTION(-mfma)
AC_MSG_CHECKING(for optimization) AC_MSG_CHECKING(for optimization)
if test "x$optimize" = xyes -a "x$leave_cflags_alone" != "xyes"; then if test "x$optimize" = xyes -a "x$leave_cflags_alone" != "xyes"; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
@ -192,6 +218,16 @@ if test $CC_MAJ -gt 4 -o $CC_MAJ -eq 4 -a $CC_MIN -ge 5; then
fi fi
QF_CC_OPTION(-Wtype-limits) QF_CC_OPTION(-Wtype-limits)
QF_CC_OPTION_TEST([-fvisibility=hidden], [VISIBILITY=-fvisibility=hidden]) QF_CC_OPTION_TEST([-fvisibility=hidden], [VISIBILITY=-fvisibility=hidden])
QF_CC_OPTION(-Wsuggest-attribute=pure)
QF_CC_OPTION(-Wsuggest-attribute=const)
QF_CC_OPTION(-Wsuggest-attribute=noreturn)
QF_CC_OPTION(-Wsuggest-attribute=format)
AC_ARG_ENABLE(coverage,
[ --enable-coverage Enable generation of data for gcov])
if test "x$enable_coverage" = xyes; then
QF_CC_OPTION(-fprofile-arcs -ftest-coverage)
fi
dnl QuakeForge uses lots of BCPL-style (//) comments, which can cause problems dnl QuakeForge uses lots of BCPL-style (//) comments, which can cause problems
dnl with many compilers that do not support the latest ISO standards. Well, dnl with many compilers that do not support the latest ISO standards. Well,
@ -220,8 +256,7 @@ if test "x$GCC" != xyes; then
fi fi
AC_ARG_ENABLE(Werror, AC_ARG_ENABLE(Werror,
[ --disable-Werror Do not treat warnings as errors] [ --disable-Werror Do not treat warnings as errors])
)
dnl We want warnings, lots of warnings... dnl We want warnings, lots of warnings...
dnl The help text should be INVERTED before release! dnl The help text should be INVERTED before release!
dnl when in git, this test defaults to ENABLED. dnl when in git, this test defaults to ENABLED.

View file

@ -2,7 +2,9 @@ AC_ARG_ENABLE(curses,
[ --disable-curses disable curses support] [ --disable-curses disable curses support]
) )
if test "x$enable_curses" != "xno"; then if test "x$enable_curses" != "xno"; then
AC_CHECK_HEADERS(curses.h) AC_CHECK_HEADER([curses.h],
[AC_DEFINE([HAVE_CURSES_H], [1],
[Define to 1 if you have <curses.h>.])])
AC_CHECK_LIB(ncurses, initscr, AC_CHECK_LIB(ncurses, initscr,
CURSES_LIBS=-lncurses, CURSES_LIBS=-lncurses,
AC_CHECK_LIB(pdcurses, initscr, AC_CHECK_LIB(pdcurses, initscr,
@ -13,7 +15,32 @@ if test "x$enable_curses" != "xno"; then
) )
) )
) )
if test "x$CURSES_LIBS" != "x"; then
AC_DEFINE(HAVE_CURSES, 1, [Define if you have the ncurses library])
HAVE_CURSES=yes
else else
HAVE_CURSES=no
fi
else
HAVE_CURSES=no
CURSES_LIBS= CURSES_LIBS=
fi fi
AC_SUBST(CURSES_LIBS) AC_SUBST(CURSES_LIBS)
if test "x$HAVE_CURSES" == "xyes"; then
AC_CHECK_HEADER(panel.h,
[AC_CHECK_LIB(panel, new_panel,
[AC_DEFINE(HAVE_PANEL, 1,
[Define if you have the ncurses panel library])
PANEL_LIBS=-lpanel
HAVE_PANEL=yes],
[HAVE_PANEL=no],
$CURSES_LIBS
)],
HAVE_PANEL=no,
[]
)
else
PANEL_LIBS=
fi
AC_SUBST(PANEL_LIBS)

View file

@ -7,8 +7,6 @@ AC_FUNC_MEMCMP
AC_FUNC_MMAP AC_FUNC_MMAP
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_FUNC_VA_COPY
AC_FUNC__VA_COPY
AC_CHECK_FUNCS( AC_CHECK_FUNCS(
access _access connect dlopen execvp fcntl ftime _ftime getaddrinfo \ access _access connect dlopen execvp fcntl ftime _ftime getaddrinfo \
gethostbyname gethostname getnameinfo getpagesize gettimeofday getuid \ gethostbyname gethostname getnameinfo getpagesize gettimeofday getuid \
@ -17,6 +15,17 @@ AC_CHECK_FUNCS(
_vsnprintf wait _vsnprintf wait
) )
AC_FUNC_VA_COPY
AC_FUNC__VA_COPY
AH_VERBATIM([DEFINE_VA_COPY],
[#ifndef HAVE_VA_COPY
# ifdef HAVE__VA_COPY
# define va_copy(d,s) __va_copy ((d), (s))
# else
# define va_copy(d,s) memcpy (&(d), &(s), sizeof (va_list))
# endif
#endif])
DL_LIBS="" DL_LIBS=""
if test "x$ac_cv_func_dlopen" != "xyes"; then if test "x$ac_cv_func_dlopen" != "xyes"; then
AC_CHECK_LIB(dl, dlopen, AC_CHECK_LIB(dl, dlopen,
@ -26,6 +35,25 @@ if test "x$ac_cv_func_dlopen" != "xyes"; then
fi fi
AC_SUBST(DL_LIBS) AC_SUBST(DL_LIBS)
if test "x$DL_LIBS" != "x"; then
AC_MSG_CHECKING([for RTLD_NOW])
AC_TRY_COMPILE(
[#include <dlfcn.h>],
[int foo = RTLD_NOW],
AC_DEFINE(HAVE_RTLD_NOW, 1, [Define if you have RTLD_NOW.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING([for RTLD_DEEPBIND])
AC_TRY_COMPILE(
[#include <dlfcn.h>],
[int foo = RTLD_DEEPBIND],
AC_DEFINE(HAVE_RTLD_DEEPBIND, 1, [Define if you have RTLD_DEEPBIND.])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
fi
dnl Checks for stricmp/strcasecmp dnl Checks for stricmp/strcasecmp
#AC_CHECK_FUNC(strcasecmp, #AC_CHECK_FUNC(strcasecmp,
# , # ,

View file

@ -98,6 +98,19 @@ eval expanded_plugindir="$expanded_plugindir"
AC_DEFINE_UNQUOTED(FS_PLUGINPATH, "$expanded_plugindir", [Define this to the path from which to load plugins]) AC_DEFINE_UNQUOTED(FS_PLUGINPATH, "$expanded_plugindir", [Define this to the path from which to load plugins])
AC_SUBST(plugindir) AC_SUBST(plugindir)
SHADERDIR="\${libdir}/quakeforge/shaders"
if test "x$shaderdir" = "xauto" -o "x$shaderdir" = "xyes" -o "x$shaderdir" = "x"; then
shaderdir="$SHADERDIR"
elif test "x$shaderdir" = xno; then
shaderdir="."
else
SHADERDIR="$shaderdir"
fi
eval expanded_shaderdir="$shaderdir"
eval expanded_shaderdir="$expanded_shaderdir"
AC_DEFINE_UNQUOTED(FS_SHADERPATH, "$expanded_shaderdir", [Define this to the path from which to load shaders])
AC_SUBST(plugindir)
AC_ARG_WITH(gl-driver, AC_ARG_WITH(gl-driver,
[ --with-gl-driver=NAME Name of OpenGL driver DLL/DSO], [ --with-gl-driver=NAME Name of OpenGL driver DLL/DSO],
gl_driver=$withval, gl_driver=$withval,

View file

@ -9,7 +9,7 @@ AC_ARG_WITH(cpp,
if test "x$cpp_name" != xauto; then if test "x$cpp_name" != xauto; then
CPP_NAME="$cpp_name" CPP_NAME="$cpp_name"
else else
CPP_NAME="cpp %d -o %o %i" CPP_NAME="cpp %u %d %s -o %o %i"
case "$host_os" in case "$host_os" in
*freebsd*) *freebsd*)
CPP_NAME="cpp %d %i %o" CPP_NAME="cpp %d %i %o"

View file

@ -1,2 +1,2 @@
AC_CONFIG_FILES(RPM/Makefile RPM/quakeforge.conf RPM/quakeforge.spec) AC_CONFIG_FILES(RPM/quakeforge.conf RPM/quakeforge.spec)
AC_CONFIG_FILES(RPM/build_rpm, [chmod +x RPM/build_rpm]) AC_CONFIG_FILES(RPM/build_rpm, [chmod +x RPM/build_rpm])

View file

@ -45,7 +45,7 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
AH_VERBATIM([HAVE___ATTRIBUTE__VISIBILITY], AH_VERBATIM([HAVE___ATTRIBUTE__VISIBILITY],
[/* Define this if the GCC __attribute__ keyword is available */ [/* Define this if the GCC visibility __attribute__ is available */
#undef HAVE___ATTRIBUTE__VISIBILITY #undef HAVE___ATTRIBUTE__VISIBILITY
#ifdef HAVE___ATTRIBUTE__VISIBILITY #ifdef HAVE___ATTRIBUTE__VISIBILITY
# define VISIBLE __attribute__((visibility ("default"))) # define VISIBLE __attribute__((visibility ("default")))
@ -53,10 +53,30 @@ AH_VERBATIM([HAVE___ATTRIBUTE__VISIBILITY],
# define VISIBLE # define VISIBLE
#endif]) #endif])
AC_MSG_CHECKING(for __builtin_expect) if test "x$SYSTYPE" = "xWIN32"; then
AC_MSG_CHECKING(for __attribute__ ((gcc_struct)))
AC_TRY_COMPILE( AC_TRY_COMPILE(
[long (*foo) (long, long) = __builtin_expect;], [typedef struct { int foo; }
__attribute__ ((gcc_struct)) gcc_struct_test;],
[], [],
AC_DEFINE(HAVE___ATTRIBUTE__GCC_STRUCT)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
fi
AH_VERBATIM([HAVE___ATTRIBUTE__GCC_STRUCT],
[/* Define this if the GCC gcc_struct __attribute__ is available */
#undef HAVE___ATTRIBUTE__GCC_STRUCT
#ifdef HAVE___ATTRIBUTE__GCC_STRUCT
# define GCC_STRUCT __attribute__((gcc_struct))
#else
# define GCC_STRUCT
#endif])
AC_MSG_CHECKING(for __builtin_expect)
AC_TRY_LINK(
[int x;],
[if (__builtin_expect(!x, 1)) {}],
AC_DEFINE(HAVE___BUILTIN_EXPECT) AC_DEFINE(HAVE___BUILTIN_EXPECT)
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
@ -68,8 +88,6 @@ AH_VERBATIM([HAVE___BUILTIN_EXPECT],
# define __builtin_expect(x,c) x # define __builtin_expect(x,c) x
#endif]) #endif])
AC_TYPE_VA_LIST
AC_MSG_CHECKING(for type of fpos_t) AC_MSG_CHECKING(for type of fpos_t)
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include <stdio.h>], [#include <stdio.h>],

21
config.d/vulkan.m4 Normal file
View file

@ -0,0 +1,21 @@
dnl Check for vulkan support
AC_ARG_ENABLE(vulkan,
[ --disable-vulkan do not use Vulkan],
HAVE_VULKAN=$enable_vulkan, HAVE_VULKAN=auto)
if test "x$HAVE_VULKAN" != xno; then
save_CPPFLAGS="$CPPFLAGS"
AS_IF([test x"$VULKAN_SDK" != x], [
CPPFLAGS="$CPPFLAGS -I$VULKAN_SDK/include"
LDFLAGS="$LDFLAGS -L$VULKAN_SDK/lib"
glslangvalidator="$VULKAN_SDK/bin/glslangValidator"
], [glslangvalidator="glslangValidator"])
AC_CHECK_HEADER([vulkan/vulkan.h], [HAVE_VULKAN=yes], [HAVE_VULKAN=no])
CPPFLAGS="$save_CPPFLAGS"
fi
if test "x$HAVE_VULKAN" = xyes; then
AC_DEFINE([HAVE_VULKAN], [1], [Define if yhou have the Vulkan libs])
fi
AC_SUBST(VULKAN_LIBS)
AC_SUBST(GLSLANGVALIDATOR, [$glslangvalidator])
AM_CONDITIONAL(X11_VULKAN, test "x$HAVE_VULKAN" = "xyes")

View file

@ -3,7 +3,7 @@ AC_PREREQ(2.61)
dnl This is the only place where the package name and version appear dnl This is the only place where the package name and version appear
AC_INIT([QuakeForge], m4_esyscmd([config.d/git-version-gen --prefix '' .tarball-version])) AC_INIT([QuakeForge], m4_esyscmd([config.d/git-version-gen --prefix '' .tarball-version]))
AM_INIT_AUTOMAKE([foreign]) AM_INIT_AUTOMAKE([foreign subdir-objects])
dnl LT_INIT messes with CFLAGS (evil bastard) dnl LT_INIT messes with CFLAGS (evil bastard)
if test "x${CFLAGS-unset}" = xunset; then if test "x${CFLAGS-unset}" = xunset; then
@ -63,6 +63,7 @@ m4_include(config.d/compression.m4)
m4_include(config.d/mgl.m4) m4_include(config.d/mgl.m4)
m4_include(config.d/fbdev.m4) m4_include(config.d/fbdev.m4)
m4_include(config.d/svga.m4) m4_include(config.d/svga.m4)
m4_include(config.d/vulkan.m4)
m4_include(config.d/x11.m4) m4_include(config.d/x11.m4)
m4_include(config.d/sdl.m4) m4_include(config.d/sdl.m4)

23
debian/Makefile.am vendored
View file

@ -1,23 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign
# find -type f | sed -e 's:^\./::g' | grep -v Makefile | sort >> Makefile.am
EXTRA_DIST= \
changelog control copyright quakeforge.conf rules source/format \
qfcc.install \
quakeforge-alsa.install quakeforge-alsa.postinst quakeforge-alsa.prerm \
quakeforge-common.install quakeforge-common.postinst \
quakeforge-dev.install \
quakeforge-gl.install \
quakeforge-glsl.install \
quakeforge-jack.install \
quakeforge-maptools.install \
quakeforge-oss.install quakeforge-oss.postinst quakeforge-oss.prerm \
quakeforge-sdl.install \
quakeforge-servers.install \
quakeforge-stub.postinst \
quakeforge-sw32.install \
quakeforge-sw.install \
quakeforge-utils.install \
quakeforge-x11.install

28
debian/Makemodule.am vendored Normal file
View file

@ -0,0 +1,28 @@
EXTRA_DIST += \
debian/changelog \
debian/control \
debian/copyright \
debian/quakeforge.conf \
debian/rules \
debian/source/format \
debian/qfcc.install \
debian/quakeforge-alsa.install \
debian/quakeforge-alsa.postinst \
debian/quakeforge-alsa.prerm \
debian/quakeforge-common.install \
debian/quakeforge-common.postinst \
debian/quakeforge-dev.install \
debian/quakeforge-gl.install \
debian/quakeforge-glsl.install \
debian/quakeforge-jack.install \
debian/quakeforge-maptools.install \
debian/quakeforge-oss.install \
debian/quakeforge-oss.postinst \
debian/quakeforge-oss.prerm \
debian/quakeforge-sdl.install \
debian/quakeforge-servers.install \
debian/quakeforge-stub.postinst \
debian/quakeforge-sw32.install \
debian/quakeforge-sw.install \
debian/quakeforge-utils.install \
debian/quakeforge-x11.install

View file

@ -1,49 +0,0 @@
## Process this file with automake to produce Makefile.in
#
# Makefile.am
#
# Automake-using build system for QuakeForge
#
# Copyright (C) 2000 Jeff Teunissen <deek@quakeforge.net>
#
# This Makefile 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
#
# $Id$
#
AUTOMAKE_OPTIONS= foreign
# Stuff that is common to both client and server
# Desktop files
if HAVE_XDG
desktopdir=$(datarootdir)/applications
desktop_DATA= @NQ_DESKTOP_DATA@ @QW_DESKTOP_DATA@
endif
# Stuff that doesn't get linked into an executable NEEDS to be mentioned here,
# or it won't be distributed with 'make dist'
EXTRA_DIST= quakeforge-nq-glx.desktop quakeforge-nq-sdl.desktop \
quakeforge-nq-sdl32.desktop quakeforge-nq-sgl.desktop \
quakeforge-nq-x11.desktop quakeforge-qw-glx.desktop \
quakeforge-qw-sdl.desktop quakeforge-qw-sdl32.desktop \
quakeforge-qw-sgl.desktop quakeforge-qw-x11.desktop
# Kill the temp files, hopefully.
CLEANFILES = *.i *.s $(YACCLEX_CLEANFILES)

10
desktop/Makemodule.am Normal file
View file

@ -0,0 +1,10 @@
if HAVE_XDG
desktopdir=$(datarootdir)/applications
desktop_DATA = @NQ_DESKTOP_DATA@ @QW_DESKTOP_DATA@
endif
EXTRA_DIST += \
desktop/quakeforge-nq-sdl.desktop \
desktop/quakeforge-nq-x11.desktop \
desktop/quakeforge-qw-sdl.desktop \
desktop/quakeforge-qw-x11.desktop

View file

@ -1,18 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=QuakeForge (GLX)
GenericName=Quake (GLX)
Comment=A first person shooter game
Comment[fr]=Un jeu de tir subjectif
Comment[it]=Sparatutto in prima persona
Icon=quake
Categories=Game;ActionGame;
Exec=nq-glx
TryExec=nq-glx
Terminal=false
StartupNotify=false

View file

@ -1,18 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=QuakeForge (SDL32)
GenericName=Quake (SDL32)
Comment=A first person shooter game
Comment[fr]=Un jeu de tir subjectif
Comment[it]=Sparatutto in prima persona
Icon=quake
Categories=SDL;Game;ActionGame;
Exec=nq-sdl32
TryExec=nq-sdl32
Terminal=false
StartupNotify=false

View file

@ -1,18 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=QuakeForge (SDL GL)
GenericName=Quake (SDL GL)
Comment=A first person shooter game
Comment[fr]=Un jeu de tir subjectif
Comment[it]=Sparatutto in prima persona
Icon=quake
Categories=SDL;Game;ActionGame;
Exec=nq-sgl
TryExec=nq-sgl
Terminal=false
StartupNotify=false

View file

@ -1,18 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=QuakeForge QuakeWorld (GLX)
GenericName=QuakeWorld (GLX)
Comment=A first person shooter game
Comment[fr]=Un jeu de tir subjectif
Comment[it]=Sparatutto in prima persona
Icon=quake
Categories=Game;ActionGame;
Exec=qw-client-glx
TryExec=qw-client-glx
Terminal=false
StartupNotify=false

View file

@ -1,18 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=QuakeForge QuakeWorld (SDL32)
GenericName=QuakeWorld (SDL32)
Comment=A first person shooter game
Comment[fr]=Un jeu de tir subjectif
Comment[it]=Sparatutto in prima persona
Icon=quake
Categories=SDL;Game;ActionGame;
Exec=qw-client-sdl32
TryExec=qw-client-sdl32
Terminal=false
StartupNotify=false

View file

@ -1,18 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=QuakeForge QuakeWorld (SDL GL)
GenericName=QuakeWorld (SDL GL)
Comment=A first person shooter game
Comment[fr]=Un jeu de tir subjectif
Comment[it]=Sparatutto in prima persona
Icon=quake
Categories=SDL;Game;ActionGame;
Exec=qw-client-sgl
TryExec=qw-client-sgl
Terminal=false
StartupNotify=false

View file

@ -1,55 +0,0 @@
AUTOMAKE_OPTIONS= foreign
SUBDIRS= man
DOX= \
bind.dox config.dox connect.dox cshifts.dox dirconf.dox faq.dox \
filesystem.dox mapformat.dox property-list.dox qtv.dox quakeforge.dox \
qw-cap-spec.dox qw-download-spec.dox sound.dox specifications.dox \
surround-sound.dox timestamps.dox
GIB= \
gib/GIB.lyx gib/break.gib gib/continue.gib gib/curly.gib gib/examples.sh \
gib/for.gib gib/gib_head.eps gib/if-chain.gib gib/if-else.gib \
gib/if-simple.gib gib/while.gib
PROGS= \
progs/vm-exec.c progs/vm-mem.fig
EXTRA_DIST= qf.ico \
\
skybox.fig template.c template.h \
quakeforge.dox.conf.in \
\
${DOX} ${GIB} ${PROGS} \
\
config/glspeed-v1.cfg config/glspeed-v3.cfg config/swspeed.cfg \
\
config/gib/adjustvolume.gib config/gib/infobot.gib config/gib/ln.gib \
config/gib/qfadmin.gib config/gib/sshot.gib config/gib/zoom.gib \
\
qtv/qwtv.fig
SUFFIXES=.eps .fig .png
.fig.png:
@mkdir -p `dirname $@`
fig2dev -L png $< $@
.fig.eps:
@mkdir -p `dirname $@`
fig2dev -L ps $< $@
.fig.svg:
@mkdir -p `dirname $@`
fig2dev -L svg $< $@
clean-local:
-rm -fr doxygen
progs/vm-mem.svg: progs/vm-mem.fig
progs/vm-mem.eps: progs/vm-mem.fig
qtv/qwtv.svg: qtv/qwtv.fig
qtv/qwtv.eps: qtv/qwtv.fig
doc: quakeforge.dox.conf progs/vm-mem.svg progs/vm-mem.eps qtv/qwtv.svg qtv/qwtv.eps ${DOX}
doxygen quakeforge.dox.conf

81
doc/Makemodule.am Normal file
View file

@ -0,0 +1,81 @@
man_MANS += doc/man/quakeforge.1
DOX= \
doc/bind.dox \
doc/config.dox \
doc/connect.dox \
doc/cshifts.dox \
doc/dirconf.dox \
doc/faq.dox \
doc/filesystem.dox \
doc/mapformat.dox \
doc/property-list.dox \
doc/qtv.dox \
doc/quakeforge.dox \
doc/qw-cap-spec.dox \
doc/qw-download-spec.dox \
doc/sound.dox \
doc/specifications.dox \
doc/surround-sound.dox \
doc/timestamps.dox
GIB= \
doc/gib/GIB.lyx \
doc/gib/break.gib \
doc/gib/continue.gib \
doc/gib/curly.gib \
doc/gib/examples.sh \
doc/gib/for.gib \
doc/gib/gib_head.eps \
doc/gib/if-chain.gib \
doc/gib/if-else.gib \
doc/gib/if-simple.gib \
doc/gib/while.gib
PROGS= \
doc/progs/vm-exec.c \
doc/progs/vm-mem.fig
EXTRA_DIST += \
${DOX} ${GIB} ${PROGS} \
doc/qf.ico \
doc/skybox.fig \
doc/template.c \
doc/template.h \
doc/quakeforge.dox.conf.in \
doc/config/glspeed-v1.cfg \
doc/config/glspeed-v3.cfg \
doc/config/swspeed.cfg \
doc/config/gib/adjustvolume.gib \
doc/config/gib/infobot.gib \
doc/config/gib/ln.gib \
doc/config/gib/qfadmin.gib \
doc/config/gib/sshot.gib \
doc/config/gib/zoom.gib \
doc/man/quakeforge.1 \
doc/qtv/qwtv.fig
SUFFIXES += .eps .fig .png
.fig.png:
@mkdir -p `dirname $@`
fig2dev -L png $< $@
.fig.eps:
@mkdir -p `dirname $@`
fig2dev -L ps $< $@
.fig.svg:
@mkdir -p `dirname $@`
fig2dev -L svg $< $@
clean-local:
-rm -fr doxygen
doc/progs/vm-mem.svg: doc/progs/vm-mem.fig
doc/progs/vm-mem.eps: doc/progs/vm-mem.fig
doc/qtv/qwtv.svg: doc/qtv/qwtv.fig
doc/qtv/qwtv.eps: doc/qtv/qwtv.fig
.PHONY: doc
doc: doc/quakeforge.dox.conf doc/progs/vm-mem.svg doc/progs/vm-mem.eps doc/qtv/qwtv.svg doc/qtv/qwtv.eps ${DOX}
doxygen doc/quakeforge.dox.conf

View file

@ -11,6 +11,7 @@
\li \subpage sound \li \subpage sound
\li \subpage tracklist \li \subpage tracklist
\li \subpage key_binding \li \subpage key_binding
\li \subpage imt
\li \subpage cshift_cvars \li \subpage cshift_cvars
\li \subpage server_timestamps \li \subpage server_timestamps
*/ */

View file

@ -3,38 +3,39 @@
/** /**
\page connection_sequence QW Connection Sequence \page connection_sequence QW Connection Sequence
\msc \msc
Client,Server; Client [linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black],
Client=>Server [label = "getchallenge\n"]; Server [linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server=>Client [label = "c[challenge][ext]"]; Client=>Server [label = "getchallenge\n", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client=>Server [label = "connect [protover] [qport] [challenge] [userinfo]"]; Server=>Client [label = "c[challenge][ext]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server=>Client [label = "j"]; Client=>Server [label = "connect [protover] [qport] [challenge] [userinfo]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]new"]; Server=>Client [label = "j", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server->Client [label = "[svc_serverdata][data]"]; Client->Server [label = "[clc_stringcmd]new", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
|||; Server->Client [label = "[svc_serverdata][data]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]soundlist [svcount] 0"]; ||| [linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
--- [label = "soundlist loop start"]; Client->Server [label = "[clc_stringcmd]soundlist [svcount] 0", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server->Client [label = "[svc_soundlist][data][next]"]; --- [label = "soundlist loop start", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]soundlist [svcount] [next]"]; Server->Client [label = "[svc_soundlist][data][next]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
--- [label = "soundlist loop end"]; Client->Server [label = "[clc_stringcmd]soundlist [svcount] [next]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server->Client [label = "[svc_soundlist][data]0"]; --- [label = "soundlist loop end", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
|||; Server->Client [label = "[svc_soundlist][data]0", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]modellist [svcount] 0"]; ||| [linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
--- [label = "modellist list loop start"]; Client->Server [label = "[clc_stringcmd]modellist [svcount] 0", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server->Client [label = "[svc_modellist][data][next]"]; --- [label = "modellist list loop start", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]modellist [svcount] [next]"]; Server->Client [label = "[svc_modellist][data][next]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
--- [label = "modellist list loop end"]; Client->Server [label = "[clc_stringcmd]modellist [svcount] [next]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server->Client [label = "[svc_modellist][data]0"]; --- [label = "modellist list loop end", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
|||; Server->Client [label = "[svc_modellist][data]0", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]prespawn [svcount] [n=0] [wcsum]"]; ||| [linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
--- [label = "prespawn loop start"]; Client->Server [label = "[clc_stringcmd]prespawn [svcount] [n=0] [wcsum]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server->Client [label = "[signon buffer n][stuffcmd]prespawn..."]; --- [label = "prespawn loop start", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]prespawn [svcount] [n]"]; Server->Client [label = "[signon buffer n][stuffcmd]prespawn...", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
--- [label = "prespawn loop end"]; Client->Server [label = "[clc_stringcmd]prespawn [svcount] [n]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server->Client [label = "[signon buffer n][stuffcmd]spawn..."]; --- [label = "prespawn loop end", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
|||; Server->Client [label = "[signon buffer n][stuffcmd]spawn...", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]spawn [svcount] 0"]; ||| [linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Server->Client [label = "[spawn info][stuffcmd]skins"]; Client->Server [label = "[clc_stringcmd]spawn [svcount] 0", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
Client->Server [label = "[clc_stringcmd]begin [svcount]"]; Server->Client [label = "[spawn info][stuffcmd]skins", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
#... [label = "in game message sequence"]; Client->Server [label = "[clc_stringcmd]begin [svcount]", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
... [label = "in game message sequence", linecolor=white, textcolor=white, arclinecolor=white, arctextcolor=white, textbgcolor=black, arctextbgcolor=black];
\endmsc \endmsc
*/ */

View file

@ -276,17 +276,17 @@ img.footer {
/* @group Code Colorization */ /* @group Code Colorization */
span.keyword { span.keyword {
color: #262833; color: white;
font-weight: bold; font-weight: bold;
} }
span.keywordtype { span.keywordtype {
color: #262833; color: #bec3d9;
font-weight: bold; font-weight: bold;
} }
span.keywordflow { span.keywordflow {
color: #000000; color: #bec3d9;
font-weight: bold; font-weight: bold;
} }

28
doc/imt.dox Normal file
View file

@ -0,0 +1,28 @@
//unfortunately, have to wrap the docs in a C comment for doxygen
// vim:tw=74:formatoptions-=l
/**
\page imt Input Mapping Table
The user can now create and destroy IMTs at will, though currently
destroying IMTs is currently all or nothing (imt_drop_all).
An IMT is created via imt_create which takes the keydest name (key_game
etc), the name of the IMT (must be unique for all IMTs) and optionally the
name of the IMT to which the key binding search will fall back if there is
no binding in the current IMT, but must be already defined and on the same
keydest. This means that IMTs now have user determined fallback paths. The
requirements for the fallback IMT prevent loops and other weird behaviour.
Actual key binding via in_bind is unaffected. This is why the IMT name must
be unique across all IMTs.
The "imt" command works with the key_game keydest, but imt_keydest is
provided for specifying the active IMT for a specific keydest.
At startup, default IMTs are setup to emulate the previous static IMTs so
old configs will continue to work (mostly). New config files will be
written with commands to drop all of the current IMTs and build new ones,
with the bindings and active IMT set as well.
*/

View file

@ -1,4 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign
EXTRA_DIST= quakeforge.1

View file

@ -23,6 +23,7 @@ call_progs_main (progs_t *pr, int argc, const char **argv)
PR_RESET_PARAMS (pr); PR_RESET_PARAMS (pr);
P_INT (pr, 0) = argc; P_INT (pr, 0) = argc;
P_POINTER (pr, 1) = PR_SetPointer (pr, pr_argv); P_POINTER (pr, 1) = PR_SetPointer (pr, pr_argv);
pr->pr_argc = 2;
PR_ExecuteProgram (pr, progs_main); PR_ExecuteProgram (pr, progs_main);
PR_PopFrame (pr); PR_PopFrame (pr);
PR_Zone_Free (pr, pr_argv); PR_Zone_Free (pr, pr_argv);

View file

@ -87,5 +87,5 @@ And yes, these long strings were inspired by Python's long strings.
for doxygen --> for doxygen -->
Binary data is hex-encoded and contained within angle brackets (\c \< \c Binary data is hex-encoded and contained within angle brackets (\c \< \c
\>). There must be an even number of hex-digits. That is, while \c \<FF00\> \>). There must be an even number of hex-digits. That is, while \c \<FF00\>
is value, \c \<F00\> is not. is valid, \c \<F00\> is not.
*/ */

File diff suppressed because it is too large Load diff

View file

@ -1,4 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign
SUBDIRS= include source

1
hw/Makemodule.am Normal file
View file

@ -0,0 +1 @@
include hw/source/Makemodule.am

View file

@ -1,4 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign
EXTRA_DIST =

View file

@ -27,27 +27,17 @@
# $Id$ # $Id$
# #
AUTOMAKE_OPTIONS= foreign bin_PROGRAMS += @HW_TARGETS@
# Stuff that is common to both client and server EXTRA_PROGRAMS += hw-master
INCLUDES= -I$(top_srcdir)/include -I$(top_srcdir)/hw/include
SDL_LIBS = @SDL_LIBS@
bin_PROGRAMS= @HW_TARGETS@
EXTRA_PROGRAMS= hw-master
common_ldflags= -export-dynamic
hw_master_libs= \ hw_master_libs= \
$(top_builddir)/libs/net/libnet_chan.la \ libs/net/libnet_chan.la \
@server_static_plugin_libs@ \ @server_static_plugin_libs@ \
$(top_builddir)/libs/console/libQFconsole.la \ libs/console/libQFconsole.la \
$(top_builddir)/libs/util/libQFutil.la libs/util/libQFutil.la
hw_master_LDFLAGS= $(common_ldflags) hw_master_LDFLAGS= $(common_ldflags)
hw_master_LDADD= $(hw_master_libs) $(NET_LIBS) hw_master_LDADD= $(hw_master_libs) $(NET_LIBS)
hw_master_DEPENDENCIES= $(hw_master_libs) hw_master_DEPENDENCIES= $(hw_master_libs)
hw_master_SOURCES= master.c hw_master_SOURCES= hw/source/master.c
# Kill the temp files, hopefully.
CLEANFILES = *.i *.s

View file

@ -121,7 +121,7 @@ FL_Add (filter_t * filter)
filter_list = filter; filter_list = filter;
} }
static filter_t * static __attribute__((pure)) filter_t *
FL_Find (netadr_t adr) FL_Find (netadr_t adr)
{ {
filter_t *filter; filter_t *filter;
@ -209,7 +209,7 @@ SVL_Add (server_t *sv)
sv_list = sv; sv_list = sv;
} }
static server_t * static __attribute__((pure)) server_t *
SVL_Find (netadr_t adr) SVL_Find (netadr_t adr)
{ {
server_t *sv; server_t *sv;
@ -469,13 +469,10 @@ SV_WriteFilterList (void)
} }
static void static void
SV_Shutdown (void) SV_Shutdown (void *data)
{ {
NET_Shutdown ();
// write filter list // write filter list
SV_WriteFilterList (); SV_WriteFilterList ();
Con_Shutdown ();
} }
static void static void
@ -525,7 +522,7 @@ main (int argc, const char **argv)
mst_cbuf = Cbuf_New (&id_interp); mst_cbuf = Cbuf_New (&id_interp);
Sys_RegisterShutdown (SV_Shutdown); Sys_RegisterShutdown (SV_Shutdown, 0);
Sys_Init (); Sys_Init ();

View file

@ -1,26 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign
SUBDIRS = QF
EXTRA_DIST = \
adivtab.h alsa_funcs_list.h anorm_dots.h anorms.h asm_draw.h asm_i386.h \
block16.h block8.h buildnum.h clview.h compat.h context_sdl.h \
context_x11.h d_iface.h d_ifacea.h d_local.h dga_check.h exp.h fbset.h \
garbage.h getopt.h gib_buffer.h gib_builtin.h gib_classes.h \
gib_execute.h gib_function.h gib_handle.h gib_object.h gib_parse.h \
gib_process.h gib_regex.h gib_semantics.h gib_thread.h gib_tree.h \
gib_vars.h gl_warp_sin.h in_win.h logos.h mod_internal.h net_dgrm.h \
net_loop.h net_udp.h net_vcr.h net_wins.h netchan.h netmain.h \
noisetextures.h old_keys.h ops.h pstdint.h qfalloca.h qstring.h \
quakeasm.h r_cvar.h r_dynamic.h r_internal.h r_local.h r_screen.h \
r_shared.h regex.h rua_internal.h sbar.h skin_stencil.h snd_internal.h \
sv_console.h varrays.h vgamodes.h vid_internal.h vregset.h winquake.h \
world.h \
\
client/entities.h \
\
qw/bothdefs.h qw/msg_backbuf.h qw/msg_ucmd.h qw/pmove.h qw/protocol.h \
\
win32/dirent.h win32/fnmatch.h win32/stdint.h \
\
win32/resources/icon1Vista.ico win32/resources/icon1XP.ico \
win32/resources/quakeforge.rc win32/resources/resource.h

94
include/Makemodule.am Normal file
View file

@ -0,0 +1,94 @@
## Process this file with automake to produce Makefile.in
include include/QF/Makemodule.am
EXTRA_DIST += \
include/adivtab.h \
include/alsa_funcs_list.h \
include/anorm_dots.h \
include/anorms.h \
include/asm_draw.h \
include/asm_i386.h \
include/block16.h \
include/block8.h \
include/buildnum.h \
include/compat.h \
include/context_sdl.h \
include/context_x11.h \
include/d_iface.h \
include/d_ifacea.h \
include/d_local.h \
include/dga_check.h \
include/exp.h \
include/fbset.h \
include/garbage.h \
include/getopt.h \
include/gib_buffer.h \
include/gib_builtin.h \
include/gib_classes.h \
include/gib_execute.h \
include/gib_function.h \
include/gib_handle.h \
include/gib_object.h \
include/gib_parse.h \
include/gib_process.h \
include/gib_regex.h \
include/gib_semantics.h \
include/gib_thread.h \
include/gib_tree.h \
include/gib_vars.h \
include/gl_warp_sin.h \
include/in_win.h \
include/logos.h \
include/mod_internal.h \
include/net_dgrm.h \
include/net_loop.h \
include/net_udp.h \
include/net_vcr.h \
include/net_wins.h \
include/netchan.h \
include/netmain.h \
include/noisetextures.h \
include/old_keys.h \
include/ops.h \
include/pstdint.h \
include/qfalloca.h \
include/qstring.h \
include/quakeasm.h \
include/r_cvar.h \
include/r_dynamic.h \
include/r_internal.h \
include/r_local.h \
include/r_screen.h \
include/r_shared.h \
include/regex.h \
include/rua_internal.h \
include/sbar.h \
include/skin_stencil.h \
include/snd_internal.h \
include/sv_console.h \
include/varrays.h \
include/vgamodes.h \
include/vid_gl.h \
include/vid_internal.h \
include/vid_sw.h \
include/vid_vulkan.h \
include/vregset.h \
include/winquake.h \
include/world.h \
include/client/effects.h \
include/client/entities.h \
include/client/temp_entities.h \
include/client/locs.h \
include/client/view.h \
include/qw/bothdefs.h \
include/qw/msg_backbuf.h \
include/qw/msg_ucmd.h \
include/qw/pmove.h \
include/qw/protocol.h \
include/win32/dirent.h \
include/win32/fnmatch.h \
include/win32/stdint.h \
include/win32/resources/icon1Vista.ico \
include/win32/resources/icon1XP.ico \
include/win32/resources/quakeforge.rc \
include/win32/resources/resource.h

View file

@ -50,6 +50,6 @@ void gl_lightmap_init (void);
void GL_BuildLightmaps (struct model_s **models, int num_models); void GL_BuildLightmaps (struct model_s **models, int num_models);
void R_BlendLightmaps (void); void R_BlendLightmaps (void);
void R_CalcLightmaps (void); void R_CalcLightmaps (void);
extern void (*R_BuildLightMap) (msurface_t *surf); extern void (*R_BuildLightMap) (mod_brush_t *brush, msurface_t *surf);
#endif // __QF_GL_lightmap_h #endif // __QF_GL_lightmap_h

View file

@ -36,8 +36,8 @@
void glsl_lightmap_init (void); void glsl_lightmap_init (void);
void glsl_R_BuildLightmaps (struct model_s **models, int num_models); void glsl_R_BuildLightmaps (struct model_s **models, int num_models);
void glsl_R_CalcLightmaps (void); void glsl_R_CalcLightmaps (void);
extern void (*glsl_R_BuildLightMap) (msurface_t *surf); extern void (*glsl_R_BuildLightMap) (mod_brush_t *brush, msurface_t *surf);
int glsl_R_LightmapTexture (void); int glsl_R_LightmapTexture (void) __attribute__((pure));
void glsl_R_FlushLightmaps (void); void glsl_R_FlushLightmaps (void);
#endif//__QF_GLSL_lightmap_h #endif//__QF_GLSL_lightmap_h

View file

@ -31,15 +31,6 @@
#include "QF/qtypes.h" #include "QF/qtypes.h"
typedef struct scrap_s scrap_t; typedef struct scrap_s scrap_t;
typedef struct subpic_s {
const struct subpic_s * const next;
const scrap_t * const scrap;
const struct vrect_s * const rect;
const int tnum; ///< texture number
const int width; ///< requested width
const int height; ///< requested height
const float size; ///< size factor for tex coords (mult)
} subpic_t;
int GLSL_LoadQuakeTexture (const char *identifier, int width, int height, int GLSL_LoadQuakeTexture (const char *identifier, int width, int height,
byte *data); byte *data);
@ -55,10 +46,12 @@ void GLSL_TextureInit (void);
scrap_t *GLSL_CreateScrap (int size, int format, int linear); scrap_t *GLSL_CreateScrap (int size, int format, int linear);
void GLSL_DestroyScrap (scrap_t *scrap); void GLSL_DestroyScrap (scrap_t *scrap);
void GLSL_ScrapClear (scrap_t *scrap); void GLSL_ScrapClear (scrap_t *scrap);
int GLSL_ScrapTexture (scrap_t *scrap); int GLSL_ScrapTexture (scrap_t *scrap) __attribute__((pure));
subpic_t *GLSL_ScrapSubpic (scrap_t *scrap, int width, int height); //XXX slow! //XXX slow!
void GLSL_SubpicDelete (subpic_t *subpic); //XXX slow! struct subpic_s *GLSL_ScrapSubpic (scrap_t *scrap, int width, int height);
void GLSL_SubpicUpdate (subpic_t *subpic, byte *data, int batch); //XXX slow!
void GLSL_SubpicDelete (struct subpic_s *subpic);
void GLSL_SubpicUpdate (struct subpic_s *subpic, byte *data, int batch);
void GLSL_ScrapFlush (scrap_t *scrap); void GLSL_ScrapFlush (scrap_t *scrap);
#endif//__QF_GLSL_textures_h #endif//__QF_GLSL_textures_h

View file

@ -30,6 +30,12 @@
#include "QF/qtypes.h" #include "QF/qtypes.h"
typedef struct shader_s {
int num_strings;
const char **strings;
const char **src;
} shader_t;
typedef struct shaderparam_s { typedef struct shaderparam_s {
const char *name; const char *name;
qboolean uniform; qboolean uniform;
@ -40,9 +46,42 @@ extern int glsl_palette;
extern int glsl_colormap; extern int glsl_colormap;
void GLSL_Init_Common (void); void GLSL_Init_Common (void);
int GLSL_CompileShader (const char *name, const char *shader_src, int type);
int GLSL_CompileShader (const char *name, const shader_t *shader, int type);
int GLSL_LinkProgram (const char *name, int vert, int frag); int GLSL_LinkProgram (const char *name, int vert, int frag);
int GLSL_ResolveShaderParam (int program, shaderparam_t *param); int GLSL_ResolveShaderParam (int program, shaderparam_t *param);
void GLSL_DumpAttribArrays (void); void GLSL_DumpAttribArrays (void);
/* Register a shader effect "file".
This is based on The OpenGL Shader Wrangler by the little grasshopper
(http://prideout.net/blog/?p=11).
\param name The name of the effect in the effect key.
\param src The string holding the effect file.
\return 0 for failure, 1 for success.
*/
int GLSL_RegisterEffect (const char *name, const char *src);
/* Build a shader program script from a list of effect keys.
This is based on The OpenGL Shader Wrangler by the little grasshopper
(http://prideout.net/blog/?p=11).
The returned shader program script is suitable for passing directly to
GLSL_CompileShader.
\param effect_keys Null terminated list of effect keys. The shader will be
built from the specified segments in the given order.
\return A pointer to the built up shader program script, or null on
failure.
*/
shader_t *GLSL_BuildShader (const char **effect_keys);
/* Free a shader program script built by GLSL_BuildShader.
\param shader The shader program script to be freed.
*/
void GLSL_FreeShader (shader_t *shader);
#endif // __QF_GLSL_vid_h #endif // __QF_GLSL_vid_h

View file

@ -1,27 +0,0 @@
AUTOMAKE_OPTIONS = foreign
pkgincludedir = $(includedir)/QF
nobase_pkginclude_HEADERS = \
alloc.h bspfile.h cbuf.h cdaudio.h checksum.h clip_hull.h cmd.h \
console.h crc.h csqc.h cvar.h dstring.h draw.h gib.h hash.h hl.h \
idparse.h image.h in_event.h info.h input.h iqm.h joystick.h keys.h \
link.h llist.h locs.h mathlib.h mdfour.h mersenne.h model.h modelgen.h \
msg.h object.h pak.h pakfile.h pcx.h png.h plugin.h pr_comp.h pr_debug.h \
pr_obj.h progs.h qargs.h qdefs.h qendian.h qfplist.h qtypes.h quakefs.h \
quakeio.h render.h riff.h ruamoko.h set.h screen.h script.h sizebuf.h \
skin.h sound.h spritegn.h sys.h teamplay.h tga.h uint32.h va.h \
ver_check.h vid.h vrect.h view.h wad.h wadfile.h winding.h zone.h \
\
GL/ati.h GL/defines.h GL/extensions.h GL/funcs.h GL/qf_draw.h \
GL/qf_explosions.h GL/qf_funcs_list.h GL/qf_iqm.h GL/qf_lightmap.h \
GL/qf_rlight.h GL/qf_rmain.h GL/qf_rsurf.h GL/qf_sky.h GL/qf_textures.h \
GL/qf_vid.h GL/types.h \
\
GLSL/defines.h GLSL/funcs.h GLSL/qf_alias.h GLSL/qf_bsp.h GLSL/qf_draw.h \
GLSL/qf_funcs_list.h GLSL/qf_iqm.h GLSL/qf_lightmap.h GLSL/qf_particles.h \
GLSL/qf_textures.h GLSL/qf_vid.h GLSL/types.h \
\
math/dual.h math/half.h math/matrix3.h math/matrix4.h math/quaternion.h \
math/vector.h \
\
plugin/cd.h plugin/console.h plugin/general.h plugin/input.h \
plugin/snd_output.h plugin/snd_render.h plugin/vid_render.h

169
include/QF/Makemodule.am Normal file
View file

@ -0,0 +1,169 @@
include_qf = \
include/QF/alloc.h \
include/QF/bspfile.h \
include/QF/cbuf.h \
include/QF/cdaudio.h \
include/QF/checksum.h \
include/QF/clip_hull.h \
include/QF/cmd.h \
include/QF/console.h \
include/QF/crc.h \
include/QF/csqc.h \
include/QF/cvar.h \
include/QF/darray.h \
include/QF/dstring.h \
include/QF/draw.h \
include/QF/gib.h \
include/QF/hash.h \
include/QF/idparse.h \
include/QF/image.h \
include/QF/in_event.h \
include/QF/info.h \
include/QF/input.h \
include/QF/iqm.h \
include/QF/joystick.h \
include/QF/keys.h \
include/QF/link.h \
include/QF/llist.h \
include/QF/mathlib.h \
include/QF/mdfour.h \
include/QF/mersenne.h \
include/QF/model.h \
include/QF/modelgen.h \
include/QF/msg.h \
include/QF/object.h \
include/QF/pak.h \
include/QF/pakfile.h \
include/QF/pcx.h \
include/QF/png.h \
include/QF/plist.h \
include/QF/plugin.h \
include/QF/pr_comp.h \
include/QF/pr_debug.h \
include/QF/pr_obj.h \
include/QF/pr_type.h \
include/QF/progs.h \
include/QF/qargs.h \
include/QF/qdefs.h \
include/QF/qendian.h \
include/QF/qtypes.h \
include/QF/quakefs.h \
include/QF/quakeio.h \
include/QF/render.h \
include/QF/riff.h \
include/QF/ringbuffer.h \
include/QF/ruamoko.h \
include/QF/screen.h \
include/QF/script.h \
include/QF/segtext.h \
include/QF/set.h \
include/QF/sizebuf.h \
include/QF/skin.h \
include/QF/sound.h \
include/QF/spritegn.h \
include/QF/sys.h \
include/QF/teamplay.h \
include/QF/tga.h \
include/QF/txtbuffer.h \
include/QF/va.h \
include/QF/ver_check.h \
include/QF/vid.h \
include/QF/vrect.h \
include/QF/view.h \
include/QF/wad.h \
include/QF/wadfile.h \
include/QF/winding.h \
include/QF/zone.h
include_qf_gl = \
include/QF/GL/ati.h \
include/QF/GL/defines.h \
include/QF/GL/extensions.h \
include/QF/GL/funcs.h \
include/QF/GL/qf_draw.h \
include/QF/GL/qf_explosions.h \
include/QF/GL/qf_funcs_list.h \
include/QF/GL/qf_iqm.h \
include/QF/GL/qf_lightmap.h \
include/QF/GL/qf_rlight.h \
include/QF/GL/qf_rmain.h \
include/QF/GL/qf_rsurf.h \
include/QF/GL/qf_sky.h \
include/QF/GL/qf_textures.h \
include/QF/GL/qf_vid.h \
include/QF/GL/types.h
include_qf_glsl = \
include/QF/GLSL/defines.h \
include/QF/GLSL/funcs.h \
include/QF/GLSL/qf_alias.h \
include/QF/GLSL/qf_bsp.h \
include/QF/GLSL/qf_draw.h \
include/QF/GLSL/qf_funcs_list.h \
include/QF/GLSL/qf_iqm.h \
include/QF/GLSL/qf_lightmap.h \
include/QF/GLSL/qf_particles.h \
include/QF/GLSL/qf_textures.h \
include/QF/GLSL/qf_vid.h \
include/QF/GLSL/types.h
include_qf_math = \
include/QF/math/dual.h \
include/QF/math/half.h \
include/QF/math/matrix3.h \
include/QF/math/matrix4.h \
include/QF/math/quaternion.h \
include/QF/math/vector.h
include_qf_plugin = \
include/QF/plugin/cd.h \
include/QF/plugin/console.h \
include/QF/plugin/general.h \
include/QF/plugin/input.h \
include/QF/plugin/snd_output.h \
include/QF/plugin/snd_render.h \
include/QF/plugin/vid_render.h
include_qf_vulkan = \
include/QF/Vulkan/buffer.h \
include/QF/Vulkan/command.h \
include/QF/Vulkan/cvars.h \
include/QF/Vulkan/descriptor.h \
include/QF/Vulkan/device.h \
include/QF/Vulkan/funclist.h \
include/QF/Vulkan/image.h \
include/QF/Vulkan/instance.h \
include/QF/Vulkan/memory.h \
include/QF/Vulkan/pipeline.h \
include/QF/Vulkan/qf_draw.h \
include/QF/Vulkan/qf_vid.h \
include/QF/Vulkan/renderpass.h \
include/QF/Vulkan/swapchain.h
# headers shared with ruamoko
qfcc_include_qf = include/QF/keys.h
qf_includedir = $(includedir)/QF
qf_gl_includedir = $(includedir)/QF/GL
qf_glsl_includedir = $(includedir)/QF/GLSL
qf_math_includedir = $(includedir)/QF/math
qf_plugin_includedir = $(includedir)/QF/plugin
qf_vulkan_includedir = $(includedir)/QF/vulkan
qf_include_HEADERS = @qfac_include_qf@
qf_gl_include_HEADERS = @qfac_include_qf_gl@
qf_glsl_include_HEADERS = @qfac_include_qf_glsl@
qf_math_include_HEADERS = @qfac_include_qf_math@
qf_plugin_include_HEADERS = @qfac_include_qf_plugin@
qf_vulkan_include_HEADERS = @qfac_include_qf_vulkan@
ruamoko_qf_includedir = $(ruamoko_includedir)/QF
ruamoko_qf_include_HEADERS = @qfac_qfcc_include_qf@
EXTRA_HEADERS += \
$(include_qf) \
$(include_qf_gl) \
$(include_qf_glsl) \
$(include_qf_math) \
$(include_qf_plugin) \
$(include_qf_vulkan) \
$(qfcc_include_qf)

View file

@ -0,0 +1,22 @@
#ifndef __QF_Vulkan_barrier_h
#define __QF_Vulkan_barrier_h
typedef struct {
VkPipelineStageFlags src;
VkPipelineStageFlags dst;
} qfv_pipelinestagepair_t;
//XXX Note: imageLayoutTransitionBarriers, imageLayoutTransitionStages and
// the enum must be kept in sync
enum {
qfv_LT_Undefined_to_TransferDst,
qfv_LT_TransferDst_to_ShaderReadOnly,
qfv_LT_ShaderReadOnly_to_TransferDst,
qfv_LT_Undefined_to_DepthStencil,
qfv_LT_Undefined_to_Color,
};
extern const VkImageMemoryBarrier imageLayoutTransitionBarriers[];
extern const qfv_pipelinestagepair_t imageLayoutTransitionStages[];
#endif//__QF_Vulkan_barrier_h

View file

@ -0,0 +1,48 @@
#ifndef __QF_Vulkan_buffer_h
#define __QF_Vulkan_buffer_h
#include "QF/darray.h"
typedef struct qfv_buffertransition_s {
VkBuffer buffer;
VkAccessFlags srcAccess;
VkAccessFlags dstAccess;
uint32_t srcQueueFamily;
uint32_t dstQueueFamily;
VkDeviceSize offset;
VkDeviceSize size;
} qfv_buffertransition_t;
typedef struct qfv_buffertransitionset_s
DARRAY_TYPE (qfv_buffertransition_t) qfv_buffertransitionset_t;
typedef struct qfv_bufferbarrierset_s
DARRAY_TYPE (VkBufferMemoryBarrier) qfv_bufferbarrierset_t;
typedef struct qfv_bufferset_s
DARRAY_TYPE (VkBuffer) qfv_bufferset_t;
#define QFV_AllocBufferSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_bufferset_t, num, allocator)
struct qfv_device_s;
VkBuffer QFV_CreateBuffer (struct qfv_device_s *device,
VkDeviceSize size,
VkBufferUsageFlags usage);
VkDeviceMemory QFV_AllocBufferMemory (struct qfv_device_s *device,
VkBuffer buffer,
VkMemoryPropertyFlags properties,
VkDeviceSize size, VkDeviceSize offset);
int QFV_BindBufferMemory (struct qfv_device_s *device,
VkBuffer buffer, VkDeviceMemory object,
VkDeviceSize offset);
qfv_bufferbarrierset_t *
QFV_CreateBufferTransitions (qfv_buffertransition_t *transitions,
int numTransitions);
VkBufferView QFV_CreateBufferView (struct qfv_device_s *device,
VkBuffer buffer, VkFormat format,
VkDeviceSize offset, VkDeviceSize size);
#endif//__QF_Vulkan_buffer_h

View file

@ -0,0 +1,43 @@
#ifndef __QF_Vulkan_capture_h
#define __QF_Vulkan_capture_h
#include "QF/darray.h"
#include "QF/qtypes.h"
typedef struct qfv_capture_image_s {
VkImage image;
VkImageLayout layout;
VkCommandBuffer cmd;
byte *data;
} qfv_capture_image_t;
typedef struct qfv_capture_image_set_s
DARRAY_TYPE (qfv_capture_image_t) qfv_capture_image_set_t;
#define QFV_AllocCaptureImageSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_capture_image_set_t, num, allocator)
typedef struct qfv_capture_s {
struct qfv_device_s *device;
int canBlit;
VkExtent2D extent;
qfv_capture_image_set_t *image_set;
size_t memsize;
VkDeviceMemory memory;
} qfv_capture_t;
struct qfv_swapchain_s;
qfv_capture_t *QFV_CreateCapture (struct qfv_device_s *device, int numframes,
struct qfv_swapchain_s *swapchain,
VkCommandPool cmdPool);
void QFV_RenewCapture (qfv_capture_t *capture,
struct qfv_swapchain_s *swapchain);
void QFV_DestroyCapture (qfv_capture_t *capture);
VkCommandBuffer QFV_CaptureImage (qfv_capture_t *capture, VkImage scImage,
int frame);
const byte *QFV_CaptureData (qfv_capture_t *capture, int frame) __attribute__((pure));
#endif//__QF_Vulkan_capture_h

View file

@ -0,0 +1,47 @@
#ifndef __QF_Vulkan_command_h
#define __QF_Vulkan_command_h
#include "QF/darray.h"
typedef struct qfv_cmdbufferset_s
DARRAY_TYPE (VkCommandBuffer) qfv_cmdbufferset_t;
#define QFV_AllocCommandBufferSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_cmdbufferset_t, num, allocator)
typedef struct qfv_semaphoreset_s
DARRAY_TYPE (VkSemaphore) qfv_semaphoreset_t;
typedef struct qfv_fenceset_s
DARRAY_TYPE (VkFence) qfv_fenceset_t;
#define QFV_AllocFenceSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_fenceset_t, num, allocator)
typedef struct qfv_bufferimagecopy_s
DARRAY_TYPE (VkBufferImageCopy) qfv_bufferimagecopy_t;
#define QFV_AllocBufferImageCopy(num, allocator) \
DARRAY_ALLOCFIXED (qfv_bufferimagecopy_t, num, allocator)
struct qfv_queue_s;
struct qfv_device_s;
VkCommandPool QFV_CreateCommandPool (struct qfv_device_s *device,
uint32_t queueFamily,
int transient, int reset);
/** Allocate bufferset->size command buffers
*/
int QFV_AllocateCommandBuffers (struct qfv_device_s *device,
VkCommandPool pool, int secondary,
qfv_cmdbufferset_t *bufferset);
VkSemaphore QFV_CreateSemaphore (struct qfv_device_s *device);
VkFence QFV_CreateFence (struct qfv_device_s *device, int signaled);
int QFV_QueueSubmit (struct qfv_queue_s *queue,
qfv_semaphoreset_t *waitSemaphores,
VkPipelineStageFlags *stages,
qfv_cmdbufferset_t *buffers,
qfv_semaphoreset_t *signalSemaphores, VkFence fence);
int QFV_QueueWaitIdle (struct qfv_queue_s *queue);
#endif//__QF_Vulkan_command_h

View file

@ -0,0 +1,8 @@
#ifndef __QF_Vulkan_cvars_h
#define __QF_Vulkan_cvars_h
extern struct cvar_s *vulkan_use_validation;
extern struct cvar_s *vulkan_presentation_mode;
extern struct cvar_s *vulkan_frame_count;
#endif//__QF_Vulkan_cvars_h

115
include/QF/Vulkan/debug.h Normal file
View file

@ -0,0 +1,115 @@
#ifndef __QF_Vulkan_debug_h
#define __QF_Vulkan_debug_h
#define QFV_duCmdBeginLabel(device, cmd, name...)\
do { \
qfv_devfuncs_t *dfunc = device->funcs; \
if (dfunc->vkCmdBeginDebugUtilsLabelEXT) { \
VkDebugUtilsLabelEXT label = { \
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, 0, name \
}; \
dfunc->vkCmdBeginDebugUtilsLabelEXT (cmd, &label); \
} \
} while (0)
#define QFV_duCmdEndLabel(device, cmd) \
do { \
qfv_devfuncs_t *dfunc = device->funcs; \
if (dfunc->vkCmdEndDebugUtilsLabelEXT) { \
dfunc->vkCmdEndDebugUtilsLabelEXT (cmd); \
} \
} while (0)
#define QFV_duCmdInsertLabel(device, cmd, name...) \
do { \
qfv_devfuncs_t *dfunc = device->funcs; \
if (dfunc->vkCmdInsertDebugUtilsLabelEXT) { \
VkDebugUtilsLabelEXT label = { \
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, 0, name \
}; \
dfunc->vkCmdInsertDebugUtilsLabelEXT (cmd, &label); \
} \
} while (0)
#define QFV_duCreateMessenger(inst, severity, type, callback, data, messenger)\
do { \
if (inst->funcs->vkCreateDebugUtilsMessengerEXT) { \
VkDebugUtilsMessengerCreateInfoEXT createInfo = { \
VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT, 0, 0,\
severity, type, callback, data \
}; \
inst->funcs->vkCreateDebugUtilsMessengerEXT (inst, &createInfo, 0,\
messenger); \
} \
} while (0)
#define QFV_duDestroyMessenger(inst, messenger) \
do { \
if (inst->funcs->vkDestroyDebugUtilsMessengerEXT) { \
inst->funcs->vkDestroyDebugUtilsMessengerEXT (inst, messenger, 0);\
} \
} while (0)
#define QFV_duQueueBeginLabel(device, queue, name...) \
do { \
qfv_devfuncs_t *dfunc = device->funcs; \
if (dfunc->vkQueueBeginDebugUtilsLabelEXT) { \
VkDebugUtilsLabelEXT label = { \
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, 0, name \
}; \
dfunc->vkQueueBeginDebugUtilsLabelEXT (queue, &label); \
} \
} while (0)
#define QFV_duQueueEndLabel(device, queue) \
do { \
qfv_devfuncs_t *dfunc = device->funcs; \
if (dfunc->vkQueueEndDebugUtilsLabelEXT) { \
dfunc->vkQueueEndDebugUtilsLabelEXT (queue); \
} \
} while (0)
#define QFV_duQueueInsertLabel(device, queue, name...) \
do { \
qfv_devfuncs_t *dfunc = device->funcs; \
if (dfunc->vkQueueInsertDebugUtilsLabelEXT) { \
VkDebugUtilsLabelEXT label = { \
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, 0, name \
}; \
dfunc->vkQueueInsertDebugUtilsLabelEXT (queue, &label); \
} \
} while (0)
#define QFV_duSetObjectName(device, type, handle, name) \
do { \
qfv_devfuncs_t *dfunc = device->funcs; \
if (dfunc->vkSetDebugUtilsObjectNameEXT) { \
VkDebugUtilsObjectNameInfoEXT nameInfo = { \
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, 0, \
type, (uint64_t) handle, name \
}; \
dfunc->vkSetDebugUtilsObjectNameEXT (device->dev, &nameInfo); \
} \
} while (0)
#define QFV_duSetObjectTag(device, type, handle, name, size, tag) \
do { \
qfv_devfuncs_t *dfunc = device->funcs; \
if (dfunc->vkSetDebugUtilsObjectTagEXT) { \
VkDebugUtilsObjectTagInfoEXT tagInfo = { \
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT, 0, \
type, handle, name, size, tag \
}; \
dfunc->vkSetDebugUtilsObjectTagEXT (device->dev, &tagInfo); \
} \
} while (0)
#define QFV_duSubmitMessage(inst, severity, types, data) \
do { \
if (inst->funcs->vkSubmitDebugUtilsMessageEXT) { \
inst->funcs->vkSubmitDebugUtilsMessageEXT (inst, severity, types, \
data); \
} \
} while (0)
#endif//__QF_Vulkan_debug_h

View file

@ -0,0 +1,62 @@
#ifndef __QF_Vulkan_descriptor_h
#define __QF_Vulkan_descriptor_h
#include "QF/darray.h"
typedef struct qfv_bindingset_s
DARRAY_TYPE (VkDescriptorSetLayoutBinding) qfv_bindingset_t;
typedef struct qfv_descriptorsetlayoutset_s
DARRAY_TYPE (VkDescriptorSetLayout) qfv_descriptorsetlayoutset_t;
#define QFV_AllocDescriptorSetLayoutSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_descriptorsetlayoutset_t, num, allocator)
typedef struct qfv_descriptorsets_s
DARRAY_TYPE (VkDescriptorSet) qfv_descriptorsets_t;
#define QFV_AllocDescriptorSets(num, allocator) \
DARRAY_ALLOCFIXED (qfv_descriptorsets_t, num, allocator)
typedef struct qfv_writedescriptorsets_s
DARRAY_TYPE (VkWriteDescriptorSet) qfv_writedescriptorsets_t;
#define QFV_AllocWriteDescriptorSets(num, allocator) \
DARRAY_ALLOCFIXED (qfv_writedescriptorsets_t, num, allocator)
typedef struct qfv_copydescriptorsets_s
DARRAY_TYPE (VkCopyDescriptorSet) qfv_copydescriptorsets_t;
#define QFV_AllocCopyDescriptorSets(num, allocator) \
DARRAY_ALLOCFIXED (qfv_descriptorsetlayoutset_t, num, allocator)
struct qfv_device_s;
VkSampler QFV_CreateSampler (struct qfv_device_s *device,
VkFilter magFilter, VkFilter minFilter,
VkSamplerMipmapMode mipmapMode,
VkSamplerAddressMode addressModeU,
VkSamplerAddressMode addressModeV,
VkSamplerAddressMode addressModeW,
float mipLodBias,
VkBool32 anisotryEnable, float maxAnisotropy,
VkBool32 compareEnable, VkCompareOp compareOp,
float minLod, float maxLod,
VkBorderColor borderColor,
VkBool32 unnormalizedCoordinates);
VkDescriptorSetLayout
QFV_CreateDescriptorSetLayout (struct qfv_device_s *device,
qfv_bindingset_t *bindings);
VkDescriptorPool
QFV_CreateDescriptorPool (struct qfv_device_s *device,
VkDescriptorPoolCreateFlags flags, uint32_t maxSets,
qfv_bindingset_t *bindings);
qfv_descriptorsets_t *
QFV_AllocateDescriptorSet (struct qfv_device_s *device,
VkDescriptorPool pool,
qfv_descriptorsetlayoutset_t *layouts);
#endif//__QF_Vulkan_descriptor_h

View file

@ -0,0 +1,39 @@
#ifndef __QF_Vulkan_device_h
#define __QF_Vulkan_device_h
typedef struct qfv_devfuncs_s {
#define DEVICE_LEVEL_VULKAN_FUNCTION(name) PFN_##name name;
#define DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION(name,ext) PFN_##name name;
#include "QF/Vulkan/funclist.h"
} qfv_devfuncs_t;
typedef struct qfv_queue_s {
struct qfv_device_s *device;
int32_t queueFamily;
VkQueue queue;
} qfv_queue_t;
struct qfv_instance_s;
typedef struct qfv_device_s {
VkDevice dev;
struct qfv_physdev_s *physDev;
qfv_devfuncs_t *funcs;
qfv_queue_t queue;
struct strset_s *enabled_extensions;
int (*extension_enabled) (struct qfv_device_s *inst,
const char *ext);
} qfv_device_t;
struct vulkan_ctx_s;
qfv_device_t *QFV_CreateDevice (struct vulkan_ctx_s *ctx,
const char **extensions);
void QFV_DestroyDevice (qfv_device_t *device);
int QFV_DeviceWaitIdle (qfv_device_t *device);
VkFormat QFV_FindSupportedFormat (qfv_device_t *device, VkImageTiling tiling,
VkFormatFeatureFlags features,
int numCandidates,
const VkFormat *candidates);
#endif//__QF_Vulkan_device_h

237
include/QF/Vulkan/draw.h Normal file
View file

@ -0,0 +1,237 @@
/*
draw.h
Video buffer handling definitions and prototypes
Copyright (C) 1996-1997 Id Software, Inc.
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
*/
#ifndef __QF_draw_h
#define __QF_draw_h
/** \defgroup video Video Sub-sytem */
/** \defgroup video_renderer Renderer Sub-system
\ingroup video
*/
/** \defgroup video_renderer_draw Generic draw functions
\ingroup video_renderer
*/
///@{
#include "QF/wad.h"
extern byte *draw_chars;
/** Initialize the draw stuff.
*/
void Draw_Init (void);
/** Draws one 8*8 graphics character with 0 being transparent.
It can be clipped to the top of the screen to allow the console to be
smoothly scrolled off.
\param x horizontal location of the top left corner of the character.
\param y vertical location of the top left corner of the character.
\param ch 8 bit character to draw.
\note The character drawn is from the quake character set, which is
(by default) standard ascii for 0x20-0x7e (white). 0xa0-0xfe is
also standard ascii (brown). 0x01-0x1f and 0x80-0x9f are
various drawing characters, and 0x7f is a backwards arrow.
*/
void Draw_Character (int x, int y, unsigned ch);
/** Draws a character string to the screen.
No line wrapping is performed.
\param x horizontal location of the top left corner of the character.
\param y vertical location of the top left corner of the character.
\param str 8 bit character string to draw.
\note See Draw_Character() for character set description.
String is normal nul terminated C string.
*/
void Draw_String (int x, int y, const char *str);
/** Draws a character sub-string to the screen.
No line wrapping is performed.
\param x horizontal location of the top left corner of the character.
\param y vertical location of the top left corner of the character.
\param str 8 bit character string to draw.
\param count Maximum characters of the string to draw.
\note See Draw_Character() for character set description.
Draws up to \p count characters, or stops at the first nul
character.
*/
void Draw_nString (int x, int y, const char *str, int count);
/** Draws a character string to the screen.
No line wrapping is performed.
\param x horizontal location of the top left corner of the character.
\param y vertical location of the top left corner of the character.
\param str 8 bit character string to draw.
\note See Draw_Character() for character set description.
String is normal nul terminated C string.
Characters of the string are forced to have their high bit set
(ie, they will be in the range 0x80-0xff).
*/
void Draw_AltString (int x, int y, const char *str);
/** Draw the console background with various optional effects.
\param lines Vertical size in pixels of the console.
\param alpha Console transparency level (255 = opaque).
\note \p alpha is effective only in the OpenGL renderer. Effectively
255 (opaque) for the software renderer.
\c gl_conspin causes the background to spin.
\c gl_constretch causes the background to stretch rather than slide.
*/
void Draw_ConsoleBackground (int lines, byte alpha);
/** Draw a crosshair at the center of the screen.
\c crosshair specifies which crosshair (1 = '+', 2 = large 'x' shape,
3 = fancy '+' shape)
\c cl_crossx and \c cl_crossy offset the crosshair from the center of the
screen.
*/
void Draw_Crosshair (void);
/** Draw the specified crosshair on the screen.
\param ch crosshair to draw
\param x horizontal position of the center of the crosshair.
\param y vertical position of the center of the crosshair.
See Draw_Crosshair() for description of crosshair values.
*/
void Draw_CrosshairAt (int ch, int x, int y);
/** Clear a rectangle with a tiled background.
\param x horizontal position of the upper left corner of the rectangle
\param y horizontal position of the upper left corner of the rectangle
\param w width of the rectangle
\param h height of the rectangle
The background used is the "backtile" WAD lump.
*/
void Draw_TileClear (int x, int y, int w, int h);
/** Clear a rectangle with a solid color.
\param x horizontal position of the upper left corner of the rectangle
\param y horizontal position of the upper left corner of the rectangle
\param w width of the rectangle
\param h height of the rectangle
\param c 8 bit color index.
The color comes from the quake palette.
*/
void Draw_Fill (int x, int y, int w, int h, int c);
/** Draw a text box on the screen
\param x horizontal location of the upper left corner of the box
\param y vertical location of the upper left corner of the box
\param width horizontal size in character cells of the region
\param lines vertical size in character cells of the region
\param alpha transparency of the box
*/
void Draw_TextBox (int x, int y, int width, int lines, byte alpha);
/** Darken the screen.
*/
void Draw_FadeScreen (void);
/** Shift the screen colors.
*/
void Draw_BlendScreen (quat_t color);
///@}
/** \defgroup video_renderer_draw_qpic QPic functions
\ingroup video_renderer_draw
*/
///@{
/** Load a qpic from the filesystem.
\param path path of the file within the quake filesystem
\param alpha transparency level of the pic.
\return pointer qpic data.
\note Up to MAX_CACHED_PICS qpics can be loaded at a time this way
*/
qpic_t *Draw_CachePic (const char *path, qboolean alpha);
/** Remove a qpic from the qpic cache.
This affects only those qpics that were loaded via Draw_CachePic.
\param path path of the file within the quake filesystem
*/
void Draw_UncachePic (const char *path);
/** Create a qpic from raw data.
\param width The width of the pic.
\param height The height of the pic.
\param data The raw data bytes. The system palette will be used for
colors.
\return pointer qpic data.
*/
qpic_t *Draw_MakePic (int width, int height, const byte *data);
/** Destroy a qpic created by Draw_MakePic.
\param pic The qpic to destory.
*/
void Draw_DestroyPic (qpic_t *pic);
/** Load a qpic from gfx.wad.
\param name name of the was lump to load
\return pointer qpic data.
*/
qpic_t *Draw_PicFromWad (const char *name);
/** Draw a qpic to the screen
\param x horizontal location of the upper left corner of the qpic
\param y vertical location of the upper left corner of the qpic
\param pic qpic to draw
*/
void Draw_Pic (int x, int y, qpic_t *pic);
/** Draw a qpic to the screen
\param x horizontal location of the upper left corner of the qpic
\param y vertical location of the upper left corner of the qpic
\param pic qpic to draw
*/
void Draw_Picf (float x, float y, qpic_t *pic);
/** Draw a sub-region of a qpic to the screan
\param x horizontal screen location of the upper left corner of the
sub-region
\param y vertical screen location of the upper left corner of the
sub-region
\param pic qpic to draw
\param srcx horizontal qpic location of the upper left corner of the
sub-region
\param srcy vertical qpic location of the upper left corner of the
sub-region
\param width horizontal size of the sub-region to be drawn
\param height vertical size of the sub-region to be drawn
*/
void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height);
///@}
#endif//__QF_draw_h

View file

@ -0,0 +1,220 @@
#ifndef EXPORTED_VULKAN_FUNCTION
#define EXPORTED_VULKAN_FUNCTION(function)
#endif
EXPORTED_VULKAN_FUNCTION (vkGetInstanceProcAddr)
#undef EXPORTED_VULKAN_FUNCTION
#ifndef GLOBAL_LEVEL_VULKAN_FUNCTION
#define GLOBAL_LEVEL_VULKAN_FUNCTION(function)
#endif
GLOBAL_LEVEL_VULKAN_FUNCTION (vkEnumerateInstanceVersion)
GLOBAL_LEVEL_VULKAN_FUNCTION (vkEnumerateInstanceExtensionProperties)
GLOBAL_LEVEL_VULKAN_FUNCTION (vkEnumerateInstanceLayerProperties)
GLOBAL_LEVEL_VULKAN_FUNCTION (vkCreateInstance)
#undef GLOBAL_LEVEL_VULKAN_FUNCTION
#ifndef INSTANCE_LEVEL_VULKAN_FUNCTION
#define INSTANCE_LEVEL_VULKAN_FUNCTION(function)
#endif
INSTANCE_LEVEL_VULKAN_FUNCTION (vkEnumeratePhysicalDevices)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceProperties)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceFeatures)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceQueueFamilyProperties)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkCreateDevice)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetDeviceProcAddr)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkDestroyInstance)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkEnumerateDeviceLayerProperties)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkEnumerateDeviceExtensionProperties)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceMemoryProperties)
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceFormatProperties)
#undef INSTANCE_LEVEL_VULKAN_FUNCTION
#ifndef INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
#define INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION(function, extension)
#endif
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkCreateDebugUtilsMessengerEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkDestroyDebugUtilsMessengerEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkSubmitDebugUtilsMessageEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetPhysicalDeviceSurfaceSupportKHR, VK_KHR_SURFACE_EXTENSION_NAME)
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetPhysicalDeviceSurfacePresentModesKHR, VK_KHR_SURFACE_EXTENSION_NAME)
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetPhysicalDeviceSurfaceCapabilitiesKHR, VK_KHR_SURFACE_EXTENSION_NAME)
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetPhysicalDeviceSurfaceFormatsKHR, VK_KHR_SURFACE_EXTENSION_NAME)
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkDestroySurfaceKHR, VK_KHR_SURFACE_EXTENSION_NAME)
#undef INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
#ifndef PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION
#define PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION(function, extension)
#endif
#if defined(VK_USE_PLATFORM_XLIB_KHR)
PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetPhysicalDeviceXlibPresentationSupportKHR,
VK_KHR_XLIB_SURFACE_EXTENSION_NAME)
PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION
(vkCreateXlibSurfaceKHR,
VK_KHR_XLIB_SURFACE_EXTENSION_NAME)
#elif defined(VK_USE_PLATFORM_WIN32_KHR)
PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetPhysicalDeviceWin32PresentationSupportKHR,
VK_KHR_WIN32_SURFACE_EXTENSION_NAME)
PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION
(vkCreateWin32SurfaceKHR,
VK_KHR_WIN32_SURFACE_EXTENSION_NAME)
#elif defined(VK_USE_PLATFORM_XCB_KHR)
PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetPhysicalDeviceXcbPresentationSupportKHR,
VK_KHR_XCB_SURFACE_EXTENSION_NAME)
PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION
(vkCreateXcbSurfaceKHR,
VK_KHR_XCB_SURFACE_EXTENSION_NAME)
#endif
#undef PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION
#ifndef DEVICE_LEVEL_VULKAN_FUNCTION
#define DEVICE_LEVEL_VULKAN_FUNCTION(function)
#endif
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyDevice)
DEVICE_LEVEL_VULKAN_FUNCTION (vkGetDeviceQueue)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateCommandPool)
DEVICE_LEVEL_VULKAN_FUNCTION (vkResetCommandPool)
DEVICE_LEVEL_VULKAN_FUNCTION (vkAllocateCommandBuffers)
DEVICE_LEVEL_VULKAN_FUNCTION (vkBeginCommandBuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkEndCommandBuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkResetCommandBuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateSemaphore)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateFence)
DEVICE_LEVEL_VULKAN_FUNCTION (vkWaitForFences)
DEVICE_LEVEL_VULKAN_FUNCTION (vkResetFences)
DEVICE_LEVEL_VULKAN_FUNCTION (vkGetFenceStatus)
DEVICE_LEVEL_VULKAN_FUNCTION (vkQueueSubmit)
DEVICE_LEVEL_VULKAN_FUNCTION (vkQueueWaitIdle)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDeviceWaitIdle)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyFence)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroySemaphore)
DEVICE_LEVEL_VULKAN_FUNCTION (vkFreeCommandBuffers)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyCommandPool)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateBuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkGetBufferMemoryRequirements)
DEVICE_LEVEL_VULKAN_FUNCTION (vkBindBufferMemory)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateBufferView)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyBufferView)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyBuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateImage)
DEVICE_LEVEL_VULKAN_FUNCTION (vkGetImageMemoryRequirements)
DEVICE_LEVEL_VULKAN_FUNCTION (vkBindImageMemory)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateImageView)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyImageView)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyImage)
DEVICE_LEVEL_VULKAN_FUNCTION (vkAllocateMemory)
DEVICE_LEVEL_VULKAN_FUNCTION (vkFreeMemory)
DEVICE_LEVEL_VULKAN_FUNCTION (vkMapMemory)
DEVICE_LEVEL_VULKAN_FUNCTION (vkUnmapMemory)
DEVICE_LEVEL_VULKAN_FUNCTION (vkFlushMappedMemoryRanges)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateSampler)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateDescriptorSetLayout)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateDescriptorPool)
DEVICE_LEVEL_VULKAN_FUNCTION (vkAllocateDescriptorSets)
DEVICE_LEVEL_VULKAN_FUNCTION (vkUpdateDescriptorSets)
DEVICE_LEVEL_VULKAN_FUNCTION (vkFreeDescriptorSets)
DEVICE_LEVEL_VULKAN_FUNCTION (vkResetDescriptorPool)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyDescriptorPool)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyDescriptorSetLayout)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroySampler)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateRenderPass)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateFramebuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyRenderPass)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyFramebuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateShaderModule)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyShaderModule)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreatePipelineCache)
DEVICE_LEVEL_VULKAN_FUNCTION (vkGetPipelineCacheData)
DEVICE_LEVEL_VULKAN_FUNCTION (vkMergePipelineCaches)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyPipelineCache)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreatePipelineLayout)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyPipelineLayout)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateGraphicsPipelines)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCreateComputePipelines)
DEVICE_LEVEL_VULKAN_FUNCTION (vkDestroyPipeline)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdPipelineBarrier)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdCopyBuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdCopyBufferToImage)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdCopyImageToBuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdCopyImage)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdBlitImage)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdBeginRenderPass)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdNextSubpass)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdEndRenderPass)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdBindPipeline)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdClearColorImage)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdExecuteCommands)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdPushConstants)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdPushDescriptorSetKHR)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdSetViewport)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdSetScissor)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdBindVertexBuffers)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdBindIndexBuffer)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdBindDescriptorSets)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdDraw)
DEVICE_LEVEL_VULKAN_FUNCTION (vkCmdDrawIndexed)
#undef DEVICE_LEVEL_VULKAN_FUNCTION
#ifndef DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
#define DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION(function, extension)
#endif
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkCreateSwapchainKHR, VK_KHR_SWAPCHAIN_EXTENSION_NAME)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkDestroySwapchainKHR, VK_KHR_SWAPCHAIN_EXTENSION_NAME)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkGetSwapchainImagesKHR, VK_KHR_SWAPCHAIN_EXTENSION_NAME)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkAcquireNextImageKHR, VK_KHR_SWAPCHAIN_EXTENSION_NAME)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkQueuePresentKHR, VK_KHR_SWAPCHAIN_EXTENSION_NAME)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkCmdBeginDebugUtilsLabelEXT, 0)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkCmdEndDebugUtilsLabelEXT, 0)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkCmdInsertDebugUtilsLabelEXT, 0)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkQueueBeginDebugUtilsLabelEXT, 0)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkQueueEndDebugUtilsLabelEXT, 0)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkQueueInsertDebugUtilsLabelEXT, 0)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkSetDebugUtilsObjectNameEXT, 0)
DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION
(vkSetDebugUtilsObjectTagEXT, 0)
#undef DEVICE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION

98
include/QF/Vulkan/image.h Normal file
View file

@ -0,0 +1,98 @@
#ifndef __QF_Vulkan_image_h
#define __QF_Vulkan_image_h
#include "QF/darray.h"
typedef struct qfv_imageset_s
DARRAY_TYPE (VkImage) qfv_imageset_t;
#define QFV_AllocImages(num, allocator) \
DARRAY_ALLOCFIXED (qfv_imageset_t, num, allocator)
typedef struct qfv_imageviewset_s
DARRAY_TYPE (VkImageView) qfv_imageviewset_t;
#define QFV_AllocImageViews(num, allocator) \
DARRAY_ALLOCFIXED (qfv_imageviewset_t, num, allocator)
typedef struct qfv_imageresource_s {
struct qfv_device_s *device;
VkImage image;
VkDeviceMemory object;
VkImageView view;
} qfv_imageresource_t;
typedef struct qfv_imagetransition_s {
VkImage image;
VkAccessFlags srcAccess;
VkAccessFlags dstAccess;
VkImageLayout oldLayout;
VkImageLayout newLayout;
uint32_t srcQueueFamily;
uint32_t dstQueueFamily;
VkImageAspectFlags aspect;
} qfv_imagetransition_t;
typedef struct qfv_imagetransitionset_s
DARRAY_TYPE (qfv_imagetransition_t) qfv_imagetransitionset_t;
typedef struct qfv_imagebarrierset_s
DARRAY_TYPE (VkImageMemoryBarrier) qfv_imagebarrierset_t;
#define QFV_AllocImageBarrierSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_imagebarrierset_t, num, allocator)
struct qfv_device_s;
VkImage QFV_CreateImage (struct qfv_device_s *device, int cubemap,
VkImageType type,
VkFormat format,
VkExtent3D size,
uint32_t num_mipmaps,
uint32_t num_layers,
VkSampleCountFlags samples,
VkImageUsageFlags usage_scenarios);
VkDeviceMemory QFV_AllocImageMemory (struct qfv_device_s *device,
VkImage image,
VkMemoryPropertyFlags properties,
VkDeviceSize size, VkDeviceSize offset);
int QFV_BindImageMemory (struct qfv_device_s *device, VkImage image,
VkDeviceMemory object, VkDeviceSize offset);
qfv_imagebarrierset_t *
QFV_CreateImageTransitionSet (qfv_imagetransition_t *transitions,
int numTransitions);
VkImageView QFV_CreateImageView (struct qfv_device_s *device,
VkImage image, VkImageViewType type,
VkFormat format, VkImageAspectFlags aspect);
size_t QFV_GetImageSize (struct qfv_device_s *device, VkImage image);
/** Generate all mipmaps for a given texture down to a 1x1 pixel.
*
* Uses the GPU blit command from one mip level to the next, thus the base mip
* level data must have already been transfered to the image and the image is
* expected to be in VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL. This includes any
* array levels.
*
* \param device The device owning the command buffer.
* \param cmd The command buffer to which the barrier and blit commands
* will be written.
* \param image The image to be processed. All array layers of the base mip
* level must be initialized and in "transfer dst optimal"
* layout. All remaining mip levels must be in "undefined"
* oayout.
* \param mips The total number of mip levels of the processed image.
* \param width The pixel width of the base image.
* \param height The pixel height of the base image.
* \param layers The number of array layers in the mbase image.
*
* \note The processed image will be in "shader read only optimal" layout on
* completion.
*/
void QFV_GenerateMipMaps (struct qfv_device_s *device, VkCommandBuffer cmd,
VkImage image, unsigned mips,
unsigned width, unsigned height, unsigned layers);
int QFV_MipLevels (int width, int height) __attribute__((const));
#endif//__QF_Vulkan_image_h

View file

@ -0,0 +1,67 @@
/*
Copyright (C) 2019 Bill Currie <bill@taniwha.org>
Author: Bill Currie
Date: 2019/6/29
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
*/
#ifndef __QF_Vulkan_instance_h
#define __QF_Vulkan_instance_h
#include <vulkan/vulkan.h>
#include "QF/qtypes.h"
typedef struct qfv_instfuncs_s {
#define INSTANCE_LEVEL_VULKAN_FUNCTION(name) PFN_##name name;
#define INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION(name,ext) PFN_##name name;
#include "QF/Vulkan/funclist.h"
} qfv_instfuncs_t;
typedef struct qfv_physdev_s {
struct qfv_instance_s *instance;
VkPhysicalDevice dev;
VkPhysicalDeviceProperties properties;
VkPhysicalDeviceMemoryProperties memory_properties;
} qfv_physdev_t;
typedef struct qfv_instance_s {
VkInstance instance;
qfv_instfuncs_t *funcs;
struct strset_s *enabled_extensions;
int (*extension_enabled) (struct qfv_instance_s *inst,
const char *ext);
VkDebugUtilsMessengerEXT debug_handle;
uint32_t numDevices;
qfv_physdev_t *devices;
} qfv_instance_t;
struct vulkan_ctx_s;
qfv_instance_t *QFV_CreateInstance (struct vulkan_ctx_s *ctx,
const char *appName,
uint32_t appVersion,
const char **layers,
const char **extensions);
void QFV_DestroyInstance (qfv_instance_t *instance);
VkSampleCountFlagBits QFV_GetMaxSampleCount (qfv_physdev_t *physdev);
#endif // __QF_Vulkan_instance_h

View file

@ -0,0 +1,22 @@
#ifndef __QF_Vulkan_memory_h
#define __QF_Vulkan_memory_h
#include "QF/darray.h"
typedef struct qfv_mappedmemrange_s {
VkDeviceMemory object;
VkDeviceSize offset;
VkDeviceSize size;
} qfv_mappedmemrange_t;
typedef struct qfv_mappedmemrangeset_s
DARRAY_TYPE (qfv_mappedmemrange_t) qfv_mappedmemrangeset_t;
struct qfv_device_s;
void *QFV_MapMemory (struct qfv_device_s *device, VkDeviceMemory object,
VkDeviceSize offset, VkDeviceSize size);
void QFV_FlushMemory (struct qfv_device_s *device,
qfv_mappedmemrangeset_t *ranges);
#endif//__QF_Vulkan_memory_h

View file

@ -0,0 +1,156 @@
#ifndef __QF_Vulkan_pipeline_h
#define __QF_Vulkan_pipeline_h
#include "QF/darray.h"
typedef struct qfv_pipelineshaderstateset_s
DARRAY_TYPE (VkPipelineShaderStageCreateInfo) qfv_pipelineshaderstateset_s;
#define QFV_AllocPipelineShaderStageSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_pipelineshaderstateset_s, num, allocator)
typedef struct qfv_vertexinputbindingset_s
DARRAY_TYPE (VkVertexInputBindingDescription) qfv_vertexinputbindingset_t;
#define QFV_AllocVertexInputBindingSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_vertexinputbindingset_t, num, allocator)
typedef struct qfv_vertexinputattributeset_s
DARRAY_TYPE (VkVertexInputAttributeDescription)
qfv_vertexinputattributeset_t;
#define QFV_AllocVertexInputAttributeSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_vertexinputattributeset_t, num, allocator)
typedef struct qfv_vertexinputstate_s {
qfv_vertexinputbindingset_t *bindings;
qfv_vertexinputattributeset_t *attributes;
} qfv_vertexinputstate_t;
typedef struct qfv_pipelineinputassembly_s {
VkPrimitiveTopology topology;
VkBool32 primativeRestartEnable;
} qfv_pipelineinputassembly_t;
typedef struct qfv_pipelinetessellation_s {
uint32_t patchControlPoints;
} qfv_pipelinetessellation_t;
typedef struct qfv_viewportset_s DARRAY_TYPE (VkViewport) qfv_viewportset_t;
#define QFV_AllocViewportSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_viewportset_t, num, allocator)
typedef struct qfv_scissorsset_s DARRAY_TYPE (VkRect2D) qfv_scissorsset_t;
#define QFV_AllocScissorsSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_scissorsset_t, num, allocator)
typedef struct qfv_viewportinfo_s {
qfv_viewportset_t *viewportset;
qfv_scissorsset_t *scissorsset;
} qfv_viewportinfo_t;
typedef struct qfv_pipelinerasterization_s {
VkBool32 depthClampEnable;
VkBool32 rasterizerDiscardEnable;
VkPolygonMode polygonMode;
VkCullModeFlags cullMode;
VkFrontFace frontFace;
VkBool32 depthBiasEnable;
float depthBiasConstantFactor;
float depthBiasClamp;
float depthBiasSlopeFactor;
float lineWidth;
} qfv_pipelinerasterization_t;
typedef struct qfv_pipelinemultisample_s {
VkSampleCountFlagBits rasterizationSamples;
VkBool32 sampleShadingEnable;
float minSampleShading;
const VkSampleMask *sampleMask;
VkBool32 alphaToCoverageEnable;
VkBool32 alphaToOneEnable;
} qfv_pipelinemultisample_t;
typedef struct qfv_pipelinedepthandstencil_s {
VkBool32 depthTestEnable;
VkBool32 depthWriteEnable;
VkCompareOp depthCompareOp;
VkBool32 depthBoundsTestEnable;
VkBool32 stencilTestEnable;
VkStencilOpState front;
VkStencilOpState back;
float minDepthBounds;
float maxDepthBounds;
} qfv_pipelinedepthandstencil_t;
typedef struct qfv_blendattachmentset_s
DARRAY_TYPE (VkPipelineColorBlendAttachmentState) qfv_blendattachmentset_t;
#define QFV_AllocBlendAttachmentSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_blendattachmentset_t, num, allocator)
typedef struct qfv_dynamicstateset_s
DARRAY_TYPE (VkDynamicState) qfv_dynamicstateset_t;
#define QFV_AllocDynamicStateSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_dynamicstateset_t, num, allocator)
typedef struct qfv_pushconstantrangeset_s
DARRAY_TYPE (VkPushConstantRange) qfv_pushconstantrangeset_t;
#define QFV_AllocPushConstantRangeSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_pushconstantrangeset_t, num, allocator)
typedef struct qfv_pipelineset_s DARRAY_TYPE (VkPipeline) qfv_pipelineset_t;
#define QFV_AllocPipelineSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_pipelineset_t, num, allocator)
typedef struct qfv_graphicspipelinecreateinfoset_s
DARRAY_TYPE (VkGraphicsPipelineCreateInfo)
qfv_graphicspipelinecreateinfoset_t;
#define QFV_AllocGraphicsPipelineCreateInfoSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_graphicspipelinecreateinfoset_t, num, allocator)
typedef struct qfv_computepipelinecreateinfoset_s
DARRAY_TYPE (VkComputePipelineCreateInfo)
qfv_computepipelinecreateinfoset_t;
#define QFV_AllocComputePipelineCreateInfoSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_computepipelinecreateinfoset_t, num, allocator)
typedef struct qfv_pipelinecacheset_s
DARRAY_TYPE (VkPipelineCache) qfv_pipelinecacheset_t;
#define QFV_AllocPipelineCacheSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_pipelinecacheset_t, num, allocator)
struct dstring_s;
VkPipelineCache QFV_CreatePipelineCache (struct qfv_device_s *device,
struct dstring_s *cacheData);
struct dstring_s *QFV_GetPipelineCacheData (struct qfv_device_s *device,
VkPipelineCache cache);
void QFV_MergePipelineCaches (struct qfv_device_s *device,
VkPipelineCache targetCache,
qfv_pipelinecacheset_t *sourceCaches);
struct qfv_descriptorsetlayoutset_s;
VkPipelineLayout
QFV_CreatePipelineLayout (struct qfv_device_s *device,
struct qfv_descriptorsetlayoutset_s *layouts,
qfv_pushconstantrangeset_t *pushConstants);
qfv_pipelineset_t *
QFV_CreateGraphicsPipelines (struct qfv_device_s *device,
VkPipelineCache cache,
qfv_graphicspipelinecreateinfoset_t *gpciSet);
qfv_pipelineset_t *
QFV_CreateComputePipelines (struct qfv_device_s *device,
VkPipelineCache cache,
qfv_computepipelinecreateinfoset_t *cpciSet);
void
QFV_DestroyPipeline (struct qfv_device_s *device, VkPipeline pipeline);
#endif//__QF_Vulkan_pipeline_h

View file

@ -0,0 +1,116 @@
/*
qf_alias.h
Vulkan specific alias model stuff
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2012/1/7
Date: 2021/1/18
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
*/
#ifndef __QF_Vulkan_qf_alias_h
#define __QF_Vulkan_qf_alias_h
#include "QF/darray.h"
#include "QF/model.h"
#include "QF/modelgen.h"
#include "QF/Vulkan/qf_vid.h"
#include "QF/Vulkan/command.h"
typedef struct aliasvrt_s {
float vertex[4];
float normal[4];
} aliasvrt_t;
typedef struct aliasuv_s {
float u, v;
} aliasuv_t;
typedef struct qfv_alias_mesh_s {
VkBuffer vertex_buffer;
VkBuffer uv_buffer;
VkBuffer index_buffer;
VkDeviceMemory memory;
} qfv_alias_mesh_t;
typedef struct qfv_alias_skin_s {
VkDeviceMemory memory;
VkImage image;
VkImageView view;
byte colora[4];
byte colorb[4];
} qfv_alias_skin_t;
#define ALIAS_BUFFER_INFOS 1
#define ALIAS_IMAGE_INFOS 1
typedef enum {
QFV_aliasDepth,
QFV_aliasGBuffer,
QFV_aliasTranslucent,
QFV_aliasNumPasses
} QFV_AliasSubpass;
typedef struct aliasframe_s {
qfv_cmdbufferset_t cmdSet;
VkDescriptorBufferInfo bufferInfo[ALIAS_BUFFER_INFOS];
VkDescriptorImageInfo imageInfo[ALIAS_IMAGE_INFOS];
VkWriteDescriptorSet descriptors[ALIAS_BUFFER_INFOS + ALIAS_IMAGE_INFOS];
} aliasframe_t;
typedef struct aliasframeset_s
DARRAY_TYPE (aliasframe_t) aliasframeset_t;
typedef struct aliasctx_s {
aliasframeset_t frames;
VkPipeline depth;
VkPipeline gbuf;
VkPipelineLayout layout;
VkSampler sampler;
} aliasctx_t;
struct vulkan_ctx_s;
struct entity_s;
struct mod_alias_ctx_s;
void *Vulkan_Mod_LoadSkin (struct mod_alias_ctx_s *alias_ctx, byte *skin,
int skinsize, int snum, int gnum, qboolean group,
maliasskindesc_t *skindesc,
struct vulkan_ctx_s *ctx);
void Vulkan_Mod_FinalizeAliasModel (struct mod_alias_ctx_s *alias_ctx,
struct vulkan_ctx_s *ctx);
void Vulkan_Mod_LoadExternalSkins (struct mod_alias_ctx_s *alias_ctx,
struct vulkan_ctx_s *ctx);
void Vulkan_Mod_MakeAliasModelDisplayLists (struct mod_alias_ctx_s *alias_ctx,
void *_m, int _s, int extra,
struct vulkan_ctx_s *ctx);
void Vulkan_AliasBegin (struct vulkan_ctx_s *ctx);
void Vulkan_DrawAlias (struct entity_s *ent, struct vulkan_ctx_s *ctx);
void Vulkan_AliasEnd (struct vulkan_ctx_s *ctx);
void Vulkan_Alias_Init (struct vulkan_ctx_s *ctx);
void Vulkan_Alias_Shutdown (struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_alias_h

175
include/QF/Vulkan/qf_bsp.h Normal file
View file

@ -0,0 +1,175 @@
/*
qf_bsp.h
Vulkan specific brush model stuff
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2012/1/7
Date: 2021/1/18
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
*/
#ifndef __QF_Vulkan_qf_bsp_h
#define __QF_Vulkan_qf_bsp_h
#include "QF/darray.h"
#include "QF/model.h"
#include "QF/Vulkan/qf_vid.h"
#include "QF/Vulkan/command.h"
typedef struct bspvert_s {
quat_t vertex;
quat_t tlst;
} bspvert_t;
typedef struct elements_s {
struct elements_s *_next;
struct elements_s *next;
uint32_t first_index;
uint32_t index_count;
} elements_t;
typedef struct elechain_s {
struct elechain_s *_next;
struct elechain_s *next;
int index;
elements_t *elements;
vec_t *transform;
float *color;
} elechain_t;
typedef enum {
qfv_bsp_texture,
qfv_bsp_glowmap,
qfv_bsp_lightmap,
qfv_bsp_skysheet,
qfv_bsp_skycube,
} qfv_bsp_tex;
// view matrix
#define BSP_BUFFER_INFOS 1
// Texture, GlowMap, LightMap, SkySheet, SkyCube
#define BSP_IMAGE_INFOS 5
typedef enum {
QFV_bspDepth,
QFV_bspGBuffer,
QFV_bspSky,
QFV_bspTurb,
QFV_bspNumPasses
} QFV_BspSubpass;
typedef struct bspframe_s {
uint32_t *index_data; // pointer into mega-buffer for this frame (c)
uint32_t index_offset; // offset of index_data within mega-buffer (c)
uint32_t index_count; // number if indices queued (d)
qfv_cmdbufferset_t cmdSet;
VkDescriptorBufferInfo bufferInfo[BSP_BUFFER_INFOS];
VkDescriptorImageInfo imageInfo[BSP_IMAGE_INFOS];
VkWriteDescriptorSet descriptors[BSP_BUFFER_INFOS + BSP_IMAGE_INFOS];
} bspframe_t;
typedef struct fragconst_s {
quat_t fog;
float time;
} fragconst_t;
typedef struct bspframeset_s
DARRAY_TYPE (bspframe_t) bspframeset_t;
typedef struct texchainset_s
DARRAY_TYPE (struct vulktex_s *) texchainset_t;
typedef struct bspctx_s {
instsurf_t *waterchain;
instsurf_t **waterchain_tail;
instsurf_t *sky_chain;
instsurf_t **sky_chain_tail;
texchainset_t texture_chains;
// for world and non-instance models
instsurf_t *static_instsurfs;
instsurf_t **static_instsurfs_tail;
instsurf_t *free_static_instsurfs;
// for instance models
elechain_t *elechains;
elechain_t **elechains_tail;
elechain_t *free_elechains;
elements_t *elementss;
elements_t **elementss_tail;
elements_t *free_elementss;
instsurf_t *instsurfs;
instsurf_t **instsurfs_tail;
instsurf_t *free_instsurfs;
struct qfv_tex_s *default_skysheet;
struct qfv_tex_s *skysheet_tex;
struct qfv_tex_s *default_skybox;
struct qfv_tex_s *skybox_tex;
quat_t sky_rotation[2];
quat_t sky_velocity;
quat_t sky_fix;
double sky_time;
quat_t default_color;
quat_t last_color;
struct scrap_s *light_scrap;
struct qfv_stagebuf_s *light_stage;
struct bsppoly_s *polys;
VkSampler sampler;
VkDeviceMemory texture_memory;
VkPipeline depth;
VkPipeline gbuf;
VkPipeline skysheet;
VkPipeline skybox;
VkPipeline turb;
VkPipelineLayout layout;
size_t vertex_buffer_size;
size_t index_buffer_size;
VkBuffer vertex_buffer;
VkDeviceMemory vertex_memory;
VkBuffer index_buffer;
VkDeviceMemory index_memory;
bspframeset_t frames;
} bspctx_t;
struct vulkan_ctx_s;
void Vulkan_ClearElements (struct vulkan_ctx_s *ctx);
void Vulkan_DrawWorld (struct vulkan_ctx_s *ctx);
void Vulkan_DrawSky (struct vulkan_ctx_s *ctx);
void Vulkan_LoadSkys (const char *sky, struct vulkan_ctx_s *ctx);
void Vulkan_RegisterTextures (model_t **models, int num_models,
struct vulkan_ctx_s *ctx);
void Vulkan_BuildDisplayLists (model_t **models, int num_models,
struct vulkan_ctx_s *ctx);
void Vulkan_Bsp_Init (struct vulkan_ctx_s *ctx);
void Vulkan_Bsp_Shutdown (struct vulkan_ctx_s *ctx);
void Vulkan_DrawWaterSurfaces (struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_bsp_h

View file

@ -0,0 +1,62 @@
/*
qf_compose.h
Vulkan compose pass
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2021/2/24
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
*/
#ifndef __QF_Vulkan_qf_compose_h
#define __QF_Vulkan_qf_compose_h
#include "QF/darray.h"
#include "QF/model.h"
#include "QF/modelgen.h"
#include "QF/Vulkan/qf_vid.h"
#include "QF/Vulkan/command.h"
#define COMPOSE_IMAGE_INFOS 2
typedef struct composeframe_s {
VkCommandBuffer cmd;
VkDescriptorImageInfo imageInfo[COMPOSE_IMAGE_INFOS];
VkWriteDescriptorSet descriptors[COMPOSE_IMAGE_INFOS];
} composeframe_t;
typedef struct composeframeset_s
DARRAY_TYPE (composeframe_t) composeframeset_t;
typedef struct composectx_s {
composeframeset_t frames;
VkPipeline pipeline;
VkPipelineLayout layout;
} composectx_t;
struct vulkan_ctx_s;
void Vulkan_Compose_Init (struct vulkan_ctx_s *ctx);
void Vulkan_Compose_Shutdown (struct vulkan_ctx_s *ctx);
void Vulkan_Compose_Draw (struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_compose_h

View file

@ -0,0 +1,74 @@
/*
qf_draw.h
vulkan specific draw function
Copyright (C) 1996-1997 Id Software, Inc.
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
*/
#ifndef __QF_Vulkan_qf_draw_h
#define __QF_Vulkan_qf_draw_h
struct vulkan_ctx_s;
void Vulkan_Draw_Init (struct vulkan_ctx_s *ctx);
void Vulkan_Draw_Shutdown (struct vulkan_ctx_s *ctx);
void Vulkan_Draw_Character (int x, int y, unsigned ch,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_String (int x, int y, const char *str,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_nString (int x, int y, const char *str, int count,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_AltString (int x, int y, const char *str,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_ConsoleBackground (int lines, byte alpha,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_Crosshair (struct vulkan_ctx_s *ctx);
void Vulkan_Draw_CrosshairAt (int ch, int x, int y, struct vulkan_ctx_s *ctx);
void Vulkan_Draw_TileClear (int x, int y, int w, int h,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_Fill (int x, int y, int w, int h, int c,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_TextBox (int x, int y, int width, int lines, byte alpha,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_FadeScreen (struct vulkan_ctx_s *ctx);
void Vulkan_Draw_BlendScreen (quat_t color, struct vulkan_ctx_s *ctx);
qpic_t *Vulkan_Draw_CachePic (const char *path, qboolean alpha,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_UncachePic (const char *path, struct vulkan_ctx_s *ctx);
qpic_t *Vulkan_Draw_MakePic (int width, int height, const byte *data,
struct vulkan_ctx_s *ctx);
void Vulkan_Draw_DestroyPic (qpic_t *pic, struct vulkan_ctx_s *ctx);
qpic_t *Vulkan_Draw_PicFromWad (const char *name, struct vulkan_ctx_s *ctx);
void Vulkan_Draw_Pic (int x, int y, qpic_t *pic, struct vulkan_ctx_s *ctx);
void Vulkan_Draw_Picf (float x, float y, qpic_t *pic, struct vulkan_ctx_s *ctx);
void Vulkan_Draw_SubPic(int x, int y, qpic_t *pic,
int srcx, int srcy, int width, int height,
struct vulkan_ctx_s *ctx);
void Vulkan_Set2D (struct vulkan_ctx_s *ctx);
void Vulkan_Set2DScaled (struct vulkan_ctx_s *ctx);
void Vulkan_End2D (struct vulkan_ctx_s *ctx);
void Vulkan_DrawReset (struct vulkan_ctx_s *ctx);
void Vulkan_FlushText (struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_draw_h

View file

@ -0,0 +1,98 @@
/*
qf_lighting.h
Vulkan lighting pass
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2021/2/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
*/
#ifndef __QF_Vulkan_qf_lighting_h
#define __QF_Vulkan_qf_lighting_h
#include "QF/darray.h"
#include "QF/model.h"
#include "QF/modelgen.h"
#include "QF/Vulkan/qf_vid.h"
#include "QF/Vulkan/command.h"
typedef struct qfv_light_s {
vec3_t color;
int data;
vec3_t position;
float radius;
vec3_t direction;
float cone;
} qfv_light_t;
typedef struct qfv_lightset_s DARRAY_TYPE (qfv_light_t) qfv_lightset_t;
typedef struct qfv_lightleafset_s DARRAY_TYPE (int) qfv_lightleafset_t;
typedef struct qfv_lightvisset_s DARRAY_TYPE (byte) qfv_lightvisset_t;
#define NUM_LIGHTS 256
#define NUM_STYLES 64
typedef struct qfv_light_buffer_s {
float intensity[NUM_STYLES + 3];
int lightCount;
qfv_light_t lights[NUM_LIGHTS] __attribute__((aligned(16)));
} qfv_light_buffer_t;
#define LIGHTING_BUFFER_INFOS 1
#define LIGHTING_IMAGE_INFOS 5
typedef struct lightingframe_s {
VkCommandBuffer cmd;
VkBuffer light_buffer;
VkDescriptorBufferInfo bufferInfo[LIGHTING_BUFFER_INFOS];
VkDescriptorImageInfo imageInfo[LIGHTING_IMAGE_INFOS];
VkWriteDescriptorSet descriptors[LIGHTING_BUFFER_INFOS
+ LIGHTING_IMAGE_INFOS];
// A fat PVS of leafs visible from visible leafs so hidden lights can
// illuminate the leafs visible to the player
byte pvs[MAP_PVS_BYTES];
struct mleaf_s *leaf; // the last leaf used to generate the pvs
qfv_lightvisset_t lightvis;
} lightingframe_t;
typedef struct lightingframeset_s
DARRAY_TYPE (lightingframe_t) lightingframeset_t;
typedef struct lightingctx_s {
lightingframeset_t frames;
VkPipeline pipeline;
VkPipelineLayout layout;
VkDeviceMemory light_memory;
qfv_lightset_t lights;
qfv_lightleafset_t lightleafs;
} lightingctx_t;
struct vulkan_ctx_s;
void Vulkan_Lighting_Init (struct vulkan_ctx_s *ctx);
void Vulkan_Lighting_Shutdown (struct vulkan_ctx_s *ctx);
void Vulkan_Lighting_Draw (struct vulkan_ctx_s *ctx);
void Vulkan_LoadLights (model_t *model, const char *entity_data,
struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_lighting_h

View file

@ -0,0 +1,49 @@
/*
qf_lightmap.h
Vulkan lightmap stuff from the renderer.
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
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
*/
#ifndef __QF_Vulkan_qf_lightmap_h
#define __QF_Vulkan_qf_lightmap_h
#define MAX_LIGHTMAPS 1024
#define BLOCK_WIDTH 64
#define BLOCK_HEIGHT 64
#include "QF/Vulkan/qf_vid.h"
struct vulkan_ctx_s;
struct model_s;
struct mod_brush_s;
struct msurface_s;
void Vulkan_lightmap_init (struct vulkan_ctx_s *ctx);
void Vulkan_BuildLightmaps (struct model_s **models, int num_models, struct vulkan_ctx_s *ctx);
void Vulkan_CalcLightmaps (struct vulkan_ctx_s *ctx);
void Vulkan_BuildLightMap (struct mod_brush_s *brush, struct msurface_s *surf, struct vulkan_ctx_s *ctx);
VkImageView Vulkan_LightmapImageView (struct vulkan_ctx_s *ctx) __attribute__((pure));
void Vulkan_FlushLightmaps (struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_lightmap_h

View file

@ -1,9 +1,9 @@
/* /*
hl_bsp.h qf_main.h
Half Life file definitions Vulkan main stuff from the renderer.
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 2021 Bill Currie <bill@taniwha.org>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,16 +25,13 @@
*/ */
#ifndef __QF_Vulkan_qf_main_h
#define __QF_Vulkan_qf_main_h
#ifndef _HL_BSP_H struct vulkan_ctx_s;
#define _HL_BSP_H
#include "QF/qtypes.h" void Vulkan_NewMap (model_t *worldmodel, struct model_s **models,
int num_models, struct vulkan_ctx_s *ctx);
void Vulkan_RenderView (struct vulkan_ctx_s *ctx);
extern void CL_ParseEntityLump(const char *entdata); #endif//__QF_Vulkan_qf_main_h
extern void HL_Mod_LoadLighting (lump_t *l);
extern void HL_Mod_LoadTextures (lump_t *l);
extern byte *W_GetTexture(const char *name, int matchwidth, int matchheight);
extern void W_LoadTextureWadFile (const char *filename, int complain);
#endif // _HL_BSP_H

View file

@ -1,12 +1,14 @@
/* /*
uint32.h qf_model.h
Definitions for portable (?) unsigned int Vulkan specific model stuff
Copyright (C) 2000 Jeff Teunissen <d2deek@pmail.net> Copyright (C) 2012 Bill Currie <bill@taniwha.org>
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
Author: Jeff Teunissen <d2deek@pmail.net> Author: Bill Currie <bill@taniwha.org>
Date: 01 Jan 2000 Date: 2012/1/7
Date: 2021/1/19
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -27,26 +29,16 @@
Boston, MA 02111-1307, USA Boston, MA 02111-1307, USA
*/ */
#ifndef __QF_Vulkan_qf_model_h
#define __QF_Vulkan_qf_model_h
#ifndef __uint32_h #include "QF/darray.h"
#define __uint32_h #include "QF/model.h"
#include "QF/Vulkan/qf_vid.h"
#ifndef int32 typedef struct modelctx_s {
# if (SIZEOF_INT == 4) struct vulkan_ctx_s *ctx;
# define int32 int VkDeviceMemory texture_memory;
# elif (SIZEOF_LONG == 4) } modelctx_t;
# define int32 long
# elif (SIZEOF_SHORT == 4)
# define int32 short
# else
/* I hope this works */
# define int32 int
# define LARGE_INT32
# endif
#endif
#ifndef uint32 #endif//__QF_Vulkan_qf_model_h
# define uint32 unsigned int32
#endif
#endif // __uint32_h

View file

@ -0,0 +1,16 @@
#ifndef __QF_Vulkan_qf_particles_h
#define __QF_Vulkan_qf_particles_h
#include "QF/image.h"
struct cvar_s;
struct vulkan_ctx_s;;
void Vulkan_ClearParticles (struct vulkan_ctx_s *ctx);
void Vulkan_InitParticles (struct vulkan_ctx_s *ctx);
void Vulkan_r_easter_eggs_f (struct cvar_s *var, struct vulkan_ctx_s *ctx);
void Vulkan_r_particles_style_f (struct cvar_s *var, struct vulkan_ctx_s *ctx);
void Vulkan_Particles_Init (struct vulkan_ctx_s *ctx);
void Vulkan_DrawParticles (struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_particles_h

View file

@ -0,0 +1,27 @@
#ifndef __QF_Vulkan_qf_texture_h
#define __QF_Vulkan_qf_texture_h
#include "QF/image.h"
#include "QF/Vulkan/qf_vid.h"
typedef struct qfv_tex_s {
VkDeviceMemory memory;
size_t offset;
VkImage image;
VkImageView view;
} qfv_tex_t;
void Vulkan_ExpandPalette (byte *dst, const byte *src, const byte *palette,
int alpha, int count);
qfv_tex_t *Vulkan_LoadTex (struct vulkan_ctx_s *ctx, tex_t *tex, int mip,
const char *name);
qfv_tex_t *Vulkan_LoadEnvMap (struct vulkan_ctx_s *ctx, tex_t *tex,
const char *name);
qfv_tex_t *Vulkan_LoadEnvSides (struct vulkan_ctx_s *ctx, tex_t **tex,
const char *name);
VkImageView Vulkan_TexImageView (qfv_tex_t *tex) __attribute__((pure));
void Vulkan_UnloadTex (struct vulkan_ctx_s *ctx, qfv_tex_t *tex);
void Vulkan_Texture_Init (struct vulkan_ctx_s *ctx);
void Vulkan_Texture_Shutdown (struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_texture_h

View file

@ -0,0 +1,87 @@
/*
Vulkan/qf_vid.h
vulkan vid stuff from the renderer.
Copyright (C) 1996-1997 Id Software, Inc.
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
*/
#ifndef __QF_Vulkan_vid_h
#define __QF_Vulkan_vid_h
#include "QF/Vulkan/cvars.h"
#ifndef VK_NO_PROTOTYPES
#define VK_NO_PROTOTYPES
#endif
#include <vulkan/vulkan.h>
//FIXME location
typedef enum {
QFV_passDepth, // geometry
QFV_passTranslucent, // geometry
QFV_passGBuffer, // geometry
QFV_passLighting, // single quad
QFV_passCompose, // single quad
QFV_NumPasses
} QFV_Subpass;
enum {
QFV_attachDepth,
QFV_attachColor,
QFV_attachEmission,
QFV_attachNormal,
QFV_attachPosition,
QFV_attachOpaque,
QFV_attachTranslucent,
QFV_attachSwapchain,
};
struct vulkan_ctx_s;
void Vulkan_DestroyFrames (struct vulkan_ctx_s *ctx);
void Vulkan_CreateFrames (struct vulkan_ctx_s *ctx);
void Vulkan_CreateCapture (struct vulkan_ctx_s *ctx);
void Vulkan_CreateFramebuffers (struct vulkan_ctx_s *ctx);
void Vulkan_DestroyFramebuffers (struct vulkan_ctx_s *ctx);
void Vulkan_CreateRenderPass (struct vulkan_ctx_s *ctx);
void Vulkan_DestroyRenderPass (struct vulkan_ctx_s *ctx);
void Vulkan_CreateMatrices (struct vulkan_ctx_s *ctx);
void Vulkan_DestroyMatrices (struct vulkan_ctx_s *ctx);
void Vulkan_CalcProjectionMatrices (struct vulkan_ctx_s *ctx, float aspect);
void Vulkan_CalcViewMatrix (struct vulkan_ctx_s *ctx);
void Vulkan_CreateSwapchain (struct vulkan_ctx_s *ctx);
void Vulkan_CreateDevice (struct vulkan_ctx_s *ctx);
void Vulkan_Init_Common (struct vulkan_ctx_s *ctx);
void Vulkan_Shutdown_Common (struct vulkan_ctx_s *ctx);
void Vulkan_CreateStagingBuffers (struct vulkan_ctx_s *ctx);
VkPipeline Vulkan_CreatePipeline (struct vulkan_ctx_s *ctx, const char *name);
VkDescriptorPool Vulkan_CreateDescriptorPool (struct vulkan_ctx_s *ctx,
const char *name);
VkPipelineLayout Vulkan_CreatePipelineLayout (struct vulkan_ctx_s *ctx,
const char *name);
VkSampler Vulkan_CreateSampler (struct vulkan_ctx_s *ctx, const char *name);
VkDescriptorSetLayout Vulkan_CreateDescriptorSetLayout(struct vulkan_ctx_s*ctx,
const char *name);
#endif // __QF_Vulkan_vid_h

View file

@ -0,0 +1,50 @@
#ifndef __QF_Vulkan_renderpass_h
#define __QF_Vulkan_renderpass_h
#include "QF/darray.h"
typedef struct qfv_attachmentdescription_s
DARRAY_TYPE (VkAttachmentDescription) qfv_attachmentdescription_t;
#define QFV_AllocAttachmentDescription(num, allocator) \
DARRAY_ALLOCFIXED (qfv_attachmentdescription_t, num, allocator)
typedef struct qfv_attachmentreference_s
DARRAY_TYPE (VkAttachmentReference) qfv_attachmentreference_t;
#define QFV_AllocAttachmentReference(num, allocator) \
DARRAY_ALLOCFIXED (qfv_attachmentreference_t, num, allocator)
typedef struct qfv_subpassparametersset_s
DARRAY_TYPE (VkSubpassDescription) qfv_subpassparametersset_t;
#define QFV_AllocSubpassParametersSet(num, allocator) \
DARRAY_ALLOCFIXED (qfv_subpassparametersset_t, num, allocator)
typedef struct qfv_subpassdependency_s
DARRAY_TYPE (VkSubpassDependency) qfv_subpassdependency_t;
#define QFV_AllocSubpassDependencies(num, allocator) \
DARRAY_ALLOCFIXED (qfv_subpassdependency_t, num, allocator)
typedef struct qfv_framebufferset_s
DARRAY_TYPE (VkFramebuffer) qfv_framebufferset_t;
#define QFV_AllocFrameBuffers(num, allocator) \
DARRAY_ALLOCFIXED (qfv_framebufferset_t, num, allocator)
struct qfv_device_s;
struct qfv_imageviewset_s;
VkRenderPass
QFV_CreateRenderPass (struct qfv_device_s *device,
qfv_attachmentdescription_t *attachments,
qfv_subpassparametersset_t *subpasses,
qfv_subpassdependency_t *dependencies);
VkFramebuffer
QFV_CreateFramebuffer (struct qfv_device_s *device,
VkRenderPass renderPass,
struct qfv_imageviewset_s *attachments,
VkExtent2D, uint32_t layers);
#endif//__QF_Vulkan_renderpass_h

25
include/QF/Vulkan/scrap.h Normal file
View file

@ -0,0 +1,25 @@
#ifndef __QF_Vulkan_scrap_h
#define __QF_Vulkan_scrap_h
#include "QF/image.h"
typedef struct scrap_s scrap_t;
struct qfv_stagebuf_s;
struct qfv_device_s;
scrap_t *QFV_CreateScrap (struct qfv_device_s *device, const char *name,
int size, QFFormat format,
struct qfv_stagebuf_s *stage);
size_t QFV_ScrapSize (scrap_t *scrap) __attribute__((pure));
void QFV_ScrapClear (scrap_t *scrap);
void QFV_DestroyScrap (scrap_t *scrap);
VkImageView QFV_ScrapImageView (scrap_t *scrap) __attribute__((pure));
subpic_t *QFV_ScrapSubpic (scrap_t *scrap, int width, int height);
void QFV_SubpicDelete (subpic_t *subpic);
void *QFV_SubpicBatch (subpic_t *subpic, struct qfv_stagebuf_s *stage);
void QFV_ScrapFlush (scrap_t *scrap);
#endif//__QF_Vulkan_scrap_h

View file

@ -0,0 +1,14 @@
#ifndef __QF_Vulkan_shader_h
#define __QF_Vulkan_shader_h
struct qfv_device_s;
struct vulkan_ctx_s;
struct plitem_s;
struct parsectx_s;
VkShaderModule QFV_CreateShaderModule (struct qfv_device_s *device,
const char *path);
void QFV_DestroyShaderModule (struct qfv_device_s *device,
VkShaderModule module);
#endif//__QF_Vulkan_shader_h

View file

@ -0,0 +1,37 @@
#ifndef __QF_Vulkan_staging_h
#define __QF_Vulkan_staging_h
#include "QF/ringbuffer.h"
typedef struct qfv_packet_s {
struct qfv_stagebuf_s *stage; ///< staging buffer that owns this packet
VkCommandBuffer cmd;
VkFence fence;
size_t offset;
size_t length;
} qfv_packet_t;
typedef struct qfv_stagebuf_s {
struct qfv_device_s *device;
VkBuffer buffer;
VkDeviceMemory memory;
RING_BUFFER(qfv_packet_t, 4) packets; ///< packets for controlling access
size_t atom_mask; ///< for flush size rounding
size_t size; ///< actual size of the buffer
size_t end; ///< effective end of the buffer due to early wrap
size_t space_start;///< beginning of available space
size_t space_end; ///< end of available space
void *data;
} qfv_stagebuf_t;
qfv_stagebuf_t *QFV_CreateStagingBuffer (struct qfv_device_s *device,
const char *name, size_t size,
VkCommandPool cmdPool);
void QFV_DestroyStagingBuffer (qfv_stagebuf_t *stage);
void QFV_FlushStagingBuffer (qfv_stagebuf_t *stage, size_t offset, size_t size);
qfv_packet_t *QFV_PacketAcquire (qfv_stagebuf_t *stage);
void *QFV_PacketExtend (qfv_packet_t *packet, size_t size);
void QFV_PacketSubmit (qfv_packet_t *packet);
#endif//__QF_Vulkan_staging_h

View file

@ -0,0 +1,25 @@
#ifndef __QF_Vulkan_swapchain_h
#define __QF_Vulkan_swapchain_h
typedef struct qfv_swapchain_s {
struct qfv_device_s *device;
VkSurfaceKHR surface;
VkSwapchainKHR swapchain;
VkFormat format;
VkExtent2D extent;
int32_t numImages;
VkImageUsageFlags usage;
struct qfv_imageset_s *images;
struct qfv_imageviewset_s *imageViews;
} qfv_swapchain_t;
struct vulkan_ctx_s;
qfv_swapchain_t *QFV_CreateSwapchain (struct vulkan_ctx_s *ctx,
VkSwapchainKHR old_swapchain);
void QFV_DestroySwapchain (qfv_swapchain_t *swapchain);
struct qfv_semaphore_s;
struct qfv_fence_s;
int QFV_AcquireNextImage (qfv_swapchain_t *swapchain, VkSemaphore semaphore,
VkFence fence, uint32_t *imageIndex);
#endif//__QF_Vulkan_swapchain_h

View file

@ -37,7 +37,7 @@
/** \defgroup alloc High-tide allocator. /** \defgroup alloc High-tide allocator.
\ingroup utils \ingroup utils
*/ */
//@{ ///@{
#ifndef DEBUG_QF_MEMORY #ifndef DEBUG_QF_MEMORY
/** High-tide structure allocator for use in linked lists. /** High-tide structure allocator for use in linked lists.
@ -93,6 +93,6 @@
#define FREE(n, p) do { free (p); } while (0) #define FREE(n, p) do { free (p); } while (0)
#endif #endif
//@} ///@}
#endif//__QF_alloc_h #endif//__QF_alloc_h

View file

@ -24,8 +24,8 @@
Boston, MA 02111-1307, USA Boston, MA 02111-1307, USA
*/ */
#ifndef __bspfile_h_ #ifndef __QF_bspfile_h
#define __bspfile_h_ #define __QF_bspfile_h
#include "QF/qtypes.h" #include "QF/qtypes.h"
#include "QF/quakeio.h" #include "QF/quakeio.h"
@ -42,6 +42,8 @@
#define MAX_MAP_FACES 65535 // format limit (u16) #define MAX_MAP_FACES 65535 // format limit (u16)
#define MAX_MAP_MARKSURFACES 65535 // format limit (u16) #define MAX_MAP_MARKSURFACES 65535 // format limit (u16)
#define MAP_PVS_BYTES (MAX_MAP_LEAFS / 8)
//============================================================================= //=============================================================================
#define BSPVERSION 29 #define BSPVERSION 29
@ -310,4 +312,4 @@ void BSP_AddVisibility (bsp_t *bsp, const byte *visdata, size_t visdatasize);
void BSP_AddEntities (bsp_t *bsp, const char *entdata, size_t entdatasize); void BSP_AddEntities (bsp_t *bsp, const char *entdata, size_t entdatasize);
void BSP_AddTextures (bsp_t *bsp, const byte *texdata, size_t texdatasize); void BSP_AddTextures (bsp_t *bsp, const byte *texdata, size_t texdatasize);
#endif//__bspfile_h_ #endif//__QF_bspfile_h

View file

@ -34,7 +34,7 @@
/** \defgroup cbuf Command buffer management. /** \defgroup cbuf Command buffer management.
\ingroup utils \ingroup utils
*/ */
//@{ ///@{
#include <stdarg.h> #include <stdarg.h>
@ -100,6 +100,6 @@ void Cbuf_Execute (cbuf_t *cbuf);
void Cbuf_Execute_Stack (cbuf_t *cbuf); void Cbuf_Execute_Stack (cbuf_t *cbuf);
void Cbuf_Execute_Sets (cbuf_t *cbuf); void Cbuf_Execute_Sets (cbuf_t *cbuf);
//@} ///@}
#endif//__QF_cbuf_h #endif//__QF_cbuf_h

View file

@ -25,8 +25,8 @@
*/ */
#ifndef _CDAUDIO_H #ifndef __QF_cdaudio_h
#define _CDAUDIO_H #define __QF_cdaudio_h
#include "QF/qtypes.h" #include "QF/qtypes.h"
@ -35,7 +35,6 @@ void CDAudio_Play(int track, qboolean looping);
void CDAudio_Stop(void); void CDAudio_Stop(void);
void CDAudio_Pause(void); void CDAudio_Pause(void);
void CDAudio_Resume(void); void CDAudio_Resume(void);
void CDAudio_Shutdown(void);
void CDAudio_Update(void); void CDAudio_Update(void);
#endif // _CDAUDIO_H #endif//__QF_cdaudio_h

143
include/QF/cexpr.h Normal file
View file

@ -0,0 +1,143 @@
/*
cexpr.h
Config expression parser. Or concurrent.
Copyright (C) 2020 Bill Currie <bill@taniwha.org>
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
*/
#ifndef __QF_expr_h
#define __QF_expr_h
#include <stdlib.h>
struct exprval_s;
struct exprctx_s;
typedef struct binop_s {
int op;
struct exprtype_s *other;
struct exprtype_s *result;
void (*func) (const struct exprval_s *val1,
const struct exprval_s *val2,
struct exprval_s *result,
struct exprctx_s *context);
} binop_t;
typedef struct unop_s {
int op;
struct exprtype_s *result;
void (*func) (const struct exprval_s *val, struct exprval_s *result,
struct exprctx_s *context);
} unop_t;
typedef struct exprtype_s {
const char *name;
size_t size;
binop_t *binops;
unop_t *unops;
void *data;
} exprtype_t;
typedef struct exprval_s {
exprtype_t *type;
void *value;
} exprval_t;
typedef struct exprlist_s {
struct exprlist_s *next;
exprval_t *value;
} exprlist_t;
typedef struct exprsym_s {
const char *name;
exprtype_t *type;
void *value;
struct exprsym_s *next;
} exprsym_t;
typedef struct exprfunc_s {
exprtype_t *result;
int num_params;
exprtype_t **param_types;
void (*func) (const exprval_t **params, exprval_t *result,
struct exprctx_s *context);
} exprfunc_t;
typedef struct exprtab_s {
exprsym_t *symbols;
struct hashtab_s *tab;
} exprtab_t;
typedef struct exprctx_s {
exprval_t *result;
exprtab_t *symtab; // directly accessible symbols
exprtab_t *external_variables; // accessible via $id
struct memsuper_s *memsuper;
const struct plitem_s *item;
struct plitem_s *messages;
struct hashlink_s **hashlinks;
int errors;
} exprctx_t;
typedef struct exprenum_s {
exprtype_t *type;
exprtab_t *symtab;
} exprenum_t;
int cexpr_parse_enum (exprenum_t *enm, const char *str,
const exprctx_t *context, void *data);
binop_t *cexpr_find_cast (exprtype_t *dst_type, exprtype_t *src_type) __attribute__((pure));
exprval_t *cexpr_value (exprtype_t *type, exprctx_t *ctx);
exprval_t *cexpr_value_reference (exprtype_t *type, void *data, exprctx_t *ctx);
int cexpr_eval_string (const char *str, exprctx_t *context);
void cexpr_error(exprctx_t *ctx, const char *fmt, ...) __attribute__((format(printf,2,3)));
void cexpr_struct_getfield (const exprval_t *a, const exprval_t *b,
exprval_t *c, exprctx_t *ctx);
void cexpr_struct_pointer_getfield (const exprval_t *a, const exprval_t *b,
exprval_t *c, exprctx_t *ctx);
exprval_t *cexpr_cvar (const char *name, exprctx_t *ctx);
exprval_t *cexpr_cvar_struct (exprctx_t *ctx);
void cexpr_cast_plitem (const exprval_t *val1, const exprval_t *src,
exprval_t *result, exprctx_t *ctx);
void cexpr_init_symtab (exprtab_t *symtab, exprctx_t *ctx);
char *cexpr_yyget_text (void *scanner);
extern exprtype_t cexpr_int;
extern exprtype_t cexpr_uint;
extern exprtype_t cexpr_size_t;
extern exprtype_t cexpr_float;
extern exprtype_t cexpr_double;
extern exprtype_t cexpr_vector;
extern exprtype_t cexpr_quaternion;
extern exprtype_t cexpr_exprval;
extern exprtype_t cexpr_field;
extern exprtype_t cexpr_function;
extern exprtype_t cexpr_plitem;
extern binop_t cexpr_struct_binops[];
extern binop_t cexpr_struct_pointer_binops[];
#endif//__QF_expr_h

View file

@ -25,12 +25,12 @@
*/ */
#ifndef __checksum_h #ifndef __QF_checksum_h
#define __checksum_h #define __QF_checksum_h
/** \addtogroup crc /** \addtogroup crc
*/ */
//@{ ///@{
#include "QF/qtypes.h" #include "QF/qtypes.h"
@ -38,6 +38,6 @@ unsigned int Com_BlockChecksum (const void *buffer, int length);
void Com_BlockFullChecksum (const void *buffer, int len, unsigned char *outbuf); void Com_BlockFullChecksum (const void *buffer, int len, unsigned char *outbuf);
byte COM_BlockSequenceCRCByte (const byte *base, int length, int sequence); byte COM_BlockSequenceCRCByte (const byte *base, int length, int sequence);
//@} ///@}
#endif // __checksum_h #endif//__QF_checksum_h

View file

@ -31,12 +31,13 @@
/** \defgroup cmd Command management. /** \defgroup cmd Command management.
\ingroup utils \ingroup utils
*/ */
//@{ ///@{
#include "QF/qtypes.h" #include "QF/qtypes.h"
#include "QF/cbuf.h" #include "QF/cbuf.h"
typedef void (*xcommand_t) (void); typedef void (*xcommand_t) (void);
typedef void (*xdatacmd_t) (void *data);
typedef enum { typedef enum {
src_client, // came in over a net connection as a clc_stringcmd src_client, // came in over a net connection as a clc_stringcmd
@ -48,6 +49,8 @@ typedef struct cmd_function_s {
struct cmd_function_s *next; struct cmd_function_s *next;
const char *name; const char *name;
xcommand_t function; xcommand_t function;
xdatacmd_t datafunc;
void *data;
const char *description; const char *description;
} cmd_function_t; } cmd_function_t;
@ -56,18 +59,21 @@ extern cmd_source_t cmd_source;
void Cmd_Init_Hash (void); void Cmd_Init_Hash (void);
void Cmd_Init (void); void Cmd_Init (void);
int Cmd_AddCommand (const char *cmd_name, xcommand_t function, const char *description); int Cmd_AddCommand (const char *cmd_name, xcommand_t function,
const char *description);
int Cmd_AddDataCommand (const char *cmd_name, xdatacmd_t function,
void *data, const char *description);
int Cmd_RemoveCommand (const char *cmd_name); int Cmd_RemoveCommand (const char *cmd_name);
qboolean Cmd_Exists (const char *cmd_name); qboolean Cmd_Exists (const char *cmd_name);
const char *Cmd_CompleteCommand (const char *partial); const char *Cmd_CompleteCommand (const char *partial) __attribute__((pure));
int Cmd_CompleteCountPossible (const char *partial); int Cmd_CompleteCountPossible (const char *partial) __attribute__((pure));
const char **Cmd_CompleteBuildList (const char *partial); const char **Cmd_CompleteBuildList (const char *partial);
int Cmd_Argc (void); int Cmd_Argc (void) __attribute__((pure));
const char *Cmd_Argv (int arg); const char *Cmd_Argv (int arg) __attribute__((pure));
const char *Cmd_Args (int start); const char *Cmd_Args (int start) __attribute__((pure));
struct cbuf_args_s; struct cbuf_args_s;
int Cmd_Command (struct cbuf_args_s *args); int Cmd_Command (struct cbuf_args_s *args);
int Cmd_ExecuteString (const char *text, cmd_source_t src); int Cmd_ExecuteString (const char *text, cmd_source_t src);
@ -81,6 +87,6 @@ struct cbuf_interpreter_s *Cmd_GetProvider(const char *name);
extern struct cbuf_args_s *cmd_args; extern struct cbuf_args_s *cmd_args;
extern struct cvar_s *cmd_warncmd; extern struct cvar_s *cmd_warncmd;
//@} ///@}
#endif//__QF_cmd_h #endif//__QF_cmd_h

118
include/QF/cmem.h Normal file
View file

@ -0,0 +1,118 @@
/*
cmem.h
Cache-line aligned memory allocator
Copyright (C) 2020 Bill Currie <bill@taniwha.org>
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
*/
#ifndef __QF_cmem_h
#define __QF_cmem_h
#include "QF/qtypes.h"
#define MEM_LINE_SIZE 64
#define MAX_CACHE_LINES 9
typedef struct memline_s {
/* chain of free line blocks for fast allocation
* chain begins in memsuper_t
*/
struct memline_s *free_next;
struct memline_s **free_prev;
/* chain of free line blocks within a membock for merging
* chain begins in memblock_t
*/
struct memline_s *block_next;
struct memline_s **block_prev;
size_t size;
/* owning block
*/
struct memblock_s *block;
size_t pad[2];
} memline_t;
typedef struct memsline_s {
struct memsline_s *next;
size_t size:2;
size_t list:4;
size_t prev:58; // memsline_t **
} memsline_t;
typedef struct memblock_s {
struct memblock_s *next;
struct memblock_s **prev;
/* The pointer to pass to free()
*/
void *mem;
memline_t *free_lines;
/* Size of memory region before block "header".
*
* Since large blocks are allocated with page-size alignment, odds are
* high that the there will be many cache lines "wasted" in the space
* between the address returned from aligned_alloc (to cache-line
* alignment) and the block itself. Setting them up as a pool makes the
* lines available for smaller allocations, thus reducing waste.
*/
size_t pre_size;
/* Size of memory region after block "header".
*
* Will be 0 for blocks that were allocated exclusively for small
* allocations, otherwise indicates the size of the allocated block.
*/
size_t post_size;
/* True if the post-header block is free to be reused.
*/
int post_free;
int pad;
size_t pre_allocated;
} memblock_t;
typedef struct memsuper_s {
size_t page_size;
size_t page_mask;
memblock_t *memblocks;
/* Allocated cache lines from which smaller blocks can be allocated.
*
* The index is the base-2 log minus 2 of the size of the elements in the
* cache line from which an element was last freed. Only 4-32 bytes are of
* interest because nothing smaller than 4 bytes (int/float) will be
* allocated, and 64 bytes and up consume entire cache lines.
*/
memsline_t *last_freed[4];
/* Free chache lines grouped by size.
*
* The index is the base-2 log of the MINIMUM number of cache lines
* available in each block. ie, blocks with 4, 5, 6 and 7 lines will all
* be in the third list (index 2). For 4k page sizes, only 6 lists are
* needed (32-63 lines) because a page can hold only 62 lines (1 for the
* control block and one to avoid a cache-line being on a page boundary).
* Having 9 (MAX_CACHE_LINES) lists allows page sizes up to 16kB.
*/
memline_t *free_lines[MAX_CACHE_LINES];
} memsuper_t;
memsuper_t *new_memsuper (void);
void delete_memsuper (memsuper_t *super);
void *cmemalloc (memsuper_t *super, size_t size);
void cmemfree (memsuper_t *super, void *mem);
#endif//__QF_cmem_h

View file

@ -25,8 +25,8 @@
*/ */
#ifndef __console_h #ifndef __QF_console_h
#define __console_h #define __QF_console_h
#include <stdarg.h> #include <stdarg.h>
@ -92,8 +92,8 @@ extern struct console_data_s con_data;
void Con_CheckResize (void); void Con_CheckResize (void);
void Con_DrawConsole (void); void Con_DrawConsole (void);
void Con_Printf (const char *fmt, ...); void Con_Printf (const char *fmt, ...) __attribute__((format(printf, 1, 2)));
void Con_Print (const char *fmt, va_list args); void Con_Print (const char *fmt, va_list args) __attribute__((format(printf, 1, 0)));
void Con_ToggleConsole_f (void); void Con_ToggleConsole_f (void);
// wrapper function to attempt to either complete the command line // wrapper function to attempt to either complete the command line
@ -105,7 +105,7 @@ void Con_BasicCompleteCommandLine (inputline_t *il);
// Generic libs/util/console.c function to display a list // Generic libs/util/console.c function to display a list
// formatted in columns on the console // formatted in columns on the console
void Con_DisplayList(const char **list, int con_linewidth); void Con_DisplayList(const char **list, int con_linewidth);
extern void (*con_list_print)(const char *fmt, ...); extern void (*con_list_print)(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
inputline_t *Con_CreateInputLine (int lines, int lsize, char prompt); inputline_t *Con_CreateInputLine (int lines, int lsize, char prompt);
void Con_DestroyInputLine (inputline_t *inputline); void Con_DestroyInputLine (inputline_t *inputline);
@ -119,7 +119,6 @@ void Con_BufferAddText (con_buffer_t *buf, const char *text);
// init/shutdown functions // init/shutdown functions
void Con_Init (const char *plugin_name); void Con_Init (const char *plugin_name);
void Con_Shutdown (void);
void Con_ExecLine (const char *line); void Con_ExecLine (const char *line);
void Con_ProcessInput (void); void Con_ProcessInput (void);
@ -151,4 +150,4 @@ void Menu_Leave_f (void);
void Menu_Prev_f (void); void Menu_Prev_f (void);
void Menu_Next_f (void); void Menu_Next_f (void);
#endif // __console_h #endif//__QF_console_h

View file

@ -25,22 +25,22 @@
*/ */
#ifndef __crc_h #ifndef __QF_crc_h
#define __crc_h #define __QF_crc_h
/** \defgroup crc Checksum generation. /** \defgroup crc Checksum generation.
\ingroup utils \ingroup utils
*/ */
//@{ ///@{
#include "QF/qtypes.h" #include "QF/qtypes.h"
void CRC_Init(unsigned short *crcvalue); void CRC_Init(unsigned short *crcvalue);
void CRC_ProcessByte(unsigned short *crcvalue, byte data); void CRC_ProcessByte(unsigned short *crcvalue, byte data);
void CRC_ProcessBlock (const byte *start, unsigned short *crcvalue, int count); void CRC_ProcessBlock (const byte *start, unsigned short *crcvalue, int count);
unsigned short CRC_Value(unsigned short crcvalue); unsigned short CRC_Value(unsigned short crcvalue) __attribute__((const));
unsigned short CRC_Block (const byte *start, int count); unsigned short CRC_Block (const byte *start, int count) __attribute__((pure));
//@} ///@}
#endif // __crc_h #endif//__QF_crc_h

View file

@ -25,13 +25,13 @@
*/ */
#ifndef __cvar_h #ifndef __QF_cvar_h
#define __cvar_h #define __QF_cvar_h
/** \defgroup cvar Configuration variables /** \defgroup cvar Configuration variables
\ingroup utils \ingroup utils
*/ */
//@{ ///@{
#include "QF/qtypes.h" #include "QF/qtypes.h"
#include "QF/quakeio.h" #include "QF/quakeio.h"
@ -72,7 +72,7 @@ typedef struct cvar_alias_s {
code goes "look, the user made fs_basepath already", uses the users value, code goes "look, the user made fs_basepath already", uses the users value,
but sets CVAR_ROM as per the call. but sets CVAR_ROM as per the call.
*/ */
//@{ ///@{
#define CVAR_NONE 0 ///< normal cvar #define CVAR_NONE 0 ///< normal cvar
#define CVAR_ARCHIVE 1 ///< set to cause it to be saved to #define CVAR_ARCHIVE 1 ///< set to cause it to be saved to
///< config.cfg ///< config.cfg
@ -85,7 +85,7 @@ typedef struct cvar_alias_s {
#define CVAR_LATCH 2048 ///< will change only when C code next does #define CVAR_LATCH 2048 ///< will change only when C code next does
///< a Cvar_Get(), so it can't be changed ///< a Cvar_Get(), so it can't be changed
///< (not implemented) ///< (not implemented)
//@} ///@}
// Returns the Cvar if found, creates it with value if not. Description and // Returns the Cvar if found, creates it with value if not. Description and
@ -122,12 +122,12 @@ void Cvar_WriteVariables (QFile *f);
// attempts to match a partial variable name for command line completion // attempts to match a partial variable name for command line completion
// returns NULL if nothing fits // returns NULL if nothing fits
const char *Cvar_CompleteVariable (const char *partial); const char *Cvar_CompleteVariable (const char *partial) __attribute__((pure));
// Added by EvilTypeGuy - functions for tab completion system // Added by EvilTypeGuy - functions for tab completion system
// Thanks to Fett erich@heintz.com // Thanks to Fett erich@heintz.com
// Thanks to taniwha // Thanks to taniwha
int Cvar_CompleteCountPossible (const char *partial); int Cvar_CompleteCountPossible (const char *partial) __attribute__((pure));
const char **Cvar_CompleteBuildList (const char *partial); const char **Cvar_CompleteBuildList (const char *partial);
// Returns a pointer to the Cvar, NULL if not found // Returns a pointer to the Cvar, NULL if not found
@ -138,6 +138,6 @@ void Cvar_Init (void);
extern cvar_t *cvar_vars; extern cvar_t *cvar_vars;
//@} ///@}
#endif // __cvar_h #endif//__QF_cvar_h

370
include/QF/darray.h Normal file
View file

@ -0,0 +1,370 @@
/*
darray.h
Dynamic arrays
Copyright (C) 2020 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2020/02/17
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
*/
#ifndef __QF_darray_h
#define __QF_darray_h
#include "QF/sys.h"
/** \defgroup darray Dynamic Arrays
\ingroup utils
Dynamic array container object
*/
///@{
/** The structure defs for a dynamic array with elements of the given type.
This is just the defs of a struct delcaration: it is useless on its own.
The intended usage is something like:
typedef struct dynamic_array_s DARRAY_TYPE(int) dynamic_array_t;
This allows full flexibility in just how the actual type is used.
The \a size field is the number of elements currently in the array, and
the \a maxSize field is the number of elements the array can hold without
being resized.
The \a grow field specifies the number of elements by which \a maxSize is
to grow when the array needs to be resized. Setting this to 0 prevents
resizing and any attempt to do so is a fatal error.
\param ele_type The type to use for the element array, which is accessed
by the \a a field.
\hideinitializer
*/
#define DARRAY_TYPE(ele_type) \
{ \
size_t size; \
size_t maxSize; \
size_t grow; \
ele_type *a; \
}
#define DARRAY_STATIC_INIT(g) { .grow = g }
/** Allocate a fixed-size array using the given allocator
The allocated array is initilized to be ungrowable, and with both size
and maxSize set to the given size.
\param array_type Expression acceptable by typeof for determining the
type of the array.
\param array_size The size of the array.
\param alloc Allocator compatible with malloc (eg, alloca).
*/
#define DARRAY_ALLOCFIXED(array_type, array_size, alloc) \
({ \
__auto_type s = (array_size); \
typeof (array_type) *ar = alloc (sizeof(*ar) \
+ s * sizeof (*ar->a)); \
ar->size = ar->maxSize = s; \
ar->grow = 0; \
ar->a = (typeof (ar->a)) (ar + 1); \
ar; \
})
/** Allocate a fixed-size array using the given allocator
The allocated array is initilized to be ungrowable, and with both size
and maxSize set to the given size.
\param array_type Expression acceptable by typeof for determining the
type of the array.
\param array_size The size of the array.
\param alloc Allocator taking (obj, size) where obj is allocator
specific data (eg, a memory pool).
\param obj Additional data for the allocator.
*/
#define DARRAY_ALLOCFIXED_OBJ(array_type, array_size, alloc, obj) \
({ \
__auto_type s = (array_size); \
typeof (array_type) *ar = alloc ((obj), \
sizeof(*ar) \
+ s * sizeof (*ar->a)); \
ar->size = ar->maxSize = s; \
ar->grow = 0; \
ar->a = (typeof (ar->a)) (ar + 1); \
ar; \
})
/** Initialized the array.
The array will be initialized to be empty but with grow set to the
specifed value.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\param growSize Number of elements by which the array is to grow when
required.
\hideinitializer
*/
#define DARRAY_INIT(array, growSize) \
do { \
__auto_type ar = (array); \
ar->size = ar->maxSize = 0; \
ar->grow = (growSize); \
ar->a = 0; \
} while (0)
/** Clear the array.
If the array can grow, its backing will be freed and maxSize and a reset,
otherwise maxSize and a are left untouched.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\hideinitializer
*/
#define DARRAY_CLEAR(array) \
do { \
__auto_type ar = (array); \
ar->size = 0; \
if (ar->grow) { \
free (ar->a); \
ar->maxSize = 0; \
ar->a = 0; \
} \
} while (0)
/** Set the size of the array.
If the new size is greater than maxSize, and the array can grow (grow is
non-zero), then maxSize will be increased to the smallest multiple of grow
greater than or equal to size (ie, maxSize >= size, maxSize % grow == 0).
Attempting to increase maxSize on an array that cannot grow is an error:
it is assumed that the array struct does not own the backing memory.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\param newSize The new size of the array: newly opened slots are
uninitialized, but old slots retain their values.
\hideinitializer
*/
#define DARRAY_RESIZE(array, newSize) \
do { \
__auto_type ar = (array); \
size_t ns = (newSize); \
if (__builtin_expect (ns > ar->maxSize, 0)) { \
if (__builtin_expect (!ar->grow, 0)) { \
Sys_Error ("Attempt to grow fixed-size darray: %s:%d", \
__FILE__, __LINE__); \
} \
ar->maxSize = ar->grow * ((ns + ar->grow - 1) / ar->grow); \
ar->a = realloc (ar->a, ar->maxSize * sizeof (*ar->a)); \
if (__builtin_expect (!ar->a, 0)) { \
Sys_Error ("failed to realloc darray: %s:%d", \
__FILE__, __LINE__); \
} \
} \
ar->size = ns; \
} while (0)
/** Append a value to the end of the array.
The array is grown by one and the value written to the newly opened slot.
If the new array size is greater than maxSize and the array can be grown,
the array backing will be resized to the next multiple of grow.
Attempting to grow an array that cannot grow is an error: it is assumed
that the array struct does not own the backing memory.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\param value The value to be appended to the array. Must be of a type
compatible with that used for creating the array struct.
\return The appended value: can be assigned to another compatible
value.
\hideinitializer
*/
#define DARRAY_APPEND(array, value) \
({ \
__auto_type ar = (array); \
typeof(ar->a[0]) ob = (value); \
size_t sz = ar->size; \
DARRAY_RESIZE (ar, ar->size + 1); \
ar->a[sz] = ob; \
})
/** Open a hole in the array for bulk copying of data.
The array is grown by the requested size, opening a hole at the specified
index. Values beyond the index are copied to just after the newly opened
hole.
If the new array size is greater than maxSize and the array can be grown,
the array backing will be resized to the next multiple of grow.
Attempting to grow an array that cannot grow is an error: it is assumed
that the array struct does not own the backing memory.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\param index The index at which the hole will begin.
\param space The sized of the hole to be opened, in array elements.
\return The *address* of the newly opened hole: can be passed to
memcpy and friends.
memcpy (DARRAY_OPEN_AT(array, index, size), data,
size * sizeof (*data));
\hideinitializer
*/
#define DARRAY_OPEN_AT(array, index, space) \
({ \
__auto_type ar = (array); \
size_t po = (index); \
size_t sp = (space); \
if (__builtin_expect (po > ar->size, 0)) { \
Sys_Error ("Attempt to insert elements outside darray: " \
"%s:%d", __FILE__, __LINE__); \
} \
DARRAY_RESIZE (ar, ar->size + sp); \
memmove (&ar->a[po + sp], &ar->a[po], \
(ar->size - po - sp) * sizeof (*ar->a)); \
&ar->a[po]; \
})
/** Insert a value into the array at the specified index.
The array is grown by one at the specified index and the value written
to the newly opened slot. Values beyond the index are copied to just
after the newly opened slot.
If the new array size is greater than maxSize and the array can be grown,
the array backing will be resized to the next multiple of grow.
Attempting to grow an array that cannot grow is an error: it is assumed
that the array struct does not own the backing memory.
Attempting to insert a value beyond one past the end of the array is an
error (inserting at index = size is valid).
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\param value The value to be inserted into the array. Must be of a type
compatible with that used for creating the array struct.
\param index The index at which the value will be inserted
\return The inserted value: can be assigned to another compatible
value.
\hideinitializer
*/
#define DARRAY_INSERT_AT(array, value, index) \
({ \
__auto_type ar = (array); \
typeof(ar->a[0]) ob = (value); \
*DARRAY_OPEN_AT (ar, index, 1) = ob; \
})
/** Close a segment of an array.
The values beyond the segment are copied to the beginning of the segment
and the array size reduced by the size of the segment. All but the first
one of the values previously in the segment are lost and gone forever.
Attempting to close a segment that extends outside the array is an error.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\param index The index of the beginning of the segment.
\param count The number of values in the segment.
\return The single value at the beginning of the segment: can be
assigned to another compatible value.
\hideinitializer
*/
#define DARRAY_CLOSE_AT(array, index, count) \
({ \
__auto_type ar = (array); \
size_t po = (index); \
size_t co = (count); \
if (__builtin_expect (po + co > ar->size \
|| po >= ar->size, 0)) { \
Sys_Error ("Attempt to remove elements outside darray: " \
"%s:%d", __FILE__, __LINE__); \
} \
__auto_type ob = ar->a[po]; \
memmove (&ar->a[po], &ar->a[po + co], \
(ar->size - po - co) * sizeof (ob)); \
ar->size -= co; \
ob; \
})
/** Remove a value from an array at the specified index.
The values beyond the index are moved down to fill the hole left by the
single value and the array size reduced by one.
Attempting to remove a value from beyond the array is an error.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\param index The index of the value to be removed.
\return The removed value: can be assigned to another compatible
value.
\hideinitializer
*/
#define DARRAY_REMOVE_AT(array, index) \
({ \
__auto_type ar = (array); \
DARRAY_CLOSE_AT (ar, index, 1); \
})
/** Remove (pop) a value from the end of an array.
The size of the array size reduced by one.
Attempting to remove a value from an empty array is an error.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\return The removed value: can be assigned to another compatible
value.
\hideinitializer
*/
#define DARRAY_REMOVE(array) \
({ \
__auto_type ar = (array); \
DARRAY_CLOSE_AT (ar, ar->size - 1, 1); \
})
///@}
#endif//__QF_darray_h

View file

@ -25,8 +25,8 @@
*/ */
#ifndef _DRAW_H #ifndef __QF_draw_h
#define _DRAW_H #define __QF_draw_h
/** \defgroup video Video Sub-sytem */ /** \defgroup video Video Sub-sytem */
@ -37,7 +37,7 @@
/** \defgroup video_renderer_draw Generic draw functions /** \defgroup video_renderer_draw Generic draw functions
\ingroup video_renderer \ingroup video_renderer
*/ */
//@{ ///@{
#include "QF/wad.h" #include "QF/wad.h"
@ -160,12 +160,12 @@ void Draw_FadeScreen (void);
/** Shift the screen colors. /** Shift the screen colors.
*/ */
void Draw_BlendScreen (quat_t color); void Draw_BlendScreen (quat_t color);
//@} ///@}
/** \defgroup video_renderer_draw_qpic QPic functions /** \defgroup video_renderer_draw_qpic QPic functions
\ingroup video_renderer_draw \ingroup video_renderer_draw
*/ */
//@{ ///@{
/** Load a qpic from the filesystem. /** Load a qpic from the filesystem.
\param path path of the file within the quake filesystem \param path path of the file within the quake filesystem
\param alpha transparency level of the pic. \param alpha transparency level of the pic.
@ -232,6 +232,6 @@ void Draw_Picf (float x, float y, qpic_t *pic);
\param height vertical size of the sub-region to be drawn \param height vertical size of the sub-region to be drawn
*/ */
void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height);
//@} ///@}
#endif // _DRAW_H #endif//__QF_draw_h

View file

@ -25,13 +25,13 @@
*/ */
#ifndef __dstring_h #ifndef __QF_dstring_h
#define __dstring_h #define __QF_dstring_h
/** \defgroup dstring Dynamic Strings /** \defgroup dstring Dynamic Strings
\ingroup utils \ingroup utils
*/ */
//@{ ///@{
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
@ -52,13 +52,13 @@ typedef struct dstring_s {
extern dstring_mem_t dstring_default_mem; extern dstring_mem_t dstring_default_mem;
// General buffer functions // General buffer functions
//@{ ///@{
/** Create a new dstring. size and truesize start at 0 and no string buffer /** Create a new dstring. size and truesize start at 0 and no string buffer
is allocated. is allocated.
*/ */
dstring_t *_dstring_new (dstring_mem_t *mem); dstring_t *_dstring_new (dstring_mem_t *mem);
dstring_t *dstring_new (void); dstring_t *dstring_new (void);
//@} ///@}
/** Delete a dstring. Both the string buffer and dstring object are freed. /** Delete a dstring. Both the string buffer and dstring object are freed.
*/ */
void dstring_delete (dstring_t *dstr); void dstring_delete (dstring_t *dstr);
@ -103,13 +103,13 @@ void dstring_replace (dstring_t *dstr, unsigned int pos, unsigned int rlen,
char *dstring_freeze (dstring_t *dstr); char *dstring_freeze (dstring_t *dstr);
// String-specific functions // String-specific functions
//@{ ///@{
/** Allocate a new dstring pre-initialized as a null terminated string. size /** Allocate a new dstring pre-initialized as a null terminated string. size
will be 1 and the first byte 0. will be 1 and the first byte 0.
*/ */
dstring_t *_dstring_newstr (dstring_mem_t *mem); dstring_t *_dstring_newstr (dstring_mem_t *mem);
dstring_t *dstring_newstr (void); dstring_t *dstring_newstr (void);
//@} ///@}
/** Create a new dstring from a string. Similar to strdup(). /** Create a new dstring from a string. Similar to strdup().
\param str the string to copy \param str the string to copy
\return inititialized dstring \return inititialized dstring
@ -160,21 +160,21 @@ void dstring_insertsubstr (dstring_t *dstr, unsigned int pos, const char *str,
*/ */
void dstring_clearstr (dstring_t *dstr); void dstring_clearstr (dstring_t *dstr);
//@{ ///@{
/** Formatted printing to dstrings. Existing data is replaced by the formatted /** Formatted printing to dstrings. Existing data is replaced by the formatted
string. string.
*/ */
int dvsprintf (dstring_t *dstr, const char *fmt, va_list args); char *dvsprintf (dstring_t *dstr, const char *fmt, va_list args) __attribute__((format(printf,2,0)));
int dsprintf (dstring_t *dstr, const char *fmt, ...) __attribute__((format(printf,2,3))); char *dsprintf (dstring_t *dstr, const char *fmt, ...) __attribute__((format(printf,2,3)));
//@} ///@}
//@{ ///@{
/** Formatted printing to dstrings. Formatted string is appened to the dstring. /** Formatted printing to dstrings. Formatted string is appened to the dstring.
Embedded nulls in the dstring are ignored. Embedded nulls in the dstring are ignored.
*/ */
int davsprintf (dstring_t *dstr, const char *fmt, va_list args); char *davsprintf (dstring_t *dstr, const char *fmt, va_list args) __attribute__((format(printf,2,0)));
int dasprintf (dstring_t *dstr, const char *fmt, ...) __attribute__((format(printf,2,3))); char *dasprintf (dstring_t *dstr, const char *fmt, ...) __attribute__((format(printf,2,3)));
//@} ///@}
//@} ///@}
#endif // __dstring_h #endif//__QF_dstring_h

124
include/QF/entity.h Normal file
View file

@ -0,0 +1,124 @@
/*
entity.h
Entity management
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2021/02/26
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
*/
#ifndef __QF_entity_h
#define __QF_entity_h
#include "QF/darray.h"
#include "QF/mathlib.h"
#include "QF/simd/vec4f.h"
#include "QF/simd/mat4f.h"
/** \defgroup entity Entity management
\ingroup utils
*/
///@{
typedef struct mat4fset_s DARRAY_TYPE (mat4f_t) mat4fset_t;
typedef struct vec4fset_s DARRAY_TYPE (vec4f_t) vec4fset_t;
typedef struct uint32set_s DARRAY_TYPE (uint32_t) uint32set_t;
typedef struct byteset_s DARRAY_TYPE (byte) byteset_t;
typedef struct stringset_s DARRAY_TYPE (char *) stringset_t;
typedef struct xformset_s DARRAY_TYPE (struct transform_s *) xformset_t;
typedef struct entityset_s DARRAY_TYPE (struct entity_s *) entityset_t;
#define null_transform (~0u)
typedef struct hierarchy_s {
xformset_t transform;
entityset_t entity;
uint32set_t childCount;
uint32set_t childIndex;
uint32set_t parentIndex;
stringset_t name;
uint32set_t tag;
byteset_t modified;
mat4fset_t localMatrix;
mat4fset_t localInverse;
mat4fset_t worldMatrix;
mat4fset_t worldInverse;
vec4fset_t localRotation;
vec4fset_t localScale;
vec4fset_t worldRotation;
vec4fset_t worldScale;
} hierarchy_t;
typedef struct transform_s {
hierarchy_t *hierarchy;
uint32_t index;
} transform_t;
transform_t *Transform_New (transform_t *parent);
void Transform_Delete (transform_t *transform);
transform_t *Transform_NewNamed (transform_t *parent, const char *name);
uint32_t Transform_ChildCount (const transform_t *transform) __attribute__((pure));
transform_t *Transform_GetChild (const transform_t *transform,
uint32_t childIndex) __attribute__((pure));
void Transform_SetParent (transform_t *transform, transform_t *parent);
transform_t *Transform_GetParent (const transform_t *transform) __attribute__((pure));
void Transform_SetName (transform_t *transform, const char *name);
const char *Transform_GetName (const transform_t *transform) __attribute__((pure));
void Transform_SetTag (transform_t *transform, uint32_t tag);
uint32_t Transform_GetTag (const transform_t *transform) __attribute__((pure));
void Transform_GetLocalMatrix (const transform_t *transform, mat4f_t mat);
void Transform_GetLocalInverse (const transform_t *transform, mat4f_t mat);
void Transform_GetWorldMatrix (const transform_t *transform, mat4f_t mat);
void Transform_GetWorldInverse (const transform_t *transform, mat4f_t mat);
vec4f_t Transform_GetLocalPosition (const transform_t *transform) __attribute__((pure));
void Transform_SetLocalPosition (transform_t *transform, vec4f_t position);
vec4f_t Transform_GetLocalRotation (const transform_t *transform) __attribute__((pure));
void Transform_SetLocalRotation (transform_t *transform, vec4f_t rotation);
vec4f_t Transform_GetLocalScale (const transform_t *transform) __attribute__((pure));
void Transform_SetLocalScale (transform_t *transform, vec4f_t scale);
vec4f_t Transform_GetWorldPosition (const transform_t *transform) __attribute__((pure));
void Transform_SetWorldPosition (transform_t *transform, vec4f_t position);
vec4f_t Transform_GetWorldRotation (const transform_t *transform) __attribute__((pure));
void Transform_SetWorldRotation (transform_t *transform, vec4f_t rotation);
vec4f_t Transform_GetWorldScale (const transform_t *transform) __attribute__((pure));
void Transform_SetLocalTransform (transform_t *transform, vec4f_t scale,
vec4f_t rotation, vec4f_t position);
// NOTE: these use X: right, Y: forward, Z:up
// aslo, not guaranteed to be normalized or even orthogonal
vec4f_t Transform_Forward (const transform_t *transform) __attribute__((pure));
vec4f_t Transform_Right (const transform_t *transform) __attribute__((pure));
vec4f_t Transform_Up (const transform_t *transform) __attribute__((pure));
// no SetWorldScale because after rotations, non uniform scale becomes shear
hierarchy_t *Hierarchy_New (size_t grow, int createRoot);
hierarchy_t *Hierarchy_Copy (hierarchy_t *src);
void Hierarchy_Delete (hierarchy_t *hierarchy);
void Hierarchy_UpdateMatrices (hierarchy_t *hierarchy);
uint32_t Hierarchy_InsertHierarchy (hierarchy_t *dst, const hierarchy_t *src,
uint32_t dstParent, uint32_t srcRoot);
void Hierarchy_RemoveHierarchy (hierarchy_t *hierarchy, uint32_t index);
///@}
#endif//__QF_entity_h

View file

@ -28,8 +28,8 @@
*/ */
#ifndef __gib_h #ifndef __QF_gib_h
#define __gib_h #define __QF_gib_h
// Dependencies // Dependencies
@ -182,7 +182,7 @@ extern char * const gib_null_string;
#define GIB_CanReturn() (GIB_DATA(cbuf_active)->waitret) #define GIB_CanReturn() (GIB_DATA(cbuf_active)->waitret)
dstring_t *GIB_Return (const char *str); dstring_t *GIB_Return (const char *str);
void GIB_Error (const char *type, const char *fmt, ...); void GIB_Error (const char *type, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void GIB_Builtin_Add (const char *name, void (*func) (void)); void GIB_Builtin_Add (const char *name, void (*func) (void));
void GIB_Builtin_Remove (const char *name); void GIB_Builtin_Remove (const char *name);
qboolean GIB_Builtin_Exists (const char *name); qboolean GIB_Builtin_Exists (const char *name);
@ -199,12 +199,12 @@ void GIB_Event_Callback (gib_event_t *event, unsigned int argc, ...);
// Interpreter interface (for creating GIB cbufs) // Interpreter interface (for creating GIB cbufs)
cbuf_interpreter_t *GIB_Interpreter (void); cbuf_interpreter_t *GIB_Interpreter (void) __attribute__((const));
// Thread interface // Thread interface
void GIB_Thread_Execute (void); void GIB_Thread_Execute (void);
unsigned int GIB_Thread_Count (void); unsigned int GIB_Thread_Count (void) __attribute__((pure));
// Init interface // Init interface
@ -214,6 +214,6 @@ void GIB_Init (qboolean sandbox);
unsigned long int GIB_Handle_New (gib_object_t *data); unsigned long int GIB_Handle_New (gib_object_t *data);
void GIB_Handle_Free (unsigned long int num); void GIB_Handle_Free (unsigned long int num);
gib_object_t *GIB_Handle_Get (unsigned long int num); gib_object_t *GIB_Handle_Get (unsigned long int num) __attribute__((pure));
#endif #endif//__QF_gib_h

View file

@ -25,8 +25,8 @@
*/ */
#ifndef __hash_h #ifndef __QF_hash_h
#define __hash_h #define __QF_hash_h
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
@ -34,9 +34,10 @@
/** \defgroup hash Hash tables /** \defgroup hash Hash tables
\ingroup utils \ingroup utils
*/ */
//@{ ///@{
typedef struct hashtab_s hashtab_t; typedef struct hashtab_s hashtab_t;
typedef struct hashlink_s hashlink_t;
/** create a new hash table. /** create a new hash table.
\param tsize table size. larger values will give better distribution, but \param tsize table size. larger values will give better distribution, but
@ -45,11 +46,18 @@ typedef struct hashtab_s hashtab_t;
inserting or finding the element. First parameter is a pointer inserting or finding the element. First parameter is a pointer
to the element from which to extract the key, the second is to the element from which to extract the key, the second is
the user data pointer. the user data pointer.
\param f a function to free the element. Only ever called from \param f a function to free the element. Called from only
Hash_FlushTable and Hash_DelTable. The first parameter is the Hash_FlushTable and Hash_DelTable. The first parameter is the
element to be freed and the second is the user data pointer. element to be freed and the second is the user data pointer.
\param ud user data pointer. set to whatever you want, it will be passed \param ud user data pointer. set to whatever you want, it will be passed
to the get key and free functions as the second parameter. to the get key and free functions as the second parameter.
\param hlfl Address of opaque pointer used for per-thread allocation of
internal memory. If null, a local static pointer will be used,
but the hash table will not be thread-safe unless all tables
created with a null \a hlfl (hashlink freelist) are used in
only the one thread. However, this applys only to updating a
hash table; hash tables that are not updated can be safely
shared between threads.
\return pointer to the hash table (to be passed to the other functions) \return pointer to the hash table (to be passed to the other functions)
or 0 on error. or 0 on error.
@ -59,7 +67,8 @@ typedef struct hashtab_s hashtab_t;
previous ones until the later one is removed (Hash_Del). previous ones until the later one is removed (Hash_Del).
*/ */
hashtab_t *Hash_NewTable (int tsize, const char *(*gk)(const void*,void*), hashtab_t *Hash_NewTable (int tsize, const char *(*gk)(const void*,void*),
void (*f)(void*,void*), void *ud); void (*f)(void*,void*), void *ud,
hashlink_t **hlfl);
/** change the hash and compare functions used by the Hash_*Element functions. /** change the hash and compare functions used by the Hash_*Element functions.
the default hash function just returns the address of the element, and the the default hash function just returns the address of the element, and the
@ -177,20 +186,20 @@ void Hash_Free (hashtab_t *tab, void *ele);
this is the same function as used internally. this is the same function as used internally.
*/ */
unsigned long Hash_String (const char *str); unsigned long Hash_String (const char *str) __attribute__((pure));
/** hash a buffer. /** hash a buffer.
\param buf the buffer to hash \param buf the buffer to hash
\param len the size of the buffer \param len the size of the buffer
\return the hash value of the string. \return the hash value of the string.
*/ */
unsigned long Hash_Buffer (const void *buf, int len); unsigned long Hash_Buffer (const void *buf, int len) __attribute__((pure));
/** get the size of the table /** get the size of the table
\param tab the table in question \param tab the table in question
\return the number of elements in the table. \return the number of elements in the table.
*/ */
size_t Hash_NumElements (hashtab_t *tab); size_t Hash_NumElements (hashtab_t *tab) __attribute__((pure));
/** list of all elements in the table. /** list of all elements in the table.
\param tab the table to list \param tab the table to list
@ -209,6 +218,6 @@ void **Hash_GetList (hashtab_t *tab);
*/ */
void Hash_Stats (hashtab_t *tab); void Hash_Stats (hashtab_t *tab);
//@} ///@}
#endif // __hash_h #endif//__QF_hash_h

View file

@ -33,7 +33,7 @@
/** \addtogroup cbuf /** \addtogroup cbuf
*/ */
//@{ ///@{
extern const char *com_token; extern const char *com_token;
@ -44,6 +44,6 @@ void COM_TokenizeString (const char *str, struct cbuf_args_s *args);
extern struct cbuf_interpreter_s id_interp; extern struct cbuf_interpreter_s id_interp;
//@} ///@}
#endif//__QF_idparse_h #endif//__QF_idparse_h

View file

@ -30,27 +30,31 @@
#define __QF_image_h #define __QF_image_h
#include "QF/qtypes.h" #include "QF/qtypes.h"
#include "QF/quakeio.h"
typedef enum QFFormat {
tex_palette = 0,
tex_l = 0x1909, //GL_LUMINANCE
tex_a = 0x1906, //GL_ALPHA
tex_la = 2,
tex_rgb = 3,
tex_rgba = 4,
tex_frgba = 5,
} QFFormat;
// could not use texture_t as that is used for models. // could not use texture_t as that is used for models.
typedef struct tex_s { typedef struct tex_s {
int width; int width;
int height; int height;
int format; QFFormat format;
int loaded; // 0 if size info only, otherwise data loaded
const byte *palette; // 0 = 32 bit, otherwise 8 const byte *palette; // 0 = 32 bit, otherwise 8
byte data[4]; // variable length byte *data;
} tex_t; } tex_t;
#define tex_palette 0 tex_t *LoadImage (const char *imageFile, int load);
#define tex_l 0x1909 //GL_LUMINANCE
#define tex_a 0x1906 //GL_ALPHA
#define tex_la 2
#define tex_rgb 3
#define tex_rgba 4
typedef struct colcache_s colcache_t; typedef struct colcache_s colcache_t;
tex_t *LoadImage (const char *imageFile);
colcache_t *ColorCache_New (void); colcache_t *ColorCache_New (void);
void ColorCache_Delete (colcache_t *cache); void ColorCache_Delete (colcache_t *cache);
byte ConvertColor (const byte *rgb, const byte *pal, colcache_t *cache); byte ConvertColor (const byte *rgb, const byte *pal, colcache_t *cache);

View file

@ -25,13 +25,13 @@
*/ */
#ifndef _INFO_H #ifndef __QF_info_h
#define _INFO_H #define __QF_info_h
/** \defgroup info Info Keys /** \defgroup info Info Keys
\ingroup utils \ingroup utils
*/ */
//@{ ///@{
#include <stdlib.h> // for size_t. sys/types.h SHOULD be used, but can't :(bc) #include <stdlib.h> // for size_t. sys/types.h SHOULD be used, but can't :(bc)
#include <QF/qtypes.h> #include <QF/qtypes.h>
@ -47,10 +47,10 @@ typedef struct info_key_s {
const char *value; const char *value;
} info_key_t; } info_key_t;
qboolean Info_FilterForKey (const char *key, const char **filter_list); qboolean Info_FilterForKey (const char *key, const char **filter_list) __attribute__((pure));
void Info_Print (info_t *info); void Info_Print (info_t *info);
int Info_CurrentSize (info_t *info); int Info_CurrentSize (info_t *info) __attribute__((pure));
info_key_t *Info_Key (info_t *info, const char *key); info_key_t *Info_Key (info_t *info, const char *key);
info_key_t **Info_KeyList (info_t *info); info_key_t **Info_KeyList (info_t *info);
void Info_RemoveKey (info_t *info, const char *key); void Info_RemoveKey (info_t *info, const char *key);
@ -63,6 +63,6 @@ void Info_Destroy (info_t *info);
char *Info_MakeString (info_t *info, int (*filter)(const char *)); char *Info_MakeString (info_t *info, int (*filter)(const char *));
void Info_AddKeys (info_t *info, info_t *keys); void Info_AddKeys (info_t *info, info_t *keys);
//@} ///@}
#endif // _INFO_H #endif//__QF_info_h

View file

@ -25,8 +25,8 @@
*/ */
#ifndef __QF_input_h_ #ifndef __QF_input_h
#define __QF_input_h_ #define __QF_input_h
#include "QF/keys.h" #include "QF/keys.h"
@ -44,8 +44,6 @@ struct cvar_s;
void IN_Init (struct cbuf_s *cbuf); void IN_Init (struct cbuf_s *cbuf);
void IN_Init_Cvars (void); void IN_Init_Cvars (void);
void IN_Shutdown (void);
void IN_ProcessEvents (void); void IN_ProcessEvents (void);
void IN_UpdateGrab (struct cvar_s *); void IN_UpdateGrab (struct cvar_s *);
@ -75,4 +73,4 @@ void IN_LL_Grab_Input (int grab);
extern kbutton_t in_strafe, in_klook, in_speed, in_mlook; extern kbutton_t in_strafe, in_klook, in_speed, in_mlook;
#endif // __QF_input_h_ #endif//__QF_input_h

Some files were not shown because too many files have changed in this diff Show more