include libs/video/renderer/vulkan/test/Makemodule.am
include libs/video/renderer/vulkan/vkgen/Makemodule.am

#lib_LTLIBRARIES += @VID_REND_TARGETS@
plugin_LTLIBRARIES += @vid_render_plugins@
noinst_LTLIBRARIES += \
	libs/video/renderer/libQFrenderer.la \
	@render_libs@ \
	@vid_render_static_plugins@

#plugins
EXTRA_LTLIBRARIES += \
	libs/video/renderer/vid_render_sw.la \
	libs/video/renderer/vid_render_gl.la \
	libs/video/renderer/vid_render_glsl.la \
	libs/video/renderer/vid_render_vulkan.la

#helper libraries
EXTRA_LTLIBRARIES += \
	libs/video/renderer/librender_sw.la \
	libs/video/renderer/librender_gl.la \
	libs/video/renderer/librender_glsl.la \
	libs/video/renderer/librender_vulkan.la

video_renderer_common_sources = \
	libs/video/renderer/crosshair.c \
	libs/video/renderer/font8x8.c \
	libs/video/renderer/noisetextures.c \
	libs/video/renderer/r_alias.c \
	libs/video/renderer/r_billboard.c \
	libs/video/renderer/r_dyn_textures.c \
	libs/video/renderer/r_ent.c \
	libs/video/renderer/r_iqm.c \
	libs/video/renderer/r_sprite.c \
	libs/video/renderer/vid_common.c

renderer_libs= \
	@vid_render_static_plugin_libs@ \
	libs/util/libQFutil.la

libs_video_renderer_libQFrenderer_la_LDFLAGS=		@STATIC@
libs_video_renderer_libQFrenderer_la_LIBADD=		$(renderer_libs)
libs_video_renderer_libQFrenderer_la_DEPENDENCIES=	$(renderer_libs)
libs_video_renderer_libQFrenderer_la_SOURCES=\
	libs/video/renderer/r_bsp.c \
	libs/video/renderer/r_cvar.c \
	libs/video/renderer/r_efrag.c \
	libs/video/renderer/r_fog.c \
	libs/video/renderer/r_graph.c \
	libs/video/renderer/r_init.c \
	libs/video/renderer/r_light.c \
	libs/video/renderer/r_main.c \
	libs/video/renderer/r_part.c \
	libs/video/renderer/r_scrap.c \
	libs/video/renderer/r_screen.c \
	libs/video/renderer/r_progs.c

video_renderer_gl_libs= \
	libs/video/renderer/librender_gl.la \
	libs/models/libmodels_gl.la
libs_video_renderer_vid_render_gl_la_LDFLAGS=		$(plugin_ldflags)
libs_video_renderer_vid_render_gl_la_LIBADD=		$(video_renderer_gl_libs)
libs_video_renderer_vid_render_gl_la_DEPENDENCIES=	$(video_renderer_gl_libs)
libs_video_renderer_vid_render_gl_la_SOURCES=\
	$(video_renderer_common_sources) \
	libs/video/renderer/vid_render_gl.c

libs_video_renderer_librender_gl_la_SOURCES = \
	libs/video/renderer/gl/gl_draw.c \
	libs/video/renderer/gl/gl_dyn_lights.c \
	libs/video/renderer/gl/gl_dyn_part.c \
	libs/video/renderer/gl/gl_dyn_textures.c \
	libs/video/renderer/gl/gl_fog.c \
	libs/video/renderer/gl/gl_graph.c \
	libs/video/renderer/gl/gl_lightmap.c \
	libs/video/renderer/gl/gl_mod_alias.c \
	libs/video/renderer/gl/gl_mod_iqm.c \
	libs/video/renderer/gl/gl_mod_sprite.c \
	libs/video/renderer/gl/gl_rmain.c \
	libs/video/renderer/gl/gl_rmisc.c \
	libs/video/renderer/gl/gl_rsurf.c \
	libs/video/renderer/gl/gl_screen.c \
	libs/video/renderer/gl/gl_sky.c \
	libs/video/renderer/gl/gl_sky_clip.c \
	libs/video/renderer/gl/gl_textures.c \
	libs/video/renderer/gl/gl_warp.c \
	libs/video/renderer/gl/qfgl_ext.c \
	libs/video/renderer/gl/vid_common_gl.c \
	libs/video/renderer/gl/vtxarray.c

