95#define SHADER_CUSTOM_DATA_INTERP_MAX_DIMENSIONS 4
101 switch (shader_type) {
151 switch (shader_type) {
153 return "subdiv lines build";
156 return "subdiv lines loose build";
159 return "subdiv lnor build";
162 return "subdiv edge fac build";
166 return "subdiv tris";
169 return "subdiv normals accumulate";
172 return "subdiv normals finalize";
175 return "subdiv patch evaluation";
178 return "subdiv patch evaluation face-varying";
181 return "subdiv patch evaluation face dots";
184 return "subdiv patch evaluation face dots with normals";
187 return "subdiv patch evaluation orco";
190 return "subdiv custom data interp 1D";
193 return "subdiv custom data interp 2D";
196 return "subdiv custom data interp 3D";
199 return "subdiv custom data interp 4D";
202 return "subdiv sculpt data";
205 return "subdiv uv stretch angle";
208 return "subdiv uv stretch area";
219 const char *defines =
nullptr;
222 "#define OSD_PATCH_BASIS_GLSL\n"
223 "#define OPENSUBDIV_GLSL_COMPUTE_USE_1ST_DERIVATIVES\n";
227 "#define OSD_PATCH_BASIS_GLSL\n"
228 "#define OPENSUBDIV_GLSL_COMPUTE_USE_1ST_DERIVATIVES\n"
229 "#define FVAR_EVALUATION\n";
233 "#define OSD_PATCH_BASIS_GLSL\n"
234 "#define OPENSUBDIV_GLSL_COMPUTE_USE_1ST_DERIVATIVES\n"
235 "#define FDOTS_EVALUATION\n";
239 "#define OSD_PATCH_BASIS_GLSL\n"
240 "#define OPENSUBDIV_GLSL_COMPUTE_USE_1ST_DERIVATIVES\n"
241 "#define FDOTS_EVALUATION\n"
242 "#define FDOTS_NORMALS\n";
246 "#define OSD_PATCH_BASIS_GLSL\n"
247 "#define OPENSUBDIV_GLSL_COMPUTE_USE_1ST_DERIVATIVES\n"
248 "#define ORCO_EVALUATION\n";
268 if (
ELEM(shader_type,
285 const char *defines =
nullptr;
287 if (
ELEM(shader_type,
293 defines =
"#define SUBDIV_POLYGON_OFFSET\n";
297 "#define SUBDIV_POLYGON_OFFSET\n"
298 "#define SINGLE_MATERIAL\n";
301 defines =
"#define LINES_LOOSE\n";
309 defines =
"#define CUSTOM_NORMALS\n";
327 if (shader ==
nullptr) {
332 std::string defines =
"#define SUBDIV_POLYGON_OFFSET\n";
333 defines +=
"#define DIMENSIONS " + std::to_string(dimensions) +
"\n";
336 defines +=
"#define GPU_COMP_U16\n";
339 defines +=
"#define GPU_COMP_I32\n";
366 if (
format.attr_len == 0) {
376 if (
format.attr_len == 0) {
391 if (
format.attr_len == 0) {
403 if (
format.attr_len == 0) {
414 if (
format.attr_len == 0) {
424 if (
format.attr_len == 0) {
434 if (
format.attr_len == 0) {
452 (
uint(u * 65535.0f) << 16) |
uint(
v * 65535.0f),
461 if (
format.attr_len == 0) {
472 if (
format.attr_len == 0) {
481 if (
format.attr_len == 0) {
533 buffer_interface->
data = vertbuf;
557 const uint32_t number_of_quads = number_of_loops / 4;
558 return number_of_quads * 2;
573 buffer.
data<
int32_t>().take_front(num_loops).copy_from({vert_origindex, num_loops});
603 int min_patch_face = 0;
604 int max_patch_face = 0;
606 int patches_are_triangular = 0;
610 &patch_map_handles_interface,
611 &patch_map_quad_tree_interface,
615 &patches_are_triangular);
695#define SUBDIV_COARSE_FACE_FLAG_SMOOTH 1u
696#define SUBDIV_COARSE_FACE_FLAG_SELECT 2u
697#define SUBDIV_COARSE_FACE_FLAG_ACTIVE 4u
698#define SUBDIV_COARSE_FACE_FLAG_HIDDEN 8u
700#define SUBDIV_COARSE_FACE_FLAG_OFFSET 28u
702#define SUBDIV_COARSE_FACE_FLAG_SMOOTH_MASK \
703 (SUBDIV_COARSE_FACE_FLAG_SMOOTH << SUBDIV_COARSE_FACE_FLAG_OFFSET)
704#define SUBDIV_COARSE_FACE_FLAG_SELECT_MASK \
705 (SUBDIV_COARSE_FACE_FLAG_SELECT << SUBDIV_COARSE_FACE_FLAG_OFFSET)
706#define SUBDIV_COARSE_FACE_FLAG_ACTIVE_MASK \
707 (SUBDIV_COARSE_FACE_FLAG_ACTIVE << SUBDIV_COARSE_FACE_FLAG_OFFSET)
708#define SUBDIV_COARSE_FACE_FLAG_HIDDEN_MASK \
709 (SUBDIV_COARSE_FACE_FLAG_HIDDEN << SUBDIV_COARSE_FACE_FLAG_OFFSET)
711#define SUBDIV_COARSE_FACE_LOOP_START_MASK \
712 ~((SUBDIV_COARSE_FACE_FLAG_SMOOTH | SUBDIV_COARSE_FACE_FLAG_SELECT | \
713 SUBDIV_COARSE_FACE_FLAG_ACTIVE | SUBDIV_COARSE_FACE_FLAG_HIDDEN) \
714 << SUBDIV_COARSE_FACE_FLAG_OFFSET)
754 for (
const int i : faces.index_range()) {
782 for (
const int i : faces.index_range()) {
803 if (
format.attr_len == 0) {
831 if (subdiv_cache ==
nullptr) {
832 subdiv_cache = MEM_new<DRWSubdivCache>(__func__);
835 return *subdiv_cache;
853#ifdef WITH_OPENSUBDIV
906 const int *subdiv_face_offset)
910 if (num_verts == 0 && num_loops == 0) {
918 if (num_loops != 0) {
986 for (
int i = 0; i < num_verts; i++) {
994 for (
int i = 0; i < num_edges; i++) {
1009 const int coarse_vertex_index,
1012 const int subdiv_vertex_index)
1034 const int coarse_edge_index,
1035 const int subdiv_edge_index,
1071 const int ptex_face_index,
1075 const int coarse_face_index,
1077 const int subdiv_loop_index,
1078 const int subdiv_vertex_index,
1079 const int subdiv_edge_index)
1094 memset(foreach_context, 0,
sizeof(*foreach_context));
1107 foreach_context.
user_data = cache_building_context;
1144 vertex_offsets.
fill(0);
1152 int *tmp_set_faces =
static_cast<int *
>(
1156 for (
int j = 0; j < 4; j++) {
1158 int first_face_offset = vertex_offsets[subdiv_vertex] + tmp_set_faces[subdiv_vertex];
1159 adjacent_faces[first_face_offset] = i;
1160 tmp_set_faces[subdiv_vertex] += 1;
1169 const Mesh *mesh_eval,
1193 cache_building_context.
settings = &to_mesh_settings;
1194 cache_building_context.
cache = &cache;
1218 for (
int i = 0; i < mesh_eval->
faces_num; i++) {
1220 if (faces[i].
size() == 4) {
1222 blender_fdots_patch_coords[i] =
make_patch_coord(ptex_face_index, 0.5f, 0.5f);
1228 blender_fdots_patch_coords[i] =
make_patch_coord(ptex_face_index, 1.0f, 1.0f);
1258 if (first_loop_index[vertex] != -1) {
1261 first_loop_index[vertex] = i;
1267 cache_building_context.
patch_coords[first_loop_index[vertex]];
1327 "DRWSubdivUboStorage is not padded to a multiple of the size of vec4");
1331 const int src_offset,
1332 const int dst_offset,
1333 const uint total_dispatch_size,
1334 const bool has_sculpt_mask,
1335 const uint edge_loose_offset)
1359 const int src_offset,
1360 const int dst_offset,
1361 const uint total_dispatch_size,
1362 const bool has_sculpt_mask =
false,
1363 const uint edge_loose_offset = 0)
1370 total_dispatch_size,
1389#define SUBDIV_LOCAL_WORK_GROUP_SIZE 64
1402 const int src_offset,
1403 const int dst_offset,
1404 uint total_dispatch_size,
1405 const bool has_sculpt_mask =
false,
1406 const uint edge_loose_offset = 0)
1411 uint dispatch_rx = dispatch_size;
1412 uint dispatch_ry = 1u;
1413 if (dispatch_rx > max_res_x) {
1421 dispatch_rx = dispatch_ry =
ceilf(
sqrtf(dispatch_size));
1423 if ((dispatch_rx * (dispatch_ry - 1)) >= dispatch_size) {
1437 total_dispatch_size,
1489 int binding_point = 0;
1528 const int face_varying_channel,
1529 const int dst_offset)
1541 evaluator->
wrapFVarSrcBuffer(evaluator, face_varying_channel, &src_buffer_interface);
1547 evaluator, face_varying_channel, &patch_arrays_buffer_interface);
1553 evaluator, face_varying_channel, &patch_index_buffer_interface);
1559 evaluator, face_varying_channel, &patch_param_buffer_interface);
1564 int binding_point = 0;
1578 const int src_offset = src_buffer_interface.
buffer_offset / 2;
1610 int binding_point = 0;
1643 int binding_point = 1;
1667 int binding_point = 0;
1695 int binding_point = 0;
1719 int binding_point = 0;
1739 const int material_count)
1746 const bool do_single_material = material_count <= 1;
1752 int binding_point = 0;
1761 if (!do_single_material) {
1815 int binding_point = 0;
1854 int binding_point = 0;
1873 uint edge_loose_offset,
1874 uint num_loose_edges)
1900 int binding_point = 0;
1928 int binding_point = 0;
1956 int binding_point = 0;
1984 int binding_point = 0;
2038 const Mesh *mesh_eval,
2049 cache.
mat_end[0] = number_of_quads;
2054 const VArraySpan<int> material_indices = *attributes.lookup_or_default<
int>(
2058 int *mat_start =
static_cast<int *
>(
MEM_callocN(
sizeof(
int) * mat_len,
"subdiv mat_start"));
2062 for (
int i = 0; i < mesh_eval->
faces_num; i++) {
2063 const int next_offset = (i == mesh_eval->
faces_num - 1) ? number_of_quads :
2064 subdiv_face_offset[i + 1];
2065 const int quad_count = next_offset - subdiv_face_offset[i];
2066 const int mat_index = material_indices[i];
2067 mat_start[mat_index] += quad_count;
2071 int ofs = mat_start[0];
2073 for (
uint i = 1; i < mat_len; i++) {
2074 int tmp = mat_start[i];
2080 int *mat_end =
static_cast<int *
>(
MEM_dupallocN(mat_start));
2081 int *per_face_mat_offset =
static_cast<int *
>(
2084 for (
int i = 0; i < mesh_eval->
faces_num; i++) {
2085 const int mat_index = material_indices[i];
2086 const int single_material_index = subdiv_face_offset[i];
2087 const int material_offset = mat_end[mat_index];
2088 const int next_offset = (i == mesh_eval->
faces_num - 1) ? number_of_quads :
2089 subdiv_face_offset[i + 1];
2090 const int quad_count = next_offset - subdiv_face_offset[i];
2091 mat_end[mat_index] += quad_count;
2093 per_face_mat_offset[i] = material_offset - single_material_index;
2108 const bool is_editmode,
2109 const bool is_paint_mode,
2110 const bool edit_mode_active,
2112 const bool do_final,
2113 const bool do_uvedit,
2116 const bool use_hide,
2128 if (mesh.runtime->edit_mesh) {
2130 bm = mesh.runtime->edit_mesh->bm;
2136 runtime_data, mesh_eval,
true);
2161 draw_cache.
mesh = mesh_eval;
2162 draw_cache.
subdiv = subdiv;
2220 const Mesh *coarse_mesh = subdiv_cache.
mesh;
2222 const int resolution = subdiv_cache.
resolution;
2223 const int resolution_1 = resolution - 1;
2224 const float inv_resolution_1 = 1.0f /
float(resolution_1);
2226 const Span<float3> coarse_positions = coarse_mesh->vert_positions();
2227 const Span<int2> coarse_edges = coarse_mesh->edges();
2232 coarse_edges, coarse_mesh->
verts_num, vert_to_edge_offsets, vert_to_edge_indices);
2239 for (const int i : range) {
2240 const int coarse_edge = loose_edges[i];
2241 MutableSpan positions = edge_positions.slice(i * resolution, resolution);
2242 for (const int j : positions.index_range()) {
2243 positions[j] = bke::subdiv::mesh_interpolate_position_on_edge(coarse_positions,
2248 j * inv_resolution_1);
2260 const bool is_editmode,
2261 const bool is_paint_mode,
2262 const bool edit_mode_active,
2264 const bool do_final,
2265 const bool do_uvedit,
2268 const bool use_hide)
2300 fprintf(stderr,
"Time to update subdivision: %f\n", end_time - begin_time);
2301 fprintf(stderr,
"Maximum FPS: %f\n", 1.0 / (end_time - begin_time));
2342 bke::subdiv::free(subdiv);
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
General operations, lookup, etc. for blender objects.
const Mesh * BKE_object_get_editmesh_eval_final(const Object *object)
#define MAX_GPU_SUBDIV_SSBOS
blender::bke::subdiv::Subdiv * BKE_subsurf_modifier_subdiv_descriptor_ensure(SubsurfRuntimeData *runtime_data, const Mesh *mesh, bool for_draw_code)
#define BLI_assert_unreachable()
void void void * BLI_linklist_pop(LinkNode **listp) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_linklist_prepend(LinkNode **listp, void *ptr) ATTR_NONNULL(1)
MINLINE uint divide_ceil_u(uint a, uint b)
#define BLI_string_joinN(...)
#define BLI_MUTEX_INITIALIZER
void BLI_mutex_lock(ThreadMutex *mutex)
void BLI_mutex_unlock(ThreadMutex *mutex)
pthread_mutex_t ThreadMutex
Platform independent time functions.
double BLI_time_now_seconds(void)
Object is a sort of wrapper for general info.
bool GPU_crappy_amd_driver()
int GPU_max_work_group_count(int index)
void GPU_compute_dispatch(GPUShader *shader, uint groups_x_len, uint groups_y_len, uint groups_z_len)
void GPU_indexbuf_bind_as_ssbo(blender::gpu::IndexBuf *elem, int binding)
int GPU_shader_get_ubo_binding(GPUShader *shader, const char *name)
void GPU_shader_bind(GPUShader *shader)
void GPU_shader_free(GPUShader *shader)
GPUShader * GPU_shader_create_compute(const char *computecode, const char *libcode, const char *defines, const char *shname)
void GPU_memory_barrier(eGPUBarrier barrier)
@ GPU_BARRIER_SHADER_STORAGE
@ GPU_BARRIER_ELEMENT_ARRAY
@ GPU_BARRIER_VERTEX_ATTRIB_ARRAY
void GPU_vertbuf_use(blender::gpu::VertBuf *)
void GPU_vertbuf_tag_dirty(blender::gpu::VertBuf *verts)
void GPU_vertbuf_wrap_handle(blender::gpu::VertBuf *verts, uint64_t handle)
#define GPU_vertbuf_init_with_format(verts, format)
#define GPU_VERTBUF_DISCARD_SAFE(verts)
blender::gpu::VertBuf * GPU_vertbuf_calloc()
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_bind_as_ssbo(blender::gpu::VertBuf *verts, int binding)
void GPU_vertbuf_update_sub(blender::gpu::VertBuf *verts, uint start, uint len, const void *data)
void GPU_vertbuf_init_with_format_ex(blender::gpu::VertBuf &verts, const GPUVertFormat &format, GPUUsageType)
void GPU_vertbuf_discard(blender::gpu::VertBuf *)
struct GPUShader GPUShader
#define BM_elem_index_get(ele)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void reinitialize(const int64_t new_size)
constexpr void fill(const T &value) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
#define SUBDIV_COARSE_FACE_FLAG_HIDDEN
char datatoc_common_subdiv_patch_evaluation_comp_glsl[]
#define SUBDIV_COARSE_FACE_FLAG_HIDDEN_MASK
char datatoc_common_subdiv_lib_glsl[]
char datatoc_common_subdiv_ibo_lines_comp_glsl[]
char datatoc_common_subdiv_ibo_tris_comp_glsl[]
#define SUBDIV_COARSE_FACE_FLAG_ACTIVE_MASK
char datatoc_common_subdiv_vbo_sculpt_data_comp_glsl[]
#define SUBDIV_COARSE_FACE_FLAG_OFFSET
char datatoc_common_subdiv_normals_finalize_comp_glsl[]
#define SUBDIV_COARSE_FACE_FLAG_SMOOTH_MASK
#define SUBDIV_COARSE_FACE_FLAG_SMOOTH
char datatoc_common_subdiv_vbo_lnor_comp_glsl[]
#define SUBDIV_COARSE_FACE_FLAG_ACTIVE
#define SUBDIV_COARSE_FACE_FLAG_SELECT_MASK
char datatoc_common_subdiv_custom_data_interp_comp_glsl[]
char datatoc_common_subdiv_vbo_edituv_strech_area_comp_glsl[]
#define SUBDIV_LOCAL_WORK_GROUP_SIZE
char datatoc_common_subdiv_normals_accumulate_comp_glsl[]
char datatoc_common_subdiv_vbo_edge_fac_comp_glsl[]
#define SHADER_CUSTOM_DATA_INTERP_MAX_DIMENSIONS
char datatoc_common_subdiv_vbo_edituv_strech_angle_comp_glsl[]
#define SUBDIV_COARSE_FACE_FLAG_SELECT
#define SUBDIV_COARSE_FACE_LOOP_START_MASK
bool DRW_ibo_requested(blender::gpu::IndexBuf *ibo)
draw_view in_light_buf[] float
void openSubdiv_deleteEvaluatorCache(OpenSubdiv_EvaluatorCache *evaluator_cache)
const char * openSubdiv_getGLSLPatchBasisSource(void)
void openSubdiv_deleteEvaluator(OpenSubdiv_Evaluator *evaluator)
OpenSubdiv_EvaluatorCache * openSubdiv_createEvaluatorCache(eOpenSubdivEvaluator evaluator_type)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
GroupedSpan< int > build_vert_to_edge_map(Span< int2 > edges, int verts_num, Array< int > &r_offsets, Array< int > &r_indices)
bool foreach_subdiv_geometry(Subdiv *subdiv, const ForeachContext *context, const ToMeshSettings *mesh_settings, const Mesh *coarse_mesh)
bool eval_begin_from_mesh(Subdiv *subdiv, const Mesh *mesh, Span< float3 > coarse_vert_positions, eSubdivEvaluatorType evaluator_type, OpenSubdiv_EvaluatorCache *evaluator_cache)
@ SUBDIV_EVALUATOR_TYPE_GPU
int * face_ptex_offset_get(Subdiv *subdiv)
static void opensubdiv_gpu_buffer_init(OpenSubdiv_Buffer *buffer_interface, gpu::VertBuf *vertbuf)
BLI_INLINE BMFace * bm_original_face_get(const MeshRenderData &mr, int idx)
static void draw_subdiv_init_ubo_storage(const DRWSubdivCache &cache, DRWSubdivUboStorage *ubo, const int src_offset, const int dst_offset, const uint total_dispatch_size, const bool has_sculpt_mask, const uint edge_loose_offset)
static void draw_subdiv_cache_free_material_data(DRWSubdivCache &cache)
static void draw_subdiv_free_edit_mode_cache(DRWSubdivCache &cache)
static void draw_subdiv_vertex_edge_cb(const bke::subdiv::ForeachContext *, void *, const int, const float, const float, const int, const int, const int, const int)
static bool draw_subdiv_create_requested_buffers(Object &ob, Mesh &mesh, MeshBatchCache &batch_cache, MeshBufferCache &mbc, const bool is_editmode, const bool is_paint_mode, const bool edit_mode_active, const float4x4 &object_to_world, const bool do_final, const bool do_uvedit, const bool do_cage, const ToolSettings *ts, const bool use_hide, OpenSubdiv_EvaluatorCache *evaluator_cache)
static const GPUVertFormat & get_patch_array_format()
void draw_subdiv_build_edge_fac_buffer(const DRWSubdivCache &cache, gpu::VertBuf *pos_nor, gpu::VertBuf *edge_draw_flag, gpu::VertBuf *poly_other_map, gpu::VertBuf *edge_fac)
static bool draw_subdiv_cache_need_face_data(const DRWSubdivCache &cache)
void draw_subdiv_extract_uvs(const DRWSubdivCache &cache, gpu::VertBuf *uvs, const int face_varying_channel, const int dst_offset)
static void vertbuf_update_data(const OpenSubdiv_Buffer *interface, uint start, uint len, const void *data)
static GPUShader * get_subdiv_shader(int shader_type)
static const char * get_shader_code(int shader_type)
void draw_subdiv_build_edituv_stretch_area_buffer(const DRWSubdivCache &cache, gpu::VertBuf *coarse_data, gpu::VertBuf *subdiv_data)
static void vertbuf_device_alloc(const OpenSubdiv_Buffer *interface, const uint len)
static void draw_patch_map_free(DRWPatchMap *gpu_patch_map)
static void draw_subdiv_cache_ensure_mat_offsets(DRWSubdivCache &cache, const Mesh *mesh_eval, uint mat_len)
void draw_subdiv_build_fdots_buffers(const DRWSubdivCache &cache, gpu::VertBuf *fdots_pos, gpu::VertBuf *fdots_nor, gpu::IndexBuf *fdots_indices)
static void do_subdiv_traversal(DRWCacheBuildingContext *cache_building_context, bke::subdiv::Subdiv *subdiv)
void DRW_subdivide_loose_geom(DRWSubdivCache &subdiv_cache, const MeshBufferCache &cache)
void DRW_create_subdivision(Object &ob, Mesh &mesh, MeshBatchCache &batch_cache, MeshBufferCache &mbc, const bool is_editmode, const bool is_paint_mode, const bool edit_mode_active, const float4x4 &object_to_world, const bool do_final, const bool do_uvedit, const bool do_cage, const ToolSettings *ts, const bool use_hide)
void draw_subdiv_cache_free(DRWSubdivCache &cache)
static GPUShader * get_subdiv_custom_data_shader(int comp_type, int dimensions)
static GPUShader * g_subdiv_custom_data_shaders[SHADER_CUSTOM_DATA_INTERP_MAX_DIMENSIONS][GPU_COMP_MAX]
static const char * get_shader_name(int shader_type)
void draw_subdiv_build_tris_buffer(const DRWSubdivCache &cache, gpu::IndexBuf *subdiv_tris, const int material_count)
static void draw_subdiv_foreach_callbacks(bke::subdiv::ForeachContext *foreach_context)
static void draw_subdiv_edge_cb(const bke::subdiv::ForeachContext *foreach_context, void *, const int coarse_edge_index, const int subdiv_edge_index, const bool, const int, const int)
static ThreadMutex gpu_subdiv_queue_mutex
static LinkNode * gpu_subdiv_free_queue
void DRW_subdiv_cache_free(bke::subdiv::Subdiv *subdiv)
void draw_subdiv_accumulate_normals(const DRWSubdivCache &cache, gpu::VertBuf *pos_nor, gpu::VertBuf *face_adjacency_offsets, gpu::VertBuf *face_adjacency_lists, gpu::VertBuf *vertex_loop_map, gpu::VertBuf *vert_normals)
void draw_subdiv_build_lines_buffer(const DRWSubdivCache &cache, gpu::IndexBuf *lines_indices)
static uint get_dispatch_size(uint elements)
static void * vertbuf_alloc(const OpenSubdiv_Buffer *interface, const uint len)
static GPUShader * g_subdiv_shaders[NUM_SHADERS]
void draw_subdiv_build_lnor_buffer(const DRWSubdivCache &cache, gpu::VertBuf *pos_nor, gpu::VertBuf *lnor)
void draw_subdiv_extract_pos_nor(const DRWSubdivCache &cache, gpu::VertBuf *flags_buffer, gpu::VertBuf *pos_nor, gpu::VertBuf *orco)
static void draw_subdiv_vertex_corner_cb(const bke::subdiv::ForeachContext *foreach_context, void *, const int, const float, const float, const int coarse_vertex_index, const int, const int, const int subdiv_vertex_index)
static void drw_subdiv_compute_dispatch(const DRWSubdivCache &cache, GPUShader *shader, const int src_offset, const int dst_offset, uint total_dispatch_size, const bool has_sculpt_mask=false, const uint edge_loose_offset=0)
static DRWSubdivCache & mesh_batch_cache_ensure_subdiv_cache(MeshBatchCache &mbc)
void draw_subdiv_build_lines_loose_buffer(const DRWSubdivCache &cache, gpu::IndexBuf *lines_indices, gpu::VertBuf *lines_flags, uint edge_loose_offset, uint num_loose_edges)
static uint32_t compute_coarse_face_flag_bm(BMFace *f, BMFace *efa_act)
static void draw_subdiv_cache_extra_coarse_face_data_mesh(const MeshRenderData &mr, const Mesh *mesh, MutableSpan< uint32_t > flags_data)
static const GPUVertFormat & get_blender_patch_coords_format()
void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache &cache, MeshBufferCache &mbc, DRWSubdivCache &subdiv_cache, MeshRenderData &mr)
static void vertbuf_bind_gpu(const OpenSubdiv_Buffer *buffer)
static uint tris_count_from_number_of_loops(const uint number_of_loops)
void draw_subdiv_build_sculpt_data_buffer(const DRWSubdivCache &cache, gpu::VertBuf *mask_vbo, gpu::VertBuf *face_set_vbo, gpu::VertBuf *sculpt_data)
std::unique_ptr< MeshRenderData > mesh_render_data_create(Object &object, Mesh &mesh, const bool is_editmode, const bool is_paint_mode, const bool edit_mode_active, const float4x4 &object_to_world, const bool do_final, const bool do_uvedit, const bool use_hide, const ToolSettings *ts)
void draw_subdiv_interp_custom_data(const DRWSubdivCache &cache, gpu::VertBuf &src_data, gpu::VertBuf &dst_data, int comp_type, int dimensions, int dst_offset)
static const GPUVertFormat & get_uvs_format()
void draw_subdiv_finalize_normals(const DRWSubdivCache &cache, gpu::VertBuf *vert_normals, gpu::VertBuf *subdiv_loop_subdiv_vert_index, gpu::VertBuf *pos_nor)
static void draw_patch_map_build(DRWPatchMap *gpu_patch_map, bke::subdiv::Subdiv *subdiv)
void DRW_cache_free_old_subdiv()
static void draw_subdiv_invalidate_evaluator_for_orco(bke::subdiv::Subdiv *subdiv, const Mesh *mesh)
gpu::VertBuf * draw_subdiv_build_origindex_buffer(int *vert_origindex, uint num_loops)
static void draw_subdiv_cache_extra_coarse_face_data_mapped(const Mesh *mesh, BMesh *bm, MeshRenderData &mr, MutableSpan< uint32_t > flags_data)
static void vertbuf_wrap_device_handle(const OpenSubdiv_Buffer *interface, uint64_t handle)
static gpu::VertBuf * create_buffer_and_interface(OpenSubdiv_Buffer *interface, const GPUVertFormat &format)
static gpu::VertBuf * gpu_vertbuf_create_from_format(const GPUVertFormat &format, uint len)
static const GPUVertFormat & get_quadtree_format()
static GPUShader * get_patch_evaluation_shader(int shader_type)
static void draw_subdiv_cache_update_extra_coarse_face_data(DRWSubdivCache &cache, const Mesh *mesh, MeshRenderData &mr)
static const GPUVertFormat & get_subdiv_vertex_format()
static bool draw_subdiv_build_cache(DRWSubdivCache &cache, bke::subdiv::Subdiv *subdiv, const Mesh *mesh_eval, const SubsurfRuntimeData *runtime_data)
static void build_vertex_face_adjacency_maps(DRWSubdivCache &cache)
static const GPUVertFormat & get_patch_index_format()
static const GPUVertFormat & get_origindex_format()
MINLINE CompressedPatchCoord make_patch_coord(int ptex_face_index, float u, float v)
static const GPUVertFormat & get_patch_param_format()
static const GPUVertFormat & get_patch_handle_format()
@ SHADER_BUFFER_NORMALS_FINALIZE
@ SHADER_BUFFER_UV_STRETCH_AREA
@ SHADER_COMP_CUSTOM_DATA_INTERP_4D
@ SHADER_PATCH_EVALUATION_FVAR
@ SHADER_BUFFER_LINES_LOOSE
@ SHADER_PATCH_EVALUATION_FACE_DOTS_WITH_NORMALS
@ SHADER_PATCH_EVALUATION
@ SHADER_PATCH_EVALUATION_FACE_DOTS
@ SHADER_COMP_CUSTOM_DATA_INTERP_2D
@ SHADER_PATCH_EVALUATION_ORCO
@ SHADER_BUFFER_CUSTOM_NORMALS_FINALIZE
@ SHADER_BUFFER_UV_STRETCH_ANGLE
@ SHADER_BUFFER_SCULPT_DATA
@ SHADER_BUFFER_NORMALS_ACCUMULATE
@ SHADER_BUFFER_TRIS_MULTIPLE_MATERIALS
@ SHADER_COMP_CUSTOM_DATA_INTERP_1D
@ SHADER_COMP_CUSTOM_DATA_INTERP_3D
const GPUVertFormat & draw_subdiv_get_pos_nor_format()
static void draw_subdiv_loop_cb(const bke::subdiv::ForeachContext *foreach_context, void *, const int ptex_face_index, const float u, const float v, const int, const int coarse_face_index, const int, const int subdiv_loop_index, const int subdiv_vertex_index, const int subdiv_edge_index)
void draw_subdiv_init_origindex_buffer(gpu::VertBuf &buffer, int32_t *vert_origindex, uint num_loops, uint loose_len)
static void draw_subdiv_ubo_update_and_bind(const DRWSubdivCache &cache, GPUShader *shader, const int src_offset, const int dst_offset, const uint total_dispatch_size, const bool has_sculpt_mask=false, const uint edge_loose_offset=0)
void draw_subdiv_finalize_custom_normals(const DRWSubdivCache &cache, gpu::VertBuf *src_custom_normals, gpu::VertBuf *pos_nor)
static bool draw_subdiv_topology_info_cb(const bke::subdiv::ForeachContext *foreach_context, const int num_verts, const int num_edges, const int num_loops, const int num_faces, const int *subdiv_face_offset)
void draw_subdiv_build_edituv_stretch_angle_buffer(const DRWSubdivCache &cache, gpu::VertBuf *pos_nor, gpu::VertBuf *uvs, int uvs_offset, gpu::VertBuf *stretch_angles)
static OpenSubdiv_EvaluatorCache * g_evaluator_cache
static void draw_subdiv_cache_extra_coarse_face_data_bm(BMesh *bm, BMFace *efa_act, MutableSpan< uint32_t > flags_data)
void build_reverse_offsets(Span< int > indices, MutableSpan< int > offsets)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
@ OPENSUBDIV_EVALUATOR_GPU
@ OPENSUBDIV_EVALUATOR_CPU
unsigned __int64 uint64_t
void(* device_update)(const OpenSubdiv_Buffer *buffer, unsigned int start, unsigned int len, const void *data)
void(* bind_gpu)(const OpenSubdiv_Buffer *buffer)
void(* wrap_device_handle)(const OpenSubdiv_Buffer *buffer, uint64_t device_ptr)
void(* device_alloc)(const OpenSubdiv_Buffer *buffer, const unsigned int size)
void *(* alloc)(const OpenSubdiv_Buffer *buffer, const unsigned int size)
void(* wrapFVarPatchIndexBuffer)(OpenSubdiv_Evaluator *evaluator, const int face_varying_channel, OpenSubdiv_Buffer *patch_index_buffer)
void(* wrapPatchIndexBuffer)(OpenSubdiv_Evaluator *evaluator, OpenSubdiv_Buffer *patch_index_buffer)
void(* wrapFVarSrcBuffer)(OpenSubdiv_Evaluator *evaluator, const int face_varying_channel, OpenSubdiv_Buffer *src_buffer)
void(* fillPatchArraysBuffer)(OpenSubdiv_Evaluator *evaluator, OpenSubdiv_Buffer *patch_array_buffer)
bool(* hasVertexData)(OpenSubdiv_Evaluator *evaluator)
void(* getPatchMap)(OpenSubdiv_Evaluator *evaluator, OpenSubdiv_Buffer *patch_map_handles, OpenSubdiv_Buffer *patch_map_quadtree, int *min_patch_face, int *max_patch_face, int *max_depth, int *patches_are_triangular)
void(* wrapSrcVertexDataBuffer)(OpenSubdiv_Evaluator *evaluator, OpenSubdiv_Buffer *src_buffer)
void(* wrapPatchParamBuffer)(OpenSubdiv_Evaluator *evaluator, OpenSubdiv_Buffer *patch_param_buffer)
void(* wrapFVarPatchParamBuffer)(OpenSubdiv_Evaluator *evaluator, const int face_varying_channel, OpenSubdiv_Buffer *patch_param_buffer)
void(* wrapSrcBuffer)(OpenSubdiv_Evaluator *evaluator, OpenSubdiv_Buffer *src_buffer)
void(* fillFVarPatchArraysBuffer)(OpenSubdiv_Evaluator *evaluator, const int face_varying_channel, OpenSubdiv_Buffer *patch_array_buffer)
eOpenSubdivEvaluator type
blender::bke::subdiv::Settings settings
blender::bke::subdiv::Subdiv * subdiv_gpu
ForeachVertexFromCornerCb vertex_corner
ForeachTopologyInformationCb topology_info
ForeachVertexFromEdgeCb vertex_edge
OpenSubdiv_Evaluator * evaluator
blender::opensubdiv::TopologyRefinerImpl * topology_refiner
const bke::subdiv::Subdiv * subdiv
int * subdiv_loop_edge_draw_flag
int * subdiv_loop_edge_index
int * subdiv_loop_vert_index
const int * orig_index_vert
int * subdiv_loop_subdiv_edge_index
const int * orig_index_edge
int * subdiv_loop_face_index
const bke::subdiv::ToMeshSettings * settings
CompressedPatchCoord * patch_coords
int * subdiv_loop_subdiv_vert_index
gpu::VertBuf * patch_map_quadtree
int patches_are_triangular
gpu::VertBuf * patch_map_handles
gpu::VertBuf * face_mat_offset
DRWPatchMap gpu_patch_map
int * subdiv_loop_subdiv_vert_index
gpu::VertBuf * verts_orig_index
gpu::VertBuf * subdiv_vertex_face_adjacency_offsets
gpu::VertBuf * edges_orig_index
gpu::VertBuf * subdiv_vertex_face_adjacency
bool use_custom_loop_normals
gpu::VertBuf * fdots_patch_coords
gpu::VertBuf * extra_coarse_face_data
gpu::VertBuf * face_ptex_offset_buffer
int * subdiv_loop_face_index
gpu::VertBuf * subdiv_face_offset_buffer
int * subdiv_loop_subdiv_edge_index
gpu::VertBuf * edges_draw_flag
Array< float3 > loose_edge_positions
uint num_subdiv_triangles
gpu::VertBuf * corner_patch_coords
bke::subdiv::Subdiv * subdiv
gpu::VertBuf * patch_coords
uint coarse_face_smooth_mask
uint coarse_face_select_mask
int patches_are_triangular
uint coarse_face_loopstart_mask
uint coarse_face_active_mask
uint coarse_face_hidden_mask
DRWSubdivCache * subdiv_cache
MeshExtractLooseGeom loose_geom
struct blender::draw::MeshBufferList::@248 ibo
const int * orig_index_face
VArraySpan< bool > sharp_faces
VArraySpan< bool > select_poly
eMRExtractType extract_type
VArraySpan< bool > hide_poly
bke::MeshNormalDomain normals_domain