Blender V5.0
GPU_immediate.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#pragma once
12
13#include "GPU_batch.hh"
14#include "GPU_immediate_util.hh" /* IWYU pragma: export */
15#include "GPU_primitive.hh"
16#include "GPU_shader.hh"
17#include "GPU_texture.hh"
18#include "GPU_vertex_format.hh"
19
20namespace blender::gpu {
21class UniformBuf;
22} // namespace blender::gpu
23
26
30void immUnbindProgram();
40bool immIsShaderBound();
41
43void immBegin(GPUPrimType, uint vertex_len);
45void immBeginAtMost(GPUPrimType, uint max_vertex_len);
46void immEnd(); /* finishes and draws. */
47
48/* - #immBegin a batch, then use standard `imm*` functions as usual.
49 * - #immEnd will finalize the batch instead of drawing.
50 *
51 * Then you can draw it as many times as you like!
52 * Partially replaces the need for display lists. */
53
54blender::gpu::Batch *immBeginBatch(GPUPrimType, uint vertex_len);
55blender::gpu::Batch *immBeginBatchAtMost(GPUPrimType, uint vertex_len);
56
57/* Provide attribute values that can change per vertex. */
58/* First vertex after immBegin must have all its attributes specified. */
59/* Skipped attributes will continue using the previous value for that attr_id. */
60void immAttr1f(uint attr_id, float x);
61void immAttr2f(uint attr_id, float x, float y);
62void immAttr3f(uint attr_id, float x, float y, float z);
63void immAttr4f(uint attr_id, float x, float y, float z, float w);
64
65void immAttr2i(uint attr_id, int x, int y);
66
68
69void immAttr2fv(uint attr_id, const float data[2]);
70void immAttr3fv(uint attr_id, const float data[3]);
71void immAttr4fv(uint attr_id, const float data[4]);
72
73void immAttr4ub(uint attr_id, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
74
75void immAttr4ubv(uint attr_id, const unsigned char data[4]);
76
77/* Explicitly skip an attribute.
78 * This advanced option kills automatic value copying for this attr_id. */
79
81
82/* Provide one last attribute value & end the current vertex.
83 * This is most often used for 2D or 3D position (similar to #glVertex). */
84
85void immVertex2f(uint attr_id, float x, float y);
86void immVertex3f(uint attr_id, float x, float y, float z);
87void immVertex4f(uint attr_id, float x, float y, float z, float w);
88
89void immVertex2i(uint attr_id, int x, int y);
90
91void immVertex2fv(uint attr_id, const float data[2]);
92void immVertex3fv(uint attr_id, const float data[3]);
93
94void immVertex2iv(uint attr_id, const int data[2]);
95
96/* Provide uniform values that don't change for the entire draw call. */
97
98void immUniform1i(const char *name, int x);
99void immUniform1f(const char *name, float x);
100void immUniform2f(const char *name, float x, float y);
101void immUniform2fv(const char *name, const float data[2]);
102void immUniform3f(const char *name, float x, float y, float z);
103void immUniform3fv(const char *name, const float data[3]);
104void immUniform4f(const char *name, float x, float y, float z, float w);
105void immUniform4fv(const char *name, const float data[4]);
109void immUniformArray4fv(const char *bare_name, const float *data, int count);
110void immUniformMatrix4fv(const char *name, const float data[4][4]);
111
112void immBindTexture(const char *name, blender::gpu::Texture *tex);
114void immBindUniformBuf(const char *name, blender::gpu::UniformBuf *ubo);
115
116/* Convenience functions for setting "uniform vec4 color". */
117/* The RGB functions have implicit alpha = 1.0. */
118
119void immUniformColor4f(float r, float g, float b, float a);
120void immUniformColor4fv(const float rgba[4]);
121void immUniformColor3f(float r, float g, float b);
122void immUniformColor3fv(const float rgb[3]);
123void immUniformColor3fvAlpha(const float rgb[3], float a);
124
125void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b);
126void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
127void immUniformColor3ubv(const unsigned char rgb[3]);
128void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a);
129void immUniformColor4ubv(const unsigned char rgba[4]);
130
136
138void immUniformThemeColor(int color_id);
139void immUniformThemeColorAlpha(int color_id, float a);
140void immUniformThemeColor3(int color_id);
141void immUniformThemeColorShade(int color_id, int offset);
142void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset);
143void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset);
144void immUniformThemeColorBlend(int color_id1, int color_id2, float fac);
145void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
unsigned int uint
void immUniformColor4ubv(const unsigned char rgba[4])
void immVertex2iv(uint attr_id, const int data[2])
void immVertex4f(uint attr_id, float x, float y, float z, float w)
void immUniform4f(const char *name, float x, float y, float z, float w)
void immUniformThemeColorAlpha(int color_id, float a)
void immEnd()
void immUniform2fv(const char *name, const float data[2])
void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
void immUnbindProgram()
void immBindTexture(const char *name, blender::gpu::Texture *tex)
void immAttr4fv(uint attr_id, const float data[4])
void immUniform3fv(const char *name, const float data[3])
void immBindShader(blender::gpu::Shader *shader)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void immBindTextureSampler(const char *name, blender::gpu::Texture *tex, GPUSamplerState state)
void immAttr2fv(uint attr_id, const float data[2])
void immAttr4ub(uint attr_id, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
void immAttrSkip(uint attr_id)
void immUniform2f(const char *name, float x, float y)
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
void immAttr4ubv(uint attr_id, const unsigned char data[4])
void immUniformMatrix4fv(const char *name, const float data[4][4])
void immUniform3f(const char *name, float x, float y, float z)
void immUniformColor4f(float r, float g, float b, float a)
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
void immVertex2f(uint attr_id, float x, float y)
void immAttr1f(uint attr_id, float x)
void immUniformThemeColor(int color_id)
void immUniformThemeColorShade(int color_id, int offset)
blender::gpu::Batch * immBeginBatch(GPUPrimType, uint vertex_len)
blender::gpu::Batch * immBeginBatchAtMost(GPUPrimType, uint vertex_len)
void immVertex3f(uint attr_id, float x, float y, float z)
void immVertex2fv(uint attr_id, const float data[2])
void immUniformColor3ubv(const unsigned char rgb[3])
void immUniform1i(const char *name, int x)
void immBindUniformBuf(const char *name, blender::gpu::UniformBuf *ubo)
void immUniformThemeColor3(int color_id)
void immBeginAtMost(GPUPrimType, uint max_vertex_len)
void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a)
void immAttr1u(uint attr_id, uint x)
void immVertex2i(uint attr_id, int x, int y)
void immUniform1f(const char *name, float x)
void immUniformArray4fv(const char *bare_name, const float *data, int count)
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
GPUVertFormat * immVertexFormat()
void immAttr4f(uint attr_id, float x, float y, float z, float w)
void immUniformColor4fv(const float rgba[4])
void immUniformThemeColorBlend(int color_id1, int color_id2, float fac)
void immUniformColor3f(float r, float g, float b)
void immAttr2i(uint attr_id, int x, int y)
void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset)
void immUniform4fv(const char *name, const float data[4])
void immAttr3fv(uint attr_id, const float data[3])
void immAttr2f(uint attr_id, float x, float y)
void immVertex3fv(uint attr_id, const float data[3])
void immBegin(GPUPrimType, uint vertex_len)
void immUniformColor3fvAlpha(const float rgb[3], float a)
void immAttr3f(uint attr_id, float x, float y, float z)
void immUniformColor3fv(const float rgb[3])
bool immIsShaderBound()
GPUPrimType
GPUBuiltinShader
BMesh const char void * data
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
struct @021025263243242147216143265077100330027142264337::@240232116316110053135047106323056371161236243121 attr_id
int count
static ulong state[N]
const char * name