Commit: 7170f7a0414ecded72fba3ef69e28be2be148291
Author: Jeroen Bakker
Date:   Mon Sep 7 08:19:09 2020 +0200
Branches: master
https://developer.blender.org/rB7170f7a0414ecded72fba3ef69e28be2be148291

EEVEE: Shaders tests

This will add the remaining static shaders to the eevee shader test suite.

- Downsampling
- GGX LUT generation
- Mist
- Motion Blur
- Ambient Occlusion
- Render Passes
- Screen Raytracing
- Shadows
- Subsurface
- Volumes

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8779

===================================================================

M       source/blender/draw/engines/eevee/eevee_effects.c
M       source/blender/draw/engines/eevee/eevee_engine.c
M       source/blender/draw/engines/eevee/eevee_lut_gen.c
M       source/blender/draw/engines/eevee/eevee_mist.c
M       source/blender/draw/engines/eevee/eevee_motion_blur.c
M       source/blender/draw/engines/eevee/eevee_occlusion.c
M       source/blender/draw/engines/eevee/eevee_private.h
M       source/blender/draw/engines/eevee/eevee_renderpasses.c
M       source/blender/draw/engines/eevee/eevee_screen_raytrace.c
M       source/blender/draw/engines/eevee/eevee_shaders.c
M       source/blender/draw/engines/eevee/eevee_shadows.c
M       source/blender/draw/engines/eevee/eevee_subsurface.c
M       source/blender/draw/engines/eevee/eevee_temporal_sampling.c
M       source/blender/draw/engines/eevee/eevee_volumes.c
M       source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl
M       source/blender/draw/tests/shaders_test.cc

===================================================================

