EEVEE Next: Ensure correct material settings are used
Add Material::blend_flags to Shaderkey, to ensure Materials with different settings but the same shader don't end up using the same pass. Pull Request: https://projects.blender.org/blender/blender/pulls/108283
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user