Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-05-16 15:12:32 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-17 14:38:42 +0300
commit26beaa2d901004cdba4b3811e353929a49c18a87 (patch)
tree23af403ea3114c851f6c78869783ccddbfd20887 /source
parent4856474b16f666e17a0073598fb9b74094b97f40 (diff)
Cleanup: Eevee: Use SET_FLAG_FROM_TEST
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c59
-rw-r--r--source/blender/gpu/intern/gpu_material.c8
2 files changed, 18 insertions, 49 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index c6b228c29d3..79987bba6d1 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -751,27 +751,14 @@ struct GPUMaterial *EEVEE_material_mesh_get(struct Scene *scene,
const void *engine = &DRW_engine_viewport_eevee_type;
int options = VAR_MAT_MESH;
- if (use_blend) {
- options |= VAR_MAT_BLEND;
- }
- if (use_multiply) {
- options |= VAR_MAT_MULT;
- }
- if (use_refract) {
- options |= VAR_MAT_REFRACT;
- }
- if (use_sss) {
- options |= VAR_MAT_SSS;
- }
- if (use_sss && effects->sss_separate_albedo) {
- options |= VAR_MAT_SSSALBED;
- }
- if (use_translucency) {
- options |= VAR_MAT_TRANSLUC;
- }
- if (((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) && use_blend) {
- options |= VAR_MAT_VOLUME;
- }
+ SET_FLAG_FROM_TEST(options, use_blend, VAR_MAT_BLEND);
+ SET_FLAG_FROM_TEST(options, use_multiply, VAR_MAT_MULT);
+ SET_FLAG_FROM_TEST(options, use_refract, VAR_MAT_REFRACT);
+ SET_FLAG_FROM_TEST(options, use_sss, VAR_MAT_SSS);
+ SET_FLAG_FROM_TEST(options, use_sss && effects->sss_separate_albedo, VAR_MAT_SSSALBED);
+ SET_FLAG_FROM_TEST(options, use_translucency, VAR_MAT_TRANSLUC);
+ SET_FLAG_FROM_TEST(
+ options, ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) && use_blend, VAR_MAT_VOLUME);
options |= eevee_material_shadow_option(shadow_method);
@@ -832,16 +819,9 @@ struct GPUMaterial *EEVEE_material_mesh_depth_get(struct Scene *scene,
const void *engine = &DRW_engine_viewport_eevee_type;
int options = VAR_MAT_MESH;
- if (use_hashed_alpha) {
- options |= VAR_MAT_HASH;
- }
- else {
- options |= VAR_MAT_CLIP;
- }
-
- if (is_shadow) {
- options |= VAR_MAT_SHADOW;
- }
+ SET_FLAG_FROM_TEST(options, use_hashed_alpha, VAR_MAT_HASH);
+ SET_FLAG_FROM_TEST(options, !use_hashed_alpha, VAR_MAT_CLIP);
+ SET_FLAG_FROM_TEST(options, is_shadow, VAR_MAT_SHADOW);
GPUMaterial *mat = DRW_shader_find_from_material(ma, engine, options, true);
if (mat) {
@@ -914,15 +894,10 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_create(EEVEE_ViewLaye
ssr_id = (use_ssr) ? 1 : -1;
int options = VAR_MAT_MESH;
- if (is_hair) {
- options |= VAR_MAT_HAIR;
- }
- if (use_blend) {
- options |= VAR_MAT_BLEND;
- }
- if (((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) && use_blend) {
- options |= VAR_MAT_VOLUME;
- }
+ SET_FLAG_FROM_TEST(options, is_hair, VAR_MAT_HAIR);
+ SET_FLAG_FROM_TEST(options, use_blend, VAR_MAT_BLEND);
+ SET_FLAG_FROM_TEST(
+ options, ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) && use_blend, VAR_MAT_VOLUME);
options |= eevee_material_shadow_option(shadow_method);
@@ -954,9 +929,7 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_get(EEVEE_ViewLayerDa
BLI_assert(!is_hair || (ob && psys && md));
- if (is_hair) {
- options |= VAR_MAT_HAIR;
- }
+ SET_FLAG_FROM_TEST(options, is_hair, VAR_MAT_HAIR);
options |= eevee_material_shadow_option(shadow_method);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index de9ed56abf5..4f90155b88c 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -678,12 +678,8 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene,
gpu_material_ramp_texture_build(mat);
- if (has_surface_output) {
- mat->domain |= GPU_DOMAIN_SURFACE;
- }
- if (has_volume_output) {
- mat->domain |= GPU_DOMAIN_VOLUME;
- }
+ SET_FLAG_FROM_TEST(mat->domain, has_surface_output, GPU_DOMAIN_SURFACE);
+ SET_FLAG_FROM_TEST(mat->domain, has_volume_output, GPU_DOMAIN_VOLUME);
if (mat->outlink) {
/* Prune the unused nodes and extract attributes before compiling so the