diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-28 00:21:39 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-28 15:22:22 +0300 |
commit | e0c1116ce3dfef8415b7a975e82cd1506383ed9c (patch) | |
tree | 5e1aac7b4ed95890e8025ef28ef8147338eeb861 /source/blender/draw/engines | |
parent | 2e211d099f8d13b79cdf9057f77532c587311c3d (diff) |
Cleanup: DRW: Rename DRW_STATE_BLEND_* for API clarity
Diffstat (limited to 'source/blender/draw/engines')
13 files changed, 31 insertions, 28 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index c14f08857c3..4675901b952 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -204,7 +204,7 @@ void EEVEE_depth_of_field_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_ DRW_shgroup_uniform_vec2(grp, "dofParams", effects->dof_params, 1); DRW_shgroup_call(grp, quad, NULL); - DRW_PASS_CREATE(psl->dof_scatter, DRW_STATE_WRITE_COLOR | DRW_STATE_ADDITIVE_FULL); + DRW_PASS_CREATE(psl->dof_scatter, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL); /* This create an empty batch of N triangles to be positioned * by the vertex shader 0.4ms against 6ms with instancing */ diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 8b176f8e5b2..cddef0c77d6 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -344,7 +344,8 @@ void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) copy_v4_fl4(effects->color_checker_dark, 0.15f, 0.15f, 0.15f, 1.0f); copy_v4_fl4(effects->color_checker_light, 0.2f, 0.2f, 0.2f, 1.0f); - DRW_PASS_CREATE(psl->alpha_checker, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_PREMUL_UNDER); + DRW_PASS_CREATE(psl->alpha_checker, + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_UNDER_PREMUL); grp = DRW_shgroup_create(checker_sh, psl->alpha_checker); DRW_shgroup_uniform_vec4(grp, "color1", effects->color_checker_dark, 1); DRW_shgroup_uniform_vec4(grp, "color2", effects->color_checker_light, 1); diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 456f312f1df..cd75cce89a9 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -1476,8 +1476,8 @@ static void material_transparent(Material *ma, const bool use_prepass = ((ma->blend_flag & MA_BL_HIDE_BACKFACE) != 0); DRWState all_state = (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_CULL_BACK | - DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND | - DRW_STATE_ADDITIVE | DRW_STATE_MULTIPLY); + DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_DEPTH_EQUAL | + DRW_STATE_BLEND_ALPHA | DRW_STATE_BLEND_ADD | DRW_STATE_BLEND_MUL); DRWState cur_state = DRW_STATE_WRITE_COLOR; cur_state |= (use_prepass) ? DRW_STATE_DEPTH_EQUAL : DRW_STATE_DEPTH_LESS_EQUAL; @@ -1485,13 +1485,13 @@ static void material_transparent(Material *ma, switch (ma->blend_method) { case MA_BM_ADD: - cur_state |= DRW_STATE_ADDITIVE; + cur_state |= DRW_STATE_BLEND_ADD; break; case MA_BM_MULTIPLY: - cur_state |= DRW_STATE_MULTIPLY; + cur_state |= DRW_STATE_BLEND_MUL; break; case MA_BM_BLEND: - cur_state |= DRW_STATE_BLEND; + cur_state |= DRW_STATE_BLEND_ALPHA; break; default: BLI_assert(0); diff --git a/source/blender/draw/engines/eevee/eevee_mist.c b/source/blender/draw/engines/eevee/eevee_mist.c index 9f989146b05..2e56b64bd50 100644 --- a/source/blender/draw/engines/eevee/eevee_mist.c +++ b/source/blender/draw/engines/eevee/eevee_mist.c @@ -106,7 +106,7 @@ void EEVEE_mist_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) g_data->mist_falloff *= 0.5f; /* Create Pass and shgroup. */ - DRW_PASS_CREATE(psl->mist_accum_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_ADDITIVE); + DRW_PASS_CREATE(psl->mist_accum_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD); DRWShadingGroup *grp = DRW_shgroup_create(e_data.mist_sh, psl->mist_accum_ps); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); diff --git a/source/blender/draw/engines/eevee/eevee_occlusion.c b/source/blender/draw/engines/eevee/eevee_occlusion.c index 59def366695..49f62c6bf5e 100644 --- a/source/blender/draw/engines/eevee/eevee_occlusion.c +++ b/source/blender/draw/engines/eevee/eevee_occlusion.c @@ -157,7 +157,7 @@ void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata GPU_framebuffer_clear_color(fbl->ao_accum_fb, clear); /* Accumulation pass */ - DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_ADDITIVE; + DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD; DRW_PASS_CREATE(psl->ao_accum_ps, state); DRWShadingGroup *grp = DRW_shgroup_create(e_data.gtao_debug_sh, psl->ao_accum_ps); DRW_shgroup_uniform_texture(grp, "utilTex", EEVEE_materials_get_util_tex()); diff --git a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c index 33a8383fe90..26cdf62f989 100644 --- a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c +++ b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c @@ -232,7 +232,7 @@ void EEVEE_screen_raytrace_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *v } DRW_shgroup_call(grp, quad, NULL); - DRW_PASS_CREATE(psl->ssr_resolve, DRW_STATE_WRITE_COLOR | DRW_STATE_ADDITIVE); + DRW_PASS_CREATE(psl->ssr_resolve, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD); grp = DRW_shgroup_create(resolve_shader, psl->ssr_resolve); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &e_data.depth_src); DRW_shgroup_uniform_texture_ref(grp, "normalBuffer", &effects->ssr_normal_input); diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c index 19aefd03e72..0e451dc41da 100644 --- a/source/blender/draw/engines/eevee/eevee_subsurface.c +++ b/source/blender/draw/engines/eevee/eevee_subsurface.c @@ -200,8 +200,8 @@ void EEVEE_subsurface_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data */ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_STENCIL_EQUAL; DRW_PASS_CREATE(psl->sss_blur_ps, state); - DRW_PASS_CREATE(psl->sss_resolve_ps, state | DRW_STATE_ADDITIVE); - DRW_PASS_CREATE(psl->sss_accum_ps, state | DRW_STATE_ADDITIVE); + DRW_PASS_CREATE(psl->sss_resolve_ps, state | DRW_STATE_BLEND_ADD); + DRW_PASS_CREATE(psl->sss_accum_ps, state | DRW_STATE_BLEND_ADD); } void EEVEE_subsurface_add_pass(EEVEE_ViewLayerData *sldata, diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 61277628859..47a02a285f5 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -330,7 +330,7 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) /* World pass is not additive as it also clear the buffer. */ DRW_PASS_CREATE(psl->volumetric_world_ps, DRW_STATE_WRITE_COLOR); - DRW_PASS_CREATE(psl->volumetric_objects_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_ADDITIVE); + DRW_PASS_CREATE(psl->volumetric_objects_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD); /* World Volumetric */ struct World *wo = scene->world; diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index aa5ad3ebdb4..21d74f48027 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -352,16 +352,17 @@ void GPENCIL_cache_init(void *vedata) /* Stroke pass 2D */ psl->stroke_pass_2d = DRW_pass_create("GPencil Stroke Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | - DRW_STATE_DEPTH_ALWAYS | DRW_STATE_BLEND); + DRW_STATE_DEPTH_ALWAYS | DRW_STATE_BLEND_ALPHA); stl->storage->shgroup_id = 0; /* Stroke pass 3D */ psl->stroke_pass_3d = DRW_pass_create("GPencil Stroke Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | - DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND); + DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_ALPHA); stl->storage->shgroup_id = 0; /* edit pass */ - psl->edit_pass = DRW_pass_create("GPencil Edit Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND); + psl->edit_pass = DRW_pass_create("GPencil Edit Pass", + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA); /* detect if playing animation */ if (draw_ctx->evil_C) { @@ -453,13 +454,13 @@ void GPENCIL_cache_init(void *vedata) * is stored in sbuffer */ psl->drawing_pass = DRW_pass_create("GPencil Drawing Pass", - DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS); /* full screen pass to combine the result with default framebuffer */ struct GPUBatch *quad = DRW_cache_fullscreen_quad_get(); psl->mix_pass = DRW_pass_create("GPencil Mix Pass", - DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS); DRWShadingGroup *mix_shgrp = DRW_shgroup_create(e_data.gpencil_fullscreen_sh, psl->mix_pass); DRW_shgroup_call(mix_shgrp, quad, NULL); @@ -494,7 +495,7 @@ void GPENCIL_cache_init(void *vedata) * is far to agile. */ psl->background_pass = DRW_pass_create("GPencil Background Painting Session Pass", - DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS); DRWShadingGroup *background_shgrp = DRW_shgroup_create(e_data.gpencil_background_sh, psl->background_pass); @@ -509,7 +510,7 @@ void GPENCIL_cache_init(void *vedata) */ if (v3d) { psl->paper_pass = DRW_pass_create("GPencil Paper Pass", - DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND); + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA); DRWShadingGroup *paper_shgrp = DRW_shgroup_create(e_data.gpencil_paper_sh, psl->paper_pass); DRW_shgroup_call(paper_shgrp, quad, NULL); DRW_shgroup_uniform_vec3(paper_shgrp, "color", v3d->shading.background_color, 1); @@ -519,14 +520,14 @@ void GPENCIL_cache_init(void *vedata) /* grid pass */ if (v3d) { psl->grid_pass = DRW_pass_create("GPencil Grid Pass", - DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS); stl->g_data->shgrps_grid = DRW_shgroup_create(e_data.gpencil_line_sh, psl->grid_pass); } /* blend layers pass */ psl->blend_pass = DRW_pass_create("GPencil Blend Layers Pass", - DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS); DRWShadingGroup *blend_shgrp = DRW_shgroup_create(e_data.gpencil_blend_fullscreen_sh, psl->blend_pass); diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c index 9eb4123e5bc..f8b562b3672 100644 --- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c +++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c @@ -709,7 +709,7 @@ void GPENCIL_create_fx_passes(GPENCIL_PassList *psl) DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS); psl->fx_shader_pass_blend = DRW_pass_create("GPencil Shader FX Pass", - DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS); } diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index 28104a87b9a..3e442ce2125 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -755,9 +755,9 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) /* Stencil Shadow passes. */ #ifdef DEBUG_SHADOW_VOLUME DRWState depth_pass_state = DRW_STATE_DEPTH_LESS | DRW_STATE_WRITE_COLOR | - DRW_STATE_ADDITIVE; + DRW_STATE_BLEND_ADD; DRWState depth_fail_state = DRW_STATE_DEPTH_GREATER_EQUAL | DRW_STATE_WRITE_COLOR | - DRW_STATE_ADDITIVE; + DRW_STATE_BLEND_ADD; #else DRWState depth_pass_state = DRW_STATE_DEPTH_LESS | DRW_STATE_WRITE_STENCIL_SHADOW_PASS; DRWState depth_fail_state = DRW_STATE_DEPTH_LESS | DRW_STATE_WRITE_STENCIL_SHADOW_FAIL; @@ -830,7 +830,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) } /* OIT Composite */ { - int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND; + int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA; psl->oit_composite_pass = DRW_pass_create("OIT Composite", state); grp = DRW_shgroup_create(e_data.oit_resolve_sh, psl->oit_composite_pass); diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c index e24536759db..69d0500f155 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.c +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c @@ -298,7 +298,8 @@ void workbench_dof_create_pass(WORKBENCH_Data *vedata, psl->dof_dilate_v_ps = DRW_pass_create("DoF Dilate Coc V", DRW_STATE_WRITE_COLOR); psl->dof_blur1_ps = DRW_pass_create("DoF Blur 1", DRW_STATE_WRITE_COLOR); psl->dof_blur2_ps = DRW_pass_create("DoF Blur 2", DRW_STATE_WRITE_COLOR); - psl->dof_resolve_ps = DRW_pass_create("DoF Resolve", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND); + psl->dof_resolve_ps = DRW_pass_create("DoF Resolve", + DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA); { DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_prepare_sh, psl->dof_down_ps); diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c index 2b5fc8c0e47..a2fdf35109b 100644 --- a/source/blender/draw/engines/workbench/workbench_volume.c +++ b/source/blender/draw/engines/workbench/workbench_volume.c @@ -111,7 +111,7 @@ void workbench_volume_engine_free(void) void workbench_volume_cache_init(WORKBENCH_Data *vedata) { vedata->psl->volume_pass = DRW_pass_create( - "Volumes", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_PREMUL | DRW_STATE_CULL_FRONT); + "Volumes", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL | DRW_STATE_CULL_FRONT); } void workbench_volume_cache_populate(WORKBENCH_Data *vedata, |