Eevee: Hair: Fix wrong color when shader is compiling.
This commit is contained in:
parent
9215b41dd3
commit
b029cc5d74
|
@ -1510,23 +1510,30 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
|
|||
}
|
||||
else {
|
||||
if (ma->use_nodes && ma->nodetree) {
|
||||
static float half = 0.5f;
|
||||
static float error_col[3] = {1.0f, 0.0f, 1.0f};
|
||||
static float compile_col[3] = {0.5f, 0.5f, 0.5f};
|
||||
struct GPUMaterial *gpumat = EEVEE_material_hair_get(scene, ma, sldata->lamps->shadow_method);
|
||||
|
||||
shgrp = DRW_shgroup_material_create(gpumat, psl->material_pass);
|
||||
if (shgrp) {
|
||||
add_standard_uniforms(shgrp, sldata, vedata, NULL, NULL, false, false);
|
||||
|
||||
BLI_ghash_insert(material_hash, ma, shgrp);
|
||||
|
||||
DRW_shgroup_call_add(shgrp, hair_geom, mat);
|
||||
}
|
||||
else {
|
||||
/* Shader failed : pink color */
|
||||
static float col[3] = {1.0f, 0.0f, 1.0f};
|
||||
static float half = 0.5f;
|
||||
|
||||
color_p = col;
|
||||
metal_p = spec_p = rough_p = ½
|
||||
switch (GPU_material_status(gpumat)) {
|
||||
case GPU_MAT_SUCCESS:
|
||||
{
|
||||
shgrp = DRW_shgroup_material_create(gpumat, psl->material_pass);
|
||||
add_standard_uniforms(shgrp, sldata, vedata, NULL, NULL, false, false);
|
||||
break;
|
||||
}
|
||||
case GPU_MAT_QUEUED:
|
||||
{
|
||||
sldata->probes->all_materials_updated = false;
|
||||
color_p = compile_col;
|
||||
metal_p = spec_p = rough_p = ½
|
||||
break;
|
||||
}
|
||||
case GPU_MAT_FAILED:
|
||||
default:
|
||||
color_p = error_col;
|
||||
metal_p = spec_p = rough_p = ½
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1539,11 +1546,10 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
|
|||
DRW_shgroup_uniform_float(shgrp, "metallic", metal_p, 1);
|
||||
DRW_shgroup_uniform_float(shgrp, "specular", spec_p, 1);
|
||||
DRW_shgroup_uniform_float(shgrp, "roughness", rough_p, 1);
|
||||
|
||||
BLI_ghash_insert(material_hash, ma, shgrp);
|
||||
|
||||
DRW_shgroup_call_add(shgrp, hair_geom, mat);
|
||||
}
|
||||
|
||||
DRW_shgroup_call_add(shgrp, hair_geom, NULL);
|
||||
BLI_ghash_insert(material_hash, ma, shgrp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue