diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_bloom.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_bloom.c | 64 |
1 files changed, 6 insertions, 58 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_bloom.c b/source/blender/draw/engines/eevee/eevee_bloom.c index 8fd953478d5..9b8f7ddab0c 100644 --- a/source/blender/draw/engines/eevee/eevee_bloom.c +++ b/source/blender/draw/engines/eevee/eevee_bloom.c @@ -30,45 +30,8 @@ #include "eevee_private.h" -static struct { - /* Bloom */ - struct GPUShader *bloom_blit_sh[2]; - struct GPUShader *bloom_downsample_sh[2]; - struct GPUShader *bloom_upsample_sh[2]; - struct GPUShader *bloom_resolve_sh[2]; -} e_data = {{NULL}}; /* Engine data */ - -extern char datatoc_effect_bloom_frag_glsl[]; - static const bool use_highres = true; -static void eevee_create_shader_bloom(void) -{ - e_data.bloom_blit_sh[0] = DRW_shader_create_fullscreen(datatoc_effect_bloom_frag_glsl, - "#define STEP_BLIT\n"); - e_data.bloom_blit_sh[1] = DRW_shader_create_fullscreen(datatoc_effect_bloom_frag_glsl, - "#define STEP_BLIT\n" - "#define HIGH_QUALITY\n"); - - e_data.bloom_downsample_sh[0] = DRW_shader_create_fullscreen(datatoc_effect_bloom_frag_glsl, - "#define STEP_DOWNSAMPLE\n"); - e_data.bloom_downsample_sh[1] = DRW_shader_create_fullscreen(datatoc_effect_bloom_frag_glsl, - "#define STEP_DOWNSAMPLE\n" - "#define HIGH_QUALITY\n"); - - e_data.bloom_upsample_sh[0] = DRW_shader_create_fullscreen(datatoc_effect_bloom_frag_glsl, - "#define STEP_UPSAMPLE\n"); - e_data.bloom_upsample_sh[1] = DRW_shader_create_fullscreen(datatoc_effect_bloom_frag_glsl, - "#define STEP_UPSAMPLE\n" - "#define HIGH_QUALITY\n"); - - e_data.bloom_resolve_sh[0] = DRW_shader_create_fullscreen(datatoc_effect_bloom_frag_glsl, - "#define STEP_RESOLVE\n"); - e_data.bloom_resolve_sh[1] = DRW_shader_create_fullscreen(datatoc_effect_bloom_frag_glsl, - "#define STEP_RESOLVE\n" - "#define HIGH_QUALITY\n"); -} - int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) { EEVEE_StorageList *stl = vedata->stl; @@ -81,11 +44,6 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) if (scene_eval->eevee.flag & SCE_EEVEE_BLOOM_ENABLED) { const float *viewport_size = DRW_viewport_size_get(); - /* Shaders */ - if (!e_data.bloom_blit_sh[0]) { - eevee_create_shader_bloom(); - } - /* Bloom */ int blitsize[2], texsize[2]; @@ -246,26 +204,26 @@ void EEVEE_bloom_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *ved const bool use_antiflicker = true; eevee_create_bloom_pass("Bloom Downsample First", effects, - e_data.bloom_downsample_sh[use_antiflicker], + EEVEE_shaders_bloom_downsample_get(use_antiflicker), &psl->bloom_downsample_first, false, false); eevee_create_bloom_pass("Bloom Downsample", effects, - e_data.bloom_downsample_sh[0], + EEVEE_shaders_bloom_downsample_get(false), &psl->bloom_downsample, false, false); eevee_create_bloom_pass("Bloom Upsample", effects, - e_data.bloom_upsample_sh[use_highres], + EEVEE_shaders_bloom_upsample_get(use_highres), &psl->bloom_upsample, true, false); grp = eevee_create_bloom_pass("Bloom Blit", effects, - e_data.bloom_blit_sh[use_antiflicker], + EEVEE_shaders_bloom_blit_get(use_antiflicker), &psl->bloom_blit, false, false); @@ -274,7 +232,7 @@ void EEVEE_bloom_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *ved grp = eevee_create_bloom_pass("Bloom Resolve", effects, - e_data.bloom_resolve_sh[use_highres], + EEVEE_shaders_bloom_resolve_get(use_highres), &psl->bloom_resolve, true, true); @@ -362,7 +320,7 @@ void EEVEE_bloom_output_init(EEVEE_ViewLayerData *UNUSED(sldata), /* Create Pass and shgroup. */ DRWShadingGroup *grp = eevee_create_bloom_pass("Bloom Accumulate", effects, - e_data.bloom_resolve_sh[use_highres], + EEVEE_shaders_bloom_resolve_get(use_highres), &psl->bloom_accum_ps, true, true); @@ -383,13 +341,3 @@ void EEVEE_bloom_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Da GPU_framebuffer_bind(fbl->main_fb); } } - -void EEVEE_bloom_free(void) -{ - for (int i = 0; i < 2; i++) { - DRW_SHADER_FREE_SAFE(e_data.bloom_blit_sh[i]); - DRW_SHADER_FREE_SAFE(e_data.bloom_downsample_sh[i]); - DRW_SHADER_FREE_SAFE(e_data.bloom_upsample_sh[i]); - DRW_SHADER_FREE_SAFE(e_data.bloom_resolve_sh[i]); - } -} |