35 uv_layers |= (1 << layer);
42 if (uv_layers & (1 << i)) {
51 r_uv_layers |= (1 << i);
54 SNPRINTF(attr_name,
"a%s", attr_safe_name);
74 if (
format->attr_len == 0) {
100 if (uv_layers & (1 << i)) {
107 if (mr.extract_type == MR_EXTRACT_BMESH) {
108 const BMesh &bm = *mr.bm;
109 for (const int i : uv_indices.index_range()) {
110 MutableSpan<float2> data = uv_data.slice(i * bm.totloop, bm.totloop);
111 const int offset = CustomData_get_n_offset(cd_ldata, CD_PROP_FLOAT2, uv_indices[i]);
112 threading::parallel_for(IndexRange(bm.totface), 2048, [&](const IndexRange range) {
113 for (const int face_index : range) {
114 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
115 const BMLoop *loop = BM_FACE_FIRST_LOOP(&face);
116 for ([[maybe_unused]] const int i : IndexRange(face.len)) {
117 const int index = BM_elem_index_get(loop);
118 data[index] = BM_ELEM_CD_GET_FLOAT_P(loop, offset);
126 const bke::AttributeAccessor attributes = mr.mesh->attributes();
127 for (const int i : uv_indices.index_range()) {
128 const StringRef name = CustomData_get_layer_name(cd_ldata, CD_PROP_FLOAT2, uv_indices[i]);
129 const VArray uv_map = *attributes.lookup_or_default<float2>(
130 name, bke::AttrDomain::Corner, float2(0));
131 array_utils::copy(uv_map, uv_data.slice(i * mr.corners_num, mr.corners_num));
141 const Mesh *coarse_mesh = subdiv_cache.
mesh;
155 if (uv_layers == 0) {
160 int pack_layer_index = 0;
162 if (uv_layers & (1 << i)) {
bool CustomData_layer_is_anonymous(const CustomData *data, eCustomDataType type, int n)
int CustomData_get_stencil_layer(const CustomData *data, eCustomDataType type)
const char * CustomData_get_layer_name(const CustomData *data, eCustomDataType type, int n)
int CustomData_get_active_layer(const CustomData *data, eCustomDataType type)
int CustomData_get_render_layer(const CustomData *data, eCustomDataType type)
#define SNPRINTF(dst, format,...)
void GPU_vertbuf_init_build_on_device(blender::gpu::VertBuf &verts, const GPUVertFormat &format, uint v_len)
#define GPU_vertbuf_init_with_format(verts, format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
constexpr int64_t size_in_bytes() const
void append(const T &value)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
static bool mesh_extract_uv_format_init(GPUVertFormat *format, const MeshBatchCache &cache, const CustomData *cd_ldata, const eMRExtractType extract_type, uint32_t &r_uv_layers)
void draw_subdiv_extract_uvs(const DRWSubdivCache &cache, gpu::VertBuf *uvs, const int face_varying_channel, const int dst_offset)
void extract_uv_maps(const MeshRenderData &mr, const MeshBatchCache &cache, gpu::VertBuf &vbo)
void extract_uv_maps_subdiv(const DRWSubdivCache &subdiv_cache, const MeshBatchCache &cache, gpu::VertBuf &vbo)
void memory_bandwidth_bound_task(const int64_t approximate_bytes_touched, const Function &function)
eMRExtractType extract_type