shader_src= libs/video/renderer/glsl/quakeforge.glsl
shader_gen= libs/video/renderer/glsl/quakeforge.slc

SUFFICES += .frag .vert .spv .spvc .fc .vc .slc .glsl
.glsl.slc:
	$(V_SED)sed -e 's/^/"/' -e 's/$$/\\n"/' $< > $@.t &&\
	$(am__mv) $@.t $@

video_renderer_glsl_libs= \
	libs/video/renderer/librender_glsl.la \
	libs/models/libmodels_glsl.la
libs_video_renderer_vid_render_glsl_la_LDFLAGS=		$(plugin_ldflags)
libs_video_renderer_vid_render_glsl_la_LIBADD=		$(video_renderer_glsl_libs)
libs_video_renderer_vid_render_glsl_la_DEPENDENCIES=$(video_renderer_glsl_libs)
libs_video_renderer_vid_render_glsl_la_SOURCES=\
	$(video_renderer_common_sources) \
	libs/video/renderer/vid_render_glsl.c

libs_video_renderer_librender_glsl_la_SOURCES = \
	libs/video/renderer/glsl/glsl_alias.c \
	libs/video/renderer/glsl/glsl_bsp.c \
	libs/video/renderer/glsl/glsl_draw.c \
	libs/video/renderer/glsl/glsl_iqm.c \
	libs/video/renderer/glsl/glsl_lightmap.c \
	libs/video/renderer/glsl/glsl_main.c \
	libs/video/renderer/glsl/glsl_particles.c \
	libs/video/renderer/glsl/glsl_screen.c \
	libs/video/renderer/glsl/glsl_shader.c \
	libs/video/renderer/glsl/glsl_sprite.c \
	libs/video/renderer/glsl/glsl_textures.c \
	libs/video/renderer/glsl/qfglsl.c \
	libs/video/renderer/glsl/quakeforge.glsl \
	libs/video/renderer/glsl/vid_common_glsl.c

video_renderer_sw_libs= \
	libs/video/renderer/librender_sw.la \
	libs/models/libmodels_sw.la
libs_video_renderer_vid_render_sw_la_LDFLAGS=		$(plugin_ldflags)
libs_video_renderer_vid_render_sw_la_LIBADD=		$(video_renderer_sw_libs)
libs_video_renderer_vid_render_sw_la_DEPENDENCIES=	$(video_renderer_sw_libs)
libs_video_renderer_vid_render_sw_la_SOURCES=\
	$(video_renderer_common_sources) \
	libs/video/renderer/vid_render_sw.c