diff --git a/source/blender/draw/engines/eevee/eevee_effects.c 
b/source/blender/draw/engines/eevee/eevee_effects.c
index a7b067c99d6..2bd1a875371 100644
--- a/source/blender/draw/engines/eevee/eevee_effects.c
+++ b/source/blender/draw/engines/eevee/eevee_effects.c
@@ -33,21 +33,6 @@
 #include "eevee_private.h"
 
 static struct {
-  /* Downsample Depth */
-  struct GPUShader *minz_downlevel_sh;
-  struct GPUShader *maxz_downlevel_sh;
-  struct GPUShader *minz_downdepth_sh;
-  struct GPUShader *maxz_downdepth_sh;
-  struct GPUShader *minz_downdepth_layer_sh;
-  struct GPUShader *maxz_downdepth_layer_sh;
-  struct GPUShader *maxz_copydepth_layer_sh;
-  struct GPUShader *minz_copydepth_sh;
-  struct GPUShader *maxz_copydepth_sh;
-
-  /* Simple Downsample */
-  struct GPUShader *downsample_sh;
-  struct GPUShader *downsample_cube_sh;
-
   /* These are just references, not actually allocated */
   struct GPUTexture *depth_src;
   struct GPUTexture *color_src;
@@ -56,49 +41,6 @@ static struct {
   float cube_texel_size;
 } e_data = {NULL}; /* Engine data */
 
-extern char datatoc_common_uniforms_lib_glsl[];
-extern char datatoc_common_view_lib_glsl[];
-extern char datatoc_bsdf_common_lib_glsl[];
-extern char datatoc_effect_minmaxz_frag_glsl[];
-extern char datatoc_effect_downsample_frag_glsl[];
-extern char datatoc_effect_downsample_cube_frag_glsl[];
-extern char datatoc_lightprobe_vert_glsl[];
-extern char datatoc_lightprobe_geom_glsl[];
-
-static void eevee_create_shader_downsample(void)
-{
-  e_data.downsample_sh = 
DRW_shader_create_fullscreen(datatoc_effect_downsample_frag_glsl, NULL);
-  e_data.downsample_cube_sh = DRW_shader_create(datatoc_lightprobe_vert_glsl,
-                                                datatoc_lightprobe_geom_glsl,
-                                                
datatoc_effect_downsample_cube_frag_glsl,
-                                                NULL);
-
-  e_data.minz_downlevel_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                          "#define 
MIN_PASS\n");
-  e_data.maxz_downlevel_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                          "#define 
MAX_PASS\n");
-  e_data.minz_downdepth_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                          "#define 
MIN_PASS\n");
-  e_data.maxz_downdepth_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                          "#define 
MAX_PASS\n");
-  e_data.minz_downdepth_layer_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                                "#define 
MIN_PASS\n"
-                                                                "#define 
LAYERED\n");
-  e_data.maxz_downdepth_layer_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                                "#define 
MAX_PASS\n"
-                                                                "#define 
LAYERED\n");
-  e_data.maxz_copydepth_layer_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                                "#define 
MAX_PASS\n"
-                                                                "#define 
COPY_DEPTH\n"
-                                                                "#define 
LAYERED\n");
-  e_data.minz_copydepth_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                          "#define MIN_PASS\n"
-                                                          "#define 
COPY_DEPTH\n");
-  e_data.maxz_copydepth_sh = 
DRW_shader_create_fullscreen(datatoc_effect_minmaxz_frag_glsl,
-                                                          "#define MAX_PASS\n"
-                                                          "#define 
COPY_DEPTH\n");
-}
-
 #define SETUP_BUFFER(tex, fb, fb_color) \
   { \
     eGPUTextureFormat format = (DRW_state_is_scene_render()) ? GPU_RGBA32F : 
GPU_RGBA16F; \
@@ -140,11 +82,6 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata,
   const float *viewport_size = DRW_viewport_size_get();
   const int size_fs[2] = {(int)viewport_size[0], (int)viewport_size[1]};
 
-  /* Shaders */
-  if (!e_data.downsample_sh) {
-    eevee_create_shader_downsample();
-  }
-
   if (!stl->effects) {
     stl->effects = MEM_callocN(sizeof(EEVEE_EffectsInfo), "EEVEE_EffectsInfo");
     stl->effects->taa_render_sample = 1;
@@ -284,7 +221,7 @@ void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, 
EEVEE_Data *vedata)
 
   {
     DRW_PASS_CREATE(psl->color_downsample_ps, DRW_STATE_WRITE_COLOR);
-    grp = DRW_shgroup_create(e_data.downsample_sh, psl->color_downsample_ps);
+    grp = DRW_shgroup_create(EEVEE_shaders_effect_downsample_sh_get(), 
psl->color_downsample_ps);
     DRW_shgroup_uniform_texture_ref(grp, "source", &e_data.color_src);
     DRW_shgroup_uniform_float(grp, "fireflyFactor", 
&sldata->common_data.ssr_firefly_fac, 1);
     DRW_shgroup_call(grp, quad, NULL);
@@ -292,7 +229,8 @@ void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, 
EEVEE_Data *vedata)
 
   {
     DRW_PASS_CREATE(psl->color_downsample_cube_ps, DRW_STATE_WRITE_COLOR);
-    grp = DRW_shgroup_create(e_data.downsample_cube_sh, 
psl->color_downsample_cube_ps);
+    grp = DRW_shgroup_create(EEVEE_shaders_effect_downsample_cube_sh_get(),
+                             psl->color_downsample_cube_ps);
     DRW_shgroup_uniform_texture_ref(grp, "source", &e_data.color_src);
     DRW_shgroup_uniform_float(grp, "texelSize", &e_data.cube_texel_size, 1);
     DRW_shgroup_uniform_int_copy(grp, "Layer", 0);
@@ -302,30 +240,32 @@ void EEVEE_effects_cache_init(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *vedata)
   {
     /* Perform min/max downsample */
     DRW_PASS_CREATE(psl->maxz_downlevel_ps, downsample_write | 
DRW_STATE_DEPTH_ALWAYS);
-    grp = DRW_shgroup_create(e_data.maxz_downlevel_sh, psl->maxz_downlevel_ps);
+    grp = DRW_shgroup_create(EEVEE_shaders_effect_maxz_downlevel_sh_get(), 
psl->maxz_downlevel_ps);
     DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &txl->maxzbuffer);
     DRW_shgroup_call(grp, quad, NULL);
 
     /* Copy depth buffer to halfres top level of HiZ */
 
     DRW_PASS_CREATE(psl->maxz_downdepth_ps, downsample_write | 
DRW_STATE_DEPTH_ALWAYS);
-    grp = DRW_shgroup_create(e_data.maxz_downdepth_sh, psl->maxz_downdepth_ps);
+    grp = DRW_shgroup_create(EEVEE_shaders_effect_maxz_downdepth_sh_get(), 
psl->maxz_downdepth_ps);
     DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &e_data.depth_src);
     DRW_shgroup_call(grp, quad, NULL);
 
     DRW_PASS_CREATE(psl->maxz_downdepth_layer_ps, downsample_write | 
DRW_STATE_DEPTH_ALWAYS);
-    grp = DRW_shgroup_create(e_data.maxz_downdepth_layer_sh, 
psl->maxz_downdepth_layer_ps);
+    grp = 
DRW_shgroup_create(EEVEE_shaders_effect_maxz_downdepth_layer_sh_get(),
+                             psl->maxz_downdepth_layer_ps);
     DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &e_data.depth_src);
     DRW_shgroup_uniform_int(grp, "depthLayer", &e_data.depth_src_layer, 1);
     DRW_shgroup_call(grp, quad, NULL);
 
     DRW_PASS_CREATE(psl->maxz_copydepth_ps, downsample_write | 
DRW_STATE_DEPTH_ALWAYS);
-    grp = DRW_shgroup_create(e_data.maxz_copydepth_sh, psl->maxz_copydepth_ps);
+    grp = DRW_shgroup_create(EEVEE_shaders_effect_maxz_copydepth_sh_get(), 
psl->maxz_copydepth_ps);
     DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &e_data.depth_src);
     DRW_shgroup_call(grp, quad, NULL);
 
     DRW_PASS_CREATE(psl->maxz_copydepth_layer_ps, downsample_write | 
DRW_STATE_DEPTH_ALWAYS);
-    grp = DRW_shgroup_create(e_data.maxz_copydepth_layer_sh, 
psl->maxz_copydepth_layer_ps);
+    grp = 
DRW_shgroup_create(EEVEE_shaders_effect_maxz_copydepth_layer_sh_get(),
+                             psl->maxz_copydepth_layer_ps);
     DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &e_data.depth_src);
     DRW_shgroup_uniform_int(grp, "depthLayer", &e_data.depth_src_layer, 1);
     DRW_shgroup_call(grp, quad, NULL);
