Skip to content
Permalink
Browse files

renderer: initial port of the vulkan renderer from ioquake3

  • Loading branch information...
dGr8LookinSparky committed Mar 27, 2019
1 parent 3d80a23 commit 0236133b06e72edb2898f10127c4dd28d316521c
Showing with 108,288 additions and 7 deletions.
  1. +167 −1 Makefile
  2. +2 −1 assets/ui/options.menu
  3. +1 −2 src/game/g_playermodel.c
  4. +42 −0 src/renderer_vulkan/RB_DrawNormals.cpp
  5. +6 −0 src/renderer_vulkan/RB_DrawNormals.h
  6. +20 −0 src/renderer_vulkan/RB_DrawTris.cpp
  7. +8 −0 src/renderer_vulkan/RB_DrawTris.h
  8. +80 −0 src/renderer_vulkan/RB_ShowImages.cpp
  9. +245 −0 src/renderer_vulkan/RB_SurfaceAnim.cpp
  10. +6 −0 src/renderer_vulkan/RB_SurfaceAnim.h
  11. +84 −0 src/renderer_vulkan/README.md
  12. +139 −0 src/renderer_vulkan/RE_RegisterModel.cpp
  13. +23 −0 src/renderer_vulkan/R_AddAnimSurfaces.cpp
  14. +126 −0 src/renderer_vulkan/R_DEBUG.cpp
  15. +11 −0 src/renderer_vulkan/R_DEBUG.h
  16. +686 −0 src/renderer_vulkan/R_FindShader.cpp
  17. +476 −0 src/renderer_vulkan/R_ImageJPG.cpp
  18. +7 −0 src/renderer_vulkan/R_ImageJPG.h
  19. +658 −0 src/renderer_vulkan/R_ImageProcess.cpp
  20. +15 −0 src/renderer_vulkan/R_ImageProcess.h
  21. +180 −0 src/renderer_vulkan/R_LerpTag.cpp
  22. +9 −0 src/renderer_vulkan/R_LerpTag.h
  23. +64 −0 src/renderer_vulkan/R_ListShader.cpp
  24. +131 −0 src/renderer_vulkan/R_LoadImage.cpp
  25. +774 −0 src/renderer_vulkan/R_LoadImage2.cpp
  26. +272 −0 src/renderer_vulkan/R_LoadMD3.cpp
  27. +160 −0 src/renderer_vulkan/R_LoadMD3_o.cpp
  28. +527 −0 src/renderer_vulkan/R_LoadMDR.cpp
  29. +51 −0 src/renderer_vulkan/R_ModelBounds.cpp
  30. +8 −0 src/renderer_vulkan/R_ModelBounds.h
  31. +37 −0 src/renderer_vulkan/R_ModelBounds_o.cpp
  32. +31 −0 src/renderer_vulkan/R_PortalPlane.cpp
  33. +16 −0 src/renderer_vulkan/R_PortalPlane.h
  34. +59 −0 src/renderer_vulkan/R_PrintMat.cpp
  35. +21 −0 src/renderer_vulkan/R_PrintMat.h
  36. +38 −0 src/renderer_vulkan/R_StretchRaw.cpp
  37. +8 −0 src/renderer_vulkan/R_StretchRaw.h
  38. +27 −0 src/renderer_vulkan/VKimpl.h
  39. +10 −0 src/renderer_vulkan/glConfig.cpp
  40. +132 −0 src/renderer_vulkan/icon_oa.h
  41. +20 −0 src/renderer_vulkan/image_loader.h
  42. +317 −0 src/renderer_vulkan/matrix_multiplication.cpp
  43. +38 −0 src/renderer_vulkan/matrix_multiplication.h
  44. +9 −0 src/renderer_vulkan/ref_import.h
  45. BIN src/renderer_vulkan/shaders/Compiled/multi_texture.vspv
  46. BIN src/renderer_vulkan/shaders/Compiled/multi_texture_add.fspv
  47. +209 −0 src/renderer_vulkan/shaders/Compiled/multi_texture_add_frag.c
  48. BIN src/renderer_vulkan/shaders/Compiled/multi_texture_clipping_plane.vspv
  49. +208 −0 src/renderer_vulkan/shaders/Compiled/multi_texture_clipping_plane_vert.c
  50. BIN src/renderer_vulkan/shaders/Compiled/multi_texture_mul.fspv
  51. +168 −0 src/renderer_vulkan/shaders/Compiled/multi_texture_mul_frag.c
  52. +140 −0 src/renderer_vulkan/shaders/Compiled/multi_texture_vert.c
  53. BIN src/renderer_vulkan/shaders/Compiled/single_texture.fspv
  54. BIN src/renderer_vulkan/shaders/Compiled/single_texture.vspv
  55. BIN src/renderer_vulkan/shaders/Compiled/single_texture_clipping_plane.vspv
  56. +193 −0 src/renderer_vulkan/shaders/Compiled/single_texture_clipping_plane_vert.c
  57. +148 −0 src/renderer_vulkan/shaders/Compiled/single_texture_frag.c
  58. +125 −0 src/renderer_vulkan/shaders/Compiled/single_texture_vert.c
  59. BIN src/renderer_vulkan/shaders/bintoc
  60. +26 −0 src/renderer_vulkan/shaders/bintoc.c
  61. +25 −0 src/renderer_vulkan/shaders/compile.bat
  62. +22 −0 src/renderer_vulkan/shaders/compile.sh
  63. +82 −0 src/renderer_vulkan/shaders/compile_hlsl.bat
  64. +25 −0 src/renderer_vulkan/shaders/multi_texture.vert
  65. +26 −0 src/renderer_vulkan/shaders/multi_texture_add.frag
  66. +34 −0 src/renderer_vulkan/shaders/multi_texture_clipping_plane.vert
  67. +24 −0 src/renderer_vulkan/shaders/multi_texture_mul.frag
  68. +131 −0 src/renderer_vulkan/shaders/shaders.hlsl
  69. +22 −0 src/renderer_vulkan/shaders/single_texture.frag
  70. +22 −0 src/renderer_vulkan/shaders/single_texture.vert
  71. +31 −0 src/renderer_vulkan/shaders/single_texture_clipping_plane.vert
  72. +7,052 −0 src/renderer_vulkan/stb_image.h
  73. +121 −0 src/renderer_vulkan/tr_Cull.cpp
  74. +281 −0 src/renderer_vulkan/tr_animation.cpp
  75. +13 −0 src/renderer_vulkan/tr_backend.cpp
  76. +38 −0 src/renderer_vulkan/tr_backend.h
  77. +1,905 −0 src/renderer_vulkan/tr_bsp.cpp
  78. +713 −0 src/renderer_vulkan/tr_cmds.cpp
  79. +712 −0 src/renderer_vulkan/tr_common.cpp
  80. +627 −0 src/renderer_vulkan/tr_curve.cpp
  81. +168 −0 src/renderer_vulkan/tr_cvar.cpp
  82. +102 −0 src/renderer_vulkan/tr_cvar.h
  83. +102 −0 src/renderer_vulkan/tr_displayResolution.cpp
  84. +10 −0 src/renderer_vulkan/tr_displayResolution.h
  85. +547 −0 src/renderer_vulkan/tr_flares.cpp
  86. +8 −0 src/renderer_vulkan/tr_flares.h
  87. +53 −0 src/renderer_vulkan/tr_fog.cpp
  88. +9 −0 src/renderer_vulkan/tr_fog.h
  89. +570 −0 src/renderer_vulkan/tr_fonts.cpp
  90. +4 −0 src/renderer_vulkan/tr_globals.cpp
  91. +100 −0 src/renderer_vulkan/tr_globals.h
  92. +313 −0 src/renderer_vulkan/tr_image.cpp
  93. +44 −0 src/renderer_vulkan/tr_image.h
  94. +287 −0 src/renderer_vulkan/tr_init.cpp
  95. +400 −0 src/renderer_vulkan/tr_light.c
  96. +1,165 −0 src/renderer_vulkan/tr_local.h
  97. +1,280 −0 src/renderer_vulkan/tr_main.cpp
  98. +443 −0 src/renderer_vulkan/tr_marks.cpp
  99. +358 −0 src/renderer_vulkan/tr_mesh.cpp
  100. +99 −0 src/renderer_vulkan/tr_model.cpp
  101. +199 −0 src/renderer_vulkan/tr_model.h
  102. +1,169 −0 src/renderer_vulkan/tr_model_iqm.cpp
  103. +95 −0 src/renderer_vulkan/tr_noise.cpp
  104. +440 −0 src/renderer_vulkan/tr_scene.cpp
  105. +139 −0 src/renderer_vulkan/tr_shade.cpp
  106. +1,231 −0 src/renderer_vulkan/tr_shade_calc.cpp
  107. +2,216 −0 src/renderer_vulkan/tr_shader.cpp
  108. +15 −0 src/renderer_vulkan/tr_shader.h
  109. +335 −0 src/renderer_vulkan/tr_shadows.cpp
  110. +724 −0 src/renderer_vulkan/tr_sky.cpp
  111. +1,068 −0 src/renderer_vulkan/tr_surface.cpp
  112. +670 −0 src/renderer_vulkan/tr_world.cpp
  113. +99 −0 src/renderer_vulkan/vk_cmd.cpp
  114. +9 −0 src/renderer_vulkan/vk_cmd.h
  115. +496 −0 src/renderer_vulkan/vk_create_window_SDL.cpp
  116. +570 −0 src/renderer_vulkan/vk_create_window_XCB.cpp
  117. +130 −0 src/renderer_vulkan/vk_depth_attachment.cpp
  118. +8 −0 src/renderer_vulkan/vk_depth_attachment.h
  119. +882 −0 src/renderer_vulkan/vk_frame.cpp
  120. +16 −0 src/renderer_vulkan/vk_frame.h
  121. +1,063 −0 src/renderer_vulkan/vk_image.cpp
  122. +35 −0 src/renderer_vulkan/vk_image.h
  123. +191 −0 src/renderer_vulkan/vk_image_sampler.cpp
  124. +9 −0 src/renderer_vulkan/vk_image_sampler.h
  125. +216 −0 src/renderer_vulkan/vk_image_sampler2.cpp
  126. +1,236 −0 src/renderer_vulkan/vk_instance.cpp
  127. +218 −0 src/renderer_vulkan/vk_instance.h
  128. +940 −0 src/renderer_vulkan/vk_pipelines.cpp
  129. +47 −0 src/renderer_vulkan/vk_pipelines.h
  130. +655 −0 src/renderer_vulkan/vk_screenshot.cpp
  131. +33 −0 src/renderer_vulkan/vk_screenshot.h
  132. +1,259 −0 src/renderer_vulkan/vk_shade_geometry.cpp
  133. +44 −0 src/renderer_vulkan/vk_shade_geometry.h
  134. +185 −0 src/renderer_vulkan/vk_shaders.cpp
  135. +51 −0 src/renderer_vulkan/vk_shaders.h
  136. +18 −0 src/renderer_vulkan/vk_swapchain.cpp
  137. +8 −0 src/renderer_vulkan/vk_swapchain.h
  138. +131 −0 src/renderer_vulkan/vulkan/GLSL.std.450.h
  139. +593 −0 src/renderer_vulkan/vulkan/libspirv.h
  140. +1,093 −0 src/renderer_vulkan/vulkan/spirv.h
  141. +1,102 −0 src/renderer_vulkan/vulkan/spirv.hpp
  142. +1,102 −0 src/renderer_vulkan/vulkan/spirv.hpp11
  143. +1,118 −0 src/renderer_vulkan/vulkan/spirv.json
  144. +1,049 −0 src/renderer_vulkan/vulkan/spirv.lua
  145. +1,049 −0 src/renderer_vulkan/vulkan/spirv.py
  146. +589 −0 src/renderer_vulkan/vulkan/vk_dispatch_table_helper.h
  147. +3,792 −0 src/renderer_vulkan/vulkan/vk_enum_string_helper.h
  148. +170 −0 src/renderer_vulkan/vulkan/vk_icd.h
  149. +195 −0 src/renderer_vulkan/vulkan/vk_layer.h
  150. +539 −0 src/renderer_vulkan/vulkan/vk_layer_dispatch_table.h
  151. +92 −0 src/renderer_vulkan/vulkan/vk_platform.h
  152. +69 −0 src/renderer_vulkan/vulkan/vk_sdk_platform.h
  153. +79 −0 src/renderer_vulkan/vulkan/vulkan.h
  154. +45,177 −0 src/renderer_vulkan/vulkan/vulkan.hpp
  155. +126 −0 src/renderer_vulkan/vulkan/vulkan_android.h
  156. +7,801 −0 src/renderer_vulkan/vulkan/vulkan_core.h
  157. +58 −0 src/renderer_vulkan/vulkan/vulkan_ios.h
  158. +58 −0 src/renderer_vulkan/vulkan/vulkan_macos.h
  159. +65 −0 src/renderer_vulkan/vulkan/vulkan_mir.h
  160. +58 −0 src/renderer_vulkan/vulkan/vulkan_vi.h
  161. +65 −0 src/renderer_vulkan/vulkan/vulkan_wayland.h
  162. +276 −0 src/renderer_vulkan/vulkan/vulkan_win32.h
  163. +66 −0 src/renderer_vulkan/vulkan/vulkan_xcb.h
  164. +66 −0 src/renderer_vulkan/vulkan/vulkan_xlib.h
  165. +54 −0 src/renderer_vulkan/vulkan/vulkan_xlib_xrandr.h
  166. +7 −3 src/renderercommon/tr_public.h
  167. +2 −0 src/renderercommon/tr_types.h
  168. +2 −0 src/sdl/sdl_glimp.cpp
