Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement initial cascaded shadow mapping support #3307

Merged
merged 41 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2def063
Update terrain_combined_high.frag
past-due Jul 15, 2023
78a6921
piematrix: Add separate method to get UI perspective matrix
past-due Jun 30, 2023
c9dbb08
New depth-only shaders for terrain and meshes
past-due Jun 30, 2023
993f44a
Split up terrain updates and drawing, prepare for passing in shadowMVP
past-due Jun 30, 2023
40c92af
Add terrain depth-only PSO
past-due Jun 30, 2023
db84e11
Prep-work for multi-pass mesh rendering, and passing in shadowMVP
past-due Jun 30, 2023
1253b99
Add shadow mapping cascade calculation, draw basic shadow mapping pas…
past-due Jul 1, 2023
5af8a3c
Use shadow / depth map in terrain and tcmask shaders
past-due Jul 1, 2023
0519d0f
Adjust MIN_PLAYER_X_ANGLE slightly to avoid visual flickering on stru…
past-due Jul 1, 2023
b9a2055
[OpenGL] Performance improvement when skipping extra shadow taps
past-due Jul 2, 2023
168a7d5
gfx_api: Always store pipeline creation info
past-due Jul 2, 2023
69b1feb
gfx_api: Add setExtraShadowTaps, rebuild of pipelines that use this v…
past-due Jul 2, 2023
8f9db59
gfx_api: Add sampler_type::bilinear_border
past-due Jul 2, 2023
6a678c2
Improve shadow toggling (with new shadow mapping)
past-due Jul 7, 2023
d1b0c99
[Vulkan] Performance improvement when skipping extra shadow taps
past-due Jul 9, 2023
1357532
Clean up Draw3DShapeDepthOnly_Instanced
past-due Jul 9, 2023
6811537
calculateShadowCascades: Tweak view and projection matrix
past-due Jul 9, 2023
feed19e
Use texture array for shadow map, implement basic cascades
past-due Jul 9, 2023
203fbb6
Use bilinear_border instead of nearest_border for depth_map sampler
past-due Jul 9, 2023
7be7a6e
shadowcascades.cpp: Adjust calculations
past-due Jul 9, 2023
0499fd3
[OpenGL] glad: Add gpu meminfo extensions
past-due Jul 13, 2023
fc415f2
[OpenGL] Basic #include directive support in shaders
past-due Jul 15, 2023
fbf02a7
Add shadow mapping config options, use Optimized PCF algorithm
past-due Jul 15, 2023
e6c6a91
Improve shadow setup init, handling lack of shadow mapping support
past-due Jul 15, 2023
cb54a05
gfx_api: Clean-up
past-due Jul 15, 2023
b9361bb
Improve determining default depth buffer resolution
past-due Jul 15, 2023
fe76222
configuration.cpp: Store / load new shadow settings
past-due Jul 15, 2023
9716d7a
[OpenGL] Minor tweaks
past-due Jul 15, 2023
0ea9e59
Fix shadows on structure baseplates (when using instanced rendering +…
past-due Jul 16, 2023
9a41c58
[OpenGL] Improve default precision specifiers for OpenGL ES
past-due Jul 17, 2023
eb4d389
[OpenGL] Improve getSuggestedDefaultDepthBufferResolution()
past-due Jul 17, 2023
13567d6
[OpenGL] Create default depth texture
past-due Jul 17, 2023
a855ef9
[OpenGL] Fix shader OpenGL ES compatibility
past-due Jul 17, 2023
3cbad39
[OpenGL] Adjust default depth texture
past-due Jul 17, 2023
ca45cbe
Re-order Graphics Options menu items
past-due Jul 17, 2023
0b88d48
Fix MSVC compiler warning
past-due Jul 17, 2023
4d6fd1c
piematrix.cpp: Partially revert default perspectiveZFar reduction
past-due Aug 18, 2023
4e61802
drawShape: Pass timeAnimationStarted instead of BASE_OBJECT
past-due Aug 21, 2023
cbc53e7
Handle droid dying animations as effects
past-due Aug 21, 2023
3e86b4b
Support velocity for droid dying animation effect
past-due Aug 21, 2023
01fc15b
[Vulkan] Handle DeviceLostError in acquireNextSwapchainImage
past-due Aug 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions 3rdparty/glad/include/glad/glad.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*

OpenGL, OpenGL ES loader generated by glad 0.1.34 on Wed Jun 21 22:44:30 2023.
OpenGL, OpenGL ES loader generated by glad 0.1.34 on Thu Jul 13 01:28:17 2023.

Language/Generator: C/C++
Specification: gl
Expand All @@ -25,6 +25,7 @@
GL_ARB_texture_rg,
GL_ARB_timer_query,
GL_ARB_vertex_buffer_object,
GL_ATI_meminfo,
GL_ATI_separate_stencil,
GL_EXT_discard_framebuffer,
GL_EXT_framebuffer_object,
Expand All @@ -41,6 +42,7 @@
GL_GREMEDY_string_marker,
GL_KHR_debug,
GL_KHR_texture_compression_astc_ldr,
GL_NVX_gpu_memory_info,
GL_NV_instanced_arrays,
GL_OES_compressed_ETC1_RGB8_texture
Loader: True
Expand All @@ -49,9 +51,9 @@
Reproducible: False

Commandline:
--profile="core" --api="gl=3.3,gles2=3.0" --generator="c" --spec="gl" --extensions="GL_ANGLE_instanced_arrays,GL_ANGLE_texture_compression_dxt3,GL_ANGLE_texture_compression_dxt5,GL_ARB_ES3_compatibility,GL_ARB_draw_instanced,GL_ARB_instanced_arrays,GL_ARB_internalformat_query,GL_ARB_internalformat_query2,GL_ARB_invalidate_subdata,GL_ARB_texture_compression,GL_ARB_texture_compression_bptc,GL_ARB_texture_compression_rgtc,GL_ARB_texture_cube_map,GL_ARB_texture_non_power_of_two,GL_ARB_texture_rectangle,GL_ARB_texture_rg,GL_ARB_timer_query,GL_ARB_vertex_buffer_object,GL_ATI_separate_stencil,GL_EXT_discard_framebuffer,GL_EXT_framebuffer_object,GL_EXT_instanced_arrays,GL_EXT_multisampled_render_to_texture,GL_EXT_stencil_two_side,GL_EXT_stencil_wrap,GL_EXT_texture_array,GL_EXT_texture_compression_bptc,GL_EXT_texture_compression_dxt1,GL_EXT_texture_compression_s3tc,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_rg,GL_GREMEDY_string_marker,GL_KHR_debug,GL_KHR_texture_compression_astc_ldr,GL_NV_instanced_arrays,GL_OES_compressed_ETC1_RGB8_texture"
--profile="core" --api="gl=3.3,gles2=3.0" --generator="c" --spec="gl" --extensions="GL_ANGLE_instanced_arrays,GL_ANGLE_texture_compression_dxt3,GL_ANGLE_texture_compression_dxt5,GL_ARB_ES3_compatibility,GL_ARB_draw_instanced,GL_ARB_instanced_arrays,GL_ARB_internalformat_query,GL_ARB_internalformat_query2,GL_ARB_invalidate_subdata,GL_ARB_texture_compression,GL_ARB_texture_compression_bptc,GL_ARB_texture_compression_rgtc,GL_ARB_texture_cube_map,GL_ARB_texture_non_power_of_two,GL_ARB_texture_rectangle,GL_ARB_texture_rg,GL_ARB_timer_query,GL_ARB_vertex_buffer_object,GL_ATI_meminfo,GL_ATI_separate_stencil,GL_EXT_discard_framebuffer,GL_EXT_framebuffer_object,GL_EXT_instanced_arrays,GL_EXT_multisampled_render_to_texture,GL_EXT_stencil_two_side,GL_EXT_stencil_wrap,GL_EXT_texture_array,GL_EXT_texture_compression_bptc,GL_EXT_texture_compression_dxt1,GL_EXT_texture_compression_s3tc,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_rg,GL_GREMEDY_string_marker,GL_KHR_debug,GL_KHR_texture_compression_astc_ldr,GL_NVX_gpu_memory_info,GL_NV_instanced_arrays,GL_OES_compressed_ETC1_RGB8_texture"
Online:
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&api=gles2%3D3.0&extensions=GL_ANGLE_instanced_arrays&extensions=GL_ANGLE_texture_compression_dxt3&extensions=GL_ANGLE_texture_compression_dxt5&extensions=GL_ARB_ES3_compatibility&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_internalformat_query&extensions=GL_ARB_internalformat_query2&extensions=GL_ARB_invalidate_subdata&extensions=GL_ARB_texture_compression&extensions=GL_ARB_texture_compression_bptc&extensions=GL_ARB_texture_compression_rgtc&extensions=GL_ARB_texture_cube_map&extensions=GL_ARB_texture_non_power_of_two&extensions=GL_ARB_texture_rectangle&extensions=GL_ARB_texture_rg&extensions=GL_ARB_timer_query&extensions=GL_ARB_vertex_buffer_object&extensions=GL_ATI_separate_stencil&extensions=GL_EXT_discard_framebuffer&extensions=GL_EXT_framebuffer_object&extensions=GL_EXT_instanced_arrays&extensions=GL_EXT_multisampled_render_to_texture&extensions=GL_EXT_stencil_two_side&extensions=GL_EXT_stencil_wrap&extensions=GL_EXT_texture_array&extensions=GL_EXT_texture_compression_bptc&extensions=GL_EXT_texture_compression_dxt1&extensions=GL_EXT_texture_compression_s3tc&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_EXT_texture_rg&extensions=GL_GREMEDY_string_marker&extensions=GL_KHR_debug&extensions=GL_KHR_texture_compression_astc_ldr&extensions=GL_NV_instanced_arrays&extensions=GL_OES_compressed_ETC1_RGB8_texture
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&api=gles2%3D3.0&extensions=GL_ANGLE_instanced_arrays&extensions=GL_ANGLE_texture_compression_dxt3&extensions=GL_ANGLE_texture_compression_dxt5&extensions=GL_ARB_ES3_compatibility&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_internalformat_query&extensions=GL_ARB_internalformat_query2&extensions=GL_ARB_invalidate_subdata&extensions=GL_ARB_texture_compression&extensions=GL_ARB_texture_compression_bptc&extensions=GL_ARB_texture_compression_rgtc&extensions=GL_ARB_texture_cube_map&extensions=GL_ARB_texture_non_power_of_two&extensions=GL_ARB_texture_rectangle&extensions=GL_ARB_texture_rg&extensions=GL_ARB_timer_query&extensions=GL_ARB_vertex_buffer_object&extensions=GL_ATI_meminfo&extensions=GL_ATI_separate_stencil&extensions=GL_EXT_discard_framebuffer&extensions=GL_EXT_framebuffer_object&extensions=GL_EXT_instanced_arrays&extensions=GL_EXT_multisampled_render_to_texture&extensions=GL_EXT_stencil_two_side&extensions=GL_EXT_stencil_wrap&extensions=GL_EXT_texture_array&extensions=GL_EXT_texture_compression_bptc&extensions=GL_EXT_texture_compression_dxt1&extensions=GL_EXT_texture_compression_s3tc&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_EXT_texture_rg&extensions=GL_GREMEDY_string_marker&extensions=GL_KHR_debug&extensions=GL_KHR_texture_compression_astc_ldr&extensions=GL_NVX_gpu_memory_info&extensions=GL_NV_instanced_arrays&extensions=GL_OES_compressed_ETC1_RGB8_texture
*/


Expand Down Expand Up @@ -2469,6 +2471,9 @@ GLAPI PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ;
#define GL_DYNAMIC_DRAW_ARB 0x88E8
#define GL_DYNAMIC_READ_ARB 0x88E9
#define GL_DYNAMIC_COPY_ARB 0x88EA
#define GL_VBO_FREE_MEMORY_ATI 0x87FB
#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
#define GL_STENCIL_BACK_FUNC_ATI 0x8800
#define GL_STENCIL_BACK_FAIL_ATI 0x8801
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802
Expand Down Expand Up @@ -2652,6 +2657,11 @@ GLAPI PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ;
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
Expand Down Expand Up @@ -2811,6 +2821,10 @@ typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC)(GLenum target, GLenum pna
GLAPI PFNGLGETBUFFERPOINTERVARBPROC glad_glGetBufferPointervARB;
#define glGetBufferPointervARB glad_glGetBufferPointervARB
#endif
#ifndef GL_ATI_meminfo
#define GL_ATI_meminfo 1
GLAPI int GLAD_GL_ATI_meminfo;
#endif
#ifndef GL_ATI_separate_stencil
#define GL_ATI_separate_stencil 1
GLAPI int GLAD_GL_ATI_separate_stencil;
Expand Down Expand Up @@ -2983,6 +2997,10 @@ GLAPI PFNGLGETPOINTERVKHRPROC glad_glGetPointervKHR;
#define GL_KHR_texture_compression_astc_ldr 1
GLAPI int GLAD_GL_KHR_texture_compression_astc_ldr;
#endif
#ifndef GL_NVX_gpu_memory_info
#define GL_NVX_gpu_memory_info 1
GLAPI int GLAD_GL_NVX_gpu_memory_info;
#endif
#ifndef GL_ANGLE_instanced_arrays
#define GL_ANGLE_instanced_arrays 1
GLAPI int GLAD_GL_ANGLE_instanced_arrays;
Expand Down
12 changes: 9 additions & 3 deletions 3rdparty/glad/src/glad.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*

OpenGL, OpenGL ES loader generated by glad 0.1.34 on Wed Jun 21 22:44:30 2023.
OpenGL, OpenGL ES loader generated by glad 0.1.34 on Thu Jul 13 01:28:17 2023.

Language/Generator: C/C++
Specification: gl
Expand All @@ -25,6 +25,7 @@
GL_ARB_texture_rg,
GL_ARB_timer_query,
GL_ARB_vertex_buffer_object,
GL_ATI_meminfo,
GL_ATI_separate_stencil,
GL_EXT_discard_framebuffer,
GL_EXT_framebuffer_object,
Expand All @@ -41,6 +42,7 @@
GL_GREMEDY_string_marker,
GL_KHR_debug,
GL_KHR_texture_compression_astc_ldr,
GL_NVX_gpu_memory_info,
GL_NV_instanced_arrays,
GL_OES_compressed_ETC1_RGB8_texture
Loader: True
Expand All @@ -49,9 +51,9 @@
Reproducible: False

Commandline:
--profile="core" --api="gl=3.3,gles2=3.0" --generator="c" --spec="gl" --extensions="GL_ANGLE_instanced_arrays,GL_ANGLE_texture_compression_dxt3,GL_ANGLE_texture_compression_dxt5,GL_ARB_ES3_compatibility,GL_ARB_draw_instanced,GL_ARB_instanced_arrays,GL_ARB_internalformat_query,GL_ARB_internalformat_query2,GL_ARB_invalidate_subdata,GL_ARB_texture_compression,GL_ARB_texture_compression_bptc,GL_ARB_texture_compression_rgtc,GL_ARB_texture_cube_map,GL_ARB_texture_non_power_of_two,GL_ARB_texture_rectangle,GL_ARB_texture_rg,GL_ARB_timer_query,GL_ARB_vertex_buffer_object,GL_ATI_separate_stencil,GL_EXT_discard_framebuffer,GL_EXT_framebuffer_object,GL_EXT_instanced_arrays,GL_EXT_multisampled_render_to_texture,GL_EXT_stencil_two_side,GL_EXT_stencil_wrap,GL_EXT_texture_array,GL_EXT_texture_compression_bptc,GL_EXT_texture_compression_dxt1,GL_EXT_texture_compression_s3tc,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_rg,GL_GREMEDY_string_marker,GL_KHR_debug,GL_KHR_texture_compression_astc_ldr,GL_NV_instanced_arrays,GL_OES_compressed_ETC1_RGB8_texture"
--profile="core" --api="gl=3.3,gles2=3.0" --generator="c" --spec="gl" --extensions="GL_ANGLE_instanced_arrays,GL_ANGLE_texture_compression_dxt3,GL_ANGLE_texture_compression_dxt5,GL_ARB_ES3_compatibility,GL_ARB_draw_instanced,GL_ARB_instanced_arrays,GL_ARB_internalformat_query,GL_ARB_internalformat_query2,GL_ARB_invalidate_subdata,GL_ARB_texture_compression,GL_ARB_texture_compression_bptc,GL_ARB_texture_compression_rgtc,GL_ARB_texture_cube_map,GL_ARB_texture_non_power_of_two,GL_ARB_texture_rectangle,GL_ARB_texture_rg,GL_ARB_timer_query,GL_ARB_vertex_buffer_object,GL_ATI_meminfo,GL_ATI_separate_stencil,GL_EXT_discard_framebuffer,GL_EXT_framebuffer_object,GL_EXT_instanced_arrays,GL_EXT_multisampled_render_to_texture,GL_EXT_stencil_two_side,GL_EXT_stencil_wrap,GL_EXT_texture_array,GL_EXT_texture_compression_bptc,GL_EXT_texture_compression_dxt1,GL_EXT_texture_compression_s3tc,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_rg,GL_GREMEDY_string_marker,GL_KHR_debug,GL_KHR_texture_compression_astc_ldr,GL_NVX_gpu_memory_info,GL_NV_instanced_arrays,GL_OES_compressed_ETC1_RGB8_texture"
Online:
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&api=gles2%3D3.0&extensions=GL_ANGLE_instanced_arrays&extensions=GL_ANGLE_texture_compression_dxt3&extensions=GL_ANGLE_texture_compression_dxt5&extensions=GL_ARB_ES3_compatibility&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_internalformat_query&extensions=GL_ARB_internalformat_query2&extensions=GL_ARB_invalidate_subdata&extensions=GL_ARB_texture_compression&extensions=GL_ARB_texture_compression_bptc&extensions=GL_ARB_texture_compression_rgtc&extensions=GL_ARB_texture_cube_map&extensions=GL_ARB_texture_non_power_of_two&extensions=GL_ARB_texture_rectangle&extensions=GL_ARB_texture_rg&extensions=GL_ARB_timer_query&extensions=GL_ARB_vertex_buffer_object&extensions=GL_ATI_separate_stencil&extensions=GL_EXT_discard_framebuffer&extensions=GL_EXT_framebuffer_object&extensions=GL_EXT_instanced_arrays&extensions=GL_EXT_multisampled_render_to_texture&extensions=GL_EXT_stencil_two_side&extensions=GL_EXT_stencil_wrap&extensions=GL_EXT_texture_array&extensions=GL_EXT_texture_compression_bptc&extensions=GL_EXT_texture_compression_dxt1&extensions=GL_EXT_texture_compression_s3tc&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_EXT_texture_rg&extensions=GL_GREMEDY_string_marker&extensions=GL_KHR_debug&extensions=GL_KHR_texture_compression_astc_ldr&extensions=GL_NV_instanced_arrays&extensions=GL_OES_compressed_ETC1_RGB8_texture
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&api=gles2%3D3.0&extensions=GL_ANGLE_instanced_arrays&extensions=GL_ANGLE_texture_compression_dxt3&extensions=GL_ANGLE_texture_compression_dxt5&extensions=GL_ARB_ES3_compatibility&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_internalformat_query&extensions=GL_ARB_internalformat_query2&extensions=GL_ARB_invalidate_subdata&extensions=GL_ARB_texture_compression&extensions=GL_ARB_texture_compression_bptc&extensions=GL_ARB_texture_compression_rgtc&extensions=GL_ARB_texture_cube_map&extensions=GL_ARB_texture_non_power_of_two&extensions=GL_ARB_texture_rectangle&extensions=GL_ARB_texture_rg&extensions=GL_ARB_timer_query&extensions=GL_ARB_vertex_buffer_object&extensions=GL_ATI_meminfo&extensions=GL_ATI_separate_stencil&extensions=GL_EXT_discard_framebuffer&extensions=GL_EXT_framebuffer_object&extensions=GL_EXT_instanced_arrays&extensions=GL_EXT_multisampled_render_to_texture&extensions=GL_EXT_stencil_two_side&extensions=GL_EXT_stencil_wrap&extensions=GL_EXT_texture_array&extensions=GL_EXT_texture_compression_bptc&extensions=GL_EXT_texture_compression_dxt1&extensions=GL_EXT_texture_compression_s3tc&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_EXT_texture_rg&extensions=GL_GREMEDY_string_marker&extensions=GL_KHR_debug&extensions=GL_KHR_texture_compression_astc_ldr&extensions=GL_NVX_gpu_memory_info&extensions=GL_NV_instanced_arrays&extensions=GL_OES_compressed_ETC1_RGB8_texture
*/

#include <stdio.h>
Expand Down Expand Up @@ -715,6 +717,7 @@ int GLAD_GL_ARB_texture_rectangle = 0;
int GLAD_GL_ARB_texture_rg = 0;
int GLAD_GL_ARB_timer_query = 0;
int GLAD_GL_ARB_vertex_buffer_object = 0;
int GLAD_GL_ATI_meminfo = 0;
int GLAD_GL_ATI_separate_stencil = 0;
int GLAD_GL_EXT_discard_framebuffer = 0;
int GLAD_GL_EXT_framebuffer_object = 0;
Expand All @@ -731,6 +734,7 @@ int GLAD_GL_EXT_texture_rg = 0;
int GLAD_GL_GREMEDY_string_marker = 0;
int GLAD_GL_KHR_debug = 0;
int GLAD_GL_KHR_texture_compression_astc_ldr = 0;
int GLAD_GL_NVX_gpu_memory_info = 0;
int GLAD_GL_NV_instanced_arrays = 0;
int GLAD_GL_OES_compressed_ETC1_RGB8_texture = 0;
PFNGLDRAWARRAYSINSTANCEDARBPROC glad_glDrawArraysInstancedARB = NULL;
Expand Down Expand Up @@ -1361,6 +1365,7 @@ static int find_extensionsGL(void) {
GLAD_GL_ARB_texture_rg = has_ext("GL_ARB_texture_rg");
GLAD_GL_ARB_timer_query = has_ext("GL_ARB_timer_query");
GLAD_GL_ARB_vertex_buffer_object = has_ext("GL_ARB_vertex_buffer_object");
GLAD_GL_ATI_meminfo = has_ext("GL_ATI_meminfo");
GLAD_GL_ATI_separate_stencil = has_ext("GL_ATI_separate_stencil");
GLAD_GL_EXT_framebuffer_object = has_ext("GL_EXT_framebuffer_object");
GLAD_GL_EXT_stencil_two_side = has_ext("GL_EXT_stencil_two_side");
Expand All @@ -1371,6 +1376,7 @@ static int find_extensionsGL(void) {
GLAD_GL_GREMEDY_string_marker = has_ext("GL_GREMEDY_string_marker");
GLAD_GL_KHR_debug = has_ext("GL_KHR_debug");
GLAD_GL_KHR_texture_compression_astc_ldr = has_ext("GL_KHR_texture_compression_astc_ldr");
GLAD_GL_NVX_gpu_memory_info = has_ext("GL_NVX_gpu_memory_info");
free_exts();
return 1;
}
Expand Down
4 changes: 4 additions & 0 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ file(GLOB VK_SHADERS
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_combined.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_depth.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_depth_only.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_water.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_water_classic.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/decals.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/nolight.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/nolight_instanced.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/tcmask.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/tcmask_instanced.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/tcmask_depth_instanced.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/skybox.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/rect.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/rect_instanced.frag"
Expand All @@ -43,13 +45,15 @@ file(GLOB VK_SHADERS
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_combined_medium.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_combined_high.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terraindepth.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_depth_only.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/water.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/terrain_water_classic.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/decals.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/nolight.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/nolight_instanced.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/tcmask.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/tcmask_instanced.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/tcmask_depth_instanced.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/skybox.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/quad_texture2d.vert"
"${CMAKE_CURRENT_SOURCE_DIR}/base/shaders/vk/quad_texture2d.frag"
Expand Down
15 changes: 15 additions & 0 deletions data/base/shaders/tcmask_depth_instanced.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Version directive is set by Warzone when loading the shader
// (This shader supports GLSL 1.20 - 1.50 core.)

//#pragma debug(on)

//#ifdef NEWGL
//out vec4 FragColor;
//#else
//// Uses gl_FragColor
//#endif

void main()
{
// gl_FragDepth = gl_FragCoord.z;
}
55 changes: 55 additions & 0 deletions data/base/shaders/tcmask_depth_instanced.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Version directive is set by Warzone when loading the shader
// (This shader supports GLSL 1.20 - 1.50 core.)

//#pragma debug(on)

#if (!defined(GL_ES) && (__VERSION__ >= 130)) || (defined(GL_ES) && (__VERSION__ >= 300))
#define NEWGL
#endif

#if !defined(NEWGL) && defined(GL_EXT_gpu_shader4)
#extension GL_EXT_gpu_shader4 : enable
#endif

uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;

#if defined(NEWGL) || defined(GL_EXT_gpu_shader4)
#define intMod(a, b) a % b
#else
#define intMod(a, b) floor((a - floor((a + 0.5) / b) * b) + 0.5)
#endif

#ifdef NEWGL
#define VERTEX_INPUT in
#define VERTEX_OUTPUT out
#else
#define VERTEX_INPUT attribute
#define VERTEX_OUTPUT varying
#endif

VERTEX_INPUT vec4 vertex;
VERTEX_INPUT vec3 vertexNormal;
VERTEX_INPUT mat4 instanceModelMatrix;
VERTEX_INPUT vec4 instancePackedValues; // shaderStretch_ecmState_alphaTest_animFrameNumber
VERTEX_INPUT vec4 instanceColour;
VERTEX_INPUT vec4 instanceTeamColour;

void main()
{
// unpack inputs
mat4 ModelViewMatrix = ViewMatrix * instanceModelMatrix;
float stretch = instancePackedValues.x;

// Implement building stretching to accommodate terrain
vec4 position = vertex;
if (vertex.y <= 0.0) // use vertex here directly to help shader compiler optimization
{
position.y -= stretch;
}

// Translate every vertex according to the Model View and Projection Matrix
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ModelViewMatrix;
vec4 gposition = ModelViewProjectionMatrix * position;
gl_Position = gposition;
}
Loading
Loading