libs_video_renderer_librender_sw_la_SOURCES = \
	libs/video/renderer/sw/d_copy.S \
	libs/video/renderer/sw/d_draw.S \
	libs/video/renderer/sw/d_edge.c \
	libs/video/renderer/sw/d_init.c \
	libs/video/renderer/sw/d_modech.c \
	libs/video/renderer/sw/d_part.c \
	libs/video/renderer/sw/d_parta.S \
	libs/video/renderer/sw/d_polysa.S \
	libs/video/renderer/sw/d_polyse.c \
	libs/video/renderer/sw/d_scan.c \
	libs/video/renderer/sw/d_scana.S \
	libs/video/renderer/sw/d_sky.c \
	libs/video/renderer/sw/d_spr8.S \
	libs/video/renderer/sw/d_sprite.c \
	libs/video/renderer/sw/d_surf.c \
	libs/video/renderer/sw/d_vars.c \
	libs/video/renderer/sw/d_varsa.S \
	libs/video/renderer/sw/d_zpoint.c \
	libs/video/renderer/sw/draw.c \
	libs/video/renderer/sw/fpu.c \
	libs/video/renderer/sw/fpua.S \
	libs/video/renderer/sw/nonintel.c \
	libs/video/renderer/sw/screen.c \
	libs/video/renderer/sw/surf8.S \
	libs/video/renderer/sw/sw_graph.c \
	libs/video/renderer/sw/sw_raclip.c \
	libs/video/renderer/sw/sw_raclipa.S \
	libs/video/renderer/sw/sw_ralias.c \
	libs/video/renderer/sw/sw_raliasa.S \
	libs/video/renderer/sw/sw_rbsp.c \
	libs/video/renderer/sw/sw_rdraw.c \
	libs/video/renderer/sw/sw_rdrawa.S \
	libs/video/renderer/sw/sw_redge.c \
	libs/video/renderer/sw/sw_redgea.S \
	libs/video/renderer/sw/sw_riqm.c \
	libs/video/renderer/sw/sw_rmain.c \
	libs/video/renderer/sw/sw_rmisc.c \
	libs/video/renderer/sw/sw_rpart.c \
	libs/video/renderer/sw/sw_rsky.c \
	libs/video/renderer/sw/sw_rsprite.c \
	libs/video/renderer/sw/sw_rsurf.c \
	libs/video/renderer/sw/sw_rvarsa.S \
	libs/video/renderer/sw/transform.S \
	libs/video/renderer/sw/vid_common_sw.c

pipeline_src = libs/video/renderer/vulkan/qfpipeline.plist
pipeline_gen = libs/video/renderer/vulkan/qfpipeline.plc
renderpass_src = libs/video/renderer/vulkan/deferred.plist
renderpass_gen = libs/video/renderer/vulkan/deferred.plc

video_renderer_vulkan_libs = \
	libs/video/renderer/librender_vulkan.la \
	libs/models/libmodels_vulkan.la
libs_video_renderer_vid_render_vulkan_la_LDFLAGS=       $(plugin_ldflags)
libs_video_renderer_vid_render_vulkan_la_LIBADD=        $(video_renderer_vulkan_libs)
libs_video_renderer_vid_render_vulkan_la_DEPENDENCIES=$(video_renderer_vulkan_libs)
libs_video_renderer_vid_render_vulkan_la_SOURCES = \
	$(video_renderer_common_sources) \
	libs/video/renderer/vid_render_vulkan.c

libs_video_renderer_librender_vulkan_la_SOURCES = \
	libs/video/renderer/vulkan/barrier.c \
	libs/video/renderer/vulkan/buffer.c \
	libs/video/renderer/vulkan/command.c \
	libs/video/renderer/vulkan/capture.c \
	libs/video/renderer/vulkan/descriptor.c \
	libs/video/renderer/vulkan/device.c \
	libs/video/renderer/vulkan/image.c \
	libs/video/renderer/vulkan/instance.c \
	libs/video/renderer/vulkan/memory.c \
	libs/video/renderer/vulkan/pipeline.c \
	libs/video/renderer/vulkan/projection.c \
	libs/video/renderer/vulkan/renderpass.c \
	libs/video/renderer/vulkan/scrap.c \
	libs/video/renderer/vulkan/shader.c \
	libs/video/renderer/vulkan/staging.c \
	libs/video/renderer/vulkan/swapchain.c \
	libs/video/renderer/vulkan/util.c \
	libs/video/renderer/vulkan/util.h \
	libs/video/renderer/vulkan/vkparse.c \
	libs/video/renderer/vulkan/vulkan_alias.c \
	libs/video/renderer/vulkan/vulkan_bsp.c \
	libs/video/renderer/vulkan/vulkan_compose.c \
	libs/video/renderer/vulkan/vulkan_draw.c \
	libs/video/renderer/vulkan/vulkan_lighting.c \
	libs/video/renderer/vulkan/vulkan_main.c \
	libs/video/renderer/vulkan/vulkan_matrices.c \
	libs/video/renderer/vulkan/vulkan_particles.c \
	libs/video/renderer/vulkan/vulkan_sprite.c \
	libs/video/renderer/vulkan/vulkan_texture.c \
	libs/video/renderer/vulkan/vulkan_vid_common.c