168 Makefile
@@ -42,6 +42,9 @@ endif
ifndef BUILD_RENDERER_OPENGL2
BUILD_RENDERER_OPENGL2=
endif
ifndef BUILD_RENDERER_VULKAN
BUILD_RENDERER_VULKAN=1
endif

#############################################################################
#
@@ -261,6 +264,7 @@ SDIR=$(MOUNT_DIR)/server
RCOMMONDIR=$(MOUNT_DIR)/renderercommon
RGL1DIR=$(MOUNT_DIR)/renderergl1
RGL2DIR=$(MOUNT_DIR)/renderergl2
RVULKANDIR=$(MOUNT_DIR)/renderer_vulkan
CMDIR=$(MOUNT_DIR)/qcommon
SDLDIR=$(MOUNT_DIR)/sdl
ASMDIR=$(MOUNT_DIR)/asm
@@ -793,11 +797,17 @@ ifneq ($(BUILD_CLIENT),0)
ifneq ($(BUILD_RENDERER_OPENGL2),0)
TARGETS += $(B)/renderer_opengl2$(SHLIBNAME)
endif
ifneq ($(BUILD_RENDERER_VULKAN),0)
TARGETS += $(B)/renderer_vulkan$(SHLIBNAME)
endif
else
TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT)
ifneq ($(BUILD_RENDERER_OPENGL2),0)
TARGETS += $(B)/$(CLIENTBIN)_opengl2$(FULLBINEXT)
endif
ifneq ($(BUILD_RENDERER_VULKAN),0)
TARGETS += $(B)/$(CLIENTBIN)_vulkan$(FULLBINEXT)
endif
endif
endif

