Blender
V3.3
|
Curves API for render engines. More...
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_base.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector.h"
#include "BLI_math_vector.hh"
#include "BLI_span.hh"
#include "BLI_utildefines.h"
#include "DNA_curves_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_curves.hh"
#include "BKE_geometry_set.hh"
#include "GPU_batch.h"
#include "GPU_material.h"
#include "GPU_texture.h"
#include "DRW_render.h"
#include "draw_attributes.h"
#include "draw_cache_impl.h"
#include "draw_cache_inline.h"
#include "draw_curves_private.h"
#include "draw_shader.h"
Go to the source code of this file.
Classes | |
struct | CurvesBatchCache |
struct | PositionAndParameter |
Curves API for render engines.
Definition in file draw_cache_impl_curves.cc.
Definition at line 130 of file draw_cache_impl_curves.cc.
References curves, curves_batch_cache_clear_data(), CurvesBatchCache::curves_cache, CurvesBatchCache::edit_points, and GPU_BATCH_DISCARD_SAFE.
Referenced by DRW_curves_batch_cache_free(), and DRW_curves_batch_cache_validate().
|
static |
Definition at line 106 of file draw_cache_impl_curves.cc.
References curves_discard_attributes(), DRW_TEXTURE_FREE_SAFE, CurvesEvalCache::final, GPU_BATCH_DISCARD_SAFE, GPU_VERTBUF_DISCARD_SAFE, CurvesEvalCache::length_tex, MAX_HAIR_SUBDIV, MAX_THICKRES, CurvesEvalCache::point_tex, CurvesEvalFinalCache::proc_buf, CurvesEvalFinalCache::proc_hairs, CurvesEvalCache::proc_length_buf, CurvesEvalCache::proc_point_buf, CurvesEvalCache::proc_strand_buf, CurvesEvalCache::proc_strand_seg_buf, CurvesEvalFinalCache::proc_tex, CurvesEvalCache::strand_seg_tex, and CurvesEvalCache::strand_tex.
Referenced by curves_batch_cache_clear().
|
static |
Definition at line 315 of file draw_cache_impl_curves.cc.
References CurvesEvalFinalCache::attributes_buf, CurvesEvalFinalCache::attributes_tex, CurvesEvalCache::final, GPU_texture_create_from_vertbuf(), GPU_USAGE_DEVICE_ONLY, GPU_vertbuf_create_with_format_ex(), GPU_vertbuf_data_alloc(), GPU_vertbuf_use(), CurvesEvalCache::strands_len, and CurvesEvalFinalCache::strands_res.
Referenced by curves_batch_ensure_attribute().
|
static |
Definition at line 438 of file draw_cache_impl_curves.cc.
References CurvesEvalCache::final, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_texture_create_from_vertbuf(), GPU_USAGE_DEVICE_ONLY, GPU_vertbuf_create_with_format_ex(), GPU_vertbuf_data_alloc(), GPU_vertbuf_use(), GPU_vertformat_attr_add(), CurvesEvalFinalCache::proc_buf, CurvesEvalFinalCache::proc_tex, CurvesEvalCache::strands_len, and CurvesEvalFinalCache::strands_res.
Referenced by curves_ensure_procedural_data().
|
static |
Definition at line 474 of file draw_cache_impl_curves.cc.
References BLI_assert, curves, curves_batch_cache_fill_segments_indices(), CurvesEvalCache::final, GPU_batch_create_ex(), GPU_BATCH_OWNS_INDEX, GPU_BATCH_OWNS_VBO, GPU_COMP_U8, GPU_FETCH_INT_TO_FLOAT_UNIT, GPU_indexbuf_build(), GPU_indexbuf_init_ex(), GPU_PRIM_LINE_STRIP, GPU_PRIM_TRI_STRIP, GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertformat_attr_add(), GPU_vertformat_clear(), MAX_THICKRES, CurvesEvalFinalCache::proc_hairs, CurvesEvalCache::strands_len, and CurvesEvalFinalCache::strands_res.
Referenced by curves_ensure_procedural_data().
|
static |
Definition at line 262 of file draw_cache_impl_curves.cc.
References CD_HAIRLENGTH, curves, curves_batch_cache_fill_segments_proc_pos(), DRW_vbo_requested(), GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_material_attributes(), GPU_texture_create_from_vertbuf(), GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertbuf_get_data(), GPU_vertbuf_use(), GPU_vertformat_alias_add(), GPU_vertformat_attr_add(), CurvesEvalCache::length_tex, LISTBASE_FOREACH, CurvesEvalCache::point_len, CurvesEvalCache::point_tex, CurvesEvalCache::proc_length_buf, CurvesEvalCache::proc_point_buf, and CurvesEvalCache::strands_len.
Referenced by curves_ensure_procedural_data(), and DRW_curves_batch_cache_create_requested().
|
static |
Definition at line 407 of file draw_cache_impl_curves.cc.
References curves, curves_batch_cache_fill_strands_data(), GPU_COMP_U16, GPU_COMP_U32, GPU_FETCH_INT, GPU_texture_create_from_vertbuf(), GPU_vertbuf_attr_get_raw_data(), GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertbuf_use(), GPU_vertformat_attr_add(), CurvesEvalCache::proc_strand_buf, CurvesEvalCache::proc_strand_seg_buf, CurvesEvalCache::strand_seg_tex, CurvesEvalCache::strand_tex, and CurvesEvalCache::strands_len.
Referenced by curves_ensure_procedural_data().
|
static |
Definition at line 458 of file draw_cache_impl_curves.cc.
References curves, GPU_indexbuf_add_generic_vert(), and GPU_indexbuf_add_primitive_restart().
Referenced by curves_batch_cache_ensure_procedural_indices().
|
static |
Definition at line 223 of file draw_cache_impl_curves.cc.
References CurvesGeometry::curve_num, curves, blender::math::distance(), Curves::geometry, blender::Span< T >::index_range(), positions, blender::MutableSpan< T >::slice(), and blender::bke::CurvesGeometry::wrap().
Referenced by curves_batch_cache_ensure_procedural_pos().
|
static |
Definition at line 392 of file draw_cache_impl_curves.cc.
References curves, Curves::geometry, GPU_vertbuf_raw_step(), blender::IndexRange::size(), blender::IndexRange::start(), and blender::bke::CurvesGeometry::wrap().
Referenced by curves_batch_cache_ensure_procedural_strand_data().
|
static |
Definition at line 150 of file draw_cache_impl_curves.cc.
References curves, and DRW_curves_batch_cache_validate().
Referenced by curves_ensure_procedural_data(), DRW_curves_batch_cache_create_requested(), DRW_curves_batch_cache_get_edit_points(), DRW_curves_texture_for_evaluated_attribute(), and request_attribute().
Definition at line 72 of file draw_cache_impl_curves.cc.
References BLI_mutex_init(), curves, CurvesBatchCache::is_dirty, and CurvesBatchCache::render_mutex.
Referenced by DRW_curves_batch_cache_validate().
Definition at line 66 of file draw_cache_impl_curves.cc.
References curves, and CurvesBatchCache::is_dirty.
Referenced by DRW_curves_batch_cache_validate().
|
static |
Definition at line 337 of file draw_cache_impl_curves.cc.
References ATTR_DOMAIN_POINT, attribute, DRW_AttributeRequest::attribute_name, blender::bke::CurvesGeometry::attributes(), CurvesEvalFinalCache::attributes_buf, CurvesEvalFinalCache::attributes_tex, curves, curves_batch_cache_ensure_procedural_final_attr(), DRW_AttributeRequest::domain, blender::bke::AttributeAccessor::domain_size(), drw_curves_get_attribute_sampler_name(), DRW_TEXTURE_FREE_SAFE, CurvesEvalCache::final, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_texture_create_from_vertbuf(), GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_VERTBUF_DISCARD_SAFE, GPU_vertbuf_get_data(), GPU_vertbuf_use(), GPU_vertformat_attr_add(), GPU_vertformat_deinterleave(), blender::bke::AttributeAccessor::lookup_or_default(), CurvesEvalCache::proc_attributes_buf, CurvesEvalCache::proc_attributes_tex, and blender::bke::CurvesGeometry::wrap().
Referenced by curves_ensure_attributes().
|
static |
Definition at line 89 of file draw_cache_impl_curves.cc.
References CurvesEvalFinalCache::attr_used, CurvesEvalFinalCache::attributes_buf, CurvesEvalFinalCache::attributes_tex, drw_attributes_clear(), DRW_TEXTURE_FREE_SAFE, CurvesEvalCache::final, GPU_MAX_ATTR, GPU_VERTBUF_DISCARD_SAFE, MAX_HAIR_SUBDIV, CurvesEvalCache::proc_attributes_buf, and CurvesEvalCache::proc_attributes_tex.
Referenced by curves_batch_cache_clear_data(), and DRW_curves_batch_cache_free_old().
|
static |
Definition at line 508 of file draw_cache_impl_curves.cc.
References ATTR_DOMAIN_CURVE, ATTR_DOMAIN_POINT, CurvesEvalFinalCache::attr_used, CurvesEvalFinalCache::attr_used_over_time, curves, curves_batch_ensure_attribute(), CurvesBatchCache::curves_cache, DRW_AttributeRequest::domain, drw_attributes_add_request(), drw_attributes_clear(), drw_attributes_merge(), drw_attributes_overlap(), drw_custom_data_match_attribute(), DRW_TEXTURE_FREE_SAFE, CurvesEvalCache::final, GPU_material_attributes(), GPU_MAX_ATTR, GPU_VERTBUF_DISCARD_SAFE, LISTBASE_FOREACH, DRW_Attributes::num_requests, CurvesEvalCache::proc_attributes_buf, CurvesEvalCache::proc_attributes_tex, CurvesBatchCache::render_mutex, DRW_Attributes::requests, and type.
Referenced by curves_ensure_procedural_data().
bool curves_ensure_procedural_data | ( | struct Curves * | curves, |
struct CurvesEvalCache ** | r_hair_cache, | ||
struct GPUMaterial * | gpu_material, | ||
int | subdiv, | ||
int | thickness_res | ||
) |
Ensure all necessary textures and buffers exist for GPU accelerated drawing.
Definition at line 571 of file draw_cache_impl_curves.cc.
References curves, curves_batch_cache_ensure_procedural_final_points(), curves_batch_cache_ensure_procedural_indices(), curves_batch_cache_ensure_procedural_pos(), curves_batch_cache_ensure_procedural_strand_data(), curves_batch_cache_get(), CurvesBatchCache::curves_cache, curves_ensure_attributes(), ensure_seg_pt_count(), and steps.
Referenced by drw_curves_cache_get().
Definition at line 687 of file draw_cache_impl_curves.cc.
References curves, curves_batch_cache_ensure_procedural_pos(), curves_batch_cache_get(), CurvesBatchCache::curves_cache, Object::data, DRW_batch_requested(), DRW_vbo_request(), DRW_vbo_requested(), CurvesBatchCache::edit_points, GPU_PRIM_POINTS, and CurvesEvalCache::proc_point_buf.
Referenced by drw_batch_cache_generate_requested().
Definition at line 156 of file draw_cache_impl_curves.cc.
References BKE_CURVES_BATCH_DIRTY_ALL, BLI_assert_unreachable, curves, and CurvesBatchCache::is_dirty.
Referenced by DRW_engines_register().
Definition at line 171 of file draw_cache_impl_curves.cc.
References BLI_mutex_end(), curves, curves_batch_cache_clear(), MEM_SAFE_FREE, and CurvesBatchCache::render_mutex.
Referenced by DRW_engines_register().
Definition at line 179 of file draw_cache_impl_curves.cc.
References CurvesEvalFinalCache::attr_used, CurvesEvalFinalCache::attr_used_over_time, curves, CurvesBatchCache::curves_cache, curves_discard_attributes(), drw_attributes_clear(), drw_attributes_overlap(), CurvesEvalCache::final, CurvesEvalFinalCache::last_attr_matching_time, and MAX_HAIR_SUBDIV.
Referenced by DRW_batch_cache_free_old().
Definition at line 617 of file draw_cache_impl_curves.cc.
References curves, curves_batch_cache_get(), DRW_batch_request(), and CurvesBatchCache::edit_points.
Referenced by overlay_edit_curves_add_ob_to_pass().
Definition at line 142 of file draw_cache_impl_curves.cc.
References curves, curves_batch_cache_clear(), curves_batch_cache_init(), and curves_batch_cache_valid().
Referenced by curves_batch_cache_get(), and drw_batch_cache_validate().
void drw_curves_get_attribute_sampler_name | ( | const char * | layer_name, |
char | r_sampler_name[32] | ||
) |
Definition at line 307 of file draw_cache_impl_curves.cc.
References BLI_snprintf(), GPU_MAX_SAFE_ATTR_NAME, and GPU_vertformat_safe_attr_name().
Referenced by curves_batch_ensure_attribute(), and DRW_shgroup_curves_create_sub().
int DRW_curves_material_count_get | ( | Curves * | curves | ) |
Definition at line 612 of file draw_cache_impl_curves.cc.
References curves, and max_ii().
Referenced by DRW_cache_object_material_count_get().
GPUTexture** DRW_curves_texture_for_evaluated_attribute | ( | struct Curves * | curves, |
const char * | name, | ||
bool * | r_is_point_domain | ||
) |
Provide GPU access to a specific evaluated attribute on curves.
Definition at line 651 of file draw_cache_impl_curves.cc.
References ATTR_DOMAIN_CURVE, ATTR_DOMAIN_POINT, CurvesEvalFinalCache::attr_used, DRW_AttributeRequest::attribute_name, CurvesEvalFinalCache::attributes_tex, BLI_assert_unreachable, curves, curves_batch_cache_get(), CurvesBatchCache::curves_cache, DRW_AttributeRequest::domain, DRW_context_state_get(), CurvesEvalCache::final, RenderData::hair_subdiv, DRW_Attributes::num_requests, CurvesEvalCache::proc_attributes_tex, Scene::r, request_attribute(), DRW_Attributes::requests, scene, DRWContextState::scene, and STREQ.
Referenced by OVERLAY_sculpt_curves_cache_populate().
|
static |
Definition at line 207 of file draw_cache_impl_curves.cc.
References curves, CurvesEvalCache::elems_len, CurvesEvalCache::point_len, CurvesEvalCache::proc_point_buf, and CurvesEvalCache::strands_len.
Referenced by curves_ensure_procedural_data().
Definition at line 623 of file draw_cache_impl_curves.cc.
References ATTR_DOMAIN_POINT, CurvesEvalFinalCache::attr_used, blender::bke::CurvesGeometry::attributes(), curves, curves_batch_cache_get(), CurvesBatchCache::curves_cache, CustomData_get_named_layer(), drw_attributes_add_request(), drw_attributes_merge(), DRW_context_state_get(), CurvesEvalCache::final, RenderData::hair_subdiv, blender::bke::AttributeAccessor::lookup_meta_data(), Scene::r, CurvesBatchCache::render_mutex, scene, DRWContextState::scene, type, and blender::bke::CurvesGeometry::wrap().
Referenced by DRW_curves_texture_for_evaluated_attribute().