diff --git a/source/blender/draw/engines/eevee_next/eevee_material.cc b/source/blender/draw/engines/eevee_next/eevee_material.cc index 34c5134f319..85fb57ace93 100644 --- a/source/blender/draw/engines/eevee_next/eevee_material.cc +++ b/source/blender/draw/engines/eevee_next/eevee_material.cc @@ -203,7 +203,7 @@ MaterialPass MaterialModule::material_pass_get(Object *ob, matpass.sub_pass = nullptr; } else { - ShaderKey shader_key(matpass.gpumat, geometry_type, pipeline_type); + ShaderKey shader_key(matpass.gpumat, geometry_type, pipeline_type, blender_mat->blend_flag); PassMain::Sub *shader_sub = shader_map_.lookup_or_add_cb(shader_key, [&]() { /* First time encountering this shader. Create a sub that will contain materials using it. */ diff --git a/source/blender/draw/engines/eevee_next/eevee_material.hh b/source/blender/draw/engines/eevee_next/eevee_material.hh index 0546c2e06bb..f3b2e6a5d61 100644 --- a/source/blender/draw/engines/eevee_next/eevee_material.hh +++ b/source/blender/draw/engines/eevee_next/eevee_material.hh @@ -108,7 +108,7 @@ static inline eMaterialGeometry to_material_geometry(const Object *ob) /** Unique key to identify each material in the hash-map. */ struct MaterialKey { - Material *mat; + ::Material *mat; uint64_t options; MaterialKey(::Material *mat_, eMaterialGeometry geometry, eMaterialPipeline surface_pipeline) @@ -145,10 +145,14 @@ struct ShaderKey { GPUShader *shader; uint64_t options; - ShaderKey(GPUMaterial *gpumat, eMaterialGeometry geometry, eMaterialPipeline pipeline) + ShaderKey(GPUMaterial *gpumat, + eMaterialGeometry geometry, + eMaterialPipeline pipeline, + char blend_flags) { shader = GPU_material_get_shader(gpumat); - options = shader_uuid_from_material_type(pipeline, geometry); + options = blend_flags; + options = (options << 6u) | shader_uuid_from_material_type(pipeline, geometry); options = (options << 16u) | shader_closure_bits_from_flag(gpumat); }