@@ -1032,6 +1042,17 @@ $(Q)$(call EXEC_CXX,${REF_CC_FLAGS},'$@','$<')
$(Q)$(call LOG_CXX,opengl2,${REF_CC_FLAGS},$@,$<)
endef

define DO_RENDEREVULKAN_CC
$(echo_cmd) "VULKAN_RENDERER_CC $<"
$(Q)$(call EXEC_CC,${REF_CC_FLAGS},'$@','$<')
$(Q)$(call LOG_CC,vulkan,${REF_CC_FLAGS},$@,$<)
endef
define DO_RENDEREVULKAN_CXX
$(echo_cmd) "RENDERERVULKAN_CXX $<"
$(Q)$(call EXEC_CXX,${REF_CC_FLAGS},'$@','$<')
$(Q)$(call LOG_CXX,vulkan,${REF_CC_FLAGS},$@,$<)
endef

define DO_REF_STR
$(echo_cmd) "REF_STR $<"
$(Q)rm -f $@
@@ -1248,6 +1269,7 @@ makedirs:
@if [ ! -d $(B)/renderergl1 ];then $(MKDIR) $(B)/renderergl1;fi
@if [ ! -d $(B)/renderergl2 ];then $(MKDIR) $(B)/renderergl2;fi
@if [ ! -d $(B)/renderergl2/glsl ];then $(MKDIR) $(B)/renderergl2/glsl;fi
@if [ ! -d $(B)/renderer_vulkan ];then $(MKDIR) $(B)/renderer_vulkan;fi
@if [ ! -d $(B)/$(BASEGAME) ];then $(MKDIR) $(B)/$(BASEGAME);fi
@if [ ! -d $(B)/$(BASEGAME)/cgame ];then $(MKDIR) $(B)/$(BASEGAME)/cgame;fi
@if [ ! -d $(B)/$(BASEGAME)/game ];then $(MKDIR) $(B)/$(BASEGAME)/game;fi
@@ -1845,6 +1867,95 @@ endif

