diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-03-04 13:59:49 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-03-08 19:25:16 +0300 |
commit | ba75ea8012084aa84ba8c9ac088b88a8dcf4fb21 (patch) | |
tree | 32610751177961885185afee8f4c4773ccda4ced /source/blender/draw/engines/eevee/eevee_shaders.c | |
parent | 6afe2d373a00a49a7a51cafec50d03ada0fe0743 (diff) |
EEVEE: Use Fullscreen maxZBuffer instead of halfres
This removes the need for per mipmap scalling factor and trilinear interpolation
issues. We pad the texture so that all mipmaps have pixels in the next mip.
This simplifies the downsampling shader too.
This also change the SSR radiance buffer as well in the same fashion.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_shaders.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_shaders.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_shaders.c b/source/blender/draw/engines/eevee/eevee_shaders.c index a3e9236dc79..74c4803928a 100644 --- a/source/blender/draw/engines/eevee/eevee_shaders.c +++ b/source/blender/draw/engines/eevee/eevee_shaders.c @@ -103,7 +103,8 @@ static struct { struct GPUShader *minz_copydepth_sh; struct GPUShader *maxz_copydepth_sh; - /* Simple Down-sample */ + /* Simple Down-sample. */ + struct GPUShader *color_copy_sh; struct GPUShader *downsample_sh; struct GPUShader *downsample_cube_sh; @@ -452,10 +453,20 @@ GPUShader *EEVEE_shaders_probe_planar_display_sh_get(void) /** \name Down-sampling * \{ */ +GPUShader *EEVEE_shaders_effect_color_copy_sh_get(void) +{ + if (e_data.color_copy_sh == NULL) { + e_data.color_copy_sh = DRW_shader_create_fullscreen_with_shaderlib( + datatoc_effect_downsample_frag_glsl, e_data.lib, "#define COPY_SRC\n"); + } + return e_data.color_copy_sh; +} + GPUShader *EEVEE_shaders_effect_downsample_sh_get(void) { if (e_data.downsample_sh == NULL) { - e_data.downsample_sh = DRW_shader_create_fullscreen(datatoc_effect_downsample_frag_glsl, NULL); + e_data.downsample_sh = DRW_shader_create_fullscreen_with_shaderlib( + datatoc_effect_downsample_frag_glsl, e_data.lib, NULL); } return e_data.downsample_sh; } @@ -1537,6 +1548,7 @@ void EEVEE_shaders_free(void) MEM_SAFE_FREE(e_data.surface_geom_barycentric); DRW_SHADER_FREE_SAFE(e_data.lookdev_background); DRW_SHADER_FREE_SAFE(e_data.update_noise_sh); + DRW_SHADER_FREE_SAFE(e_data.color_copy_sh); 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); |