diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-08-03 19:53:36 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-08-08 22:26:49 +0300 |
commit | 82352565b79d1abb3b6f513bf186c1b3d80e8f0c (patch) | |
tree | aec2daede19ce964e8dc66db76f36dbb4aac5e48 /source/blender/gpu | |
parent | 05c0992c9b8fd852855b908fcd6333678360c307 (diff) |
Eevee: Remove some of the non-necessary uniforms
The remaining ones are from the attributes linear/srgb switches and from
nodes that should be pruned before running their _gpu function.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_material.h | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 13 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 5945621cb65..cc1150b6d77 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -124,6 +124,11 @@ typedef enum GPUMatType { GPU_MATERIAL_TYPE_WORLD = 2, } GPUMatType; +typedef enum GPUMatFlag { + GPU_MATFLAG_DIFFUSE = (1 << 0), + GPU_MATFLAG_GLOSSY = (1 << 1), + GPU_MATFLAG_REFRACT = (1 << 2), +} GPUMatFlag; typedef enum GPUBlendMode { GPU_BLEND_SOLID = 0, @@ -270,6 +275,9 @@ bool GPU_material_do_color_management(GPUMaterial *mat); bool GPU_material_use_domain_surface(GPUMaterial *mat); bool GPU_material_use_domain_volume(GPUMaterial *mat); +void GPU_material_flag_set(GPUMaterial *mat, GPUMatFlag flag); +bool GPU_material_flag_get(GPUMaterial *mat, GPUMatFlag flag); + void GPU_pass_cache_init(void); void GPU_pass_cache_garbage_collect(void); void GPU_pass_cache_free(void); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 9859f56c1db..69c3a3a73ba 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -109,6 +109,9 @@ struct GPUMaterial { */ int domain; + /* Only used by Eevee to know which bsdf are used. */ + int flag; + /* Used by 2.8 pipeline */ GPUUniformBuffer *ubo; /* UBOs for shader uniforms. */ @@ -564,6 +567,16 @@ bool GPU_material_use_domain_volume(GPUMaterial *mat) return (mat->domain & GPU_DOMAIN_VOLUME); } +void GPU_material_flag_set(GPUMaterial *mat, GPUMatFlag flag) +{ + mat->flag |= flag; +} + +bool GPU_material_flag_get(GPUMaterial *mat, GPUMatFlag flag) +{ + return (mat->flag & flag); +} + GPUMaterial *GPU_material_from_nodetree_find( ListBase *gpumaterials, const void *engine_type, int options) { diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 064ee42907e..808d2f73659 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1102,7 +1102,7 @@ void node_bsdf_anisotropic( vec4 color, float roughness, float anisotropy, float rotation, vec3 N, vec3 T, out Closure result) { - node_bsdf_diffuse(color, 0.0, N, result); + node_bsdf_glossy(color, roughness, N, -1, result); } void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 N, float ssr_id, out Closure result) |