Cleanup: Eevee: Remove Flat normal shader variation

Was use by sculpt mode but that's not used anymore.
This commit is contained in:
2019-05-04 01:42:50 +02:00
parent fb3b2ab709
commit f302224e16
4 changed files with 19 additions and 56 deletions

View File

@@ -296,9 +296,6 @@ static char *eevee_get_defines(int options)
if ((options & VAR_MAT_PROBE) != 0) { if ((options & VAR_MAT_PROBE) != 0) {
BLI_dynstr_append(ds, "#define PROBE_CAPTURE\n"); 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) { if ((options & VAR_MAT_CLIP) != 0) {
BLI_dynstr_append(ds, "#define USE_ALPHA_CLIP\n"); 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, EEVEE_Data *vedata,
DRWPass *pass, DRWPass *pass,
bool is_hair, bool is_hair,
bool is_flat_normal,
bool use_blend, bool use_blend,
bool use_ssr, bool use_ssr,
int shadow_method) int shadow_method)
@@ -918,9 +914,6 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_create(EEVEE_ViewLaye
if (is_hair) { if (is_hair) {
options |= VAR_MAT_HAIR; options |= VAR_MAT_HAIR;
} }
if (is_flat_normal) {
options |= VAR_MAT_FLAT;
}
if (use_blend) { if (use_blend) {
options |= VAR_MAT_BLEND; options |= VAR_MAT_BLEND;
} }
@@ -949,7 +942,6 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_get(EEVEE_ViewLayerDa
ParticleSystem *psys, ParticleSystem *psys,
ModifierData *md, ModifierData *md,
bool is_hair, bool is_hair,
bool is_flat_normal,
bool use_ssr, bool use_ssr,
int shadow_method) int shadow_method)
{ {
@@ -962,9 +954,6 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_get(EEVEE_ViewLayerDa
if (is_hair) { if (is_hair) {
options |= VAR_MAT_HAIR; options |= VAR_MAT_HAIR;
} }
if (is_flat_normal) {
options |= VAR_MAT_FLAT;
}
options |= eevee_material_shadow_option(shadow_method); options |= eevee_material_shadow_option(shadow_method);
@@ -1217,7 +1206,6 @@ static void material_opaque(Material *ma,
EEVEE_ViewLayerData *sldata, EEVEE_ViewLayerData *sldata,
EEVEE_Data *vedata, EEVEE_Data *vedata,
bool do_cull, bool do_cull,
bool use_flat_nor,
struct GPUMaterial **gpumat, struct GPUMaterial **gpumat,
struct GPUMaterial **gpumat_depth, struct GPUMaterial **gpumat_depth,
struct DRWShadingGroup **shgrp, struct DRWShadingGroup **shgrp,
@@ -1437,7 +1425,7 @@ static void material_opaque(Material *ma,
if (*shgrp == NULL) { if (*shgrp == NULL) {
bool use_ssr = ((effects->enabled_effects & EFFECT_SSR) != 0); bool use_ssr = ((effects->enabled_effects & EFFECT_SSR) != 0);
*shgrp = EEVEE_default_shading_group_get( *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_vec3(*shgrp, "basecol", color_p, 1);
DRW_shgroup_uniform_float(*shgrp, "metallic", metal_p, 1); DRW_shgroup_uniform_float(*shgrp, "metallic", metal_p, 1);
DRW_shgroup_uniform_float(*shgrp, "specular", spec_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_ViewLayerData *sldata,
EEVEE_Data *vedata, EEVEE_Data *vedata,
bool do_cull, bool do_cull,
bool use_flat_nor,
struct GPUMaterial **gpumat, struct GPUMaterial **gpumat,
struct DRWShadingGroup **shgrp, struct DRWShadingGroup **shgrp,
struct DRWShadingGroup **shgrp_depth) struct DRWShadingGroup **shgrp_depth)
@@ -1543,14 +1530,8 @@ static void material_transparent(Material *ma,
/* Fallback to default shader */ /* Fallback to default shader */
if (*shgrp == NULL) { if (*shgrp == NULL) {
*shgrp = EEVEE_default_shading_group_create(sldata, *shgrp = EEVEE_default_shading_group_create(
vedata, sldata, vedata, psl->transparent_pass, false, true, false, linfo->shadow_method);
psl->transparent_pass,
false,
use_flat_nor,
true,
false,
linfo->shadow_method);
DRW_shgroup_uniform_vec3(*shgrp, "basecol", color_p, 1); DRW_shgroup_uniform_vec3(*shgrp, "basecol", color_p, 1);
DRW_shgroup_uniform_float(*shgrp, "metallic", metal_p, 1); DRW_shgroup_uniform_float(*shgrp, "metallic", metal_p, 1);
DRW_shgroup_uniform_float(*shgrp, "specular", spec_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 GPUMaterial **gpumat_depth_array = BLI_array_alloca(gpumat_array, materials_len);
struct Material **ma_array = BLI_array_alloca(ma_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) { for (int i = 0; i < materials_len; ++i) {
ma_array[i] = eevee_object_material_get(ob, i); ma_array[i] = eevee_object_material_get(ob, i);
gpumat_array[i] = NULL; gpumat_array[i] = NULL;
@@ -1659,7 +1639,6 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
sldata, sldata,
vedata, vedata,
do_cull, do_cull,
use_flat_nor,
&gpumat_array[i], &gpumat_array[i],
&gpumat_depth_array[i], &gpumat_depth_array[i],
&shgrp_array[i], &shgrp_array[i],
@@ -1673,7 +1652,6 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
sldata, sldata,
vedata, vedata,
do_cull, do_cull,
use_flat_nor,
&gpumat_array[i], &gpumat_array[i],
&shgrp_array[i], &shgrp_array[i],
&shgrp_depth_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. */ /* Only support single volume material for now. */
/* XXX We rely on the previously compiled surface shader /* XXX We rely on the previously compiled surface shader
* to know if the material has a "volume nodetree". * 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; int auto_layer_count;
struct GPUBatch **mat_geom = NULL; struct GPUBatch **mat_geom = NULL;
if (!is_sculpt_mode_draw) { if (!is_sculpt_mode) {
mat_geom = DRW_cache_object_surface_material_get(ob, mat_geom = DRW_cache_object_surface_material_get(ob,
gpumat_array, gpumat_array,
materials_len, materials_len,
@@ -1892,7 +1866,7 @@ void EEVEE_hair_cache_populate(EEVEE_Data *vedata,
/* Fallback to default shader */ /* Fallback to default shader */
if (shgrp == NULL) { if (shgrp == NULL) {
shgrp = EEVEE_default_shading_group_get( 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_vec3(shgrp, "basecol", color_p, 1);
DRW_shgroup_uniform_float(shgrp, "metallic", metal_p, 1); DRW_shgroup_uniform_float(shgrp, "metallic", metal_p, 1);
DRW_shgroup_uniform_float(shgrp, "specular", spec_p, 1); DRW_shgroup_uniform_float(shgrp, "specular", spec_p, 1);

View File

@@ -147,26 +147,25 @@ enum {
VAR_MAT_MESH = (1 << 0), VAR_MAT_MESH = (1 << 0),
VAR_MAT_PROBE = (1 << 1), VAR_MAT_PROBE = (1 << 1),
VAR_MAT_HAIR = (1 << 2), VAR_MAT_HAIR = (1 << 2),
VAR_MAT_FLAT = (1 << 3), VAR_MAT_BLEND = (1 << 3),
VAR_MAT_BLEND = (1 << 4), VAR_MAT_VSM = (1 << 4),
VAR_MAT_VSM = (1 << 5), VAR_MAT_ESM = (1 << 5),
VAR_MAT_ESM = (1 << 6), VAR_MAT_VOLUME = (1 << 6),
VAR_MAT_VOLUME = (1 << 7), VAR_MAT_LOOKDEV = (1 << 7),
VAR_MAT_LOOKDEV = (1 << 8),
/* Max number of variation */ /* Max number of variation */
/* IMPORTANT : Leave it last and set /* IMPORTANT : Leave it last and set
* it's value accordingly. */ * 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 /* These are options that are not counted in VAR_MAT_MAX
* because they are not cumulative with the others above. */ * because they are not cumulative with the others above. */
VAR_MAT_CLIP = (1 << 10), VAR_MAT_CLIP = (1 << 9),
VAR_MAT_HASH = (1 << 11), VAR_MAT_HASH = (1 << 10),
VAR_MAT_MULT = (1 << 12), VAR_MAT_MULT = (1 << 11),
VAR_MAT_SHADOW = (1 << 13), VAR_MAT_SHADOW = (1 << 12),
VAR_MAT_REFRACT = (1 << 14), VAR_MAT_REFRACT = (1 << 13),
VAR_MAT_SSS = (1 << 15), VAR_MAT_SSS = (1 << 14),
VAR_MAT_TRANSLUC = (1 << 16), VAR_MAT_TRANSLUC = (1 << 15),
VAR_MAT_SSSALBED = (1 << 17), VAR_MAT_SSSALBED = (1 << 16),
}; };
/* ************ PROBE UBO ************* */ /* ************ PROBE UBO ************* */

View File

@@ -13,13 +13,8 @@ uniform sampler2DArray utilTex;
in vec3 worldPosition; in vec3 worldPosition;
in vec3 viewPosition; in vec3 viewPosition;
#ifdef USE_FLAT_NORMAL
flat in vec3 worldNormal;
flat in vec3 viewNormal;
#else
in vec3 worldNormal; in vec3 worldNormal;
in vec3 viewNormal; in vec3 viewNormal;
#endif
#ifdef HAIR_SHADER #ifdef HAIR_SHADER
in vec3 hairTangent; /* world space */ in vec3 hairTangent; /* world space */

View File

@@ -23,13 +23,8 @@ layout(std140) uniform clip_block
vec4 ClipPlanes[1]; vec4 ClipPlanes[1];
}; };
#ifdef USE_FLAT_NORMAL
flat out vec3 worldNormal;
flat out vec3 viewNormal;
#else
out vec3 worldNormal; out vec3 worldNormal;
out vec3 viewNormal; out vec3 viewNormal;
#endif
#ifdef HAIR_SHADER #ifdef HAIR_SHADER
out vec3 hairTangent; out vec3 hairTangent;