Q3OBJ += $(LUAOBJ) $(SCRIPTOBJ) $(NETTLEOBJ) $(SEMVEROBJ)

###################### VULKAN ######################

Q3VKOBJ = \
$(B)/renderer_vulkan/R_DEBUG.o \
$(B)/renderer_vulkan/matrix_multiplication.o \
$(B)/renderer_vulkan/tr_globals.o \
$(B)/renderer_vulkan/tr_cvar.o \
$(B)/renderer_vulkan/tr_animation.o \
$(B)/renderer_vulkan/tr_bsp.o \
$(B)/renderer_vulkan/tr_cmds.o \
$(B)/renderer_vulkan/tr_curve.o \
$(B)/renderer_vulkan/tr_fonts.o \
$(B)/renderer_vulkan/tr_image.o \
$(B)/renderer_vulkan/R_FindShader.o \
$(B)/renderer_vulkan/R_ListShader.o \
$(B)/renderer_vulkan/R_ImageProcess.o \
$(B)/renderer_vulkan/tr_init.o \
$(B)/renderer_vulkan/tr_light.o \
$(B)/renderer_vulkan/tr_main.o \
$(B)/renderer_vulkan/tr_marks.o \
$(B)/renderer_vulkan/tr_mesh.o \
$(B)/renderer_vulkan/R_AddAnimSurfaces.o \
$(B)/renderer_vulkan/tr_model.o \
$(B)/renderer_vulkan/tr_model_iqm.o \
$(B)/renderer_vulkan/RE_RegisterModel.o \
$(B)/renderer_vulkan/R_ModelBounds.o \
$(B)/renderer_vulkan/R_LoadMD3.o \
$(B)/renderer_vulkan/R_LoadMDR.o \
$(B)/renderer_vulkan/R_LerpTag.o \
$(B)/renderer_vulkan/tr_noise.o \
$(B)/renderer_vulkan/tr_scene.o \
$(B)/renderer_vulkan/tr_shade.o \
$(B)/renderer_vulkan/tr_shade_calc.o \
$(B)/renderer_vulkan/tr_shader.o \
$(B)/renderer_vulkan/tr_shadows.o \
$(B)/renderer_vulkan/tr_sky.o \
$(B)/renderer_vulkan/tr_surface.o \
$(B)/renderer_vulkan/RB_SurfaceAnim.o \
$(B)/renderer_vulkan/tr_flares.o \
$(B)/renderer_vulkan/tr_fog.o \
$(B)/renderer_vulkan/tr_world.o \
$(B)/renderer_vulkan/tr_common.o \
$(B)/renderer_vulkan/tr_displayResolution.o \
$(B)/renderer_vulkan/vk_instance.o \
$(B)/renderer_vulkan/vk_cmd.o \
$(B)/renderer_vulkan/vk_image.o \
$(B)/renderer_vulkan/vk_image_sampler2.o \
$(B)/renderer_vulkan/vk_pipelines.o \
$(B)/renderer_vulkan/vk_frame.o \
$(B)/renderer_vulkan/vk_swapchain.o \
$(B)/renderer_vulkan/vk_screenshot.o \
$(B)/renderer_vulkan/vk_shade_geometry.o \
$(B)/renderer_vulkan/vk_depth_attachment.o \
\
$(B)/renderer_vulkan/vk_shaders.o \
$(B)/renderer_vulkan/multi_texture_add_frag.o \
$(B)/renderer_vulkan/multi_texture_clipping_plane_vert.o \
$(B)/renderer_vulkan/multi_texture_mul_frag.o \
$(B)/renderer_vulkan/multi_texture_vert.o \
$(B)/renderer_vulkan/single_texture_clipping_plane_vert.o \
$(B)/renderer_vulkan/single_texture_frag.o \
$(B)/renderer_vulkan/single_texture_vert.o \
\
$(B)/renderer_vulkan/R_LoadImage2.o \
$(B)/renderer_vulkan/R_StretchRaw.o \
$(B)/renderer_vulkan/R_ImageJPG.o \
$(B)/renderer_vulkan/RB_ShowImages.o \
$(B)/renderer_vulkan/RB_DrawNormals.o \
$(B)/renderer_vulkan/RB_DrawTris.o \
$(B)/renderer_vulkan/tr_backend.o \
$(B)/renderer_vulkan/tr_Cull.o \
$(B)/renderer_vulkan/glConfig.o \
$(B)/renderer_vulkan/R_PortalPlane.o \
$(B)/renderer_vulkan/R_PrintMat.o
# $(B)/renderer_vulkan/R_LoadImage.o \
$(B)/renderer_vulkan/tr_image_png.o \
$(B)/renderer_vulkan/tr_image_jpg.o \
$(B)/renderer_vulkan/tr_image_bmp.o \
$(B)/renderer_vulkan/tr_image_tga.o \
$(B)/renderer_vulkan/tr_image_pcx.o \
ifeq ($(BUILD_WITH_XCB), 1)
Q3VKOBJ += $(B)/renderer_vulkan/vk_create_window_XCB.o
else
Q3VKOBJ += $(B)/renderer_vulkan/vk_create_window_SDL.o
endif

