42 return &
imm->vertex_format;
50 imm->builtin_shader_bound = std::nullopt;
52 if (!
imm->vertex_format.packed) {
54 imm->enabled_attr_bits = 0xFFFFu & ~(0xFFFFu <<
imm->vertex_format.attr_len);
65 imm->builtin_shader_bound = shader_id;
73 imm->shader =
nullptr;
78 return imm->shader !=
nullptr;
90 if (vertex_len == 0) {
98 return vertex_len % 2 == 0;
101 return vertex_len >= 2;
103 return vertex_len >= 4;
105 return vertex_len % 3 == 0;
108 return vertex_len >= 3;
134 if (!
imm->builtin_shader_bound) {
139 switch (*
imm->builtin_shader_bound) {
157 imm->prev_builtin_shader =
imm->builtin_shader_bound;
176 if (
ELEM(polyline_sh,
186 if (
imm->prev_builtin_shader) {
194 imm->prev_builtin_shader = std::nullopt;
207 imm->prim_type = prim_type;
208 imm->vertex_len = vertex_len;
210 imm->unassigned_attr_bits =
imm->enabled_attr_bits;
212 imm->vertex_data =
imm->begin();
218 imm->strict_vertex_len =
false;
227 imm->prim_type = prim_type;
228 imm->vertex_len = vertex_len;
230 imm->unassigned_attr_bits =
imm->enabled_attr_bits;
246 imm->strict_vertex_len =
false;
255 if (
imm->strict_vertex_len) {
265 if (
imm->vertex_idx <
imm->vertex_len) {
271 imm->batch =
nullptr;
280 imm->strict_vertex_len =
true;
281 imm->vertex_data =
nullptr;
298 int data[3] = {stride, int(
imm->vertex_idx), int(offset / 4)};
309 int pos_attr_id = -1;
310 int col_attr_id = -1;
312 for (
uint a_idx = 0; a_idx <
format.attr_len; a_idx++) {
317 const bool fetch_int =
false;
329 VertAttrType::SFLOAT_32,
330 VertAttrType::SFLOAT_32_32,
331 VertAttrType::SFLOAT_32_32_32,
332 VertAttrType::SFLOAT_32_32_32_32,
333 VertAttrType::UNORM_8_8_8_8),
334 "Only support float attributes or uchar4");
335 const bool fetch_unorm8 = a->
type.
format == VertAttrType::UNORM_8_8_8_8;
342 if (pos_attr_id != -1 && col_attr_id != -1) {
515 if (
imm->unassigned_attr_bits) {
517 for (
uint a_idx = 0; a_idx <
imm->vertex_format.attr_len; a_idx++) {
518 if ((
imm->unassigned_attr_bits >> a_idx) & 1) {
522 printf(
"copying %s from vertex %u to %u\n", a->name,
imm->vertex_idx - 1,
imm->vertex_idx);
533 imm->vertex_data +=
imm->vertex_format.stride;
534 imm->unassigned_attr_bits =
imm->enabled_attr_bits;
655 float data[4] = {r, g,
b, a};
683 const float scale = 1.0f / 255.0f;
689 const float scale = 1.0f / 255.0f;
708#ifndef GPU_STANDALONE
#define BLI_assert_msg(a, msg)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void GPU_batch_draw_advanced(blender::gpu::Batch *batch, int vertex_first, int vertex_count, int instance_first, int instance_count)
blender::IndexRange GPU_batch_draw_expanded_parameter_get(GPUPrimType input_prim_type, GPUPrimType output_prim_type, int vertex_count, int vertex_first, int output_primitive_cout)
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
void GPU_batch_set_shader(blender::gpu::Batch *batch, blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_matrix_bind(blender::gpu::Shader *shader)
@ GPU_PRIM_LINE_STRIP_ADJ
int GPU_shader_get_ubo_binding(blender::gpu::Shader *shader, const char *name)
void GPU_shader_uniform_1b(blender::gpu::Shader *sh, const char *name, bool value)
void GPU_shader_uniform_4fv_array(blender::gpu::Shader *sh, const char *name, int len, const float(*val)[4])
void GPU_shader_uniform_1f(blender::gpu::Shader *sh, const char *name, float value)
void GPU_shader_uniform_4fv(blender::gpu::Shader *sh, const char *name, const float data[4])
int GPU_shader_get_sampler_binding(blender::gpu::Shader *shader, const char *name)
void GPU_shader_uniform_3fv(blender::gpu::Shader *sh, const char *name, const float data[3])
void GPU_shader_bind(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_1i(blender::gpu::Shader *sh, const char *name, int value)
void GPU_shader_uniform_mat4(blender::gpu::Shader *sh, const char *name, const float data[4][4])
void GPU_shader_uniform_4f(blender::gpu::Shader *sh, const char *name, float x, float y, float z, float w)
void GPU_shader_uniform_2f(blender::gpu::Shader *sh, const char *name, float x, float y)
void GPU_shader_uniform_2fv(blender::gpu::Shader *sh, const char *name, const float data[2])
void GPU_shader_uniform_3f(blender::gpu::Shader *sh, const char *name, float x, float y, float z)
int GPU_shader_get_builtin_uniform(blender::gpu::Shader *shader, int builtin)
void GPU_shader_uniform_float_ex(blender::gpu::Shader *shader, int location, int length, int array_size, const float *value)
void GPU_shader_uniform_2iv(blender::gpu::Shader *sh, const char *name, const int data[2])
void GPU_shader_uniform_3iv(blender::gpu::Shader *sh, const char *name, const int data[3])
blender::gpu::Shader * GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_FLAT_COLOR
@ GPU_SHADER_3D_POLYLINE_FLAT_COLOR
@ GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR
bool GPU_line_smooth_get()
float GPU_line_width_get()
void GPU_viewport_size_get_f(float coords[4])
void GPU_texture_bind_ex(blender::gpu::Texture *texture, GPUSamplerState state, int unit)
void GPU_texture_bind(blender::gpu::Texture *texture, int unit)
void GPU_vertbuf_data_resize(blender::gpu::VertBuf &verts, uint v_len)
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4])
void UI_GetThemeColor3fv(int colorid, float col[3])
void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3])
void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4])
void UI_GetThemeColor4fv(int colorid, float col[4])
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
BMesh const char void * data
unsigned long long int uint64_t
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
constexpr int64_t size() const
constexpr int64_t start() const
Batch * procedural_triangles_batch_get()
void assert_framebuffer_shader_compatibility(Shader *sh)
struct @021025263243242147216143265077100330027142264337::@240232116316110053135047106323056371161236243121 attr_id
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
bool is_fetch_float(VertAttrType attr_type)
blender::gpu::VertAttrType format
struct GPUVertAttr::Type type