27using namespace blender::gpu;
92 if (vertex_len == 0) {
100 return vertex_len % 2 == 0;
103 return vertex_len >= 2;
105 return vertex_len >= 4;
107 return vertex_len % 3 == 0;
110 return vertex_len >= 3;
178 if (
ELEM(polyline_sh,
311 int pos_attr_id = -1;
312 int col_attr_id = -1;
314 for (
uint a_idx = 0; a_idx < format.attr_len; a_idx++) {
319 const bool fetch_int =
false;
327 else if (col_attr_id == -1 &&
StringRefNull(name) ==
"color") {
331 VertAttrType::SFLOAT_32,
332 VertAttrType::SFLOAT_32_32,
333 VertAttrType::SFLOAT_32_32_32,
334 VertAttrType::SFLOAT_32_32_32_32,
335 VertAttrType::UNORM_8_8_8_8),
336 "Only support float attributes or uchar4");
337 const bool fetch_unorm8 = a->
type.
format == VertAttrType::UNORM_8_8_8_8;
344 if (pos_attr_id != -1 && col_attr_id != -1) {
372 BLI_assert(attr_id < imm->vertex_format.attr_len);
387 BLI_assert(attr_id < imm->vertex_format.attr_len);
403 BLI_assert(attr_id < imm->vertex_format.attr_len);
420 BLI_assert(attr_id < imm->vertex_format.attr_len);
438 BLI_assert(attr_id < imm->vertex_format.attr_len);
452 BLI_assert(attr_id < imm->vertex_format.attr_len);
482 BLI_assert(attr_id < imm->vertex_format.attr_len);
504 BLI_assert(attr_id < imm->vertex_format.attr_len);
621 imm->
shader, name, count,
reinterpret_cast<const float (*)[4]
>(
data));
658 float data[4] = {r, g,
b, a};
686 const float scale = 1.0f / 255.0f;
692 const float scale = 1.0f / 255.0f;
711#ifndef GPU_STANDALONE
#define BLI_assert_msg(a, msg)
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
constexpr StringRefNull()
Batch * procedural_triangles_batch_get()
void assert_framebuffer_shader_compatibility(Shader *sh)
float3x3 scale(float3x3 mat, float2 scale)
bool is_fetch_float(VertAttrType attr_type)
void get_color_3fv(int colorid, float col[3])
void get_color_4fv(int colorid, float col[4])
void get_color_shade_4fv(int colorid, int offset, float col[4])
void get_color_blend_shade_4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
void get_color_shade_alpha_4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4])
void get_color_blend_3ubv(int colorid1, int colorid2, float fac, unsigned char col[3])
void get_color_shade_alpha_4fv(int colorid, int coloffset, int alphaoffset, float col[4])
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void GPU_shader_uniform_2iv(gpu::Shader *sh, const char *name, const int data[2])
int GPU_shader_get_sampler_binding(gpu::Shader *shader, const char *name)
void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset)
unsigned __int64 uint64_t
void immUniformThemeColorBlend(int color_id1, int color_id2, float fac)
void immAttr4f(uint attr_id, float x, float y, float z, float w)
gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, gpu::VertBuf *vertex_buf, gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
static void immEndVertex()
void immAttr3f(uint attr_id, float x, float y, float z)
void GPU_shader_uniform_2f(gpu::Shader *sh, const char *name, float x, float y)
void immUniformColor3f(float r, float g, float b)
void immAttr4ubv(uint attr_id, const unsigned char data[4])
void GPU_shader_uniform_mat4(gpu::Shader *sh, const char *name, const float data[4][4])
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
void immVertex2iv(uint attr_id, const int data[2])
void immUniform2f(const char *name, float x, float y)
void immBeginAtMost(GPUPrimType, uint max_vertex_len)
void immAttrSkip(uint attr_id)
GPUVertFormat * immVertexFormat()
static bool vertex_count_makes_sense_for_primitive(uint vertex_len, GPUPrimType prim_type)
void GPU_shader_uniform_3f(gpu::Shader *sh, const char *name, float x, float y, float z)
void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
void immBegin(GPUPrimType, uint vertex_len)
BLI_INLINE const char * GPU_vertformat_attr_name_get(const GPUVertFormat *format, const GPUVertAttr *attr, uint n_idx)
@ GPU_PRIM_LINE_STRIP_ADJ
void GPU_shader_uniform_4fv(gpu::Shader *sh, const char *name, const float data[4])
void GPU_shader_uniform_3iv(gpu::Shader *sh, const char *name, const int data[3])
void GPU_batch_set_shader(gpu::Batch *batch, gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)
void immUniformColor4fv(const float rgba[4])
gpu::Batch * immBeginBatchAtMost(GPUPrimType, uint vertex_len)
void immUniformThemeColorAlpha(int color_id, float a)
void immAttr2f(uint attr_id, float x, float y)
void GPU_shader_uniform_1b(gpu::Shader *sh, const char *name, bool value)
void immUniformColor3ubv(const unsigned char rgb[3])
float GPU_line_width_get()
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)
void immAttr3fv(uint attr_id, const float data[3])
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void GPU_shader_uniform_4fv_array(gpu::Shader *sh, const char *name, int len, const float(*val)[4])
void GPU_matrix_bind(gpu::Shader *shader)
void immUniformThemeColor(int color_id)
void immAttr2fv(uint attr_id, const float data[2])
void immUniform1f(const char *name, float x)
void immVertex2f(uint attr_id, float x, float y)
void immVertex2i(uint attr_id, int x, int y)
void GPU_viewport_size_get_f(float coords[4])
void immAttr4fv(uint attr_id, const float data[4])
BMesh const char void * data
static void wide_line_workaround_end()
void GPU_shader_uniform_3fv(gpu::Shader *sh, const char *name, const float data[3])
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_POLYLINE_FLAT_COLOR
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR
@ GPU_SHADER_3D_FLAT_COLOR
@ GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR
void immUniform4fv(const char *name, const float data[4])
void GPU_shader_uniform_float_ex(gpu::Shader *shader, int location, int length, int array_size, const float *value)
void immUniformThemeColor3(int color_id)
void immUniformThemeColorShade(int color_id, int offset)
void immUniformArray4fv(const char *bare_name, const float *data, int count)
void immUniformMatrix4fv(const char *name, const float data[4][4])
void immUniformColor4f(float r, float g, float b, float a)
void VertexFormat_pack(GPUVertFormat *format)
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
gpu::Batch * immBeginBatch(GPUPrimType, uint vertex_len)
void immBindTexture(const char *name, gpu::Texture *tex)
void GPU_shader_bind(gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_1i(gpu::Shader *sh, const char *name, int value)
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
void GPU_uniformbuf_bind(gpu::UniformBuf *ubo, int slot)
void GPU_texture_bind_ex(gpu::Texture *texture, GPUSamplerState state, int unit)
static void wide_line_workaround_start(GPUPrimType prim_type)
void GPU_shader_uniform_2fv(gpu::Shader *sh, const char *name, const float data[2])
void immAttr4ub(uint attr_id, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
void immBindTextureSampler(const char *name, gpu::Texture *tex, GPUSamplerState state)
void immVertex4f(uint attr_id, float x, float y, float z, float w)
gpu::Shader * GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
void immAttr1f(uint attr_id, float x)
void immVertex3fv(uint attr_id, const float data[3])
void GPU_shader_uniform_1f(gpu::Shader *sh, const char *name, float value)
void immUniform3fv(const char *name, const float data[3])
void immUniform4f(const char *name, float x, float y, float z, float w)
bool GPU_line_smooth_get()
gpu::Shader * immGetShader()
void GPU_texture_bind(gpu::Texture *texture, int unit)
static void setAttrValueBit(uint attr_id)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_data_resize(gpu::VertBuf &verts, uint v_len)
void immBindShader(gpu::Shader *shader)
int GPU_shader_get_ubo_binding(gpu::Shader *shader, const char *name)
void immAttr2i(uint attr_id, int x, int y)
void GPU_batch_draw_advanced(gpu::Batch *batch, int vertex_first, int vertex_count, int instance_first, int instance_count)
void GPU_vertformat_clear(GPUVertFormat *)
void immUniform2fv(const char *name, const float data[2])
MINLINE void copy_v4_v4(float r[4], const float a[4])
void immAttr1u(uint attr_id, uint x)
void immUniformColor3fv(const float rgb[3])
void immVertex3f(uint attr_id, float x, float y, float z)
void immUniform3f(const char *name, float x, float y, float z)
void immUniform1i(const char *name, int x)
void immUniformColor4ubv(const unsigned char rgba[4])
int GPU_shader_get_builtin_uniform(gpu::Shader *shader, int builtin)
void immVertex2fv(uint attr_id, const float data[2])
void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a)
void immUniformColor3fvAlpha(const float rgb[3], float a)
void GPU_shader_uniform_4f(gpu::Shader *sh, const char *name, float x, float y, float z, float w)
void immBindUniformBuf(const char *name, gpu::UniformBuf *ubo)
struct blender::GPUVertAttr::Type type