Blender V5.0
draw_curves_info.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#ifdef GPU_SHADER
10# pragma once
11# include "gpu_shader_compat.hh"
12
15
16# define DRW_HAIR_INFO
17#endif
18
20
22
23GPU_SHADER_CREATE_INFO(draw_curves_topology)
25/* Offsets giving the start and end of the curve. */
26STORAGE_BUF(0, read, int, evaluated_offsets_buf[])
27STORAGE_BUF(1, read, uint, curves_cyclic_buf[]) /* Actually bool (1 byte). */
28STORAGE_BUF(2, write, int, indirection_buf[])
29PUSH_CONSTANT(int, curves_start)
30PUSH_CONSTANT(int, curves_count)
31PUSH_CONSTANT(bool, is_ribbon_topology)
32PUSH_CONSTANT(bool, use_cyclic)
33COMPUTE_SOURCE("draw_curves_topology_comp.glsl")
36
37GPU_SHADER_CREATE_INFO(draw_curves_data)
39/* Offsets giving the start and end of the curve. */
40STORAGE_BUF(EVALUATED_POINT_SLOT, read, int, evaluated_points_by_curve_buf[])
41STORAGE_BUF(POINTS_BY_CURVES_SLOT, read, int, points_by_curve_buf[])
42STORAGE_BUF(CURVE_RESOLUTION_SLOT, read, uint, curves_resolution_buf[])
43STORAGE_BUF(CURVE_TYPE_SLOT, read, uint, curves_type_buf[]) /* Actually int8_t. */
44STORAGE_BUF(CURVE_CYCLIC_SLOT, read, uint, curves_cyclic_buf[]) /* Actually bool (1 byte). */
45/* Bezier handles (if needed). */
46STORAGE_BUF(HANDLES_POS_LEFT_SLOT, read, float, handles_positions_left_buf[])
47STORAGE_BUF(HANDLES_POS_RIGHT_SLOT, read, float, handles_positions_right_buf[])
48STORAGE_BUF(BEZIER_OFFSETS_SLOT, read, int, bezier_offsets_buf[])
49/* Nurbs (alias of other buffers). */
50// STORAGE_BUF(CURVES_ORDER_SLOT, read, uint, curves_order_buf[]) /* Actually int8_t. */
51// STORAGE_BUF(BASIS_CACHE_SLOT, read, float, basis_cache_buf[])
52// STORAGE_BUF(CONTROL_WEIGHTS_SLOT, read, float, control_weights_buf[])
53// STORAGE_BUF(BASIS_CACHE_OFFSET_SLOT, read, int, basis_cache_offset_buf[])
54PUSH_CONSTANT(int, curves_start)
55PUSH_CONSTANT(int, curves_count)
56PUSH_CONSTANT(bool, use_point_weight)
57PUSH_CONSTANT(bool, use_cyclic)
62SPECIALIZATION_CONSTANT(int, evaluated_type, 3) /* CURVE_TYPE_NURBS */
63TYPEDEF_SOURCE("draw_attribute_shader_shared.hh")
64COMPUTE_SOURCE("draw_curves_interpolation_comp.glsl")
66
67GPU_SHADER_CREATE_INFO(draw_curves_interpolate_position)
68ADDITIONAL_INFO(draw_curves_data)
69/* Attributes. */
70STORAGE_BUF(POINT_POSITIONS_SLOT, read, float, positions_buf[])
71STORAGE_BUF(POINT_RADII_SLOT, read, float, radii_buf[])
72/* Outputs. */
73STORAGE_BUF(EVALUATED_POS_RAD_SLOT, read_write, float4, evaluated_positions_radii_buf[])
75COMPUTE_FUNCTION("evaluate_position_radius")
78
79GPU_SHADER_CREATE_INFO(draw_curves_interpolate_float4_attribute)
80ADDITIONAL_INFO(draw_curves_data)
81STORAGE_BUF(POINT_ATTR_SLOT, read, StoredFloat4, attribute_float4_buf[])
82STORAGE_BUF(EVALUATED_ATTR_SLOT, read_write, StoredFloat4, evaluated_float4_buf[])
83COMPUTE_FUNCTION("evaluate_attribute_float4")
86
87GPU_SHADER_CREATE_INFO(draw_curves_interpolate_float3_attribute)
88ADDITIONAL_INFO(draw_curves_data)
89STORAGE_BUF(POINT_ATTR_SLOT, read, StoredFloat3, attribute_float3_buf[])
90STORAGE_BUF(EVALUATED_ATTR_SLOT, read_write, StoredFloat3, evaluated_float3_buf[])
91COMPUTE_FUNCTION("evaluate_attribute_float3")
94
95GPU_SHADER_CREATE_INFO(draw_curves_interpolate_float2_attribute)
96ADDITIONAL_INFO(draw_curves_data)
97STORAGE_BUF(POINT_ATTR_SLOT, read, StoredFloat2, attribute_float2_buf[])
98STORAGE_BUF(EVALUATED_ATTR_SLOT, read_write, StoredFloat2, evaluated_float2_buf[])
99COMPUTE_FUNCTION("evaluate_attribute_float2")
102
103GPU_SHADER_CREATE_INFO(draw_curves_interpolate_float_attribute)
104ADDITIONAL_INFO(draw_curves_data)
105STORAGE_BUF(POINT_ATTR_SLOT, read, StoredFloat, attribute_float_buf[])
106STORAGE_BUF(EVALUATED_ATTR_SLOT, read_write, StoredFloat, evaluated_float_buf[])
107COMPUTE_FUNCTION("evaluate_attribute_float")
110
111GPU_SHADER_CREATE_INFO(draw_curves_evaluate_length_intercept)
113STORAGE_BUF(EVALUATED_POINT_SLOT, read, int, evaluated_points_by_curve_buf[])
114STORAGE_BUF(EVALUATED_POS_RAD_SLOT, read, float4, evaluated_positions_radii_buf[])
115STORAGE_BUF(EVALUATED_TIME_SLOT, read_write, float, evaluated_time_buf[])
116STORAGE_BUF(CURVES_LENGTH_SLOT, write, float, curves_length_buf[])
117PUSH_CONSTANT(int, curves_start)
118PUSH_CONSTANT(int, curves_count)
119PUSH_CONSTANT(bool, use_cyclic)
120COMPUTE_FUNCTION("evaluate_length_intercept")
121COMPUTE_SOURCE("draw_curves_length_intercept_comp.glsl")
124
125GPU_SHADER_CREATE_INFO(draw_curves_test)
126STORAGE_BUF(0, write, float, result_pos_buf[])
127STORAGE_BUF(1, write, int4, result_indices_buf[])
128VERTEX_SOURCE("draw_curves_test.glsl")
129FRAGMENT_SOURCE("draw_curves_test.glsl")
130ADDITIONAL_INFO(draw_curves_infos)
131ADDITIONAL_INFO(draw_curves)
unsigned int uint
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
#define HANDLES_POS_LEFT_SLOT
#define CURVES_PER_THREADGROUP
#define POINT_ATTR_SLOT
#define EVALUATED_ATTR_SLOT
#define CURVE_TYPE_SLOT
#define POINT_RADII_SLOT
#define POINTS_BY_CURVES_SLOT
#define EVALUATED_POS_RAD_SLOT
#define EVALUATED_TIME_SLOT
#define EVALUATED_POINT_SLOT
#define CURVES_LENGTH_SLOT
#define HANDLES_POS_RIGHT_SLOT
#define CURVE_CYCLIC_SLOT
#define BEZIER_OFFSETS_SLOT
#define POINT_POSITIONS_SLOT
#define CURVE_RESOLUTION_SLOT
#define GPU_SHADER_CREATE_INFO(_info)
#define GPU_SHADER_CREATE_END()
#define TYPEDEF_SOURCE(filename)
#define FRAGMENT_SOURCE(filename)
#define SPECIALIZATION_CONSTANT(type, name, default_value)
#define ADDITIONAL_INFO(info_name)
#define PUSH_CONSTANT(type, name)
#define STORAGE_BUF(slot, qualifiers, type_name, name)
#define COMPUTE_FUNCTION(function)
#define VERTEX_SOURCE(filename)
#define LOCAL_GROUP_SIZE(...)
#define COMPUTE_SOURCE(filename)
#define DO_STATIC_COMPILATION()
MatBase< 4, 4 > float4x4