Fix #116140: GPU subdivision ignores completely smooth shading

Extraction of data is done in a different order for GPU subdivision
drawing. The necessary normals domain of the mesh has to be
retrieved before that.
This commit is contained in:
Hans Goudey 2023-12-13 18:59:28 -05:00
parent 463dc4dbec
commit cdb2f1e1ba
1 changed files with 2 additions and 1 deletions

View File

@ -488,7 +488,6 @@ void mesh_render_data_update_normals(MeshRenderData &mr, const eMRDataType data_
{
if (mr.extract_type != MR_EXTRACT_BMESH) {
/* Mesh */
mr.normals_domain = mr.mesh->normals_domain();
mr.vert_normals = mr.mesh->vert_normals();
if (data_flag & (MR_DATA_POLY_NOR | MR_DATA_LOOP_NOR | MR_DATA_TAN_LOOP_NOR)) {
mr.face_normals = mr.mesh->face_normals();
@ -679,6 +678,8 @@ MeshRenderData *mesh_render_data_create(Object *object,
mr->p_origindex = static_cast<const int *>(
CustomData_get_layer(&mr->mesh->face_data, CD_ORIGINDEX));
mr->normals_domain = mr->mesh->normals_domain();
const bke::AttributeAccessor attributes = mr->mesh->attributes();
mr->material_indices = *attributes.lookup<int>("material_index", ATTR_DOMAIN_FACE);