######################################################

Q3R2OBJ = \
$(B)/renderergl2/tr_animation.o \
$(B)/renderergl2/tr_backend.o \
@@ -1893,6 +2004,15 @@ ifneq ($(USE_RENDERER_DLOPEN), 0)
$(B)/renderergl1/puff.o \
$(B)/renderergl1/q_math.o \
$(B)/renderergl1/tr_subs.o

############### VULKAN ###################

Q3VKOBJ += \
$(B)/renderergl1/q_shared.o \
$(B)/renderergl1/puff.o \
$(B)/renderergl1/q_math.o

##########################################
endif

Q3R2STRINGOBJ = \
@@ -2281,6 +2401,17 @@ $(B)/renderer_opengl2$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CXX) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LDFLAGS)

######################## VULKAN ##############################

$(B)/renderer_vulkan$(SHLIBNAME): $(Q3VKOBJ) $(JPGOBJ)
$(echo_cmd) "LD $@"
$(Q)$(CXX) $(SHLIBLDFLAGS) -o $@ $(Q3VKOBJ) $(JPGOBJ) \
$(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LDFLAGS)
# $(XCB_LIBS)

##############################################################

else
$(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@"
@@ -2293,6 +2424,15 @@ $(B)/$(CLIENTBIN)_opengl2$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(J
$(Q)$(CXX) -std=c++1y $(CXXFLAGS) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)

######################## VULKAN ##############################
$(B)/$(CLIENTBIN)_vulkan$(FULLBINEXT): $(Q3OBJ) $(Q3VKOBJ) $(JPGOBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@"
$(Q)$(CXX) -std=c++1y $(CXXFLAGS) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3VKOBJ) $(JPGOBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)

##############################################################
endif

ifneq ($(strip $(LIBSDLMAIN)),)
@@ -2738,6 +2878,31 @@ $(B)/renderergl2/%.o: $(RCOMMONDIR)/%.cpp
$(B)/renderergl2/%.o: $(RGL2DIR)/%.cpp
$(DO_RENDERERGL2_CXX)

############### VULKAN ######################

$(B)/renderer_vulkan/%.o: $(CMDIR)/%.c
$(DO_RENDEREVULKAN_CC)
$(B)/renderer_vulkan/%.o: $(CMDIR)/%.cpp
$(DO_RENDEREVULKAN_CXX)
$(B)/renderer_vulkan/%.o: $(SDLDIR)/%.c
$(DO_RENDERER_COMMON_CC)
$(B)/renderer_vulkan/%.o: $(SDLDIR)/%.cpp
$(DO_RENDERER_COMMON_CXX)
$(B)/renderer_vulkan/%.o: $(JPDIR)/%.c
$(DO_RENDERER_COMMON_CC)
$(B)/renderer_vulkan/%.o: $(RCOMMONDIR)/%.c
$(DO_RENDERER_COMMON_CC)
$(B)/renderer_vulkan/%.o: $(RVULKANDIR)/%.c
$(DO_RENDEREVULKAN_CC)
$(B)/renderer_vulkan/%.o: $(RCOMMONDIR)/%.cpp
$(DO_RENDERER_COMMON_CXX)
$(B)/renderer_vulkan/%.o: $(RVULKANDIR)/%.cpp
$(DO_RENDEREVULKAN_CXX)
$(B)/renderer_vulkan/%.o: $(MOUNT_DIR)/renderer_vulkan/shaders/Compiled/%.c
$(DO_RENDEREVULKAN_CC)

##############################################

$(B)/ded/%.o: $(ASMDIR)/%.s
$(DO_DED_AS)

@@ -2857,7 +3022,7 @@ $(B)/$(BASEGAME)/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC)
# MISC
#############################################################################

OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3DOBJ) $(JPGOBJ) \
OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3VKOBJ) $(Q3DOBJ) $(JPGOBJ) \
$(GOBJ) $(CGOBJ) $(UIOBJ) $(LUAOBJ) $(SCRIPTOBJ) $(NETTLEOBJ) \
$(GVMOBJ) $(CGVMOBJ) $(UIVMOBJ) $(GRANGEROBJ)
TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ)
@@ -2879,6 +3044,7 @@ clean2:
@rm -f $(OBJ_D_FILES)
@rm -f $(STRINGOBJ)
@rm -f $(TARGETS)
@rm -f $(Q3VKOBJ)

toolsclean: toolsclean-debug toolsclean-release

@@ -69,7 +69,8 @@
text "Renderer:"
cvar "cl_renderer"
cvarStrList { "OpenGL 1", "opengl1",
"OpenGL 2", "opengl2" }
"OpenGL 2", "opengl2",
"Vulkan", "vulkan" }
rect X (Y+(ELEM_H+ELEM_GAP)) W ELEM_H
textalign ALIGN_RIGHT
textalignx TOFF_X
@@ -60,7 +60,7 @@ void G_InitPlayerModel(void)
start = filePtr + 15;

// Only want directory names at the current depth.
for ( c = start; c != '\0'; c++ )
for ( c = start; *c != '\0'; c++ )
{
if ( *c == '/' || *c == '\\' )
{
@@ -190,4 +190,3 @@ char *GetSkin( char *modelname, char *wish )

return lastpick;
}

@@ -0,0 +1,42 @@
#include "tr_backend.h"
#include "vk_shade_geometry.h"
#include "tr_globals.h"
#include "vk_pipelines.h"

/*
================
Draws vertex normals for debugging
================
*/
void RB_DrawNormals (shaderCommands_t *input)
{
// VULKAN

vec4_t xyz[SHADER_MAX_VERTEXES];
memcpy(xyz, tess.xyz, tess.numVertexes * sizeof(vec4_t));
memset(tess.svars.colors, tr.identityLightByte, SHADER_MAX_VERTEXES * sizeof(color4ub_t));

int numVertexes = tess.numVertexes;
int i = 0;
while (i < numVertexes)
{
int count = numVertexes - i;
if (count >= SHADER_MAX_VERTEXES/2 - 1)
count = SHADER_MAX_VERTEXES/2 - 1;

int k;
for (k = 0; k < count; k++)
{
VectorCopy(xyz[i + k], tess.xyz[2*k]);
VectorMA(xyz[i + k], 2, input->normal[i + k], tess.xyz[2*k + 1]);
}
tess.numVertexes = 2 * count;
tess.numIndexes = 0;

uploadShadingData();
updateMVP(backEnd.viewParms.isPortal, backEnd.projection2D, getptr_modelview_matrix());
vk_shade_geometry(g_stdPipelines.normals_debug_pipeline, VK_FALSE, DEPTH_RANGE_ZERO, VK_TRUE);

i += count;
}
}
@@ -0,0 +1,6 @@
#ifndef RB_SHOW_NORMALS_H_
#define RB_SHOW_NORMALS_H_

void RB_DrawNormals (shaderCommands_t *input);

#endif
@@ -0,0 +1,20 @@
#include "RB_DrawTris.h"
#include "tr_globals.h"
#include "vk_shade_geometry.h"
#include "vk_pipelines.h"
#include "tr_backend.h"
/*
================
Draws triangle outlines for debugging
================
*/
void RB_DrawTris (shaderCommands_t *input)
{
updateCurDescriptor( tr.whiteImage->descriptor_set, 0);

// VULKAN

memset(tess.svars.colors, tr.identityLightByte, tess.numVertexes * 4 );
VkPipeline pipeline = backEnd.viewParms.isMirror ? g_stdPipelines.tris_mirror_debug_pipeline : g_stdPipelines.tris_debug_pipeline;
vk_shade_geometry(pipeline, VK_FALSE, DEPTH_RANGE_ZERO, VK_FALSE);
}
@@ -0,0 +1,8 @@
#ifndef RB_DRAWTRIS_H_
#define RB_DRAWTRIS_H_

#include "tr_local.h"
void RB_DrawTris (shaderCommands_t *input);


#endif
Oops, something went wrong.

0 comments on commit 0236133

Please sign in to comment.
You can’t perform that action at this time.