Blender  V3.3
draw_curves.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2017 Blender Foundation. All rights reserved. */
3 
10 #include "BLI_string_utils.h"
11 #include "BLI_utildefines.h"
12 
13 #include "DNA_curves_types.h"
14 #include "DNA_customdata_types.h"
15 
16 #include "BKE_curves.hh"
17 #include "BKE_geometry_set.hh"
18 
19 #include "GPU_batch.h"
20 #include "GPU_capabilities.h"
21 #include "GPU_compute.h"
22 #include "GPU_material.h"
23 #include "GPU_shader.h"
24 #include "GPU_texture.h"
25 #include "GPU_vertex_buffer.h"
26 
27 #include "DRW_gpu_wrapper.hh"
28 #include "DRW_render.h"
29 
30 #include "draw_cache_impl.h"
31 #include "draw_curves_private.h"
32 #include "draw_hair_private.h"
33 #include "draw_manager.h"
34 #include "draw_shader.h"
35 
36 #ifndef __APPLE__
37 # define USE_TRANSFORM_FEEDBACK
38 # define USE_COMPUTE_SHADERS
39 #endif
40 
42 {
43 #ifdef USE_COMPUTE_SHADERS
46  }
47 #endif
48 #ifdef USE_TRANSFORM_FEEDBACK
50 #endif
52 }
53 
54 #ifndef USE_TRANSFORM_FEEDBACK
55 struct CurvesEvalCall {
56  struct CurvesEvalCall *next;
57  GPUVertBuf *vbo;
58  DRWShadingGroup *shgrp;
59  uint vert_len;
60 };
61 
62 static CurvesEvalCall *g_tf_calls = nullptr;
63 static int g_tf_id_offset;
64 static int g_tf_target_width;
65 static int g_tf_target_height;
66 #endif
67 
68 static GPUVertBuf *g_dummy_vbo = nullptr;
69 static GPUTexture *g_dummy_texture = nullptr;
70 static DRWPass *g_tf_pass; /* XXX can be a problem with multiple DRWManager in the future */
71 
73 
76  int used = 0;
77 
78  void reset()
79  {
80  used = 0;
81  }
82 
84  {
85  if (used >= ubos.size()) {
86  ubos.append(std::make_unique<CurvesInfosBuf>());
87  return *ubos.last();
88  }
89  return *ubos[used++];
90  }
91 };
92 
94 {
96 }
97 
98 void DRW_curves_init(DRWData *drw_data)
99 {
100  /* Initialize legacy hair too, to avoid verbosity in callers. */
101  DRW_hair_init();
102 
103  if (drw_data->curves_ubos == nullptr) {
104  drw_data->curves_ubos = MEM_new<CurvesUniformBufPool>("CurvesUniformBufPool");
105  }
107  pool->reset();
108 
109 #if defined(USE_TRANSFORM_FEEDBACK) || defined(USE_COMPUTE_SHADERS)
110  g_tf_pass = DRW_pass_create("Update Curves Pass", (DRWState)0);
111 #else
112  g_tf_pass = DRW_pass_create("Update Curves Pass", DRW_STATE_WRITE_COLOR);
113 #endif
114 
115  if (g_dummy_vbo == nullptr) {
116  /* initialize vertex format */
117  GPUVertFormat format = {0};
119 
121 
122  const float vert[4] = {0.0f, 0.0f, 0.0f, 0.0f};
124  GPU_vertbuf_attr_fill(g_dummy_vbo, dummy_id, vert);
125  /* Create vbo immediately to bind to texture buffer. */
127 
129  }
130 }
131 
133 {
134  MEM_delete(pool);
135 }
136 
138  CurvesEvalCache *cache,
139  GPUTexture *tex,
140  const int subdiv)
141 {
142  DRW_shgroup_uniform_texture(shgrp, "hairPointBuffer", tex);
143  DRW_shgroup_uniform_texture(shgrp, "hairStrandBuffer", cache->strand_tex);
144  DRW_shgroup_uniform_texture(shgrp, "hairStrandSegBuffer", cache->strand_seg_tex);
145  DRW_shgroup_uniform_int(shgrp, "hairStrandsRes", &cache->final[subdiv].strands_res, 1);
146 }
147 
149  const int subdiv,
150  const int strands_len,
152  GPUTexture *tex)
153 {
155  DRWShadingGroup *shgrp = DRW_shgroup_create(shader, g_tf_pass);
156  drw_curves_cache_shgrp_attach_resources(shgrp, cache, tex, subdiv);
157  DRW_shgroup_vertex_buffer(shgrp, "posTime", buffer);
158 
159  const int max_strands_per_call = GPU_max_work_group_count(0);
160  int strands_start = 0;
161  while (strands_start < strands_len) {
162  int batch_strands_len = MIN2(strands_len - strands_start, max_strands_per_call);
163  DRWShadingGroup *subgroup = DRW_shgroup_create_sub(shgrp);
164  DRW_shgroup_uniform_int_copy(subgroup, "hairStrandOffset", strands_start);
165  DRW_shgroup_call_compute(subgroup, batch_strands_len, cache->final[subdiv].strands_res, 1);
166  strands_start += batch_strands_len;
167  }
168 }
169 
170 static void drw_curves_cache_update_compute(CurvesEvalCache *cache, const int subdiv)
171 {
172  const int strands_len = cache->strands_len;
173  const int final_points_len = cache->final[subdiv].strands_res * strands_len;
174  if (final_points_len == 0) {
175  return;
176  }
177 
179  cache, subdiv, strands_len, cache->final[subdiv].proc_buf, cache->point_tex);
180 
181  const DRW_Attributes &attrs = cache->final[subdiv].attr_used;
182  for (int i = 0; i < attrs.num_requests; i++) {
183  /* Only refine point attributes. */
184  if (attrs.requests[i].domain == ATTR_DOMAIN_CURVE) {
185  continue;
186  }
187 
189  subdiv,
190  strands_len,
191  cache->final[subdiv].attributes_buf[i],
192  cache->proc_attributes_tex[i]);
193  }
194 }
195 
197  GPUVertBuf *vbo,
198  GPUTexture *tex,
199  const int subdiv,
200  const int final_points_len)
201 {
203 
204 #ifdef USE_TRANSFORM_FEEDBACK
206 #else
207  DRWShadingGroup *tf_shgrp = DRW_shgroup_create(tf_shader, g_tf_pass);
208 
209  CurvesEvalCall *pr_call = MEM_new<CurvesEvalCall>(__func__);
210  pr_call->next = g_tf_calls;
211  pr_call->vbo = vbo;
212  pr_call->shgrp = tf_shgrp;
213  pr_call->vert_len = final_points_len;
214  g_tf_calls = pr_call;
215  DRW_shgroup_uniform_int(tf_shgrp, "targetHeight", &g_tf_target_height, 1);
216  DRW_shgroup_uniform_int(tf_shgrp, "targetWidth", &g_tf_target_width, 1);
217  DRW_shgroup_uniform_int(tf_shgrp, "idOffset", &g_tf_id_offset, 1);
218 #endif
219 
220  drw_curves_cache_shgrp_attach_resources(tf_shgrp, cache, tex, subdiv);
221  DRW_shgroup_call_procedural_points(tf_shgrp, nullptr, final_points_len);
222 }
223 
224 static void drw_curves_cache_update_transform_feedback(CurvesEvalCache *cache, const int subdiv)
225 {
226  const int final_points_len = cache->final[subdiv].strands_res * cache->strands_len;
227  if (final_points_len == 0) {
228  return;
229  }
230 
232  cache, cache->final[subdiv].proc_buf, cache->point_tex, subdiv, final_points_len);
233 
234  const DRW_Attributes &attrs = cache->final[subdiv].attr_used;
235  for (int i = 0; i < attrs.num_requests; i++) {
236  /* Only refine point attributes. */
237  if (attrs.requests[i].domain == ATTR_DOMAIN_CURVE) {
238  continue;
239  }
240 
242  cache->final[subdiv].attributes_buf[i],
243  cache->proc_attributes_tex[i],
244  subdiv,
245  final_points_len);
246  }
247 }
248 
250  GPUMaterial *gpu_material,
251  int subdiv,
252  int thickness_res)
253 {
254  CurvesEvalCache *cache;
256  &curves, &cache, gpu_material, subdiv, thickness_res);
257 
258  if (update) {
260  drw_curves_cache_update_compute(cache, subdiv);
261  }
262  else {
264  }
265  }
266  return cache;
267 }
268 
270 {
271  const DRWContextState *draw_ctx = DRW_context_state_get();
272  const Scene *scene = draw_ctx->scene;
273 
274  const int subdiv = scene->r.hair_subdiv;
275  const int thickness_res = (scene->r.hair_type == SCE_HAIR_SHAPE_STRAND) ? 1 : 2;
276 
277  Curves &curves = *static_cast<Curves *>(object->data);
278  CurvesEvalCache *cache = drw_curves_cache_get(curves, nullptr, subdiv, thickness_res);
279 
280  return cache->final[subdiv].proc_buf;
281 }
282 
283 static int attribute_index_in_material(GPUMaterial *gpu_material, const char *name)
284 {
285  if (!gpu_material) {
286  return -1;
287  }
288 
289  int index = 0;
290 
291  ListBase gpu_attrs = GPU_material_attributes(gpu_material);
292  LISTBASE_FOREACH (GPUMaterialAttribute *, gpu_attr, &gpu_attrs) {
293  if (STREQ(gpu_attr->name, name)) {
294  return index;
295  }
296 
297  index++;
298  }
299 
300  return -1;
301 }
302 
304  DRWShadingGroup *shgrp_parent,
305  GPUMaterial *gpu_material)
306 {
307  const DRWContextState *draw_ctx = DRW_context_state_get();
308  const Scene *scene = draw_ctx->scene;
310  CurvesInfosBuf &curves_infos = pool->alloc();
311  Curves &curves_id = *static_cast<Curves *>(object->data);
312 
313  const int subdiv = scene->r.hair_subdiv;
314  const int thickness_res = (scene->r.hair_type == SCE_HAIR_SHAPE_STRAND) ? 1 : 2;
315 
316  CurvesEvalCache *curves_cache = drw_curves_cache_get(
317  curves_id, gpu_material, subdiv, thickness_res);
318 
319  DRWShadingGroup *shgrp = DRW_shgroup_create_sub(shgrp_parent);
320 
321  /* Fix issue with certain driver not drawing anything if there is no texture bound to
322  * "ac", "au", "u" or "c". */
327 
328  /* TODO: Generalize radius implementation for curves data type. */
329  float hair_rad_shape = 0.0f;
330  float hair_rad_root = 0.005f;
331  float hair_rad_tip = 0.0f;
332  bool hair_close_tip = true;
333 
334  /* Use the radius of the root and tip of the first curve for now. This is a workaround that we
335  * use for now because we can't use a per-point radius yet. */
337  curves_id.geometry);
338  if (curves.curves_num() >= 1) {
339  blender::VArray<float> radii = curves.attributes().lookup_or_default(
340  "radius", ATTR_DOMAIN_POINT, 0.005f);
341  const blender::IndexRange first_curve_points = curves.points_for_curve(0);
342  const float first_radius = radii[first_curve_points.first()];
343  const float last_radius = radii[first_curve_points.last()];
344  const float middle_radius = radii[first_curve_points.size() / 2];
345  hair_rad_root = radii[first_curve_points.first()];
346  hair_rad_tip = radii[first_curve_points.last()];
347  hair_rad_shape = std::clamp(
348  safe_divide(middle_radius - first_radius, last_radius - first_radius) * 2.0f - 1.0f,
349  -1.0f,
350  1.0f);
351  }
352 
353  DRW_shgroup_uniform_texture(shgrp, "hairPointBuffer", curves_cache->final[subdiv].proc_tex);
354  if (curves_cache->length_tex) {
355  DRW_shgroup_uniform_texture(shgrp, "hairLen", curves_cache->length_tex);
356  }
357 
358  const DRW_Attributes &attrs = curves_cache->final[subdiv].attr_used;
359  for (int i = 0; i < attrs.num_requests; i++) {
360  const DRW_AttributeRequest &request = attrs.requests[i];
361 
362  char sampler_name[32];
364 
365  if (request.domain == ATTR_DOMAIN_CURVE) {
366  if (!curves_cache->proc_attributes_tex[i]) {
367  continue;
368  }
369 
370  DRW_shgroup_uniform_texture(shgrp, sampler_name, curves_cache->proc_attributes_tex[i]);
371  }
372  else {
373  if (!curves_cache->final[subdiv].attributes_tex[i]) {
374  continue;
375  }
377  shgrp, sampler_name, curves_cache->final[subdiv].attributes_tex[i]);
378  }
379 
380  /* Some attributes may not be used in the shader anymore and were not garbage collected yet, so
381  * we need to find the right index for this attribute as uniforms defining the scope of the
382  * attributes are based on attribute loading order, which is itself based on the material's
383  * attributes. */
384  const int index = attribute_index_in_material(gpu_material, request.attribute_name);
385  if (index != -1) {
386  curves_infos.is_point_attribute[index][0] = request.domain == ATTR_DOMAIN_POINT;
387  }
388  }
389 
390  curves_infos.push_update();
391 
392  DRW_shgroup_uniform_block(shgrp, "drw_curves", curves_infos);
393 
394  DRW_shgroup_uniform_int(shgrp, "hairStrandsRes", &curves_cache->final[subdiv].strands_res, 1);
395  DRW_shgroup_uniform_int_copy(shgrp, "hairThicknessRes", thickness_res);
396  DRW_shgroup_uniform_float_copy(shgrp, "hairRadShape", hair_rad_shape);
397  DRW_shgroup_uniform_mat4_copy(shgrp, "hairDupliMatrix", object->obmat);
398  DRW_shgroup_uniform_float_copy(shgrp, "hairRadRoot", hair_rad_root);
399  DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", hair_rad_tip);
400  DRW_shgroup_uniform_bool_copy(shgrp, "hairCloseTip", hair_close_tip);
401  if (gpu_material) {
402  /* \note: This needs to happen before the drawcall to allow correct attribute extraction.
403  * (see T101896) */
404  DRW_shgroup_add_material_resources(shgrp, gpu_material);
405  }
406  /* TODO(fclem): Until we have a better way to cull the curves and render with orco, bypass
407  * culling test. */
408  GPUBatch *geom = curves_cache->final[subdiv].proc_hairs[thickness_res - 1];
409  DRW_shgroup_call_no_cull(shgrp, geom, object);
410 
411  return shgrp;
412 }
413 
415 {
416  /* Update legacy hair too, to avoid verbosity in callers. */
417  DRW_hair_update();
418 
419 #ifndef USE_TRANSFORM_FEEDBACK
430  if (g_tf_calls == nullptr) {
431  return;
432  }
433 
434  /* Search ideal buffer size. */
435  uint max_size = 0;
436  for (CurvesEvalCall *pr_call = g_tf_calls; pr_call; pr_call = pr_call->next) {
437  max_size = max_ii(max_size, pr_call->vert_len);
438  }
439 
440  /* Create target Texture / Frame-buffer */
441  /* Don't use max size as it can be really heavy and fail.
442  * Do chunks of maximum 2048 * 2048 hair points. */
443  int width = 2048;
444  int height = min_ii(width, 1 + max_size / width);
447  g_tf_target_height = height;
448  g_tf_target_width = width;
449 
450  GPUFrameBuffer *fb = nullptr;
451  GPU_framebuffer_ensure_config(&fb,
452  {
453  GPU_ATTACHMENT_NONE,
454  GPU_ATTACHMENT_TEXTURE(tex),
455  });
456 
457  float *data = static_cast<float *>(
458  MEM_mallocN(sizeof(float[4]) * width * height, "tf fallback buffer"));
459 
461  while (g_tf_calls != nullptr) {
462  CurvesEvalCall *pr_call = g_tf_calls;
463  g_tf_calls = g_tf_calls->next;
464 
465  g_tf_id_offset = 0;
466  while (pr_call->vert_len > 0) {
467  int max_read_px_len = min_ii(width * height, pr_call->vert_len);
468 
469  DRW_draw_pass_subset(g_tf_pass, pr_call->shgrp, pr_call->shgrp);
470  /* Read back result to main memory. */
472  /* Upload back to VBO. */
473  GPU_vertbuf_use(pr_call->vbo);
474  GPU_vertbuf_update_sub(pr_call->vbo,
475  sizeof(float[4]) * g_tf_id_offset,
476  sizeof(float[4]) * max_read_px_len,
477  data);
478 
479  g_tf_id_offset += max_read_px_len;
480  pr_call->vert_len -= max_read_px_len;
481  }
482 
483  MEM_freeN(pr_call);
484  }
485 
486  MEM_freeN(data);
488 #else
489  /* Just render the pass when using compute shaders or transform feedback. */
493  }
494 #endif
495 }
496 
498 {
499  DRW_hair_free();
500 
503 }
@ ATTR_DOMAIN_CURVE
Definition: BKE_attribute.h:31
@ ATTR_DOMAIN_POINT
Definition: BKE_attribute.h:27
Low-level operations for curves.
#define BLI_INLINE
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
unsigned int uint
Definition: BLI_sys_types.h:67
#define MIN2(a, b)
#define STREQ(a, b)
@ SCE_HAIR_SHAPE_STRAND
#define DRW_shgroup_vertex_buffer(shgroup, name, vert)
Definition: DRW_render.h:647
#define DRW_shgroup_call_no_cull(shgroup, geom, ob)
Definition: DRW_render.h:431
DRWState
Definition: DRW_render.h:298
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:303
#define DRW_shgroup_uniform_block(shgroup, name, ubo)
Definition: DRW_render.h:651
#define DRW_TEXTURE_FREE_SAFE(tex)
Definition: DRW_render.h:183
GPUBatch
Definition: GPU_batch.h:78
bool GPU_compute_shader_support(void)
int GPU_max_work_group_count(int index)
bool GPU_shader_storage_buffer_objects_support(void)
struct GPUFrameBuffer GPUFrameBuffer
void GPU_framebuffer_free(GPUFrameBuffer *fb)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
ListBase GPU_material_attributes(GPUMaterial *material)
Definition: gpu_material.c:216
struct GPUShader GPUShader
Definition: GPU_shader.h:20
void GPU_memory_barrier(eGPUBarrier barrier)
Definition: gpu_state.cc:371
@ GPU_BARRIER_SHADER_STORAGE
Definition: GPU_state.h:29
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
GPUTexture * GPU_texture_create_from_vertbuf(const char *name, struct GPUVertBuf *vert)
Definition: gpu_texture.cc:361
@ GPU_DATA_FLOAT
Definition: GPU_texture.h:171
@ GPU_RGBA32F
Definition: GPU_texture.h:90
#define GPU_vertbuf_create_with_format(format)
struct GPUVertBuf GPUVertBuf
void GPU_vertbuf_update_sub(GPUVertBuf *verts, uint start, uint len, const void *data)
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len)
#define GPU_VERTBUF_DISCARD_SAFE(verts)
void GPU_vertbuf_use(GPUVertBuf *)
void GPU_vertbuf_attr_fill(GPUVertBuf *, uint a_idx, const void *data)
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
constexpr int64_t first() const
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
static CurvesGeometry & wrap(::CurvesGeometry &dna_struct)
Definition: BKE_curves.hh:138
Scene scene
bool curves_ensure_procedural_data(Curves *curves, CurvesEvalCache **r_hair_cache, GPUMaterial *gpu_material, const int subdiv, const int thickness_res)
void drw_curves_get_attribute_sampler_name(const char *layer_name, char r_sampler_name[32])
void DRW_hair_update(void)
Definition: draw_hair.cc:312
void DRW_hair_init(void)
Definition: draw_hair.cc:78
void DRW_hair_free(void)
Definition: draw_hair.cc:391
void DRW_curves_free()
Definition: draw_curves.cc:497
DRWShadingGroup * DRW_shgroup_curves_create_sub(Object *object, DRWShadingGroup *shgrp_parent, GPUMaterial *gpu_material)
Definition: draw_curves.cc:303
void DRW_curves_init(DRWData *drw_data)
Definition: draw_curves.cc:98
static void drw_curves_cache_shgrp_attach_resources(DRWShadingGroup *shgrp, CurvesEvalCache *cache, GPUTexture *tex, const int subdiv)
Definition: draw_curves.cc:137
BLI_INLINE eParticleRefineShaderType drw_curves_shader_type_get()
Definition: draw_curves.cc:41
static GPUTexture * g_dummy_texture
Definition: draw_curves.cc:69
static GPUVertBuf * g_dummy_vbo
Definition: draw_curves.cc:68
void DRW_curves_update()
Definition: draw_curves.cc:414
static GPUShader * curves_eval_shader_get(CurvesEvalShader type)
Definition: draw_curves.cc:93
void DRW_curves_ubos_pool_free(CurvesUniformBufPool *pool)
Definition: draw_curves.cc:132
GPUVertBuf * DRW_curves_pos_buffer_get(Object *object)
Definition: draw_curves.cc:269
static void drw_curves_cache_update_transform_feedback(CurvesEvalCache *cache, GPUVertBuf *vbo, GPUTexture *tex, const int subdiv, const int final_points_len)
Definition: draw_curves.cc:196
static CurvesEvalCache * drw_curves_cache_get(Curves &curves, GPUMaterial *gpu_material, int subdiv, int thickness_res)
Definition: draw_curves.cc:249
static void drw_curves_cache_update_compute(CurvesEvalCache *cache, const int subdiv, const int strands_len, GPUVertBuf *buffer, GPUTexture *tex)
Definition: draw_curves.cc:148
static int attribute_index_in_material(GPUMaterial *gpu_material, const char *name)
Definition: draw_curves.cc:283
static DRWPass * g_tf_pass
Definition: draw_curves.cc:70
CurvesEvalShader
@ CURVES_EVAL_CATMULL_ROM
DRWManager DST
Definition: draw_manager.c:104
const DRWContextState * DRW_context_state_get(void)
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
void DRW_shgroup_call_compute(DRWShadingGroup *shgroup, int groups_x_len, int groups_y_len, int groups_z_len)
void DRW_shgroup_call_procedural_points(DRWShadingGroup *shgroup, Object *ob, uint point_count)
void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_int(DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
DRWShadingGroup * DRW_shgroup_transform_feedback_create(struct GPUShader *shader, DRWPass *pass, GPUVertBuf *tf_target)
void DRW_shgroup_add_material_resources(DRWShadingGroup *grp, struct GPUMaterial *material)
DRWShadingGroup * DRW_shgroup_create_sub(DRWShadingGroup *shgroup)
DRWPass * DRW_pass_create(const char *name, DRWState state)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_shgroup_uniform_mat4_copy(DRWShadingGroup *shgroup, const char *name, const float(*value)[4])
void DRW_draw_pass(DRWPass *pass)
void DRW_draw_pass_subset(DRWPass *pass, DRWShadingGroup *start_group, DRWShadingGroup *end_group)
GPUTexture * DRW_texture_pool_query_2d(int w, int h, eGPUTextureFormat format, DrawEngineType *engine_type)
GPUShader * DRW_shader_curves_refine_get(CurvesEvalShader type, eParticleRefineShaderType sh_type)
Definition: draw_shader.cc:88
eParticleRefineShaderType
Definition: draw_shader.h:19
@ PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND
Definition: draw_shader.h:21
@ PART_REFINE_SHADER_COMPUTE
Definition: draw_shader.h:22
@ PART_REFINE_SHADER_TRANSFORM_FEEDBACK
Definition: draw_shader.h:20
void GPU_framebuffer_read_color(GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, int channels, int slot, eGPUDataFormat format, void *data)
BLI_INLINE float fb(float length, float L)
ccl_global float * buffer
format
Definition: logImageCore.h:38
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
static ulong * next
T clamp(const T &a, const T &min, const T &max)
T safe_divide(const T &a, const T &b)
static void update(bNodeTree *ntree)
MutableSpan< float > radii
GPUTexture * point_tex
CurvesEvalFinalCache final[MAX_HAIR_SUBDIV]
GPUTexture * strand_tex
GPUTexture * proc_attributes_tex[GPU_MAX_ATTR]
GPUTexture * length_tex
GPUTexture * strand_seg_tex
GPUBatch * proc_hairs[MAX_THICKRES]
GPUVertBuf * attributes_buf[GPU_MAX_ATTR]
GPUTexture * attributes_tex[GPU_MAX_ATTR]
blender::Vector< std::unique_ptr< CurvesInfosBuf > > ubos
Definition: draw_curves.cc:75
CurvesInfosBuf & alloc()
Definition: draw_curves.cc:83
CurvesGeometry geometry
struct Scene * scene
Definition: DRW_render.h:979
struct CurvesUniformBufPool * curves_ubos
Definition: draw_manager.h:544
DRWData * vmempool
Definition: draw_manager.h:562
DRW_AttributeRequest requests[GPU_MAX_ATTR]
float obmat[4][4]
struct RenderData r