Blender V4.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
11#pragma once
12
13#include "GPU_batch.hh"
14#include "GPU_immediate_util.hh"
15#include "GPU_primitive.hh"
16#include "GPU_shader.hh"
17#include "GPU_texture.hh"
18#include "GPU_vertex_format.hh"
19
22
24void immBindShader(GPUShader *shader);
26void immUnbindProgram();
27
29void immBegin(GPUPrimType, uint vertex_len);
31void immBeginAtMost(GPUPrimType, uint max_vertex_len);
32void immEnd(); /* finishes and draws. */
33
34/* - #immBegin a batch, then use standard `imm*` functions as usual.
35 * - #immEnd will finalize the batch instead of drawing.
36 *
37 * Then you can draw it as many times as you like!
38 * Partially replaces the need for display lists. */
39
40blender::gpu::Batch *immBeginBatch(GPUPrimType, uint vertex_len);
41blender::gpu::Batch *immBeginBatchAtMost(GPUPrimType, uint vertex_len);
42
43/* Provide attribute values that can change per vertex. */
44/* First vertex after immBegin must have all its attributes specified. */
45/* Skipped attributes will continue using the previous value for that attr_id. */
46void immAttr1f(uint attr_id, float x);
47void immAttr2f(uint attr_id, float x, float y);
48void immAttr3f(uint attr_id, float x, float y, float z);
49void immAttr4f(uint attr_id, float x, float y, float z, float w);
50
51void immAttr2i(uint attr_id, int x, int y);
52
53void immAttr1u(uint attr_id, uint x);
54
55void immAttr2s(uint attr_id, short x, short y);
56
57void immAttr2fv(uint attr_id, const float data[2]);
58void immAttr3fv(uint attr_id, const float data[3]);
59void immAttr4fv(uint attr_id, const float data[4]);
60
61void immAttr3ub(uint attr_id, unsigned char r, unsigned char g, unsigned char b);
62void immAttr4ub(uint attr_id, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
63
64void immAttr3ubv(uint attr_id, const unsigned char data[3]);
65void immAttr4ubv(uint attr_id, const unsigned char data[4]);
66
67/* Explicitly skip an attribute.
68 * This advanced option kills automatic value copying for this attr_id. */
69
71
72/* Provide one last attribute value & end the current vertex.
73 * This is most often used for 2D or 3D position (similar to #glVertex). */
74
75void immVertex2f(uint attr_id, float x, float y);
76void immVertex3f(uint attr_id, float x, float y, float z);
77void immVertex4f(uint attr_id, float x, float y, float z, float w);
78
79void immVertex2i(uint attr_id, int x, int y);
80
81void immVertex2s(uint attr_id, short x, short y);
82
83void immVertex2fv(uint attr_id, const float data[2]);
84void immVertex3fv(uint attr_id, const float data[3]);
85
86void immVertex2iv(uint attr_id, const int data[2]);
87
88/* Provide uniform values that don't change for the entire draw call. */
89
90void immUniform1i(const char *name, int x);
91void immUniform1f(const char *name, float x);
92void immUniform2f(const char *name, float x, float y);
93void immUniform2fv(const char *name, const float data[2]);
94void immUniform3f(const char *name, float x, float y, float z);
95void immUniform3fv(const char *name, const float data[3]);
96void immUniform4f(const char *name, float x, float y, float z, float w);
97void immUniform4fv(const char *name, const float data[4]);
101void immUniformArray4fv(const char *bare_name, const float *data, int count);
102void immUniformMatrix4fv(const char *name, const float data[4][4]);
103
104void immBindTexture(const char *name, GPUTexture *tex);
105void immBindTextureSampler(const char *name, GPUTexture *tex, GPUSamplerState state);
106void immBindUniformBuf(const char *name, GPUUniformBuf *ubo);
107
108/* Convenience functions for setting "uniform vec4 color". */
109/* The RGB functions have implicit alpha = 1.0. */
110
111void immUniformColor4f(float r, float g, float b, float a);
112void immUniformColor4fv(const float rgba[4]);
113void immUniformColor3f(float r, float g, float b);
114void immUniformColor3fv(const float rgb[3]);
115void immUniformColor3fvAlpha(const float rgb[3], float a);
116
117void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b);
118void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
119void immUniformColor3ubv(const unsigned char rgb[3]);
120void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a);
121void immUniformColor4ubv(const unsigned char rgba[4]);
122
128
130void immUniformThemeColor(int color_id);
131void immUniformThemeColorAlpha(int color_id, float a);
132void immUniformThemeColor3(int color_id);
133void immUniformThemeColorShade(int color_id, int offset);
134void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset);
135void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset);
136void immUniformThemeColorBlend(int color_id1, int color_id2, float fac);
137void 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 immAttr3ubv(uint attr_id, const unsigned char data[3])
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 immAttr2s(uint attr_id, short x, short y)
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 immVertex2s(uint attr_id, short x, short y)
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 immAttr3ub(uint attr_id, unsigned char r, unsigned char g, unsigned char b)
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])
GPUPrimType
eGPUBuiltinShader
struct GPUShader GPUShader
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
local_group_size(16, 16) .push_constant(Type b
struct @620::@623 attr_id
int count
static ulong state[N]