libs/video/renderer/vulkan/vkparse.lo: libs/video/renderer/vulkan/vkparse.c $(vkparse_src)

libs/video/renderer/vulkan/shader.lo: libs/video/renderer/vulkan/shader.c $(vkshader_c)

libs/video/renderer/vulkan/vulkan_vid_common.lo: libs/video/renderer/vulkan/vulkan_vid_common.c $(vkparse_src) $(pipeline_gen) ${renderpass_gen}


qwaq_cmd = $(top_builddir)/ruamoko/qwaq/qwaq-cmd$(EXEEXT)
vkparse_cinc = $(top_builddir)/libs/video/renderer/vulkan/vkparse.cinc
vkparse_hinc = $(top_builddir)/libs/video/renderer/vulkan/vkparse.hinc
vkparse_src = \
	$(vkparse_cinc) \
	$(vkparse_hinc)
vkparse_plist = \
	$(srcdir)/libs/video/renderer/vulkan/vkparse.plist

vkshaderpath = libs/video/renderer/vulkan/shader

partphysicsc_src = $(vkshaderpath)/partphysics.comp
partphysicsc_c = $(vkshaderpath)/partphysics.comp.spvc
partupdatec_src = $(vkshaderpath)/partupdate.comp
partupdatec_c = $(vkshaderpath)/partupdate.comp.spvc
particlev_src = $(vkshaderpath)/particle.vert
particlev_c = $(vkshaderpath)/particle.vert.spvc
particleg_src = $(vkshaderpath)/particle.geom
particleg_c = $(vkshaderpath)/particle.geom.spvc
particlef_src = $(vkshaderpath)/particle.frag
particlef_c = $(vkshaderpath)/particle.frag.spvc
sprite_gbufv_src = $(vkshaderpath)/sprite_gbuf.vert
sprite_gbufv_c = $(vkshaderpath)/sprite_gbuf.vert.spvc
sprite_gbuff_src = $(vkshaderpath)/sprite_gbuf.frag
sprite_gbuff_c = $(vkshaderpath)/sprite_gbuf.frag.spvc
sprite_depthv_src = $(vkshaderpath)/sprite_depth.vert
sprite_depthv_c = $(vkshaderpath)/sprite_depth.vert.spvc
sprite_depthf_src = $(vkshaderpath)/sprite_depth.frag
sprite_depthf_c = $(vkshaderpath)/sprite_depth.frag.spvc
twodv_src = $(vkshaderpath)/twod.vert
twodv_c = $(vkshaderpath)/twod.vert.spvc
twodf_src = $(vkshaderpath)/twod.frag
twodf_c = $(vkshaderpath)/twod.frag.spvc
quakebspv_src = $(vkshaderpath)/quakebsp.vert
quakebspv_c = $(vkshaderpath)/quakebsp.vert.spvc
quakebspf_src = $(vkshaderpath)/quakebsp.frag
quakebspf_c = $(vkshaderpath)/quakebsp.frag.spvc