@@ -584,19 +524,3 @@ void EEVEE_draw_effects(EEVEE_ViewLayerData *sldata, 
EEVEE_Data *vedata)
     stl->g_data->valid_taa_history = (txl->taa_history != NULL);
   }
 }
-
-void EEVEE_effects_free(void)
-{
-  DRW_SHADER_FREE_SAFE(e_data.downsample_sh);
-  DRW_SHADER_FREE_SAFE(e_data.downsample_cube_sh);
-
-  DRW_SHADER_FREE_SAFE(e_data.minz_downlevel_sh);
-  DRW_SHADER_FREE_SAFE(e_data.maxz_downlevel_sh);
-  DRW_SHADER_FREE_SAFE(e_data.minz_downdepth_sh);
-  DRW_SHADER_FREE_SAFE(e_data.maxz_downdepth_sh);
-  DRW_SHADER_FREE_SAFE(e_data.minz_downdepth_layer_sh);
-  DRW_SHADER_FREE_SAFE(e_data.maxz_downdepth_layer_sh);
-  DRW_SHADER_FREE_SAFE(e_data.maxz_copydepth_layer_sh);
-  DRW_SHADER_FREE_SAFE(e_data.minz_copydepth_sh);
-  DRW_SHADER_FREE_SAFE(e_data.maxz_copydepth_sh);
-}
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c 
b/source/blender/draw/engines/eevee/eevee_engine.c
index 0f9f2c184bb..5d5bd7ea9ba 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -571,17 +571,10 @@ static void eevee_render_to_image(void *vedata,
 static void eevee_engine_free(void)
 {
   EEVEE_shaders_free();
-  EEVEE_effects_free();
   EEVEE_lightprobes_free();
-  EEVEE_shadows_free();
   EEVEE_materials_free();
-  EEVEE_mist_free();
-  EEVEE_motion_blur_free();
   EEVEE_occlusion_free();
-  EEVEE_screen_raytrace_free();
-  EEVEE_subsurface_free();
   EEVEE_volumes_free();
-  EEVEE_renderpasses_free();
 }
 
 static const DrawEngineDataSize eevee_data_size = 
DRW_VIEWPORT_DATA_SIZE(EEVEE_Data);
diff --git a/source/blender/draw/engines/eevee/eevee_lut_gen.c 
b/source/blender/draw/engines/eevee/eevee_lut_gen.c
index 9b07a6908c3..b74cb6c7687 100644
--- a/source/blender/draw/engines/eevee/eevee_lut_gen.c
+++ b/source/blender/draw/engines/eevee/eevee_lut_gen.c
@@ -33,13 +33,6 @@
 
 #include "eevee_private.h"
 
-extern char datatoc_bsdf_lut_frag_glsl[];
-extern char datatoc_btdf_lut_frag_glsl[];
-extern char datatoc_bsdf_common_lib

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to