diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-04 02:42:50 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-04 15:11:04 +0300 |
commit | f302224e161c28553a5ce12d77a27c201ec3be51 (patch) | |
tree | dbb09e37205ce743b6311df2fba2c72b136e83ec /source/blender/draw | |
parent | fb3b2ab709bfd3aa1e9a1c9db9d3ce05ed4e6c13 (diff) |
Cleanup: Eevee: Remove Flat normal shader variation
Was use by sculpt mode but that's not used anymore.
Diffstat (limited to 'source/blender/draw')
4 files changed, 19 insertions, 56 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 8ee5b51d825..c55f3f0150c 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -296,9 +296,6 @@ static char *eevee_get_defines(int options) if ((options & VAR_MAT_PROBE) != 0) { BLI_dynstr_append(ds, "#define PROBE_CAPTURE\n"); } - if ((options & VAR_MAT_FLAT) != 0) { - BLI_dynstr_append(ds, "#define USE_FLAT_NORMAL\n"); - } if ((options & VAR_MAT_CLIP) != 0) { BLI_dynstr_append(ds, "#define USE_ALPHA_CLIP\n"); } @@ -905,7 +902,6 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_create(EEVEE_ViewLaye EEVEE_Data *vedata, DRWPass *pass, bool is_hair, - bool is_flat_normal, bool use_blend, bool use_ssr, int shadow_method) @@ -918,9 +914,6 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_create(EEVEE_ViewLaye if (is_hair) { options |= VAR_MAT_HAIR; } - if (is_flat_normal) { - options |= VAR_MAT_FLAT; - } if (use_blend) { options |= VAR_MAT_BLEND; } @@ -949,7 +942,6 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_get(EEVEE_ViewLayerDa ParticleSystem *psys, ModifierData *md, bool is_hair, - bool is_flat_normal, bool use_ssr, int shadow_method) { @@ -962,9 +954,6 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_get(EEVEE_ViewLayerDa if (is_hair) { options |= VAR_MAT_HAIR; } - if (is_flat_normal) { - options |= VAR_MAT_FLAT; - } options |= eevee_material_shadow_option(shadow_method); @@ -1217,7 +1206,6 @@ static void material_opaque(Material *ma, EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, bool do_cull, - bool use_flat_nor, struct GPUMaterial **gpumat, struct GPUMaterial **gpumat_depth, struct DRWShadingGroup **shgrp, @@ -1437,7 +1425,7 @@ static void material_opaque(Material *ma, if (*shgrp == NULL) { bool use_ssr = ((effects->enabled_effects & EFFECT_SSR) != 0); *shgrp = EEVEE_default_shading_group_get( - sldata, vedata, NULL, NULL, NULL, false, use_flat_nor, use_ssr, linfo->shadow_method); + sldata, vedata, NULL, NULL, NULL, false, use_ssr, linfo->shadow_method); DRW_shgroup_uniform_vec3(*shgrp, "basecol", color_p, 1); DRW_shgroup_uniform_float(*shgrp, "metallic", metal_p, 1); DRW_shgroup_uniform_float(*shgrp, "specular", spec_p, 1); @@ -1470,7 +1458,6 @@ static void material_transparent(Material *ma, EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, bool do_cull, - bool use_flat_nor, struct GPUMaterial **gpumat, struct DRWShadingGroup **shgrp, struct DRWShadingGroup **shgrp_depth) @@ -1543,14 +1530,8 @@ static void material_transparent(Material *ma, /* Fallback to default shader */ if (*shgrp == NULL) { - *shgrp = EEVEE_default_shading_group_create(sldata, - vedata, - psl->transparent_pass, - false, - use_flat_nor, - true, - false, - linfo->shadow_method); + *shgrp = EEVEE_default_shading_group_create( + sldata, vedata, psl->transparent_pass, false, true, false, linfo->shadow_method); DRW_shgroup_uniform_vec3(*shgrp, "basecol", color_p, 1); DRW_shgroup_uniform_float(*shgrp, "metallic", metal_p, 1); DRW_shgroup_uniform_float(*shgrp, "specular", spec_p, 1); @@ -1641,7 +1622,6 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, struct GPUMaterial **gpumat_depth_array = BLI_array_alloca(gpumat_array, materials_len); struct Material **ma_array = BLI_array_alloca(ma_array, materials_len); - bool use_flat_nor = false; for (int i = 0; i < materials_len; ++i) { ma_array[i] = eevee_object_material_get(ob, i); gpumat_array[i] = NULL; @@ -1659,7 +1639,6 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, sldata, vedata, do_cull, - use_flat_nor, &gpumat_array[i], &gpumat_depth_array[i], &shgrp_array[i], @@ -1673,7 +1652,6 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, sldata, vedata, do_cull, - use_flat_nor, &gpumat_array[i], &shgrp_array[i], &shgrp_depth_array[i]); @@ -1684,10 +1662,6 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, } } - if (is_sculpt_mode && is_sculpt_mode_draw == false) { - DRW_cache_mesh_sculpt_coords_ensure(ob); - } - /* Only support single volume material for now. */ /* XXX We rely on the previously compiled surface shader * to know if the material has a "volume nodetree". @@ -1702,7 +1676,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, int auto_layer_count; struct GPUBatch **mat_geom = NULL; - if (!is_sculpt_mode_draw) { + if (!is_sculpt_mode) { mat_geom = DRW_cache_object_surface_material_get(ob, gpumat_array, materials_len, @@ -1892,7 +1866,7 @@ void EEVEE_hair_cache_populate(EEVEE_Data *vedata, /* Fallback to default shader */ if (shgrp == NULL) { shgrp = EEVEE_default_shading_group_get( - sldata, vedata, ob, psys, md, true, false, use_ssr, sldata->lights->shadow_method); + sldata, vedata, ob, psys, md, true, use_ssr, sldata->lights->shadow_method); DRW_shgroup_uniform_vec3(shgrp, "basecol", color_p, 1); DRW_shgroup_uniform_float(shgrp, "metallic", metal_p, 1); DRW_shgroup_uniform_float(shgrp, "specular", spec_p, 1); diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index c3cd25923b2..6112921ff39 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -147,26 +147,25 @@ enum { VAR_MAT_MESH = (1 << 0), VAR_MAT_PROBE = (1 << 1), VAR_MAT_HAIR = (1 << 2), - VAR_MAT_FLAT = (1 << 3), - VAR_MAT_BLEND = (1 << 4), - VAR_MAT_VSM = (1 << 5), - VAR_MAT_ESM = (1 << 6), - VAR_MAT_VOLUME = (1 << 7), - VAR_MAT_LOOKDEV = (1 << 8), + VAR_MAT_BLEND = (1 << 3), + VAR_MAT_VSM = (1 << 4), + VAR_MAT_ESM = (1 << 5), + VAR_MAT_VOLUME = (1 << 6), + VAR_MAT_LOOKDEV = (1 << 7), /* Max number of variation */ /* IMPORTANT : Leave it last and set * it's value accordingly. */ - VAR_MAT_MAX = (1 << 9), + VAR_MAT_MAX = (1 << 8), /* These are options that are not counted in VAR_MAT_MAX * because they are not cumulative with the others above. */ - VAR_MAT_CLIP = (1 << 10), - VAR_MAT_HASH = (1 << 11), - VAR_MAT_MULT = (1 << 12), - VAR_MAT_SHADOW = (1 << 13), - VAR_MAT_REFRACT = (1 << 14), - VAR_MAT_SSS = (1 << 15), - VAR_MAT_TRANSLUC = (1 << 16), - VAR_MAT_SSSALBED = (1 << 17), + VAR_MAT_CLIP = (1 << 9), + VAR_MAT_HASH = (1 << 10), + VAR_MAT_MULT = (1 << 11), + VAR_MAT_SHADOW = (1 << 12), + VAR_MAT_REFRACT = (1 << 13), + VAR_MAT_SSS = (1 << 14), + VAR_MAT_TRANSLUC = (1 << 15), + VAR_MAT_SSSALBED = (1 << 16), }; /* ************ PROBE UBO ************* */ diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl index 37b0ebb33cf..fe3225b1086 100644 --- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl @@ -13,13 +13,8 @@ uniform sampler2DArray utilTex; in vec3 worldPosition; in vec3 viewPosition; -#ifdef USE_FLAT_NORMAL -flat in vec3 worldNormal; -flat in vec3 viewNormal; -#else in vec3 worldNormal; in vec3 viewNormal; -#endif #ifdef HAIR_SHADER in vec3 hairTangent; /* world space */ diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl index 29ecbd694c9..40075ed64be 100644 --- a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl @@ -23,13 +23,8 @@ layout(std140) uniform clip_block vec4 ClipPlanes[1]; }; -#ifdef USE_FLAT_NORMAL -flat out vec3 worldNormal; -flat out vec3 viewNormal; -#else out vec3 worldNormal; out vec3 viewNormal; -#endif #ifdef HAIR_SHADER out vec3 hairTangent; |