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