From 622e6f05f1b5fb1db326dca647a2cbd56ca6b573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Mon, 15 Nov 2021 02:38:52 +0100 Subject: Fix T92750: sculpt vertex colors missing in object mode The layers were not aliased properly for usage in the shaders. Regression caused by rB03013d19d167. --- .../intern/mesh_extractors/extract_mesh_vbo_attributes.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/draw') diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc index 9edefe32fbc..8a5a8134ca7 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc @@ -172,6 +172,18 @@ static void init_vbo_for_attribute(const MeshRenderData *mr, GPUVertFormat format = {0}; GPU_vertformat_deinterleave(&format); GPU_vertformat_attr_add(&format, attr_name, comp_type, comp_size, fetch_mode); + + /* Ensure Sculpt Vertex Colors are properly aliased. */ + if (request.cd_type == CD_PROP_COLOR && request.domain == ATTR_DOMAIN_POINT) { + CustomData *cd_vdata = get_custom_data_for_domain(mr, ATTR_DOMAIN_POINT); + if (request.layer_index == CustomData_get_render_layer(cd_vdata, CD_PROP_COLOR)) { + GPU_vertformat_alias_add(&format, "c"); + } + if (request.layer_index == CustomData_get_active_layer(cd_vdata, CD_PROP_COLOR)) { + GPU_vertformat_alias_add(&format, "ac"); + } + } + GPU_vertbuf_init_with_format(vbo, &format); GPU_vertbuf_data_alloc(vbo, static_cast(mr->loop_len)); } -- cgit v1.2.3