bsp_depth_src = $(vkshaderpath)/bsp_depth.vert
bsp_depth_c = $(vkshaderpath)/bsp_depth.vert.spvc
bsp_gbufv_src = $(vkshaderpath)/bsp_gbuf.vert
bsp_gbufv_c = $(vkshaderpath)/bsp_gbuf.vert.spvc
bsp_gbufg_src = $(vkshaderpath)/bsp_gbuf.geom
bsp_gbufg_c = $(vkshaderpath)/bsp_gbuf.geom.spvc
bsp_gbuff_src = $(vkshaderpath)/bsp_gbuf.frag
bsp_gbuff_c = $(vkshaderpath)/bsp_gbuf.frag.spvc
bsp_shadow_src = $(vkshaderpath)/bsp_shadow.vert
bsp_shadow_c = $(vkshaderpath)/bsp_shadow.vert.spvc
bsp_skyf_src = $(vkshaderpath)/bsp_sky.frag
bsp_skyf_c = $(vkshaderpath)/bsp_sky.frag.spvc
bsp_turbf_src = $(vkshaderpath)/bsp_turb.frag
bsp_turbf_c = $(vkshaderpath)/bsp_turb.frag.spvc
lightingf_src = $(vkshaderpath)/lighting.frag
lightingf_c = $(vkshaderpath)/lighting.frag.spvc
composef_src = $(vkshaderpath)/compose.frag
composef_c = $(vkshaderpath)/compose.frag.spvc
aliasv_src = $(vkshaderpath)/alias.vert
aliasv_c = $(vkshaderpath)/alias.vert.spvc
aliasf_src = $(vkshaderpath)/alias.frag
aliasf_c = $(vkshaderpath)/alias.frag.spvc
alias_depth_src = $(vkshaderpath)/alias_depth.vert
alias_depth_c = $(vkshaderpath)/alias_depth.vert.spvc
alias_gbuf_src = $(vkshaderpath)/alias_gbuf.frag
alias_gbuf_c = $(vkshaderpath)/alias_gbuf.frag.spvc
alias_shadow_src = $(vkshaderpath)/alias_shadow.vert
alias_shadow_c = $(vkshaderpath)/alias_shadow.vert.spvc
passthrough_src = $(vkshaderpath)/passthrough.vert
passthrough_c = $(vkshaderpath)/passthrough.vert.spvc
pushcolor_src = $(vkshaderpath)/pushcolor.frag
pushcolor_c = $(vkshaderpath)/pushcolor.frag.spvc
shadow_src = $(vkshaderpath)/shadow.geom
shadow_c = $(vkshaderpath)/shadow.geom.spvc

$(partphysicsc_c): $(partphysicsc_src)
$(partupdatec_c): $(partupdatec_src)
$(particlev_c): $(particlev_src)
$(particleg_c): $(particleg_src)
$(particlef_c): $(particlef_src)

$(sprite_gbufv_c): $(sprite_gbufv_src)

$(sprite_gbuff_c): $(sprite_gbuff_src)

$(sprite_depthv_c): $(sprite_depthv_src)

$(sprite_depthf_c): $(sprite_depthf_src)

$(twodv_c): $(twodv_src)

$(twodf_c): $(twodf_src)

$(quakebspv_c): $(quakebspv_src)

$(quakebspf_c): $(quakebspf_src)

$(bsp_depth_c): $(bsp_depth_src)

$(bsp_gbufv_c): $(bsp_gbufv_src)

$(bsp_gbufg_c): $(bsp_gbufg_src)

$(bsp_gbuff_c): $(bsp_gbuff_src)

$(bsp_shadow_c): $(bsp_shadow_src)

$(bsp_skyf_c): $(bsp_skyf_src)

$(bsp_turbf_c): $(bsp_turbf_src)

$(lightingf_c): $(lightingf_src)

$(composef_c): $(composef_src)

$(aliasv_c): $(aliasv_src)

$(alias_depth_c): $(alias_depth_src)

$(aliasf_c): $(aliasf_src)

$(alias_gbuf_c): $(alias_gbuf_src)

$(alias_shadow_c): $(alias_shadow_src)

$(passthrough_c): $(passthrough_src)

$(pushcolor_c): $(pushcolor_src)

$(shadow_c): $(shadow_src)

vkshader_c = \
	$(partphysicsc_c) \
	$(partupdatec_c) \
	$(particlev_c) \
	$(particleg_c) \
	$(particlef_c) \
	$(sprite_gbufv_c) \
	$(sprite_gbuff_c) \
	$(sprite_depthv_c) \
	$(sprite_depthf_c) \
	$(twodv_c) \
	$(twodf_c) \
	$(quakebspv_c) \
	$(quakebspf_c) \
	$(bsp_depth_c) \
	$(bsp_gbufv_c) \
	$(bsp_gbufg_c) \
	$(bsp_gbuff_c) \
	$(bsp_shadow_c) \
	$(bsp_skyf_c) \
	$(bsp_turbf_c) \
	$(lightingf_c) \
	$(composef_c) \
	$(aliasv_c) \
	$(alias_depth_c) \
	$(aliasf_c) \
	$(alias_gbuf_c) \
	$(alias_shadow_c) \
	$(passthrough_c) \
	$(pushcolor_c) \
	$(shadow_c)

