Blender V5.3
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 {
21
22namespace gpu {
23class UniformBuf;
24} // namespace gpu
25
28
32void immUnbindProgram();
42bool immIsShaderBound();
43
45void immBegin(GPUPrimType, uint vertex_len);
47void immBeginAtMost(GPUPrimType, uint max_vertex_len);
48void immEnd(); /* finishes and draws. */
49
50/* - #immBegin a batch, then use standard `imm*` functions as usual.
51 * - #immEnd will finalize the batch instead of drawing.
52 *
53 * Then you can draw it as many times as you like!
54 * Partially replaces the need for display lists. */
55
56gpu::Batch *immBeginBatch(GPUPrimType, uint vertex_len);
57gpu::Batch *immBeginBatchAtMost(GPUPrimType, uint vertex_len);
58
59/* Provide attribute values that can change per vertex. */
60/* First vertex after immBegin must have all its attributes specified. */
61/* Skipped attributes will continue using the previous value for that attr_id. */
62void immAttr1f(uint attr_id, float x);
63void immAttr2f(uint attr_id, float x, float y);
64void immAttr3f(uint attr_id, float x, float y, float z);
65void immAttr4f(uint attr_id, float x, float y, float z, float w);
66
67void immAttr2i(uint attr_id, int x, int y);
68
69void immAttr1u(uint attr_id, uint x);
70
71void immAttr2fv(uint attr_id, const float data[2]);
72void immAttr3fv(uint attr_id, const float data[3]);
73void immAttr4fv(uint attr_id, const float data[4]);
74
75void immAttr4ub(uint attr_id, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
76
77void immAttr4ubv(uint attr_id, const unsigned char data[4]);
78
79/* Explicitly skip an attribute.
80 * This advanced option kills automatic value copying for this attr_id. */
81
82void immAttrSkip(uint attr_id);
83
84/* Provide one last attribute value & end the current vertex.
85 * This is most often used for 2D or 3D position (similar to #glVertex). */
86
87void immVertex2f(uint attr_id, float x, float y);
88void immVertex3f(uint attr_id, float x, float y, float z);
89void immVertex4f(uint attr_id, float x, float y, float z, float w);
90
91void immVertex2i(uint attr_id, int x, int y);
92
93void immVertex2fv(uint attr_id, const float data[2]);
94void immVertex3fv(uint attr_id, const float data[3]);
95
96void immVertex2iv(uint attr_id, const int data[2]);
97
98/* Provide uniform values that don't change for the entire draw call. */
99
100void immUniform1i(const char *name, int x);
101void immUniform1f(const char *name, float x);
102void immUniform2f(const char *name, float x, float y);
103void immUniform2fv(const char *name, const float data[2]);
104void immUniform3f(const char *name, float x, float y, float z);
105void immUniform3fv(const char *name, const float data[3]);
106void immUniform4f(const char *name, float x, float y, float z, float w);
107void immUniform4fv(const char *name, const float data[4]);
111void immUniformArray4fv(const char *bare_name, const float *data, int count);
112void immUniformMatrix4fv(const char *name, const float data[4][4]);
113
114void immBindTexture(const char *name, gpu::Texture *tex);
115void immBindTextureSampler(const char *name, gpu::Texture *tex, GPUSamplerState state);
116void immBindUniformBuf(const char *name, gpu::UniformBuf *ubo);
117
118/* Convenience functions for setting "uniform vec4 color". */
119/* The RGB functions have implicit alpha = 1.0. */
120
121void immUniformColor4f(float r, float g, float b, float a);
122void immUniformColor4fv(const float rgba[4]);
123void immUniformColor3f(float r, float g, float b);
124void immUniformColor3fv(const float rgb[3]);
125void immUniformColor3fvAlpha(const float rgb[3], float a);
126
127void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b);
128void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
129void immUniformColor3ubv(const unsigned char rgb[3]);
130void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a);
131void immUniformColor4ubv(const unsigned char rgba[4]);
132
138
140void immUniformThemeColor(int color_id);
141void immUniformThemeColorAlpha(int color_id, float a);
142void immUniformThemeColor3(int color_id);
143void immUniformThemeColorShade(int color_id, int offset);
144void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset);
145void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset);
146void immUniformThemeColorBlend(int color_id1, int color_id2, float fac);
147void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
148
149} // namespace blender
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
const int state
BMesh Iterators.
void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset)
void immUniformThemeColorBlend(int color_id1, int color_id2, float fac)
void immAttr4f(uint attr_id, float x, float y, float z, float w)
void immAttr3f(uint attr_id, float x, float y, float z)
void immEnd()
void immUniformColor3f(float r, float g, float b)
unsigned int uint
Definition BKE_text.h:55
void immAttr4ubv(uint attr_id, const unsigned char data[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()
void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
void immBegin(GPUPrimType, uint vertex_len)
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 immUnbindProgram()
void immUniformColor3ubv(const unsigned char rgb[3])
bool immIsShaderBound()
void immAttr3fv(uint attr_id, const float data[3])
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
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 immAttr4fv(uint attr_id, const float data[4])
BMesh const char void * data
void immUniform4fv(const char *name, const float data[4])
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 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 immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
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)
void immAttr1f(uint attr_id, float x)
void immVertex3fv(uint attr_id, const float data[3])
void immUniform3fv(const char *name, const float data[3])
void immUniform4f(const char *name, float x, float y, float z, float w)
void immBindShader(gpu::Shader *shader)
void immAttr2i(uint attr_id, int x, int y)
void immUniform2fv(const char *name, const float data[2])
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])
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 immBindUniformBuf(const char *name, gpu::UniformBuf *ubo)