V_VKGEN = $(V_VKGEN_@AM_V@)
V_VKGEN_ = $(V_VKGEN_@AM_DEFAULT_V@)
V_VKGEN_0 = @echo "  VKGEN   " $@;
V_VKGEN_1 =

$(vkparse_cinc): $(vkgen) $(qwaq_cmd) $(vkparse_plist)
	$(V_VKGEN)$(QWAQ) $(vkgen) -- $(vkparse_plist) $(vkparse_cinc).t $(vkparse_hinc).t &&\
	$(am__mv) $(vkparse_cinc).t $(vkparse_cinc) &&\
	$(am__mv) $(vkparse_hinc).t $(vkparse_hinc)

$(vkparse_hinc): $(vkparse_cinc)
# do nothing: hinc generated at the same time as cinc

CLEANFILES += \
	libs/video/renderer/glsl/*.vc \
	libs/video/renderer/glsl/*.fc \
	libs/video/renderer/glsl/*.slc \
	libs/video/renderer/vulkan/*.plc \
	libs/video/renderer/vulkan/shader/*.spv \
	libs/video/renderer/vulkan/shader/*.spvc \
	vkgen.sym \
	$(vkparse_src)

BUILT_SOURCES += $(shader_gen)

#shader_DATA += \
#	libs/video/renderer/vulkan/passthrough.vert.spv \
#	libs/video/renderer/vulkan/pushcolor.frag.spv

EXTRA_DIST += \
	libs/video/renderer/vulkan/deferred.plist \
	libs/video/renderer/vulkan/qfpipeline.plist \
	libs/video/renderer/vulkan/vkparse.plist \
	libs/video/renderer/vulkan/vkparse.h \
	libs/video/renderer/vulkan/shader/alias.frag \
	libs/video/renderer/vulkan/shader/alias.vert \
	libs/video/renderer/vulkan/shader/alias_depth.vert \
	libs/video/renderer/vulkan/shader/alias_gbuf.frag \
	libs/video/renderer/vulkan/shader/alias_shadow.vert \
	libs/video/renderer/vulkan/shader/bsp_depth.vert \
	libs/video/renderer/vulkan/shader/bsp_gbuf.frag \
	libs/video/renderer/vulkan/shader/bsp_gbuf.geom \
	libs/video/renderer/vulkan/shader/bsp_gbuf.vert \
	libs/video/renderer/vulkan/shader/bsp_shadow.vert \
	libs/video/renderer/vulkan/shader/bsp_sky.frag \
	libs/video/renderer/vulkan/shader/bsp_turb.frag \
	libs/video/renderer/vulkan/shader/compose.frag \
	libs/video/renderer/vulkan/shader/lighting.frag \
	libs/video/renderer/vulkan/shader/passthrough.vert \
	libs/video/renderer/vulkan/shader/partphysics.comp \
	libs/video/renderer/vulkan/shader/partupdate.comp \
	libs/video/renderer/vulkan/shader/particle.vert \
	libs/video/renderer/vulkan/shader/particle.geom \
	libs/video/renderer/vulkan/shader/particle.frag \
	libs/video/renderer/vulkan/shader/pushcolor.frag \
	libs/video/renderer/vulkan/shader/quakebsp.frag \
	libs/video/renderer/vulkan/shader/quakebsp.vert \
	libs/video/renderer/vulkan/shader/shadow.geom \
	libs/video/renderer/vulkan/shader/sprite_depth.vert \
	libs/video/renderer/vulkan/shader/sprite_depth.frag \
	libs/video/renderer/vulkan/shader/sprite_gbuf.vert \
	libs/video/renderer/vulkan/shader/sprite_gbuf.frag \
	libs/video/renderer/vulkan/shader/twod.frag \
	libs/video/renderer/vulkan/shader/twod.vert
