Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-06-19 13:18:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-06-19 13:18:04 +0300
commitb4d053efc75424fca4b413ac1bc7a7e826fac629 (patch)
tree80647d9ca9109e997fce9911f202f98d7f8577d4 /source
parent349946bd010b1112b13c8594aabfb318c330bc0d (diff)
Gawain API naming refactor
Use consistent prefix for gawain API names as well as some abbreviations to avoid over-long names, see: D2678
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf.c8
-rw-r--r--source/blender/blenfont/intern/blf_font.c6
-rw-r--r--source/blender/blenkernel/BKE_animsys.h2
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h4
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c8
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c14
-rw-r--r--source/blender/blenkernel/intern/cloth.c4
-rw-r--r--source/blender/blenkernel/intern/pbvh.c8
-rw-r--r--source/blender/collada/MeshImporter.cpp4
-rw-r--r--source/blender/draw/engines/basic/basic_engine.c2
-rw-r--r--source/blender/draw/engines/clay/clay_engine.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_effects.c4
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c12
-rw-r--r--source/blender/draw/engines/eevee/eevee_lights.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c10
-rw-r--r--source/blender/draw/engines/eevee/eevee_private.h4
-rw-r--r--source/blender/draw/engines/external/external_engine.c2
-rw-r--r--source/blender/draw/intern/DRW_render.h14
-rw-r--r--source/blender/draw/intern/draw_armature.c28
-rw-r--r--source/blender/draw/intern/draw_cache.c1146
-rw-r--r--source/blender/draw/intern/draw_cache.h164
-rw-r--r--source/blender/draw/intern/draw_cache_impl.h70
-rw-r--r--source/blender/draw/intern/draw_cache_impl_curve.c216
-rw-r--r--source/blender/draw/intern/draw_cache_impl_displist.c28
-rw-r--r--source/blender/draw/intern/draw_cache_impl_lattice.c76
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c822
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c100
-rw-r--r--source/blender/draw/intern/draw_common.c24
-rw-r--r--source/blender/draw/intern/draw_common.h28
-rw-r--r--source/blender/draw/intern/draw_manager.c70
-rw-r--r--source/blender/draw/intern/draw_view.c46
-rw-r--r--source/blender/draw/modes/edit_curve_mode.c2
-rw-r--r--source/blender/draw/modes/edit_lattice_mode.c2
-rw-r--r--source/blender/draw/modes/edit_mesh_mode.c8
-rw-r--r--source/blender/draw/modes/edit_metaball_mode.c2
-rw-r--r--source/blender/draw/modes/edit_surface_mode.c2
-rw-r--r--source/blender/draw/modes/edit_text_mode.c2
-rw-r--r--source/blender/draw/modes/object_mode.c26
-rw-r--r--source/blender/draw/modes/paint_texture_mode.c10
-rw-r--r--source/blender/draw/modes/paint_vertex_mode.c2
-rw-r--r--source/blender/draw/modes/paint_weight_mode.c2
-rw-r--r--source/blender/draw/modes/particle_mode.c2
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c12
-rw-r--r--source/blender/editors/animation/anim_draw.c14
-rw-r--r--source/blender/editors/animation/anim_markers.c8
-rw-r--r--source/blender/editors/animation/keyframes_draw.c14
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c14
-rw-r--r--source/blender/editors/curve/editcurve_paint.c14
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c92
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c4
-rw-r--r--source/blender/editors/include/ED_keyframes_draw.h2
-rw-r--r--source/blender/editors/interface/interface_draw.c192
-rw-r--r--source/blender/editors/interface/interface_icons.c26
-rw-r--r--source/blender/editors/interface/interface_panel.c32
-rw-r--r--source/blender/editors/interface/interface_widgets.c74
-rw-r--r--source/blender/editors/interface/view2d.c32
-rw-r--r--source/blender/editors/manipulator_library/arrow2d_manipulator.c6
-rw-r--r--source/blender/editors/manipulator_library/arrow3d_manipulator.c8
-rw-r--r--source/blender/editors/manipulator_library/cage2d_manipulator.c14
-rw-r--r--source/blender/editors/manipulator_library/dial3d_manipulator.c12
-rw-r--r--source/blender/editors/manipulator_library/grab3d_manipulator.c4
-rw-r--r--source/blender/editors/manipulator_library/manipulator_draw_utils.c36
-rw-r--r--source/blender/editors/manipulator_library/primitive3d_manipulator.c6
-rw-r--r--source/blender/editors/mask/mask_draw.c32
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c26
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c6
-rw-r--r--source/blender/editors/physics/particle_edit.c2
-rw-r--r--source/blender/editors/screen/area.c74
-rw-r--r--source/blender/editors/screen/glutil.c16
-rw-r--r--source/blender/editors/screen/screen_draw.c22
-rw-r--r--source/blender/editors/screen/screendump.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c34
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c8
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c2
-rw-r--r--source/blender/editors/space_action/action_draw.c6
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c18
-rw-r--r--source/blender/editors/space_clip/clip_draw.c74
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c12
-rw-r--r--source/blender/editors/space_clip/clip_utils.c8
-rw-r--r--source/blender/editors/space_console/console_draw.c4
-rw-r--r--source/blender/editors/space_file/file_draw.c14
-rw-r--r--source/blender/editors/space_graph/graph_draw.c48
-rw-r--r--source/blender/editors/space_graph/space_graph.c6
-rw-r--r--source/blender/editors/space_image/image_draw.c16
-rw-r--r--source/blender/editors/space_info/textview.c12
-rw-r--r--source/blender/editors/space_nla/nla_draw.c38
-rw-r--r--source/blender/editors/space_node/drawnode.c40
-rw-r--r--source/blender/editors/space_node/node_draw.c22
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c42
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c40
-rw-r--r--source/blender/editors/space_text/text_draw.c22
-rw-r--r--source/blender/editors/space_time/space_time.c16
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c20
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c254
-rw-r--r--source/blender/editors/space_view3d/drawobject.c674
-rw-r--r--source/blender/editors/space_view3d/drawsimdebug.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c80
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c6
-rw-r--r--source/blender/editors/transform/transform.c32
-rw-r--r--source/blender/editors/transform/transform_constraints.c6
-rw-r--r--source/blender/editors/transform/transform_generics.c4
-rw-r--r--source/blender/editors/transform/transform_snap.c6
-rw-r--r--source/blender/editors/util/ed_util.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c70
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c86
-rw-r--r--source/blender/gpu/GPU_batch.h8
-rw-r--r--source/blender/gpu/GPU_buffers.h4
-rw-r--r--source/blender/gpu/GPU_immediate_util.h2
-rw-r--r--source/blender/gpu/GPU_matrix.h2
-rw-r--r--source/blender/gpu/intern/gpu_batch.c60
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c180
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c2
-rw-r--r--source/blender/gpu/intern/gpu_compositing.c84
-rw-r--r--source/blender/gpu/intern/gpu_draw.c100
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c36
-rw-r--r--source/blender/gpu/intern/gpu_immediate_util.c30
-rw-r--r--source/blender/gpu/intern/gpu_matrix.c14
-rw-r--r--source/blender/gpu/intern/gpu_shader.c16
-rw-r--r--source/blender/gpu/intern/gpu_shader_private.h2
-rw-r--r--source/blender/gpu/intern/gpu_viewport.c16
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c8
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c18
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c16
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c4
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c24
131 files changed, 3094 insertions, 3094 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 43060870449..55c08361a47 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -566,10 +566,10 @@ static void blf_draw_gl__start(FontBLF *font)
gpuRotate2D(RAD2DEG(font->angle));
#ifndef BLF_STANDALONE
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
BLI_assert(pos == BLF_POS_ID);
BLI_assert(texCoord == BLF_COORD_ID);
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 3ba75517581..03f62cbb6ea 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -206,7 +206,7 @@ static void blf_font_draw_ex(
blf_font_ensure_ascii_table(font);
- immBeginAtMost(PRIM_TRIANGLES, verts_needed(font, str, len));
+ immBeginAtMost(GWN_PRIM_TRIS, verts_needed(font, str, len));
/* at most because some glyphs might be clipped & not drawn */
while ((i < len) && str[i]) {
@@ -253,7 +253,7 @@ static void blf_font_draw_ascii_ex(
blf_font_ensure_ascii_table(font);
- immBeginAtMost(PRIM_TRIANGLES, verts_needed(font, str, len));
+ immBeginAtMost(GWN_PRIM_TRIS, verts_needed(font, str, len));
while ((c = *(str++)) && len--) {
BLI_assert(c < 128);
@@ -293,7 +293,7 @@ int blf_font_draw_mono(FontBLF *font, const char *str, size_t len, int cwidth)
blf_font_ensure_ascii_table(font);
- immBeginAtMost(PRIM_TRIANGLES, verts_needed(font, str, len));
+ immBeginAtMost(GWN_PRIM_TRIS, verts_needed(font, str, len));
while ((i < len) && str[i]) {
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index 420ae4bb12d..3e6e24a28b0 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -147,7 +147,7 @@ char *BKE_animdata_driver_path_hack(struct bContext *C, struct PointerRNA *ptr,
char *base_path);
/* ************************************* */
-/* Batch AnimData API */
+/* Gwn_Batch AnimData API */
/* Define for callback looper used in BKE_animdata_main_cb */
typedef void (*ID_AnimData_Edit_Callback)(struct ID *id, struct AnimData *adt, void *user_data);
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 27c6814b959..905eb677612 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -30,7 +30,7 @@
#include "BLI_ghash.h"
#include "BLI_utildefines.h"
-struct Batch;
+struct Gwn_Batch;
struct CCGElem;
struct CCGKey;
struct CustomData;
@@ -121,7 +121,7 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
int (*setMaterial)(int matnr, void *attribs), bool wireframe, bool fast);
void BKE_pbvh_draw_cb(
PBVH *bvh, float (*planes)[4], float (*fnors)[3], bool fast,
- void (*draw_fn)(void *user_data, struct Batch *batch), void *user_data);
+ void (*draw_fn)(void *user_data, struct Gwn_Batch *batch), void *user_data);
/* PBVH Access */
typedef enum {
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 874637896cd..55d5f6f89a1 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -3520,14 +3520,14 @@ static void navmesh_drawColored(DerivedMesh *dm)
dm->drawEdges(dm, 0, 1);
#endif
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
/* Note: batch drawing API would let us share vertices */
- immBeginAtMost(PRIM_TRIANGLES, dm->numTessFaceData * 6);
+ immBeginAtMost(GWN_PRIM_TRIS, dm->numTessFaceData * 6);
for (int a = 0; a < dm->numTessFaceData; a++, mface++) {
int pi = polygonIdx[a];
if (pi <= 0) {
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index c743d1f7e11..155634c9d9c 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -388,8 +388,8 @@ static void cdDM_drawEdges(DerivedMesh *dm, bool UNUSED(drawLooseEdges), bool UN
MVert *vert = cddm->mvert;
MEdge *edge = cddm->medge;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* NOTE: This is active object color, which is not really perfect.
* But we can't query color set by glColor() :(
@@ -406,7 +406,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, bool UNUSED(drawLooseEdges), bool UN
const int num_current_edges = (chunk < num_chunks - 1)
? chunk_size
: dm->numEdgeData - chunk_size * (num_chunks - 1);
- immBeginAtMost(PRIM_LINES, num_current_edges * 2);
+ immBeginAtMost(GWN_PRIM_LINES, num_current_edges * 2);
for (int i = 0; i < num_current_edges; i++, edge++) {
immVertex3fv(pos, vert[edge->v1].co);
immVertex3fv(pos, vert[edge->v2].co);
@@ -461,9 +461,9 @@ static void cdDM_drawFacesSolid(
const float (*nors)[3] = dm->getPolyDataArray(dm, CD_NORMAL);
const float (*lnors)[3] = dm->getLoopDataArray(dm, CD_NORMAL);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int nor = VertexFormat_add_attrib(format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int nor = GWN_vertformat_attr_add(format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
float color[4] = {0.8f, 0.8f, 0.8f, 1.0f};
const float light_vec[3] = {0.0f, 0.0f, 1.0f};
@@ -480,7 +480,7 @@ static void cdDM_drawFacesSolid(
? chunk_size
: num_looptris - chunk_size * (num_chunks - 1);
- immBeginAtMost(PRIM_TRIANGLES, num_current_looptris * 3);
+ immBeginAtMost(GWN_PRIM_TRIS, num_current_looptris * 3);
for (a = 0; a < num_current_looptris; a++, looptri++) {
const MPoly *mp = &mpoly[looptri->poly];
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 8190a7c2a8b..6d0ad3255a2 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -922,7 +922,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
}
/***************************************************************************************
- * SPRING NETWORK BUILDING IMPLEMENTATION BEGIN
+ * SPRING NETWORK GWN_BATCH_BUILDING IMPLEMENTATION BEGIN
***************************************************************************************/
BLI_INLINE void spring_verts_ordered_set(ClothSpring *spring, int v0, int v1)
@@ -1504,6 +1504,6 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
} /* cloth_build_springs */
/***************************************************************************************
- * SPRING NETWORK BUILDING IMPLEMENTATION END
+ * SPRING NETWORK GWN_BATCH_BUILDING IMPLEMENTATION END
***************************************************************************************/
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 336d4fae1b8..ef2eaf8405b 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1159,7 +1159,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
static void pbvh_draw_BB(PBVH *bvh)
{
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
for (int a = 0; a < bvh->totnode; a++) {
@@ -1849,7 +1849,7 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*fnors)[3],
struct PBVHNodeDrawCallbackData {
- void (*draw_fn)(void *user_data, Batch *batch);
+ void (*draw_fn)(void *user_data, Gwn_Batch *batch);
void *user_data;
bool fast;
};
@@ -1859,7 +1859,7 @@ static void pbvh_node_draw_cb(PBVHNode *node, void *data_v)
struct PBVHNodeDrawCallbackData *data = data_v;
if (!(node->flag & PBVH_FullyHidden)) {
- Batch *triangles = GPU_pbvh_buffers_batch_get(node->draw_buffers, data->fast);
+ Gwn_Batch *triangles = GPU_pbvh_buffers_batch_get(node->draw_buffers, data->fast);
if (triangles != NULL) {
data->draw_fn(data->user_data, triangles);
}
@@ -1871,7 +1871,7 @@ static void pbvh_node_draw_cb(PBVHNode *node, void *data_v)
*/
void BKE_pbvh_draw_cb(
PBVH *bvh, float (*planes)[4], float (*fnors)[3], bool fast,
- void (*draw_fn)(void *user_data, Batch *batch), void *user_data)
+ void (*draw_fn)(void *user_data, Gwn_Batch *batch), void *user_data)
{
struct PBVHNodeDrawCallbackData draw_data = {
.fast = fast,
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 9c95d4de695..402534a8e4c 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -67,7 +67,7 @@ static const std::string bc_get_dae_name(T *node)
return node->getName().size() ? node->getName(): node->getOriginalId();
}
-static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type)
+static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::Gwn_PrimType type)
{
switch (type) {
case COLLADAFW::MeshPrimitive::LINES:
@@ -274,7 +274,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has su
for (unsigned i = 0; i < prim_arr.getCount(); i++) {
COLLADAFW::MeshPrimitive *mp = prim_arr[i];
- COLLADAFW::MeshPrimitive::PrimitiveType type = mp->getPrimitiveType();
+ COLLADAFW::MeshPrimitive::Gwn_PrimType type = mp->getPrimitiveType();
const char *type_str = bc_primTypeToStr(type);
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c
index 96eaf541cae..d1afb0b4a1e 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -181,7 +181,7 @@ static void BASIC_cache_populate(void *vedata, Object *ob)
if (!DRW_object_is_renderable(ob))
return;
- struct Batch *geom = DRW_cache_object_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
bool do_cull = false; /* TODO (we probably wan't to take this from the viewport?) */
#ifdef USE_DEPTH
diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c
index 8ca228ebce5..f39438e660c 100644
--- a/source/blender/draw/engines/clay/clay_engine.c
+++ b/source/blender/draw/engines/clay/clay_engine.c
@@ -776,7 +776,7 @@ static void CLAY_cache_populate(void *vedata, Object *ob)
}
}
- struct Batch *geom = DRW_cache_object_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
IDProperty *ces_mode_ob = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_OBJECT, "");
const bool do_cull = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_backface_culling");
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c
index e6f2bfbd5ba..6aa70e980a7 100644
--- a/source/blender/draw/engines/eevee/eevee_effects.c
+++ b/source/blender/draw/engines/eevee/eevee_effects.c
@@ -382,7 +382,7 @@ void EEVEE_effects_init(EEVEE_Data *vedata)
static DRWShadingGroup *eevee_create_bloom_pass(const char *name, EEVEE_EffectsInfo *effects, struct GPUShader *sh, DRWPass **pass, bool upsample)
{
- struct Batch *quad = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
*pass = DRW_pass_create(name, DRW_STATE_WRITE_COLOR);
@@ -406,7 +406,7 @@ void EEVEE_effects_cache_init(EEVEE_Data *vedata)
EEVEE_EffectsInfo *effects = stl->effects;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
- struct Batch *quad = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
{
psl->motion_blur = DRW_pass_create("Motion Blur", DRW_STATE_WRITE_COLOR);
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index 325758f4eb9..729e44b0def 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -91,7 +91,7 @@ static void EEVEE_cache_populate(void *vedata, Object *ob)
}
}
- struct Batch *geom = DRW_cache_object_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
EEVEE_materials_cache_populate(vedata, sldata, ob, geom);
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 36eb5074cf8..15a4b86129d 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -279,7 +279,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *
{
psl->probe_background = DRW_pass_create("World Probe Pass", DRW_STATE_WRITE_COLOR);
- struct Batch *geom = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
DRWShadingGroup *grp = NULL;
const DRWContextState *draw_ctx = DRW_context_state_get();
@@ -326,7 +326,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *
{
psl->probe_glossy_compute = DRW_pass_create("LightProbe Glossy Compute", DRW_STATE_WRITE_COLOR);
- struct Batch *geom = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_filter_glossy_sh, psl->probe_glossy_compute, geom);
DRW_shgroup_uniform_float(grp, "sampleCount", &sldata->probes->samples_ct, 1);
@@ -359,7 +359,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *
#endif
DRW_shgroup_uniform_texture(grp, "probeHdr", sldata->probe_rt);
- struct Batch *geom = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
DRW_shgroup_call_add(grp, geom, NULL);
}
@@ -367,7 +367,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_CULL_BACK;
psl->probe_display = DRW_pass_create("LightProbe Display", state);
- struct Batch *geom = DRW_cache_sphere_get();
+ struct Gwn_Batch *geom = DRW_cache_sphere_get();
DRWShadingGroup *grp = stl->g_data->cube_display_shgrp = DRW_shgroup_instance_create(e_data.probe_cube_display_sh, psl->probe_display, geom);
DRW_shgroup_attrib_float(grp, "probe_id", 1); /* XXX this works because we are still uploading 4bytes and using the right stride */
DRW_shgroup_attrib_float(grp, "probe_location", 3);
@@ -535,7 +535,7 @@ static void EEVEE_planar_reflections_updates(EEVEE_SceneLayerData *sldata, EEVEE
DRW_shgroup_uniform_buffer(grp, "probePlanars", &txl->planar_pool);
DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo);
- struct Batch *geom = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
DRW_shgroup_call_add(grp, geom, ob->obmat);
}
}
@@ -640,7 +640,7 @@ static void EEVEE_lightprobes_updates(EEVEE_SceneLayerData *sldata, EEVEE_PassLi
/* Debug Display */
if ((probe->flag & LIGHTPROBE_FLAG_SHOW_DATA) != 0) {
- struct Batch *geom = DRW_cache_sphere_get();
+ struct Gwn_Batch *geom = DRW_cache_sphere_get();
DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_grid_display_sh, psl->probe_display, geom);
DRW_shgroup_set_instance_count(grp, ped->num_cell);
DRW_shgroup_uniform_int(grp, "offset", &egrid->offset, 1);
diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c
index 05565e8e0ba..c6436d5b923 100644
--- a/source/blender/draw/engines/eevee/eevee_lights.c
+++ b/source/blender/draw/engines/eevee/eevee_lights.c
@@ -179,7 +179,7 @@ void EEVEE_lights_cache_add(EEVEE_SceneLayerData *sldata, Object *ob)
}
/* Add a shadow caster to the shadowpasses */
-void EEVEE_lights_cache_shcaster_add(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl, struct Batch *geom, float (*obmat)[4])
+void EEVEE_lights_cache_shcaster_add(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl, struct Gwn_Batch *geom, float (*obmat)[4])
{
DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.shadow_sh, psl->shadow_cube_pass, geom);
DRW_shgroup_uniform_block(grp, "shadow_render_block", sldata->shadow_render_ubo);
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index e4d5e368be0..75eec99b1a1 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -133,7 +133,7 @@ static struct GPUTexture *create_ggx_lut_texture(int UNUSED(w), int UNUSED(h))
DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley);
DRW_shgroup_uniform_texture(grp, "texJitter", e_data.jitter);
- struct Batch *geom = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
DRW_shgroup_call_add(grp, geom, NULL);
float *texels = MEM_mallocN(sizeof(float[2]) * w * h, "lut");
@@ -342,7 +342,7 @@ void EEVEE_materials_cache_init(EEVEE_Data *vedata)
{
psl->background_pass = DRW_pass_create("Background Pass", DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR);
- struct Batch *geom = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
DRWShadingGroup *grp = NULL;
const DRWContextState *draw_ctx = DRW_context_state_get();
@@ -425,7 +425,7 @@ void EEVEE_materials_cache_init(EEVEE_Data *vedata)
} \
} while (0)
-void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_SceneLayerData *sldata, Object *ob, struct Batch *geom)
+void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_SceneLayerData *sldata, Object *ob, struct Gwn_Batch *geom)
{
EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
@@ -445,7 +445,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_SceneLayerData *sl
ADD_SHGROUP_CALL(depth_clip_shgrp, ob, geom);
/* Get per-material split surface */
- struct Batch **mat_geom = DRW_cache_object_surface_material_get(ob);
+ struct Gwn_Batch **mat_geom = DRW_cache_object_surface_material_get(ob);
if (mat_geom) {
struct GPUShader *default_shader = e_data.default_lit;
struct DRWPass *default_pass = psl->default_pass;
@@ -522,7 +522,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_SceneLayerData *sl
int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as;
if (draw_as == PART_DRAW_PATH && (psys->pathcache || psys->childcache)) {
- struct Batch *hair_geom = DRW_cache_particles_get_hair(psys);
+ struct Gwn_Batch *hair_geom = DRW_cache_particles_get_hair(psys);
DRWShadingGroup *shgrp = NULL;
Material *ma = give_current_material(ob, part->omat);
static float mat[4][4];
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index 72419831795..530a9b894a2 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -383,7 +383,7 @@ EEVEE_LampEngineData *EEVEE_lamp_data_get(Object *ob);
/* eevee_materials.c */
void EEVEE_materials_init(void);
void EEVEE_materials_cache_init(EEVEE_Data *vedata);
-void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_SceneLayerData *sldata, Object *ob, struct Batch *geom);
+void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_SceneLayerData *sldata, Object *ob, struct Gwn_Batch *geom);
void EEVEE_materials_cache_finish(EEVEE_Data *vedata);
struct GPUMaterial *EEVEE_material_world_lightprobe_get(struct Scene *scene, struct World *wo);
struct GPUMaterial *EEVEE_material_world_background_get(struct Scene *scene, struct World *wo);
@@ -396,7 +396,7 @@ void EEVEE_materials_free(void);
void EEVEE_lights_init(EEVEE_SceneLayerData *sldata);
void EEVEE_lights_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl);
void EEVEE_lights_cache_add(EEVEE_SceneLayerData *sldata, struct Object *ob);
-void EEVEE_lights_cache_shcaster_add(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl, struct Batch *geom, float (*obmat)[4]);
+void EEVEE_lights_cache_shcaster_add(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl, struct Gwn_Batch *geom, float (*obmat)[4]);
void EEVEE_lights_cache_finish(EEVEE_SceneLayerData *sldata);
void EEVEE_lights_update(EEVEE_SceneLayerData *sldata);
void EEVEE_draw_shadows(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl);
diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c
index c48518ef5e7..e487b29ebfd 100644
--- a/source/blender/draw/engines/external/external_engine.c
+++ b/source/blender/draw/engines/external/external_engine.c
@@ -128,7 +128,7 @@ static void EXTERNAL_cache_populate(void *vedata, Object *ob)
if (!DRW_object_is_renderable(ob))
return;
- struct Batch *geom = DRW_cache_object_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
/* Depth Prepass */
DRW_shgroup_call_add(stl->g_data->depth_shgrp, geom, ob->obmat);
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 3ea46531379..7c47f47100b 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -60,7 +60,7 @@ struct GPUMaterial;
struct GPUTexture;
struct GPUUniformBuffer;
struct Object;
-struct Batch;
+struct Gwn_Batch;
struct DefaultFramebufferList;
struct DefaultTextureList;
struct DRWTextStore;
@@ -262,22 +262,22 @@ typedef enum {
DRWShadingGroup *DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass);
DRWShadingGroup *DRW_shgroup_material_create(struct GPUMaterial *material, DRWPass *pass);
-DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *material, DRWPass *pass, struct Batch *geom);
-DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, struct Batch *geom);
+DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *material, DRWPass *pass, struct Gwn_Batch *geom);
+DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, struct Gwn_Batch *geom);
DRWShadingGroup *DRW_shgroup_point_batch_create(struct GPUShader *shader, DRWPass *pass);
DRWShadingGroup *DRW_shgroup_line_batch_create(struct GPUShader *shader, DRWPass *pass);
DRWShadingGroup *DRW_shgroup_empty_tri_batch_create(struct GPUShader *shader, DRWPass *pass, int size);
typedef void (DRWCallGenerateFn)(
DRWShadingGroup *shgroup,
- void (*draw_fn)(DRWShadingGroup *shgroup, struct Batch *geom),
+ void (*draw_fn)(DRWShadingGroup *shgroup, struct Gwn_Batch *geom),
void *user_data);
-void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Batch *instances);
+void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Gwn_Batch *instances);
void DRW_shgroup_free(struct DRWShadingGroup *shgroup);
-void DRW_shgroup_call_add(DRWShadingGroup *shgroup, struct Batch *geom, float (*obmat)[4]);
-void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, struct Batch *geom, struct Object *ob);
+void DRW_shgroup_call_add(DRWShadingGroup *shgroup, struct Gwn_Batch *geom, float (*obmat)[4]);
+void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, struct Gwn_Batch *geom, struct Object *ob);
void DRW_shgroup_call_sculpt_add(DRWShadingGroup *shgroup, struct Object *ob, float (*obmat)[4]);
void DRW_shgroup_call_generate_add(
DRWShadingGroup *shgroup, DRWCallGenerateFn *geometry_fn, void *user_data, float (*obmat)[4]);
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index 47af8a3c8a4..e31fbeb054c 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -101,7 +101,7 @@ static struct {
static void DRW_shgroup_bone_octahedral_solid(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_octahedral_solid == NULL) {
- struct Batch *geom = DRW_cache_bone_octahedral_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_octahedral_get();
g_data.bone_octahedral_solid = shgroup_instance_objspace_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
}
@@ -111,7 +111,7 @@ static void DRW_shgroup_bone_octahedral_solid(const float (*bone_mat)[4], const
static void DRW_shgroup_bone_octahedral_wire(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_octahedral_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_octahedral_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_octahedral_wire_outline_get();
g_data.bone_octahedral_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -122,7 +122,7 @@ static void DRW_shgroup_bone_octahedral_wire(const float (*bone_mat)[4], const f
static void DRW_shgroup_bone_box_solid(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_box_solid == NULL) {
- struct Batch *geom = DRW_cache_bone_box_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_box_get();
g_data.bone_box_solid = shgroup_instance_objspace_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
}
@@ -132,7 +132,7 @@ static void DRW_shgroup_bone_box_solid(const float (*bone_mat)[4], const float c
static void DRW_shgroup_bone_box_wire(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_box_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_box_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_box_wire_outline_get();
g_data.bone_box_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -143,7 +143,7 @@ static void DRW_shgroup_bone_box_wire(const float (*bone_mat)[4], const float co
static void DRW_shgroup_bone_wire_wire(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_wire_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_wire_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_wire_wire_outline_get();
g_data.bone_wire_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -157,7 +157,7 @@ static void DRW_shgroup_bone_envelope_distance(
{
if (g_data.pass_bone_envelope != NULL) {
if (g_data.bone_envelope_distance == NULL) {
- struct Batch *geom = DRW_cache_bone_envelope_distance_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_envelope_distance_outline_get();
/* Note: bone_wire draw pass is not really working, think we need another one here? */
g_data.bone_envelope_distance = shgroup_instance_bone_envelope_wire(g_data.pass_bone_envelope, geom, g_data.ob->obmat);
}
@@ -171,7 +171,7 @@ static void DRW_shgroup_bone_envelope_solid(
const float *radius_head, const float *radius_tail)
{
if (g_data.bone_envelope_solid == NULL) {
- struct Batch *geom = DRW_cache_bone_envelope_solid_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_envelope_solid_get();
g_data.bone_envelope_solid = shgroup_instance_bone_envelope_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
}
@@ -183,7 +183,7 @@ static void DRW_shgroup_bone_envelope_wire(
const float *radius_head, const float *radius_tail, const float *distance)
{
if (g_data.bone_envelope_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_envelope_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_envelope_wire_outline_get();
g_data.bone_envelope_wire = shgroup_instance_bone_envelope_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -195,7 +195,7 @@ static void DRW_shgroup_bone_envelope_head_wire(
const float *radius_head, const float *radius_tail, const float *distance)
{
if (g_data.bone_envelope_head_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_envelope_head_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_envelope_head_wire_outline_get();
g_data.bone_envelope_head_wire = shgroup_instance_bone_envelope_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -207,7 +207,7 @@ static void DRW_shgroup_bone_envelope_head_wire(
static void DRW_shgroup_bone_custom_solid(const float (*bone_mat)[4], const float color[4], Object *custom)
{
/* grr, not re-using instances! */
- struct Batch *geom = DRW_cache_object_surface_get(custom);
+ struct Gwn_Batch *geom = DRW_cache_object_surface_get(custom);
if (geom) {
DRWShadingGroup *shgrp_geom_solid = shgroup_instance_objspace_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
DRW_shgroup_call_dynamic_add(shgrp_geom_solid, bone_mat, color);
@@ -217,7 +217,7 @@ static void DRW_shgroup_bone_custom_solid(const float (*bone_mat)[4], const floa
static void DRW_shgroup_bone_custom_wire(const float (*bone_mat)[4], const float color[4], Object *custom)
{
/* grr, not re-using instances! */
- struct Batch *geom = DRW_cache_object_wire_outline_get(custom);
+ struct Gwn_Batch *geom = DRW_cache_object_wire_outline_get(custom);
if (geom) {
DRWShadingGroup *shgrp_geom_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
DRW_shgroup_call_dynamic_add(shgrp_geom_wire, bone_mat, color);
@@ -228,7 +228,7 @@ static void DRW_shgroup_bone_custom_wire(const float (*bone_mat)[4], const float
static void DRW_shgroup_bone_point_solid(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_point_solid == NULL) {
- struct Batch *geom = DRW_cache_bone_point_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_point_get();
g_data.bone_point_solid = shgroup_instance_objspace_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
}
@@ -238,7 +238,7 @@ static void DRW_shgroup_bone_point_solid(const float (*bone_mat)[4], const float
static void DRW_shgroup_bone_point_wire(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_point_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_point_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_point_wire_outline_get();
g_data.bone_point_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -249,7 +249,7 @@ static void DRW_shgroup_bone_point_wire(const float (*bone_mat)[4], const float
static void DRW_shgroup_bone_axes(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_axes == NULL) {
- struct Batch *geom = DRW_cache_bone_arrows_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_arrows_get();
g_data.bone_axes = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 41541252bea..4dfb9f960c2 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -39,53 +39,53 @@
#include "draw_cache_impl.h"
static struct DRWShapeCache {
- Batch *drw_single_vertice;
- Batch *drw_fullscreen_quad;
- Batch *drw_screenspace_circle;
- Batch *drw_plain_axes;
- Batch *drw_single_arrow;
- Batch *drw_cube;
- Batch *drw_circle;
- Batch *drw_square;
- Batch *drw_line;
- Batch *drw_line_endpoints;
- Batch *drw_empty_sphere;
- Batch *drw_empty_cone;
- Batch *drw_arrows;
- Batch *drw_axis_names;
- Batch *drw_image_plane;
- Batch *drw_image_plane_wire;
- Batch *drw_field_wind;
- Batch *drw_field_force;
- Batch *drw_field_vortex;
- Batch *drw_field_tube_limit;
- Batch *drw_field_cone_limit;
- Batch *drw_lamp;
- Batch *drw_lamp_sunrays;
- Batch *drw_lamp_area;
- Batch *drw_lamp_hemi;
- Batch *drw_lamp_spot;
- Batch *drw_lamp_spot_square;
- Batch *drw_speaker;
- Batch *drw_lightprobe;
- Batch *drw_bone_octahedral;
- Batch *drw_bone_octahedral_wire;
- Batch *drw_bone_box;
- Batch *drw_bone_box_wire;
- Batch *drw_bone_wire_wire;
- Batch *drw_bone_envelope;
- Batch *drw_bone_envelope_distance;
- Batch *drw_bone_envelope_wire;
- Batch *drw_bone_envelope_head_wire;
- Batch *drw_bone_point;
- Batch *drw_bone_point_wire;
- Batch *drw_bone_arrows;
- Batch *drw_camera;
- Batch *drw_camera_tria;
- Batch *drw_camera_focus;
- Batch *drw_particle_cross;
- Batch *drw_particle_circle;
- Batch *drw_particle_axis;
+ Gwn_Batch *drw_single_vertice;
+ Gwn_Batch *drw_fullscreen_quad;
+ Gwn_Batch *drw_screenspace_circle;
+ Gwn_Batch *drw_plain_axes;
+ Gwn_Batch *drw_single_arrow;
+ Gwn_Batch *drw_cube;
+ Gwn_Batch *drw_circle;
+ Gwn_Batch *drw_square;
+ Gwn_Batch *drw_line;
+ Gwn_Batch *drw_line_endpoints;
+ Gwn_Batch *drw_empty_sphere;
+ Gwn_Batch *drw_empty_cone;
+ Gwn_Batch *drw_arrows;
+ Gwn_Batch *drw_axis_names;
+ Gwn_Batch *drw_image_plane;
+ Gwn_Batch *drw_image_plane_wire;
+ Gwn_Batch *drw_field_wind;
+ Gwn_Batch *drw_field_force;
+ Gwn_Batch *drw_field_vortex;
+ Gwn_Batch *drw_field_tube_limit;
+ Gwn_Batch *drw_field_cone_limit;
+ Gwn_Batch *drw_lamp;
+ Gwn_Batch *drw_lamp_sunrays;
+ Gwn_Batch *drw_lamp_area;
+ Gwn_Batch *drw_lamp_hemi;
+ Gwn_Batch *drw_lamp_spot;
+ Gwn_Batch *drw_lamp_spot_square;
+ Gwn_Batch *drw_speaker;
+ Gwn_Batch *drw_lightprobe;
+ Gwn_Batch *drw_bone_octahedral;
+ Gwn_Batch *drw_bone_octahedral_wire;
+ Gwn_Batch *drw_bone_box;
+ Gwn_Batch *drw_bone_box_wire;
+ Gwn_Batch *drw_bone_wire_wire;
+ Gwn_Batch *drw_bone_envelope;
+ Gwn_Batch *drw_bone_envelope_distance;
+ Gwn_Batch *drw_bone_envelope_wire;
+ Gwn_Batch *drw_bone_envelope_head_wire;
+ Gwn_Batch *drw_bone_point;
+ Gwn_Batch *drw_bone_point_wire;
+ Gwn_Batch *drw_bone_arrows;
+ Gwn_Batch *drw_camera;
+ Gwn_Batch *drw_camera_tria;
+ Gwn_Batch *drw_camera_focus;
+ Gwn_Batch *drw_particle_cross;
+ Gwn_Batch *drw_particle_circle;
+ Gwn_Batch *drw_particle_axis;
} SHC = {NULL};
void DRW_shape_cache_free(void)
@@ -145,21 +145,21 @@ void DRW_shape_cache_free(void)
* \{ */
static void add_fancy_edge(
- VertexBuffer *vbo, unsigned int pos_id, unsigned int n1_id, unsigned int n2_id,
+ Gwn_VertBuf *vbo, unsigned int pos_id, unsigned int n1_id, unsigned int n2_id,
unsigned int *v_idx, const float co1[3], const float co2[3],
const float n1[3], const float n2[3])
{
- VertexBuffer_set_attrib(vbo, n1_id, *v_idx, n1);
- VertexBuffer_set_attrib(vbo, n2_id, *v_idx, n2);
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, co1);
+ GWN_vertbuf_attr_set(vbo, n1_id, *v_idx, n1);
+ GWN_vertbuf_attr_set(vbo, n2_id, *v_idx, n2);
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++, co1);
- VertexBuffer_set_attrib(vbo, n1_id, *v_idx, n1);
- VertexBuffer_set_attrib(vbo, n2_id, *v_idx, n2);
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, co2);
+ GWN_vertbuf_attr_set(vbo, n1_id, *v_idx, n1);
+ GWN_vertbuf_attr_set(vbo, n2_id, *v_idx, n2);
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++, co2);
}
static void add_lat_lon_vert(
- VertexBuffer *vbo, unsigned int pos_id, unsigned int nor_id,
+ Gwn_VertBuf *vbo, unsigned int pos_id, unsigned int nor_id,
unsigned int *v_idx, const float rad, const float lat, const float lon)
{
float pos[3], nor[3];
@@ -168,22 +168,22 @@ static void add_lat_lon_vert(
nor[2] = sinf(lat) * sinf(lon);
mul_v3_v3fl(pos, nor, rad);
- VertexBuffer_set_attrib(vbo, nor_id, *v_idx, nor);
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, pos);
+ GWN_vertbuf_attr_set(vbo, nor_id, *v_idx, nor);
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++, pos);
}
-static VertexBuffer *fill_arrows_vbo(const float scale)
+static Gwn_VertBuf *fill_arrows_vbo(const float scale)
{
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Line */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6 * 3);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6 * 3);
float v1[3] = {0.0, 0.0, 0.0};
float v2[3] = {0.0, 0.0, 0.0};
@@ -195,21 +195,21 @@ static VertexBuffer *fill_arrows_vbo(const float scale)
v2[axis] = 1.0f;
mul_v3_v3fl(vtmp1, v1, scale);
mul_v3_v3fl(vtmp2, v2, scale);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 0, vtmp1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 1, vtmp2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 0, vtmp1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 1, vtmp2);
v1[axis] = 0.85f;
v1[arrow_axis] = -0.08f;
mul_v3_v3fl(vtmp1, v1, scale);
mul_v3_v3fl(vtmp2, v2, scale);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 2, vtmp1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 3, vtmp2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 2, vtmp1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 3, vtmp2);
v1[arrow_axis] = 0.08f;
mul_v3_v3fl(vtmp1, v1, scale);
mul_v3_v3fl(vtmp2, v2, scale);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 4, vtmp1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 5, vtmp2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 4, vtmp1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 5, vtmp2);
/* reset v1 & v2 to zero */
v1[arrow_axis] = v1[axis] = v2[axis] = 0.0f;
@@ -218,18 +218,18 @@ static VertexBuffer *fill_arrows_vbo(const float scale)
return vbo;
}
-static VertexBuffer *sphere_wire_vbo(const float rad)
+static Gwn_VertBuf *sphere_wire_vbo(const float rad)
{
#define NSEGMENTS 32
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, NSEGMENTS * 2 * 3);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, NSEGMENTS * 2 * 3);
/* a single ring of vertices */
float p[NSEGMENTS][2];
@@ -254,7 +254,7 @@ static VertexBuffer *sphere_wire_vbo(const float rad)
else
v[0] = 0.0f, v[1] = cv[0], v[2] = cv[1];
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 2 + j + (NSEGMENTS * 2 * axis), v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 2 + j + (NSEGMENTS * 2 * axis), v);
}
}
}
@@ -264,7 +264,7 @@ static VertexBuffer *sphere_wire_vbo(const float rad)
}
/* Quads */
-Batch *DRW_cache_fullscreen_quad_get(void)
+Gwn_Batch *DRW_cache_fullscreen_quad_get(void)
{
if (!SHC.drw_fullscreen_quad) {
/* Use a triangle instead of a real quad */
@@ -273,28 +273,28 @@ Batch *DRW_cache_fullscreen_quad_get(void)
float uvs[3][2] = {{ 0.0f, 0.0f}, { 2.0f, 0.0f}, { 0.0f, 2.0f}};
/* Position Only 2D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, uvs; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
- attr_id.uvs = VertexFormat_add_attrib(&format, "uvs", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ attr_id.uvs = GWN_vertformat_attr_add(&format, "uvs", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 3);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 3);
for (int i = 0; i < 3; ++i) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, pos[i]);
- VertexBuffer_set_attrib(vbo, attr_id.uvs, i, uvs[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, pos[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.uvs, i, uvs[i]);
}
- SHC.drw_fullscreen_quad = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_fullscreen_quad = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_fullscreen_quad;
}
/* Sphere */
-Batch *DRW_cache_sphere_get(void)
+Gwn_Batch *DRW_cache_sphere_get(void)
{
return Batch_get_sphere(2);
}
@@ -306,7 +306,7 @@ Batch *DRW_cache_sphere_get(void)
/** \name Common
* \{ */
-Batch *DRW_cache_cube_get(void)
+Gwn_Batch *DRW_cache_cube_get(void)
{
if (!SHC.drw_cube) {
const GLfloat verts[8][3] = {
@@ -323,59 +323,59 @@ Batch *DRW_cache_cube_get(void)
const GLubyte indices[24] = {0, 1, 1, 3, 3, 2, 2, 0, 0, 4, 4, 5, 5, 7, 7, 6, 6, 4, 1, 5, 3, 7, 2, 6};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 24);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 24);
for (int i = 0; i < 24; ++i) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, verts[indices[i]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, verts[indices[i]]);
}
- SHC.drw_cube = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_cube = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_cube;
}
-Batch *DRW_cache_circle_get(void)
+Gwn_Batch *DRW_cache_circle_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_circle) {
float v[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2);
for (int a = 0; a < CIRCLE_RESOL; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2 + 1, v);
}
- SHC.drw_circle = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_circle = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_circle;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_square_get(void)
+Gwn_Batch *DRW_cache_square_get(void)
{
if (!SHC.drw_square) {
float p[4][3] = {{ 1.0f, 0.0f, 1.0f},
@@ -384,26 +384,26 @@ Batch *DRW_cache_square_get(void)
{-1.0f, 0.0f, 1.0f}};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 8);
for (int i = 0; i < 4; i++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 2, p[i % 4]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 2 + 1, p[(i+1) % 4]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 2, p[i % 4]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 2 + 1, p[(i+1) % 4]);
}
- SHC.drw_square = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_square = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_square;
}
-Batch *DRW_cache_single_line_get(void)
+Gwn_Batch *DRW_cache_single_line_get(void)
{
/* Z axis line */
if (!SHC.drw_line) {
@@ -411,24 +411,24 @@ Batch *DRW_cache_single_line_get(void)
float v2[3] = {0.0f, 0.0f, 1.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 1, v2);
- SHC.drw_line = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_line = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_line;
}
-Batch *DRW_cache_single_line_endpoints_get(void)
+Gwn_Batch *DRW_cache_single_line_endpoints_get(void)
{
/* Z axis line */
if (!SHC.drw_line_endpoints) {
@@ -436,46 +436,46 @@ Batch *DRW_cache_single_line_endpoints_get(void)
float v2[3] = {0.0f, 0.0f, 1.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 1, v2);
- SHC.drw_line_endpoints = Batch_create(PRIM_POINTS, vbo, NULL);
+ SHC.drw_line_endpoints = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
}
return SHC.drw_line_endpoints;
}
-Batch *DRW_cache_screenspace_circle_get(void)
+Gwn_Batch *DRW_cache_screenspace_circle_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_screenspace_circle) {
float v[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL + 1);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL + 1);
for (int a = 0; a <= CIRCLE_RESOL; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
- VertexBuffer_set_attrib(vbo, attr_id.pos, a, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a, v);
}
- SHC.drw_screenspace_circle = Batch_create(PRIM_LINE_STRIP, vbo, NULL);
+ SHC.drw_screenspace_circle = GWN_batch_create(GWN_PRIM_LINE_STRIP, vbo, NULL);
}
return SHC.drw_screenspace_circle;
#undef CIRCLE_RESOL
@@ -488,7 +488,7 @@ Batch *DRW_cache_screenspace_circle_get(void)
/** \name Common Object API
* \{ */
-Batch *DRW_cache_object_wire_outline_get(Object *ob)
+Gwn_Batch *DRW_cache_object_wire_outline_get(Object *ob)
{
switch (ob->type) {
case OB_MESH:
@@ -500,7 +500,7 @@ Batch *DRW_cache_object_wire_outline_get(Object *ob)
}
}
-Batch *DRW_cache_object_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_object_surface_get(Object *ob)
{
switch (ob->type) {
case OB_MESH:
@@ -516,7 +516,7 @@ Batch *DRW_cache_object_surface_get(Object *ob)
}
}
-Batch **DRW_cache_object_surface_material_get(struct Object *ob)
+Gwn_Batch **DRW_cache_object_surface_material_get(struct Object *ob)
{
switch (ob->type) {
case OB_MESH:
@@ -534,7 +534,7 @@ Batch **DRW_cache_object_surface_material_get(struct Object *ob)
/** \name Empties
* \{ */
-Batch *DRW_cache_plain_axes_get(void)
+Gwn_Batch *DRW_cache_plain_axes_get(void)
{
if (!SHC.drw_plain_axes) {
int axis;
@@ -542,46 +542,46 @@ Batch *DRW_cache_plain_axes_get(void)
float v2[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6);
for (axis = 0; axis < 3; axis++) {
v1[axis] = 1.0f;
v2[axis] = -1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 2, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 2 + 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 2, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 2 + 1, v2);
/* reset v1 & v2 to zero for next axis */
v1[axis] = v2[axis] = 0.0f;
}
- SHC.drw_plain_axes = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_plain_axes = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_plain_axes;
}
-Batch *DRW_cache_single_arrow_get(void)
+Gwn_Batch *DRW_cache_single_arrow_get(void)
{
if (!SHC.drw_single_arrow) {
float v1[3] = {0.0f, 0.0f, 1.0f}, v2[3], v3[3];
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Square Pyramid */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 12);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 12);
v2[0] = 0.035f; v2[1] = 0.035f;
v3[0] = -0.035f; v3[1] = 0.035f;
@@ -597,26 +597,26 @@ Batch *DRW_cache_single_arrow_get(void)
v3[0] = -v3[0];
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, sides * 3 + 0, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, sides * 3 + 1, v2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, sides * 3 + 2, v3);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, sides * 3 + 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, sides * 3 + 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, sides * 3 + 2, v3);
}
- SHC.drw_single_arrow = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_single_arrow = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_single_arrow;
}
-Batch *DRW_cache_empty_sphere_get(void)
+Gwn_Batch *DRW_cache_empty_sphere_get(void)
{
if (!SHC.drw_empty_sphere) {
- VertexBuffer *vbo = sphere_wire_vbo(1.0f);
- SHC.drw_empty_sphere = Batch_create(PRIM_LINES, vbo, NULL);
+ Gwn_VertBuf *vbo = sphere_wire_vbo(1.0f);
+ SHC.drw_empty_sphere = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_empty_sphere;
}
-Batch *DRW_cache_empty_cone_get(void)
+Gwn_Batch *DRW_cache_empty_cone_get(void)
{
#define NSEGMENTS 8
if (!SHC.drw_empty_cone) {
@@ -629,14 +629,14 @@ Batch *DRW_cache_empty_cone_get(void)
}
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, NSEGMENTS * 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, NSEGMENTS * 4);
for (int i = 0; i < NSEGMENTS; ++i) {
float cv[2], v[3];
@@ -645,152 +645,152 @@ Batch *DRW_cache_empty_cone_get(void)
/* cone sides */
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4, v);
v[0] = 0.0f, v[1] = 2.0f, v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 1, v);
/* end ring */
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 2, v);
cv[0] = p[(i + 1) % NSEGMENTS][0];
cv[1] = p[(i + 1) % NSEGMENTS][1];
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 3, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 3, v);
}
- SHC.drw_empty_cone = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_empty_cone = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_empty_cone;
#undef NSEGMENTS
}
-Batch *DRW_cache_arrows_get(void)
+Gwn_Batch *DRW_cache_arrows_get(void)
{
if (!SHC.drw_arrows) {
- VertexBuffer *vbo = fill_arrows_vbo(1.0f);
+ Gwn_VertBuf *vbo = fill_arrows_vbo(1.0f);
- SHC.drw_arrows = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_arrows = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_arrows;
}
-Batch *DRW_cache_axis_names_get(void)
+Gwn_Batch *DRW_cache_axis_names_get(void)
{
if (!SHC.drw_axis_names) {
const float size = 0.1f;
float v1[3], v2[3];
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* Using 3rd component as axis indicator */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Line */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 14);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 14);
/* X */
copy_v3_fl3(v1, -size, size, 0.0f);
copy_v3_fl3(v2, size, -size, 0.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 1, v2);
copy_v3_fl3(v1, size, size, 0.0f);
copy_v3_fl3(v2, -size, -size, 0.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 2, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 3, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 2, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 3, v2);
/* Y */
copy_v3_fl3(v1, -size + 0.25f * size, size, 1.0f);
copy_v3_fl3(v2, 0.0f, 0.0f, 1.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 4, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 5, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 4, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 5, v2);
copy_v3_fl3(v1, size - 0.25f * size, size, 1.0f);
copy_v3_fl3(v2, -size + 0.25f * size, -size, 1.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 6, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 7, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 6, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 7, v2);
/* Z */
copy_v3_fl3(v1, -size, size, 2.0f);
copy_v3_fl3(v2, size, size, 2.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 8, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 9, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 8, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 9, v2);
copy_v3_fl3(v1, size, size, 2.0f);
copy_v3_fl3(v2, -size, -size, 2.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 10, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 11, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 10, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 11, v2);
copy_v3_fl3(v1, -size, -size, 2.0f);
copy_v3_fl3(v2, size, -size, 2.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 12, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 13, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 12, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 13, v2);
- SHC.drw_axis_names = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_axis_names = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_axis_names;
}
-Batch *DRW_cache_image_plane_get(void)
+Gwn_Batch *DRW_cache_image_plane_get(void)
{
if (!SHC.drw_image_plane) {
const float quad[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, texCoords; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
- attr_id.texCoords = VertexFormat_add_attrib(&format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ attr_id.texCoords = GWN_vertformat_attr_add(&format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 4);
for (uint j = 0; j < 4; j++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, j, quad[j]);
- VertexBuffer_set_attrib(vbo, attr_id.texCoords, j, quad[j]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, j, quad[j]);
+ GWN_vertbuf_attr_set(vbo, attr_id.texCoords, j, quad[j]);
}
- SHC.drw_image_plane = Batch_create(PRIM_TRIANGLE_FAN, vbo, NULL);
+ SHC.drw_image_plane = GWN_batch_create(GWN_PRIM_TRI_FAN, vbo, NULL);
}
return SHC.drw_image_plane;
}
-Batch *DRW_cache_image_plane_wire_get(void)
+Gwn_Batch *DRW_cache_image_plane_wire_get(void)
{
if (!SHC.drw_image_plane_wire) {
const float quad[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 4);
for (uint j = 0; j < 4; j++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, j, quad[j]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, j, quad[j]);
}
- SHC.drw_image_plane_wire = Batch_create(PRIM_LINE_LOOP, vbo, NULL);
+ SHC.drw_image_plane_wire = GWN_batch_create(GWN_PRIM_LINE_LOOP, vbo, NULL);
}
return SHC.drw_image_plane_wire;
}
/* Force Field */
-Batch *DRW_cache_field_wind_get(void)
+Gwn_Batch *DRW_cache_field_wind_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_field_wind) {
float v[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 4);
for (int i = 0; i < 4; i++) {
float z = 0.05f * (float)i;
@@ -798,36 +798,36 @@ Batch *DRW_cache_field_wind_get(void)
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2 + 1, v);
}
}
- SHC.drw_field_wind = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_field_wind = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_field_wind;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_field_force_get(void)
+Gwn_Batch *DRW_cache_field_force_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_field_force) {
float v[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 3);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 3);
for (int i = 0; i < 3; i++) {
float radius = 1.0f + 0.5f * (float)i;
@@ -835,22 +835,22 @@ Batch *DRW_cache_field_force_get(void)
v[0] = radius * sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = radius * cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2, v);
v[0] = radius * sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = radius * cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2 + 1, v);
}
}
- SHC.drw_field_force = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_field_force = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_field_force;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_field_vortex_get(void)
+Gwn_Batch *DRW_cache_field_vortex_get(void)
{
#define SPIRAL_RESOL 32
if (!SHC.drw_field_vortex) {
@@ -858,36 +858,36 @@ Batch *DRW_cache_field_vortex_get(void)
unsigned int v_idx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, SPIRAL_RESOL * 2 + 1);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, SPIRAL_RESOL * 2 + 1);
for (int a = SPIRAL_RESOL; a > -1; a--) {
v[0] = sinf((2.0f * M_PI * a) / ((float)SPIRAL_RESOL)) * (a / (float)SPIRAL_RESOL);
v[1] = cosf((2.0f * M_PI * a) / ((float)SPIRAL_RESOL)) * (a / (float)SPIRAL_RESOL);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
for (int a = 1; a <= SPIRAL_RESOL; a++) {
v[0] = -sinf((2.0f * M_PI * a) / ((float)SPIRAL_RESOL)) * (a / (float)SPIRAL_RESOL);
v[1] = -cosf((2.0f * M_PI * a) / ((float)SPIRAL_RESOL)) * (a / (float)SPIRAL_RESOL);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
- SHC.drw_field_vortex = Batch_create(PRIM_LINE_STRIP, vbo, NULL);
+ SHC.drw_field_vortex = GWN_batch_create(GWN_PRIM_LINE_STRIP, vbo, NULL);
}
return SHC.drw_field_vortex;
#undef SPIRAL_RESOL
}
-Batch *DRW_cache_field_tube_limit_get(void)
+Gwn_Batch *DRW_cache_field_tube_limit_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_field_tube_limit) {
@@ -895,14 +895,14 @@ Batch *DRW_cache_field_tube_limit_get(void)
unsigned int v_idx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 2 + 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 2 + 8);
/* Caps */
for (int i = 0; i < 2; i++) {
@@ -911,12 +911,12 @@ Batch *DRW_cache_field_tube_limit_get(void)
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
}
/* Side Edges */
@@ -926,17 +926,17 @@ Batch *DRW_cache_field_tube_limit_get(void)
v[0] = sinf((2.0f * M_PI * a) / 4.0f);
v[1] = cosf((2.0f * M_PI * a) / 4.0f);
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
}
- SHC.drw_field_tube_limit = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_field_tube_limit = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_field_tube_limit;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_field_cone_limit_get(void)
+Gwn_Batch *DRW_cache_field_cone_limit_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_field_cone_limit) {
@@ -944,14 +944,14 @@ Batch *DRW_cache_field_cone_limit_get(void)
unsigned int v_idx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 2 + 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 2 + 8);
/* Caps */
for (int i = 0; i < 2; i++) {
@@ -960,12 +960,12 @@ Batch *DRW_cache_field_cone_limit_get(void)
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
}
/* Side Edges */
@@ -975,11 +975,11 @@ Batch *DRW_cache_field_cone_limit_get(void)
v[0] = z * sinf((2.0f * M_PI * a) / 4.0f);
v[1] = z * cosf((2.0f * M_PI * a) / 4.0f);
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
}
- SHC.drw_field_cone_limit = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_field_cone_limit = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_field_cone_limit;
#undef CIRCLE_RESOL
@@ -992,52 +992,52 @@ Batch *DRW_cache_field_cone_limit_get(void)
/** \name Lamps
* \{ */
-Batch *DRW_cache_lamp_get(void)
+Gwn_Batch *DRW_cache_lamp_get(void)
{
#define NSEGMENTS 8
if (!SHC.drw_lamp) {
float v[2];
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, NSEGMENTS * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, NSEGMENTS * 2);
for (int a = 0; a < NSEGMENTS; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)NSEGMENTS));
v[1] = cosf((2.0f * M_PI * a) / ((float)NSEGMENTS));
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)NSEGMENTS));
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)NSEGMENTS));
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2 + 1, v);
}
- SHC.drw_lamp = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp;
#undef NSEGMENTS
}
-Batch *DRW_cache_lamp_sunrays_get(void)
+Gwn_Batch *DRW_cache_lamp_sunrays_get(void)
{
if (!SHC.drw_lamp_sunrays) {
float v[2], v1[2], v2[2];
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 16);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 16);
for (int a = 0; a < 8; a++) {
v[0] = sinf((2.0f * M_PI * a) / 8.0f);
@@ -1046,50 +1046,50 @@ Batch *DRW_cache_lamp_sunrays_get(void)
mul_v2_v2fl(v1, v, 1.2f);
mul_v2_v2fl(v2, v, 2.5f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2 + 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2 + 1, v2);
}
- SHC.drw_lamp_sunrays = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_sunrays = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_sunrays;
}
-Batch *DRW_cache_lamp_area_get(void)
+Gwn_Batch *DRW_cache_lamp_area_get(void)
{
if (!SHC.drw_lamp_area) {
float v1[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 8);
v1[0] = v1[1] = 0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
v1[0] = -0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 1, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 2, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 1, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 2, v1);
v1[1] = -0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 3, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 4, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 3, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 4, v1);
v1[0] = 0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 5, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 6, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 5, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 6, v1);
v1[1] = 0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 7, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 7, v1);
- SHC.drw_lamp_area = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_area = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_area;
}
-Batch *DRW_cache_lamp_hemi_get(void)
+Gwn_Batch *DRW_cache_lamp_hemi_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_lamp_hemi) {
@@ -1097,26 +1097,26 @@ Batch *DRW_cache_lamp_hemi_get(void)
int vidx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 2 - 6 * 2 * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 2 - 6 * 2 * 2);
/* XZ plane */
for (int a = 3; a < CIRCLE_RESOL / 2 - 3; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL) - M_PI / 2);
v[2] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL) - M_PI / 2) - 1.0f;
v[1] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL) - M_PI / 2);
v[2] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL) - M_PI / 2) - 1.0f;
v[1] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
/* XY plane */
@@ -1124,12 +1124,12 @@ Batch *DRW_cache_lamp_hemi_get(void)
v[2] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL)) - 1.0f;
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[0] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
v[2] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL)) - 1.0f;
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[0] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
/* YZ plane full circle */
@@ -1138,22 +1138,22 @@ Batch *DRW_cache_lamp_hemi_get(void)
for (int a = 0; a < CIRCLE_RESOL; a++) {
v[1] = rad * sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[0] = rad * cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
v[1] = rad * sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[0] = rad * cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
- SHC.drw_lamp_hemi = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_hemi = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_hemi;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_lamp_spot_get(void)
+Gwn_Batch *DRW_cache_lamp_spot_get(void)
{
#define NSEGMENTS 32
if (!SHC.drw_lamp_spot) {
@@ -1175,16 +1175,16 @@ Batch *DRW_cache_lamp_spot_get(void)
}
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, NSEGMENTS * 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, NSEGMENTS * 4);
for (int i = 0; i < NSEGMENTS; ++i) {
float cv[2], v[3];
@@ -1193,36 +1193,36 @@ Batch *DRW_cache_lamp_spot_get(void)
/* cone sides */
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4, v);
v[0] = 0.0f, v[1] = 0.0f, v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 1, v);
- VertexBuffer_set_attrib(vbo, attr_id.n1, i * 4, n[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n1, i * 4 + 1, n[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n2, i * 4, n[(i+1) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n2, i * 4 + 1, n[(i+1) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, i * 4, n[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, i * 4 + 1, n[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, i * 4, n[(i+1) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, i * 4 + 1, n[(i+1) % NSEGMENTS]);
/* end ring */
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 2, v);
cv[0] = p[(i + 1) % NSEGMENTS][0];
cv[1] = p[(i + 1) % NSEGMENTS][1];
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 3, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 3, v);
- VertexBuffer_set_attrib(vbo, attr_id.n1, i * 4 + 2, n[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n1, i * 4 + 3, n[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n2, i * 4 + 2, neg[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n2, i * 4 + 3, neg[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, i * 4 + 2, n[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, i * 4 + 3, n[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, i * 4 + 2, neg[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, i * 4 + 3, neg[(i) % NSEGMENTS]);
}
- SHC.drw_lamp_spot = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_spot = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_spot;
#undef NSEGMENTS
}
-Batch *DRW_cache_lamp_spot_square_get(void)
+Gwn_Batch *DRW_cache_lamp_spot_square_get(void)
{
if (!SHC.drw_lamp_spot_square) {
float p[5][3] = {{ 0.0f, 0.0f, 0.0f},
@@ -1234,25 +1234,25 @@ Batch *DRW_cache_lamp_spot_square_get(void)
unsigned int v_idx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 16);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 16);
/* piramid sides */
for (int i = 1; i <= 4; ++i) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, p[0]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, p[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, p[(i % 4)+1]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, p[((i+1) % 4)+1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[(i % 4)+1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[((i+1) % 4)+1]);
}
- SHC.drw_lamp_spot_square = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_spot_square = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_spot_square;
}
@@ -1264,7 +1264,7 @@ Batch *DRW_cache_lamp_spot_square_get(void)
/** \name Speaker
* \{ */
-Batch *DRW_cache_speaker_get(void)
+Gwn_Batch *DRW_cache_speaker_get(void)
{
if (!SHC.drw_speaker) {
float v[3];
@@ -1272,30 +1272,30 @@ Batch *DRW_cache_speaker_get(void)
int vidx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 3 * segments * 2 + 4 * 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 3 * segments * 2 + 4 * 4);
for (int j = 0; j < 3; j++) {
float z = 0.25f * j - 0.125f;
float r = (j == 0 ? 0.5f : 0.25f);
copy_v3_fl3(v, r, 0.0f, z);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
for (int i = 1; i < segments; i++) {
float x = cosf(2.f * (float)M_PI * i / segments) * r;
float y = sinf(2.f * (float)M_PI * i / segments) * r;
copy_v3_fl3(v, x, y, z);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
copy_v3_fl3(v, r, 0.0f, z);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
for (int j = 0; j < 4; j++) {
@@ -1309,14 +1309,14 @@ Batch *DRW_cache_speaker_get(void)
float z = 0.25f * i - 0.125f;
copy_v3_fl3(v, x, y, z);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
if (i == 1) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
}
}
- SHC.drw_speaker = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_speaker = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_speaker;
}
@@ -1328,7 +1328,7 @@ Batch *DRW_cache_speaker_get(void)
/** \name Probe
* \{ */
-Batch *DRW_cache_lightprobe_get(void)
+Gwn_Batch *DRW_cache_lightprobe_get(void)
{
#define CIRCLE_RESOL 16
if (!SHC.drw_lightprobe) {
@@ -1337,39 +1337,39 @@ Batch *DRW_cache_lightprobe_get(void)
/* TODO something nicer than just a circle */
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 + 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 + 8);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
for (int a = 1; a < CIRCLE_RESOL; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
if ((a % 2 == 0) && (a % 4 != 0)) {
v[0] *= 0.5f;
v[1] *= 0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
v[0] *= 3.0f;
v[1] *= 3.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
v[0] /= 1.5f;
v[1] /= 1.5f;
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
v[0] = 0.0f;
v[1] = 1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
- SHC.drw_lightprobe = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lightprobe = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lightprobe;
#undef CIRCLE_RESOL
@@ -1429,52 +1429,52 @@ static const float bone_octahedral_solid_normals[8][3] = {
{ 0.00000000f, 0.11043154f, 0.99388373f}
};
-Batch *DRW_cache_bone_octahedral_get(void)
+Gwn_Batch *DRW_cache_bone_octahedral_get(void)
{
if (!SHC.drw_bone_octahedral) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 24);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 24);
for (int i = 0; i < 8; i++) {
- VertexBuffer_set_attrib(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]);
- VertexBuffer_set_attrib(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]);
- VertexBuffer_set_attrib(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][2]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][2]]);
}
- SHC.drw_bone_octahedral = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_bone_octahedral = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_bone_octahedral;
}
-Batch *DRW_cache_bone_octahedral_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_octahedral_wire_outline_get(void)
{
if (!SHC.drw_bone_octahedral_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 12 * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 12 * 2);
for (int i = 0; i < 12; i++) {
const float *co1 = bone_octahedral_verts[bone_octahedral_wire[i * 2]];
@@ -1484,7 +1484,7 @@ Batch *DRW_cache_bone_octahedral_wire_outline_get(void)
add_fancy_edge(vbo, attr_id.pos, attr_id.n1, attr_id.n2, &v_idx, co1, co2, n1, n2);
}
- SHC.drw_bone_octahedral_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_bone_octahedral_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_octahedral_wire;
}
@@ -1557,50 +1557,50 @@ static const float bone_box_solid_normals[12][3] = {
{ 0.0f, 1.0f, 0.0f},
};
-Batch *DRW_cache_bone_box_get(void)
+Gwn_Batch *DRW_cache_bone_box_get(void)
{
if (!SHC.drw_bone_box) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 36);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 36);
for (int i = 0; i < 12; i++) {
for (int j = 0; j < 3; j++) {
- VertexBuffer_set_attrib(vbo, attr_id.nor, v_idx, bone_box_solid_normals[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, bone_box_verts[bone_box_solid_tris[i][j]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, v_idx, bone_box_solid_normals[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, bone_box_verts[bone_box_solid_tris[i][j]]);
}
}
- SHC.drw_bone_box = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_bone_box = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_bone_box;
}
-Batch *DRW_cache_bone_box_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_box_wire_outline_get(void)
{
if (!SHC.drw_bone_box_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 12 * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 12 * 2);
for (int i = 0; i < 12; i++) {
const float *co1 = bone_box_verts[bone_box_wire[i * 2]];
@@ -1610,35 +1610,35 @@ Batch *DRW_cache_bone_box_wire_outline_get(void)
add_fancy_edge(vbo, attr_id.pos, attr_id.n1, attr_id.n2, &v_idx, co1, co2, n1, n2);
}
- SHC.drw_bone_box_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_bone_box_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_box_wire;
}
-Batch *DRW_cache_bone_wire_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_wire_wire_outline_get(void)
{
if (!SHC.drw_bone_wire_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 2);
const float co1[3] = {0.0f, 0.0f, 0.0f};
const float co2[3] = {0.0f, 1.0f, 0.0f};
const float n[3] = {1.0f, 0.0f, 0.0f};
add_fancy_edge(vbo, attr_id.pos, attr_id.n1, attr_id.n2, &v_idx, co1, co2, n, n);
- SHC.drw_bone_wire_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_bone_wire_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_wire_wire;
}
@@ -1654,25 +1654,25 @@ static void benv_lat_lon_to_co(const float lat, const float lon, float r_nor[3])
r_nor[2] = sinf(lat) * sinf(lon);
}
-static void benv_add_tri(VertexBuffer *vbo, uint pos_id, uint *v_idx, float *co1, float *co2, float *co3)
+static void benv_add_tri(Gwn_VertBuf *vbo, uint pos_id, uint *v_idx, float *co1, float *co2, float *co3)
{
/* Given tri and its seven other mirrors along X/Y/Z axes. */
for (int x = -1; x <= 1; x += 2) {
for (int y = -1; y <= 1; y += 2) {
const float head_tail = (y == -1) ? 0.0f : 1.0f;
for (int z = -1; z <= 1; z += 2) {
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++,
- (const float[4]){co1[0] * x, co1[1] * y, co1[2] * z, head_tail});
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++,
- (const float[4]){co2[0] * x, co2[1] * y, co2[2] * z, head_tail});
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++,
- (const float[4]){co3[0] * x, co3[1] * y, co3[2] * z, head_tail});
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++,
+ (const float[4]){co1[0] * x, co1[1] * y, co1[2] * z, head_tail});
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++,
+ (const float[4]){co2[0] * x, co2[1] * y, co2[2] * z, head_tail});
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++,
+ (const float[4]){co3[0] * x, co3[1] * y, co3[2] * z, head_tail});
}
}
}
}
-Batch *DRW_cache_bone_envelope_solid_get(void)
+Gwn_Batch *DRW_cache_bone_envelope_solid_get(void)
{
#define CIRCLE_RESOL 32 /* Must be multiple of 4 */
if (!SHC.drw_bone_envelope) {
@@ -1682,15 +1682,15 @@ Batch *DRW_cache_bone_envelope_solid_get(void)
const float lat_inc = M_PI_2 / lat_res;
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 4, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, lat_res * lon_res * 8 * 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, lat_res * lon_res * 8 * 6);
float lon = 0.0f;
for (int i = 0; i < lon_res; i++, lon += lon_inc) {
@@ -1713,44 +1713,44 @@ Batch *DRW_cache_bone_envelope_solid_get(void)
/* We need to add 'cylinder' part between the equators (along XZ plane). */
for (int x = -1; x <= 1; x += 2) {
for (int z = -1; z <= 1; z += 2) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co3[0] * x, co3[1], co3[2] * z, 0.0f});
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co4[0] * x, co4[1], co4[2] * z, 0.0f});
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co4[0] * x, co4[1], co4[2] * z, 1.0f});
-
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co3[0] * x, co3[1], co3[2] * z, 0.0f});
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co4[0] * x, co4[1], co4[2] * z, 1.0f});
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co3[0] * x, co3[1], co3[2] * z, 1.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co3[0] * x, co3[1], co3[2] * z, 0.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co4[0] * x, co4[1], co4[2] * z, 0.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co4[0] * x, co4[1], co4[2] * z, 1.0f});
+
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co3[0] * x, co3[1], co3[2] * z, 0.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co4[0] * x, co4[1], co4[2] * z, 1.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co3[0] * x, co3[1], co3[2] * z, 1.0f});
}
}
}
- SHC.drw_bone_envelope = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_bone_envelope = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_bone_envelope;
}
-Batch *DRW_cache_bone_envelope_distance_outline_get(void)
+Gwn_Batch *DRW_cache_bone_envelope_distance_outline_get(void)
{
#define CIRCLE_RESOL 32 /* Must be multiple of 2 */
if (!SHC.drw_bone_envelope_distance) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 4, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 + 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 + 6);
/* Encoded triangle strip, vertex shader gives them final correct value. */
for (int i = 0; i < CIRCLE_RESOL + 1; i++) {
@@ -1761,15 +1761,15 @@ Batch *DRW_cache_bone_envelope_distance_outline_get(void)
const float y = -sinf(alpha);
/* { X, Y, head/tail, inner/outer border } */
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){x, y, head_tail, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){x, y, head_tail, 1.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){x, y, head_tail, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){x, y, head_tail, 1.0f});
if (is_headtail_transition) {
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){x, y, 1.0f - head_tail, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){x, y, 1.0f - head_tail, 1.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){x, y, 1.0f - head_tail, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){x, y, 1.0f - head_tail, 1.0f});
}
}
- SHC.drw_bone_envelope_distance = Batch_create(PRIM_TRIANGLE_STRIP, vbo, NULL);
+ SHC.drw_bone_envelope_distance = GWN_batch_create(GWN_PRIM_TRI_STRIP, vbo, NULL);
}
return SHC.drw_bone_envelope_distance;
#undef CIRCLE_RESOL
@@ -1777,51 +1777,51 @@ Batch *DRW_cache_bone_envelope_distance_outline_get(void)
/* Bone body. */
-Batch *DRW_cache_bone_envelope_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_envelope_wire_outline_get(void)
{
if (!SHC.drw_bone_envelope_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 4, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 4);
/* Two lines between head and tail circles. */
/* Encoded lines, vertex shader gives them final correct value. */
/* { X, Y, head/tail, inner/outer border } */
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){ 1.0f, 0.0f, 0.0f, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){ 1.0f, 0.0f, 1.0f, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){-1.0f, 0.0f, 0.0f, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){-1.0f, 0.0f, 1.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){ 1.0f, 0.0f, 0.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){ 1.0f, 0.0f, 1.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){-1.0f, 0.0f, 0.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){-1.0f, 0.0f, 1.0f, 0.0f});
- SHC.drw_bone_envelope_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_bone_envelope_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_envelope_wire;
}
/* Bone head and tail. */
-Batch *DRW_cache_bone_envelope_head_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_envelope_head_wire_outline_get(void)
{
#define CIRCLE_RESOL 32 /* Must be multiple of 2 */
if (!SHC.drw_bone_envelope_head_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 4, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL);
/* Encoded lines, vertex shader gives them final correct value. */
/* Only head circle (tail is drawn in disp_tail_mat space as a head one by draw_armature.c's draw_point()). */
@@ -1831,17 +1831,17 @@ Batch *DRW_cache_bone_envelope_head_wire_outline_get(void)
const float y = -sinf(alpha);
/* { X, Y, head/tail, inner/outer border } */
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){ x, y, 0.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){ x, y, 0.0f, 0.0f});
}
- SHC.drw_bone_envelope_head_wire = Batch_create(PRIM_LINE_LOOP, vbo, NULL);
+ SHC.drw_bone_envelope_head_wire = GWN_batch_create(GWN_PRIM_LINE_LOOP, vbo, NULL);
}
return SHC.drw_bone_envelope_head_wire;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_bone_point_get(void)
+Gwn_Batch *DRW_cache_bone_point_get(void)
{
if (!SHC.drw_bone_point) {
const int lon_res = 16;
@@ -1851,16 +1851,16 @@ Batch *DRW_cache_bone_point_get(void)
const float lat_inc = M_PI / lat_res;
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, (lat_res - 1) * lon_res * 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, (lat_res - 1) * lon_res * 6);
float lon = 0.0f;
for (int i = 0; i < lon_res; i++, lon += lon_inc) {
@@ -1880,25 +1880,25 @@ Batch *DRW_cache_bone_point_get(void)
}
}
- SHC.drw_bone_point = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_bone_point = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_bone_point;
}
-Batch *DRW_cache_bone_point_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_point_wire_outline_get(void)
{
if (!SHC.drw_bone_point_wire) {
- VertexBuffer *vbo = sphere_wire_vbo(0.05f);
- SHC.drw_bone_point_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ Gwn_VertBuf *vbo = sphere_wire_vbo(0.05f);
+ SHC.drw_bone_point_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_point_wire;
}
-Batch *DRW_cache_bone_arrows_get(void)
+Gwn_Batch *DRW_cache_bone_arrows_get(void)
{
if (!SHC.drw_bone_arrows) {
- VertexBuffer *vbo = fill_arrows_vbo(0.25f);
- SHC.drw_bone_arrows = Batch_create(PRIM_LINES, vbo, NULL);
+ Gwn_VertBuf *vbo = fill_arrows_vbo(0.25f);
+ SHC.drw_bone_arrows = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_arrows;
}
@@ -1910,7 +1910,7 @@ Batch *DRW_cache_bone_arrows_get(void)
/** \name Camera
* \{ */
-Batch *DRW_cache_camera_get(void)
+Gwn_Batch *DRW_cache_camera_get(void)
{
if (!SHC.drw_camera) {
float v0 = 0.0f; /* Center point */
@@ -1923,60 +1923,60 @@ Batch *DRW_cache_camera_get(void)
float v7 = 7.0f; /* tria + Y */
int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* use x coordinate to identify the vertex
* the vertex shader take care to place it
* appropriatelly */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 1, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 22);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 22);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v0);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v0);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v0);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v0);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v0);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v3);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v0);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v3);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v0);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v4);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v0);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v4);
/* camera frame */
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v3);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v3);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v3);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v4);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v3);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v4);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v4);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v4);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v1);
/* tria */
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v5);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v6);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v5);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v6);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v6);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v7);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v6);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v7);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v7);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v5);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v7);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v5);
- SHC.drw_camera = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_camera = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_camera;
}
-Batch *DRW_cache_camera_tria_get(void)
+Gwn_Batch *DRW_cache_camera_tria_get(void)
{
if (!SHC.drw_camera_tria) {
float v5 = 5.0f; /* tria + X */
@@ -1984,25 +1984,25 @@ Batch *DRW_cache_camera_tria_get(void)
float v7 = 7.0f; /* tria + Y */
int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* use x coordinate to identify the vertex
* the vertex shader take care to place it
* appropriatelly */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 1, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6);
/* tria */
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v5);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v6);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v7);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v5);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v6);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v7);
- SHC.drw_camera_tria = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_camera_tria = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_camera_tria;
}
@@ -2015,24 +2015,24 @@ Batch *DRW_cache_camera_tria_get(void)
* \{ */
/* Object Center */
-Batch *DRW_cache_single_vert_get(void)
+Gwn_Batch *DRW_cache_single_vert_get(void)
{
if (!SHC.drw_single_vertice) {
float v1[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 1);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
- SHC.drw_single_vertice = Batch_create(PRIM_POINTS, vbo, NULL);
+ SHC.drw_single_vertice = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
}
return SHC.drw_single_vertice;
}
@@ -2044,7 +2044,7 @@ Batch *DRW_cache_single_vert_get(void)
/** \name Meshes
* \{ */
-Batch *DRW_cache_mesh_surface_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
Mesh *me = ob->data;
@@ -2053,7 +2053,7 @@ Batch *DRW_cache_mesh_surface_overlay_get(Object *ob)
void DRW_cache_mesh_wire_overlay_get(
Object *ob,
- Batch **r_tris, Batch **r_ledges, Batch **r_lverts)
+ Gwn_Batch **r_tris, Gwn_Batch **r_ledges, Gwn_Batch **r_lverts)
{
BLI_assert(ob->type == OB_MESH);
@@ -2066,7 +2066,7 @@ void DRW_cache_mesh_wire_overlay_get(
void DRW_cache_mesh_normals_overlay_get(
Object *ob,
- Batch **r_tris, Batch **r_ledges, Batch **r_lverts)
+ Gwn_Batch **r_tris, Gwn_Batch **r_ledges, Gwn_Batch **r_lverts)
{
BLI_assert(ob->type == OB_MESH);
@@ -2077,7 +2077,7 @@ void DRW_cache_mesh_normals_overlay_get(
*r_lverts = DRW_mesh_batch_cache_get_overlay_loose_verts(me);
}
-Batch *DRW_cache_face_centers_get(Object *ob)
+Gwn_Batch *DRW_cache_face_centers_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2086,7 +2086,7 @@ Batch *DRW_cache_face_centers_get(Object *ob)
return DRW_mesh_batch_cache_get_overlay_facedots(me);
}
-Batch *DRW_cache_mesh_wire_outline_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_wire_outline_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2094,7 +2094,7 @@ Batch *DRW_cache_mesh_wire_outline_get(Object *ob)
return DRW_mesh_batch_cache_get_fancy_edges(me);
}
-Batch *DRW_cache_mesh_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2102,7 +2102,7 @@ Batch *DRW_cache_mesh_surface_get(Object *ob)
return DRW_mesh_batch_cache_get_triangles_with_normals(me);
}
-Batch *DRW_cache_mesh_surface_weights_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_weights_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2110,7 +2110,7 @@ Batch *DRW_cache_mesh_surface_weights_get(Object *ob)
return DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(me, ob->actdef - 1);
}
-Batch *DRW_cache_mesh_surface_vert_colors_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_vert_colors_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2119,7 +2119,7 @@ Batch *DRW_cache_mesh_surface_vert_colors_get(Object *ob)
}
/* Return list of batches */
-Batch **DRW_cache_mesh_surface_shaded_get(Object *ob)
+Gwn_Batch **DRW_cache_mesh_surface_shaded_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2128,7 +2128,7 @@ Batch **DRW_cache_mesh_surface_shaded_get(Object *ob)
}
/* Return list of batches */
-Batch **DRW_cache_mesh_surface_texpaint_get(Object *ob)
+Gwn_Batch **DRW_cache_mesh_surface_texpaint_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2136,7 +2136,7 @@ Batch **DRW_cache_mesh_surface_texpaint_get(Object *ob)
return DRW_mesh_batch_cache_get_surface_texpaint(me);
}
-Batch *DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2144,7 +2144,7 @@ Batch *DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
return DRW_mesh_batch_cache_get_surface_texpaint_single(me);
}
-Batch *DRW_cache_mesh_surface_verts_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_verts_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2152,7 +2152,7 @@ Batch *DRW_cache_mesh_surface_verts_get(Object *ob)
return DRW_mesh_batch_cache_get_points_with_normals(me);
}
-Batch *DRW_cache_mesh_edges_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_edges_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2160,7 +2160,7 @@ Batch *DRW_cache_mesh_edges_get(Object *ob)
return DRW_mesh_batch_cache_get_all_edges(me);
}
-Batch *DRW_cache_mesh_verts_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_verts_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2168,7 +2168,7 @@ Batch *DRW_cache_mesh_verts_get(Object *ob)
return DRW_mesh_batch_cache_get_all_verts(me);
}
-Batch *DRW_cache_mesh_edges_paint_overlay_get(Object *ob, bool use_wire, bool use_sel)
+Gwn_Batch *DRW_cache_mesh_edges_paint_overlay_get(Object *ob, bool use_wire, bool use_sel)
{
BLI_assert(ob->type == OB_MESH);
@@ -2176,7 +2176,7 @@ Batch *DRW_cache_mesh_edges_paint_overlay_get(Object *ob, bool use_wire, bool us
return DRW_mesh_batch_cache_get_weight_overlay_edges(me, use_wire, use_sel);
}
-Batch *DRW_cache_mesh_faces_weight_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_faces_weight_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2184,7 +2184,7 @@ Batch *DRW_cache_mesh_faces_weight_overlay_get(Object *ob)
return DRW_mesh_batch_cache_get_weight_overlay_faces(me);
}
-Batch *DRW_cache_mesh_verts_weight_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_verts_weight_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2199,7 +2199,7 @@ Batch *DRW_cache_mesh_verts_weight_overlay_get(Object *ob)
/** \name Curve
* \{ */
-Batch *DRW_cache_curve_edge_wire_get(Object *ob)
+Gwn_Batch *DRW_cache_curve_edge_wire_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2207,7 +2207,7 @@ Batch *DRW_cache_curve_edge_wire_get(Object *ob)
return DRW_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
}
-Batch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
+Gwn_Batch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2215,7 +2215,7 @@ Batch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
return DRW_curve_batch_cache_get_normal_edge(cu, ob->curve_cache, normal_size);
}
-Batch *DRW_cache_curve_edge_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_curve_edge_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2223,7 +2223,7 @@ Batch *DRW_cache_curve_edge_overlay_get(Object *ob)
return DRW_curve_batch_cache_get_overlay_edges(cu);
}
-Batch *DRW_cache_curve_vert_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_curve_vert_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2231,7 +2231,7 @@ Batch *DRW_cache_curve_vert_overlay_get(Object *ob)
return DRW_curve_batch_cache_get_overlay_verts(cu);
}
-Batch *DRW_cache_curve_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_curve_surface_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2246,7 +2246,7 @@ Batch *DRW_cache_curve_surface_get(Object *ob)
/** \name Font
* \{ */
-Batch *DRW_cache_text_edge_wire_get(Object *ob)
+Gwn_Batch *DRW_cache_text_edge_wire_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
@@ -2254,7 +2254,7 @@ Batch *DRW_cache_text_edge_wire_get(Object *ob)
return DRW_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
}
-Batch *DRW_cache_text_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_text_surface_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
@@ -2264,14 +2264,14 @@ Batch *DRW_cache_text_surface_get(Object *ob)
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
}
-Batch *DRW_cache_text_cursor_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_text_cursor_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
return DRW_curve_batch_cache_get_overlay_cursor(cu);
}
-Batch *DRW_cache_text_select_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_text_select_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
@@ -2285,7 +2285,7 @@ Batch *DRW_cache_text_select_overlay_get(Object *ob)
/** \name Surface
* \{ */
-Batch *DRW_cache_surf_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_surf_surface_get(Object *ob)
{
BLI_assert(ob->type == OB_SURF);
@@ -2300,7 +2300,7 @@ Batch *DRW_cache_surf_surface_get(Object *ob)
/** \name Lattice
* \{ */
-Batch *DRW_cache_lattice_verts_get(Object *ob)
+Gwn_Batch *DRW_cache_lattice_verts_get(Object *ob)
{
BLI_assert(ob->type == OB_LATTICE);
@@ -2308,7 +2308,7 @@ Batch *DRW_cache_lattice_verts_get(Object *ob)
return DRW_lattice_batch_cache_get_all_verts(lt);
}
-Batch *DRW_cache_lattice_wire_get(Object *ob)
+Gwn_Batch *DRW_cache_lattice_wire_get(Object *ob)
{
BLI_assert(ob->type == OB_LATTICE);
@@ -2316,7 +2316,7 @@ Batch *DRW_cache_lattice_wire_get(Object *ob)
return DRW_lattice_batch_cache_get_all_edges(lt);
}
-Batch *DRW_cache_lattice_vert_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_lattice_vert_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_LATTICE);
@@ -2331,110 +2331,110 @@ Batch *DRW_cache_lattice_vert_overlay_get(Object *ob)
/** \name Particles
* \{ */
-Batch *DRW_cache_particles_get_hair(ParticleSystem *psys)
+Gwn_Batch *DRW_cache_particles_get_hair(ParticleSystem *psys)
{
return DRW_particles_batch_cache_get_hair(psys);
}
-Batch *DRW_cache_particles_get_dots(ParticleSystem *psys)
+Gwn_Batch *DRW_cache_particles_get_dots(ParticleSystem *psys)
{
return DRW_particles_batch_cache_get_dots(psys);
}
-Batch *DRW_cache_particles_get_prim(int type)
+Gwn_Batch *DRW_cache_particles_get_prim(int type)
{
switch (type) {
case PART_DRAW_CROSS:
if (!SHC.drw_particle_cross) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned pos_id, axis_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "inst_pos", COMP_F32, 3, KEEP_FLOAT);
- axis_id = VertexFormat_add_attrib(&format, "axis", COMP_I32, 1, KEEP_INT);
+ pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6);
/* X axis */
float co[3] = {-1.0f, 0.0f, 0.0f};
int axis = -1;
- VertexBuffer_set_attrib(vbo, pos_id, 0, co);
- VertexBuffer_set_attrib(vbo, axis_id, 0, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 0, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 0, &axis);
co[0] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 1, co);
- VertexBuffer_set_attrib(vbo, axis_id, 1, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 1, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 1, &axis);
/* Y axis */
co[0] = 0.0f;
co[1] = -1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 2, co);
- VertexBuffer_set_attrib(vbo, axis_id, 2, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 2, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 2, &axis);
co[1] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 3, co);
- VertexBuffer_set_attrib(vbo, axis_id, 3, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 3, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 3, &axis);
/* Z axis */
co[1] = 0.0f;
co[2] = -1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 4, co);
- VertexBuffer_set_attrib(vbo, axis_id, 4, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 4, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 4, &axis);
co[2] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 5, co);
- VertexBuffer_set_attrib(vbo, axis_id, 5, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 5, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 5, &axis);
- SHC.drw_particle_cross = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_particle_cross = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_particle_cross;
case PART_DRAW_AXIS:
if (!SHC.drw_particle_axis) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned pos_id, axis_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "inst_pos", COMP_F32, 3, KEEP_FLOAT);
- axis_id = VertexFormat_add_attrib(&format, "axis", COMP_I32, 1, KEEP_INT);
+ pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6);
/* X axis */
float co[3] = {0.0f, 0.0f, 0.0f};
int axis = 0;
- VertexBuffer_set_attrib(vbo, pos_id, 0, co);
- VertexBuffer_set_attrib(vbo, axis_id, 0, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 0, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 0, &axis);
co[0] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 1, co);
- VertexBuffer_set_attrib(vbo, axis_id, 1, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 1, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 1, &axis);
/* Y axis */
co[0] = 0.0f;
axis = 1;
- VertexBuffer_set_attrib(vbo, pos_id, 2, co);
- VertexBuffer_set_attrib(vbo, axis_id, 2, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 2, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 2, &axis);
co[1] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 3, co);
- VertexBuffer_set_attrib(vbo, axis_id, 3, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 3, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 3, &axis);
/* Z axis */
co[1] = 0.0f;
axis = 2;
- VertexBuffer_set_attrib(vbo, pos_id, 4, co);
- VertexBuffer_set_attrib(vbo, axis_id, 4, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 4, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 4, &axis);
co[2] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 5, co);
- VertexBuffer_set_attrib(vbo, axis_id, 5, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 5, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 5, &axis);
- SHC.drw_particle_axis = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_particle_axis = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_particle_axis;
@@ -2444,26 +2444,26 @@ Batch *DRW_cache_particles_get_prim(int type)
float v[3] = {0.0f, 0.0f, 0.0f};
int axis = -1;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned pos_id, axis_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "inst_pos", COMP_F32, 3, KEEP_FLOAT);
- axis_id = VertexFormat_add_attrib(&format, "axis", COMP_I32, 1, KEEP_INT);
+ pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL);
for (int a = 0; a < CIRCLE_RESOL; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, pos_id, a, v);
- VertexBuffer_set_attrib(vbo, axis_id, a, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, a, v);
+ GWN_vertbuf_attr_set(vbo, axis_id, a, &axis);
}
- SHC.drw_particle_circle = Batch_create(PRIM_LINE_LOOP, vbo, NULL);
+ SHC.drw_particle_circle = GWN_batch_create(GWN_PRIM_LINE_LOOP, vbo, NULL);
}
return SHC.drw_particle_circle;
diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h
index f28eca46099..a4fac3fe71f 100644
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@ -26,126 +26,126 @@
#ifndef __DRAW_CACHE_H__
#define __DRAW_CACHE_H__
-struct Batch;
+struct Gwn_Batch;
struct Object;
void DRW_shape_cache_free(void);
/* Common Shapes */
-struct Batch *DRW_cache_fullscreen_quad_get(void);
-struct Batch *DRW_cache_sphere_get(void);
-struct Batch *DRW_cache_single_vert_get(void);
-struct Batch *DRW_cache_single_line_get(void);
-struct Batch *DRW_cache_single_line_endpoints_get(void);
-struct Batch *DRW_cache_screenspace_circle_get(void);
+struct Gwn_Batch *DRW_cache_fullscreen_quad_get(void);
+struct Gwn_Batch *DRW_cache_sphere_get(void);
+struct Gwn_Batch *DRW_cache_single_vert_get(void);
+struct Gwn_Batch *DRW_cache_single_line_get(void);
+struct Gwn_Batch *DRW_cache_single_line_endpoints_get(void);
+struct Gwn_Batch *DRW_cache_screenspace_circle_get(void);
/* Common Object */
-struct Batch *DRW_cache_object_wire_outline_get(struct Object *ob);
-struct Batch *DRW_cache_object_surface_get(struct Object *ob);
-struct Batch **DRW_cache_object_surface_material_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_object_wire_outline_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_object_surface_get(struct Object *ob);
+struct Gwn_Batch **DRW_cache_object_surface_material_get(struct Object *ob);
/* Empties */
-struct Batch *DRW_cache_plain_axes_get(void);
-struct Batch *DRW_cache_single_arrow_get(void);
-struct Batch *DRW_cache_cube_get(void);
-struct Batch *DRW_cache_circle_get(void);
-struct Batch *DRW_cache_square_get(void);
-struct Batch *DRW_cache_empty_sphere_get(void);
-struct Batch *DRW_cache_empty_cone_get(void);
-struct Batch *DRW_cache_arrows_get(void);
-struct Batch *DRW_cache_axis_names_get(void);
-struct Batch *DRW_cache_image_plane_get(void);
-struct Batch *DRW_cache_image_plane_wire_get(void);
+struct Gwn_Batch *DRW_cache_plain_axes_get(void);
+struct Gwn_Batch *DRW_cache_single_arrow_get(void);
+struct Gwn_Batch *DRW_cache_cube_get(void);
+struct Gwn_Batch *DRW_cache_circle_get(void);
+struct Gwn_Batch *DRW_cache_square_get(void);
+struct Gwn_Batch *DRW_cache_empty_sphere_get(void);
+struct Gwn_Batch *DRW_cache_empty_cone_get(void);
+struct Gwn_Batch *DRW_cache_arrows_get(void);
+struct Gwn_Batch *DRW_cache_axis_names_get(void);
+struct Gwn_Batch *DRW_cache_image_plane_get(void);
+struct Gwn_Batch *DRW_cache_image_plane_wire_get(void);
/* Force Field */
-struct Batch *DRW_cache_field_wind_get(void);
-struct Batch *DRW_cache_field_force_get(void);
-struct Batch *DRW_cache_field_vortex_get(void);
-struct Batch *DRW_cache_field_tube_limit_get(void);
-struct Batch *DRW_cache_field_cone_limit_get(void);
+struct Gwn_Batch *DRW_cache_field_wind_get(void);
+struct Gwn_Batch *DRW_cache_field_force_get(void);
+struct Gwn_Batch *DRW_cache_field_vortex_get(void);
+struct Gwn_Batch *DRW_cache_field_tube_limit_get(void);
+struct Gwn_Batch *DRW_cache_field_cone_limit_get(void);
/* Lamps */
-struct Batch *DRW_cache_lamp_get(void);
-struct Batch *DRW_cache_lamp_sunrays_get(void);
-struct Batch *DRW_cache_lamp_area_get(void);
-struct Batch *DRW_cache_lamp_hemi_get(void);
-struct Batch *DRW_cache_lamp_spot_get(void);
-struct Batch *DRW_cache_lamp_spot_square_get(void);
+struct Gwn_Batch *DRW_cache_lamp_get(void);
+struct Gwn_Batch *DRW_cache_lamp_sunrays_get(void);
+struct Gwn_Batch *DRW_cache_lamp_area_get(void);
+struct Gwn_Batch *DRW_cache_lamp_hemi_get(void);
+struct Gwn_Batch *DRW_cache_lamp_spot_get(void);
+struct Gwn_Batch *DRW_cache_lamp_spot_square_get(void);
/* Camera */
-struct Batch *DRW_cache_camera_get(void);
-struct Batch *DRW_cache_camera_tria_get(void);
+struct Gwn_Batch *DRW_cache_camera_get(void);
+struct Gwn_Batch *DRW_cache_camera_tria_get(void);
/* Speaker */
-struct Batch *DRW_cache_speaker_get(void);
+struct Gwn_Batch *DRW_cache_speaker_get(void);
/* Probe */
-struct Batch *DRW_cache_lightprobe_get(void);
+struct Gwn_Batch *DRW_cache_lightprobe_get(void);
/* Bones */
-struct Batch *DRW_cache_bone_octahedral_get(void);
-struct Batch *DRW_cache_bone_octahedral_wire_outline_get(void);
-struct Batch *DRW_cache_bone_box_get(void);
-struct Batch *DRW_cache_bone_box_wire_outline_get(void);
-struct Batch *DRW_cache_bone_wire_wire_outline_get(void);
-struct Batch *DRW_cache_bone_envelope_solid_get(void);
-struct Batch *DRW_cache_bone_envelope_distance_outline_get(void);
-struct Batch *DRW_cache_bone_envelope_wire_outline_get(void);
-struct Batch *DRW_cache_bone_envelope_head_wire_outline_get(void);
-struct Batch *DRW_cache_bone_point_get(void);
-struct Batch *DRW_cache_bone_point_wire_outline_get(void);
-struct Batch *DRW_cache_bone_arrows_get(void);
+struct Gwn_Batch *DRW_cache_bone_octahedral_get(void);
+struct Gwn_Batch *DRW_cache_bone_octahedral_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_box_get(void);
+struct Gwn_Batch *DRW_cache_bone_box_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_wire_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_envelope_solid_get(void);
+struct Gwn_Batch *DRW_cache_bone_envelope_distance_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_envelope_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_envelope_head_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_point_get(void);
+struct Gwn_Batch *DRW_cache_bone_point_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_arrows_get(void);
/* Meshes */
-struct Batch *DRW_cache_mesh_surface_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_overlay_get(struct Object *ob);
void DRW_cache_mesh_wire_overlay_get(
struct Object *ob,
- struct Batch **r_tris, struct Batch **r_ledges, struct Batch **r_lverts);
+ struct Gwn_Batch **r_tris, struct Gwn_Batch **r_ledges, struct Gwn_Batch **r_lverts);
void DRW_cache_mesh_normals_overlay_get(
struct Object *ob,
- struct Batch **r_tris, struct Batch **r_ledges, struct Batch **r_lverts);
-struct Batch *DRW_cache_face_centers_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_wire_outline_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_weights_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_vert_colors_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_verts_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_edges_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_verts_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_edges_paint_overlay_get(struct Object *ob, bool use_wire, bool use_sel);
-struct Batch *DRW_cache_mesh_faces_weight_overlay_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_verts_weight_overlay_get(struct Object *ob);
-struct Batch **DRW_cache_mesh_surface_shaded_get(struct Object *ob);
-struct Batch **DRW_cache_mesh_surface_texpaint_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_texpaint_single_get(struct Object *ob);
+ struct Gwn_Batch **r_tris, struct Gwn_Batch **r_ledges, struct Gwn_Batch **r_lverts);
+struct Gwn_Batch *DRW_cache_face_centers_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_wire_outline_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_weights_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_vert_colors_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_verts_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_edges_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_verts_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_edges_paint_overlay_get(struct Object *ob, bool use_wire, bool use_sel);
+struct Gwn_Batch *DRW_cache_mesh_faces_weight_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_verts_weight_overlay_get(struct Object *ob);
+struct Gwn_Batch **DRW_cache_mesh_surface_shaded_get(struct Object *ob);
+struct Gwn_Batch **DRW_cache_mesh_surface_texpaint_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_texpaint_single_get(struct Object *ob);
/* Curve */
-struct Batch *DRW_cache_curve_surface_get(struct Object *ob);
-struct Batch *DRW_cache_curve_surface_verts_get(struct Object *ob);
-struct Batch *DRW_cache_curve_edge_wire_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_surface_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_surface_verts_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_edge_wire_get(struct Object *ob);
/* edit-mode */
-struct Batch *DRW_cache_curve_edge_normal_get(struct Object *ob, float normal_size);
-struct Batch *DRW_cache_curve_edge_overlay_get(struct Object *ob);
-struct Batch *DRW_cache_curve_vert_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_edge_normal_get(struct Object *ob, float normal_size);
+struct Gwn_Batch *DRW_cache_curve_edge_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_vert_overlay_get(struct Object *ob);
/* Font */
-struct Batch *DRW_cache_text_edge_wire_get(struct Object *ob);
-struct Batch *DRW_cache_text_surface_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_text_edge_wire_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_text_surface_get(struct Object *ob);
/* edit-mode */
-struct Batch *DRW_cache_text_cursor_overlay_get(struct Object *ob);
-struct Batch *DRW_cache_text_select_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_text_cursor_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_text_select_overlay_get(struct Object *ob);
/* Surface */
-struct Batch *DRW_cache_surf_surface_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_surf_surface_get(struct Object *ob);
/* Lattice */
-struct Batch *DRW_cache_lattice_verts_get(struct Object *ob);
-struct Batch *DRW_cache_lattice_wire_get(struct Object *ob);
-struct Batch *DRW_cache_lattice_vert_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_lattice_verts_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_lattice_wire_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_lattice_vert_overlay_get(struct Object *ob);
/* Particles */
-struct Batch *DRW_cache_particles_get_hair(struct ParticleSystem *psys);
-struct Batch *DRW_cache_particles_get_dots(struct ParticleSystem *psys);
-struct Batch *DRW_cache_particles_get_prim(int type);
+struct Gwn_Batch *DRW_cache_particles_get_hair(struct ParticleSystem *psys);
+struct Gwn_Batch *DRW_cache_particles_get_dots(struct ParticleSystem *psys);
+struct Gwn_Batch *DRW_cache_particles_get_prim(int type);
#endif /* __DRAW_CACHE_H__ */
diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h
index bfb61199674..066ca9f60e0 100644
--- a/source/blender/draw/intern/draw_cache_impl.h
+++ b/source/blender/draw/intern/draw_cache_impl.h
@@ -26,7 +26,7 @@
#ifndef __DRAW_CACHE_IMPL_H__
#define __DRAW_CACHE_IMPL_H__
-struct Batch;
+struct Gwn_Batch;
struct ListBase;
struct CurveCache;
struct ParticleSystem;
@@ -49,52 +49,52 @@ void DRW_particle_batch_cache_dirty(struct ParticleSystem *psys, int mode);
void DRW_particle_batch_cache_free(struct ParticleSystem *psys);
/* Curve */
-struct Batch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu, struct CurveCache *ob_curve_cache);
-struct Batch *DRW_curve_batch_cache_get_normal_edge(
+struct Gwn_Batch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu, struct CurveCache *ob_curve_cache);
+struct Gwn_Batch *DRW_curve_batch_cache_get_normal_edge(
struct Curve *cu, struct CurveCache *ob_curve_cache, float normal_size);
-struct Batch *DRW_curve_batch_cache_get_overlay_edges(struct Curve *cu);
-struct Batch *DRW_curve_batch_cache_get_overlay_verts(struct Curve *cu);
+struct Gwn_Batch *DRW_curve_batch_cache_get_overlay_edges(struct Curve *cu);
+struct Gwn_Batch *DRW_curve_batch_cache_get_overlay_verts(struct Curve *cu);
-struct Batch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu, struct CurveCache *ob_curve_cache);
+struct Gwn_Batch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu, struct CurveCache *ob_curve_cache);
/* Curve (Font) */
-struct Batch *DRW_curve_batch_cache_get_overlay_cursor(struct Curve *cu);
-struct Batch *DRW_curve_batch_cache_get_overlay_select(struct Curve *cu);
+struct Gwn_Batch *DRW_curve_batch_cache_get_overlay_cursor(struct Curve *cu);
+struct Gwn_Batch *DRW_curve_batch_cache_get_overlay_select(struct Curve *cu);
/* DispList */
-struct Batch *BLI_displist_batch_calc_surface(struct ListBase *lb);
+struct Gwn_Batch *BLI_displist_batch_calc_surface(struct ListBase *lb);
/* Lattice */
-struct Batch *DRW_lattice_batch_cache_get_all_edges(struct Lattice *lt);
-struct Batch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt);
-struct Batch *DRW_lattice_batch_cache_get_overlay_verts(struct Lattice *lt);
+struct Gwn_Batch *DRW_lattice_batch_cache_get_all_edges(struct Lattice *lt);
+struct Gwn_Batch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt);
+struct Gwn_Batch *DRW_lattice_batch_cache_get_overlay_verts(struct Lattice *lt);
/* Mesh */
-struct Batch **DRW_mesh_batch_cache_get_surface_shaded(struct Mesh *me);
-struct Batch **DRW_mesh_batch_cache_get_surface_texpaint(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(struct Mesh *me, bool use_wire, bool use_sel);
-struct Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_all_triangles(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(struct Mesh *me, int defgroup);
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide);
-struct Batch *DRW_mesh_batch_cache_get_points_with_normals(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_fancy_edges(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_triangles(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_facedots(struct Mesh *me);
+struct Gwn_Batch **DRW_mesh_batch_cache_get_surface_shaded(struct Mesh *me);
+struct Gwn_Batch **DRW_mesh_batch_cache_get_surface_texpaint(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(struct Mesh *me, bool use_wire, bool use_sel);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_all_triangles(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(struct Mesh *me, int defgroup);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_points_with_normals(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_fancy_edges(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_triangles(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_facedots(struct Mesh *me);
/* Particles */
-struct Batch *DRW_particles_batch_cache_get_hair(struct ParticleSystem *psys);
-struct Batch *DRW_particles_batch_cache_get_dots(struct ParticleSystem *psys);
+struct Gwn_Batch *DRW_particles_batch_cache_get_hair(struct ParticleSystem *psys);
+struct Gwn_Batch *DRW_particles_batch_cache_get_dots(struct ParticleSystem *psys);
#endif /* __DRAW_CACHE_IMPL_H__ */
diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c
index 3fbee0d7c2a..9ff9fab4c64 100644
--- a/source/blender/draw/intern/draw_cache_impl_curve.c
+++ b/source/blender/draw/intern/draw_cache_impl_curve.c
@@ -284,39 +284,39 @@ enum {
};
/* ---------------------------------------------------------------------- */
-/* Curve Batch Cache */
+/* Curve Gwn_Batch Cache */
typedef struct CurveBatchCache {
/* center-line */
struct {
- VertexBuffer *verts;
- VertexBuffer *edges;
- Batch *batch;
- ElementList *elem;
+ Gwn_VertBuf *verts;
+ Gwn_VertBuf *edges;
+ Gwn_Batch *batch;
+ Gwn_IndexBuf *elem;
} wire;
/* normals */
struct {
- VertexBuffer *verts;
- VertexBuffer *edges;
- Batch *batch;
- ElementList *elem;
+ Gwn_VertBuf *verts;
+ Gwn_VertBuf *edges;
+ Gwn_Batch *batch;
+ Gwn_IndexBuf *elem;
} normal;
/* control handles and vertices */
struct {
- Batch *edges;
- Batch *verts;
+ Gwn_Batch *edges;
+ Gwn_Batch *verts;
} overlay;
struct {
- Batch *batch;
+ Gwn_Batch *batch;
} surface;
/* 3d text */
struct {
- Batch *select;
- Batch *cursor;
+ Gwn_Batch *select;
+ Gwn_Batch *cursor;
} text;
/* settings to determine if cache is invalid */
@@ -330,7 +330,7 @@ typedef struct CurveBatchCache {
bool is_editmode;
} CurveBatchCache;
-/* Batch cache management. */
+/* Gwn_Batch cache management. */
static bool curve_batch_cache_valid(Curve *cu)
{
@@ -453,9 +453,9 @@ static void curve_batch_cache_clear(Curve *cu)
cache->wire.elem = NULL;
}
else {
- VERTEXBUFFER_DISCARD_SAFE(cache->wire.verts);
- VERTEXBUFFER_DISCARD_SAFE(cache->wire.edges);
- ELEMENTLIST_DISCARD_SAFE(cache->wire.elem);
+ GWN_VERTBUF_DISCARD_SAFE(cache->wire.verts);
+ GWN_VERTBUF_DISCARD_SAFE(cache->wire.edges);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->wire.elem);
}
if (cache->normal.batch) {
@@ -465,9 +465,9 @@ static void curve_batch_cache_clear(Curve *cu)
cache->normal.elem = NULL;
}
else {
- VERTEXBUFFER_DISCARD_SAFE(cache->normal.verts);
- VERTEXBUFFER_DISCARD_SAFE(cache->normal.edges);
- ELEMENTLIST_DISCARD_SAFE(cache->normal.elem);
+ GWN_VERTBUF_DISCARD_SAFE(cache->normal.verts);
+ GWN_VERTBUF_DISCARD_SAFE(cache->normal.edges);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->normal.elem);
}
/* 3d text */
@@ -486,30 +486,30 @@ void DRW_curve_batch_cache_free(Curve *cu)
/** \name Private Curve Cache API
* \{ */
-/* Batch cache usage. */
-static VertexBuffer *curve_batch_cache_get_wire_verts(CurveRenderData *rdata, CurveBatchCache *cache)
+/* Gwn_Batch cache usage. */
+static Gwn_VertBuf *curve_batch_cache_get_wire_verts(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_WIRE);
BLI_assert(rdata->ob_curve_cache != NULL);
if (cache->wire.verts == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int vert_len = curve_render_data_wire_verts_len_get(rdata);
- VertexBuffer *vbo = cache->wire.verts = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vert_len);
+ Gwn_VertBuf *vbo = cache->wire.verts = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vert_len);
int vbo_len_used = 0;
for (const BevList *bl = rdata->ob_curve_cache->bev.first; bl; bl = bl->next) {
if (bl->nr > 0) {
const int i_end = vbo_len_used + bl->nr;
for (const BevPoint *bevp = bl->bevpoints; vbo_len_used < i_end; vbo_len_used++, bevp++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bevp->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bevp->vec);
}
}
}
@@ -519,7 +519,7 @@ static VertexBuffer *curve_batch_cache_get_wire_verts(CurveRenderData *rdata, Cu
return cache->wire.verts;
}
-static ElementList *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_IndexBuf *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_WIRE);
BLI_assert(rdata->ob_curve_cache != NULL);
@@ -529,8 +529,8 @@ static ElementList *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, Cur
const int edge_len = curve_render_data_wire_edges_len_get(rdata);
int edge_len_used = 0;
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, edge_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, edge_len, vert_len);
int i = 0;
for (const BevList *bl = rdata->ob_curve_cache->bev.first; bl; bl = bl->next) {
@@ -546,7 +546,7 @@ static ElementList *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, Cur
i += 1;
}
for (; i < i_end; i_prev = i++) {
- add_line_vertices(&elb, i_prev, i);
+ GWN_indexbuf_add_line_verts(&elb, i_prev, i);
edge_len_used += 1;
}
}
@@ -559,30 +559,30 @@ static ElementList *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, Cur
BLI_assert(edge_len_used == edge_len);
}
- cache->wire.elem = ElementList_build(&elb);
+ cache->wire.elem = GWN_indexbuf_build(&elb);
}
return cache->wire.elem;
}
-static VertexBuffer *curve_batch_cache_get_normal_verts(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_VertBuf *curve_batch_cache_get_normal_verts(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_NORMAL);
BLI_assert(rdata->ob_curve_cache != NULL);
if (cache->normal.verts == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int normal_len = curve_render_data_normal_len_get(rdata);
const int vert_len = normal_len * 3;
- VertexBuffer *vbo = cache->normal.verts = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vert_len);
+ Gwn_VertBuf *vbo = cache->normal.verts = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vert_len);
int vbo_len_used = 0;
const BevList *bl;
@@ -614,9 +614,9 @@ static VertexBuffer *curve_batch_cache_get_normal_verts(CurveRenderData *rdata,
add_v3_v3(vec_a, bevp->vec);
add_v3_v3(vec_b, bevp->vec);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, vec_a);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, bevp->vec);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, vec_b);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, vec_a);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, bevp->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, vec_b);
bevp += skip + 1;
nr -= skip;
@@ -628,7 +628,7 @@ static VertexBuffer *curve_batch_cache_get_normal_verts(CurveRenderData *rdata,
return cache->normal.verts;
}
-static ElementList *curve_batch_cache_get_normal_edges(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_IndexBuf *curve_batch_cache_get_normal_edges(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_NORMAL);
BLI_assert(rdata->ob_curve_cache != NULL);
@@ -638,19 +638,19 @@ static ElementList *curve_batch_cache_get_normal_edges(CurveRenderData *rdata, C
const int vert_len = normal_len * 3;
const int edge_len = normal_len * 2;
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, edge_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, edge_len, vert_len);
int vbo_len_used = 0;
for (int i = 0; i < normal_len; i++) {
- add_line_vertices(&elb, vbo_len_used + 0, vbo_len_used + 1);
- add_line_vertices(&elb, vbo_len_used + 1, vbo_len_used + 2);
+ GWN_indexbuf_add_line_verts(&elb, vbo_len_used + 0, vbo_len_used + 1);
+ GWN_indexbuf_add_line_verts(&elb, vbo_len_used + 1, vbo_len_used + 2);
vbo_len_used += 3;
}
BLI_assert(vbo_len_used == vert_len);
- cache->normal.elem = ElementList_build(&elb);
+ cache->normal.elem = GWN_indexbuf_build(&elb);
}
return cache->normal.elem;
@@ -665,18 +665,18 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
CurveRenderData *rdata = curve_render_data_create(cu, NULL, options);
if (cache->overlay.verts == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, data; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_U8, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = curve_render_data_overlay_verts_len_get(rdata);
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
int i = 0;
for (Nurb *nu = rdata->nurbs->first; nu; nu = nu->next) {
if (nu->bezt) {
@@ -689,16 +689,16 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
if (rdata->hide_handles) {
vflag = (bezt->f2 & SELECT) ?
(is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[1]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
else {
for (int j = 0; j < 3; j++) {
vflag = ((&bezt->f1)[j] & SELECT) ?
(is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[j]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[j]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
}
@@ -713,8 +713,8 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
const bool is_active = (i == rdata->actvert);
char vflag;
vflag = (bp->f1 & SELECT) ? (is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bp->vec);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bp->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
i += 1;
@@ -723,29 +723,29 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
i += nu->pntsu;
}
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
- cache->overlay.verts = Batch_create(PRIM_POINTS, vbo, NULL);
+ cache->overlay.verts = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
}
if ((cache->overlay.edges == NULL) && (rdata->hide_handles == false)) {
/* Note: we could reference indices to vertices (above) */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, data; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_U8, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
const int edge_len = curve_render_data_overlay_edges_len_get(rdata);
const int vbo_len_capacity = edge_len * 2;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
int i = 0;
for (Nurb *nu = rdata->nurbs->first; nu; nu = nu->next) {
if (nu->bezt) {
@@ -756,22 +756,22 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
char vflag;
vflag = (bezt->f1 & SELECT) ? (is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[0]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
/* same vertex twice, only check different selection */
for (int j = 0; j < 2; j++) {
vflag = ((j ? bezt->f3 : bezt->f1) & SELECT) ?
(is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[1]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
vflag = (bezt->f3 & SELECT) ? (is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[2]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
i += 1;
@@ -783,11 +783,11 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
if ((bp_prev->hide == false) && (bp_curr->hide == false)) {
char vflag;
vflag = ((bp_prev->f1 & SELECT) && (bp_curr->f1 & SELECT)) ? VFLAG_VERTEX_SELECTED : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bp_prev->vec);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bp_prev->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bp_curr->vec);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bp_curr->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
@@ -795,16 +795,16 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
}
}
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
- cache->overlay.edges = Batch_create(PRIM_LINES, vbo, NULL);
+ cache->overlay.edges = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
curve_render_data_free(rdata);
}
-static Batch *curve_batch_cache_get_pos_and_normals(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_Batch *curve_batch_cache_get_pos_and_normals(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_SURFACE);
if (cache->surface.batch == NULL) {
@@ -822,21 +822,21 @@ static Batch *curve_batch_cache_get_pos_and_normals(CurveRenderData *rdata, Curv
* \{ */
-static Batch *curve_batch_cache_get_overlay_select(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_Batch *curve_batch_cache_get_overlay_select(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_TEXT_SELECT);
if (cache->text.select == NULL) {
EditFont *ef = rdata->text.edit_font;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = ef->selboxes_len * 6;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
float box[4][3];
@@ -883,37 +883,37 @@ static Batch *curve_batch_cache_get_overlay_select(CurveRenderData *rdata, Curve
add_v2_v2(box[3], &sb->x);
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[0]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[1]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[2]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[0]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[2]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[3]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[3]);
}
BLI_assert(vbo_len_used == vbo_len_capacity);
- cache->text.select = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ cache->text.select = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return cache->text.select;
}
-static Batch *curve_batch_cache_get_overlay_cursor(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_Batch *curve_batch_cache_get_overlay_cursor(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_TEXT_SELECT);
if (cache->text.cursor == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = 4;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < 4; i++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, rdata->text.edit_font->textcurs[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, rdata->text.edit_font->textcurs[i]);
}
- cache->text.cursor = Batch_create(PRIM_TRIANGLE_FAN, vbo, NULL);
+ cache->text.cursor = GWN_batch_create(GWN_PRIM_TRI_FAN, vbo, NULL);
}
return cache->text.cursor;
}
@@ -925,7 +925,7 @@ static Batch *curve_batch_cache_get_overlay_cursor(CurveRenderData *rdata, Curve
/** \name Public Object/Curve API
* \{ */
-Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache)
+Gwn_Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -933,8 +933,8 @@ Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache
/* create batch from Curve */
CurveRenderData *rdata = curve_render_data_create(cu, ob_curve_cache, CU_DATATYPE_WIRE);
- cache->wire.batch = Batch_create(
- PRIM_LINES,
+ cache->wire.batch = GWN_batch_create(
+ GWN_PRIM_LINES,
curve_batch_cache_get_wire_verts(rdata, cache),
curve_batch_cache_get_wire_edges(rdata, cache));
@@ -943,7 +943,7 @@ Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache
return cache->wire.batch;
}
-Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cache, float normal_size)
+Gwn_Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cache, float normal_size)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -959,8 +959,8 @@ Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cac
/* create batch from Curve */
CurveRenderData *rdata = curve_render_data_create(cu, ob_curve_cache, CU_DATATYPE_NORMAL);
- cache->normal.batch = Batch_create(
- PRIM_LINES,
+ cache->normal.batch = GWN_batch_create(
+ GWN_PRIM_LINES,
curve_batch_cache_get_normal_verts(rdata, cache),
curve_batch_cache_get_normal_edges(rdata, cache));
@@ -970,7 +970,7 @@ Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cac
return cache->normal.batch;
}
-Batch *DRW_curve_batch_cache_get_overlay_edges(Curve *cu)
+Gwn_Batch *DRW_curve_batch_cache_get_overlay_edges(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -981,7 +981,7 @@ Batch *DRW_curve_batch_cache_get_overlay_edges(Curve *cu)
return cache->overlay.edges;
}
-Batch *DRW_curve_batch_cache_get_overlay_verts(Curve *cu)
+Gwn_Batch *DRW_curve_batch_cache_get_overlay_verts(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -992,7 +992,7 @@ Batch *DRW_curve_batch_cache_get_overlay_verts(Curve *cu)
return cache->overlay.verts;
}
-Batch *DRW_curve_batch_cache_get_triangles_with_normals(
+Gwn_Batch *DRW_curve_batch_cache_get_triangles_with_normals(
struct Curve *cu, struct CurveCache *ob_curve_cache)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -1014,7 +1014,7 @@ Batch *DRW_curve_batch_cache_get_triangles_with_normals(
/** \name Public Object/Font API
* \{ */
-Batch *DRW_curve_batch_cache_get_overlay_select(Curve *cu)
+Gwn_Batch *DRW_curve_batch_cache_get_overlay_select(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -1029,7 +1029,7 @@ Batch *DRW_curve_batch_cache_get_overlay_select(Curve *cu)
return cache->text.select;
}
-Batch *DRW_curve_batch_cache_get_overlay_cursor(Curve *cu)
+Gwn_Batch *DRW_curve_batch_cache_get_overlay_cursor(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c
index 9e93409c24d..fd36b7ad4a3 100644
--- a/source/blender/draw/intern/draw_cache_impl_displist.c
+++ b/source/blender/draw/intern/draw_cache_impl_displist.c
@@ -86,27 +86,27 @@ static int curve_render_surface_tri_len_get(const ListBase *lb)
return tri_len;
}
-Batch *BLI_displist_batch_calc_surface(ListBase *lb)
+Gwn_Batch *BLI_displist_batch_calc_surface(ListBase *lb)
{
const int tri_len = curve_render_surface_tri_len_get(lb);
if (tri_len == 0) {
return NULL;
}
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int vert_len = curve_render_surface_vert_len_get(lb);
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
{
const int vbo_len_capacity = vert_len;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
BKE_displist_normals_add(lb);
@@ -117,9 +117,9 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
const float *fp_no = dl->nors;
const int vbo_end = vbo_len_used + dl_vert_len(dl);
while (vbo_len_used < vbo_end) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, fp_co);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, fp_co);
if (fp_no) {
- VertexBuffer_set_attrib(vbo, attr_id.nor, vbo_len_used, fp_no);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, vbo_len_used, fp_no);
if (ndata_is_single == false) {
fp_no += 3;
}
@@ -132,8 +132,8 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
}
{
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, tri_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, tri_len, vert_len);
int ofs = 0;
int tri_len_used = 0;
@@ -143,7 +143,7 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
const int *idx = dl->index;
const int i_end = dl->parts;
for (int i = 0; i < i_end; i++) {
- add_triangle_vertices(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs);
tri_len_used += 1;
idx += 3;
}
@@ -152,9 +152,9 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
const int *idx = dl->index;
const int i_end = dl->totindex;
for (int i = 0; i < i_end; i++) {
- add_triangle_vertices(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs);
tri_len_used += 1;
- add_triangle_vertices(&elb, idx[0] + ofs, idx[2] + ofs, idx[3] + ofs);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0] + ofs, idx[2] + ofs, idx[3] + ofs);
tri_len_used += 1;
idx += 4;
}
@@ -163,6 +163,6 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
}
}
- return Batch_create(PRIM_TRIANGLES, vbo, ElementList_build(&elb));
+ return GWN_batch_create(GWN_PRIM_TRIS, vbo, GWN_indexbuf_build(&elb));
}
}
diff --git a/source/blender/draw/intern/draw_cache_impl_lattice.c b/source/blender/draw/intern/draw_cache_impl_lattice.c
index e5d8a6c9301..dfba2aedcda 100644
--- a/source/blender/draw/intern/draw_cache_impl_lattice.c
+++ b/source/blender/draw/intern/draw_cache_impl_lattice.c
@@ -215,16 +215,16 @@ enum {
};
/* ---------------------------------------------------------------------- */
-/* Lattice Batch Cache */
+/* Lattice Gwn_Batch Cache */
typedef struct LatticeBatchCache {
- VertexBuffer *pos;
- ElementList *edges;
+ Gwn_VertBuf *pos;
+ Gwn_IndexBuf *edges;
- Batch *all_verts;
- Batch *all_edges;
+ Gwn_Batch *all_verts;
+ Gwn_Batch *all_edges;
- Batch *overlay_verts;
+ Gwn_Batch *overlay_verts;
/* settings to determine if cache is invalid */
bool is_dirty;
@@ -237,7 +237,7 @@ typedef struct LatticeBatchCache {
bool is_editmode;
} LatticeBatchCache;
-/* Batch cache management. */
+/* Gwn_Batch cache management. */
static bool lattice_batch_cache_valid(Lattice *lt)
{
@@ -326,12 +326,12 @@ static void lattice_batch_cache_clear(Lattice *lt)
return;
}
- BATCH_DISCARD_SAFE(cache->all_verts);
- BATCH_DISCARD_SAFE(cache->all_edges);
+ GWN_BATCH_DISCARD_SAFE(cache->all_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->all_edges);
BATCH_DISCARD_ALL_SAFE(cache->overlay_verts);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos);
- ELEMENTLIST_DISCARD_SAFE(cache->edges);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->edges);
}
void DRW_lattice_batch_cache_free(Lattice *lt)
@@ -340,33 +340,33 @@ void DRW_lattice_batch_cache_free(Lattice *lt)
MEM_SAFE_FREE(lt->batch_cache);
}
-/* Batch cache usage. */
-static VertexBuffer *lattice_batch_cache_get_pos(LatticeRenderData *rdata, LatticeBatchCache *cache)
+/* Gwn_Batch cache usage. */
+static Gwn_VertBuf *lattice_batch_cache_get_pos(LatticeRenderData *rdata, LatticeBatchCache *cache)
{
BLI_assert(rdata->types & LR_DATATYPE_VERT);
if (cache->pos == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int vert_len = lattice_render_data_verts_len_get(rdata);
- cache->pos = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(cache->pos, vert_len);
+ cache->pos = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(cache->pos, vert_len);
for (int i = 0; i < vert_len; ++i) {
const BPoint *bp = lattice_render_data_vert_bpoint(rdata, i);
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, i, bp->vec);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, i, bp->vec);
}
}
return cache->pos;
}
-static ElementList *lattice_batch_cache_get_edges(LatticeRenderData *rdata, LatticeBatchCache *cache)
+static Gwn_IndexBuf *lattice_batch_cache_get_edges(LatticeRenderData *rdata, LatticeBatchCache *cache)
{
BLI_assert(rdata->types & (LR_DATATYPE_VERT | LR_DATATYPE_EDGE));
@@ -375,8 +375,8 @@ static ElementList *lattice_batch_cache_get_edges(LatticeRenderData *rdata, Latt
const int edge_len = lattice_render_data_edges_len_get(rdata);
int edge_len_real = 0;
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, edge_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, edge_len, vert_len);
#define LATT_INDEX(u, v, w) \
((((w) * rdata->dims.v_len + (v)) * rdata->dims.u_len) + (u))
@@ -389,17 +389,17 @@ static ElementList *lattice_batch_cache_get_edges(LatticeRenderData *rdata, Latt
int uxt = (u == 0 || u == rdata->dims.u_len - 1);
if (w && ((uxt || vxt) || !rdata->show_only_outside)) {
- add_line_vertices(&elb, LATT_INDEX(u, v, w - 1), LATT_INDEX(u, v, w));
+ GWN_indexbuf_add_line_verts(&elb, LATT_INDEX(u, v, w - 1), LATT_INDEX(u, v, w));
BLI_assert(edge_len_real <= edge_len);
edge_len_real++;
}
if (v && ((uxt || wxt) || !rdata->show_only_outside)) {
- add_line_vertices(&elb, LATT_INDEX(u, v - 1, w), LATT_INDEX(u, v, w));
+ GWN_indexbuf_add_line_verts(&elb, LATT_INDEX(u, v - 1, w), LATT_INDEX(u, v, w));
BLI_assert(edge_len_real <= edge_len);
edge_len_real++;
}
if (u && ((vxt || wxt) || !rdata->show_only_outside)) {
- add_line_vertices(&elb, LATT_INDEX(u - 1, v, w), LATT_INDEX(u, v, w));
+ GWN_indexbuf_add_line_verts(&elb, LATT_INDEX(u - 1, v, w), LATT_INDEX(u, v, w));
BLI_assert(edge_len_real <= edge_len);
edge_len_real++;
}
@@ -416,7 +416,7 @@ static ElementList *lattice_batch_cache_get_edges(LatticeRenderData *rdata, Latt
BLI_assert(edge_len_real == edge_len);
}
- cache->edges = ElementList_build(&elb);
+ cache->edges = GWN_indexbuf_build(&elb);
}
return cache->edges;
@@ -431,18 +431,18 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt)
LatticeRenderData *rdata = lattice_render_data_create(lt, options);
if (cache->overlay_verts == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, data; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_U8, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT);
}
const int vert_len = lattice_render_data_verts_len_get(rdata);
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vert_len);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vert_len);
for (int i = 0; i < vert_len; ++i) {
const BPoint *bp = lattice_render_data_vert_bpoint(rdata, i);
@@ -456,17 +456,17 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt)
}
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, bp->vec);
- VertexBuffer_set_attrib(vbo, attr_id.data, i, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, bp->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, i, &vflag);
}
- cache->overlay_verts = Batch_create(PRIM_POINTS, vbo, NULL);
+ cache->overlay_verts = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
}
lattice_render_data_free(rdata);
}
-Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
+Gwn_Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);
@@ -474,7 +474,7 @@ Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
/* create batch from Lattice */
LatticeRenderData *rdata = lattice_render_data_create(lt, LR_DATATYPE_VERT | LR_DATATYPE_EDGE);
- cache->all_edges = Batch_create(PRIM_LINES, lattice_batch_cache_get_pos(rdata, cache),
+ cache->all_edges = GWN_batch_create(GWN_PRIM_LINES, lattice_batch_cache_get_pos(rdata, cache),
lattice_batch_cache_get_edges(rdata, cache));
lattice_render_data_free(rdata);
@@ -483,14 +483,14 @@ Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
return cache->all_edges;
}
-Batch *DRW_lattice_batch_cache_get_all_verts(Lattice *lt)
+Gwn_Batch *DRW_lattice_batch_cache_get_all_verts(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);
if (cache->all_verts == NULL) {
LatticeRenderData *rdata = lattice_render_data_create(lt, LR_DATATYPE_VERT);
- cache->all_verts = Batch_create(PRIM_POINTS, lattice_batch_cache_get_pos(rdata, cache), NULL);
+ cache->all_verts = GWN_batch_create(GWN_PRIM_POINTS, lattice_batch_cache_get_pos(rdata, cache), NULL);
lattice_render_data_free(rdata);
}
@@ -498,7 +498,7 @@ Batch *DRW_lattice_batch_cache_get_all_verts(Lattice *lt)
return cache->all_verts;
}
-Batch *DRW_lattice_batch_cache_get_overlay_verts(Lattice *lt)
+Gwn_Batch *DRW_lattice_batch_cache_get_overlay_verts(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 012f840d51b..524ee22f577 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1219,7 +1219,7 @@ static unsigned char mesh_render_data_vertex_flag(MeshRenderData *rdata, const B
}
static void add_overlay_tri(
- MeshRenderData *rdata, VertexBuffer *vbo_pos, VertexBuffer *vbo_nor, VertexBuffer *vbo_data,
+ MeshRenderData *rdata, Gwn_VertBuf *vbo_pos, Gwn_VertBuf *vbo_nor, Gwn_VertBuf *vbo_data,
const unsigned int pos_id, const unsigned int vnor_id, const unsigned int lnor_id, const unsigned int data_id,
const BMLoop **bm_looptri, const int base_vert_idx)
{
@@ -1229,7 +1229,7 @@ static void add_overlay_tri(
if (vbo_pos) {
for (uint i = 0; i < 3; i++) {
const float *pos = bm_looptri[i]->v->co;
- VertexBuffer_set_attrib(vbo_pos, pos_id, base_vert_idx + i, pos);
+ GWN_vertbuf_attr_set(vbo_pos, pos_id, base_vert_idx + i, pos);
}
}
@@ -1238,8 +1238,8 @@ static void add_overlay_tri(
PackedNormal lnor = convert_i10_v3(bm_looptri[0]->f->no);
for (uint i = 0; i < 3; i++) {
PackedNormal vnor = convert_i10_v3(bm_looptri[i]->v->no);
- VertexBuffer_set_attrib(vbo_nor, vnor_id, base_vert_idx + i, &vnor);
- VertexBuffer_set_attrib(vbo_nor, lnor_id, base_vert_idx + i, &lnor);
+ GWN_vertbuf_attr_set(vbo_nor, vnor_id, base_vert_idx + i, &vnor);
+ GWN_vertbuf_attr_set(vbo_nor, lnor_id, base_vert_idx + i, &lnor);
}
}
@@ -1253,7 +1253,7 @@ static void add_overlay_tri(
mesh_render_data_edge_flag(rdata, bm_looptri[i_next]->e, &eattr);
}
eattr.v_flag = fflag | vflag;
- VertexBuffer_set_attrib(vbo_data, data_id, base_vert_idx + i, &eattr);
+ GWN_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr);
i_prev = i;
i = i_next;
@@ -1262,21 +1262,21 @@ static void add_overlay_tri(
}
static void add_overlay_loose_edge(
- MeshRenderData *rdata, VertexBuffer *vbo_pos, VertexBuffer *vbo_nor, VertexBuffer *vbo_data,
+ MeshRenderData *rdata, Gwn_VertBuf *vbo_pos, Gwn_VertBuf *vbo_nor, Gwn_VertBuf *vbo_data,
const unsigned int pos_id, const unsigned int vnor_id, const unsigned int data_id,
const BMEdge *eed, const int base_vert_idx)
{
if (vbo_pos) {
for (int i = 0; i < 2; ++i) {
const float *pos = (&eed->v1)[i]->co;
- VertexBuffer_set_attrib(vbo_pos, pos_id, base_vert_idx + i, pos);
+ GWN_vertbuf_attr_set(vbo_pos, pos_id, base_vert_idx + i, pos);
}
}
if (vbo_nor) {
for (int i = 0; i < 2; ++i) {
PackedNormal vnor = convert_i10_v3((&eed->v1)[i]->no);
- VertexBuffer_set_attrib(vbo_nor, vnor_id, base_vert_idx + i, &vnor);
+ GWN_vertbuf_attr_set(vbo_nor, vnor_id, base_vert_idx + i, &vnor);
}
}
@@ -1285,30 +1285,30 @@ static void add_overlay_loose_edge(
mesh_render_data_edge_flag(rdata, eed, &eattr);
for (int i = 0; i < 2; ++i) {
eattr.v_flag = mesh_render_data_vertex_flag(rdata, (&eed->v1)[i]);
- VertexBuffer_set_attrib(vbo_data, data_id, base_vert_idx + i, &eattr);
+ GWN_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr);
}
}
}
static void add_overlay_loose_vert(
- MeshRenderData *rdata, VertexBuffer *vbo_pos, VertexBuffer *vbo_nor, VertexBuffer *vbo_data,
+ MeshRenderData *rdata, Gwn_VertBuf *vbo_pos, Gwn_VertBuf *vbo_nor, Gwn_VertBuf *vbo_data,
const unsigned int pos_id, const unsigned int vnor_id, const unsigned int data_id,
const BMVert *eve, const int base_vert_idx)
{
if (vbo_pos) {
const float *pos = eve->co;
- VertexBuffer_set_attrib(vbo_pos, pos_id, base_vert_idx, pos);
+ GWN_vertbuf_attr_set(vbo_pos, pos_id, base_vert_idx, pos);
}
if (vbo_nor) {
PackedNormal vnor = convert_i10_v3(eve->no);
- VertexBuffer_set_attrib(vbo_nor, vnor_id, base_vert_idx, &vnor);
+ GWN_vertbuf_attr_set(vbo_nor, vnor_id, base_vert_idx, &vnor);
}
if (vbo_data) {
unsigned char vflag[4] = {0, 0, 0, 0};
vflag[0] = mesh_render_data_vertex_flag(rdata, eve);
- VertexBuffer_set_attrib(vbo_data, data_id, base_vert_idx, vflag);
+ GWN_vertbuf_attr_set(vbo_data, data_id, base_vert_idx, vflag);
}
}
@@ -1317,78 +1317,78 @@ static void add_overlay_loose_vert(
/* ---------------------------------------------------------------------- */
-/** \name Mesh Batch Cache
+/** \name Mesh Gwn_Batch Cache
* \{ */
typedef struct MeshBatchCache {
- VertexBuffer *pos_in_order;
- VertexBuffer *nor_in_order;
- ElementList *edges_in_order;
- ElementList *triangles_in_order;
- ElementList *overlay_triangles_vpaint;
-
- Batch *all_verts;
- Batch *all_edges;
- Batch *all_triangles;
-
- VertexBuffer *pos_with_normals;
- VertexBuffer *pos_with_normals_visible_only; /* for paint modes with vert/face hide support. */
- VertexBuffer *tri_aligned_weights;
- VertexBuffer *tri_aligned_vert_colors;
- VertexBuffer *tri_aligned_select_id;
- VertexBuffer *tri_aligned_uv; /* Active UV layer (mloopuv) */
- VertexBuffer *edge_pos_with_select_bool;
- VertexBuffer *pos_with_select_bool;
- Batch *triangles_with_normals;
+ Gwn_VertBuf *pos_in_order;
+ Gwn_VertBuf *nor_in_order;
+ Gwn_IndexBuf *edges_in_order;
+ Gwn_IndexBuf *triangles_in_order;
+ Gwn_IndexBuf *overlay_triangles_vpaint;
+
+ Gwn_Batch *all_verts;
+ Gwn_Batch *all_edges;
+ Gwn_Batch *all_triangles;
+
+ Gwn_VertBuf *pos_with_normals;
+ Gwn_VertBuf *pos_with_normals_visible_only; /* for paint modes with vert/face hide support. */
+ Gwn_VertBuf *tri_aligned_weights;
+ Gwn_VertBuf *tri_aligned_vert_colors;
+ Gwn_VertBuf *tri_aligned_select_id;
+ Gwn_VertBuf *tri_aligned_uv; /* Active UV layer (mloopuv) */
+ Gwn_VertBuf *edge_pos_with_select_bool;
+ Gwn_VertBuf *pos_with_select_bool;
+ Gwn_Batch *triangles_with_normals;
/* Skip hidden (depending on paint select mode),
* 'pos_with_normals' or 'pos_with_normals_visible_only'. */
- Batch *triangles_with_weights;
- Batch *triangles_with_vert_colors;
+ Gwn_Batch *triangles_with_weights;
+ Gwn_Batch *triangles_with_vert_colors;
/* Always skip hidden */
- Batch *triangles_with_select_id;
+ Gwn_Batch *triangles_with_select_id;
- Batch *points_with_normals;
- Batch *fancy_edges; /* owns its vertex buffer (not shared) */
+ Gwn_Batch *points_with_normals;
+ Gwn_Batch *fancy_edges; /* owns its vertex buffer (not shared) */
/* Maybe have shaded_triangles_data split into pos_nor and uv_tangent
* to minimise data transfer for skinned mesh. */
- VertexFormat shaded_triangles_format;
- VertexBuffer *shaded_triangles_data;
- ElementList **shaded_triangles_in_order;
- Batch **shaded_triangles;
+ Gwn_VertFormat shaded_triangles_format;
+ Gwn_VertBuf *shaded_triangles_data;
+ Gwn_IndexBuf **shaded_triangles_in_order;
+ Gwn_Batch **shaded_triangles;
/* Texture Paint.*/
/* per-texture batch */
- Batch **texpaint_triangles;
- Batch *texpaint_triangles_single;
+ Gwn_Batch **texpaint_triangles;
+ Gwn_Batch *texpaint_triangles_single;
/* Edit Cage Mesh buffers */
- VertexBuffer *ed_tri_pos;
- VertexBuffer *ed_tri_nor; /* LoopNor, VertNor */
- VertexBuffer *ed_tri_data;
+ Gwn_VertBuf *ed_tri_pos;
+ Gwn_VertBuf *ed_tri_nor; /* LoopNor, VertNor */
+ Gwn_VertBuf *ed_tri_data;
- VertexBuffer *ed_ledge_pos;
- VertexBuffer *ed_ledge_nor; /* VertNor */
- VertexBuffer *ed_ledge_data;
+ Gwn_VertBuf *ed_ledge_pos;
+ Gwn_VertBuf *ed_ledge_nor; /* VertNor */
+ Gwn_VertBuf *ed_ledge_data;
- VertexBuffer *ed_lvert_pos;
- VertexBuffer *ed_lvert_nor; /* VertNor */
- VertexBuffer *ed_lvert_data;
+ Gwn_VertBuf *ed_lvert_pos;
+ Gwn_VertBuf *ed_lvert_nor; /* VertNor */
+ Gwn_VertBuf *ed_lvert_data;
- VertexBuffer *ed_fcenter_pos;
- VertexBuffer *ed_fcenter_nor;
+ Gwn_VertBuf *ed_fcenter_pos;
+ Gwn_VertBuf *ed_fcenter_nor;
- Batch *overlay_triangles;
- Batch *overlay_triangles_nor; /* PRIM_POINTS */
- Batch *overlay_loose_edges;
- Batch *overlay_loose_edges_nor; /* PRIM_POINTS */
- Batch *overlay_loose_verts;
- Batch *overlay_facedots;
+ Gwn_Batch *overlay_triangles;
+ Gwn_Batch *overlay_triangles_nor; /* GWN_PRIM_POINTS */
+ Gwn_Batch *overlay_loose_edges;
+ Gwn_Batch *overlay_loose_edges_nor; /* GWN_PRIM_POINTS */
+ Gwn_Batch *overlay_loose_verts;
+ Gwn_Batch *overlay_facedots;
- Batch *overlay_weight_faces;
- Batch *overlay_weight_verts;
- Batch *overlay_paint_edges;
+ Gwn_Batch *overlay_weight_faces;
+ Gwn_Batch *overlay_weight_verts;
+ Gwn_Batch *overlay_paint_edges;
/* settings to determine if cache is invalid */
bool is_dirty;
@@ -1401,7 +1401,7 @@ typedef struct MeshBatchCache {
bool is_editmode;
} MeshBatchCache;
-/* Batch cache management. */
+/* Gwn_Batch cache management. */
static bool mesh_batch_cache_valid(Mesh *me)
{
@@ -1490,13 +1490,13 @@ void DRW_mesh_batch_cache_dirty(Mesh *me, int mode)
cache->is_dirty = true;
break;
case BKE_MESH_BATCH_DIRTY_SELECT:
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_tri_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_ledge_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_lvert_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_fcenter_nor); /* Contains select flag */
- BATCH_DISCARD_SAFE(cache->overlay_triangles);
- BATCH_DISCARD_SAFE(cache->overlay_loose_verts);
- BATCH_DISCARD_SAFE(cache->overlay_loose_edges);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_ledge_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_lvert_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_fcenter_nor); /* Contains select flag */
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_triangles);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_edges);
BATCH_DISCARD_ALL_SAFE(cache->overlay_facedots);
break;
@@ -1515,61 +1515,61 @@ static void mesh_batch_cache_clear(Mesh *me)
return;
}
- BATCH_DISCARD_SAFE(cache->all_verts);
- BATCH_DISCARD_SAFE(cache->all_edges);
- BATCH_DISCARD_SAFE(cache->all_triangles);
-
- VERTEXBUFFER_DISCARD_SAFE(cache->pos_in_order);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos_with_select_bool);
- ELEMENTLIST_DISCARD_SAFE(cache->edges_in_order);
- ELEMENTLIST_DISCARD_SAFE(cache->triangles_in_order);
- ELEMENTLIST_DISCARD_SAFE(cache->overlay_triangles_vpaint);
-
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_tri_pos);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_tri_nor);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_tri_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_ledge_pos);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_ledge_nor);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_ledge_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_lvert_pos);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_lvert_nor);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_lvert_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_fcenter_pos);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_fcenter_nor);
- BATCH_DISCARD_SAFE(cache->overlay_triangles);
- BATCH_DISCARD_SAFE(cache->overlay_triangles_nor);
- BATCH_DISCARD_SAFE(cache->overlay_loose_verts);
- BATCH_DISCARD_SAFE(cache->overlay_loose_edges);
- BATCH_DISCARD_SAFE(cache->overlay_loose_edges_nor);
-
- BATCH_DISCARD_SAFE(cache->overlay_weight_faces);
- BATCH_DISCARD_SAFE(cache->overlay_weight_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->all_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->all_edges);
+ GWN_BATCH_DISCARD_SAFE(cache->all_triangles);
+
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos_in_order);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos_with_select_bool);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->edges_in_order);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->triangles_in_order);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->overlay_triangles_vpaint);
+
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_pos);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_nor);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_ledge_pos);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_ledge_nor);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_ledge_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_lvert_pos);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_lvert_nor);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_lvert_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_fcenter_pos);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_fcenter_nor);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_triangles);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_triangles_nor);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_edges);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_edges_nor);
+
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_weight_faces);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_weight_verts);
BATCH_DISCARD_ALL_SAFE(cache->overlay_paint_edges);
BATCH_DISCARD_ALL_SAFE(cache->overlay_facedots);
- BATCH_DISCARD_SAFE(cache->triangles_with_normals);
- BATCH_DISCARD_SAFE(cache->points_with_normals);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos_with_normals);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos_with_normals_visible_only);
- VERTEXBUFFER_DISCARD_SAFE(cache->tri_aligned_vert_colors);
- VERTEXBUFFER_DISCARD_SAFE(cache->tri_aligned_weights);
- BATCH_DISCARD_SAFE(cache->triangles_with_weights);
- BATCH_DISCARD_SAFE(cache->triangles_with_vert_colors);
- VERTEXBUFFER_DISCARD_SAFE(cache->tri_aligned_select_id);
- VERTEXBUFFER_DISCARD_SAFE(cache->tri_aligned_uv);
- BATCH_DISCARD_SAFE(cache->triangles_with_select_id);
+ GWN_BATCH_DISCARD_SAFE(cache->triangles_with_normals);
+ GWN_BATCH_DISCARD_SAFE(cache->points_with_normals);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos_with_normals);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos_with_normals_visible_only);
+ GWN_VERTBUF_DISCARD_SAFE(cache->tri_aligned_vert_colors);
+ GWN_VERTBUF_DISCARD_SAFE(cache->tri_aligned_weights);
+ GWN_BATCH_DISCARD_SAFE(cache->triangles_with_weights);
+ GWN_BATCH_DISCARD_SAFE(cache->triangles_with_vert_colors);
+ GWN_VERTBUF_DISCARD_SAFE(cache->tri_aligned_select_id);
+ GWN_VERTBUF_DISCARD_SAFE(cache->tri_aligned_uv);
+ GWN_BATCH_DISCARD_SAFE(cache->triangles_with_select_id);
BATCH_DISCARD_ALL_SAFE(cache->fancy_edges);
- VERTEXBUFFER_DISCARD_SAFE(cache->shaded_triangles_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->shaded_triangles_data);
if (cache->shaded_triangles_in_order) {
for (int i = 0; i < cache->mat_len; ++i) {
- ELEMENTLIST_DISCARD_SAFE(cache->shaded_triangles_in_order[i]);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->shaded_triangles_in_order[i]);
}
}
if (cache->shaded_triangles) {
for (int i = 0; i < cache->mat_len; ++i) {
- BATCH_DISCARD_SAFE(cache->shaded_triangles[i]);
+ GWN_BATCH_DISCARD_SAFE(cache->shaded_triangles[i]);
}
}
@@ -1578,12 +1578,12 @@ static void mesh_batch_cache_clear(Mesh *me)
if (cache->texpaint_triangles) {
for (int i = 0; i < cache->mat_len; ++i) {
- BATCH_DISCARD_SAFE(cache->texpaint_triangles[i]);
+ GWN_BATCH_DISCARD_SAFE(cache->texpaint_triangles[i]);
}
}
MEM_SAFE_FREE(cache->texpaint_triangles);
- BATCH_DISCARD_SAFE(cache->texpaint_triangles_single);
+ GWN_BATCH_DISCARD_SAFE(cache->texpaint_triangles_single);
}
@@ -1593,9 +1593,9 @@ void DRW_mesh_batch_cache_free(Mesh *me)
MEM_SAFE_FREE(me->batch_cache);
}
-/* Batch cache usage. */
+/* Gwn_Batch cache usage. */
-static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata, MeshBatchCache *cache)
+static Gwn_VertBuf *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
#define USE_COMP_MESH_DATA
@@ -1608,9 +1608,9 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
return NULL;
}
- VertexFormat *format = &cache->shaded_triangles_format;
+ Gwn_VertFormat *format = &cache->shaded_triangles_format;
- VertexFormat_clear(format);
+ GWN_vertformat_clear(format);
/* initialize vertex format */
unsigned int *uv_id = MEM_mallocN(sizeof(*uv_id) * rdata->cd.layers.uv_len, "UV attrib format");
@@ -1621,17 +1621,17 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
/* UV */
attrib_name = mesh_render_data_uv_layer_uuid_get(rdata, i);
#if defined(USE_COMP_MESH_DATA) && 0 /* these are clamped. Maybe use them as an option in the future */
- uv_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_I16, 2, NORMALIZE_INT_TO_FLOAT);
+ uv_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_I16, 2, GWN_FETCH_INT_TO_FLOAT_UNIT);
#else
- uv_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_F32, 2, KEEP_FLOAT);
+ uv_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
#endif
/* Auto Name */
attrib_name = mesh_render_data_uv_auto_layer_uuid_get(rdata, i);
- VertexFormat_add_alias(format, attrib_name);
+ GWN_vertformat_alias_add(format, attrib_name);
if (i == rdata->cd.layers.uv_active) {
- VertexFormat_add_alias(format, "u");
+ GWN_vertformat_alias_add(format, "u");
}
/* Tangent */
@@ -1640,40 +1640,40 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
* That may cause some problem but I could not make it to fail (fclem) */
#ifdef USE_COMP_MESH_DATA
/* Tangents need more precision than 10_10_10 */
- tangent_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
+ tangent_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
#else
- tangent_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_F32, 3, KEEP_FLOAT);
+ tangent_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
#endif
if (i == rdata->cd.layers.uv_active) {
- VertexFormat_add_alias(format, "t");
+ GWN_vertformat_alias_add(format, "t");
}
}
for (int i = 0; i < rdata->cd.layers.vcol_len; i++) {
attrib_name = mesh_render_data_vcol_layer_uuid_get(rdata, i);
- vcol_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ vcol_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
/* Auto layer */
if (rdata->cd.layers.auto_vcol[i]) {
attrib_name = mesh_render_data_vcol_auto_layer_uuid_get(rdata, i);
- VertexFormat_add_alias(format, attrib_name);
+ GWN_vertformat_alias_add(format, attrib_name);
}
if (i == rdata->cd.layers.vcol_active) {
- VertexFormat_add_alias(format, "c");
+ GWN_vertformat_alias_add(format, "c");
}
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->shaded_triangles_data = VertexBuffer_create_with_format(format);
+ Gwn_VertBuf *vbo = cache->shaded_triangles_data = GWN_vertbuf_create_with_format(format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
- /* TODO deduplicate all verts and make use of ElementList in
+ /* TODO deduplicate all verts and make use of Gwn_IndexBuf in
* mesh_batch_cache_get_triangles_in_order_split_by_material. */
for (int i = 0; i < tri_len; i++) {
float *tri_uvs[3], *tri_tans[3];
@@ -1694,9 +1694,9 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
#else
float **s_uvs = tri_uvs;
#endif
- VertexBuffer_set_attrib(vbo, uv_id[j], vidx + 0, s_uvs[0]);
- VertexBuffer_set_attrib(vbo, uv_id[j], vidx + 1, s_uvs[1]);
- VertexBuffer_set_attrib(vbo, uv_id[j], vidx + 2, s_uvs[2]);
+ GWN_vertbuf_attr_set(vbo, uv_id[j], vidx + 0, s_uvs[0]);
+ GWN_vertbuf_attr_set(vbo, uv_id[j], vidx + 1, s_uvs[1]);
+ GWN_vertbuf_attr_set(vbo, uv_id[j], vidx + 2, s_uvs[2]);
/* Tangent */
mesh_render_data_looptri_tans_get(rdata, i, j, &tri_tans);
@@ -1709,17 +1709,17 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
#else
float **s_tan = tri_tans;
#endif
- VertexBuffer_set_attrib(vbo, tangent_id[j], vidx + 0, s_tan[0]);
- VertexBuffer_set_attrib(vbo, tangent_id[j], vidx + 1, s_tan[1]);
- VertexBuffer_set_attrib(vbo, tangent_id[j], vidx + 2, s_tan[2]);
+ GWN_vertbuf_attr_set(vbo, tangent_id[j], vidx + 0, s_tan[0]);
+ GWN_vertbuf_attr_set(vbo, tangent_id[j], vidx + 1, s_tan[1]);
+ GWN_vertbuf_attr_set(vbo, tangent_id[j], vidx + 2, s_tan[2]);
}
/* VCOLs */
for (int j = 0; j < rdata->cd.layers.vcol_len; j++) {
mesh_render_data_looptri_cols_get(rdata, i, j, &tri_cols);
- VertexBuffer_set_attrib(vbo, vcol_id[j], vidx + 0, tri_cols[0]);
- VertexBuffer_set_attrib(vbo, vcol_id[j], vidx + 1, tri_cols[1]);
- VertexBuffer_set_attrib(vbo, vcol_id[j], vidx + 2, tri_cols[2]);
+ GWN_vertbuf_attr_set(vbo, vcol_id[j], vidx + 0, tri_cols[0]);
+ GWN_vertbuf_attr_set(vbo, vcol_id[j], vidx + 1, tri_cols[1]);
+ GWN_vertbuf_attr_set(vbo, vcol_id[j], vidx + 2, tri_cols[2]);
}
vidx += 3;
@@ -1728,7 +1728,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
vbo_len_used = vidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
MEM_freeN(uv_id);
@@ -1741,7 +1741,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
return cache->shaded_triangles_data;
}
-static VertexBuffer *mesh_batch_cache_get_tri_uv_active(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_uv_active(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPUV));
@@ -1750,27 +1750,27 @@ static VertexBuffer *mesh_batch_cache_get_tri_uv_active(
if (cache->tri_aligned_uv == NULL) {
unsigned int vidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint uv; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.uv = VertexFormat_add_attrib(&format, "uv", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.uv = GWN_vertformat_attr_add(&format, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->tri_aligned_uv = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->tri_aligned_uv = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
const MLoopUV *mloopuv = rdata->mloopuv;
for (int i = 0; i < tri_len; i++) {
const MLoopTri *mlt = &rdata->mlooptri[i];
- VertexBuffer_set_attrib(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[0]].uv);
- VertexBuffer_set_attrib(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[1]].uv);
- VertexBuffer_set_attrib(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[2]].uv);
+ GWN_vertbuf_attr_set(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[0]].uv);
+ GWN_vertbuf_attr_set(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[1]].uv);
+ GWN_vertbuf_attr_set(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[2]].uv);
}
vbo_len_used = vidx;
@@ -1780,29 +1780,29 @@ static VertexBuffer *mesh_batch_cache_get_tri_uv_active(
return cache->tri_aligned_uv;
}
-static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals_ex(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_pos_and_normals_ex(
MeshRenderData *rdata, const bool use_hide,
- VertexBuffer **r_vbo)
+ Gwn_VertBuf **r_vbo)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
if (*r_vbo == NULL) {
unsigned int vidx = 0, nidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = *r_vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = *r_vbo = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < tri_len; i++) {
float *tri_vert_cos[3];
@@ -1820,41 +1820,41 @@ static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals_ex(
};
PackedNormal *snor[3] = { &snor_pack[0], &snor_pack[1], &snor_pack[2] };
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor[0]);
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor[1]);
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor[2]);
}
else {
PackedNormal snor_pack = convert_i10_s3(tri_nor);
PackedNormal *snor = &snor_pack;
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor);
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor);
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor);
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, tri_vert_cos[0]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, tri_vert_cos[1]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, tri_vert_cos[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, tri_vert_cos[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, tri_vert_cos[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, tri_vert_cos[2]);
}
}
vbo_len_used = vidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return *r_vbo;
}
-static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_pos_and_normals(
MeshRenderData *rdata, MeshBatchCache *cache)
{
return mesh_batch_cache_get_tri_pos_and_normals_ex(
rdata, false,
&cache->pos_with_normals);
}
-static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals_visible_only(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_pos_and_normals_visible_only(
MeshRenderData *rdata, MeshBatchCache *cache)
{
return mesh_batch_cache_get_tri_pos_and_normals_ex(
@@ -1862,7 +1862,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals_visible_only(
&cache->pos_with_normals_visible_only);
}
-static VertexBuffer *mesh_batch_cache_get_tri_weights(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_weights(
MeshRenderData *rdata, MeshBatchCache *cache, bool use_hide, int defgroup)
{
BLI_assert(
@@ -1872,19 +1872,19 @@ static VertexBuffer *mesh_batch_cache_get_tri_weights(
if (cache->tri_aligned_weights == NULL) {
unsigned int cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint col; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.col = VertexFormat_add_attrib(&format, "color", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->tri_aligned_weights = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->tri_aligned_weights = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
mesh_render_data_ensure_vert_weight_color(rdata, defgroup);
const float (*vert_weight_color)[3] = rdata->vert_weight_color;
@@ -1896,7 +1896,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_weights(
if (!BM_elem_flag_test(ltri[0]->f, BM_ELEM_HIDDEN)) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
const int v_index = BM_elem_index_get(ltri[tri_corner]->v);
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, vert_weight_color[v_index]);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, vert_weight_color[v_index]);
}
}
}
@@ -1907,7 +1907,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_weights(
if (!(use_hide && (rdata->mpoly[mlt->poly].flag & ME_HIDE))) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
const uint v_index = rdata->mloop[mlt->tri[tri_corner]].v;
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, vert_weight_color[v_index]);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, vert_weight_color[v_index]);
}
}
}
@@ -1915,14 +1915,14 @@ static VertexBuffer *mesh_batch_cache_get_tri_weights(
vbo_len_used = cidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return cache->tri_aligned_weights;
}
-static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_vert_colors(
MeshRenderData *rdata, MeshBatchCache *cache, bool use_hide)
{
BLI_assert(
@@ -1932,18 +1932,18 @@ static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
if (cache->tri_aligned_vert_colors == NULL) {
unsigned int cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint col; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.col = VertexFormat_add_attrib(&format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->tri_aligned_vert_colors = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->tri_aligned_vert_colors = GWN_vertbuf_create_with_format(&format);
const uint vbo_len_capacity = tri_len * 3;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
mesh_render_data_ensure_vert_color(rdata);
const char (*vert_color)[3] = rdata->vert_color;
@@ -1955,7 +1955,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
if (!BM_elem_flag_test(ltri[0]->f, BM_ELEM_HIDDEN)) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
const int l_index = BM_elem_index_get(ltri[tri_corner]);
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, vert_color[l_index]);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, vert_color[l_index]);
}
}
}
@@ -1966,7 +1966,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
if (!(use_hide && (rdata->mpoly[mlt->poly].flag & ME_HIDE))) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
const uint l_index = mlt->tri[tri_corner];
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, vert_color[l_index]);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, vert_color[l_index]);
}
}
}
@@ -1974,14 +1974,14 @@ static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
const uint vbo_len_used = cidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return cache->tri_aligned_vert_colors;
}
-static VertexBuffer *mesh_batch_cache_get_tri_select_id(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_select_id(
MeshRenderData *rdata, MeshBatchCache *cache, bool use_hide)
{
BLI_assert(
@@ -1991,19 +1991,19 @@ static VertexBuffer *mesh_batch_cache_get_tri_select_id(
if (cache->tri_aligned_select_id == NULL) {
unsigned int cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint col; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.col = VertexFormat_add_attrib(&format, "color", COMP_I32, 1, KEEP_INT);
+ attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->tri_aligned_select_id = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->tri_aligned_select_id = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
if (rdata->edit_bmesh) {
for (int i = 0; i < tri_len; i++) {
@@ -2014,7 +2014,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_select_id(
int select_id;
GPU_select_index_get(poly_index + 1, &select_id);
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, &select_id);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, &select_id);
}
}
}
@@ -2027,7 +2027,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_select_id(
int select_id;
GPU_select_index_get(poly_index + 1, &select_id);
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, &select_id);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, &select_id);
}
}
}
@@ -2035,29 +2035,29 @@ static VertexBuffer *mesh_batch_cache_get_tri_select_id(
vbo_len_used = cidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return cache->tri_aligned_select_id;
}
-static VertexBuffer *mesh_batch_cache_get_vert_pos_and_nor_in_order(
+static Gwn_VertBuf *mesh_batch_cache_get_vert_pos_and_nor_in_order(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
if (cache->pos_in_order == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
- VertexBuffer *vbo = cache->pos_in_order = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->pos_in_order = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = mesh_render_data_verts_len_get(rdata);
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
if (rdata->edit_bmesh) {
BMesh *bm = rdata->edit_bmesh->bm;
@@ -2069,15 +2069,15 @@ static VertexBuffer *mesh_batch_cache_get_vert_pos_and_nor_in_order(
static short no_short[3];
normal_float_to_short_v3(no_short, eve->no);
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, eve->co);
- VertexBuffer_set_attrib(vbo, attr_id.nor, i, no_short);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, eve->co);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, i, no_short);
}
BLI_assert(i == vbo_len_capacity);
}
else {
for (int i = 0; i < vbo_len_capacity; ++i) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, rdata->mvert[i].co);
- VertexBuffer_set_attrib(vbo, attr_id.nor, i, rdata->mvert[i].no);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, rdata->mvert[i].co);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, i, rdata->mvert[i].no);
}
}
}
@@ -2085,26 +2085,26 @@ static VertexBuffer *mesh_batch_cache_get_vert_pos_and_nor_in_order(
return cache->pos_in_order;
}
-static VertexFormat *edit_mesh_overlay_pos_format(unsigned int *r_pos_id)
+static Gwn_VertFormat *edit_mesh_overlay_pos_format(unsigned int *r_pos_id)
{
- static VertexFormat format_pos = { 0 };
+ static Gwn_VertFormat format_pos = { 0 };
static unsigned pos_id;
if (format_pos.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format_pos, "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format_pos, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
*r_pos_id = pos_id;
return &format_pos;
}
-static VertexFormat *edit_mesh_overlay_nor_format(unsigned int *r_vnor_id, unsigned int *r_lnor_id)
+static Gwn_VertFormat *edit_mesh_overlay_nor_format(unsigned int *r_vnor_id, unsigned int *r_lnor_id)
{
- static VertexFormat format_nor = { 0 };
- static VertexFormat format_nor_loop = { 0 };
+ static Gwn_VertFormat format_nor = { 0 };
+ static Gwn_VertFormat format_nor_loop = { 0 };
static unsigned vnor_id, vnor_loop_id, lnor_id;
if (format_nor.attrib_ct == 0) {
- vnor_id = VertexFormat_add_attrib(&format_nor, "vnor", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
- vnor_loop_id = VertexFormat_add_attrib(&format_nor_loop, "vnor", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
- lnor_id = VertexFormat_add_attrib(&format_nor_loop, "lnor", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
+ vnor_id = GWN_vertformat_attr_add(&format_nor, "vnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ vnor_loop_id = GWN_vertformat_attr_add(&format_nor_loop, "vnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ lnor_id = GWN_vertformat_attr_add(&format_nor_loop, "lnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
if (r_lnor_id) {
*r_vnor_id = vnor_loop_id;
@@ -2117,12 +2117,12 @@ static VertexFormat *edit_mesh_overlay_nor_format(unsigned int *r_vnor_id, unsig
}
}
-static VertexFormat *edit_mesh_overlay_data_format(unsigned int *r_data_id)
+static Gwn_VertFormat *edit_mesh_overlay_data_format(unsigned int *r_data_id)
{
- static VertexFormat format_flag = { 0 };
+ static Gwn_VertFormat format_flag = { 0 };
static unsigned data_id;
if (format_flag.attrib_ct == 0) {
- data_id = VertexFormat_add_attrib(&format_flag, "data", COMP_U8, 4, KEEP_INT);
+ data_id = GWN_vertformat_attr_add(&format_flag, "data", GWN_COMP_U8, 4, GWN_FETCH_INT);
}
*r_data_id = data_id;
return &format_flag;
@@ -2139,28 +2139,28 @@ static void mesh_batch_cache_create_overlay_tri_buffers(
int vbo_len_used = 0;
/* Positions */
- VertexBuffer *vbo_pos = NULL;
+ Gwn_VertBuf *vbo_pos = NULL;
static struct { uint pos, vnor, lnor, data; } attr_id;
if (cache->ed_tri_pos == NULL) {
vbo_pos = cache->ed_tri_pos =
- VertexBuffer_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
- VertexBuffer_allocate_data(vbo_pos, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
+ GWN_vertbuf_data_alloc(vbo_pos, vbo_len_capacity);
}
/* Normals */
- VertexBuffer *vbo_nor = NULL;
+ Gwn_VertBuf *vbo_nor = NULL;
if (cache->ed_tri_nor == NULL) {
vbo_nor = cache->ed_tri_nor =
- VertexBuffer_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, &attr_id.lnor));
- VertexBuffer_allocate_data(vbo_nor, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, &attr_id.lnor));
+ GWN_vertbuf_data_alloc(vbo_nor, vbo_len_capacity);
}
/* Data */
- VertexBuffer *vbo_data = NULL;
+ Gwn_VertBuf *vbo_data = NULL;
if (cache->ed_tri_data == NULL) {
vbo_data = cache->ed_tri_data =
- VertexBuffer_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
- VertexBuffer_allocate_data(vbo_data, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
+ GWN_vertbuf_data_alloc(vbo_data, vbo_len_capacity);
}
for (int i = 0; i < tri_len; i++) {
@@ -2178,13 +2178,13 @@ static void mesh_batch_cache_create_overlay_tri_buffers(
/* Finish */
if (vbo_len_used != vbo_len_capacity) {
if (vbo_pos != NULL) {
- VertexBuffer_resize_data(vbo_pos, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_pos, vbo_len_used);
}
if (vbo_nor != NULL) {
- VertexBuffer_resize_data(vbo_nor, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_nor, vbo_len_used);
}
if (vbo_data != NULL) {
- VertexBuffer_resize_data(vbo_data, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_data, vbo_len_used);
}
}
}
@@ -2200,28 +2200,28 @@ static void mesh_batch_cache_create_overlay_ledge_buffers(
int vbo_len_used = 0;
/* Positions */
- VertexBuffer *vbo_pos = NULL;
+ Gwn_VertBuf *vbo_pos = NULL;
static struct { uint pos, vnor, data; } attr_id;
if (cache->ed_ledge_pos == NULL) {
vbo_pos = cache->ed_ledge_pos =
- VertexBuffer_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
- VertexBuffer_allocate_data(vbo_pos, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
+ GWN_vertbuf_data_alloc(vbo_pos, vbo_len_capacity);
}
/* Normals */
- VertexBuffer *vbo_nor = NULL;
+ Gwn_VertBuf *vbo_nor = NULL;
if (cache->ed_ledge_nor == NULL) {
vbo_nor = cache->ed_ledge_nor =
- VertexBuffer_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, NULL));
- VertexBuffer_allocate_data(vbo_nor, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, NULL));
+ GWN_vertbuf_data_alloc(vbo_nor, vbo_len_capacity);
}
/* Data */
- VertexBuffer *vbo_data = NULL;
+ Gwn_VertBuf *vbo_data = NULL;
if (cache->ed_ledge_data == NULL) {
vbo_data = cache->ed_ledge_data =
- VertexBuffer_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
- VertexBuffer_allocate_data(vbo_data, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
+ GWN_vertbuf_data_alloc(vbo_data, vbo_len_capacity);
}
if (rdata->edit_bmesh) {
@@ -2241,13 +2241,13 @@ static void mesh_batch_cache_create_overlay_ledge_buffers(
/* Finish */
if (vbo_len_used != vbo_len_capacity) {
if (vbo_pos != NULL) {
- VertexBuffer_resize_data(vbo_pos, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_pos, vbo_len_used);
}
if (vbo_nor != NULL) {
- VertexBuffer_resize_data(vbo_nor, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_nor, vbo_len_used);
}
if (vbo_data != NULL) {
- VertexBuffer_resize_data(vbo_data, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_data, vbo_len_used);
}
}
}
@@ -2266,27 +2266,27 @@ static void mesh_batch_cache_create_overlay_lvert_buffers(
static struct { uint pos, vnor, data; } attr_id;
/* Positions */
- VertexBuffer *vbo_pos = NULL;
+ Gwn_VertBuf *vbo_pos = NULL;
if (cache->ed_lvert_pos == NULL) {
vbo_pos = cache->ed_lvert_pos =
- VertexBuffer_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
- VertexBuffer_allocate_data(vbo_pos, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
+ GWN_vertbuf_data_alloc(vbo_pos, vbo_len_capacity);
}
/* Normals */
- VertexBuffer *vbo_nor = NULL;
+ Gwn_VertBuf *vbo_nor = NULL;
if (cache->ed_lvert_nor == NULL) {
vbo_nor = cache->ed_lvert_nor =
- VertexBuffer_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, NULL));
- VertexBuffer_allocate_data(vbo_nor, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, NULL));
+ GWN_vertbuf_data_alloc(vbo_nor, vbo_len_capacity);
}
/* Data */
- VertexBuffer *vbo_data = NULL;
+ Gwn_VertBuf *vbo_data = NULL;
if (cache->ed_lvert_data == NULL) {
vbo_data = cache->ed_lvert_data =
- VertexBuffer_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
- VertexBuffer_allocate_data(vbo_data, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
+ GWN_vertbuf_data_alloc(vbo_data, vbo_len_capacity);
}
for (uint i = 0; i < lvert_len; i++) {
@@ -2301,19 +2301,19 @@ static void mesh_batch_cache_create_overlay_lvert_buffers(
/* Finish */
if (vbo_len_used != vbo_len_capacity) {
if (vbo_pos != NULL) {
- VertexBuffer_resize_data(vbo_pos, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_pos, vbo_len_used);
}
if (vbo_nor != NULL) {
- VertexBuffer_resize_data(vbo_nor, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_nor, vbo_len_used);
}
if (vbo_data != NULL) {
- VertexBuffer_resize_data(vbo_data, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_data, vbo_len_used);
}
}
}
/* Position */
-static VertexBuffer *mesh_batch_cache_get_edit_tri_pos(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_tri_pos(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2325,7 +2325,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_tri_pos(
return cache->ed_tri_pos;
}
-static VertexBuffer *mesh_batch_cache_get_edit_ledge_pos(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_ledge_pos(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2337,7 +2337,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_ledge_pos(
return cache->ed_ledge_pos;
}
-static VertexBuffer *mesh_batch_cache_get_edit_lvert_pos(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_lvert_pos(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2350,7 +2350,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_lvert_pos(
}
/* Normal */
-static VertexBuffer *mesh_batch_cache_get_edit_tri_nor(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_tri_nor(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2362,7 +2362,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_tri_nor(
return cache->ed_tri_nor;
}
-static VertexBuffer *mesh_batch_cache_get_edit_ledge_nor(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_ledge_nor(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2374,7 +2374,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_ledge_nor(
return cache->ed_ledge_nor;
}
-static VertexBuffer *mesh_batch_cache_get_edit_lvert_nor(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_lvert_nor(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2387,7 +2387,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_lvert_nor(
}
/* Data */
-static VertexBuffer *mesh_batch_cache_get_edit_tri_data(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_tri_data(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2399,7 +2399,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_tri_data(
return cache->ed_tri_data;
}
-static VertexBuffer *mesh_batch_cache_get_edit_ledge_data(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_ledge_data(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2411,7 +2411,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_ledge_data(
return cache->ed_ledge_data;
}
-static VertexBuffer *mesh_batch_cache_get_edit_lvert_data(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_lvert_data(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2423,7 +2423,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_lvert_data(
return cache->ed_lvert_data;
}
-static ElementList *mesh_batch_cache_get_edges_in_order(MeshRenderData *rdata, MeshBatchCache *cache)
+static Gwn_IndexBuf *mesh_batch_cache_get_edges_in_order(MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_EDGE));
@@ -2431,8 +2431,8 @@ static ElementList *mesh_batch_cache_get_edges_in_order(MeshRenderData *rdata, M
const int vert_len = mesh_render_data_verts_len_get(rdata);
const int edge_len = mesh_render_data_edges_len_get(rdata);
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, edge_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, edge_len, vert_len);
BLI_assert(rdata->types & MR_DATATYPE_EDGE);
@@ -2442,23 +2442,23 @@ static ElementList *mesh_batch_cache_get_edges_in_order(MeshRenderData *rdata, M
BMEdge *eed;
BM_ITER_MESH(eed, &eiter, bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- add_line_vertices(&elb, BM_elem_index_get(eed->v1), BM_elem_index_get(eed->v2));
+ GWN_indexbuf_add_line_verts(&elb, BM_elem_index_get(eed->v1), BM_elem_index_get(eed->v2));
}
}
}
else {
const MEdge *ed = rdata->medge;
for (int i = 0; i < edge_len; i++, ed++) {
- add_line_vertices(&elb, ed->v1, ed->v2);
+ GWN_indexbuf_add_line_verts(&elb, ed->v1, ed->v2);
}
}
- cache->edges_in_order = ElementList_build(&elb);
+ cache->edges_in_order = GWN_indexbuf_build(&elb);
}
return cache->edges_in_order;
}
-static ElementList *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdata, MeshBatchCache *cache)
+static Gwn_IndexBuf *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI));
@@ -2466,15 +2466,15 @@ static ElementList *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdat
const int vert_len = mesh_render_data_verts_len_get(rdata);
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, tri_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, tri_len, vert_len);
if (rdata->edit_bmesh) {
for (int i = 0; i < tri_len; ++i) {
const BMLoop **ltri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
if (!BM_elem_flag_test(ltri[0]->f, BM_ELEM_HIDDEN)) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- add_generic_vertex(&elb, BM_elem_index_get(ltri[tri_corner]->v));
+ GWN_indexbuf_add_generic_vert(&elb, BM_elem_index_get(ltri[tri_corner]->v));
}
}
}
@@ -2483,17 +2483,17 @@ static ElementList *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdat
for (int i = 0; i < tri_len; ++i) {
const MLoopTri *mlt = &rdata->mlooptri[i];
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- add_generic_vertex(&elb, mlt->tri[tri_corner]);
+ GWN_indexbuf_add_generic_vert(&elb, mlt->tri[tri_corner]);
}
}
}
- cache->triangles_in_order = ElementList_build(&elb);
+ cache->triangles_in_order = GWN_indexbuf_build(&elb);
}
return cache->triangles_in_order;
}
-static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
+static Gwn_IndexBuf **mesh_batch_cache_get_triangles_in_order_split_by_material(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_POLY));
@@ -2505,7 +2505,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
int *mat_tri_len = MEM_callocN(sizeof(*mat_tri_len) * mat_len, __func__);
cache->shaded_triangles_in_order = MEM_callocN(sizeof(*cache->shaded_triangles) * mat_len, __func__);
- ElementListBuilder *elb = MEM_callocN(sizeof(*elb) * mat_len, __func__);
+ Gwn_IndexBufBuilder *elb = MEM_callocN(sizeof(*elb) * mat_len, __func__);
/* Note that polygons (not triangles) are used here.
* This OK because result is _guaranteed_ to be the same. */
@@ -2531,7 +2531,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
/* Init ELBs. */
for (int i = 0; i < mat_len; ++i) {
- ElementListBuilder_init(&elb[i], PRIM_TRIANGLES, mat_tri_len[i], tri_len * 3);
+ GWN_indexbuf_init(&elb[i], GWN_PRIM_TRIS, mat_tri_len[i], tri_len * 3);
}
/* Populate ELBs. */
@@ -2545,7 +2545,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
const short ma_id = efa->mat_nr < mat_len ? efa->mat_nr : 0;
for (int j = 2; j < efa->len; j++) {
- add_triangle_vertices(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
+ GWN_indexbuf_add_tri_verts(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
nidx += 3;
}
}
@@ -2556,7 +2556,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
const MPoly *mp = &rdata->mpoly[i]; ;
const short ma_id = mp->mat_nr < mat_len ? mp->mat_nr : 0;
for (int j = 2; j < mp->totloop; j++) {
- add_triangle_vertices(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
+ GWN_indexbuf_add_tri_verts(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
nidx += 3;
}
}
@@ -2564,7 +2564,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
/* Build ELBs. */
for (int i = 0; i < mat_len; ++i) {
- cache->shaded_triangles_in_order[i] = ElementList_build(&elb[i]);
+ cache->shaded_triangles_in_order[i] = GWN_indexbuf_build(&elb[i]);
}
MEM_freeN(mat_tri_len);
@@ -2574,7 +2574,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
return cache->shaded_triangles_in_order;
}
-static VertexBuffer *mesh_batch_cache_get_edge_pos_with_sel(
+static Gwn_VertBuf *mesh_batch_cache_get_edge_pos_with_sel(
MeshRenderData *rdata, MeshBatchCache *cache, bool use_wire, bool use_select_bool)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP));
@@ -2583,20 +2583,20 @@ static VertexBuffer *mesh_batch_cache_get_edge_pos_with_sel(
if (!cache->edge_pos_with_select_bool) {
unsigned int vidx = 0, cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, sel; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.sel = VertexFormat_add_attrib(&format, "select", COMP_U8, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.sel = GWN_vertformat_attr_add(&format, "select", GWN_COMP_U8, 1, GWN_FETCH_INT);
}
const int edge_len = mesh_render_data_edges_len_get(rdata);
- VertexBuffer *vbo = cache->edge_pos_with_select_bool = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->edge_pos_with_select_bool = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = edge_len * 2;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
if (use_select_bool) {
mesh_render_data_ensure_edge_select_bool(rdata, use_wire);
@@ -2617,23 +2617,23 @@ static VertexBuffer *mesh_batch_cache_get_edge_pos_with_sel(
continue;
}
- VertexBuffer_set_attrib(vbo, attr_id.sel, cidx++, &edge_vert_sel);
- VertexBuffer_set_attrib(vbo, attr_id.sel, cidx++, &edge_vert_sel);
+ GWN_vertbuf_attr_set(vbo, attr_id.sel, cidx++, &edge_vert_sel);
+ GWN_vertbuf_attr_set(vbo, attr_id.sel, cidx++, &edge_vert_sel);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, rdata->mvert[ed->v1].co);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, rdata->mvert[ed->v2].co);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, rdata->mvert[ed->v1].co);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, rdata->mvert[ed->v2].co);
}
vbo_len_used = vidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return cache->edge_pos_with_select_bool;
}
-static ElementList *mesh_batch_cache_get_tri_overlay_weight_faces(
+static Gwn_IndexBuf *mesh_batch_cache_get_tri_overlay_weight_faces(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI));
@@ -2642,18 +2642,18 @@ static ElementList *mesh_batch_cache_get_tri_overlay_weight_faces(
const int vert_len = mesh_render_data_verts_len_get(rdata);
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, tri_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, tri_len, vert_len);
for (int i = 0; i < tri_len; ++i) {
const MLoopTri *mlt = &rdata->mlooptri[i];
if (!(rdata->mpoly[mlt->poly].flag & (ME_FACE_SEL | ME_HIDE))) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- add_generic_vertex(&elb, rdata->mloop[mlt->tri[tri_corner]].v);
+ GWN_indexbuf_add_generic_vert(&elb, rdata->mloop[mlt->tri[tri_corner]].v);
}
}
}
- cache->overlay_triangles_vpaint = ElementList_build(&elb);
+ cache->overlay_triangles_vpaint = GWN_indexbuf_build(&elb);
}
return cache->overlay_triangles_vpaint;
@@ -2662,7 +2662,7 @@ static ElementList *mesh_batch_cache_get_tri_overlay_weight_faces(
/**
* Non-edit mode vertices (only used for weight-paint mode).
*/
-static VertexBuffer *mesh_batch_cache_get_vert_pos_with_overlay_data(
+static Gwn_VertBuf *mesh_batch_cache_get_vert_pos_with_overlay_data(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT));
@@ -2671,29 +2671,29 @@ static VertexBuffer *mesh_batch_cache_get_vert_pos_with_overlay_data(
if (cache->pos_with_select_bool == NULL) {
unsigned int cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint data; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_I8, 1, KEEP_INT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_I8, 1, GWN_FETCH_INT);
}
const int vert_len = mesh_render_data_verts_len_get(rdata);
- VertexBuffer *vbo = cache->pos_with_select_bool = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->pos_with_select_bool = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = vert_len;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < vert_len; i++) {
const MVert *mv = &rdata->mvert[i];
const char data = mv->flag & (SELECT | ME_HIDE);
- VertexBuffer_set_attrib(vbo, attr_id.data, cidx++, &data);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, cidx++, &data);
}
vbo_len_used = cidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
@@ -2708,7 +2708,7 @@ static VertexBuffer *mesh_batch_cache_get_vert_pos_with_overlay_data(
/** \name Public API
* \{ */
-Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2717,8 +2717,8 @@ Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_EDGE;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->all_edges = Batch_create(
- PRIM_LINES, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
+ cache->all_edges = GWN_batch_create(
+ GWN_PRIM_LINES, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
mesh_batch_cache_get_edges_in_order(rdata, cache));
mesh_render_data_free(rdata);
@@ -2727,7 +2727,7 @@ Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
return cache->all_edges;
}
-Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2736,8 +2736,8 @@ Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->all_triangles = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
+ cache->all_triangles = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
mesh_batch_cache_get_triangles_in_order(rdata, cache));
mesh_render_data_free(rdata);
@@ -2746,7 +2746,7 @@ Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
return cache->all_triangles;
}
-Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2754,8 +2754,8 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->triangles_with_normals = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_tri_pos_and_normals(rdata, cache), NULL);
+ cache->triangles_with_normals = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_tri_pos_and_normals(rdata, cache), NULL);
mesh_render_data_free(rdata);
}
@@ -2763,7 +2763,7 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
return cache->triangles_with_normals;
}
-Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int defgroup)
+Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int defgroup)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2773,14 +2773,14 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int
MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_DVERT;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->triangles_with_weights = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_tri_weights(rdata, cache, use_hide, defgroup), NULL);
+ cache->triangles_with_weights = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_tri_weights(rdata, cache, use_hide, defgroup), NULL);
- VertexBuffer *vbo_tris = use_hide ?
+ Gwn_VertBuf *vbo_tris = use_hide ?
mesh_batch_cache_get_tri_pos_and_normals_visible_only(rdata, cache) :
mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
- Batch_add_VertexBuffer(cache->triangles_with_weights, vbo_tris);
+ GWN_batch_vertbuf_add(cache->triangles_with_weights, vbo_tris);
mesh_render_data_free(rdata);
}
@@ -2788,7 +2788,7 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int
return cache->triangles_with_weights;
}
-Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2798,13 +2798,13 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(Mesh *me)
MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPCOL;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->triangles_with_vert_colors = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_tri_vert_colors(rdata, cache, use_hide), NULL);
+ cache->triangles_with_vert_colors = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_tri_vert_colors(rdata, cache, use_hide), NULL);
- VertexBuffer *vbo_tris = use_hide ?
+ Gwn_VertBuf *vbo_tris = use_hide ?
mesh_batch_cache_get_tri_pos_and_normals_visible_only(rdata, cache) :
mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
- Batch_add_VertexBuffer(cache->triangles_with_vert_colors, vbo_tris);
+ GWN_batch_vertbuf_add(cache->triangles_with_vert_colors, vbo_tris);
mesh_render_data_free(rdata);
}
@@ -2813,7 +2813,7 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(Mesh *me)
}
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide)
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2822,13 +2822,13 @@ struct Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me,
MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->triangles_with_select_id = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_tri_select_id(rdata, cache, use_hide), NULL);
+ cache->triangles_with_select_id = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_tri_select_id(rdata, cache, use_hide), NULL);
- VertexBuffer *vbo_tris = use_hide ?
+ Gwn_VertBuf *vbo_tris = use_hide ?
mesh_batch_cache_get_tri_pos_and_normals_visible_only(rdata, cache) :
mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
- Batch_add_VertexBuffer(cache->triangles_with_select_id, vbo_tris);
+ GWN_batch_vertbuf_add(cache->triangles_with_select_id, vbo_tris);
mesh_render_data_free(rdata);
}
@@ -2836,7 +2836,7 @@ struct Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me,
return cache->triangles_with_select_id;
}
-Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2844,8 +2844,8 @@ Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->points_with_normals = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_tri_pos_and_normals(rdata, cache), NULL);
+ cache->points_with_normals = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_tri_pos_and_normals(rdata, cache), NULL);
mesh_render_data_free(rdata);
}
@@ -2853,7 +2853,7 @@ Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
return cache->points_with_normals;
}
-Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2861,8 +2861,8 @@ Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
/* create batch from DM */
MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT);
- cache->all_verts = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache), NULL);
+ cache->all_verts = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache), NULL);
mesh_render_data_free(rdata);
}
@@ -2870,21 +2870,21 @@ Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
return cache->all_verts;
}
-Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
if (cache->fancy_edges == NULL) {
/* create batch from DM */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
MeshRenderData *rdata = mesh_render_data_create(
me, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_POLY);
@@ -2893,7 +2893,7 @@ Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
const int vbo_len_capacity = edge_len * 2; /* these are PRIM_LINE verts, not mesh verts */
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < edge_len; ++i) {
float *vcos1, *vcos2;
float *pnor1 = NULL, *pnor2 = NULL;
@@ -2912,22 +2912,22 @@ Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
const PackedNormal *n1 = &n1value;
const PackedNormal *n2 = &n2value;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 2 * i, vcos1);
- VertexBuffer_set_attrib(vbo, attr_id.n1, 2 * i, n1);
- VertexBuffer_set_attrib(vbo, attr_id.n2, 2 * i, n2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 2 * i, vcos1);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, 2 * i, n1);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, 2 * i, n2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 2 * i + 1, vcos2);
- VertexBuffer_set_attrib(vbo, attr_id.n1, 2 * i + 1, n1);
- VertexBuffer_set_attrib(vbo, attr_id.n2, 2 * i + 1, n2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 2 * i + 1, vcos2);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, 2 * i + 1, n1);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, 2 * i + 1, n2);
vbo_len_used += 2;
}
}
if (vbo_len_used != vbo_len_capacity) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
- cache->fancy_edges = Batch_create(PRIM_LINES, vbo, NULL);
+ cache->fancy_edges = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
mesh_render_data_free(rdata);
}
@@ -2948,42 +2948,42 @@ static void mesh_batch_cache_create_overlay_batches(Mesh *me)
MeshRenderData *rdata = mesh_render_data_create(me, options);
if (cache->overlay_triangles == NULL) {
- cache->overlay_triangles = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_edit_tri_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_triangles, mesh_batch_cache_get_edit_tri_nor(rdata, cache));
- Batch_add_VertexBuffer(cache->overlay_triangles, mesh_batch_cache_get_edit_tri_data(rdata, cache));
+ cache->overlay_triangles = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_edit_tri_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_triangles, mesh_batch_cache_get_edit_tri_nor(rdata, cache));
+ GWN_batch_vertbuf_add(cache->overlay_triangles, mesh_batch_cache_get_edit_tri_data(rdata, cache));
}
if (cache->overlay_loose_edges == NULL) {
- cache->overlay_loose_edges = Batch_create(
- PRIM_LINES, mesh_batch_cache_get_edit_ledge_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_loose_edges, mesh_batch_cache_get_edit_ledge_nor(rdata, cache));
- Batch_add_VertexBuffer(cache->overlay_loose_edges, mesh_batch_cache_get_edit_ledge_data(rdata, cache));
+ cache->overlay_loose_edges = GWN_batch_create(
+ GWN_PRIM_LINES, mesh_batch_cache_get_edit_ledge_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_loose_edges, mesh_batch_cache_get_edit_ledge_nor(rdata, cache));
+ GWN_batch_vertbuf_add(cache->overlay_loose_edges, mesh_batch_cache_get_edit_ledge_data(rdata, cache));
}
if (cache->overlay_loose_verts == NULL) {
- cache->overlay_loose_verts = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_edit_lvert_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_loose_verts, mesh_batch_cache_get_edit_lvert_nor(rdata, cache));
- Batch_add_VertexBuffer(cache->overlay_loose_verts, mesh_batch_cache_get_edit_lvert_data(rdata, cache));
+ cache->overlay_loose_verts = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_edit_lvert_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_loose_verts, mesh_batch_cache_get_edit_lvert_nor(rdata, cache));
+ GWN_batch_vertbuf_add(cache->overlay_loose_verts, mesh_batch_cache_get_edit_lvert_data(rdata, cache));
}
if (cache->overlay_triangles_nor == NULL) {
- cache->overlay_triangles_nor = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_edit_tri_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_triangles_nor, mesh_batch_cache_get_edit_tri_nor(rdata, cache));
+ cache->overlay_triangles_nor = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_edit_tri_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_triangles_nor, mesh_batch_cache_get_edit_tri_nor(rdata, cache));
}
if (cache->overlay_loose_edges_nor == NULL) {
- cache->overlay_loose_edges_nor = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_edit_ledge_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_loose_edges_nor, mesh_batch_cache_get_edit_ledge_nor(rdata, cache));
+ cache->overlay_loose_edges_nor = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_edit_ledge_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_loose_edges_nor, mesh_batch_cache_get_edit_ledge_nor(rdata, cache));
}
mesh_render_data_free(rdata);
}
-Batch *DRW_mesh_batch_cache_get_overlay_triangles(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_triangles(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2994,7 +2994,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_triangles(Mesh *me)
return cache->overlay_triangles;
}
-Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3005,7 +3005,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
return cache->overlay_loose_edges;
}
-Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3016,7 +3016,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
return cache->overlay_loose_verts;
}
-Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3027,7 +3027,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(Mesh *me)
return cache->overlay_triangles_nor;
}
-Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3038,25 +3038,25 @@ Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(Mesh *me)
return cache->overlay_loose_edges_nor;
}
-Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
if (cache->overlay_facedots == NULL) {
MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY);
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, data; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.data = VertexFormat_add_attrib(&format, "norAndFlag", COMP_I10, 4, NORMALIZE_INT_TO_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "norAndFlag", GWN_COMP_I10, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
const int vbo_len_capacity = mesh_render_data_polys_len_get(rdata);
int vidx = 0;
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < vbo_len_capacity; ++i) {
float pcenter[3], pnor[3];
bool selected = false;
@@ -3066,9 +3066,9 @@ Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
PackedNormal nor = { .x = 0, .y = 0, .z = -511 };
nor = convert_i10_v3(pnor);
nor.w = selected ? 1 : 0;
- VertexBuffer_set_attrib(vbo, attr_id.data, vidx, &nor);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vidx, &nor);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx, pcenter);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx, pcenter);
vidx += 1;
@@ -3076,10 +3076,10 @@ Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
}
const int vbo_len_used = vidx;
if (vbo_len_used != vbo_len_capacity) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
- cache->overlay_facedots = Batch_create(PRIM_POINTS, vbo, NULL);
+ cache->overlay_facedots = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
mesh_render_data_free(rdata);
}
@@ -3087,7 +3087,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
return cache->overlay_facedots;
}
-Batch **DRW_mesh_batch_cache_get_surface_shaded(Mesh *me)
+Gwn_Batch **DRW_mesh_batch_cache_get_surface_shaded(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3102,15 +3102,15 @@ Batch **DRW_mesh_batch_cache_get_surface_shaded(Mesh *me)
cache->shaded_triangles = MEM_callocN(sizeof(*cache->shaded_triangles) * mat_len, __func__);
- ElementList **el = mesh_batch_cache_get_triangles_in_order_split_by_material(rdata, cache);
+ Gwn_IndexBuf **el = mesh_batch_cache_get_triangles_in_order_split_by_material(rdata, cache);
- VertexBuffer *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
+ Gwn_VertBuf *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
for (int i = 0; i < mat_len; ++i) {
- cache->shaded_triangles[i] = Batch_create(
- PRIM_TRIANGLES, vbo, el[i]);
- VertexBuffer *vbo_shading = mesh_batch_cache_get_tri_shading_data(rdata, cache);
+ cache->shaded_triangles[i] = GWN_batch_create(
+ GWN_PRIM_TRIS, vbo, el[i]);
+ Gwn_VertBuf *vbo_shading = mesh_batch_cache_get_tri_shading_data(rdata, cache);
if (vbo_shading) {
- Batch_add_VertexBuffer(cache->shaded_triangles[i], vbo_shading);
+ GWN_batch_vertbuf_add(cache->shaded_triangles[i], vbo_shading);
}
}
@@ -3121,7 +3121,7 @@ Batch **DRW_mesh_batch_cache_get_surface_shaded(Mesh *me)
return cache->shaded_triangles;
}
-Batch **DRW_mesh_batch_cache_get_surface_texpaint(Mesh *me)
+Gwn_Batch **DRW_mesh_batch_cache_get_surface_texpaint(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3135,15 +3135,15 @@ Batch **DRW_mesh_batch_cache_get_surface_texpaint(Mesh *me)
cache->texpaint_triangles = MEM_callocN(sizeof(*cache->texpaint_triangles) * mat_len, __func__);
- ElementList **el = mesh_batch_cache_get_triangles_in_order_split_by_material(rdata, cache);
+ Gwn_IndexBuf **el = mesh_batch_cache_get_triangles_in_order_split_by_material(rdata, cache);
- VertexBuffer *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
+ Gwn_VertBuf *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
for (int i = 0; i < mat_len; ++i) {
- cache->texpaint_triangles[i] = Batch_create(
- PRIM_TRIANGLES, vbo, el[i]);
- VertexBuffer *vbo_uv = mesh_batch_cache_get_tri_uv_active(rdata, cache);
+ cache->texpaint_triangles[i] = GWN_batch_create(
+ GWN_PRIM_TRIS, vbo, el[i]);
+ Gwn_VertBuf *vbo_uv = mesh_batch_cache_get_tri_uv_active(rdata, cache);
if (vbo_uv) {
- Batch_add_VertexBuffer(cache->texpaint_triangles[i], vbo_uv);
+ GWN_batch_vertbuf_add(cache->texpaint_triangles[i], vbo_uv);
}
}
mesh_render_data_free(rdata);
@@ -3152,7 +3152,7 @@ Batch **DRW_mesh_batch_cache_get_surface_texpaint(Mesh *me)
return cache->texpaint_triangles;
}
-Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3162,20 +3162,20 @@ Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(Mesh *me)
MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOPUV;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- VertexBuffer *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
+ Gwn_VertBuf *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
- cache->texpaint_triangles_single = Batch_create(
- PRIM_TRIANGLES, vbo, NULL);
- VertexBuffer *vbo_uv = mesh_batch_cache_get_tri_uv_active(rdata, cache);
+ cache->texpaint_triangles_single = GWN_batch_create(
+ GWN_PRIM_TRIS, vbo, NULL);
+ Gwn_VertBuf *vbo_uv = mesh_batch_cache_get_tri_uv_active(rdata, cache);
if (vbo_uv) {
- Batch_add_VertexBuffer(cache->texpaint_triangles_single, vbo_uv);
+ GWN_batch_vertbuf_add(cache->texpaint_triangles_single, vbo_uv);
}
mesh_render_data_free(rdata);
}
return cache->texpaint_triangles_single;
}
-Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(Mesh *me, bool use_wire, bool use_sel)
+Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(Mesh *me, bool use_wire, bool use_sel)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3184,8 +3184,8 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(Mesh *me, bool use_wire, bo
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->overlay_paint_edges = Batch_create(
- PRIM_LINES, mesh_batch_cache_get_edge_pos_with_sel(rdata, cache, use_wire, use_sel), NULL);
+ cache->overlay_paint_edges = GWN_batch_create(
+ GWN_PRIM_LINES, mesh_batch_cache_get_edge_pos_with_sel(rdata, cache, use_wire, use_sel), NULL);
mesh_render_data_free(rdata);
}
@@ -3193,7 +3193,7 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(Mesh *me, bool use_wire, bo
return cache->overlay_paint_edges;
}
-Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3202,8 +3202,8 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_POLY | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->overlay_weight_faces = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
+ cache->overlay_weight_faces = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
mesh_batch_cache_get_tri_overlay_weight_faces(rdata, cache));
mesh_render_data_free(rdata);
@@ -3212,7 +3212,7 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(Mesh *me)
return cache->overlay_weight_faces;
}
-Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3220,10 +3220,10 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(Mesh *me)
/* create batch from Mesh */
MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT);
- cache->overlay_weight_verts = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache), NULL);
+ cache->overlay_weight_verts = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache), NULL);
- Batch_add_VertexBuffer(
+ GWN_batch_vertbuf_add(
cache->overlay_weight_verts,
mesh_batch_cache_get_vert_pos_with_overlay_data(rdata, cache));
mesh_render_data_free(rdata);
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index febba333a2b..6b15bd673c9 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -45,13 +45,13 @@
static void particle_batch_cache_clear(ParticleSystem *psys);
/* ---------------------------------------------------------------------- */
-/* Particle Batch Cache */
+/* Particle Gwn_Batch Cache */
typedef struct ParticleBatchCache {
- VertexBuffer *pos;
- ElementList *segments;
+ Gwn_VertBuf *pos;
+ Gwn_IndexBuf *segments;
- Batch *hairs;
+ Gwn_Batch *hairs;
int segment_count;
int point_count;
@@ -60,7 +60,7 @@ typedef struct ParticleBatchCache {
bool is_dirty;
} ParticleBatchCache;
-/* Batch cache management. */
+/* Gwn_Batch cache management. */
static bool particle_batch_cache_valid(ParticleSystem *psys)
{
@@ -125,10 +125,10 @@ static void particle_batch_cache_clear(ParticleSystem *psys)
return;
}
- BATCH_DISCARD_SAFE(cache->hairs);
+ GWN_BATCH_DISCARD_SAFE(cache->hairs);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos);
- ELEMENTLIST_DISCARD_SAFE(cache->segments);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->segments);
}
void DRW_particle_batch_cache_free(ParticleSystem *psys)
@@ -169,29 +169,29 @@ static void ensure_seg_pt_count(ParticleSystem *psys, ParticleBatchCache *cache)
}
}
-/* Batch cache usage. */
+/* Gwn_Batch cache usage. */
static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys, ParticleBatchCache *cache)
{
if (cache->pos == NULL || cache->segments == NULL) {
int curr_point = 0;
- VERTEXBUFFER_DISCARD_SAFE(cache->pos);
- ELEMENTLIST_DISCARD_SAFE(cache->segments);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->segments);
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, tan, ind; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.tan = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
- attr_id.ind = VertexFormat_add_attrib(&format, "ind", COMP_I32, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.tan = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.ind = GWN_vertformat_attr_add(&format, "ind", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
- cache->pos = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(cache->pos, cache->point_count);
+ cache->pos = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(cache->pos, cache->point_count);
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, cache->segment_count, cache->point_count);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, cache->segment_count, cache->point_count);
if (psys->pathcache && (!psys->childcache || (psys->part->draw & PART_DRAW_PARENT))) {
for (int i = 0; i < psys->totpart; i++) {
@@ -208,20 +208,20 @@ static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys, Partic
sub_v3_v3v3(tangent, path[j + 1].co, path[j - 1].co);
}
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, curr_point, path[j].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.tan, curr_point, tangent);
- VertexBuffer_set_attrib(cache->pos, attr_id.ind, curr_point, &i);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, curr_point, path[j].co);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.tan, curr_point, tangent);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.ind, curr_point, &i);
- add_line_vertices(&elb, curr_point, curr_point + 1);
+ GWN_indexbuf_add_line_verts(&elb, curr_point, curr_point + 1);
curr_point++;
}
sub_v3_v3v3(tangent, path[path->segments].co, path[path->segments - 1].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, curr_point, path[path->segments].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.tan, curr_point, tangent);
- VertexBuffer_set_attrib(cache->pos, attr_id.ind, curr_point, &i);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, curr_point, path[path->segments].co);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.tan, curr_point, tangent);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.ind, curr_point, &i);
curr_point++;
}
@@ -244,50 +244,50 @@ static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys, Partic
sub_v3_v3v3(tangent, path[j + 1].co, path[j - 1].co);
}
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, curr_point, path[j].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.tan, curr_point, tangent);
- VertexBuffer_set_attrib(cache->pos, attr_id.ind, curr_point, &x);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, curr_point, path[j].co);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.tan, curr_point, tangent);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.ind, curr_point, &x);
- add_line_vertices(&elb, curr_point, curr_point + 1);
+ GWN_indexbuf_add_line_verts(&elb, curr_point, curr_point + 1);
curr_point++;
}
sub_v3_v3v3(tangent, path[path->segments].co, path[path->segments - 1].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, curr_point, path[path->segments].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.tan, curr_point, tangent);
- VertexBuffer_set_attrib(cache->pos, attr_id.ind, curr_point, &x);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, curr_point, path[path->segments].co);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.tan, curr_point, tangent);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.ind, curr_point, &x);
curr_point++;
}
}
}
- cache->segments = ElementList_build(&elb);
+ cache->segments = GWN_indexbuf_build(&elb);
}
}
static void particle_batch_cache_ensure_pos(ParticleSystem *psys, ParticleBatchCache *cache)
{
if (cache->pos == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned pos_id, rot_id, val_id;
int i, curr_point;
ParticleData *pa;
- VERTEXBUFFER_DISCARD_SAFE(cache->pos);
- ELEMENTLIST_DISCARD_SAFE(cache->segments);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->segments);
if (format.attrib_ct == 0) {
/* initialize vertex format */
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- rot_id = VertexFormat_add_attrib(&format, "rot", COMP_F32, 4, KEEP_FLOAT);
- val_id = VertexFormat_add_attrib(&format, "val", COMP_F32, 1, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ rot_id = GWN_vertformat_attr_add(&format, "rot", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
+ val_id = GWN_vertformat_attr_add(&format, "val", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
}
- cache->pos = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(cache->pos, psys->totpart);
+ cache->pos = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(cache->pos, psys->totpart);
for (curr_point = 0, i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
if (pa->state.time >= pa->time && pa->state.time < pa->dietime &&
@@ -295,8 +295,8 @@ static void particle_batch_cache_ensure_pos(ParticleSystem *psys, ParticleBatchC
{
float val;
- VertexBuffer_set_attrib(cache->pos, pos_id, curr_point, pa->state.co);
- VertexBuffer_set_attrib(cache->pos, rot_id, curr_point, pa->state.rot);
+ GWN_vertbuf_attr_set(cache->pos, pos_id, curr_point, pa->state.co);
+ GWN_vertbuf_attr_set(cache->pos, rot_id, curr_point, pa->state.rot);
switch (psys->part->draw_col) {
case PART_DRAW_COL_VEL:
@@ -310,38 +310,38 @@ static void particle_batch_cache_ensure_pos(ParticleSystem *psys, ParticleBatchC
break;
}
- VertexBuffer_set_attrib(cache->pos, val_id, curr_point, &val);
+ GWN_vertbuf_attr_set(cache->pos, val_id, curr_point, &val);
curr_point++;
}
}
if (curr_point != psys->totpart) {
- VertexBuffer_resize_data(cache->pos, curr_point);
+ GWN_vertbuf_data_resize(cache->pos, curr_point);
}
}
}
-Batch *DRW_particles_batch_cache_get_hair(ParticleSystem *psys)
+Gwn_Batch *DRW_particles_batch_cache_get_hair(ParticleSystem *psys)
{
ParticleBatchCache *cache = particle_batch_cache_get(psys);
if (cache->hairs == NULL) {
ensure_seg_pt_count(psys, cache);
particle_batch_cache_ensure_pos_and_seg(psys, cache);
- cache->hairs = Batch_create(PRIM_LINES, cache->pos, cache->segments);
+ cache->hairs = GWN_batch_create(GWN_PRIM_LINES, cache->pos, cache->segments);
}
return cache->hairs;
}
-Batch *DRW_particles_batch_cache_get_dots(ParticleSystem *psys)
+Gwn_Batch *DRW_particles_batch_cache_get_dots(ParticleSystem *psys)
{
ParticleBatchCache *cache = particle_batch_cache_get(psys);
if (cache->hairs == NULL) {
particle_batch_cache_ensure_pos(psys, cache);
- cache->hairs = Batch_create(PRIM_POINTS, cache->pos, NULL);
+ cache->hairs = GWN_batch_create(GWN_PRIM_POINTS, cache->pos, NULL);
}
return cache->hairs;
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index f8040f28f53..c3d95d700a0 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -184,7 +184,7 @@ DRWShadingGroup *shgroup_groundpoints_uniform_color(DRWPass *pass, float color[4
return grp;
}
-DRWShadingGroup *shgroup_instance_screenspace(DRWPass *pass, struct Batch *geom, float *size)
+DRWShadingGroup *shgroup_instance_screenspace(DRWPass *pass, struct Gwn_Batch *geom, float *size)
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR);
@@ -199,7 +199,7 @@ DRWShadingGroup *shgroup_instance_screenspace(DRWPass *pass, struct Batch *geom,
return grp;
}
-DRWShadingGroup *shgroup_instance_objspace_solid(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+DRWShadingGroup *shgroup_instance_objspace_solid(DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4])
{
static float light[3] = {0.0f, 0.0f, 1.0f};
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_OBJECTSPACE_SIMPLE_LIGHTING_VARIYING_COLOR);
@@ -213,7 +213,7 @@ DRWShadingGroup *shgroup_instance_objspace_solid(DRWPass *pass, struct Batch *ge
return grp;
}
-DRWShadingGroup *shgroup_instance_objspace_wire(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+DRWShadingGroup *shgroup_instance_objspace_wire(DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4])
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_OBJECTSPACE_VARIYING_COLOR);
@@ -225,7 +225,7 @@ DRWShadingGroup *shgroup_instance_objspace_wire(DRWPass *pass, struct Batch *geo
return grp;
}
-DRWShadingGroup *shgroup_instance_screen_aligned(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_instance_screen_aligned(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED);
@@ -238,7 +238,7 @@ DRWShadingGroup *shgroup_instance_screen_aligned(DRWPass *pass, struct Batch *ge
return grp;
}
-DRWShadingGroup *shgroup_instance_axis_names(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_instance_axis_names(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED_AXIS);
@@ -251,7 +251,7 @@ DRWShadingGroup *shgroup_instance_axis_names(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE);
@@ -263,7 +263,7 @@ DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_instance(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_instance(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
@@ -275,7 +275,7 @@ DRWShadingGroup *shgroup_instance(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_CAMERA);
@@ -289,7 +289,7 @@ DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_DISTANCE_LINES);
static float point_size = 4.0f;
@@ -304,7 +304,7 @@ DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct Batch *ge
return grp;
}
-DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR);
static bool True = true;
@@ -320,7 +320,7 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_instance_bone_envelope_wire(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+DRWShadingGroup *shgroup_instance_bone_envelope_wire(DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4])
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_WIRE);
@@ -335,7 +335,7 @@ DRWShadingGroup *shgroup_instance_bone_envelope_wire(DRWPass *pass, struct Batch
return grp;
}
-DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4])
{
static float light[3] = {0.0f, 0.0f, 1.0f};
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_SOLID);
diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h
index 2c597a175ff..a6c9b24af7d 100644
--- a/source/blender/draw/intern/draw_common.h
+++ b/source/blender/draw/intern/draw_common.h
@@ -28,7 +28,7 @@
struct DRWPass;
struct DRWShadingGroup;
-struct Batch;
+struct Gwn_Batch;
struct Object;
struct SceneLayer;
@@ -91,19 +91,19 @@ struct DRWShadingGroup *shgroup_dynlines_uniform_color(struct DRWPass *pass, flo
struct DRWShadingGroup *shgroup_dynpoints_uniform_color(struct DRWPass *pass, float color[4], float *size);
struct DRWShadingGroup *shgroup_groundlines_uniform_color(struct DRWPass *pass, float color[4]);
struct DRWShadingGroup *shgroup_groundpoints_uniform_color(struct DRWPass *pass, float color[4]);
-struct DRWShadingGroup *shgroup_instance_screenspace(struct DRWPass *pass, struct Batch *geom, float *size);
-struct DRWShadingGroup *shgroup_instance_objspace_solid(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]);
-struct DRWShadingGroup *shgroup_instance_objspace_wire(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]);
-struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance_axis_names(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance_image_plane(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance_bone_envelope_wire(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]);
-struct DRWShadingGroup *shgroup_instance_bone_envelope_solid(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]);
+struct DRWShadingGroup *shgroup_instance_screenspace(struct DRWPass *pass, struct Gwn_Batch *geom, float *size);
+struct DRWShadingGroup *shgroup_instance_objspace_solid(struct DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4]);
+struct DRWShadingGroup *shgroup_instance_objspace_wire(struct DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4]);
+struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_axis_names(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_image_plane(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_bone_envelope_wire(struct DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4]);
+struct DRWShadingGroup *shgroup_instance_bone_envelope_solid(struct DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4]);
int DRW_object_wire_theme_get(struct Object *ob, struct SceneLayer *sl, float **r_color);
float *DRW_color_background_blend_get(int theme_id);
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index f1a870992dc..bebb9fce590 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -181,10 +181,10 @@ struct DRWInterface {
/* UBO */
int ubo_bind; /* next ubo binding point */
/* Dynamic batch */
- Batch *instance_batch; /* contains instances attributes */
+ Gwn_Batch *instance_batch; /* contains instances attributes */
GLuint instance_vbo; /* same as instance_batch but generated from DRWCalls */
int instance_count;
- VertexFormat vbo_format;
+ Gwn_VertFormat vbo_format;
};
struct DRWPass {
@@ -211,7 +211,7 @@ typedef struct DRWCall {
DRWCallHeader head;
float obmat[4][4];
- Batch *geometry;
+ Gwn_Batch *geometry;
Object *ob; /* Optional */
ID *ob_data; /* Optional. */
@@ -241,8 +241,8 @@ struct DRWShadingGroup {
DRWState state_extra; /* State changes for this batch only (or'd with the pass's state) */
int type;
- Batch *instance_geom; /* Geometry to instance */
- Batch *batch_geom; /* Result of call batching */
+ Gwn_Batch *instance_geom; /* Geometry to instance */
+ Gwn_Batch *batch_geom; /* Result of call batching */
#ifdef USE_GPU_SELECT
/* backlink to pass we're in */
@@ -600,7 +600,7 @@ static DRWInterface *DRW_interface_create(GPUShader *shader)
interface->tex_bind = GPU_max_textures() - 1;
interface->ubo_bind = GPU_max_ubo_binds() - 1;
- memset(&interface->vbo_format, 0, sizeof(VertexFormat));
+ memset(&interface->vbo_format, 0, sizeof(Gwn_VertFormat));
BLI_listbase_clear(&interface->uniforms);
BLI_listbase_clear(&interface->attribs);
@@ -773,7 +773,7 @@ DRWShadingGroup *DRW_shgroup_material_create(struct GPUMaterial *material, DRWPa
return grp;
}
-DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *material, DRWPass *pass, Batch *geom)
+DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *material, DRWPass *pass, Gwn_Batch *geom)
{
DRWShadingGroup *shgroup = DRW_shgroup_material_create(material, pass);
@@ -785,7 +785,7 @@ DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *materi
return shgroup;
}
-DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, Batch *geom)
+DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, Gwn_Batch *geom)
{
DRWShadingGroup *shgroup = DRW_shgroup_create(shader, pass);
@@ -846,7 +846,7 @@ void DRW_shgroup_free(struct DRWShadingGroup *shgroup)
BATCH_DISCARD_ALL_SAFE(shgroup->batch_geom);
}
-void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Batch *instances)
+void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Gwn_Batch *instances)
{
BLI_assert(shgroup->type == DRW_SHG_INSTANCE);
BLI_assert(shgroup->interface->instance_batch == NULL);
@@ -854,7 +854,7 @@ void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Batch *instance
shgroup->interface->instance_batch = instances;
}
-void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Batch *geom, float (*obmat)[4])
+void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Gwn_Batch *geom, float (*obmat)[4])
{
BLI_assert(geom != NULL);
@@ -874,7 +874,7 @@ void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Batch *geom, float (*obmat)[
BLI_addtail(&shgroup->calls, call);
}
-void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, Batch *geom, Object *ob)
+void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, Gwn_Batch *geom, Object *ob)
{
BLI_assert(geom != NULL);
@@ -918,7 +918,7 @@ void DRW_shgroup_call_generate_add(
static void sculpt_draw_cb(
DRWShadingGroup *shgroup,
- void (*draw_fn)(DRWShadingGroup *shgroup, Batch *geom),
+ void (*draw_fn)(DRWShadingGroup *shgroup, Gwn_Batch *geom),
void *user_data)
{
Object *ob = user_data;
@@ -927,7 +927,7 @@ static void sculpt_draw_cb(
if (pbvh) {
BKE_pbvh_draw_cb(
pbvh, NULL, NULL, false,
- (void (*)(void *, Batch *))draw_fn, shgroup);
+ (void (*)(void *, Gwn_Batch *))draw_fn, shgroup);
}
}
@@ -1106,8 +1106,8 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup)
DRWInterface *interface = shgroup->interface;
int nbr = interface->instance_count;
- PrimitiveType type = (shgroup->type == DRW_SHG_POINT_BATCH) ? PRIM_POINTS :
- (shgroup->type == DRW_SHG_TRIANGLE_BATCH) ? PRIM_TRIANGLES : PRIM_LINES;
+ Gwn_PrimType type = (shgroup->type == DRW_SHG_POINT_BATCH) ? GWN_PRIM_POINTS :
+ (shgroup->type == DRW_SHG_TRIANGLE_BATCH) ? GWN_PRIM_TRIS : GWN_PRIM_LINES;
if (nbr == 0)
return;
@@ -1117,12 +1117,12 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup)
for (DRWAttrib *attrib = interface->attribs.first; attrib; attrib = attrib->next) {
BLI_assert(attrib->size <= 4); /* matrices have no place here for now */
if (attrib->type == DRW_ATTRIB_FLOAT) {
- attrib->format_id = VertexFormat_add_attrib(
- &interface->vbo_format, attrib->name, COMP_F32, attrib->size, KEEP_FLOAT);
+ attrib->format_id = GWN_vertformat_attr_add(
+ &interface->vbo_format, attrib->name, GWN_COMP_F32, attrib->size, GWN_FETCH_FLOAT);
}
else if (attrib->type == DRW_ATTRIB_INT) {
- attrib->format_id = VertexFormat_add_attrib(
- &interface->vbo_format, attrib->name, COMP_I8, attrib->size, KEEP_INT);
+ attrib->format_id = GWN_vertformat_attr_add(
+ &interface->vbo_format, attrib->name, GWN_COMP_I8, attrib->size, GWN_FETCH_INT);
}
else {
BLI_assert(false);
@@ -1130,22 +1130,22 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup)
}
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&interface->vbo_format);
- VertexBuffer_allocate_data(vbo, nbr);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&interface->vbo_format);
+ GWN_vertbuf_data_alloc(vbo, nbr);
int j = 0;
for (DRWCallDynamic *call = shgroup->calls.first; call; call = call->head.next, j++) {
int i = 0;
for (DRWAttrib *attrib = interface->attribs.first; attrib; attrib = attrib->next, i++) {
- VertexBuffer_set_attrib(vbo, attrib->format_id, j, call->data[i]);
+ GWN_vertbuf_attr_set(vbo, attrib->format_id, j, call->data[i]);
}
}
/* TODO make the batch dynamic instead of freeing it every times */
if (shgroup->batch_geom)
- Batch_discard_all(shgroup->batch_geom);
+ GWN_batch_discard_all(shgroup->batch_geom);
- shgroup->batch_geom = Batch_create(type, vbo, NULL);
+ shgroup->batch_geom = GWN_batch_create(type, vbo, NULL);
}
static void shgroup_dynamic_instance(DRWShadingGroup *shgroup)
@@ -1630,24 +1630,24 @@ static void draw_geometry_prepare(
GPU_shader_uniform_vector(shgroup->shader, interface->clipplanes, 4, DST.num_clip_planes, (float *)DST.clip_planes_eq);
}
-static void draw_geometry_execute(DRWShadingGroup *shgroup, Batch *geom)
+static void draw_geometry_execute(DRWShadingGroup *shgroup, Gwn_Batch *geom)
{
DRWInterface *interface = shgroup->interface;
/* step 2 : bind vertex array & draw */
- Batch_set_program(geom, GPU_shader_get_program(shgroup->shader), GPU_shader_get_interface(shgroup->shader));
+ GWN_batch_program_set(geom, GPU_shader_get_program(shgroup->shader), GPU_shader_get_interface(shgroup->shader));
if (interface->instance_batch) {
- Batch_draw_stupid_instanced_with_batch(geom, interface->instance_batch);
+ GWN_batch_draw_stupid_instanced_with_batch(geom, interface->instance_batch);
}
else if (interface->instance_vbo) {
- Batch_draw_stupid_instanced(geom, interface->instance_vbo, interface->instance_count, interface->attribs_count,
+ GWN_batch_draw_stupid_instanced(geom, interface->instance_vbo, interface->instance_count, interface->attribs_count,
interface->attribs_stride, interface->attribs_size, interface->attribs_loc);
}
else {
- Batch_draw_stupid(geom);
+ GWN_batch_draw_stupid(geom);
}
}
-static void draw_geometry(DRWShadingGroup *shgroup, Batch *geom, const float (*obmat)[4], ID *ob_data)
+static void draw_geometry(DRWShadingGroup *shgroup, Gwn_Batch *geom, const float (*obmat)[4], ID *ob_data)
{
float *texcoloc = NULL;
float *texcosize = NULL;
@@ -2143,9 +2143,9 @@ void DRW_transform_to_display(GPUTexture *tex)
{
DRW_state_set(DRW_STATE_WRITE_COLOR);
- VertexFormat *vert_format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(vert_format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texco = VertexFormat_add_attrib(vert_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *vert_format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(vert_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texco = GWN_vertformat_attr_add(vert_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
const float dither = 1.0f;
@@ -2167,7 +2167,7 @@ void DRW_transform_to_display(GPUTexture *tex)
immUniformMatrix4fv("ModelViewProjectionMatrix", mat);
/* Full screen triangle */
- immBegin(PRIM_TRIANGLES, 3);
+ immBegin(GWN_PRIM_TRIS, 3);
immAttrib2f(texco, 0.0f, 0.0f);
immVertex2f(pos, -1.0f, -1.0f);
@@ -2889,7 +2889,7 @@ static void DRW_debug_gpu_stats(void)
/* Memory Stats */
unsigned int tex_mem = GPU_texture_memory_usage_get();
- unsigned int vbo_mem = VertexBuffer_get_memory_usage();
+ unsigned int vbo_mem = GWN_vertbuf_get_memory_usage();
sprintf(pass_name, "GPU Memory");
draw_stat(&rect, 0, v, pass_name, sizeof(pass_name));
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index b4d0a9309dd..6d7fcc61702 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -211,9 +211,9 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
glDepthMask(GL_FALSE); /* disable write in zbuffer */
#endif
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
@@ -250,7 +250,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
if (gridline_ct == 0)
goto drawgrid_cleanup; /* nothing to draw */
- immBegin(PRIM_LINES, gridline_ct * 2);
+ immBegin(GWN_PRIM_LINES, gridline_ct * 2);
}
float blend_fac = 1.0f - ((GRID_MIN_PX_F * 2.0f) / (float)dx_scalar);
@@ -303,7 +303,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
if (gridline_ct == 0)
goto drawgrid_cleanup; /* nothing to draw */
- immBegin(PRIM_LINES, gridline_ct * 2);
+ immBegin(GWN_PRIM_LINES, gridline_ct * 2);
if (grids_to_draw == 2) {
UI_GetThemeColorBlend3ubv(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0), col2);
@@ -378,13 +378,13 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
unsigned char col_bg[3], col_grid_emphasise[3], col_grid_light[3];
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBegin(PRIM_LINES, vertex_ct);
+ immBegin(GWN_PRIM_LINES, vertex_ct);
/* draw normal grid lines */
UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
@@ -466,12 +466,12 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
if (show_axis_x || show_axis_y || show_axis_z) {
/* draw axis lines -- sometimes grid floor is off, other times we still need to draw the Z axis */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBegin(PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
+ immBegin(GWN_PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
if (show_axis_x) {
UI_make_axis_color(col_grid, col_axis, 'X');
@@ -570,9 +570,9 @@ void DRW_draw_background(void)
/* Gradient background Color */
glDisable(GL_DEPTH_TEST);
- VertexFormat *format = immVertexFormat();
- unsigned pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
unsigned char col_hi[3], col_lo[3];
gpuPushMatrix();
@@ -584,7 +584,7 @@ void DRW_draw_background(void)
UI_GetThemeColor3ubv(TH_LOW_GRAD, col_lo);
UI_GetThemeColor3ubv(TH_HIGH_GRAD, col_hi);
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib3ubv(color, col_lo);
immVertex2f(pos, -1.0f, -1.0f);
immVertex2f(pos, 1.0f, -1.0f);
@@ -662,10 +662,10 @@ void DRW_draw_cursor(void)
const float f10 = 0.5f;
const float f20 = 1.0f;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
- unsigned int wpos = VertexFormat_add_attrib(format, "world_pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ unsigned int wpos = GWN_vertformat_attr_add(format, "world_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* XXX Using instance shader without instance */
immBindBuiltinProgram(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR);
@@ -676,7 +676,7 @@ void DRW_draw_cursor(void)
const int segments = 16;
- immBegin(PRIM_LINE_LOOP, segments);
+ immBegin(GWN_PRIM_LINE_LOOP, segments);
immAttrib3fv(wpos, co);
for (int i = 0; i < segments; ++i) {
@@ -695,7 +695,7 @@ void DRW_draw_cursor(void)
UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immAttrib3ubv(color, crosshair_color);
immAttrib3fv(wpos, co);
diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c
index ae3201fa297..dc81725d19a 100644
--- a/source/blender/draw/modes/edit_curve_mode.c
+++ b/source/blender/draw/modes/edit_curve_mode.c
@@ -222,7 +222,7 @@ static void EDIT_CURVE_cache_populate(void *vedata, Object *ob)
if (ob == obedit) {
Curve *cu = ob->data;
/* Get geometry cache */
- struct Batch *geom;
+ struct Gwn_Batch *geom;
geom = DRW_cache_curve_edge_wire_get(ob);
DRW_shgroup_call_add(stl->g_data->wire_shgrp, geom, ob->obmat);
diff --git a/source/blender/draw/modes/edit_lattice_mode.c b/source/blender/draw/modes/edit_lattice_mode.c
index 2993719ee1c..b3a20075f0e 100644
--- a/source/blender/draw/modes/edit_lattice_mode.c
+++ b/source/blender/draw/modes/edit_lattice_mode.c
@@ -194,7 +194,7 @@ static void EDIT_LATTICE_cache_populate(void *vedata, Object *ob)
if (ob->type == OB_LATTICE) {
if (ob == obedit) {
/* Get geometry cache */
- struct Batch *geom;
+ struct Gwn_Batch *geom;
geom = DRW_cache_lattice_wire_get(ob);
DRW_shgroup_call_add(stl->g_data->wire_shgrp, geom, ob->obmat);
diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c
index 286d277f0e3..c06a2976ac7 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -381,7 +381,7 @@ static void EDIT_MESH_cache_init(void *vedata)
DRW_shgroup_uniform_block(stl->g_data->facefill_occluded_shgrp, "globalsBlock", globals_ubo);
/* we need a full screen pass to combine the result */
- struct Batch *quad = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
psl->mix_occlude = DRW_pass_create(
"Mix Occluded Wires",
@@ -399,7 +399,7 @@ static void edit_mesh_add_ob_to_pass(
Scene *scene, Object *ob, DRWShadingGroup *face_shgrp, DRWShadingGroup *ledges_shgrp,
DRWShadingGroup *lverts_shgrp, DRWShadingGroup *facedot_shgrp, DRWShadingGroup *facefill_shgrp)
{
- struct Batch *geo_ovl_tris, *geo_ovl_ledges, *geo_ovl_lverts, *geo_ovl_fcenter;
+ struct Gwn_Batch *geo_ovl_tris, *geo_ovl_ledges, *geo_ovl_lverts, *geo_ovl_fcenter;
ToolSettings *tsettings = scene->toolsettings;
DRW_cache_mesh_wire_overlay_get(ob, &geo_ovl_tris, &geo_ovl_ledges, &geo_ovl_lverts);
@@ -427,7 +427,7 @@ static void EDIT_MESH_cache_populate(void *vedata, Object *ob)
View3D *v3d = draw_ctx->v3d;
Scene *scene = draw_ctx->scene;
Object *obedit = scene->obedit;
- struct Batch *geom;
+ struct Gwn_Batch *geom;
if (ob->type == OB_MESH) {
if (ob == obedit) {
@@ -462,7 +462,7 @@ static void EDIT_MESH_cache_populate(void *vedata, Object *ob)
}
if (vnormals_do || lnormals_do) {
- struct Batch *geo_ovl_tris, *geo_ovl_ledges, *geo_ovl_lverts;
+ struct Gwn_Batch *geo_ovl_tris, *geo_ovl_ledges, *geo_ovl_lverts;
DRW_cache_mesh_normals_overlay_get(ob, &geo_ovl_tris, &geo_ovl_ledges, &geo_ovl_lverts);
if (vnormals_do) {
diff --git a/source/blender/draw/modes/edit_metaball_mode.c b/source/blender/draw/modes/edit_metaball_mode.c
index a5857ba362a..4e9e1cb5b56 100644
--- a/source/blender/draw/modes/edit_metaball_mode.c
+++ b/source/blender/draw/modes/edit_metaball_mode.c
@@ -178,7 +178,7 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
if (ob->type == OB_MESH) {
/* Get geometry cache */
- struct Batch *geom = DRW_cache_mesh_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
/* Add geom to a shading group */
DRW_shgroup_call_add(stl->g_data->group, geom, ob->obmat);
diff --git a/source/blender/draw/modes/edit_surface_mode.c b/source/blender/draw/modes/edit_surface_mode.c
index 577b84e38c6..c8dbbd90754 100644
--- a/source/blender/draw/modes/edit_surface_mode.c
+++ b/source/blender/draw/modes/edit_surface_mode.c
@@ -178,7 +178,7 @@ static void EDIT_SURFACE_cache_populate(void *vedata, Object *ob)
if (ob->type == OB_MESH) {
/* Get geometry cache */
- struct Batch *geom = DRW_cache_mesh_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
/* Add geom to a shading group */
DRW_shgroup_call_add(stl->g_data->group, geom, ob->obmat);
diff --git a/source/blender/draw/modes/edit_text_mode.c b/source/blender/draw/modes/edit_text_mode.c
index 13c8015e628..938ab2f3fbc 100644
--- a/source/blender/draw/modes/edit_text_mode.c
+++ b/source/blender/draw/modes/edit_text_mode.c
@@ -199,7 +199,7 @@ static void EDIT_TEXT_cache_populate(void *vedata, Object *ob)
if (ob == obedit) {
const Curve *cu = ob->data;
/* Get geometry cache */
- struct Batch *geom;
+ struct Gwn_Batch *geom;
if (cu->flag & CU_FAST) {
geom = DRW_cache_text_edge_wire_get(ob);
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 3262e863106..f6220a70f9c 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -626,7 +626,7 @@ static void DRW_shgroup_empty_image(
image_calc_aspect(ob->data, ob->iuser, empty_image_data->image_aspect);
if (tex) {
- struct Batch *geom = DRW_cache_image_plane_get();
+ struct Gwn_Batch *geom = DRW_cache_image_plane_get();
DRWShadingGroup *grp = DRW_shgroup_instance_create(
e_data.object_empty_image_sh, psl->non_meshes, geom);
DRW_shgroup_attrib_float(grp, "objectColor", 4);
@@ -644,7 +644,7 @@ static void DRW_shgroup_empty_image(
}
{
- struct Batch *geom = DRW_cache_image_plane_wire_get();
+ struct Gwn_Batch *geom = DRW_cache_image_plane_wire_get();
DRWShadingGroup *grp = DRW_shgroup_instance_create(
e_data.object_empty_image_wire_sh, psl->non_meshes, geom);
DRW_shgroup_attrib_float(grp, "color", 3);
@@ -708,7 +708,7 @@ static void OBJECT_cache_init(void *vedata)
{
DRWState state = DRW_STATE_WRITE_COLOR;
- struct Batch *quad = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
static float alphaOcclu = 0.35f;
static float one = 1.0f;
static float alpha1 = 5.0f / 6.0f;
@@ -787,7 +787,7 @@ static void OBJECT_cache_init(void *vedata)
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND;
psl->outlines_resolve = DRW_pass_create("Outlines Resolve Pass", state);
- struct Batch *quad = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
DRWShadingGroup *grp = DRW_shgroup_create(e_data.outline_resolve_sh, psl->outlines_resolve);
DRW_shgroup_uniform_buffer(grp, "outlineBluredColor", &e_data.outlines_blur_tx);
@@ -799,7 +799,7 @@ static void OBJECT_cache_init(void *vedata)
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND;
psl->grid = DRW_pass_create("Infinite Grid Pass", state);
- struct Batch *quad = DRW_cache_fullscreen_quad_get();
+ struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
static float mat[4][4];
unit_m4(mat);
@@ -850,7 +850,7 @@ static void OBJECT_cache_init(void *vedata)
{
/* Non Meshes Pass (Camera, empties, lamps ...) */
- struct Batch *geom;
+ struct Gwn_Batch *geom;
DRWState state =
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
@@ -954,7 +954,7 @@ static void OBJECT_cache_init(void *vedata)
/* TODO
* for now we create multiple times the same VBO with only lamp center coordinates
* but ideally we would only create it once */
- struct Batch *geom;
+ struct Gwn_Batch *geom;
/* start with buflimit because we don't want stipples */
geom = DRW_cache_single_line_get();
@@ -1001,7 +1001,7 @@ static void OBJECT_cache_init(void *vedata)
{
/* -------- STIPPLES ------- */
/* TODO port to shader stipple */
- struct Batch *geom;
+ struct Gwn_Batch *geom;
/* Relationship Lines */
stl->g_data->relationship_lines = shgroup_dynlines_uniform_color(psl->non_meshes, ts.colorWire);
@@ -1587,7 +1587,7 @@ static void OBJECT_cache_populate_particles(Object *ob,
unit_m4(mat);
if (draw_as != PART_DRAW_PATH) {
- struct Batch *geom = DRW_cache_particles_get_dots(psys);
+ struct Gwn_Batch *geom = DRW_cache_particles_get_dots(psys);
DRWShadingGroup *shgrp = NULL;
static int screen_space[2] = {0, 1};
static float def_prim_col[3] = {0.5f, 0.5f, 0.5f};
@@ -1654,7 +1654,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (do_outlines) {
Object *obedit = scene->obedit;
if (ob != obedit && !((ob == draw_ctx->obact) && (ob->mode & OB_MODE_ALL_PAINT))) {
- struct Batch *geom = DRW_cache_object_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
theme_id = DRW_object_wire_theme_get(ob, sl, NULL);
DRWShadingGroup *shgroup = shgroup_theme_id_to_outline_or(stl, theme_id, NULL);
@@ -1672,7 +1672,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (me->totpoly == 0) {
Object *obedit = scene->obedit;
if (ob != obedit) {
- struct Batch *geom = DRW_cache_mesh_edges_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_mesh_edges_get(ob);
if (geom) {
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, sl, NULL);
@@ -1693,7 +1693,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
{
Object *obedit = scene->obedit;
if (ob != obedit) {
- struct Batch *geom = DRW_cache_lattice_wire_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_lattice_wire_get(ob);
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, sl, NULL);
}
@@ -1708,7 +1708,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
{
Object *obedit = scene->obedit;
if (ob != obedit) {
- struct Batch *geom = DRW_cache_curve_edge_wire_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_curve_edge_wire_get(ob);
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, sl, NULL);
}
diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c
index 9521fb08d34..795b0bae02b 100644
--- a/source/blender/draw/modes/paint_texture_mode.c
+++ b/source/blender/draw/modes/paint_texture_mode.c
@@ -297,9 +297,9 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob)
if (me->mloopuv != NULL) {
if (use_material_slots) {
- struct Batch **geom_array = me->totcol ? DRW_cache_mesh_surface_texpaint_get(ob) : NULL;
+ struct Gwn_Batch **geom_array = me->totcol ? DRW_cache_mesh_surface_texpaint_get(ob) : NULL;
if ((me->totcol == 0) || (geom_array == NULL)) {
- struct Batch *geom = DRW_cache_mesh_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
DRW_shgroup_call_add(stl->g_data->shgroup_fallback, geom, ob->obmat);
ok = true;
}
@@ -316,7 +316,7 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob)
}
}
else {
- struct Batch *geom = DRW_cache_mesh_surface_texpaint_single_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_mesh_surface_texpaint_single_get(ob);
if (geom && stl->g_data->shgroup_image_array[0]) {
DRW_shgroup_call_add(stl->g_data->shgroup_image_array[0], geom, ob->obmat);
ok = true;
@@ -325,14 +325,14 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob)
}
if (!ok) {
- struct Batch *geom = DRW_cache_mesh_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
DRW_shgroup_call_add(stl->g_data->shgroup_fallback, geom, ob->obmat);
}
/* Face Mask */
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
if (use_face_sel) {
- struct Batch *geom;
+ struct Gwn_Batch *geom;
/* Note: ideally selected faces wouldn't show interior wire. */
const bool use_wire = true;
geom = DRW_cache_mesh_edges_paint_overlay_get(ob, use_wire, use_face_sel);
diff --git a/source/blender/draw/modes/paint_vertex_mode.c b/source/blender/draw/modes/paint_vertex_mode.c
index f65db8686c0..ac3b82e9418 100644
--- a/source/blender/draw/modes/paint_vertex_mode.c
+++ b/source/blender/draw/modes/paint_vertex_mode.c
@@ -147,7 +147,7 @@ static void PAINT_VERTEX_cache_populate(void *vedata, Object *ob)
bool use_wire = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_wire");
const Mesh *me = ob->data;
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
- struct Batch *geom;
+ struct Gwn_Batch *geom;
world_light = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_shading") ? 0.5f : 1.0f;
diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c
index d880d1d9f23..270566b6cc6 100644
--- a/source/blender/draw/modes/paint_weight_mode.c
+++ b/source/blender/draw/modes/paint_weight_mode.c
@@ -184,7 +184,7 @@ static void PAINT_WEIGHT_cache_populate(void *vedata, Object *ob)
const Mesh *me = ob->data;
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
- struct Batch *geom;
+ struct Gwn_Batch *geom;
world_light = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_shading") ? 0.5f : 1.0f;
diff --git a/source/blender/draw/modes/particle_mode.c b/source/blender/draw/modes/particle_mode.c
index 4b63a00d0a5..dd22a5c6d8f 100644
--- a/source/blender/draw/modes/particle_mode.c
+++ b/source/blender/draw/modes/particle_mode.c
@@ -172,7 +172,7 @@ static void PARTICLE_cache_populate(void *vedata, Object *ob)
if (ob->type == OB_MESH) {
/* Get geometry cache */
- struct Batch *geom = DRW_cache_mesh_surface_get(ob);
+ struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
/* Add geom to a shading group */
DRW_shgroup_call_add(stl->g_data->group, geom, ob->obmat);
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 0ebd556a0f5..69e8f708e3d 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -142,7 +142,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
@@ -231,7 +231,7 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
@@ -3862,7 +3862,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* for F-Curves, draw color-preview of curve behind checkbox */
if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
FCurve *fcu = (FCurve *)ale->data;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -3918,7 +3918,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* draw red underline if channel is disabled */
if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE) && (ale->flag & FCURVE_DISABLED)) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -3927,7 +3927,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
glLineWidth(2.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, (float)offset, yminc);
immVertex2f(pos, (float)v2d->cur.xmax, yminc);
immEnd();
@@ -3946,7 +3946,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
short draw_sliders = 0;
float ymin_ofs = 0.0f;
float color[3];
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 6127f77d7d6..08851cebf51 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -72,8 +72,8 @@
static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const bool time)
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
unsigned char col[4];
float xscale, x, y;
char numstr[32] = " t"; /* t is the character to start replacing from */
@@ -128,15 +128,15 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
glLineWidth((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* Draw a light green line to indicate current frame */
immUniformThemeColor(TH_CFRAME);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */
immVertex2f(pos, x, v2d->cur.ymax);
immEnd();
@@ -163,8 +163,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f);
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index ef67411a48d..064879bdd70 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -351,8 +351,8 @@ static void draw_marker(
if (flag & DRAW_MARKERS_LINES)
#endif
{
- VertexFormat *format = immVertexFormat();
- uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -369,7 +369,7 @@ static void draw_marker(
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, xpos + 0.5f, 12.0f);
immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
immEnd();
@@ -452,7 +452,7 @@ void ED_markers_draw(const bContext *C, int flag)
v2d = UI_view2d_fromcontext(C);
if (flag & DRAW_MARKERS_MARGIN) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
const unsigned char shade[4] = {0, 0, 0, 16};
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 5dca4be4de1..97e5597326e 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -585,7 +585,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
copy_v4_v4(unsel_mhcol, unsel_color);
unsel_mhcol[3] *= 0.8f;
- unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos_id = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* NOTE: the tradeoff for changing colors between each draw is dwarfed by the cost of checking validity */
for (ActKeyBlock *ab = blocks->first; ab; ab = ab->next) {
@@ -618,14 +618,14 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
if (key_ct > 0) {
/* draw keys */
- VertexFormat *format = immVertexFormat();
- unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int size_id = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT);
- unsigned int color_id = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
- unsigned int outline_color_id = VertexFormat_add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
+ unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
GPU_enable_program_point_size();
- immBegin(PRIM_POINTS, key_ct);
+ immBegin(GWN_PRIM_POINTS, key_ct);
for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) {
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) {
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 957048bcc42..20fb7b5e693 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -440,7 +440,7 @@ static float sk_clampPointSize(SK_Point *pt, float size)
static void sk_drawPoint(SK_Point *pt, float size, float color[4])
{
- Batch *batch = NULL;
+ Gwn_Batch *batch = NULL;
gpuTranslate3fv(pt->p);
@@ -450,9 +450,9 @@ static void sk_drawPoint(SK_Point *pt, float size, float color[4])
batch = Batch_get_sphere(0);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
- Batch_Uniform4fv(batch, "color", color);
+ GWN_batch_uniform_4fv(batch, "color", color);
- Batch_draw(batch);
+ GWN_batch_draw(batch);
gpuPopMatrix();
}
@@ -462,8 +462,8 @@ static void sk_drawEdge(SK_Point *pt0, SK_Point *pt1, float size, float color[4]
float vec1[3], vec2[3] = { 0, 0, 1 }, axis[3];
float angle, length;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
sub_v3_v3v3(vec1, pt1->p, pt0->p);
length = normalize_v3(vec1);
@@ -489,8 +489,8 @@ static void sk_drawNormal(SK_Point *pt, float size, float height)
float angle;
float color[3] = { 0.0f, 1.0f, 1.0f };
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
gpuPushMatrix();
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index e9d214157c0..6d29d2def97 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -471,9 +471,9 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
float color[3];
UI_GetThemeColor3fv(TH_WIRE, color);
- Batch *sphere = Batch_get_sphere(0);
+ Gwn_Batch *sphere = Batch_get_sphere(0);
Batch_set_builtin_program(sphere, GPU_SHADER_3D_UNIFORM_COLOR);
- Batch_Uniform3fv(sphere, "color", color);
+ GWN_batch_uniform_3fv(sphere, "color", color);
/* scale to edit-mode space */
gpuPushMatrix();
@@ -491,7 +491,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
gpuPushMatrix();
gpuScaleUniform(radius);
- Batch_draw(sphere);
+ GWN_batch_draw(sphere);
gpuPopMatrix();
location_prev = selem->location_local;
@@ -514,15 +514,15 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
}
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
imm_cpack(0x0);
- immBegin(PRIM_LINE_STRIP, stroke_len);
+ immBegin(GWN_PRIM_LINE_STRIP, stroke_len);
glLineWidth(3.0f);
if (v3d->zbuf) {
@@ -536,7 +536,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
immEnd();
imm_cpack(0xffffffff);
- immBegin(PRIM_LINE_STRIP, stroke_len);
+ immBegin(GWN_PRIM_LINE_STRIP, stroke_len);
glLineWidth(1.0f);
for (int i = 0; i < stroke_len; i++) {
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index a868b47053c..96f9959af02 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -149,14 +149,14 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f
/* draw triangulation data */
if (tot_triangles > 0) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
/* Draw all triangles for filling the polygon */
- immBegin(PRIM_TRIANGLES, tot_triangles * 3);
+ immBegin(GWN_PRIM_TRIS, tot_triangles * 3);
/* TODO: use batch instead of immediate mode, to share vertices */
const tGPspoint *pt;
@@ -207,9 +207,9 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
return;
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
const tGPspoint *pt = points;
@@ -217,7 +217,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
/* if drawing a single point, draw it larger */
glPointSize((float)(thickness + 2) * points->pressure);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
gp_set_tpoint_varying_color(pt, ink, color);
immVertex2iv(pos, &pt->x);
}
@@ -227,7 +227,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
/* draw stroke curve */
glLineWidth(max_ff(oldpressure * thickness, 1.0));
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
- immBeginAtMost(PRIM_LINE_STRIP, totpoints);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints);
/* TODO: implement this with a geometry shader to draw one continuous tapered stroke */
@@ -246,7 +246,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
draw_points = 0;
glLineWidth(max_ff(pt->pressure * thickness, 1.0f));
- immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1);
/* need to roll-back one point to ensure that there are no gaps in the stroke */
if (i != 0) {
@@ -318,14 +318,14 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi
if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D))
return;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR);
GPU_enable_program_point_size();
- immBegin(PRIM_POINTS, totpoints);
+ immBegin(GWN_PRIM_POINTS, totpoints);
const tGPspoint *pt = points;
for (int i = 0; i < totpoints; i++, pt++) {
@@ -345,14 +345,14 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints
int offsx, int offsy, int winx, int winy,
const float diff_mat[4][4], const float ink[4])
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR);
GPU_enable_program_point_size();
- immBegin(PRIM_POINTS, totpoints);
+ immBegin(GWN_PRIM_POINTS, totpoints);
const bGPDspoint *pt = points;
for (int i = 0; i < totpoints; i++, pt++) {
@@ -378,14 +378,14 @@ static void gp_draw_stroke_volumetric_3d(
const bGPDspoint *points, int totpoints, short thickness,
const float ink[4])
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR);
GPU_enable_program_point_size();
- immBegin(PRIM_POINTS, totpoints);
+ immBegin(GWN_PRIM_POINTS, totpoints);
const bGPDspoint *pt = points;
for (int i = 0; i < totpoints && pt; i++, pt++) {
@@ -521,18 +521,18 @@ static void gp_draw_stroke_fill(
unsigned int pos;
if (gps->flag & GP_STROKE_3DSPACE) {
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
}
else {
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
}
immUniformColor4fv(color);
/* Draw all triangles for filling the polygon (cache must be calculated before) */
- immBegin(PRIM_TRIANGLES, gps->tot_triangles * 3);
+ immBegin(GWN_PRIM_TRIS, gps->tot_triangles * 3);
/* TODO: use batch instead of immediate mode, to share vertices */
bGPDtriangle *stroke_triangle = gps->triangles;
@@ -591,8 +591,8 @@ static void gp_draw_stroke_point(
float fpt[3];
mul_v3_m4v3(fpt, diff_mat, &pt->x);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (sflag & GP_STROKE_3DSPACE) {
immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);
@@ -610,7 +610,7 @@ static void gp_draw_stroke_point(
/* set point thickness (since there's only one of these) */
immUniform1f("size", (float)(thickness + 2) * pt->pressure);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, fpt);
immEnd();
@@ -633,9 +633,9 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
@@ -643,7 +643,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
/* draw stroke curve */
glLineWidth(max_ff(curpressure * thickness, 1.0f));
- immBeginAtMost(PRIM_LINE_STRIP, totpoints + cyclic_add);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints + cyclic_add);
const bGPDspoint *pt = points;
for (int i = 0; i < totpoints; i++, pt++) {
gp_set_point_varying_color(pt, ink, color);
@@ -664,7 +664,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
curpressure = pt->pressure;
glLineWidth(max_ff(curpressure * thickness, 1.0f));
- immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add);
/* need to roll-back one point to ensure that there are no gaps in the stroke */
if (i != 0) {
@@ -732,12 +732,12 @@ static void gp_draw_stroke_2d(const bGPDspoint *points, int totpoints, short thi
int i;
float fpt[3];
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(PRIM_TRIANGLE_STRIP, totpoints * 2 + 4);
+ immBegin(GWN_PRIM_TRI_STRIP, totpoints * 2 + 4);
/* get x and y coordinates from first point */
mul_v3_m4v3(fpt, diff_mat, &points->x);
@@ -1166,21 +1166,21 @@ static void gp_draw_strokes_edit(
UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor);
selectColor[3] = alpha;
- VertexFormat *format = immVertexFormat();
+ Gwn_VertFormat *format = immVertexFormat();
unsigned int pos; /* specified later */
- unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (gps->flag & GP_STROKE_3DSPACE) {
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR);
}
else {
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR);
}
- immBegin(PRIM_POINTS, gps->totpoints);
+ immBegin(GWN_PRIM_POINTS, gps->totpoints);
/* Draw start and end point differently if enabled stroke direction hint */
bool show_direction_hint = (gpd->flag & GP_DATA_SHOW_DIRECTION) && (gps->totpoints > 1);
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 1577cb76f99..f478596deec 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -981,8 +981,8 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customda
GP_EditBrush_Data *brush = gpsculpt_get_brush(CTX_data_scene(C));
if (brush) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
glEnable(GL_LINE_SMOOTH);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index eb37c3fe629..1b2f35b3fb1 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1849,8 +1849,8 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
tGPsdata *p = (tGPsdata *)p_ptr;
if (p->paintmode == GP_PAINTMODE_ERASER) {
- VertexFormat *format = immVertexFormat();
- const uint shdr_pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ const uint shdr_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
glEnable(GL_LINE_SMOOTH);
diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h
index 8eef016a846..62f1a617fcb 100644
--- a/source/blender/editors/include/ED_keyframes_draw.h
+++ b/source/blender/editors/include/ED_keyframes_draw.h
@@ -109,7 +109,7 @@ typedef enum eKeyframeShapeDrawOpts {
} eKeyframeShapeDrawOpts;
/* draw simple diamond-shape keyframe */
-/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(PRIM_POINTS, n), then call this n times */
+/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(GWN_PRIM_POINTS, n), then call this n times */
void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type, short mode, float alpha,
unsigned int pos_id, unsigned int size_id, unsigned int color_id, unsigned int outline_color_id);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 3553b5f4d4b..1baf01b583f 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -107,8 +107,8 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
{0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
int a;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* mult */
for (a = 0; a < 7; a++) {
@@ -124,7 +124,7 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(col);
- immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, vert_ct);
+ immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_ct);
/* start with corner right-bottom */
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
immVertex2f(pos, maxx - rad, miny);
@@ -202,9 +202,9 @@ void UI_draw_roundbox_shade_x(
int vert_count = 0;
int a;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
@@ -226,7 +226,7 @@ void UI_draw_roundbox_shade_x(
vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1;
vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1;
- immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, vert_count);
+ immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_count);
/* start with corner right-bottom */
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
@@ -327,9 +327,9 @@ void UI_draw_roundbox_shade_y(
mul_v2_fl(vec[a], rad);
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
@@ -347,7 +347,7 @@ void UI_draw_roundbox_shade_y(
vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1;
vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1;
- immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, vert_count);
+ immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_count);
/* start with corner right-bottom */
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
@@ -430,8 +430,8 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo
{
int ofs_y = 4 * U.pixelsize;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(color);
@@ -445,9 +445,9 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo
/* based on UI_draw_roundbox_gl_mode, check on making a version which allows us to skip some sides */
void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highlight[3], unsigned char highlight_fade[3])
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
/* add a 1px offset, looks nicer */
const int minx = rect->xmin + U.pixelsize, maxx = rect->xmax - U.pixelsize;
const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize;
@@ -466,7 +466,7 @@ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highligh
}
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
- immBeginAtMost(PRIM_LINE_STRIP, 25);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, 25);
immAttrib3ubv(col, highlight);
@@ -579,8 +579,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
*
* \Note This functionn is to be used with the 2D dashed shader enabled.
*
- * \param pos is a PRIM_FLOAT, 2, KEEP_FLOAT vertex attrib
- * \param line_origin is a PRIM_FLOAT, 2, KEEP_FLOAT vertex attrib
+ * \param pos is a PRIM_FLOAT, 2, GWN_FETCH_FLOAT vertex attrib
+ * \param line_origin is a PRIM_FLOAT, 2, GWN_FETCH_FLOAT vertex attrib
*
* The next 4 parameters are the offsets for the view, not the zones.
*/
@@ -643,7 +643,7 @@ static void histogram_draw_one(
/* curve outline */
glLineWidth(1.5);
- immBegin(PRIM_LINE_STRIP, res);
+ immBegin(GWN_PRIM_LINE_STRIP, res);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
immVertex2f(pos_attrib, x2, y + (data[i] * h));
@@ -652,7 +652,7 @@ static void histogram_draw_one(
}
else {
/* under the curve */
- immBegin(PRIM_TRIANGLE_STRIP, res * 2);
+ immBegin(GWN_PRIM_TRI_STRIP, res * 2);
immVertex2f(pos_attrib, x, y);
immVertex2f(pos_attrib, x, y + (data[0] * h));
for (int i = 1; i < res; i++) {
@@ -666,7 +666,7 @@ static void histogram_draw_one(
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.25f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- immBegin(PRIM_LINE_STRIP, res);
+ immBegin(GWN_PRIM_LINE_STRIP, res);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
immVertex2f(pos_attrib, x2, y + (data[i] * h));
@@ -711,8 +711,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
(rect.xmax + 1) - (rect.xmin - 1),
(rect.ymax + 1) - (rect.ymin - 1));
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -726,7 +726,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
}
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, rect.xmin, rect.ymin + fac * h);
immVertex2f(pos, rect.xmax, rect.ymin + fac * h);
@@ -762,21 +762,21 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
static void waveform_draw_one(float *waveform, int nbr, const float col[3])
{
- VertexFormat format = {0};
- unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat format = {0};
+ unsigned int pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, nbr);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, nbr);
- VertexBuffer_fill_attrib(vbo, pos_id, waveform);
+ GWN_vertbuf_attr_fill(vbo, pos_id, waveform);
- /* TODO store the Batch inside the scope */
- Batch *batch = Batch_create(PRIM_POINTS, vbo, NULL);
+ /* TODO store the Gwn_Batch inside the scope */
+ Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR);
- Batch_Uniform4f(batch, "color", col[0], col[1], col[2], 1.0f);
- Batch_draw(batch);
+ GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f);
+ GWN_batch_draw(batch);
- Batch_discard_all(batch);
+ GWN_batch_discard_all(batch);
}
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
@@ -843,15 +843,15 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
/* draw grid lines here */
- immBegin(PRIM_LINES, 12);
+ immBegin(GWN_PRIM_LINES, 12);
for (int i = 0; i < 6; i++) {
immVertex2f(pos, rect.xmin + 22, yofs + (i * 0.2f) * h);
@@ -862,7 +862,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
/* 3 vertical separation */
if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) {
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
for (int i = 1; i < 3; i++) {
immVertex2f(pos, rect.xmin + i * w3, rect.ymin);
@@ -873,7 +873,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
}
/* separate min max zone on the right */
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, rect.xmin + w, rect.ymin);
immVertex2f(pos, rect.xmin + w, rect.ymax);
immEnd();
@@ -881,7 +881,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
/* 16-235-240 level in case of ITU-R BT601/709 */
immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f);
if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) {
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex2f(pos, rect.xmin + 22, yofs + h * 16.0f / 255.0f);
immVertex2f(pos, rect.xmax + 1, yofs + h * 16.0f / 255.0f);
@@ -899,7 +899,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
}
/* 7.5 IRE black point level for NTSC */
if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, rect.xmin, yofs + h * 0.075f);
immVertex2f(pos, rect.xmax + 1, yofs + h * 0.075f);
immEnd();
@@ -928,7 +928,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
CLAMP(min, rect.ymin, rect.ymax);
CLAMP(max, rect.ymin, rect.ymax);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, rect.xmax - 3, min);
immVertex2f(pos, rect.xmax - 3, max);
immEnd();
@@ -982,7 +982,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
CLAMP(min, rect.ymin, rect.ymax);
CLAMP(max, rect.ymin, rect.ymax);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, rect.xmin + w + 2 + c * 2, min);
immVertex2f(pos, rect.xmin + w + 2 + c * 2, max);
immEnd();
@@ -1026,7 +1026,7 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f);
dangle = DEG2RADF(2.5f);
dampli = 2.5f / 200.0f;
- immBegin(PRIM_LINE_LOOP, 4);
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
@@ -1038,22 +1038,22 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente
dampli = 0.2f * tampli;
dangle2 = DEG2RADF(5.0f);
dampli2 = 0.5f * dampli;
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle + dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle + dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli + dampli, tangle + dangle - dangle2));
immEnd();
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle + dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle + dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli - dampli, tangle + dangle - dangle2));
immEnd();
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle - dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle - dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli - dampli, tangle - dangle + dangle2));
immEnd();
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle), polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2));
@@ -1100,15 +1100,15 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
(rect.xmax + 1) - (rect.xmin - 1),
(rect.ymax + 1) - (rect.ymin - 1));
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
/* draw grid elements */
/* cross */
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, centerx - (diam * 0.5f) - 5, centery);
immVertex2f(pos, centerx + (diam * 0.5f) + 5, centery);
@@ -1121,7 +1121,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
/* circles */
for (int j = 0; j < 5; j++) {
const int increment = 15;
- immBegin(PRIM_LINE_LOOP, (int)(360 / increment));
+ immBegin(GWN_PRIM_LINE_LOOP, (int)(360 / increment));
for (int i = 0; i <= 360 - increment; i += increment) {
const float a = DEG2RADF((float)i);
const float r = (j + 1) * 0.1f;
@@ -1132,7 +1132,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
/* skin tone line */
immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery, diam, 0.5f, skin_rad));
immVertex2f(pos, polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery, diam, 0.1f, skin_rad));
immEnd();
@@ -1169,7 +1169,7 @@ static void ui_draw_colorband_handle_tri_hlight(unsigned int pos, float x1, floa
{
glEnable(GL_LINE_SMOOTH);
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, x1 + halfwidth, y1);
immVertex2f(pos, x1, y1 + height);
immVertex2f(pos, x1 - halfwidth, y1);
@@ -1182,7 +1182,7 @@ static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, f
{
glEnable(fill ? GL_POLYGON_SMOOTH : GL_LINE_SMOOTH);
- immBegin(fill ? PRIM_TRIANGLES : PRIM_LINE_LOOP, 3);
+ immBegin(fill ? GWN_PRIM_TRIS : GWN_PRIM_LINE_LOOP, 3);
immVertex2f(pos, x1 + halfwidth, y1);
immVertex2f(pos, x1, y1 + height);
immVertex2f(pos, x1 - halfwidth, y1);
@@ -1193,7 +1193,7 @@ static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, f
static void ui_draw_colorband_handle_box(unsigned int pos, float x1, float y1, float x2, float y2, bool fill)
{
- immBegin(fill ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, 4);
+ immBegin(fill ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, 4);
immVertex2f(pos, x1, y1);
immVertex2f(pos, x1, y2);
immVertex2f(pos, x2, y2);
@@ -1233,7 +1233,7 @@ static void ui_draw_colorband_handle(
immUniformArray4fv("colors", (float *)(float[][4]){{0.8f, 0.8f, 0.8f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
immUniform1f("dash_width", active ? 4.0f : 2.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(shdr_pos, x, y1);
immVertex2f(shdr_pos, x, y2);
immEnd();
@@ -1304,8 +1304,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
float sizey_solid = sizey * 0.25f;
float y1 = rect->ymin;
- VertexFormat *format = immVertexFormat();
- position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_CHECKER);
/* Drawing the checkerboard. */
@@ -1317,8 +1317,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
/* New format */
format = immVertexFormat();
- position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- color = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT);
+ position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
/* layer: color ramp */
@@ -1332,7 +1332,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
v1[1] = y1 + sizey_solid;
v2[1] = rect->ymax;
- immBegin(PRIM_TRIANGLE_STRIP, (sizex + 1) * 2);
+ immBegin(GWN_PRIM_TRI_STRIP, (sizex + 1) * 2);
for (int a = 0; a <= sizex; a++) {
float pos = ((float)a) / sizex;
do_colorband(coba, pos, colf);
@@ -1351,7 +1351,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
v1[1] = y1;
v2[1] = y1 + sizey_solid;
- immBegin(PRIM_TRIANGLE_STRIP, (sizex + 1) * 2);
+ immBegin(GWN_PRIM_TRI_STRIP, (sizex + 1) * 2);
for (int a = 0; a <= sizex; a++) {
float pos = ((float)a) / sizex;
do_colorband(coba, pos, colf);
@@ -1372,7 +1372,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
/* New format */
format = immVertexFormat();
- position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* layer: box outline */
@@ -1383,14 +1383,14 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
glEnable(GL_BLEND);
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(position, x1, y1);
immVertex2f(position, x1 + sizex, y1);
immEnd();
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(position, x1, y1 - 1);
immVertex2f(position, x1 + sizex, y1 - 1);
immEnd();
@@ -1443,18 +1443,18 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
gpuTranslate2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect), rect->ymin + 0.5f * BLI_rcti_size_y(rect));
gpuScaleUniform(size);
- Batch *sphere = Batch_get_sphere(2);
+ Gwn_Batch *sphere = Batch_get_sphere(2);
Batch_set_builtin_program(sphere, GPU_SHADER_SIMPLE_LIGHTING);
- Batch_Uniform4f(sphere, "color", diffuse[0], diffuse[1], diffuse[2], 1.0f);
- Batch_Uniform3fv(sphere, "light", light);
- Batch_draw(sphere);
+ GWN_batch_uniform_4f(sphere, "color", diffuse[0], diffuse[1], diffuse[2], 1.0f);
+ GWN_batch_uniform_3fv(sphere, "light", light);
+ GWN_batch_draw(sphere);
/* restore */
glDisable(GL_CULL_FACE);
/* AA circle */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ubv((unsigned char *)wcol->inner);
@@ -1483,7 +1483,7 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo
float line_count = floorf((rect->xmax - fx) / dx) + 1.0f +
floorf((rect->ymax - fy) / dy) + 1.0f;
- immBegin(PRIM_LINES, (int)line_count * 2);
+ immBegin(GWN_PRIM_LINES, (int)line_count * 2);
while (fx < rect->xmax) {
immVertex2f(pos, fx, rect->ymin);
immVertex2f(pos, fx, rect->ymax);
@@ -1556,8 +1556,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
glLineWidth(1.0f);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* backdrop */
@@ -1592,7 +1592,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f);
/* axes */
gl_shaded_color((unsigned char *)wcol->inner, -50);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (-offsy));
immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (-offsy));
immVertex2f(pos, rect->xmin + zoomx * (-offsx), rect->ymin);
@@ -1605,7 +1605,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
#if 0
if (cumap->flag & CUMA_DRAW_CFRA) {
immUniformColor3ub(0x60, 0xc0, 0x40);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymin);
immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymax);
immEnd();
@@ -1614,7 +1614,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
/* sample option */
if (cumap->flag & CUMA_DRAW_SAMPLE) {
- immBegin(PRIM_LINES, 2); /* will draw one of the following 3 lines */
+ immBegin(GWN_PRIM_LINES, 2); /* will draw one of the following 3 lines */
if (but->a1 == UI_GRAD_H) {
float tsample[3];
float hsv[3];
@@ -1650,7 +1650,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
immUniformColor3ubv((unsigned char *)wcol->item);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
- immBegin(PRIM_LINE_STRIP, (CM_TABLE+1) + 2);
+ immBegin(GWN_PRIM_LINE_STRIP, (CM_TABLE+1) + 2);
if (cuma->table == NULL)
curvemapping_changed(cumap, false);
@@ -1687,13 +1687,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
/* the points, use aspect to make them visible on edges */
format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
cmp = cuma->curve;
glPointSize(3.0f);
- immBegin(PRIM_POINTS, cuma->totpoint);
+ immBegin(GWN_PRIM_POINTS, cuma->totpoint);
for (int a = 0; a < cuma->totpoint; a++) {
float color[4];
if (cmp[a].flag & CUMA_SELECT)
@@ -1713,7 +1713,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
/* outline */
format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ubv((unsigned char *)wcol->outline);
@@ -1803,16 +1803,16 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
BLI_rctf_size_x(&rect),
BLI_rctf_size_y(&rect));
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
UI_GetThemeColor4fv(TH_SEL_MARKER, col_sel);
UI_GetThemeColor4fv(TH_MARKER_OUTLINE, col_outline);
/* Do stipple cross with geometry */
- immBegin(PRIM_LINES, 7*2*2);
+ immBegin(GWN_PRIM_LINES, 7*2*2);
float pos_sel[8] = {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f, 11.0f};
for (int axe = 0; axe < 2; ++axe) {
for (int i = 0; i < 7; ++i) {
@@ -1892,13 +1892,13 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
float x = 0.5f * (recti->xmin + recti->xmax);
float y = 0.5f * (recti->ymin + recti->ymax);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv(but->col);
glEnable(GL_BLEND);
- immBegin(PRIM_TRIANGLE_FAN, 16);
+ immBegin(GWN_PRIM_TRI_FAN, 16);
for (int a = 0; a < 16; a++)
immVertex2f(pos, x + size * si[a], y + size * co[a]);
immEnd();
@@ -1906,7 +1906,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
immUniformColor4ub(0, 0, 0, 150);
glLineWidth(1);
glEnable(GL_LINE_SMOOTH);
- immBegin(PRIM_LINE_LOOP, 16);
+ immBegin(GWN_PRIM_LINE_LOOP, 16);
for (int a = 0; a < 16; a++)
immVertex2f(pos, x + size * si[a], y + size * co[a]);
immEnd();
@@ -1989,13 +1989,13 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx,
{
glEnable(GL_BLEND);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
- immBegin(PRIM_TRIANGLES, 54);
+ immBegin(GWN_PRIM_TRIS, 54);
/* accumulated outline boxes to make shade not linear, is more pleasant */
ui_shadowbox(pos, color, minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8);
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 2548951cb88..ac07756b372 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -223,11 +223,11 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float
viconutil_set_point(pts[1], cx - d2, cy - d);
viconutil_set_point(pts[2], cx + d2, cy);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(0.2f, 0.2f, 0.2f, alpha);
- immBegin(PRIM_TRIANGLES, 3);
+ immBegin(GWN_PRIM_TRIS, 3);
immVertex2iv(pos, pts[0]);
immVertex2iv(pos, pts[1]);
immVertex2iv(pos, pts[2]);
@@ -253,15 +253,15 @@ static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha,
int xco = x + w / 2;
int yco = y + h / 2;
- VertexFormat *format = immVertexFormat();
- unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int size_id = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT);
- unsigned int color_id = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
- unsigned int outline_color_id = VertexFormat_add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
+ unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
GPU_enable_program_point_size();
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
/* draw keyframe
* - size: 0.6 * h (found out experimentally... dunno why!)
@@ -316,7 +316,7 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU
const int b = x + w / 3 * 2;
const int c = x + w;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* XXX: Include alpha into this... */
@@ -1025,9 +1025,9 @@ static void icon_draw_texture(
y2 = (iy + ih) * icongltex.invh;
glBindTexture(GL_TEXTURE_2D, icongltex.id);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
if (rgb) immUniformColor3fvAlpha(rgb, alpha);
@@ -1035,7 +1035,7 @@ static void icon_draw_texture(
immUniform1i("image", 0);
- immBegin(PRIM_TRIANGLE_STRIP, 4);
+ immBegin(GWN_PRIM_TRI_STRIP, 4);
immAttrib2f(texCoord, x1, y2);
immVertex2f(pos, x, y + h);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index d1b4c2cd8fb..cc49eeb5b59 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -436,7 +436,7 @@ static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float
glLineWidth(2.0);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, x1, y1);
immVertex2f(pos, x2, y2);
@@ -477,7 +477,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
glEnable(GL_BLEND);
immUniformColor4ub(255, 255, 255, 50);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, xmin, ymin);
immVertex2f(pos, xmax, ymax);
@@ -489,7 +489,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
immUniformColor4ub(0, 0, 0, 50);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, xmin, ymin + 1);
immVertex2f(pos, xmax, ymax + 1);
@@ -591,7 +591,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
headrect.ymin = headrect.ymax;
headrect.ymax = headrect.ymin + floor(PNL_HEADER / block->aspect + 0.001f);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
{
@@ -606,7 +606,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
immUniformThemeColor(TH_PANEL_HEADER);
immRectf(pos, minx, headrect.ymin + 1, maxx, y);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, minx, y);
immVertex2f(pos, maxx, y);
@@ -626,14 +626,14 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, minx, y);
immVertex2f(pos, maxx, y);
immEnd();
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, minx, y - 1);
immVertex2f(pos, maxx, y - 1);
immEnd();
@@ -663,7 +663,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
/* horizontal title */
if (is_closed_x == false) {
ui_draw_aligned_panel_header(style, block, &headrect, 'h');
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* itemrect smaller */
itemrect.xmax = headrect.xmax - 5.0f / block->aspect;
@@ -686,7 +686,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
else if (is_closed_x) {
/* draw vertical title */
ui_draw_aligned_panel_header(style, block, &headrect, 'v');
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
/* an open panel */
else {
@@ -1568,9 +1568,9 @@ static void ui_panel_category_draw_tab(
{0.98, 0.805}};
int a;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
/* mult */
for (a = 0; a < 4; a++) {
@@ -1592,7 +1592,7 @@ static void ui_panel_category_draw_tab(
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
- immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_STRIP, vert_ct);
+ immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_STRIP, vert_ct);
immAttrib3ubv(color, col);
@@ -1780,7 +1780,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
/* begin drawing */
glEnable(GL_LINE_SMOOTH);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* draw the background */
@@ -1839,7 +1839,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
/* tab blackline */
if (!is_active) {
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ubv(theme_col_tab_divider);
@@ -1869,7 +1869,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
glDisable(GL_BLEND);
/* tab blackline remaining (last tab) */
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
if (pc_dyn->prev == NULL) {
immUniformColor3ubv(theme_col_tab_divider);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index d0ec40bbb70..8adcca8c7cd 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -197,11 +197,11 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
glEnable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(draw_color);
- immBegin(PRIM_TRIANGLES, 3 * WIDGET_AA_JITTER);
+ immBegin(GWN_PRIM_TRIS, 3 * WIDGET_AA_JITTER);
/* for each AA step */
for (int j = 0; j < WIDGET_AA_JITTER; j++) {
@@ -549,7 +549,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, const rcti *rect, float tr
static void widget_trias_draw(uiWidgetTrias *tria, unsigned int pos)
{
- immBegin(PRIM_TRIANGLES, tria->tot * 3);
+ immBegin(GWN_PRIM_TRIS, tria->tot * 3);
for (int i = 0; i < tria->tot; ++i)
for (int j = 0; j < 3; ++j)
immVertex2fv(pos, tria->vec[tria->index[i][j]]);
@@ -677,7 +677,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
float inner_v_half[WIDGET_SIZE_MAX][2];
float x_mid = 0.0f; /* used for dumb clamping of values */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_CHECKER);
/* checkers */
@@ -716,7 +716,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
}
else {
/* simple fill */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv((unsigned char *)wcol->inner);
@@ -730,9 +730,9 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
unsigned char col_array[WIDGET_SIZE_MAX][4];
unsigned char *col_pt = &col_array[0][0];
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
@@ -765,7 +765,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
UI_GetThemeColor4ubv(TH_WIDGET_EMBOSS, emboss);
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
for (j = 0; j < WIDGET_AA_JITTER; j++) {
@@ -796,7 +796,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
wcol->item[2],
(unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)};
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv(tcol);
@@ -1384,7 +1384,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selend - but->ofs);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv((unsigned char *)wcol->item);
@@ -1416,7 +1416,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
t = 0;
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3f(0.2f, 0.6f, 0.9f);
@@ -2214,7 +2214,7 @@ static void widget_softshadow(const rcti *rect, int roundboxalign, const float r
/* we draw a number of increasing size alpha quad strips */
alphastep = 3.0f * btheme->tui.menu_shadow_fac / radout;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -2267,7 +2267,7 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
static void ui_hsv_cursor(float x, float y)
{
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -2362,13 +2362,13 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
ui_color_picker_to_rgb(0.0f, 0.0f, hsv[2], colcent, colcent + 1, colcent + 2);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
- immBegin(PRIM_TRIANGLE_FAN, tot + 2);
+ immBegin(GWN_PRIM_TRI_FAN, tot + 2);
immAttrib3fv(color, colcent);
immVertex2f(pos, centx, centy);
@@ -2389,7 +2389,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
/* fully rounded outline */
format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -2473,12 +2473,12 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons
}
/* old below */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
- immBegin(PRIM_TRIANGLES, steps * 3 * 6);
+ immBegin(GWN_PRIM_TRIS, steps * 3 * 6);
for (dx = 0.0f; dx < 0.999f; dx += color_step) { /* 0.999 = prevent float inaccuracy for steps */
const float dx_next = dx + color_step;
@@ -2634,7 +2634,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect)
ui_hsv_cursor(x, y);
/* outline */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ub(0, 0, 0);
imm_draw_line_box(pos, (rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
@@ -2707,14 +2707,14 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol)
30
};
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
glEnable(GL_BLEND);
immUniformColor4ubv(col);
glLineWidth(1.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, rect->xmin, y);
immVertex2f(pos, rect->xmax, y);
immEnd();
@@ -2798,7 +2798,7 @@ void ui_draw_link_bezier(const rcti *rect, const float color[4])
float coord_array[LINK_RESOL + 1][2];
if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
#if 0 /* unused */
@@ -2810,7 +2810,7 @@ void ui_draw_link_bezier(const rcti *rect, const float color[4])
immUniformColor4fv(color);
- immBegin(PRIM_LINE_STRIP, LINK_RESOL + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, LINK_RESOL + 1);
for (int i = 0; i <= LINK_RESOL; ++i)
immVertex2fv(pos, coord_array[i]);
immEnd();
@@ -3162,11 +3162,11 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
bw += (bw < 0.5f) ? 0.5f : -0.5f;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3f(bw, bw, bw);
- immBegin(PRIM_TRIANGLES, 3);
+ immBegin(GWN_PRIM_TRIS, 3);
immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.9f * height);
immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.5f * height);
immVertex2f(pos, rect->xmin + 0.5f * width, rect->ymin + 0.9f * height);
@@ -3521,7 +3521,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
/* note: drawextra can change rect +1 or -1, to match round errors of existing previews */
but->block->drawextra(C, but->poin, but->block->drawextra_arg1, but->block->drawextra_arg2, rect);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* make mask to draw over image */
@@ -4083,10 +4083,10 @@ static void draw_disk_shaded(
unsigned char r_col[4];
unsigned int pos, col;
- VertexFormat *format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
if (shaded) {
- col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
}
else {
@@ -4094,7 +4094,7 @@ static void draw_disk_shaded(
immUniformColor4ubv((unsigned char *)col1);
}
- immBegin(PRIM_TRIANGLE_STRIP, subd * 2);
+ immBegin(GWN_PRIM_TRI_STRIP, subd * 2);
for (i = 0; i < subd; i++) {
float a;
@@ -4163,8 +4163,8 @@ void ui_draw_pie_center(uiBlock *block)
}
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv((unsigned char *)btheme->tui.wcol_pie_menu.outline);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index a12b033c936..fb57902d258 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1325,12 +1325,12 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
if (vertex_count == 0)
return;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(PRIM_LINES, vertex_count);
+ immBegin(GWN_PRIM_LINES, vertex_count);
/* vertical lines */
if (flag & V2D_VERTICAL_LINES) {
@@ -1467,15 +1467,15 @@ void UI_view2d_constant_grid_draw(View2D *v2d)
count_y = (v2d->cur.ymax - start_y) / step + 1;
if (count_x > 0 || count_y > 0) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
float theme_color[3];
UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(PRIM_LINES, count_x * 2 + count_y * 2 + 4);
+ immBegin(GWN_PRIM_LINES, count_x * 2 + count_y * 2 + 4);
immAttrib3fv(color, theme_color);
for (int i = 0; i < count_x ; start_x += step, i++) {
@@ -1518,14 +1518,14 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s
vertex_count += 2 * ((int)((v2d->cur.xmax - v2d->cur.xmin) / lstep) + 1);
vertex_count += 2 * ((int)((v2d->cur.ymax - v2d->cur.ymin) / lstep) + 1);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
glLineWidth(1.0f);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBeginAtMost(PRIM_LINES, vertex_count);
+ immBeginAtMost(GWN_PRIM_LINES, vertex_count);
for (int level = 0; level < totlevels; ++level) {
UI_GetThemeColorShade3ubv(colorid, offset, grid_line_color);
@@ -1839,8 +1839,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* clean rect behind slider, but not with transparent background */
if (scrollers_back_color[3] == 255) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1946,8 +1946,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* clean rect behind slider, but not with transparent background */
if (scrollers_back_color[3] == 255) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
diff --git a/source/blender/editors/manipulator_library/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/arrow2d_manipulator.c
index 5e7975d05e3..6e263b86bfa 100644
--- a/source/blender/editors/manipulator_library/arrow2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/arrow2d_manipulator.c
@@ -75,7 +75,7 @@ static void arrow2d_draw_geom(ArrowManipulator2D *arrow, const float matrix[4][4
const float len = arrow->line_len;
const float draw_line_ofs = (arrow->manipulator.line_width * 0.5f) / arrow->manipulator.scale;
- uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
gpuPushMatrix();
gpuMultMatrix(matrix);
@@ -90,12 +90,12 @@ static void arrow2d_draw_geom(ArrowManipulator2D *arrow, const float matrix[4][4
immUniformColor4fv(color);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, 0.0f, 0.0f);
immVertex2f(pos, 0.0f, len);
immEnd();
- immBegin(PRIM_TRIANGLES, 3);
+ immBegin(GWN_PRIM_TRIS, 3);
immVertex2f(pos, size_h, len);
immVertex2f(pos, -size_h, len);
immVertex2f(pos, 0.0f, len + size * 1.7f);
diff --git a/source/blender/editors/manipulator_library/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
index 41368240f46..6e7fa3a7269 100644
--- a/source/blender/editors/manipulator_library/arrow3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
@@ -101,7 +101,7 @@ static void manipulator_arrow_matrix_world_get(wmManipulator *mpr, float r_matri
static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, const float color[4])
{
- uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
bool unbind_shader = true;
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -109,7 +109,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
if (arrow->style & ED_MANIPULATOR_ARROW_STYLE_CROSS) {
immUniformColor4fv(color);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex3f(pos, -1.0f, 0.0f, 0.0f);
immVertex3f(pos, 1.0f, 0.0f, 0.0f);
immVertex3f(pos, 0.0f, -1.0f, 0.0f);
@@ -127,7 +127,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
};
glLineWidth(arrow->manipulator.line_width);
- wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, PRIM_LINE_LOOP);
+ wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_LOOP);
}
else {
#ifdef USE_MANIPULATOR_CUSTOM_ARROWS
@@ -140,7 +140,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
};
glLineWidth(arrow->manipulator.line_width);
- wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, PRIM_LINE_STRIP);
+ wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP);
/* *** draw arrow head *** */
diff --git a/source/blender/editors/manipulator_library/cage2d_manipulator.c b/source/blender/editors/manipulator_library/cage2d_manipulator.c
index bf6c23f98e7..07667c70bd4 100644
--- a/source/blender/editors/manipulator_library/cage2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/cage2d_manipulator.c
@@ -86,12 +86,12 @@ typedef struct Cage2D {
static void rect_transform_draw_corners(
const rctf *r, const float offsetx, const float offsety, const float color[3])
{
- uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3fv(color);
- immBegin(PRIM_LINES, 16);
+ immBegin(GWN_PRIM_LINES, 16);
immVertex2f(pos, r->xmin, r->ymin + offsety);
immVertex2f(pos, r->xmin, r->ymin);
@@ -175,14 +175,14 @@ static void rect_transform_draw_interaction(
return;
}
- VertexFormat *format = immVertexFormat();
- uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- uint color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
glLineWidth(line_width + 3.0);
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immAttrib3f(color, 0.0f, 0.0f, 0.0f);
immVertex2fv(pos, verts[0]);
immVertex2fv(pos, verts[1]);
@@ -191,7 +191,7 @@ static void rect_transform_draw_interaction(
glLineWidth(line_width);
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immAttrib3fv(color, col);
immVertex2fv(pos, verts[0]);
immVertex2fv(pos, verts[1]);
diff --git a/source/blender/editors/manipulator_library/dial3d_manipulator.c b/source/blender/editors/manipulator_library/dial3d_manipulator.c
index 111ea04cd3b..753cd794fe1 100644
--- a/source/blender/editors/manipulator_library/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/dial3d_manipulator.c
@@ -130,8 +130,8 @@ static void dial_geom_draw(
glLineWidth(dial->manipulator.line_width);
- VertexFormat *format = immVertexFormat();
- uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
if (clip_plane) {
immBindBuiltinProgram(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR);
@@ -168,13 +168,13 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[
gpuPushMatrix();
gpuRotate3f(RAD2DEGF(angle), 0.0f, 0.0f, -1.0f);
- uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(col);
- immBegin(PRIM_LINE_STRIP, 2);
+ immBegin(GWN_PRIM_LINE_STRIP, 2);
immVertex3f(pos, 0.0f, 0.0f, 0.0f);
immVertex3fv(pos, co_outer);
immEnd();
@@ -189,8 +189,8 @@ static void dial_ghostarc_draw(
{
const float width_inner = DIAL_WIDTH - dial->manipulator.line_width * 0.5f / U.manipulator_size;
- VertexFormat *format = immVertexFormat();
- uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(color);
imm_draw_disk_partial_fill(
diff --git a/source/blender/editors/manipulator_library/grab3d_manipulator.c b/source/blender/editors/manipulator_library/grab3d_manipulator.c
index c794c99160c..995ee4e97c4 100644
--- a/source/blender/editors/manipulator_library/grab3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/grab3d_manipulator.c
@@ -96,8 +96,8 @@ static void grab_geom_draw(
glLineWidth(grab3d->manipulator.line_width);
- VertexFormat *format = immVertexFormat();
- uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
diff --git a/source/blender/editors/manipulator_library/manipulator_draw_utils.c b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
index cfa1bc38ed5..4bd7f74e6e5 100644
--- a/source/blender/editors/manipulator_library/manipulator_draw_utils.c
+++ b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
@@ -64,52 +64,52 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo
* So we don't need to re-created and discard it every time */
const bool use_lighting = true || (!select && ((U.manipulator_flag & USER_MANIPULATOR_SHADED) != 0));
- VertexBuffer *vbo;
- ElementList *el;
- Batch *batch;
- ElementListBuilder elb = {0};
+ Gwn_VertBuf *vbo;
+ Gwn_IndexBuf *el;
+ Gwn_Batch *batch;
+ Gwn_IndexBufBuilder elb = {0};
- VertexFormat format = {0};
- uint pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat format = {0};
+ uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
uint nor_id;
if (use_lighting) {
- nor_id = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
+ nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
/* Elements */
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, info->ntris, info->nverts);
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, info->ntris, info->nverts);
for (int i = 0; i < info->ntris; ++i) {
const unsigned short *idx = &info->indices[i * 3];
- add_triangle_vertices(&elb, idx[0], idx[1], idx[2]);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);
}
- el = ElementList_build(&elb);
+ el = GWN_indexbuf_build(&elb);
- vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, info->nverts);
+ vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, info->nverts);
- VertexBuffer_fill_attrib(vbo, pos_id, info->verts);
+ GWN_vertbuf_attr_fill(vbo, pos_id, info->verts);
if (use_lighting) {
/* Normals are expected to be smooth. */
- VertexBuffer_fill_attrib(vbo, nor_id, info->normals);
+ GWN_vertbuf_attr_fill(vbo, nor_id, info->normals);
}
- batch = Batch_create(PRIM_TRIANGLES, vbo, el);
+ batch = GWN_batch_create(GWN_PRIM_TRIS, vbo, el);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
- Batch_Uniform4fv(batch, "color", color);
+ GWN_batch_uniform_4fv(batch, "color", color);
glEnable(GL_CULL_FACE);
// glEnable(GL_DEPTH_TEST);
- Batch_draw(batch);
+ GWN_batch_draw(batch);
glDisable(GL_DEPTH_TEST);
// glDisable(GL_CULL_FACE);
- Batch_discard_all(batch);
+ GWN_batch_discard_all(batch);
}
void wm_manipulator_vec_draw(
diff --git a/source/blender/editors/manipulator_library/primitive3d_manipulator.c b/source/blender/editors/manipulator_library/primitive3d_manipulator.c
index ba728145163..75151830109 100644
--- a/source/blender/editors/manipulator_library/primitive3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/primitive3d_manipulator.c
@@ -79,10 +79,10 @@ static void manipulator_primitive_draw_geom(
}
if (vert_count > 0) {
- uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- wm_manipulator_vec_draw(col_inner, verts, vert_count, pos, PRIM_TRIANGLE_FAN);
- wm_manipulator_vec_draw(col_outer, verts, vert_count, pos, PRIM_LINE_LOOP);
+ wm_manipulator_vec_draw(col_inner, verts, vert_count, pos, GWN_PRIM_TRI_FAN);
+ wm_manipulator_vec_draw(col_outer, verts, vert_count, pos, GWN_PRIM_LINE_LOOP);
immUnbindProgram();
}
}
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index b3e6a369d90..72bc61139c6 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -123,8 +123,8 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
return;
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
const unsigned char rgb_gray[4] = {0x60, 0x60, 0x60, 0xff};
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -133,7 +133,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
/* this could be split into its own loop */
if (draw_type == MASK_DT_OUTLINE) {
glLineWidth(3.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, point_pos);
immVertex2fv(pos, handle_pos);
immEnd();
@@ -153,7 +153,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
}
glLineWidth(1.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, point_pos);
immVertex2fv(pos, handle_pos);
immEnd();
@@ -177,7 +177,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
immUniform4fv("outlineColor", point_color);
immUniformColor3fvAlpha(point_color, 0.25f);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2fv(pos, handle_pos);
immEnd();
@@ -211,8 +211,8 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline
mask_spline_color_get(masklay, spline, is_spline_sel, rgb_spline);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);
immUniform1f("size", 0.7f * handle_size);
@@ -250,7 +250,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline
immUniformThemeColor(TH_HANDLE_VERTEX);
}
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2fv(pos, feather_point);
immEnd();
@@ -319,7 +319,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline
else
immUniformThemeColor(TH_HANDLE_VERTEX);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2fv(pos, vert);
immEnd();
@@ -349,7 +349,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline
immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 1.0f);
immUniform1f("size", 12.0f);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(pos, x, y);
immEnd();
@@ -370,7 +370,7 @@ static void mask_color_active_tint(unsigned char r_rgb[4], const unsigned char r
}
}
-static void mask_draw_array(unsigned int pos, PrimitiveType prim_type, const float (*points)[2], unsigned int vertex_ct)
+static void mask_draw_array(unsigned int pos, Gwn_PrimType prim_type, const float (*points)[2], unsigned int vertex_ct)
{
immBegin(prim_type, vertex_ct);
for (unsigned int i = 0; i < vertex_ct; ++i) {
@@ -383,7 +383,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (*
const bool is_feather, const bool is_active,
const unsigned char rgb_spline[4], const char draw_type)
{
- const PrimitiveType draw_method = (spline->flag & MASK_SPLINE_CYCLIC) ? PRIM_LINE_LOOP : PRIM_LINE_STRIP;
+ const Gwn_PrimType draw_method = (spline->flag & MASK_SPLINE_CYCLIC) ? GWN_PRIM_LINE_LOOP : GWN_PRIM_LINE_STRIP;
const unsigned char rgb_black[4] = {0x00, 0x00, 0x00, 0xff};
unsigned char rgb_tmp[4];
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -401,8 +401,8 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (*
}
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
switch (draw_type) {
@@ -815,12 +815,12 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra
unsigned int num_lines = BLI_listbase_count(&masklay->splines_shapes);
if (num_lines > 0) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ub(255, 175, 0, 255);
- immBegin(PRIM_LINES, 2 * num_lines);
+ immBegin(GWN_PRIM_LINES, 2 * num_lines);
for (MaskLayerShape *masklay_shape = masklay->splines_shapes.first;
masklay_shape;
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 530faffdac1..3c974e4b3b9 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1002,13 +1002,13 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd)
copy_v3_v3(v2, ray_hit_best[1]);
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_TRANSFORM);
glLineWidth(2.0);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, v1);
immVertex3fv(pos, v2);
immEnd();
@@ -1044,7 +1044,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
gpuPushMatrix();
gpuMultMatrix(kcd->ob->obmat);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -1055,7 +1055,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor3ubv(kcd->colors.line);
glLineWidth(2.0);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, kcd->prev.cage);
immVertex3fv(pos, kcd->curr.cage);
immEnd();
@@ -1065,7 +1065,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor3ubv(kcd->colors.point);
glPointSize(11);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->prev.cage);
immEnd();
}
@@ -1074,7 +1074,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor3ubv(kcd->colors.curpoint);
glPointSize(9);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->prev.cage);
immEnd();
}
@@ -1083,7 +1083,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor3ubv(kcd->colors.edge);
glLineWidth(2.0);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, kcd->curr.edge->v1->cageco);
immVertex3fv(pos, kcd->curr.edge->v2->cageco);
immEnd();
@@ -1092,7 +1092,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor3ubv(kcd->colors.point);
glPointSize(11);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->curr.cage);
immEnd();
}
@@ -1101,7 +1101,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor3ubv(kcd->colors.curpoint);
glPointSize(9);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->curr.cage);
immEnd();
}
@@ -1117,7 +1117,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor4ubv(kcd->colors.point_a);
glPointSize(11);
- immBeginAtMost(PRIM_POINTS, kcd->totlinehit);
+ immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit);
lh = kcd->linehits;
for (i = 0; i < kcd->totlinehit; i++, lh++) {
@@ -1132,7 +1132,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor4ubv(kcd->colors.curpoint_a);
glPointSize(7);
- immBeginAtMost(PRIM_POINTS, kcd->totlinehit);
+ immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit);
lh = kcd->linehits;
for (i = 0; i < kcd->totlinehit; i++, lh++) {
@@ -1153,7 +1153,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor3ubv(kcd->colors.line);
glLineWidth(1.0);
- immBeginAtMost(PRIM_LINES, BLI_mempool_count(kcd->kedges) * 2);
+ immBeginAtMost(GWN_PRIM_LINES, BLI_mempool_count(kcd->kedges) * 2);
BLI_mempool_iternew(kcd->kedges, &iter);
for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
@@ -1174,7 +1174,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immUniformColor3ubv(kcd->colors.point);
glPointSize(5.0);
- immBeginAtMost(PRIM_POINTS, BLI_mempool_count(kcd->kverts));
+ immBeginAtMost(GWN_PRIM_POINTS, BLI_mempool_count(kcd->kverts));
BLI_mempool_iternew(kcd->kverts, &iter);
for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) {
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index e7a6689b57c..6a656ace09c 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -108,13 +108,13 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
gpuPushMatrix();
gpuMultMatrix(lcd->ob->obmat);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ub(255, 0, 255);
if (lcd->totedge > 0) {
- immBegin(PRIM_LINES, lcd->totedge * 2);
+ immBegin(GWN_PRIM_LINES, lcd->totedge * 2);
for (int i = 0; i < lcd->totedge; i++) {
immVertex3fv(pos, lcd->edges[i][0]);
@@ -127,7 +127,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (lcd->totpoint > 0) {
glPointSize(3.0f);
- immBegin(PRIM_POINTS, lcd->totpoint);
+ immBegin(GWN_PRIM_POINTS, lcd->totpoint);
for (int i = 0; i < lcd->totpoint; i++) {
immVertex3fv(pos, lcd->points[i]);
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 27ea7e09fd6..fb3cfdc86b2 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -2712,7 +2712,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
brush = &pset->brush[pset->brushtype];
if (brush) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ub(255, 255, 255, 128);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 9d3dde06925..c882b1b093e 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -92,12 +92,12 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(PRIM_LINE_STRIP, 5);
+ immBegin(GWN_PRIM_LINE_STRIP, 5);
/* right */
immAttrib4ub(color, 0, 0, 0, 30);
@@ -222,16 +222,16 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f
BLI_rcti_init(&click_rect, x, x + icon_size, y, y + icon_size);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immAttrib4ub(color, 255, 0, 0, alpha_debug);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
imm_draw_line_box(pos, click_rect.xmin, click_rect.ymin, click_rect.xmax, click_rect.ymax);
immAttrib4ub(color, 0, 255, 255, alpha_debug);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, click_rect.xmin, click_rect.ymin);
immVertex2f(pos, click_rect.xmax, click_rect.ymax);
immVertex2f(pos, click_rect.xmin, click_rect.ymax);
@@ -255,12 +255,12 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
glEnable(GL_LINE_SMOOTH);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(PRIM_LINES, 12);
+ immBegin(GWN_PRIM_LINES, 12);
immAttrib4ub(col, 255, 255, 255, 180);
immVertex2f(pos, x1, y2);
@@ -297,8 +297,8 @@ static void region_draw_azone_icon(AZone *az)
float midx = az->x1 + (az->x2 - az->x1) * 0.5f;
float midy = az->y1 + (az->y2 - az->y1) * 0.5f;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* outlined circle */
GPU_enable_program_point_size(); /* TODO: make a fixed-size shader to avoid this */
@@ -307,7 +307,7 @@ static void region_draw_azone_icon(AZone *az)
immUniform4f("outlineColor", 0.2f, 0.2f, 0.2f, 0.9f);
immUniform1f("outlineWidth", 1.0f);
immUniform1f("size", 9.5f);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(pos, midx, midy);
immEnd();
immUnbindProgram();
@@ -316,7 +316,7 @@ static void region_draw_azone_icon(AZone *az)
/* + */
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(0.2f, 0.2f, 0.2f, 0.9f);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, midx, midy - 2);
immVertex2f(pos, midx, midy + 3);
immVertex2f(pos, midx - 2, midy);
@@ -330,8 +330,8 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2)
float width = 0.1f * U.widget_unit;
float pad = 0.2f * U.widget_unit;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
glEnable(GL_BLEND);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -566,8 +566,8 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
/* for debugging unneeded area redraws and partial redraw */
#if 0
glEnable(GL_BLEND);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(drand48(), drand48(), drand48(), 0.1f);
immRectf(pos, ar->drawrct.xmin - ar->winrct.xmin, ar->drawrct.ymin - ar->winrct.ymin,
@@ -2015,8 +2015,8 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int c
/* view should be in pixelspace */
UI_view2d_view_restore(C);
glEnable(GL_BLEND);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor((ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK);
immRecti(pos, 0, 0, BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct) + 1);
@@ -2164,8 +2164,8 @@ void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(fill_color);
immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1);
@@ -2383,8 +2383,8 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame,
/* set up rect */
BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y);
/* draw top box */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_METADATA_BG);
immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
@@ -2408,8 +2408,8 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame,
/* set up box rect */
BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin);
/* draw top box */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_METADATA_BG);
immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
@@ -2437,8 +2437,8 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x1, &y1);
UI_view2d_view_to_region(&ar->v2d, 1.0f, 1.0f, &x2, &y2);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShade(TH_BACK, 20);
@@ -2470,12 +2470,12 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
int count_large = 1.0f / (4.0f * gridstep);
if (count_fine > 0) {
- VertexFormat_clear(format);
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ GWN_vertformat_clear(format);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(PRIM_LINES, 4 * count_fine + 4 * count_large);
+ immBegin(GWN_PRIM_LINES, 4 * count_fine + 4 * count_large);
float theme_color[3];
UI_GetThemeColorShade3fv(TH_BACK, (int)(20.0f * (1.0f - blendfac)), theme_color);
@@ -2545,7 +2545,7 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect)
void ED_region_cache_draw_background(const ARegion *ar)
{
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ub(128, 128, 255, 64);
immRecti(pos, 0, 0, ar->winx, 8 * UI_DPI_FAC);
@@ -2565,7 +2565,7 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f
BLF_width_and_height(fontid, numstr, sizeof(numstr), &font_dims[0], &font_dims[1]);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_CFRAME);
immRecti(pos, x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f);
@@ -2579,7 +2579,7 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f
void ED_region_cache_draw_cached_segments(const ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra)
{
if (num_segments) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ub(128, 128, 255, 128);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 2eb981467f2..7ce16efdb97 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -139,9 +139,9 @@ static int get_cached_work_texture(int *r_w, int *r_h)
static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state)
{
- VertexFormat *vert_format = immVertexFormat();
- state->pos = VertexFormat_add_attrib(vert_format, "pos", COMP_F32, 2, KEEP_FLOAT);
- state->texco = VertexFormat_add_attrib(vert_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *vert_format = immVertexFormat();
+ state->pos = GWN_vertformat_attr_add(vert_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ state->texco = GWN_vertformat_attr_add(vert_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
/* To be used before calling immDrawPixelsTex
@@ -303,7 +303,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, format, GL_UNSIGNED_BYTE, &uc_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components + (subpart_x * offset_x + subpart_w - 1) * components]);
}
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texco, (float)(0 + offset_left) / tex_w, (float)(0 + offset_bot) / tex_h);
immVertex2f(pos, rast_x + (float)offset_left * xzoom, rast_y + (float)offset_bot * yzoom);
@@ -693,28 +693,28 @@ void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, flo
delta_y = min_ff(delta_y, border->ymax - border->ymin);
/* left bottom corner */
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmin, border->ymin + delta_y);
immVertex2f(pos, border->xmin, border->ymin);
immVertex2f(pos, border->xmin + delta_x, border->ymin);
immEnd();
/* left top corner */
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmin, border->ymax - delta_y);
immVertex2f(pos, border->xmin, border->ymax);
immVertex2f(pos, border->xmin + delta_x, border->ymax);
immEnd();
/* right bottom corner */
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmax - delta_x, border->ymin);
immVertex2f(pos, border->xmax, border->ymin);
immVertex2f(pos, border->xmax, border->ymin + delta_y);
immEnd();
/* right top corner */
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, border->xmax - delta_x, border->ymax);
immVertex2f(pos, border->xmax, border->ymax);
immVertex2f(pos, border->xmax, border->ymax - delta_y);
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index 52c13871925..5690076fedb 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -94,7 +94,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos)
}
}
- immBegin(PRIM_TRIANGLE_FAN, 5);
+ immBegin(GWN_PRIM_TRI_FAN, 5);
for (i = 0; i < 5; i++) {
immVertex2f(pos, points[i].x, points[i].y);
@@ -102,7 +102,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos)
immEnd();
- immBegin(PRIM_TRIANGLE_FAN, 5);
+ immBegin(GWN_PRIM_TRI_FAN, 5);
for (i = 4; i < 8; i++) {
immVertex2f(pos, points[i].x, points[i].y);
@@ -175,7 +175,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos)
}
}
- immBegin(PRIM_TRIANGLE_FAN, 5);
+ immBegin(GWN_PRIM_TRI_FAN, 5);
for (i = 0; i < 5; i++) {
immVertex2f(pos, points[i].x, points[i].y);
@@ -183,7 +183,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos)
immEnd();
- immBegin(PRIM_TRIANGLE_FAN, 5);
+ immBegin(GWN_PRIM_TRI_FAN, 5);
for (i = 4; i < 8; i++) {
immVertex2f(pos, points[i].x, points[i].y);
@@ -246,7 +246,7 @@ static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, shor
return;
}
- immBegin(PRIM_LINES, count);
+ immBegin(GWN_PRIM_LINES, count);
/* right border area */
if (x2 < sizex - 1) {
@@ -304,7 +304,7 @@ void ED_screen_draw(wmWindow *win)
wmSubWindowSet(win, screen->mainwin);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* Note: first loop only draws if U.pixelsize > 1, skip otherwise */
@@ -368,7 +368,7 @@ void ED_screen_draw(wmWindow *win)
glEnable(GL_BLEND);
immUniformColor4ub(255, 255, 255, 100);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y);
@@ -378,7 +378,7 @@ void ED_screen_draw(wmWindow *win)
immUniformColor4ub(0, 0, 0, 100);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y + 1);
immVertex2f(pos, sa3->totrct.xmax, win->eventstate->y + 1);
@@ -391,7 +391,7 @@ void ED_screen_draw(wmWindow *win)
immUniformColor4ub(0, 0, 0, 100);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymin);
immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymax);
@@ -433,7 +433,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2
const float ofs_between_areas)
{
const float ofs_h = ofs_between_areas * 0.5f;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(col);
@@ -446,7 +446,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2
.ymax = sa->totrct.ymax * scale[1] - ofs_h
};
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immVertex2f(pos, rect.xmin, rect.ymin);
immVertex2f(pos, rect.xmax, rect.ymin);
immVertex2f(pos, rect.xmax, rect.ymax);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index a0b077a6b29..6fa8905293c 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -456,8 +456,8 @@ static void screencast_draw_cursor(bContext *UNUSED(C), int x, int y, void *UNUS
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index d48b6f86831..a9b4df81277 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -660,9 +660,9 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
}
/* set quad color. Colored overlay does not get blending */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
if (col) {
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
@@ -676,7 +676,7 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
/* draw textured quad */
immUniform1i("image", GL_TEXTURE0);
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texCoord, 0.0f, 0.0f);
immVertex2f(pos, quad.xmin, quad.ymin);
immAttrib2f(texCoord, 1.0f, 0.0f);
@@ -745,9 +745,9 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
gpuTranslate2f(-center[0], -center[1]);
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
@@ -758,7 +758,7 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
/* draw textured quad */
immUniform1i("image", GL_TEXTURE0);
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texCoord, 0.0f, 0.0f);
immVertex2f(pos, quad.xmin, quad.ymin);
immAttrib2f(texCoord, 1.0f, 0.0f);
@@ -819,7 +819,7 @@ BLI_INLINE void draw_tri_point(
{co[0] + w, co[1] - w},
};
- immBegin(PRIM_LINE_LOOP, 3);
+ immBegin(GWN_PRIM_LINE_LOOP, 3);
immVertex2fv(pos, tri[0]);
immVertex2fv(pos, tri[1]);
immVertex2fv(pos, tri[2]);
@@ -828,7 +828,7 @@ BLI_INLINE void draw_tri_point(
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
glLineWidth(1.0f);
- immBegin(PRIM_LINE_LOOP, 3);
+ immBegin(GWN_PRIM_LINE_LOOP, 3);
immVertex2fv(pos, tri[0]);
immVertex2fv(pos, tri[1]);
immVertex2fv(pos, tri[2]);
@@ -863,7 +863,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
glLineWidth(3.0f);
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2fv(pos, bez->vec[0]);
immVertex2fv(pos, bez->vec[1]);
immVertex2fv(pos, bez->vec[2]);
@@ -877,7 +877,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez
else {
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
}
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, bez->vec[0]);
immVertex2fv(pos, bez->vec[1]);
immEnd();
@@ -888,7 +888,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez
else {
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
}
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, bez->vec[1]);
immVertex2fv(pos, bez->vec[2]);
immEnd();
@@ -905,7 +905,7 @@ static void paint_draw_curve_cursor(Brush *brush)
glEnable(GL_BLEND);
/* draw the bezier handles and the curve segment between the current and next point */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -936,7 +936,7 @@ static void paint_draw_curve_cursor(Brush *brush)
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
glLineWidth(3.0f);
- immBegin(PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1);
for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) {
immVertex2fv(pos, v[j]);
}
@@ -944,7 +944,7 @@ static void paint_draw_curve_cursor(Brush *brush)
immUniformColor4f(0.9f, 0.9f, 1.0f, 0.5f);
glLineWidth(1.0f);
- immBegin(PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1);
for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) {
immVertex2fv(pos, v[j]);
}
@@ -1089,7 +1089,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
glEnable(GL_BLEND); /* TODO: also set blend mode? */
glEnable(GL_LINE_SMOOTH);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* set brush color */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index f31b5984c61..8c6b3b0106c 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -722,15 +722,15 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
glLineWidth(4.0);
immUniformColor4ub(0, 0, 0, 255);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2i(pos, x, y);
immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]);
immEnd();
@@ -738,7 +738,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
glLineWidth(2.0);
immUniformColor4ub(255, 255, 255, 255);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2i(pos, x, y);
immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]);
immEnd();
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index bc561c345b4..86008ec0308 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -147,11 +147,11 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv(paint->paint_cursor_col);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, x, y);
immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]);
immEnd();
@@ -170,7 +170,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
glEnable(GL_LINE_SMOOTH);
- uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -183,7 +183,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
immUniformArray4fv("colors", (float *)(float[][4]){{0.0f, 0.0f, 0.0f, alpha}, {1.0f, 1.0f, 1.0f, alpha}}, 2);
immUniform1f("dash_width", 6.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
if (stroke->constrain_line) {
immVertex2f(shdr_pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]);
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 28beb2c3f8d..ee6f25ee44e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -213,7 +213,7 @@ static void brush_drawcursor_uvsculpt(bContext *C, int x, int y, void *UNUSED(cu
alpha *= (size - PX_SIZE_FADE_MIN) / (PX_SIZE_FADE_MAX - PX_SIZE_FADE_MIN);
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3fvAlpha(brush->add_col, alpha);
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 1cf97af7a35..11ac1d60f39 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -204,8 +204,8 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* first backdrop strips */
y = (float)(-ACHANNEL_HEIGHT(ac));
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -319,7 +319,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
if (saction->flag & SACTION_MOVING) {
immUniformColor3f(0.0f, 0.0f, 0.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, saction->timeslide, v2d->cur.ymin - EXTRA_SCROLL_PAD);
immVertex2f(pos, saction->timeslide, v2d->cur.ymax);
immEnd();
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index 954b3f2bd1a..0f06d66d033 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -129,8 +129,8 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
unsigned int keyframe_ct = 0;
- VertexFormat *format = immVertexFormat();
- unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* don't use totrect set, as the width stays the same
@@ -214,14 +214,14 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
if (keyframe_ct > 0) {
/* draw keyframe markers */
format = immVertexFormat();
- pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int size_id = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT);
- unsigned int color_id = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT);
- unsigned int outline_color_id = VertexFormat_add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
+ unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
+ unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
GPU_enable_program_point_size();
- immBegin(PRIM_POINTS, keyframe_ct);
+ immBegin(GWN_PRIM_POINTS, keyframe_ct);
/* all same size with black outline */
immAttrib1f(size_id, 2.0f * STRIP_HEIGHT_HALF);
@@ -317,8 +317,8 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
*/
float y = (float) CHANNEL_FIRST;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 0108e23af02..15ec385fd09 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -79,7 +79,7 @@ static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int wid
int x = (frame - sfra) * framelen;
if (width == 1) {
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2i(pos, x, 0);
immVertex2i(pos, x, height * UI_DPI_FAC);
immEnd();
@@ -166,7 +166,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points);
ED_region_cache_draw_cached_segments(ar, totseg, points, sfra, efra);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* track */
@@ -247,7 +247,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
ED_region_cache_draw_curfra_label(sc->user.framenr, x, 8.0f * UI_DPI_FAC);
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* solver keyframes */
@@ -289,7 +289,7 @@ static void draw_movieclip_muted(ARegion *ar, int width, int height, float zoomx
{
int x, y;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* find window pixel coordinates of origin */
@@ -348,7 +348,7 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int
/* draw boundary border for frame if stabilization is enabled */
if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) {
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* Exclusive OR allows to get orig value when second operand is 0,
* and negative of orig value when second operand is 1. */
@@ -442,7 +442,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
i++;
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -453,7 +453,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if ((b - a - 1) >= 1) {
glPointSize(5.0f);
- immBegin(PRIM_POINTS, b - a - 1);
+ immBegin(GWN_PRIM_POINTS, b - a - 1);
for (i = a; i < b; i++) {
if (i != curindex) {
@@ -468,7 +468,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if ((b - a) >= 2) {
glLineWidth(3.0f);
- immBegin(PRIM_LINE_STRIP, b - a);
+ immBegin(GWN_PRIM_LINE_STRIP, b - a);
for (i = a; i < b; i++) {
immVertex2f(pos, path[i][0], path[i][1]);
@@ -484,7 +484,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if ((curindex - a) >= 1) {
immUniformThemeColor(TH_PATH_BEFORE);
- immBegin(PRIM_POINTS, curindex - a);
+ immBegin(GWN_PRIM_POINTS, curindex - a);
for (i = a; i < curindex; i++) {
immVertex2f(pos, path[i][0], path[i][1]);
@@ -496,7 +496,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if ((b - curindex - 1) >= 1) {
immUniformThemeColor(TH_PATH_AFTER);
- immBegin(PRIM_POINTS, b - curindex - 1);
+ immBegin(GWN_PRIM_POINTS, b - curindex - 1);
for (i = curindex + 1; i < b; i++) {
immVertex2f(pos, path[i][0], path[i][1]);
@@ -511,7 +511,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if ((curindex - a + 1) >= 2) {
immUniformThemeColor(TH_PATH_BEFORE);
- immBegin(PRIM_LINE_STRIP, curindex - a + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, curindex - a + 1);
for (i = a; i <= curindex; i++) {
immVertex2f(pos, path[i][0], path[i][1]);
@@ -523,7 +523,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if ((b - curindex) >= 2) {
immUniformThemeColor(TH_PATH_AFTER);
- immBegin(PRIM_LINE_STRIP, b - curindex);
+ immBegin(GWN_PRIM_LINE_STRIP, b - curindex);
for (i = curindex; i < b; i++) {
immVertex2f(pos, path[i][0], path[i][1]);
@@ -564,12 +564,12 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
{
glPointSize(tiny ? 3.0f : 4.0f);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(position, pos[0], pos[1]);
immEnd();
}
else {
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex2f(position, pos[0] + px[0] * 2, pos[1]);
immVertex2f(position, pos[0] + px[0] * 8, pos[1]);
@@ -592,7 +592,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
gpuTranslate2fv(marker_pos);
if (sc->flag & SC_SHOW_MARKER_PATTERN) {
- immBegin(PRIM_LINE_LOOP, 4);
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex2fv(position, marker->pattern_corners[0]);
immVertex2fv(position, marker->pattern_corners[1]);
immVertex2fv(position, marker->pattern_corners[2]);
@@ -690,14 +690,14 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
immUniform1f("dash_factor", 2.0f); /* Solid "line" */
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(shdr_pos, pos[0], pos[1]);
immEnd();
}
else {
immUniform1f("dash_factor", 2.0f); /* Solid line */
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex2f(shdr_pos, pos[0] + px[0] * 3, pos[1]);
immVertex2f(shdr_pos, pos[0] + px[0] * 7, pos[1]);
@@ -720,7 +720,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_XOR);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(shdr_pos, pos);
immVertex2fv(shdr_pos, marker_pos);
immEnd();
@@ -768,7 +768,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
}
if ((track->pat_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_PATTERN)) {
- immBegin(PRIM_LINE_LOOP, 4);
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex2fv(shdr_pos, marker->pattern_corners[0]);
immVertex2fv(shdr_pos, marker->pattern_corners[1]);
immVertex2fv(shdr_pos, marker->pattern_corners[2]);
@@ -790,7 +790,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
/* Restore default shader */
immUnbindProgram();
- const uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
BLI_assert(pos == shdr_pos);
UNUSED_VARS_NDEBUG(pos);
@@ -842,7 +842,7 @@ static void draw_marker_slide_triangle(float x, float y, float dx, float dy, int
tdy += px[1];
}
- immBegin(PRIM_TRIANGLES, 3);
+ immBegin(GWN_PRIM_TRIS, 3);
immVertex2f(pos, x, y);
immVertex2f(pos, x - tdx, y);
immVertex2f(pos, x, y + tdy);
@@ -920,7 +920,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
glLineWidth(outline ? 3.0f : 1.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, 0.0f, 0.0f);
immVertex2fv(pos, tilt_ctrl);
immEnd();
@@ -1128,15 +1128,15 @@ static void draw_plane_marker_image(Scene *scene,
gpuPushMatrix();
gpuMultMatrix(gl_matrix);
- VertexFormat *imm_format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(imm_format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *imm_format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
immUniformColor4f(1.0f, 1.0f, 1.0f, plane_track->image_opacity);
immUniform1i("image", GL_TEXTURE0);
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texCoord, 0.0f, 0.0f);
immVertex2f(pos, 0.0f, 0.0f);
@@ -1190,7 +1190,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
}
if (draw_plane_quad || is_selected_track) {
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -1223,7 +1223,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
}
/* Draw rectangle itself. */
- immBegin(PRIM_LINE_LOOP, 4);
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex2fv(shdr_pos, plane_marker->corners[0]);
immVertex2fv(shdr_pos, plane_marker->corners[1]);
immVertex2fv(shdr_pos, plane_marker->corners[2]);
@@ -1236,7 +1236,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
immUniformColor3f(1.0f, 0.0f, 0.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[1], end_point);
immVertex2fv(shdr_pos, plane_marker->corners[0]);
@@ -1246,7 +1246,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
immUniformColor3f(0.0f, 1.0f, 0.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[3], end_point);
immVertex2fv(shdr_pos, plane_marker->corners[0]);
@@ -1398,7 +1398,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie
}
}
- unsigned int position = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1503,7 +1503,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie
immUniformColor3f(1.0f, 0.0f, 0.0f);
}
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
if (undistort) {
immVertex2f(position, pos[0] / width, pos[1] / (height * aspy));
@@ -1582,7 +1582,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
gpuMultMatrix(sc->stabmat);
gpuScale2f(width, height);
- unsigned int position = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1659,7 +1659,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
immUniformColor3f(1.0f, 0.0f, 0.0f);
for (i = 0; i <= n; i++) {
- immBegin(PRIM_LINE_STRIP, n + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, n + 1);
for (j = 0; j <= n; j++) {
immVertex2fv(position, grid[i][j]);
@@ -1669,7 +1669,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
}
for (j = 0; j <= n; j++) {
- immBegin(PRIM_LINE_STRIP, n + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, n + 1);
for (i = 0; i <= n; i++) {
immVertex2fv(position, grid[i][j]);
@@ -1727,7 +1727,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
sub_v2_v2v2(dpos, npos, pos);
mul_v2_fl(dpos, 1.0f / steps);
- immBegin(PRIM_LINE_STRIP, steps + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, steps + 1);
for (j = 0; j <= steps; j++) {
BKE_tracking_distort_v2(tracking, pos, tpos);
@@ -1740,7 +1740,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
}
}
else if (stroke->totpoints == 1) {
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(position, stroke->points[0].x + offsx, stroke->points[0].y + offsy);
immEnd();
}
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index c9db5d4a328..5c2782dc26d 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -90,11 +90,11 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track,
immUniformColor4fv(col);
if (is_point) {
- immBeginAtMost(PRIM_POINTS, 1);
+ immBeginAtMost(GWN_PRIM_POINTS, 1);
}
else {
/* Graph can be composed of smaller segments, if any marker is disabled */
- immBeginAtMost(PRIM_LINE_STRIP, track->markersnr);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, track->markersnr);
}
}
@@ -236,11 +236,11 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *
immUniformColor4fv(col);
if (is_point) { /* This probably never happens here, but just in case... */
- immBeginAtMost(PRIM_POINTS, 1);
+ immBeginAtMost(GWN_PRIM_POINTS, 1);
}
else {
/* Graph can be composed of smaller segments, if any marker is disabled */
- immBeginAtMost(PRIM_LINE_STRIP, track->markersnr);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, track->markersnr);
}
}
}
@@ -299,7 +299,7 @@ static void draw_frame_curves(SpaceClip *sc, unsigned int pos)
}
if (!lines) {
- immBeginAtMost(PRIM_LINE_STRIP, reconstruction->camnr);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, reconstruction->camnr);
lines = 1;
}
@@ -327,7 +327,7 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
UI_view2d_grid_free(grid);
if (clip) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
glPointSize(3.0f);
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 5d02f02167b..40661937bae 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -248,13 +248,13 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
View2D *v2d = &ar->v2d;
float x = (float)(sc->user.framenr * scene->r.framelen);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_CFRAME);
glLineWidth(2.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, x, v2d->cur.ymin);
immVertex2f(pos, x, v2d->cur.ymax);
immEnd();
@@ -283,7 +283,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f);
@@ -297,7 +297,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
/* thin lines where the actual frames are */
glLineWidth(1.0f);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, (float)SFRA, v2d->cur.ymin);
immVertex2f(pos, (float)SFRA, v2d->cur.ymax);
immVertex2f(pos, (float)EFRA, v2d->cur.ymin);
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index e813557f9e8..c8a06545e0f 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -158,8 +158,8 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
int offl = 0, offc = 0;
int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
int pen[2];
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
xy[1] += tvc->lheight / 6;
console_cursor_wrap_offset(sc->prompt, tvc->console_width, &offl, &offc, NULL);
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 61f33d72b71..be873358931 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -399,8 +399,8 @@ static void file_draw_preview(
/* border */
if (use_dropshadow) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2,KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2,GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f);
@@ -461,7 +461,7 @@ static void draw_background(FileLayout *layout, View2D *v2d)
int i;
int sy;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShade(TH_BACK, -7);
@@ -498,12 +498,12 @@ static void draw_dividers(FileLayout *layout, View2D *v2d)
v1[1] = v2d->cur.ymax - layout->tile_border_y;
v2[1] = v2d->cur.ymin;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(PRIM_LINES, vertex_ct);
+ immBegin(GWN_PRIM_LINES, vertex_ct);
sx = (int)v2d->tot.xmin;
while (sx < v2d->cur.xmax) {
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index e8d033b7a06..4a1707a3c63 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -85,7 +85,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
int i;
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
glLineWidth(1.0f);
@@ -102,7 +102,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
/* draw two black lines showing the standard reference levels */
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(shdr_pos, v2d->cur.xmin, env->midval + env->min);
immVertex2f(shdr_pos, v2d->cur.xmax, env->midval + env->min);
@@ -121,7 +121,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
/* for now, point color is fixed, and is white */
immUniformColor3f(1.0f, 1.0f, 1.0f);
- immBeginAtMost(PRIM_POINTS, env->totvert * 2);
+ immBeginAtMost(GWN_PRIM_POINTS, env->totvert * 2);
for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
/* only draw if visible
@@ -171,7 +171,7 @@ static void draw_fcurve_selected_keyframe_vertices(FCurve *fcu, View2D *v2d, boo
set_fcurve_vertex_color(fcu, sel);
- immBeginAtMost(PRIM_POINTS, fcu->totvert);
+ immBeginAtMost(GWN_PRIM_POINTS, fcu->totvert);
BezTriple *bezt = fcu->bezt;
for (int i = 0; i < fcu->totvert; i++, bezt++) {
@@ -223,7 +223,7 @@ static void draw_fcurve_selected_handle_vertices(FCurve *fcu, View2D *v2d, bool
immUniform4f("outlineColor", hcolor[0], hcolor[1], hcolor[2], 1.0f);
immUniformColor3fvAlpha(hcolor, 0.4f);
- immBeginAtMost(PRIM_POINTS, fcu->totvert * 2);
+ immBeginAtMost(GWN_PRIM_POINTS, fcu->totvert * 2);
BezTriple *bezt = fcu->bezt;
BezTriple *prevbezt = NULL;
@@ -279,7 +279,7 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool
* - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users)
*/
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
glEnable(GL_BLEND);
GPU_enable_program_point_size();
@@ -323,7 +323,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
{
int sel, b;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* slightly hacky, but we want to draw unselected points before selected ones
@@ -354,7 +354,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
col[3] = fcurve_display_alpha(fcu) * 255;
immUniformColor4ubv(col);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, fp);
immVertex2fv(pos, fp + 3);
immEnd();
@@ -366,7 +366,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
col[3] = fcurve_display_alpha(fcu) * 255;
immUniformColor4ubv(col);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, fp + 3);
immVertex2fv(pos, fp + 6);
immEnd();
@@ -382,7 +382,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
col[3] = fcurve_display_alpha(fcu) * 255;
immUniformColor4ubv(col);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, fp);
immVertex2fv(pos, fp + 3);
immEnd();
@@ -397,7 +397,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
col[3] = fcurve_display_alpha(fcu) * 255;
immUniformColor4ubv(col);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, fp);
immVertex2fv(pos, fp + 3);
immEnd();
@@ -423,7 +423,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc
gpuScale2f(1.0f / xscale * hsize, 1.0f / yscale * hsize);
/* draw X shape */
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, -0.7f, -0.7f);
immVertex2f(pos, +0.7f, +0.7f);
@@ -455,7 +455,7 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor((fcu->flag & FCURVE_SELECTED) ? TH_TEXT_HI : TH_TEXT);
@@ -547,7 +547,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
n = (etime - stime) / samplefreq + 0.5f;
if (n > 0) {
- immBegin(PRIM_LINE_STRIP, (n + 1));
+ immBegin(GWN_PRIM_LINE_STRIP, (n + 1));
for (i = 0; i <= n; i++) {
float ctime = stime + i * samplefreq;
@@ -586,7 +586,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
gpuScale2f(1.0f, unit_scale);
gpuTranslate2f(0.0f, offset);
- immBegin(PRIM_LINE_STRIP, count);
+ immBegin(GWN_PRIM_LINE_STRIP, count);
/* extrapolate to left? - left-side of view comes before first keyframe? */
if (prevfpt->vec[0] > v2d->cur.xmin) {
@@ -683,7 +683,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
/* For now, this assumes the worst case scenario, where all the keyframes have
* bezier interpolation, and are drawn at full res.
* This is tricky to optimize, but maybe can be improved at some point... */
- immBeginAtMost(PRIM_LINE_STRIP, (b * 32 + 3));
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, (b * 32 + 3));
/* extrapolate to left? */
if (prevbezt->vec[1][0] > v2d->cur.xmin) {
@@ -845,7 +845,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
//if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0)
// return;
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
float viewport_size[4];
@@ -870,7 +870,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
/* draw 1-1 line, stretching just past the screen limits
* NOTE: we need to scale the y-values to be valid for the units
*/
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
t = v2d->cur.xmin;
immVertex2f(shdr_pos, t, (t + offset) * unitfac);
@@ -896,7 +896,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
immUniform1f("dash_width", 10.0f);
immUniform1f("dash_factor", 0.5f);
- immBegin(PRIM_LINES, (y >= v2d->cur.ymin) ? 4 : 2);
+ immBegin(GWN_PRIM_LINES, (y >= v2d->cur.ymin) ? 4 : 2);
/* x-axis lookup */
co[0] = x;
@@ -922,7 +922,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
immUnbindProgram();
- /* PRIM_POINTS do not survive dashed line geometry shader... */
+ /* GWN_PRIM_POINTS do not survive dashed line geometry shader... */
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* x marks the spot .................................................... */
@@ -930,7 +930,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
immUniformColor3f(0.9f, 0.9f, 0.9f);
glPointSize(7.0);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(shdr_pos, x, y);
immEnd();
@@ -938,7 +938,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
immUniformColor3f(0.9f, 0.0f, 0.0f);
glPointSize(3.0);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(shdr_pos, x, y);
immEnd();
}
@@ -965,7 +965,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
}
glEnable(GL_BLEND);
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -1051,7 +1051,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
}
glEnable(GL_BLEND);
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index c17b60badae..d2358a494d5 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -267,7 +267,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
UI_view2d_grid_free(grid);
if (((sipo->flag & SIPO_NODRAWCURSOR) == 0) || (sipo->mode == SIPO_MODE_DRIVERS)) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -281,7 +281,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
glEnable(GL_BLEND);
glLineWidth(2.0);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, v2d->cur.xmin, y);
immVertex2f(pos, v2d->cur.xmax, y);
immEnd();
@@ -299,7 +299,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
glEnable(GL_BLEND);
glLineWidth(2.0);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, x, v2d->cur.ymin);
immVertex2f(pos, x, v2d->cur.ymax);
immEnd();
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 259dc124d37..733008ee478 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -126,7 +126,7 @@ static void draw_render_info(const bContext *C,
(int)(-rd->border.ymin * rd->ysch * rd->size * 0.01f));
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_FACE_SELECT);
@@ -173,7 +173,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* noisy, high contrast make impossible to read if lower alpha is used. */
@@ -329,7 +329,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), 0.15f * UI_UNIT_Y, 0.85f * UI_UNIT_Y);
/* BLF uses immediate mode too, so we must reset our vertex format */
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
if (channels == 4) {
@@ -366,7 +366,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
immUnbindProgram();
/* draw outline */
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ub(128, 128, 128);
imm_draw_line_box(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
@@ -686,8 +686,8 @@ void draw_image_sample_line(SpaceImage *sima)
if (sima->sample_line_hist.flag & HISTO_FLAG_SAMPLELINE) {
Histogram *hist = &sima->sample_line_hist;
- VertexFormat *format = immVertexFormat();
- unsigned int shdr_dashed_pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int shdr_dashed_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -699,7 +699,7 @@ void draw_image_sample_line(SpaceImage *sima)
immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
immUniform1f("dash_width", 2.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(shdr_dashed_pos, hist->co[0]);
immVertex2fv(shdr_dashed_pos, hist->co[1]);
immEnd();
@@ -898,7 +898,7 @@ void draw_image_cache(const bContext *C, ARegion *ar)
/* Draw current frame. */
x = (cfra - sfra) / (efra - sfra + 1) * ar->winx;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_CFRAME);
immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC);
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index 33c0565c12c..3eb0158e7b5 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -84,8 +84,8 @@ static void console_draw_sel(const char *str, const int sel[2], const int xy[2],
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv(bg_sel);
@@ -190,8 +190,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
cdc->sel[1] = str_len - sel_orig[0];
if (bg) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ubv(bg);
@@ -241,8 +241,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
else { /* simple, no wrap */
if (bg) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ubv(bg);
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 561c29b68cc..d87da323b97 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -118,8 +118,8 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa
nla_action_get_color(adt, act, color);
color[3] *= 2.5f;
- VertexFormat *format = immVertexFormat();
- unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -142,13 +142,13 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa
if (key_ct > 0) {
format = immVertexFormat();
- pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int size_id = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT);
- unsigned int color_id = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
- unsigned int outline_color_id = VertexFormat_add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
+ unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
GPU_enable_program_point_size();
- immBegin(PRIM_POINTS, key_ct);
+ immBegin(GWN_PRIM_POINTS, key_ct);
/* - disregard the selection status of keyframes so they draw a certain way
* - size is 6.0f which is smaller than the editable keyframes, so that there is a distinction
@@ -177,7 +177,7 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax
if (!(act && act->markers.first))
return;
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
if (dashed) {
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -194,7 +194,7 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax
}
immUniformThemeColorShade(TH_STRIP_SELECT, shade);
- immBeginAtMost(PRIM_LINES, BLI_listbase_count(&act->markers) * 2);
+ immBeginAtMost(GWN_PRIM_LINES, BLI_listbase_count(&act->markers) * 2);
for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) {
float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP);
@@ -315,7 +315,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns
float cfra;
/* plot the curve (over the strip's main region) */
- immBegin(PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1));
+ immBegin(GWN_PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1));
/* sample at 1 frame intervals, and draw
* - min y-val is yminc, max is y-maxc, so clamp in those regions
@@ -331,7 +331,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns
else {
/* use blend in/out values only if both aren't zero */
if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f)) == 0) {
- immBeginAtMost(PRIM_LINE_STRIP, 4);
+ immBeginAtMost(GWN_PRIM_LINE_STRIP, 4);
/* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */
if (IS_EQF(strip->blendin, 0.0f) == 0) {
@@ -367,7 +367,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
/* get color of strip */
nla_strip_get_color_inside(adt, strip, color);
- uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* draw extrapolation info first (as backdrop)
@@ -420,7 +420,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
UI_draw_roundbox_shade_x(true, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1, color);
/* restore current vertex format & program (roundbox trashes it) */
- shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
}
else {
@@ -465,7 +465,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
/* restore current vertex format & program (roundbox trashes it) */
/* Note that we use dahsed shader here, and make it draw solid lines if not muted... */
- shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
float viewport_size[4];
@@ -491,7 +491,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
/* only draw lines for whole-numbered repeats, starting from the first full-repeat
* up to the last full repeat (but not if it lies on the end of the strip)
*/
- immBeginAtMost(PRIM_LINES, 2 * (strip->repeat - 1));
+ immBeginAtMost(GWN_PRIM_LINES, 2 * (strip->repeat - 1));
for (int i = 1; i < strip->repeat; i++) {
float repeatPos = strip->start + (repeatLen * i);
@@ -507,7 +507,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) {
float y = (ymaxc - yminc) * 0.5f + yminc;
- immBeginAtMost(PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); /* up to 2 lines per strip */
+ immBeginAtMost(GWN_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); /* up to 2 lines per strip */
/* only draw first-level of child-strips, but don't draw any lines on the endpoints */
for (NlaStrip *cs = strip->strips.first; cs; cs = cs->next) {
@@ -676,7 +676,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
{
AnimData *adt = ale->adt;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* just draw a semi-shaded rect spanning the width of the viewable area if there's data,
@@ -699,7 +699,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* white base-lines */
glLineWidth(2.0f);
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.3f);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmax, yminc + NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP);
@@ -709,7 +709,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* black top-lines */
glLineWidth(1.0f);
immUniformColor3f(0.0f, 0.0f, 0.0f);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmax, yminc + NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 500abfe6c63..bee2379cd81 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2157,14 +2157,14 @@ static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNo
const float cx = x + snode->zoom * backdropWidth * node->custom3;
const float cy = y + snode->zoom * backdropHeight * node->custom4;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3f(1.0f, 1.0f, 1.0f);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, cx - 25, cy - 25);
immVertex2f(pos, cx + 25, cy + 25);
immVertex2f(pos, cx + 25, cy - 25);
@@ -2202,14 +2202,14 @@ static void node_composit_backdrop_boxmask(SpaceNode *snode, ImBuf *backdrop, bN
y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3f(1.0f, 1.0f, 1.0f);
- immBegin(PRIM_LINE_LOOP, 4);
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex2f(pos, x1, y1);
immVertex2f(pos, x2, y2);
immVertex2f(pos, x3, y3);
@@ -2246,14 +2246,14 @@ static void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop
y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3f(1.0f, 1.0f, 1.0f);
- immBegin(PRIM_LINE_LOOP, 4);
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex2f(pos, x1, y1);
immVertex2f(pos, x2, y2);
immVertex2f(pos, x3, y3);
@@ -3258,7 +3258,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
y + snode->zoom * viewer_border->ymin * ibuf->y,
y + snode->zoom * viewer_border->ymax * ibuf->y);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_ACTIVE);
@@ -3407,7 +3407,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
}
if (do_triple || drawarrow || (!do_shaded)) {
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
}
@@ -3415,7 +3415,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
immUniformThemeColorShadeAlpha(th_col3, -80, -120);
glLineWidth(4.0f);
- immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1));
+ immBegin(GWN_PRIM_LINE_STRIP, (LINK_RESOL + 1));
for (i = 0; i <= LINK_RESOL; i++) {
immVertex2fv(pos, coord_array[i]);
@@ -3424,7 +3424,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
immEnd();
if (drawarrow) {
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2fv(pos, arrow1);
immVertex2fv(pos, arrow);
immVertex2fv(pos, arrow2);
@@ -3437,7 +3437,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
if (drawarrow) {
immUniformThemeColorBlend(th_col1, th_col2, 0.5f);
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2fv(pos, arrow1);
immVertex2fv(pos, arrow);
immVertex2fv(pos, arrow2);
@@ -3447,7 +3447,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
if (!do_shaded) {
immUniformThemeColor(th_col1);
- immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1));
+ immBegin(GWN_PRIM_LINE_STRIP, (LINK_RESOL + 1));
for (i = 0; i <= LINK_RESOL; i++) {
immVertex2fv(pos, coord_array[i]);
@@ -3463,13 +3463,13 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
if (do_shaded) {
unsigned char col[3];
- VertexFormat *format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
- immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1));
+ immBegin(GWN_PRIM_LINE_STRIP, (LINK_RESOL + 1));
for (i = 0; i <= LINK_RESOL; i++) {
UI_GetThemeColorBlend3ubv(th_col1, th_col2, spline_step, col);
@@ -3537,7 +3537,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned pos)
{
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
if (border & (NODE_LEFT | NODE_RIGHT)) {
immVertex2f(pos, cent[0], v2d->cur.ymin);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 02adc064f88..d99d1c97653 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -640,8 +640,8 @@ static void node_draw_preview_background(float tile, rctf *rect)
{
float x, y;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -713,7 +713,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
glDisable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_BACK, -15, +100);
imm_draw_line_box(pos, draw_rect.xmin, draw_rect.ymin, draw_rect.xmax, draw_rect.ymax);
@@ -763,9 +763,9 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *
float scale;
UI_view2d_scale_get(v2d, &scale, NULL);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
glEnable(GL_BLEND);
GPU_enable_program_point_size();
@@ -780,7 +780,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *
immUniform1f("outlineWidth", 1.0f);
immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 0.6f);
- immBeginAtMost(PRIM_POINTS, total_input_ct + total_output_ct);
+ immBeginAtMost(GWN_PRIM_POINTS, total_input_ct + total_output_ct);
}
/* socket inputs */
@@ -824,7 +824,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *
immUniform4f("outlineColor", c[0], c[1], c[2], 1.0f);
immUniform1f("outlineWidth", 1.5f);
- immBegin(PRIM_POINTS, selected_input_ct + selected_output_ct);
+ immBegin(GWN_PRIM_POINTS, selected_input_ct + selected_output_ct);
if (selected_input_ct) {
/* socket inputs */
@@ -1096,13 +1096,13 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
}
/* scale widget thing */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShade(color_id, -10);
dx = 10.0f;
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, rct->xmax - dx, centy - 4.0f);
immVertex2f(pos, rct->xmax - dx, centy + 4.0f);
@@ -1113,7 +1113,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
immUniformThemeColorShade(color_id, 30);
dx -= snode->aspect;
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, rct->xmax - dx, centy - 4.0f);
immVertex2f(pos, rct->xmax - dx, centy + 4.0f);
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index b6a2e6f60fb..7a1eca0f179 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -652,11 +652,11 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex)
glLineWidth(1.0f);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, sizex, v2d->cur.ymax);
immVertex2f(pos, sizex, miny);
@@ -1455,8 +1455,8 @@ static void outliner_draw_tree_element(
/* divider */
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
unsigned char col[4];
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1510,7 +1510,7 @@ static void outliner_draw_tree_element_floating(
const TreeElement *te_insert = te_floating->drag_data->insert_handle;
const int line_width = 2;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
int coord_y = te_insert->ys;
int coord_x = te_insert->xs;
float col[4];
@@ -1531,7 +1531,7 @@ static void outliner_draw_tree_element_floating(
immUniformColor4fv(col);
glLineWidth(line_width);
- immBegin(PRIM_LINE_STRIP, 2);
+ immBegin(GWN_PRIM_LINE_STRIP, 2);
immVertex2f(pos, coord_x, coord_y);
immVertex2f(pos, ar->v2d.cur.xmax, coord_y);
immEnd();
@@ -1540,7 +1540,7 @@ static void outliner_draw_tree_element_floating(
BLI_assert(te_floating->drag_data->insert_type == TE_INSERT_INTO);
immUniformColor3fvAlpha(col, col[3] * 0.5f);
- immBegin(PRIM_TRIANGLE_STRIP, 4);
+ immBegin(GWN_PRIM_TRI_STRIP, 4);
immVertex2f(pos, coord_x, coord_y + UI_UNIT_Y);
immVertex2f(pos, coord_x, coord_y);
immVertex2f(pos, ar->v2d.cur.xmax, coord_y + UI_UNIT_Y);
@@ -1608,8 +1608,8 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo
static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int startx, int *starty)
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
unsigned char col[4];
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1634,8 +1634,8 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
/* selection status */
if (TSELEM_OPEN(tselem, soops))
if (tselem->type == TSE_RNA_STRUCT) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immThemeColorShadeAlpha(TH_BACK, -15, -200);
immRecti(pos, 0, *starty + 1, (int)ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
@@ -1646,12 +1646,12 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
if (TSELEM_OPEN(tselem, soops)) {
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
if (tselem->type == TSE_RNA_STRUCT) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immThemeColorShadeAlpha(TH_BACK, -15, -200);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, 0, (float)*starty + UI_UNIT_Y);
immVertex2f(pos, ar->v2d.cur.xmax, (float)*starty + UI_UNIT_Y);
immEnd();
@@ -1714,8 +1714,8 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx,
col_searchmatch[3] = 0.5f;
glEnable(GL_BLEND);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
outliner_draw_highlights_recursive(pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch,
startx, starty);
@@ -1786,8 +1786,8 @@ static void outliner_back(ARegion *ar)
ystart = (int)ar->v2d.tot.ymax;
ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShade(TH_BACK, 6);
@@ -1797,7 +1797,7 @@ static void outliner_back(ARegion *ar)
int tot = (int)floor(ystart - ar->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y);
if (tot > 0) {
- immBegin(PRIM_TRIANGLES, 6 * tot);
+ immBegin(GWN_PRIM_TRIS, 6 * tot);
while (tot--) {
y1 -= 2 * UI_UNIT_Y;
y2 = y1 + UI_UNIT_Y;
@@ -1818,10 +1818,10 @@ static void outliner_draw_restrictcols(ARegion *ar)
{
glLineWidth(1.0f);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
- immBegin(PRIM_LINES, 6);
+ immBegin(GWN_PRIM_LINES, 6);
/* view */
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 4d1e878868a..9cdb74e02f9 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -262,7 +262,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s
glEnable(GL_BLEND);
- immBegin(PRIM_TRIANGLE_STRIP, length * 2);
+ immBegin(GWN_PRIM_TRI_STRIP, length * 2);
for (i = 0; i < length; i++) {
float sampleoffset = startsample + ((x1_offset - x1) / stepsize + i) * samplestep;
@@ -338,7 +338,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
col[3] = 196; /* alpha, used for all meta children */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -452,7 +452,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla
immUniformColor4ub(0, 0, 0, 50);
}
- immBegin(PRIM_TRIANGLES, 3);
+ immBegin(GWN_PRIM_TRIS, 3);
immVertex2fv(pos, v1);
immVertex2fv(pos, v2);
immVertex2fv(pos, v3);
@@ -714,7 +714,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -776,7 +776,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
if (seq->flag & SEQ_LOCK) {
glEnable(GL_BLEND);
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES);
immUniform4f("color1", 1.0f, 1.0f, 1.0f, 0.125f);
@@ -794,7 +794,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
if (!BKE_sequence_is_valid_check(seq)) {
glEnable(GL_BLEND);
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES);
immUniform4f("color1", 1.0f, 0.0f, 0.0f, 1.0f);
@@ -829,7 +829,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
drawmeta_contents(scene, seq, x1, y1, x2, y2);
}
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* TODO: add back stippled line for muted strips? */
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1033,7 +1033,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
glLineWidth(1.0f);
/* border */
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -1224,9 +1224,9 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
/* Format needs to be created prior to any immBindProgram call.
* Do it here because OCIO binds it's own shader.
*/
- VertexFormat *imm_format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(imm_format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *imm_format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
if (scope) {
IMB_freeImBuf(ibuf);
@@ -1324,7 +1324,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
immUniform1i("image", GL_TEXTURE0);
}
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
if (draw_overlay) {
if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
@@ -1507,7 +1507,7 @@ static void draw_seq_backdrop(View2D *v2d)
{
int i;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* darker gray overlay over the view backdrop */
@@ -1534,7 +1534,7 @@ static void draw_seq_backdrop(View2D *v2d)
i = max_ii(1, ((int)v2d->cur.ymin) - 1);
int line_ct = (int)v2d->cur.ymax - i + 1;
immUniformThemeColor(TH_GRID);
- immBegin(PRIM_LINES, line_ct * 2);
+ immBegin(GWN_PRIM_LINES, line_ct * 2);
while (line_ct--) {
immVertex2f(pos, v2d->cur.xmax, i);
immVertex2f(pos, v2d->cur.xmin, i);
@@ -1586,7 +1586,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
const Sequence *seq = special_seq_update;
glEnable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ub(255, 255, 255, 48);
@@ -1606,7 +1606,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
glEnable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* draw darkened area outside of active timeline
@@ -1624,7 +1624,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
immUniformThemeColorShade(TH_BACK, -60);
/* thin lines where the actual frames are */
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, frame_sta, v2d->cur.ymin);
immVertex2f(pos, frame_sta, v2d->cur.ymax);
@@ -1642,7 +1642,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
immUniformThemeColorShade(TH_BACK, -40);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, ms->disp_range[0], v2d->cur.ymin);
immVertex2f(pos, ms->disp_range[0], v2d->cur.ymax);
@@ -1730,12 +1730,12 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3f(0.2f, 0.2f, 0.2f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, cfra_over, v2d->cur.ymin);
immVertex2f(pos, cfra_over, v2d->cur.ymax);
immEnd();
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 79607bf88cb..7b4565d8b66 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -912,7 +912,7 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
float rad;
/* background so highlights don't go behind the scrollbar */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_BACK);
immRecti(pos, back->xmin, back->ymin, back->xmax, back->ymax);
@@ -966,24 +966,24 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
boxh = (DOC_HEIGHT + 1) * (st->lheight_dpi + TXT_LINE_SPACING);
/* Draw panel */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_BACK);
immRecti(pos, x, y, x + boxw, y - boxh);
immUniformThemeColor(TH_SHADE1);
- immBegin(PRIM_LINE_LOOP, 4);
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex2i(pos, x, y);
immVertex2i(pos, x + boxw, y);
immVertex2i(pos, x + boxw, y - boxh);
immVertex2i(pos, x, y - boxh);
immEnd();
- immBegin(PRIM_LINE_LOOP, 3);
+ immBegin(GWN_PRIM_LINE_LOOP, 3);
immVertex2i(pos, x + boxw - 10, y - 7);
immVertex2i(pos, x + boxw - 4, y - 7);
immVertex2i(pos, x + boxw - 7, y - 2);
immEnd();
- immBegin(PRIM_LINE_LOOP, 3);
+ immBegin(GWN_PRIM_LINE_LOOP, 3);
immVertex2i(pos, x + boxw - 10, y - boxh + 7);
immVertex2i(pos, x + boxw - 4, y - boxh + 7);
immVertex2i(pos, x + boxw - 7, y - boxh + 2);
@@ -1065,7 +1065,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
/* not needed but stands out nicer */
UI_draw_box_shadow(220, x, y - boxh, x + boxw, y);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_SHADE1);
@@ -1088,7 +1088,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
w = st->cwidth * text_get_char_pos(st, str, len);
if (item == sel) {
- unsigned int posi = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int posi = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_SHADE2);
@@ -1129,7 +1129,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
return;
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* Draw the selection */
@@ -1442,7 +1442,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
if (st->showlinenrs) {
x = TXT_OFFSET + TEXTXLOC;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_GRID);
immRecti(pos, (TXT_OFFSET - 12), 0, (TXT_OFFSET - 5) + TEXTXLOC, ar->winy - 2);
@@ -1501,7 +1501,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
margin_column_x = x + st->cwidth * (st->margin_column - st->left);
if (margin_column_x >= x) {
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -1514,7 +1514,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_factor", 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2i(shdr_pos, margin_column_x, 0);
immVertex2i(shdr_pos, margin_column_x, ar->winy - 2);
immEnd();
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 283cd6c0e24..4672cc073fc 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -83,8 +83,8 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f);
@@ -102,7 +102,7 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d)
/* thin lines where the actual frames are */
immUniformThemeColorShade(TH_BACK, -60);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, (float)PSFRA, v2d->cur.ymin);
immVertex2f(pos, (float)PSFRA, v2d->cur.ymax);
@@ -126,7 +126,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene)
BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* iterate over pointcaches on the active object,
@@ -215,7 +215,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene)
immUniformColor4fv(col);
if (len > 0) {
- immBeginAtMost(PRIM_TRIANGLES, len);
+ immBeginAtMost(GWN_PRIM_TRIS, len);
/* draw a quad for each cached frame */
for (int i = sta; i <= end; i++) {
@@ -323,13 +323,13 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel, cons
if (max_len > 0) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ubv(color);
- immBeginAtMost(PRIM_LINES, max_len * 2);
+ immBeginAtMost(GWN_PRIM_LINES, max_len * 2);
for (; (ak) && (ak->cfra <= v2d->cur.xmax);
ak = ak->next)
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index c2db34d8d1a..66355a50478 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -238,13 +238,13 @@ void draw_motion_path_instance(Scene *scene,
/* set line thickness */
glLineWidth(mpath->line_thickness);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
- immBegin(PRIM_LINE_STRIP, len);
+ immBegin(GWN_PRIM_LINE_STRIP, len);
for (i = 0, mpv = mpv_start; i < len; i++, mpv++) {
short sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT);
@@ -264,7 +264,7 @@ void draw_motion_path_instance(Scene *scene,
glLineWidth(old_width);
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -274,7 +274,7 @@ void draw_motion_path_instance(Scene *scene,
/* draw little black point at each frame */
immUniformColor3ub(0, 0, 0);
- immBegin(PRIM_POINTS, len);
+ immBegin(GWN_PRIM_POINTS, len);
for (i = 0, mpv = mpv_start; i < len; i++, mpv++) {
immVertex3fv(pos, mpv->co);
@@ -290,7 +290,7 @@ void draw_motion_path_instance(Scene *scene,
immUniformThemeColor(TH_TEXT_HI);
}
- immBegin(PRIM_POINTS, (len + stepsize - 1) / stepsize);
+ immBegin(GWN_PRIM_POINTS, (len + stepsize - 1) / stepsize);
for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) {
immVertex3fv(pos, mpv->co);
@@ -307,7 +307,7 @@ void draw_motion_path_instance(Scene *scene,
glPointSize(mpath->line_thickness + 5.0);
immUniformThemeColor(TH_CFRAME);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
mpv = mpv_start + (CFRA - sfra);
immVertex3fv(pos, mpv->co);
@@ -388,12 +388,12 @@ void draw_motion_path_instance(Scene *scene,
/* point must be bigger than line */
glPointSize(mpath->line_thickness + 3.0);
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(col);
- immBeginAtMost(PRIM_POINTS, len);
+ immBeginAtMost(GWN_PRIM_POINTS, len);
for (i = 0, mpv = mpv_start; i < len; i++, mpv++) {
int frame = sfra + i;
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 2152d67e447..5845a53055c 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -331,15 +331,15 @@ static void set_ebone_color(const unsigned int boneflag)
/* *************** Armature drawing, helper calls for parts ******************* */
-static void add_solid_flat_triangle(VertexBuffer *vbo, unsigned int *vertex, unsigned int pos, unsigned int nor,
+static void add_solid_flat_triangle(Gwn_VertBuf *vbo, unsigned int *vertex, unsigned int pos, unsigned int nor,
const float p1[3], const float p2[3], const float p3[3], const float n[3])
{
- VertexBuffer_set_attrib(vbo, nor, *vertex, n);
- VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p1);
- VertexBuffer_set_attrib(vbo, nor, *vertex, n);
- VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p2);
- VertexBuffer_set_attrib(vbo, nor, *vertex, n);
- VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p3);
+ GWN_vertbuf_attr_set(vbo, nor, *vertex, n);
+ GWN_vertbuf_attr_set(vbo, pos, (*vertex)++, p1);
+ GWN_vertbuf_attr_set(vbo, nor, *vertex, n);
+ GWN_vertbuf_attr_set(vbo, pos, (*vertex)++, p2);
+ GWN_vertbuf_attr_set(vbo, nor, *vertex, n);
+ GWN_vertbuf_attr_set(vbo, pos, (*vertex)++, p3);
}
/* half the cube, in Y */
@@ -362,21 +362,21 @@ static const float cube_wire[24] = {
static void drawsolidcube_size(float xsize, float ysize, float zsize)
{
- static VertexFormat format = {0};
- static VertexBuffer vbo = {{0}};
- static Batch batch = {{0}};
+ static Gwn_VertFormat format = {0};
+ static Gwn_VertBuf vbo = {{0}};
+ static Gwn_Batch batch = {{0}};
const float light_vec[3] = {0.0f, 0.0f, 1.0f};
if (format.attrib_ct == 0) {
unsigned int i = 0;
float n[3] = {0.0f};
/* Vertex format */
- unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* Vertices */
- VertexBuffer_init_with_format(&vbo, &format);
- VertexBuffer_allocate_data(&vbo, 36);
+ GWN_vertbuf_init_with_format(&vbo, &format);
+ GWN_vertbuf_data_alloc(&vbo, 36);
n[0] = -1.0;
add_solid_flat_triangle(&vbo, &i, pos, nor, cube_vert[0], cube_vert[1], cube_vert[2], n);
@@ -401,7 +401,7 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
add_solid_flat_triangle(&vbo, &i, pos, nor, cube_vert[7], cube_vert[4], cube_vert[0], n);
add_solid_flat_triangle(&vbo, &i, pos, nor, cube_vert[0], cube_vert[3], cube_vert[7], n);
- Batch_init(&batch, PRIM_TRIANGLES, &vbo, NULL);
+ GWN_batch_init(&batch, GWN_PRIM_TRIS, &vbo, NULL);
}
gpuPushMatrix();
@@ -413,50 +413,50 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
else {
/* TODO replace with good default lighting shader ? */
Batch_set_builtin_program(&batch, GPU_SHADER_SIMPLE_LIGHTING);
- Batch_Uniform3fv(&batch, "light", light_vec);
+ GWN_batch_uniform_3fv(&batch, "light", light_vec);
}
- Batch_Uniform4fv(&batch, "color", fcolor);
- Batch_draw(&batch);
+ GWN_batch_uniform_4fv(&batch, "color", fcolor);
+ GWN_batch_draw(&batch);
gpuPopMatrix();
}
static void drawcube_size(float xsize, float ysize, float zsize)
{
- static VertexFormat format = {0};
- static VertexBuffer vbo = {{0}};
- static ElementListBuilder elb = {0};
- static ElementList el = {0};
- static Batch batch = {{0}};
+ static Gwn_VertFormat format = {0};
+ static Gwn_VertBuf vbo = {{0}};
+ static Gwn_IndexBufBuilder elb = {0};
+ static Gwn_IndexBuf el = {0};
+ static Gwn_Batch batch = {{0}};
if (format.attrib_ct == 0) {
/* Vertex format */
- unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* Elements */
- ElementListBuilder_init(&elb, PRIM_LINES, 12, 8);
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, 12, 8);
for (int i = 0; i < 12; ++i) {
- add_line_vertices(&elb, cube_wire[i*2], cube_wire[i*2+1]);
+ GWN_indexbuf_add_line_verts(&elb, cube_wire[i*2], cube_wire[i*2+1]);
}
- ElementList_build_in_place(&elb, &el);
+ GWN_indexbuf_build_in_place(&elb, &el);
/* Vertices */
- VertexBuffer_init_with_format(&vbo, &format);
- VertexBuffer_allocate_data(&vbo, 8);
+ GWN_vertbuf_init_with_format(&vbo, &format);
+ GWN_vertbuf_data_alloc(&vbo, 8);
for (int i = 0; i < 8; ++i) {
- VertexBuffer_set_attrib(&vbo, pos, i, cube_vert[i]);
+ GWN_vertbuf_attr_set(&vbo, pos, i, cube_vert[i]);
}
- Batch_init(&batch, PRIM_LINES, &vbo, &el);
+ GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, &el);
Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR);
}
gpuPushMatrix();
gpuScale3f(xsize, ysize, zsize);
- Batch_use_program(&batch);
- Batch_Uniform4fv(&batch, "color", fcolor);
- Batch_draw(&batch);
+ GWN_batch_program_use_begin(&batch);
+ GWN_batch_uniform_4fv(&batch, "color", fcolor);
+ GWN_batch_draw(&batch);
gpuPopMatrix();
}
@@ -464,57 +464,57 @@ static void drawcube_size(float xsize, float ysize, float zsize)
static void draw_bonevert(void)
{
- static VertexFormat format = {0};
- static VertexBuffer vbo = {{0}};
- static Batch batch = {{0}};
+ static Gwn_VertFormat format = {0};
+ static Gwn_VertBuf vbo = {{0}};
+ static Gwn_Batch batch = {{0}};
if (format.attrib_ct == 0) {
/* Vertex format */
- unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* Vertices */
- VertexBuffer_init_with_format(&vbo, &format);
- VertexBuffer_allocate_data(&vbo, 96);
+ GWN_vertbuf_init_with_format(&vbo, &format);
+ GWN_vertbuf_data_alloc(&vbo, 96);
for (int i = 0; i < 16; ++i) {
float vert[3] = {0.f, 0.f, 0.f};
const float r = 0.05f;
vert[0] = r * cosf(2 * M_PI * i / 16.f);
vert[1] = r * sinf(2 * M_PI * i / 16.f);
- VertexBuffer_set_attrib(&vbo, pos, i * 6 + 0, vert);
+ GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 0, vert);
vert[0] = r * cosf(2 * M_PI * (i + 1) / 16.f);
vert[1] = r * sinf(2 * M_PI * (i + 1) / 16.f);
- VertexBuffer_set_attrib(&vbo, pos, i * 6 + 1, vert);
+ GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 1, vert);
vert[0] = 0.f;
vert[1] = r * cosf(2 * M_PI * i / 16.f);
vert[2] = r * sinf(2 * M_PI * i / 16.f);
- VertexBuffer_set_attrib(&vbo, pos, i * 6 + 2, vert);
+ GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 2, vert);
vert[1] = r * cosf(2 * M_PI * (i + 1) / 16.f);
vert[2] = r * sinf(2 * M_PI * (i + 1) / 16.f);
- VertexBuffer_set_attrib(&vbo, pos, i * 6 + 3, vert);
+ GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 3, vert);
vert[1] = 0.f;
vert[0] = r * cosf(2 * M_PI * i / 16.f);
vert[2] = r * sinf(2 * M_PI * i / 16.f);
- VertexBuffer_set_attrib(&vbo, pos, i * 6 + 4, vert);
+ GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 4, vert);
vert[0] = r * cosf(2 * M_PI * (i + 1) / 16.f);
vert[2] = r * sinf(2 * M_PI * (i + 1) / 16.f);
- VertexBuffer_set_attrib(&vbo, pos, i * 6 + 5, vert);
+ GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 5, vert);
}
- Batch_init(&batch, PRIM_LINES, &vbo, NULL);
+ GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, NULL);
Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR);
}
- Batch_use_program(&batch);
- Batch_Uniform4fv(&batch, "color", fcolor);
- Batch_draw(&batch);
+ GWN_batch_program_use_begin(&batch);
+ GWN_batch_uniform_4fv(&batch, "color", fcolor);
+ GWN_batch_draw(&batch);
}
static void draw_bonevert_solid(void)
{
- Batch *batch = Batch_get_sphere(0);
+ Gwn_Batch *batch = Batch_get_sphere(0);
const float light_vec[3] = {0.0f, 0.0f, 1.0f};
gpuPushMatrix();
@@ -526,10 +526,10 @@ static void draw_bonevert_solid(void)
else {
/* TODO replace with good default lighting shader ? */
Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING);
- Batch_Uniform3fv(batch, "light", light_vec);
+ GWN_batch_uniform_3fv(batch, "light", light_vec);
}
- Batch_Uniform4fv(batch, "color", fcolor);
- Batch_draw(batch);
+ GWN_batch_uniform_4fv(batch, "color", fcolor);
+ GWN_batch_draw(batch);
gpuPopMatrix();
}
@@ -575,55 +575,55 @@ static const float bone_octahedral_solid_normals[8][3] = {
static void draw_bone_octahedral(void)
{
- static VertexFormat format = {0};
- static VertexBuffer vbo = {{0}};
- static ElementListBuilder elb = {0};
- static ElementList el = {0};
- static Batch batch = {{0}};
+ static Gwn_VertFormat format = {0};
+ static Gwn_VertBuf vbo = {{0}};
+ static Gwn_IndexBufBuilder elb = {0};
+ static Gwn_IndexBuf el = {0};
+ static Gwn_Batch batch = {{0}};
if (format.attrib_ct == 0) {
/* Vertex format */
- unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* Elements */
- ElementListBuilder_init(&elb, PRIM_LINES, 12, 6);
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, 12, 6);
for (int i = 0; i < 12; ++i) {
- add_line_vertices(&elb, bone_octahedral_wire[i*2], bone_octahedral_wire[i*2+1]);
+ GWN_indexbuf_add_line_verts(&elb, bone_octahedral_wire[i*2], bone_octahedral_wire[i*2+1]);
}
- ElementList_build_in_place(&elb, &el);
+ GWN_indexbuf_build_in_place(&elb, &el);
/* Vertices */
- VertexBuffer_init_with_format(&vbo, &format);
- VertexBuffer_allocate_data(&vbo, 6);
+ GWN_vertbuf_init_with_format(&vbo, &format);
+ GWN_vertbuf_data_alloc(&vbo, 6);
for (int i = 0; i < 6; ++i) {
- VertexBuffer_set_attrib(&vbo, pos, i, bone_octahedral_verts[i]);
+ GWN_vertbuf_attr_set(&vbo, pos, i, bone_octahedral_verts[i]);
}
- Batch_init(&batch, PRIM_LINES, &vbo, &el);
+ GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, &el);
Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR);
}
- Batch_use_program(&batch);
- Batch_Uniform4fv(&batch, "color", fcolor);
- Batch_draw(&batch);
+ GWN_batch_program_use_begin(&batch);
+ GWN_batch_uniform_4fv(&batch, "color", fcolor);
+ GWN_batch_draw(&batch);
}
static void draw_bone_solid_octahedral(void)
{
- static VertexFormat format = {0};
- static VertexBuffer vbo = {{0}};
- static Batch batch = {{0}};
+ static Gwn_VertFormat format = {0};
+ static Gwn_VertBuf vbo = {{0}};
+ static Gwn_Batch batch = {{0}};
const float light_vec[3] = {0.0f, 0.0f, 1.0f};
if (format.attrib_ct == 0) {
unsigned int v_idx = 0;
/* Vertex format */
- unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* Vertices */
- VertexBuffer_init_with_format(&vbo, &format);
- VertexBuffer_allocate_data(&vbo, 24);
+ GWN_vertbuf_init_with_format(&vbo, &format);
+ GWN_vertbuf_data_alloc(&vbo, 24);
for (int i = 0; i < 8; i++) {
add_solid_flat_triangle(&vbo, &v_idx, pos, nor,
@@ -633,7 +633,7 @@ static void draw_bone_solid_octahedral(void)
bone_octahedral_solid_normals[i]);
}
- Batch_init(&batch, PRIM_TRIANGLES, &vbo, NULL);
+ GWN_batch_init(&batch, GWN_PRIM_TRIS, &vbo, NULL);
}
if (flat_color) {
@@ -642,10 +642,10 @@ static void draw_bone_solid_octahedral(void)
else {
/* TODO replace with good default lighting shader ? */
Batch_set_builtin_program(&batch, GPU_SHADER_SIMPLE_LIGHTING);
- Batch_Uniform3fv(&batch, "light", light_vec);
+ GWN_batch_uniform_3fv(&batch, "light", light_vec);
}
- Batch_Uniform4fv(&batch, "color", fcolor);
- Batch_draw(&batch);
+ GWN_batch_uniform_4fv(&batch, "color", fcolor);
+ GWN_batch_draw(&batch);
}
/* *************** Armature drawing, bones ******************* */
@@ -810,11 +810,11 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann
//mul_v3_fl(dirvec, head);
cross_v3_v3v3(norvec, dirvec, imat[2]);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- immBegin(PRIM_TRIANGLE_STRIP, 66);
+ immBegin(GWN_PRIM_TRI_STRIP, 66);
immUniformColor4ub(255, 255, 255, 50);
for (a = 0; a < 16; a++) {
@@ -866,8 +866,8 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4],
float head, tail /*, length*/;
float *headvec, *tailvec, dirvec[3];
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -966,7 +966,7 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4],
if (id != -1)
GPU_select_load_id(id | BONESEL_BONE);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
add_v3_v3v3(vec, headvec, norvech);
immVertex3fv(pos, vec);
@@ -990,14 +990,14 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4],
static void draw_sphere_bone(const short dt, int armflag, int boneflag, short constflag, unsigned int id,
bPoseChannel *pchan, EditBone *ebone)
{
- Batch *sphere = Batch_get_sphere(1);
+ Gwn_Batch *sphere = Batch_get_sphere(1);
float head, tail, length;
float fac1, fac2, size1, size2;
const float light_vec[3] = {0.0f, 0.0f, 1.0f};
/* dt is always OB_SOlID */
Batch_set_builtin_program(sphere, GPU_SHADER_SIMPLE_LIGHTING);
- Batch_Uniform3fv(sphere, "light", light_vec);
+ GWN_batch_uniform_3fv(sphere, "light", light_vec);
gpuPushMatrix();
@@ -1040,8 +1040,8 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
GPU_select_load_id(id | BONESEL_ROOT);
gpuPushMatrix();
gpuScaleUniform(head);
- Batch_Uniform4fv(sphere, "color", fcolor);
- Batch_draw(sphere);
+ GWN_batch_uniform_4fv(sphere, "color", fcolor);
+ GWN_batch_draw(sphere);
gpuPopMatrix();
}
@@ -1058,9 +1058,9 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
gpuPushMatrix();
gpuScaleUniform(tail);
- Batch_use_program(sphere); /* hack to make the following uniforms stick */
- Batch_Uniform4fv(sphere, "color", fcolor);
- Batch_draw(sphere);
+ GWN_batch_program_use_begin(sphere); /* hack to make the following uniforms stick */
+ GWN_batch_uniform_4fv(sphere, "color", fcolor);
+ GWN_batch_draw(sphere);
gpuPopMatrix();
gpuTranslate3f(0.0f, 0.0f, -length);
@@ -1075,8 +1075,8 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
else if (dt == OB_SOLID)
UI_GetThemeColor4fv(TH_BONE_SOLID, fcolor);
- Batch_use_program(sphere); /* hack to make the following uniforms stick */
- Batch_Uniform4fv(sphere, "color", fcolor);
+ GWN_batch_program_use_begin(sphere); /* hack to make the following uniforms stick */
+ GWN_batch_uniform_4fv(sphere, "color", fcolor);
fac1 = (length - head) / length;
fac2 = (length - tail) / length;
@@ -1093,23 +1093,23 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
gpuTranslate3f(0.0f, 0.0f, length - tail);
gpuScaleUniform(size1);
- Batch_draw(sphere);
+ GWN_batch_draw(sphere);
gpuPopMatrix();
gpuPushMatrix();
gpuTranslate3f(0.0f, 0.0f, head);
gpuScaleUniform(size2);
- Batch_draw(sphere);
+ GWN_batch_draw(sphere);
gpuPopMatrix();
/* draw cynlinder between spheres */
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.0f, -1.0f);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int nor = VertexFormat_add_attrib(format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int nor = GWN_vertformat_attr_add(format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_SIMPLE_LIGHTING);
immUniformColor4fv(fcolor);
@@ -1129,7 +1129,7 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
gpuTranslate3f(0.0f, 0.0f, (head + length - tail) / 2.0f);
gpuScaleUniform(size1);
- Batch_draw(sphere);
+ GWN_batch_draw(sphere);
}
gpuPopMatrix();
@@ -1145,8 +1145,8 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
else
length = ebone->length;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
gpuPushMatrix();
gpuScaleUniform(length);
@@ -1169,7 +1169,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
if (id != -1)
GPU_select_load_id(id | BONESEL_BONE);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, 0.0f, 1.0f, 0.0f);
immVertex3f(pos, 0.0f, 0.0f, 0.0f);
immEnd();
@@ -1184,7 +1184,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
if (G.f & G_PICKSEL)
GPU_select_load_id(id | BONESEL_ROOT);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3f(pos, 0.0f, 0.0f, 0.0f);
immEnd();
}
@@ -1193,7 +1193,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
if (G.f & G_PICKSEL)
GPU_select_load_id(id | BONESEL_TIP);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3f(pos, 0.0f, 1.0f, 0.0f);
immEnd();
@@ -1221,7 +1221,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(fcolor);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, 0.0f, 1.0f, 0.0f);
immVertex3f(pos, 0.0f, 0.0f, 0.0f);
immEnd();
@@ -1237,7 +1237,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
else UI_GetThemeColor4fv(TH_VERTEX, fcolor);
}
immUniformColor4fv(fcolor);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3f(pos, 0.0f, 0.0f, 0.0f);
immEnd();
}
@@ -1250,7 +1250,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
else UI_GetThemeColor4fv(TH_VERTEX, fcolor);
}
immUniformColor4fv(fcolor);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3f(pos, 0.0f, 1.0f, 0.0f);
immEnd();
}
@@ -1451,8 +1451,8 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl
static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float length, int segments)
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(fcolor);
@@ -1466,7 +1466,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len
gpuPushMatrix();
gpuMultMatrix(bbone->mat);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, 0.0f, 0.0f, 0.0f);
immVertex3f(pos, 0.0f, dlen, 0.0f);
immEnd();
@@ -1477,7 +1477,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len
else {
gpuPushMatrix();
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, 0.0f, 0.0f, 0.0f);
immVertex3f(pos, 0.0f, length, 0.0f);
immEnd();
@@ -1632,7 +1632,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
bConstraint *con;
bPoseChannel *parchan;
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_COLOR);
@@ -1677,7 +1677,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
}
if (parchan) {
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(shdr_pos, ik_tip);
immVertex3fv(shdr_pos, parchan->pose_head);
immEnd();
@@ -1703,7 +1703,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
}
/* Only draw line in case our chain is more than one bone long! */
if (parchan != pchan) { /* XXX revise the breaking conditions to only stop at the tail? */
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(shdr_pos, ik_tip);
immVertex3fv(shdr_pos, parchan->pose_head);
immEnd();
@@ -1750,7 +1750,7 @@ static void draw_dof_ellipse(unsigned int pos, float ax, float az)
immUniformColor4ub(70, 70, 70, 50);
- immBegin(PRIM_TRIANGLES, tri*3);
+ immBegin(GWN_PRIM_TRIS, tri*3);
pz = 0.0f;
for (i = 1; i < n; i++) {
z = staticSine[i];
@@ -1785,7 +1785,7 @@ static void draw_dof_ellipse(unsigned int pos, float ax, float az)
immUniformColor3ub(0, 0, 0);
- immBegin(PRIM_LINE_STRIP, n);
+ immBegin(GWN_PRIM_LINE_STRIP, n);
for (i = 0; i < n; i++)
imm_sphere_project(pos, staticSine[n - i - 1] * ax, staticSine[i] * az);
immEnd();
@@ -1797,8 +1797,8 @@ static void draw_pose_dofs(Object *ob)
bPoseChannel *pchan;
Bone *bone;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -1863,7 +1863,7 @@ static void draw_pose_dofs(Object *ob)
gpuRotateAxis(theta, 'Z');
immUniformColor3ub(50, 50, 255); /* blue, Z axis limit */
- immBegin(PRIM_LINE_STRIP, 33);
+ immBegin(GWN_PRIM_LINE_STRIP, 33);
for (a = -16; a <= 16; a++) {
/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
float fac = ((float)a) / 16.0f * 0.5f;
@@ -1888,7 +1888,7 @@ static void draw_pose_dofs(Object *ob)
gpuRotateAxis(theta, 'X');
immUniformColor3ub(255, 50, 50); /* Red, X axis limit */
- immBegin(PRIM_LINE_STRIP, 33);
+ immBegin(GWN_PRIM_LINE_STRIP, 33);
for (a = -16; a <= 16; a++) {
/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
float fac = ((float)a) / 16.0f * 0.5f;
@@ -2207,7 +2207,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *
* - only if V3D_HIDE_HELPLINES is enabled...
*/
if ((do_dashed & DASH_HELP_LINES) && ((bone->flag & BONE_CONNECTED) == 0)) {
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_COLOR);
@@ -2225,7 +2225,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *
immUniformThemeColor(TH_WIRE);
}
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(shdr_pos, pchan->parent->pose_tail);
immVertex3fv(shdr_pos, pchan->pose_head);
immEnd();
@@ -2512,7 +2512,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
/* offset to parent */
if (eBone->parent) {
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
GPU_select_load_id(-1); /* -1 here is OK! */
@@ -2527,7 +2527,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(shdr_pos, eBone->parent->tail);
immVertex3fv(shdr_pos, eBone->head);
immEnd();
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 126217057e5..f41602f7899 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -429,7 +429,7 @@ static const float cosval[CIRCLE_RESOL] = {
*/
static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3], float size, int axis, unsigned pos)
{
- PrimitiveType line_type = PRIM_LINES;
+ Gwn_PrimType line_type = GWN_PRIM_LINES;
float buffer[4][3];
int n = 0;
@@ -481,7 +481,7 @@ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3]
break;
case 2: /* z axis */
- line_type = PRIM_LINE_STRIP;
+ line_type = GWN_PRIM_LINE_STRIP;
/* start at top left */
negate_v3_v3(v1, dx);
@@ -530,7 +530,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const
glLineWidth(1.0f);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (color) {
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4ubv(color);
@@ -541,7 +541,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const
switch (drawtype) {
case OB_PLAINAXES:
- immBegin(PRIM_LINES, 6);
+ immBegin(GWN_PRIM_LINES, 6);
for (axis = 0; axis < 3; axis++) {
v1[axis] = size;
v2[axis] = -size;
@@ -555,7 +555,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const
break;
case OB_SINGLE_ARROW:
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
/* in positive z direction only */
v1[2] = size;
immVertex3fv(pos, v1);
@@ -563,7 +563,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const
immEnd();
/* square pyramid */
- immBegin(PRIM_TRIANGLES, 12);
+ immBegin(GWN_PRIM_TRIS, 12);
v2[0] = size * 0.035f; v2[1] = size * 0.035f;
v3[0] = size * -0.035f; v3[1] = size * 0.035f;
@@ -613,7 +613,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const
for (axis = 0; axis < 3; axis++) {
const int arrow_axis = (axis == 0) ? 1 : 0;
- immBegin(PRIM_LINES, 6);
+ immBegin(GWN_PRIM_LINES, 6);
v2[axis] = size;
immVertex3fv(pos, v1);
@@ -725,14 +725,14 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA);
immUniform1f("alpha", ob_alpha);
immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texCoord, 0.0f, 0.0f);
immVertex2f(pos, rect.xmin, rect.ymin);
@@ -753,7 +753,7 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
/* Draw the image outline */
glLineWidth(1.5f);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
const bool picking = dflag & DRAW_CONSTCOLOR;
if (picking) {
@@ -805,7 +805,7 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un
circball_array_fill(verts, cent, rad, tmat);
- immBegin(PRIM_LINE_LOOP, CIRCLE_RESOL);
+ immBegin(GWN_PRIM_LINE_LOOP, CIRCLE_RESOL);
for (int i = 0; i < CIRCLE_RESOL; ++i) {
immVertex3fv(pos, verts[i]);
}
@@ -826,7 +826,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *UNUSED(rv3d), const floa
glEnable(GL_BLEND);
GPU_enable_program_point_size();
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA);
immUniform1f("size", size);
@@ -846,7 +846,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *UNUSED(rv3d), const floa
immUniform4fv("outlineColor", outlineColor);
immUniform1f("outlineWidth", outlineWidth);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, co);
immEnd();
@@ -1039,7 +1039,7 @@ static void drawcube_size(float size, unsigned pos)
glDrawRangeElements(GL_LINES, 0, 7, 24, GL_UNSIGNED_BYTE, indices);
glDisableClientState(GL_VERTEX_ARRAY);
#else
- immBegin(PRIM_LINES, 24);
+ immBegin(GWN_PRIM_LINES, 24);
for (int i = 0; i < 24; ++i) {
immVertex3fv(pos, verts[indices[i]]);
}
@@ -1057,13 +1057,13 @@ static void drawshadbuflimits(const Lamp *la, const float mat[4][4], unsigned po
madd_v3_v3v3fl(sta, mat[3], lavec, la->clipsta);
madd_v3_v3v3fl(end, mat[3], lavec, la->clipend);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, sta);
immVertex3fv(pos, end);
immEnd();
glPointSize(3.0f);
- immBegin(PRIM_POINTS, 2);
+ immBegin(GWN_PRIM_POINTS, 2);
immVertex3fv(pos, sta);
immVertex3fv(pos, end);
immEnd();
@@ -1138,7 +1138,7 @@ static void draw_spot_cone(Lamp *la, float x, float z, unsigned pos)
const bool square = (la->mode & LA_SQUARE);
- immBegin(PRIM_TRIANGLE_FAN, square ? 6 : 34);
+ immBegin(GWN_PRIM_TRI_FAN, square ? 6 : 34);
immVertex3f(pos, 0.0f, 0.0f, -x);
if (square) {
@@ -1285,7 +1285,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
normalize_v3(imat[0]);
normalize_v3(imat[1]);
- const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ const unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* lamp center */
copy_v3_v3(vec, ob->obmat[3]);
@@ -1329,7 +1329,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
immUniformColor3fvAlpha(color, 0.3f);
immUniform4fv("outlineColor", color);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, vec);
immEnd();
@@ -1345,7 +1345,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
/* color doesn't matter, so don't set */
glPointSize(lampdot_size);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, vec);
immEnd();
@@ -1400,7 +1400,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
setlinestyle(3);
- immBegin(PRIM_LINES, 16);
+ immBegin(GWN_PRIM_LINES, 16);
for (axis = 0; axis < 8; axis++) {
immVertex3fv(pos, v1);
immVertex3fv(pos, v2);
@@ -1453,7 +1453,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
{-z_abs, z_abs, x},
};
- immBegin(PRIM_LINES, 16);
+ immBegin(GWN_PRIM_LINES, 16);
for (int i = 1; i <= 4; ++i) {
immVertex3fv(pos, vertices[0]); /* apex to corner */
immVertex3fv(pos, vertices[i]);
@@ -1479,7 +1479,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
}
else {
/* draw the angled sides of the cone */
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex3fv(pos, vvec);
immVertex3fv(pos, vec);
immVertex3fv(pos, lvec);
@@ -1507,7 +1507,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
/* draw clip start, useful for wide cones where its not obvious where the start is */
gpuTranslate3f(0.0f, 0.0f, -x); /* reverse translation above */
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
if (la->type == LA_SPOT && (la->mode & LA_SHAD_BUF)) {
float lvec_clip[3];
float vvec_clip[3];
@@ -1528,7 +1528,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
}
else if (ELEM(la->type, LA_HEMI, LA_SUN)) {
/* draw the line from the circle along the dist */
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
vec[2] = -circrad;
immVertex3fv(pos, vec);
vec[2] = -la->dist;
@@ -1548,7 +1548,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
float v[3] = {0.0f, 0.0f, 0.0f};
zdist = 0.02f;
- immBegin(PRIM_LINE_STRIP, 6);
+ immBegin(GWN_PRIM_LINE_STRIP, 6);
for (steps = 0; steps < 6; steps++) {
if (axis == 0 || axis == 1) { /* x axis up, x axis down */
@@ -1587,7 +1587,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
else if (la->area_shape == LA_AREA_RECT)
imm_draw_line_box_3d(pos, -la->area_size * 0.5f, -la->area_sizey * 0.5f, la->area_size * 0.5f, la->area_sizey * 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, 0.0f, 0.0f, -circrad);
immVertex3f(pos, 0.0f, 0.0f, -la->dist);
immEnd();
@@ -1613,14 +1613,14 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
if (vec[2] > 0) vec[2] -= circrad;
else vec[2] += circrad;
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, vec);
vec[2] = 0;
immVertex3fv(pos, vec);
immEnd();
glPointSize(2.0f);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, vec);
immEnd();
@@ -1632,7 +1632,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
static void draw_limit_line(float sta, float end, const short dflag, const unsigned char col[3], unsigned pos)
{
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, 0.0f, 0.0f, -sta);
immVertex3f(pos, 0.0f, 0.0f, -end);
immEnd();
@@ -1641,7 +1641,7 @@ static void draw_limit_line(float sta, float end, const short dflag, const unsig
glPointSize(3.0f);
/* would like smooth round points here, but that means binding another shader...
* if it's really desired, pull these points into their own function to be called after */
- immBegin(PRIM_POINTS, 2);
+ immBegin(GWN_PRIM_POINTS, 2);
if ((dflag & DRAW_CONSTCOLOR) == 0) {
immUniformColor3ubv(col);
}
@@ -1656,7 +1656,7 @@ static void draw_limit_line(float sta, float end, const short dflag, const unsig
/* qdn: now also enabled for Blender to set focus point for defocus composite node */
static void draw_focus_cross(float dist, float size, unsigned pos)
{
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex3f(pos, -size, 0.0f, -dist);
immVertex3f(pos, size, 0.0f, -dist);
immVertex3f(pos, 0.0f, -size, -dist);
@@ -1753,7 +1753,7 @@ static void draw_viewport_object_reconstruction(
}
else if (v3d_drawtype > OB_WIRE) {
if (v3d->bundle_drawtype == OB_EMPTY_SPHERE) {
- Batch *batch;
+ Gwn_Batch *batch;
gpuScaleUniform(0.05f);
@@ -1763,17 +1763,17 @@ static void draw_viewport_object_reconstruction(
if ((dflag & DRAW_CONSTCOLOR) == 0) {
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
- Batch_Uniform4f(batch, "color",
- ob_wire_col[0]/255.f,
- ob_wire_col[1]/255.f,
- ob_wire_col[2]/255.f, 1.0f);
+ GWN_batch_uniform_4f(batch, "color",
+ ob_wire_col[0] / 255.f,
+ ob_wire_col[1] / 255.f,
+ ob_wire_col[2] / 255.f, 1.0f);
}
else {
Batch_set_builtin_program(batch, GPU_SHADER_3D_DEPTH_ONLY);
}
glLineWidth(2.0f);
- Batch_draw(batch);
+ GWN_batch_draw(batch);
}
batch = Batch_get_sphere(0);
@@ -1782,17 +1782,17 @@ static void draw_viewport_object_reconstruction(
const float light[3] = {0.0f, 0.0f, 1.0f};
float col[3];
Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING);
- Batch_Uniform3fv(batch, "light", light);
+ GWN_batch_uniform_3fv(batch, "light", light);
if (track->flag & TRACK_CUSTOMCOLOR) copy_v3_v3(col, track->color);
else UI_GetThemeColor3fv(TH_BUNDLE_SOLID, col);
- Batch_Uniform4f(batch, "color", col[0], col[1], col[2], 1.0f);
+ GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f);
}
else {
Batch_set_builtin_program(batch, GPU_SHADER_3D_DEPTH_ONLY);
}
- Batch_draw(batch);
+ GWN_batch_draw(batch);
}
else {
unsigned char color[4];
@@ -1835,14 +1835,14 @@ static void draw_viewport_object_reconstruction(
if (reconstruction->camnr >= 2) {
MovieReconstructedCamera *camera = reconstruction->cameras;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_CAMERA_PATH);
glLineWidth(2.0f);
- immBegin(PRIM_LINE_STRIP, reconstruction->camnr);
+ immBegin(GWN_PRIM_LINE_STRIP, reconstruction->camnr);
for (int a = 0; a < reconstruction->camnr; a++, camera++) {
immVertex3fv(pos, camera->mat[3]);
}
@@ -1895,7 +1895,7 @@ static void draw_viewport_reconstruction(
/* camera frame */
static void drawcamera_frame(float vec[4][3], bool filled, unsigned pos)
{
- immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, 4);
+ immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, 4);
immVertex3fv(pos, vec[0]);
immVertex3fv(pos, vec[1]);
immVertex3fv(pos, vec[2]);
@@ -1906,7 +1906,7 @@ static void drawcamera_frame(float vec[4][3], bool filled, unsigned pos)
/* center point to camera frame */
static void drawcamera_framelines(float vec[4][3], float origin[3], unsigned pos)
{
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex3fv(pos, origin);
immVertex3fv(pos, vec[0]);
immVertex3fv(pos, origin);
@@ -1924,7 +1924,7 @@ static void drawcamera_volume(float near_plane[4][3], float far_plane[4][3], boo
drawcamera_frame(far_plane, filled, pos);
if (filled) {
- immBegin(PRIM_TRIANGLE_STRIP, 10);
+ immBegin(GWN_PRIM_TRI_STRIP, 10);
immVertex3fv(pos, near_plane[0]);
immVertex3fv(pos, far_plane[0]);
@@ -1940,7 +1940,7 @@ static void drawcamera_volume(float near_plane[4][3], float far_plane[4][3], boo
immEnd();
}
else {
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
for (int i = 0; i < 4; ++i) {
immVertex3fv(pos, near_plane[i]);
immVertex3fv(pos, far_plane[i]);
@@ -2024,7 +2024,7 @@ static void drawcamera_stereo3d(
glLineStipple(2, 0xAAAA);
glEnable(GL_LINE_STIPPLE);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, origin[0]);
immVertex3fv(pos, origin[1]);
immEnd();
@@ -2180,7 +2180,7 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
BKE_camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale,
asp, shift, &drawsize, vec);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) {
immUniformColor3ubv(ob_wire_col);
@@ -2225,10 +2225,10 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
* for active cameras. We actually draw both outline+filled
* for active cameras so the wire can be seen side-on */
for (int i = 0; i < 2; i++) {
- if (i == 0) immBegin(PRIM_LINE_LOOP, 3);
+ if (i == 0) immBegin(GWN_PRIM_LINE_LOOP, 3);
else if (i == 1 && is_active) {
glDisable(GL_CULL_FACE); /* TODO: declarative state tracking */
- immBegin(PRIM_TRIANGLES, 3);
+ immBegin(GWN_PRIM_TRIS, 3);
}
else break;
@@ -2288,8 +2288,8 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* flag similar to draw_object() */
void drawspeaker(const unsigned char ob_wire_col[3])
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -2304,7 +2304,7 @@ void drawspeaker(const unsigned char ob_wire_col[3])
for (int j = 0; j < 3; j++) {
float z = 0.25f * j - 0.125f;
- immBegin(PRIM_LINE_LOOP, segments);
+ immBegin(GWN_PRIM_LINE_LOOP, segments);
for (int i = 0; i < segments; i++) {
float x = cosf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f);
float y = sinf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f);
@@ -2316,7 +2316,7 @@ void drawspeaker(const unsigned char ob_wire_col[3])
for (int j = 0; j < 4; j++) {
float x = (((j + 1) % 2) * (j - 1)) * 0.5f;
float y = ((j % 2) * (j - 2)) * 0.5f;
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
for (int i = 0; i < 3; i++) {
if (i == 1) {
x *= 0.5f;
@@ -2343,7 +2343,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s
UI_GetThemeColor4fv(TH_ACTIVE_VERT, active_color);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- immBeginAtMost(PRIM_POINTS, lt->pntsw * lt->pntsv * lt->pntsu);
+ immBeginAtMost(GWN_PRIM_POINTS, lt->pntsw * lt->pntsv * lt->pntsu);
for (int w = 0; w < lt->pntsw; w++) {
int wxt = (w == 0 || w == lt->pntsw - 1);
@@ -2453,11 +2453,11 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign
}
}
- VertexFormat *format = immVertexFormat();
- unsigned int color, pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int color, pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (actdef_wcol) {
- color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
}
else {
@@ -2477,7 +2477,7 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign
}
glLineWidth(1.0f);
- immBeginAtMost(PRIM_LINES, lt->pntsw * lt->pntsv * lt->pntsu * 6);
+ immBeginAtMost(GWN_PRIM_LINES, lt->pntsw * lt->pntsv * lt->pntsu * 6);
for (w = 0; w < lt->pntsw; w++) {
int wxt = (w == 0 || w == lt->pntsw - 1);
@@ -2510,9 +2510,9 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
- VertexFormat *v_format = immVertexFormat();
- unsigned int v_pos = VertexFormat_add_attrib(v_format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int v_color = VertexFormat_add_attrib(v_format, "color", COMP_F32, 4, KEEP_FLOAT);
+ Gwn_VertFormat *v_format = immVertexFormat();
+ unsigned int v_pos = GWN_vertformat_attr_add(v_format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int v_color = GWN_vertformat_attr_add(v_format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
@@ -2557,7 +2557,7 @@ static void drawSelectedVertices__mapFunc(void *userData, int index, const float
static void drawSelectedVertices(DerivedMesh *dm, Mesh *me)
{
drawDMVertSel_userData data;
- VertexFormat *format = immVertexFormat();
+ Gwn_VertFormat *format = immVertexFormat();
/* TODO define selected color */
unsigned char base_col[3] = {0x0, 0x0, 0x0};
@@ -2572,14 +2572,14 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me)
data.col[1] = sel_col;
data.col[2] = act_col;
- data.color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (dm->getNumVerts(dm) == 0) return;
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm));
+ immBeginAtMost(GWN_PRIM_POINTS, dm->getNumVerts(dm));
dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, &data, DM_FOREACH_NOP);
immEnd();
@@ -2639,12 +2639,12 @@ static void draw_dm_face_normals__mapFunc(void *userData, int index, const float
static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, DerivedMesh *dm, int theme_id)
{
- VertexFormat *format = immVertexFormat();
+ Gwn_VertFormat *format = immVertexFormat();
drawDMNormal_userData data;
data.bm = em->bm;
data.normalsize = scene->toolsettings->normalsize;
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
calcDrawDMNormalScale(ob, &data);
@@ -2653,7 +2653,7 @@ static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(theme_id);
- immBeginAtMost(PRIM_LINES, dm->getNumPolys(dm) * 2);
+ immBeginAtMost(GWN_PRIM_LINES, dm->getNumPolys(dm) * 2);
dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL);
immEnd();
@@ -2673,19 +2673,19 @@ static void draw_dm_face_centers__mapFunc(void *userData, int index, const float
}
static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, bool select, const unsigned char fcol[3])
{
- VertexFormat *format = immVertexFormat();
+ Gwn_VertFormat *format = immVertexFormat();
drawBMSelect_userData data;
data.bm = em->bm;
data.select = select;
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (dm->getNumPolys(dm) == 0) return;
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(fcol);
- immBeginAtMost(PRIM_POINTS, dm->getNumPolys(dm));
+ immBeginAtMost(GWN_PRIM_POINTS, dm->getNumPolys(dm));
dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, &data, DM_FOREACH_NOP);
immEnd();
@@ -2726,11 +2726,11 @@ static void draw_dm_vert_normals__mapFunc(void *userData, int index, const float
static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, DerivedMesh *dm, int theme_id)
{
drawDMNormal_userData data;
- VertexFormat *format = immVertexFormat();
+ Gwn_VertFormat *format = immVertexFormat();
data.bm = em->bm;
data.normalsize = scene->toolsettings->normalsize;
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
calcDrawDMNormalScale(ob, &data);
@@ -2739,7 +2739,7 @@ static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(theme_id);
- immBeginAtMost(PRIM_LINES, dm->getNumVerts(dm) * 2);
+ immBeginAtMost(GWN_PRIM_LINES, dm->getNumVerts(dm) * 2);
dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL);
immEnd();
@@ -2785,14 +2785,14 @@ static void draw_dm_verts__mapFunc(void *userData, int index, const float co[3],
static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVert *eve_act,
RegionView3D *rv3d, const unsigned char col[4])
{
- VertexFormat *format = immVertexFormat();
+ Gwn_VertFormat *format = immVertexFormat();
drawDMVerts_userData data;
data.sel = sel;
data.eve_act = eve_act;
data.bm = em->bm;
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- data.color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ data.color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
/* Cache theme values */
UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, data.th_editmesh_active);
@@ -2813,7 +2813,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm));
+ immBeginAtMost(GWN_PRIM_POINTS, dm->getNumVerts(dm));
dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data, DM_FOREACH_NOP);
immEnd();
@@ -2823,7 +2823,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer
data.cd_vskin_offset = CustomData_get_offset(&em->bm->vdata, CD_MVERT_SKIN);
if (data.cd_vskin_offset != -1) {
- data.pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4ubv(data.th_skin_root);
@@ -3148,7 +3148,7 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
data.bm = em->bm;
data.normalsize = scene->toolsettings->normalsize;
- data.pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (dm->getNumLoops(dm) == 0) return;
@@ -3157,7 +3157,7 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
calcDrawDMNormalScale(ob, &data);
- immBeginAtMost(PRIM_LINES, dm->getNumLoops(dm) * 2);
+ immBeginAtMost(GWN_PRIM_LINES, dm->getNumLoops(dm) * 2);
dm->foreachMappedLoop(dm, draw_dm_loop_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL);
immEnd();
@@ -3327,15 +3327,15 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
/* is that ever true? */
if (data.cd_layer_offset != -1) {
- VertexFormat *format = immVertexFormat();
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2.0f);
- immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm));
+ immBeginAtMost(GWN_PRIM_POINTS, dm->getNumVerts(dm));
dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, &data, DM_FOREACH_NOP);
immEnd();
@@ -4141,7 +4141,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D
Object *UNUSED(ob), Mesh *me, BMEditMesh *UNUSED(em), DerivedMesh *UNUSED(cageDM), DerivedMesh *UNUSED(finalDM), const char UNUSED(dt))
{
/* for now... something simple! */
- Batch *surface = DRW_mesh_batch_cache_get_all_triangles(me);
+ Gwn_Batch *surface = DRW_mesh_batch_cache_get_all_triangles(me);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
@@ -4152,16 +4152,16 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D
glDepthMask(GL_FALSE);
Batch_set_builtin_program(surface, GPU_SHADER_3D_UNIFORM_COLOR);
- Batch_Uniform4f(surface, "color", 1.0f, 0.5f, 0.0f, 0.5f);
- Batch_draw(surface);
+ GWN_batch_uniform_4f(surface, "color", 1.0f, 0.5f, 0.0f, 0.5f);
+ GWN_batch_draw(surface);
#if 0 /* until I understand finalDM better */
if (finalDM != cageDM) {
puts("finalDM != cageDM");
- Batch *finalSurface = MBC_get_all_triangles(finalDM);
+ Gwn_Batch *finalSurface = MBC_get_all_triangles(finalDM);
Batch_set_builtin_program(finalSurface, GPU_SHADER_3D_UNIFORM_COLOR);
- Batch_Uniform4f(finalSurface, "color", 0.0f, 0.0f, 0.0f, 0.05f);
- Batch_draw(finalSurface);
+ GWN_batch_uniform_4f(finalSurface, "color", 0.0f, 0.0f, 0.0f, 0.05f);
+ GWN_batch_draw(finalSurface);
}
#endif
@@ -4172,46 +4172,46 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D
* TODO: draw edit object last to avoid this mess
*/
Batch_set_builtin_program(surface, GPU_SHADER_3D_DEPTH_ONLY);
- Batch_draw(surface);
+ GWN_batch_draw(surface);
if (GLEW_VERSION_3_2) {
#if 0
- Batch *overlay = DRW_mesh_batch_cache_get_overlay_edges(me);
+ Gwn_Batch *overlay = DRW_mesh_batch_cache_get_overlay_edges(me);
Batch_set_builtin_program(overlay, GPU_SHADER_EDGES_OVERLAY);
- Batch_Uniform2f(overlay, "viewportSize", ar->winx, ar->winy);
- Batch_draw(overlay);
+ GWN_batch_uniform_2f(overlay, "viewportSize", ar->winx, ar->winy);
+ GWN_batch_draw(overlay);
#endif
#if 0 /* TODO: use this SIMPLE variant for pure triangle meshes */
Batch_set_builtin_program(surface, GPU_SHADER_EDGES_OVERLAY_SIMPLE);
/* use these defaults:
* const float edgeColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
- * Batch_Uniform4f(surface, "fillColor", edgeColor[0], edgeColor[1], edgeColor[2], 0.0f);
- * Batch_Uniform4fv(surface, "outlineColor", edgeColor);
- * Batch_Uniform1f(surface, "outlineWidth", 1.0f);
+ * GWN_batch_uniform_4f(surface, "fillColor", edgeColor[0], edgeColor[1], edgeColor[2], 0.0f);
+ * GWN_batch_uniform_4fv(surface, "outlineColor", edgeColor);
+ * GWN_batch_uniform_1f(surface, "outlineWidth", 1.0f);
*/
- Batch_Uniform2f(surface, "viewportSize", ar->winx, ar->winy);
- Batch_draw(surface);
+ GWN_batch_uniform_2f(surface, "viewportSize", ar->winx, ar->winy);
+ GWN_batch_draw(surface);
#endif
}
else {
- Batch *edges = DRW_mesh_batch_cache_get_all_edges(me);
+ Gwn_Batch *edges = DRW_mesh_batch_cache_get_all_edges(me);
Batch_set_builtin_program(edges, GPU_SHADER_3D_UNIFORM_COLOR);
- Batch_Uniform4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f);
+ GWN_batch_uniform_4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f);
glEnable(GL_LINE_SMOOTH);
glLineWidth(1.5f);
- Batch_draw(edges);
+ GWN_batch_draw(edges);
glDisable(GL_LINE_SMOOTH);
}
#if 0 /* looks good even without points */
- Batch *verts = MBC_get_all_verts(me);
+ Gwn_Batch *verts = MBC_get_all_verts(me);
glEnable(GL_BLEND);
Batch_set_builtin_program(verts, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);
- Batch_Uniform4f(verts, "color", 0.0f, 0.0f, 0.0f, 1.0f);
- Batch_Uniform1f(verts, "size", UI_GetThemeValuef(TH_VERTEX_SIZE) * 1.5f);
- Batch_draw(verts);
+ GWN_batch_uniform_4f(verts, "color", 0.0f, 0.0f, 0.0f, 1.0f);
+ GWN_batch_uniform_1f(verts, "size", UI_GetThemeValuef(TH_VERTEX_SIZE) * 1.5f);
+ GWN_batch_draw(verts);
glDisable(GL_BLEND);
#endif
@@ -4257,30 +4257,30 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object
UI_GetThemeColor4fv((is_active ? TH_ACTIVE : TH_SELECT), outline_color);
#if 1 /* new version that draws only silhouette edges */
- Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me);
+ Gwn_Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me);
if (rv3d->persp == RV3D_ORTHO) {
Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO);
/* set eye vector, transformed to object coords */
float eye[3] = { 0.0f, 0.0f, 1.0f }; /* looking into the screen */
mul_m3_v3(gpuGetNormalMatrixInverse(NULL), eye);
- Batch_Uniform3fv(fancy_edges, "eye", eye);
+ GWN_batch_uniform_3fv(fancy_edges, "eye", eye);
}
else {
Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP);
}
- Batch_Uniform1b(fancy_edges, "drawFront", false);
- Batch_Uniform1b(fancy_edges, "drawBack", false);
- Batch_Uniform1b(fancy_edges, "drawSilhouette", true);
- Batch_Uniform4fv(fancy_edges, "silhouetteColor", outline_color);
+ GWN_batch_uniform_1b(fancy_edges, "drawFront", false);
+ GWN_batch_uniform_1b(fancy_edges, "drawBack", false);
+ GWN_batch_uniform_1b(fancy_edges, "drawSilhouette", true);
+ GWN_batch_uniform_4fv(fancy_edges, "silhouetteColor", outline_color);
- Batch_draw(fancy_edges);
+ GWN_batch_draw(fancy_edges);
#else /* alternate version that matches look of old viewport (but more efficient) */
- Batch *batch = MBC_get_all_edges(dm);
+ Gwn_Batch *batch = MBC_get_all_edges(dm);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
- Batch_Uniform4fv(batch, "color", outline_color);
- Batch_draw(batch);
+ GWN_batch_uniform_4fv(batch, "color", outline_color);
+ GWN_batch_draw(batch);
#endif
glDepthMask(GL_TRUE);
@@ -4781,14 +4781,14 @@ static void draw_mesh_fancy_new(Scene *scene, SceneLayer *sl, ARegion *ar, View3
#if 1 /* fancy wireframes */
- Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me);
+ Gwn_Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me);
if (rv3d->persp == RV3D_ORTHO) {
Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO);
/* set eye vector, transformed to object coords */
float eye[3] = { 0.0f, 0.0f, 1.0f }; /* looking into the screen */
mul_m3_v3(gpuGetNormalMatrixInverse(NULL), eye);
- Batch_Uniform3fv(fancy_edges, "eye", eye);
+ GWN_batch_uniform_3fv(fancy_edges, "eye", eye);
}
else {
Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP);
@@ -4799,35 +4799,35 @@ static void draw_mesh_fancy_new(Scene *scene, SceneLayer *sl, ARegion *ar, View3
float outlineColor[4];
make_color_variations(ob_wire_col, backColor, frontColor, outlineColor, other_obedit);
- Batch_Uniform4fv(fancy_edges, "frontColor", frontColor);
- Batch_Uniform4fv(fancy_edges, "backColor", backColor);
- Batch_Uniform1b(fancy_edges, "drawFront", true);
- Batch_Uniform1b(fancy_edges, "drawBack", true); /* false here = backface cull */
- Batch_Uniform1b(fancy_edges, "drawSilhouette", false);
+ GWN_batch_uniform_4fv(fancy_edges, "frontColor", frontColor);
+ GWN_batch_uniform_4fv(fancy_edges, "backColor", backColor);
+ GWN_batch_uniform_1b(fancy_edges, "drawFront", true);
+ GWN_batch_uniform_1b(fancy_edges, "drawBack", true); /* false here = backface cull */
+ GWN_batch_uniform_1b(fancy_edges, "drawSilhouette", false);
- Batch_draw(fancy_edges);
+ GWN_batch_draw(fancy_edges);
/* extra oomph for the silhouette contours */
glLineWidth(2.0f);
- Batch_use_program(fancy_edges); /* hack to make the following uniforms stick */
- Batch_Uniform1b(fancy_edges, "drawFront", false);
- Batch_Uniform1b(fancy_edges, "drawBack", false);
- Batch_Uniform1b(fancy_edges, "drawSilhouette", true);
- Batch_Uniform4fv(fancy_edges, "silhouetteColor", outlineColor);
+ GWN_batch_program_use_begin(fancy_edges); /* hack to make the following uniforms stick */
+ GWN_batch_uniform_1b(fancy_edges, "drawFront", false);
+ GWN_batch_uniform_1b(fancy_edges, "drawBack", false);
+ GWN_batch_uniform_1b(fancy_edges, "drawSilhouette", true);
+ GWN_batch_uniform_4fv(fancy_edges, "silhouetteColor", outlineColor);
- Batch_draw(fancy_edges);
+ GWN_batch_draw(fancy_edges);
#else /* simple wireframes */
- Batch *batch = MBC_get_all_edges(dm);
+ Gwn_Batch *batch = MBC_get_all_edges(dm);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
float color[4];
rgba_uchar_to_float(color, ob_wire_col);
- Batch_Uniform4fv(batch, "color", color);
+ GWN_batch_uniform_4fv(batch, "color", color);
- Batch_draw(batch);
+ GWN_batch_draw(batch);
#endif
}
else if (((is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
@@ -5121,23 +5121,23 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)(Scene *scene, SceneLayer *sl,
/* ************** DRAW DISPLIST ****************** */
-static void drawDispListVerts(PrimitiveType prim_type, const void *data, unsigned int vert_ct, const unsigned char wire_col[3])
+static void drawDispListVerts(Gwn_PrimType prim_type, const void *data, unsigned int vert_ct, const unsigned char wire_col[3])
{
- VertexFormat format = {0};
- unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat format = {0};
+ unsigned int pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vert_ct);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vert_ct);
- VertexBuffer_fill_attrib(vbo, pos_id, data);
+ GWN_vertbuf_attr_fill(vbo, pos_id, data);
- Batch *batch = Batch_create(prim_type, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
if (wire_col) {
- Batch_Uniform4f(batch, "color", wire_col[0]/255.0f, wire_col[1]/255.0f, wire_col[2]/255.0f, 1.0f);
+ GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f);
}
- Batch_draw(batch);
- Batch_discard_all(batch);
+ GWN_batch_draw(batch);
+ GWN_batch_discard_all(batch);
}
/* convert dispList with elem indices to batch, only support triangles and quads
@@ -5149,59 +5149,59 @@ static void drawDispListElem(
const float *data, const float *ndata, unsigned int data_len,
const int *elem, unsigned int elem_len, const unsigned char wire_col[3])
{
- VertexFormat format = {0};
+ Gwn_VertFormat format = {0};
int i;
const int *idx = elem;
unsigned int pos_id, nor_id;
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (ndata) {
if (ndata_is_single) {
/* pass */
}
else {
- nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
}
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, (quads) ? elem_len * 2 : elem_len, 0xffffffff);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, (quads) ? elem_len * 2 : elem_len, 0xffffffff);
if (quads) {
for (i = elem_len; i; --i, idx += 4) {
- add_triangle_vertices(&elb, idx[0], idx[1], idx[2]);
- add_triangle_vertices(&elb, idx[0], idx[2], idx[3]);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[2], idx[3]);
}
}
else {
for (i = elem_len; i; --i, idx += 3) {
- add_triangle_vertices(&elb, idx[0], idx[1], idx[2]);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);
}
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, data_len);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, data_len);
- VertexBuffer_fill_attrib(vbo, pos_id, data);
+ GWN_vertbuf_attr_fill(vbo, pos_id, data);
if (ndata) {
if (ndata_is_single) {
/* TODO: something like glNormal for a single value */
}
else {
- VertexBuffer_fill_attrib(vbo, nor_id, ndata);
+ GWN_vertbuf_attr_fill(vbo, nor_id, ndata);
}
}
- Batch *batch = Batch_create(PRIM_TRIANGLES, vbo, ElementList_build(&elb));
+ Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_TRIS, vbo, GWN_indexbuf_build(&elb));
Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING);
if (wire_col) {
- Batch_Uniform4f(batch, "color", wire_col[0]/255.0f, wire_col[1]/255.0f, wire_col[2]/255.0f, 1.0f);
+ GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f);
}
- Batch_Uniform4f(batch, "color", 0.8f, 0.8f, 0.8f, 1.0f);
- Batch_Uniform3f(batch, "light", 0.0f, 0.0f, 1.0f);
- Batch_draw(batch);
- Batch_discard_all(batch);
+ GWN_batch_uniform_4f(batch, "color", 0.8f, 0.8f, 0.8f, 1.0f);
+ GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f);
+ GWN_batch_draw(batch);
+ GWN_batch_discard_all(batch);
}
/**
@@ -5229,20 +5229,20 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask, con
switch (dl->type) {
case DL_SEGM:
for (parts = 0; parts < dl->parts; parts++)
- drawDispListVerts(PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col);
+ drawDispListVerts(GWN_PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col);
break;
case DL_POLY:
for (parts = 0; parts < dl->parts; parts++)
- drawDispListVerts(PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col);
+ drawDispListVerts(GWN_PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col);
break;
case DL_SURF:
for (parts = 0; parts < dl->parts; parts++) {
if (dl->flag & DL_CYCL_U)
- drawDispListVerts(PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col);
+ drawDispListVerts(GWN_PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col);
else
- drawDispListVerts(PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col);
+ drawDispListVerts(GWN_PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col);
}
float *data_aligned = MEM_mallocN(sizeof(float) * 3 * dl->parts, "aligned data");
@@ -5260,9 +5260,9 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask, con
}
if (dl->flag & DL_CYCL_V)
- drawDispListVerts(PRIM_LINE_LOOP, data_aligned, dl->parts, wire_col);
+ drawDispListVerts(GWN_PRIM_LINE_LOOP, data_aligned, dl->parts, wire_col);
else
- drawDispListVerts(PRIM_LINE_STRIP, data_aligned, dl->parts, wire_col);
+ drawDispListVerts(GWN_PRIM_LINE_STRIP, data_aligned, dl->parts, wire_col);
}
if (data_aligned)
@@ -5328,7 +5328,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short UNUSED(dflag
col = -1;
}
- drawDispListVerts(PRIM_LINE_STRIP, data, dl->nr, ob_wire_col);
+ drawDispListVerts(GWN_PRIM_LINE_STRIP, data, dl->nr, ob_wire_col);
}
break;
case DL_POLY:
@@ -5338,7 +5338,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short UNUSED(dflag
col = -1;
}
- drawDispListVerts(PRIM_LINE_LOOP, data, dl->nr, ob_wire_col);
+ drawDispListVerts(GWN_PRIM_LINE_LOOP, data, dl->nr, ob_wire_col);
}
break;
case DL_SURF:
@@ -5621,47 +5621,47 @@ static bool drawDispList(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D
/* *********** drawing for particles ************* */
/* stride : offset size in bytes
* col[4] : the color to use when *color is NULL, can be also NULL */
-static void draw_vertex_array(PrimitiveType prim_type, const float *vert, const float *nor, const float *color, int stride, int vert_ct, float col[4])
+static void draw_vertex_array(Gwn_PrimType prim_type, const float *vert, const float *nor, const float *color, int stride, int vert_ct, float col[4])
{
- VertexFormat format = {0};
+ Gwn_VertFormat format = {0};
unsigned int pos_id, nor_id, col_id;
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- if (nor) nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
- if (color) col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, 3, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ if (nor) nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ if (color) col_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vert_ct);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vert_ct);
if (stride == 0) {
- VertexBuffer_fill_attrib(vbo, pos_id, vert);
- if (nor) VertexBuffer_fill_attrib(vbo, nor_id, nor);
- if (color) VertexBuffer_fill_attrib(vbo, col_id, color);
+ GWN_vertbuf_attr_fill(vbo, pos_id, vert);
+ if (nor) GWN_vertbuf_attr_fill(vbo, nor_id, nor);
+ if (color) GWN_vertbuf_attr_fill(vbo, col_id, color);
}
else {
- VertexBuffer_fill_attrib_stride(vbo, pos_id, stride, vert);
- if (nor) VertexBuffer_fill_attrib_stride(vbo, nor_id, stride, nor);
- if (color) VertexBuffer_fill_attrib_stride(vbo, col_id, stride, color);
+ GWN_vertbuf_attr_fill_stride(vbo, pos_id, stride, vert);
+ if (nor) GWN_vertbuf_attr_fill_stride(vbo, nor_id, stride, nor);
+ if (color) GWN_vertbuf_attr_fill_stride(vbo, col_id, stride, color);
}
- Batch *batch = Batch_create(prim_type, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL);
if (nor && color) {
Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR);
- Batch_Uniform3f(batch, "light", 0.0f, 0.0f, 1.0f);
+ GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f);
}
else if (nor) {
Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING);
- Batch_Uniform3f(batch, "light", 0.0f, 0.0f, 1.0f);
- if (col) Batch_Uniform4fv(batch, "color", col);
+ GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f);
+ if (col) GWN_batch_uniform_4fv(batch, "color", col);
}
else if (color) {
Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR);
}
else {
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
- if (col) Batch_Uniform4fv(batch, "color", col);
+ if (col) GWN_batch_uniform_4fv(batch, "color", col);
}
- Batch_draw(batch);
- Batch_discard_all(batch);
+ GWN_batch_draw(batch);
+ GWN_batch_discard_all(batch);
}
static void draw_particle_arrays_new(int draw_as, int ob_dt, int select,
@@ -5672,10 +5672,10 @@ static void draw_particle_arrays_new(int draw_as, int ob_dt, int select,
switch (draw_as) {
case PART_DRAW_AXIS:
case PART_DRAW_CROSS:
- draw_vertex_array(PRIM_LINES, vert, nor, color, 0, 6 * totpoint, col);
+ draw_vertex_array(GWN_PRIM_LINES, vert, nor, color, 0, 6 * totpoint, col);
break;
case PART_DRAW_LINE:
- draw_vertex_array(PRIM_LINES, vert, nor, color, 0, 2 * totpoint, col);
+ draw_vertex_array(GWN_PRIM_LINES, vert, nor, color, 0, 2 * totpoint, col);
break;
case PART_DRAW_BB:
if (ob_dt <= OB_WIRE || select)
@@ -5683,10 +5683,10 @@ static void draw_particle_arrays_new(int draw_as, int ob_dt, int select,
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- draw_vertex_array(PRIM_TRIANGLES, vert, nor, color, 0, 6 * totpoint, col);
+ draw_vertex_array(GWN_PRIM_TRIS, vert, nor, color, 0, 6 * totpoint, col);
break;
default:
- draw_vertex_array(PRIM_POINTS, vert, nor, color, 0, totpoint, col);
+ draw_vertex_array(GWN_PRIM_POINTS, vert, nor, color, 0, totpoint, col);
break;
}
}
@@ -6160,7 +6160,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
else {
if ((draw_as == PART_DRAW_CIRC) || (part->draw & PART_DRAW_SIZE)) {
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
imm_cpack(0xFFFFFF);
}
@@ -6329,12 +6329,12 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
path = cache[a];
if (path->segments > 0) {
if (((dflag & DRAW_CONSTCOLOR) == 0) && (part->draw_col == PART_DRAW_COL_MAT)) {
- draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL);
+ draw_vertex_array(GWN_PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL);
}
else {
float color[4];
rgba_uchar_to_float(color, tcol);
- draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color);
+ draw_vertex_array(GWN_PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color);
}
}
}
@@ -6349,7 +6349,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* XXX use proper theme color here */
float color[4] = {0.58f, 0.67f, 1.0f, 1.0f};
- draw_vertex_array(PRIM_LINE_STRIP, hkey->world_co, NULL, NULL, sizeof(HairKey), pa->totkey, color);
+ draw_vertex_array(GWN_PRIM_LINE_STRIP, hkey->world_co, NULL, NULL, sizeof(HairKey), pa->totkey, color);
}
}
@@ -6357,7 +6357,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
MVert *mvert = hair_dm->getVertArray(hair_dm);
int i;
- unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos_id = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3f(0.9f, 0.4f, 0.4f);
@@ -6367,7 +6367,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
if (count > 0) {
- immBegin(PRIM_LINES, count * 2);
+ immBegin(GWN_PRIM_LINES, count * 2);
for (a = 0, pa = psys->particles; a < totpart; a++, pa++) {
for (i = 1; i < pa->totkey; ++i) {
float v1[3], v2[3];
@@ -6397,14 +6397,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
int *res = clmd->hair_grid_res;
int i;
- unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos_id = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (select)
immUniformThemeColor(TH_ACTIVE);
else
immUniformThemeColor(TH_WIRE);
- immBegin(PRIM_LINES, 24);
+ immBegin(GWN_PRIM_LINES, 24);
immVertex3f(pos_id, gmin[0], gmin[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmin[1], gmin[2]);
immVertex3f(pos_id, gmax[0], gmin[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmax[1], gmin[2]);
immVertex3f(pos_id, gmax[0], gmax[1], gmin[2]); immVertex3f(pos_id, gmin[0], gmax[1], gmin[2]);
@@ -6433,7 +6433,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if (count >= 2) {
glEnable(GL_BLEND);
- immBegin(PRIM_LINES, count);
+ immBegin(GWN_PRIM_LINES, count);
for (i = 1; i < res[0] - 1; ++i) {
float f = interpf(gmax[0], gmin[0], (float)i / (float)(res[0] - 1));
immVertex3f(pos_id, f, gmin[1], gmin[2]); immVertex3f(pos_id, f, gmax[1], gmin[2]);
@@ -6470,11 +6470,11 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
path = cache[a];
if (((dflag & DRAW_CONSTCOLOR) == 0) && (part->draw_col == PART_DRAW_COL_MAT)) {
- draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL);
+ draw_vertex_array(GWN_PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL);
}
else {
float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
- draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color);
+ draw_vertex_array(GWN_PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color);
}
}
@@ -6543,7 +6543,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if (pdd && pdd->vedata) {
float color[4] = {0.75f, 0.75f, 0.75f, 1.0f};
- draw_vertex_array(PRIM_LINES, pdd->vedata, NULL, NULL, 0, 2 * totve, color);
+ draw_vertex_array(GWN_PRIM_LINES, pdd->vedata, NULL, NULL, 0, 2 * totve, color);
}
glPolygonMode(GL_FRONT, polygonmode[0]);
@@ -6625,18 +6625,18 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
for (i = 0, point = edit->points; i < totpoint; i++, point++) {
ParticleCacheKey *path = cache[i];
- VertexFormat format = {0};
+ Gwn_VertFormat format = {0};
unsigned int pos_id, col_id, col_comp;
col_comp = ((point->flag & PEP_HIDE) || timed) ? 4 : 3;
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, col_comp, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ col_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, col_comp, GWN_FETCH_FLOAT);
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, path->segments + 1);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, path->segments + 1);
- VertexBuffer_fill_attrib_stride(vbo, pos_id, sizeof(ParticleCacheKey), path->co);
+ GWN_vertbuf_attr_fill_stride(vbo, pos_id, sizeof(ParticleCacheKey), path->co);
float *pcol = pathcol;
@@ -6646,7 +6646,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
pcol[3] = 0.25f;
}
- VertexBuffer_fill_attrib(vbo, col_id, pathcol);
+ GWN_vertbuf_attr_fill(vbo, col_id, pathcol);
}
else if (timed) {
ParticleCacheKey *pkey = path;
@@ -6655,18 +6655,18 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
pcol[3] = 1.0f - fabsf((float)(CFRA) -pkey->time) / (float)pset->fade_frames;
}
- VertexBuffer_fill_attrib(vbo, col_id, pathcol);
+ GWN_vertbuf_attr_fill(vbo, col_id, pathcol);
}
else {
/* FIXME: shader wants 4 color components but the cache only contains ParticleCacheKey
* So alpha is random */
- VertexBuffer_fill_attrib_stride(vbo, col_id, sizeof(ParticleCacheKey), path->col);
+ GWN_vertbuf_attr_fill_stride(vbo, col_id, sizeof(ParticleCacheKey), path->col);
}
- Batch *batch = Batch_create(PRIM_LINE_STRIP, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_LINE_STRIP, vbo, NULL);
Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR);
- Batch_draw(batch);
- Batch_discard_all(batch);
+ GWN_batch_draw(batch);
+ GWN_batch_discard_all(batch);
}
if (pathcol) { MEM_freeN(pathcol); pathcol = NULL; }
@@ -6680,9 +6680,9 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
float *cd = NULL, *cdata = NULL;
int totkeys_visible = 0;
- VertexFormat format = {0};
- unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, (timed ? 4 : 3), KEEP_FLOAT);
+ Gwn_VertFormat format = {0};
+ unsigned int pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int col_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, (timed ? 4 : 3), GWN_FETCH_FLOAT);
for (i = 0, point = edit->points; i < totpoint; i++, point++)
if (!(point->flag & PEP_HIDE))
@@ -6724,20 +6724,20 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
if (point->flag & PEP_HIDE || point->totkey == 0)
continue;
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, point->totkey);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, point->totkey);
if (point->keys->flag & PEK_USE_WCO)
- VertexBuffer_fill_attrib_stride(vbo, pos_id, sizeof(PTCacheEditKey), point->keys->world_co);
+ GWN_vertbuf_attr_fill_stride(vbo, pos_id, sizeof(PTCacheEditKey), point->keys->world_co);
else
- VertexBuffer_fill_attrib(vbo, pos_id, pd);
+ GWN_vertbuf_attr_fill(vbo, pos_id, pd);
- VertexBuffer_fill_attrib(vbo, col_id, cd);
+ GWN_vertbuf_attr_fill(vbo, col_id, cd);
- Batch *batch = Batch_create(PRIM_POINTS, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR);
- Batch_draw(batch);
- Batch_discard_all(batch);
+ GWN_batch_draw(batch);
+ GWN_batch_discard_all(batch);
pd += pd ? 3 * point->totkey : 0;
cd += (timed ? 4 : 3) * point->totkey;
@@ -6746,11 +6746,11 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
if (cdata) { MEM_freeN(cdata); cd = cdata = NULL; }
}
else if (pset->selectmode == SCE_SELECT_END) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int col_id = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int col_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBeginAtMost(PRIM_POINTS, totpoint);
+ immBeginAtMost(GWN_PRIM_POINTS, totpoint);
for (i = 0, point = edit->points; i < totpoint; i++, point++) {
if ((point->flag & PEP_HIDE) == 0 && point->totkey) {
PTCacheEditKey *key = point->keys + point->totkey - 1;
@@ -6782,12 +6782,12 @@ static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, flo
float tw = itw * drw_size;
float th = ith * drw_size;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBegin(PRIM_LINES, 30);
+ immBegin(GWN_PRIM_LINES, 30);
immAttrib4ub(col, 0x7F, 0x00, 0x00, 155);
root[1] = root[2] = 0.0f;
@@ -6934,14 +6934,14 @@ static void drawhandlesN(Nurb *nu, const char sel, const bool hide_handles)
UI_GetThemeColor3ubv(basecol + a, handle_cols[a]);
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
glLineWidth(1.0f);
- immBeginAtMost(PRIM_LINES, nu->pntsu * 4);
+ immBeginAtMost(GWN_PRIM_LINES, nu->pntsu * 4);
BezTriple *bezt = nu->bezt;
int a = nu->pntsu;
@@ -6990,12 +6990,12 @@ static void drawhandlesN_active(Nurb *nu)
if (nu->hide) return;
if (nu->type == CU_BEZIER && nu->pntsu > 0) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_ACTIVE_SPLINE);
glLineWidth(2.0f);
- immBeginAtMost(PRIM_LINES, nu->pntsu * 4);
+ immBeginAtMost(GWN_PRIM_LINES, nu->pntsu * 4);
BezTriple *bezt = nu->bezt;
int a = nu->pntsu;
while (a--) {
@@ -7033,9 +7033,9 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve
}
if (count == 0) return;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
unsigned char vert_color[3];
@@ -7047,7 +7047,7 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- immBeginAtMost(PRIM_POINTS, count);
+ immBeginAtMost(GWN_PRIM_POINTS, count);
for (nu = nurb; nu; nu = nu->next) {
@@ -7107,8 +7107,8 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve
static void editnurb_draw_active_poly(Nurb *nu)
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_ACTIVE_SPLINE);
@@ -7117,8 +7117,8 @@ static void editnurb_draw_active_poly(Nurb *nu)
BPoint *bp = nu->bp;
for (int b = 0; b < nu->pntsv; b++) {
if (nu->pntsu >= 2) {
- if (nu->flagu & 1) immBegin(PRIM_LINE_LOOP, nu->pntsu);
- else immBegin(PRIM_LINE_STRIP, nu->pntsu);
+ if (nu->flagu & 1) immBegin(GWN_PRIM_LINE_LOOP, nu->pntsu);
+ else immBegin(GWN_PRIM_LINE_STRIP, nu->pntsu);
for (int a = 0; a < nu->pntsu; a++, bp++) {
immVertex3fv(pos, bp->vec);
@@ -7134,8 +7134,8 @@ static void editnurb_draw_active_poly(Nurb *nu)
static void editnurb_draw_active_nurbs(Nurb *nu)
{
if (nu->pntsv > 0) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_ACTIVE_SPLINE);
@@ -7145,7 +7145,7 @@ static void editnurb_draw_active_nurbs(Nurb *nu)
if (nu->pntsv > 1) count += (nu->pntsv - 1) * nu->pntsu * 2;
if (count < 2) return;
- immBeginAtMost(PRIM_LINES, count);
+ immBeginAtMost(GWN_PRIM_LINES, count);
BPoint *bp = nu->bp;
for (int b = 0; b < nu->pntsv; b++) {
BPoint *bp1 = bp;
@@ -7186,7 +7186,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel)
BPoint *bp, *bp1;
int a, b;
Curve *cu = ob->data;
- VertexFormat *format;
+ Gwn_VertFormat *format;
unsigned int pos, col;
unsigned char color[3];
@@ -7203,7 +7203,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel)
}
format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
glLineWidth(1.0f);
@@ -7212,8 +7212,8 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel)
bp = nu->bp;
for (b = 0; b < nu->pntsv; b++) {
if (nu->pntsu >= 2) {
- if (nu->flagu & 1) immBegin(PRIM_LINE_LOOP, nu->pntsu);
- else immBegin(PRIM_LINE_STRIP, nu->pntsu);
+ if (nu->flagu & 1) immBegin(GWN_PRIM_LINE_LOOP, nu->pntsu);
+ else immBegin(GWN_PRIM_LINE_STRIP, nu->pntsu);
for (a = 0; a < nu->pntsu; a++, bp++) {
immVertex3fv(pos, bp->vec);
@@ -7233,8 +7233,8 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel)
}
format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
// just quick guesstimate of how many verts to draw
@@ -7244,7 +7244,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel)
glLineWidth(1.0f);
- immBeginAtMost(PRIM_LINES, count);
+ immBeginAtMost(GWN_PRIM_LINES, count);
bp = nu->bp;
for (b = 0; b < nu->pntsv; b++) {
@@ -7367,8 +7367,8 @@ static void draw_editnurb(
if ((cu->flag & CU_3D) && (ts->normalsize > 0.0015f) && (cu->drawflag & CU_HIDE_NORMALS) == 0) {
BevList *bl;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_WIRE_EDIT);
@@ -7392,7 +7392,7 @@ static void draw_editnurb(
}
if (count > 2) {
- immBegin(PRIM_LINES, count);
+ immBegin(GWN_PRIM_LINES, count);
for (bl = ob->curve_cache->bev.first, nu = nurb; nu && bl; bl = bl->next, nu = nu->next) {
BevPoint *bevp = bl->bevpoints;
int nr = bl->nr;
@@ -7443,12 +7443,12 @@ static void draw_editnurb(
static void draw_editfont_textcurs(RegionView3D *rv3d, float textcurs[4][2])
{
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
ED_view3d_polygon_offset(rv3d, -1.0);
set_inverted_drawing(1);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
imm_cpack(0);
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immVertex2fv(pos, textcurs[0]);
immVertex2fv(pos, textcurs[1]);
immVertex2fv(pos, textcurs[2]);
@@ -7480,7 +7480,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
}
if (cu->linewidth != 0.0f) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_WIRE_EDIT);
copy_v3_v3(vec1, ob->orig);
@@ -7490,7 +7490,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
vec1[1] += cu->linedist * cu->fsize;
vec2[1] -= cu->lines * cu->linedist * cu->fsize;
setlinestyle(3);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, vec1);
immVertex2fv(pos, vec2);
immEnd();
@@ -7501,13 +7501,13 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
setlinestyle(3);
for (int i = 0; i < cu->totbox; i++) {
if (cu->tb[i].w != 0.0f) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(i == (cu->actbox - 1) ? TH_ACTIVE : TH_WIRE);
vec1[0] = cu->xof + cu->tb[i].x;
vec1[1] = cu->yof + cu->tb[i].y + cu->fsize;
vec1[2] = 0.001;
- immBegin(PRIM_LINE_STRIP, 5);
+ immBegin(GWN_PRIM_LINE_STRIP, 5);
immVertex3fv(pos, vec1);
vec1[0] += cu->tb[i].w;
immVertex3fv(pos, vec1);
@@ -7527,7 +7527,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
if (ef->selboxes && ef->selboxes_len) {
float selboxw;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
imm_cpack(0xffffff);
set_inverted_drawing(1);
@@ -7548,7 +7548,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
/* fill in xy below */
tvec[2] = 0.001;
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
if (sb->rot == 0.0f) {
copy_v2_fl2(tvec, sb->x, sb->y);
@@ -7606,15 +7606,15 @@ static void draw_empty_sphere(float size, unsigned pos)
p[i][1] = size * sinf(angle);
}
- immBegin(PRIM_LINE_LOOP, NSEGMENTS);
+ immBegin(GWN_PRIM_LINE_LOOP, NSEGMENTS);
for (int i = 0; i < NSEGMENTS; ++i)
immVertex3f(pos, p[i][0], p[i][1], 0.0f);
immEnd();
- immBegin(PRIM_LINE_LOOP, NSEGMENTS);
+ immBegin(GWN_PRIM_LINE_LOOP, NSEGMENTS);
for (int i = 0; i < NSEGMENTS; ++i)
immVertex3f(pos, p[i][0], 0.0f, p[i][1]);
immEnd();
- immBegin(PRIM_LINE_LOOP, NSEGMENTS);
+ immBegin(GWN_PRIM_LINE_LOOP, NSEGMENTS);
for (int i = 0; i < NSEGMENTS; ++i)
immVertex3f(pos, 0.0f, p[i][0], p[i][1]);
immEnd();
@@ -7634,7 +7634,7 @@ static void draw_empty_cone(float size, unsigned pos)
}
/* cone sides */
- immBegin(PRIM_LINES, NSEGMENTS * 2);
+ immBegin(GWN_PRIM_LINES, NSEGMENTS * 2);
for (int i = 0; i < NSEGMENTS; ++i) {
immVertex3f(pos, 0.0f, 2.0f * size, 0.0f);
immVertex3f(pos, p[i][0], 0.0f, p[i][1]);
@@ -7642,7 +7642,7 @@ static void draw_empty_cone(float size, unsigned pos)
immEnd();
/* end ring */
- immBegin(PRIM_LINE_LOOP, NSEGMENTS);
+ immBegin(GWN_PRIM_LINE_LOOP, NSEGMENTS);
for (int i = 0; i < NSEGMENTS; ++i)
immVertex3f(pos, p[i][0], 0.0f, p[i][1]);
immEnd();
@@ -7665,7 +7665,7 @@ static void drawspiral(unsigned int pos, const float cent[3], float rad, float t
mul_v3_v3fl(vx, tmat[0], rad);
mul_v3_v3fl(vy, tmat[1], rad);
- immBegin(PRIM_LINE_STRIP, CIRCLE_RESOL + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, CIRCLE_RESOL + 1);
if (inverse == 0) {
copy_v3_v3(vec, cent);
@@ -7719,7 +7719,7 @@ static void drawspiral(unsigned int pos, const float cent[3], float rad, float t
* all required matrices have been set (used for drawing empties) */
static void drawcircle_size(float size, unsigned pos)
{
- immBegin(PRIM_LINE_LOOP, CIRCLE_RESOL);
+ immBegin(GWN_PRIM_LINE_LOOP, CIRCLE_RESOL);
/* coordinates are: cos(degrees * 11.25) = x, sin(degrees * 11.25) = y, 0.0f = z */
for (short degrees = 0; degrees < CIRCLE_RESOL; degrees++) {
@@ -7743,7 +7743,7 @@ static void imm_drawtube(const float vec[3], float radius, float height, float t
imm_drawcircball(cur, radius, tmat, pos);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex3f(pos, vec[0] + radius, vec[1], vec[2]);
immVertex3f(pos, cur[0] + radius, cur[1], cur[2]);
immVertex3f(pos, vec[0] - radius, vec[1], vec[2]);
@@ -7765,7 +7765,7 @@ static void imm_drawcone(const float vec[3], float radius, float height, float t
imm_drawcircball(cur, radius, tmat, pos);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex3f(pos, vec[0], vec[1], vec[2]);
immVertex3f(pos, cur[0] + radius, cur[1], cur[2]);
immVertex3f(pos, vec[0], vec[1], vec[2]);
@@ -7825,7 +7825,7 @@ static bool drawmball(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *r
glLineWidth(1.0f);
- const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ const unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
while (ml) {
@@ -7881,7 +7881,7 @@ static void draw_forcefield(Object *ob, RegionView3D *rv3d,
normalize_v3(imat[1]);
#endif
- const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ const unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3fv(draw_color);
@@ -8047,7 +8047,7 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos)
/* Adpated from "Optimizing Triangle Strips for Fast Rendering" by F. Evans, S. Skiena and A. Varshney
* (http://www.cs.umd.edu/gvil/papers/av_ts.pdf). */
static const GLubyte tris_strip_indices[14] = {0,1,3,2,6,1,5,0,4,3,7,6,4,5};
- immBegin(PRIM_TRIANGLE_STRIP, 14);
+ immBegin(GWN_PRIM_TRI_STRIP, 14);
for (int i = 0; i < 14; ++i) {
immVertex3fv(pos, vec[tris_strip_indices[i]]);
}
@@ -8055,7 +8055,7 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos)
}
else {
static const GLubyte line_indices[24] = {0,1,1,2,2,3,3,0,0,4,4,5,5,6,6,7,7,4,1,5,2,6,3,7};
- immBegin(PRIM_LINES, 24);
+ immBegin(GWN_PRIM_LINES, 24);
for (int i = 0; i < 24; ++i) {
immVertex3fv(pos, vec[line_indices[i]]);
}
@@ -8067,9 +8067,9 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos)
static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsigned char ob_wire_col[4])
{
float size[3], cent[3];
- Batch *sphere = Batch_get_sphere_wire(0);
+ Gwn_Batch *sphere = Batch_get_sphere_wire(0);
Batch_set_builtin_program(sphere, GPU_SHADER_3D_UNIFORM_COLOR);
- if (ob_wire_col) Batch_Uniform4f(sphere, "color", ob_wire_col[0]/255.0f, ob_wire_col[1]/255.0f, ob_wire_col[2]/255.0f, 1.0f);
+ if (ob_wire_col) GWN_batch_uniform_4f(sphere, "color", ob_wire_col[0] / 255.0f, ob_wire_col[1] / 255.0f, ob_wire_col[2] / 255.0f, 1.0f);
BKE_boundbox_calc_size_aabb(bb, size);
@@ -8082,7 +8082,7 @@ static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsig
gpuPushMatrix();
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8091,7 +8091,7 @@ static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsig
gpuTranslate3fv(cent);
gpuRotateAxis(90, 'X');
gpuScaleUniform(scale);
- Batch_draw(sphere);
+ GWN_batch_draw(sphere);
}
else if (type == OB_BOUND_CYLINDER) {
float radius = size[0] > size[1] ? size[0] : size[1];
@@ -8114,10 +8114,10 @@ static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsig
gpuRotateAxis(90, 'X');
gpuScaleUniform(radius);
- Batch_draw(sphere);
+ GWN_batch_draw(sphere);
gpuTranslate3f(0.0f, length / radius, 0.0f);
- Batch_draw(sphere);
+ GWN_batch_draw(sphere);
}
gpuPopMatrix();
@@ -8160,7 +8160,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col
if (type == OB_BOUND_BOX) {
float vec[8][3], size[3];
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8183,7 +8183,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col
}
else {
if (type == OB_BOUND_BOX) {
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8227,7 +8227,7 @@ static void drawtexspace(Object *ob, const unsigned char ob_wire_col[3])
setlinestyle(2);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
if (ob_wire_col) {
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -8346,7 +8346,7 @@ static void draw_hooks(Object *ob, unsigned int pos)
if (hmd->object) {
setlinestyle(3);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, hmd->object->obmat[3]);
immVertex3fv(pos, vec);
immEnd();
@@ -8354,7 +8354,7 @@ static void draw_hooks(Object *ob, unsigned int pos)
}
glPointSize(3.0f);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, vec);
immEnd();
}
@@ -8367,7 +8367,7 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data,
const char *axis_str[3] = {"px", "py", "pz"};
float mat[4][4];
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8376,7 +8376,7 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data,
glLineWidth(4.0f);
setlinestyle(2);
- immBegin(PRIM_LINES, 6);
+ immBegin(GWN_PRIM_LINES, 6);
for (int axis = 0; axis < 3; axis++) {
float dir[3] = {0, 0, 0};
float v[3];
@@ -8514,7 +8514,7 @@ void draw_rigidbody_shape(Object *ob, const unsigned char ob_wire_col[4])
case RB_SHAPE_BOX:
BKE_boundbox_calc_size_aabb(bb, size);
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8963,7 +8963,7 @@ afterdraw:
if (!render_override) {
BoundBox bb;
float p0[3], p1[3];
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -9101,7 +9101,7 @@ afterdraw:
{
float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f};
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
invert_m4_m4(imat, rv3d->viewmatob);
@@ -9156,12 +9156,12 @@ afterdraw:
if ((base->sx != IS_CLIPPED) &&
(U.obcenter_dia != 0.0))
{
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR);
/* TODO: short term, use DEPTH_ONLY shader or set appropriate color */
/* TODO: long term, solve picking & selection problem better */
glPointSize(U.obcenter_dia);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, ob->obmat[3]);
immEnd();
immUnbindProgram();
@@ -9185,7 +9185,7 @@ afterdraw:
ListBase *list;
RigidBodyCon *rbc = ob->rigidbody_constraint;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(ob_wire_col);
@@ -9198,7 +9198,7 @@ afterdraw:
Base *base_parent = BKE_scene_layer_base_find(sl, ob->parent);
if ((base_parent->flag & BASE_VISIBLED) != 0) {
setlinestyle(3);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, ob->obmat[3]);
immVertex3fv(pos, ob->orig);
immEnd();
@@ -9241,7 +9241,7 @@ afterdraw:
if (camob) {
setlinestyle(3);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, camob->obmat[3]);
immVertex3fv(pos, ob->obmat[3]);
immEnd();
@@ -9265,7 +9265,7 @@ afterdraw:
unit_m4(ct->matrix);
setlinestyle(3);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, ct->matrix[3]);
immVertex3fv(pos, ob->obmat[3]);
immEnd();
@@ -9285,7 +9285,7 @@ afterdraw:
immUniformThemeColor(TH_WIRE);
setlinestyle(3);
- immBegin(PRIM_LINES, ((int)((bool)rbc->ob1) + (int)((bool)rbc->ob2)) * 2);
+ immBegin(GWN_PRIM_LINES, ((int)((bool)rbc->ob1) + (int)((bool)rbc->ob2)) * 2);
if (rbc->ob1) {
immVertex3fv(pos, ob->obmat[3]);
immVertex3fv(pos, rbc->ob1->obmat[3]);
@@ -9374,15 +9374,15 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
if (imm_len == 0) return;
- VertexFormat *format = immVertexFormat();
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT);
+ Gwn_VertFormat *format = immVertexFormat();
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- immBeginAtMost(PRIM_POINTS, imm_len);
+ immBeginAtMost(GWN_PRIM_POINTS, imm_len);
dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
immEnd();
@@ -9407,15 +9407,15 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
drawBMOffset_userData data;
data.bm = em->bm;
data.offset = offset;
- VertexFormat *format = immVertexFormat();
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT);
+ Gwn_VertFormat *format = immVertexFormat();
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- immBeginAtMost(PRIM_POINTS, em->bm->totvert);
+ immBeginAtMost(GWN_PRIM_POINTS, em->bm->totvert);
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
immEnd();
@@ -9442,20 +9442,20 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset)
data.bm = em->bm;
data.offset = offset;
- VertexFormat *format = immVertexFormat();
+ Gwn_VertFormat *format = immVertexFormat();
const int imm_len = dm->getNumEdges(dm) * 2;
if (imm_len == 0) return;
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT);
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- immBeginAtMost(PRIM_LINES, imm_len);
+ immBeginAtMost(GWN_PRIM_LINES, imm_len);
dm->foreachMappedEdge(dm, bbs_mesh_wire__mapFunc, &data);
immEnd();
@@ -9475,13 +9475,13 @@ static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *dm, const bool use_select
if (imm_len == 0) return;
- VertexFormat *format = immVertexFormat();
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT);
+ Gwn_VertFormat *format = immVertexFormat();
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
- immBeginAtMost(PRIM_TRIANGLES, imm_len);
+ immBeginAtMost(GWN_PRIM_TRIS, imm_len);
if (use_select == false) {
int selcol;
@@ -9532,15 +9532,15 @@ static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm)
{
drawBMOffset_userData data; /* don't use offset */
data.bm = em->bm;
- VertexFormat *format = immVertexFormat();
- data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT);
+ Gwn_VertFormat *format = immVertexFormat();
+ data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
- immBeginAtMost(PRIM_POINTS, em->bm->totface);
+ immBeginAtMost(GWN_PRIM_POINTS, em->bm->totface);
dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP);
immEnd();
@@ -9614,7 +9614,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob)
{
Mesh *me = ob->data;
UNUSED_VARS(scene, bbs_mesh_solid_hide__setDrawOpts, bbs_mesh_solid__setDrawOpts);
- Batch *batch;
+ Gwn_Batch *batch;
if ((me->editflag & ME_EDIT_PAINT_FACE_SEL)) {
batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true);
}
@@ -9622,7 +9622,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob)
batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, false);
}
Batch_set_builtin_program(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
- Batch_draw(batch);
+ GWN_batch_draw(batch);
}
void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
@@ -9816,8 +9816,8 @@ void ED_draw_object_facemap(Scene *scene, Object *ob, const float col[4], const
Mesh *me = ob->data;
const int *facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP);
if (facemap_data) {
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(col);
@@ -9857,7 +9857,7 @@ void ED_draw_object_facemap(Scene *scene, Object *ob, const float col[4], const
/* use gawain immediate mode fore now */
const int looptris_len = poly_to_tri_count(mpoly_len, mloop_len);
- immBeginAtMost(PRIM_TRIANGLES, looptris_len * 3);
+ immBeginAtMost(GWN_PRIM_TRIS, looptris_len * 3);
MPoly *mp;
int i;
diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c
index 24ac1c5b4db..14708ca67bc 100644
--- a/source/blender/editors/space_view3d/drawsimdebug.c
+++ b/source/blender/editors/space_view3d/drawsimdebug.c
@@ -48,9 +48,9 @@
static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
{
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
@@ -73,7 +73,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
/**** dots ****/
glPointSize(3.0f);
- immBegin(PRIM_POINTS, num_dots);
+ immBegin(GWN_PRIM_POINTS, num_dots);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
if (elem->type != SIM_DEBUG_ELEM_DOT)
@@ -94,7 +94,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
{-0.000000, -1.000000}, {-0.382683, -0.923880}, {-0.707107, -0.707107}, {-0.923879, -0.382684},
{-1.000000, 0.000000}, {-0.923879, 0.382684}, {-0.707107, 0.707107}, {-0.382683, 0.923880} };
- immBegin(PRIM_LINES, num_circles * CIRCLERES * 2);
+ immBegin(GWN_PRIM_LINES, num_circles * CIRCLERES * 2);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
@@ -130,7 +130,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
/**** lines ****/
- immBegin(PRIM_LINES, num_lines * 2);
+ immBegin(GWN_PRIM_LINES, num_lines * 2);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
if (elem->type != SIM_DEBUG_ELEM_LINE)
@@ -145,7 +145,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
/**** vectors ****/
glPointSize(2.0f);
- immBegin(PRIM_POINTS, num_vectors);
+ immBegin(GWN_PRIM_POINTS, num_vectors);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
if (elem->type != SIM_DEBUG_ELEM_VECTOR)
@@ -156,7 +156,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
}
immEnd();
- immBegin(PRIM_LINES, num_vectors * 2);
+ immBegin(GWN_PRIM_LINES, num_vectors * 2);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
float t[3];
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index b1938054944..7c057723b72 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -364,7 +364,7 @@ static void drawviewborder_grid3(uint shdr_pos, float x1, float x2, float y1, fl
x4 = x1 + (1.0f - fac) * (x2 - x1);
y4 = y1 + (1.0f - fac) * (y2 - y1);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex2f(shdr_pos, x1, y3);
immVertex2f(shdr_pos, x2, y3);
@@ -389,7 +389,7 @@ static void drawviewborder_triangle(
float w = x2 - x1;
float h = y2 - y1;
- immBegin(PRIM_LINES, 6);
+ immBegin(GWN_PRIM_LINES, 6);
if (w > h) {
if (golden) {
@@ -466,7 +466,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
x2i = (int)(x2 + (1.0f - 0.0001f));
y2i = (int)(y2 + (1.0f - 0.0001f));
- uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* First, solid lines. */
{
@@ -558,7 +558,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
x3 = x1 + 0.5f * (x2 - x1);
y3 = y1 + 0.5f * (y2 - y1);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(shdr_pos, x1, y3);
immVertex2f(shdr_pos, x2, y3);
@@ -570,7 +570,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
}
if (ca->dtx & CAM_DTX_CENTER_DIAG) {
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
immVertex2f(shdr_pos, x1, y1);
immVertex2f(shdr_pos, x2, y2);
@@ -673,7 +673,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
static void drawrenderborder(ARegion *ar, View3D *v3d)
{
/* use the same program for everything */
- uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
glLineWidth(1.0f);
@@ -755,9 +755,9 @@ static void view3d_draw_background_gradient(void)
{
/* TODO: finish 2D API & draw background with that */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
unsigned char col_hi[3], col_lo[3];
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
@@ -765,7 +765,7 @@ static void view3d_draw_background_gradient(void)
UI_GetThemeColor3ubv(TH_LOW_GRAD, col_lo);
UI_GetThemeColor3ubv(TH_HIGH_GRAD, col_hi);
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib3ubv(color, col_lo);
immVertex2f(pos, -1.0f, -1.0f);
immVertex2f(pos, 1.0f, -1.0f);
@@ -978,9 +978,9 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
glDepthMask(GL_FALSE); /* disable write in zbuffer */
#endif
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
@@ -1017,7 +1017,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
if (gridline_ct == 0)
goto drawgrid_cleanup; /* nothing to draw */
- immBegin(PRIM_LINES, gridline_ct * 2);
+ immBegin(GWN_PRIM_LINES, gridline_ct * 2);
}
float blend_fac = 1.0f - ((GRID_MIN_PX_F * 2.0f) / (float)dx_scalar);
@@ -1077,7 +1077,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
if (gridline_ct == 0)
goto drawgrid_cleanup; /* nothing to draw */
- immBegin(PRIM_LINES, gridline_ct * 2);
+ immBegin(GWN_PRIM_LINES, gridline_ct * 2);
if (grids_to_draw == 2) {
UI_GetThemeColorBlend3ubv(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0), col2);
@@ -1154,13 +1154,13 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
unsigned char col_bg[3], col_grid_emphasise[3], col_grid_light[3];
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBegin(PRIM_LINES, vertex_ct);
+ immBegin(GWN_PRIM_LINES, vertex_ct);
/* draw normal grid lines */
UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
@@ -1242,12 +1242,12 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
if (show_axis_x || show_axis_y || show_axis_z) {
/* draw axis lines -- sometimes grid floor is off, other times we still need to draw the Z axis */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBegin(PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
+ immBegin(GWN_PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
if (show_axis_x) {
UI_make_axis_color(col_grid, col_axis, 'X');
@@ -1347,15 +1347,15 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
glLineWidth(1.0f);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
const int segments = 16;
- immBegin(PRIM_LINE_LOOP, segments);
+ immBegin(GWN_PRIM_LINE_LOOP, segments);
for (int i = 0; i < segments; ++i) {
float angle = 2 * M_PI * ((float)i / (float)segments);
@@ -1373,8 +1373,8 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
immUnbindProgram();
- VertexFormat_clear(format);
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ GWN_vertformat_clear(format);
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1382,7 +1382,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color);
immUniformColor3ubv(crosshair_color);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex2f(pos, co[0] - f20, co[1]);
immVertex2f(pos, co[0] - f5, co[1]);
immVertex2f(pos, co[0] + f5, co[1]);
@@ -1432,12 +1432,12 @@ static void draw_view_axis(RegionView3D *rv3d, rcti *rect)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(PRIM_LINES, 6);
+ immBegin(GWN_PRIM_LINES, 6);
for (int axis_i = 0; axis_i < 3; axis_i++) {
int i = axis_order[axis_i];
@@ -1476,9 +1476,9 @@ static void draw_rotation_guide(RegionView3D *rv3d)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(GL_FALSE); /* don't overwrite zbuf */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
@@ -1489,7 +1489,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale);
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
color[3] = 0; /* more transparent toward the ends */
immAttrib4ubv(col, color);
add_v3_v3v3(end, o, scaled_axis);
@@ -1528,7 +1528,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
axis_angle_to_quat(q, vis_axis, vis_angle);
}
- immBegin(PRIM_LINE_LOOP, ROT_AXIS_DETAIL);
+ immBegin(GWN_PRIM_LINE_LOOP, ROT_AXIS_DETAIL);
color[3] = 63; /* somewhat faint */
immAttrib4ubv(col, color);
float angle = 0.0f;
@@ -1557,7 +1557,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
/* -- draw rotation center -- */
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
glPointSize(5.0f);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immAttrib4ubv(col, color);
immVertex3fv(pos, o);
immEnd();
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 1a8ac374e75..85f44b528bc 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -259,14 +259,14 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar),
x2 = xoff + 0.55f * fly->width;
y2 = yoff + 0.55f * fly->height;
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_VIEW_OVERLAY);
- immBegin(PRIM_LINES, 16);
+ immBegin(GWN_PRIM_LINES, 16);
/* bottom left */
immVertex2f(pos, x1, y1);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 99449a40a8c..3428af3f560 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -38,7 +38,7 @@
struct ARegion;
struct ARegionType;
struct BoundBox;
-struct Batch;
+struct Gwn_Batch;
struct DerivedMesh;
struct Object;
struct SmokeDomainSettings;
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index aecde1b1657..550a0ee4186 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -458,7 +458,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
glEnable(GL_BLEND);
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
if (ruler_item->flag & RULERITEM_USE_ANGLE) {
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -472,7 +472,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2);
immUniform1f("dash_width", 6.0f);
- immBegin(PRIM_LINE_STRIP, 3);
+ immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2fv(shdr_pos, co_ss[0]);
immVertex2fv(shdr_pos, co_ss[1]);
@@ -514,7 +514,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immUniformColor3ubv(color_wire);
- immBegin(PRIM_LINE_STRIP, arc_steps + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, arc_steps + 1);
for (j = 0; j <= arc_steps; j++) {
madd_v3_v3v3fl(co_tmp, ruler_item->co[1], dir_tmp, px_scale);
@@ -547,7 +547,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immUniformColor3ubv(color_wire);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec_a, cap_size);
immVertex2fv(shdr_pos, cap);
@@ -611,7 +611,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2);
immUniform1f("dash_width", 6.0f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(shdr_pos, co_ss[0]);
immVertex2fv(shdr_pos, co_ss[2]);
@@ -635,7 +635,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immUniformColor3ubv(color_wire);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec, cap_size);
immVertex2fv(shdr_pos, cap);
@@ -700,7 +700,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
float co_ss[3];
ED_view3d_project_float_global(ar, ruler_item->co[ruler_item->co_index], co_ss, V3D_PROJ_TEST_NOP);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(color_act);
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index e0c8ad2ed6b..71a4980d4a6 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -341,14 +341,14 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a
yoff = walk->ar->winy / 2;
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_VIEW_OVERLAY);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
/* North */
immVertex2i(pos, xoff, yoff + inner_length);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 4727986fdb4..81d8f64045f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1605,13 +1605,13 @@ typedef enum {
} ArrowDirection;
#define POS_INDEX 0
-/* NOTE: this --^ is a bit hackish, but simplifies VertexFormat usage among functions
+/* NOTE: this --^ is a bit hackish, but simplifies Gwn_VertFormat usage among functions
* private to this file - merwin
*/
static void drawArrow(ArrowDirection d, short offset, short length, short size)
{
- immBegin(PRIM_LINES, 6);
+ immBegin(GWN_PRIM_LINES, 6);
switch (d) {
case LEFT:
@@ -1648,7 +1648,7 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size)
static void drawArrowHead(ArrowDirection d, short size)
{
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
switch (d) {
case LEFT:
@@ -1681,7 +1681,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments
float angle;
int a;
- immBegin(PRIM_LINE_STRIP, segments + 1);
+ immBegin(GWN_PRIM_LINE_STRIP, segments + 1);
for (angle = angle_start, a = 0; a < segments; angle += delta, a++) {
immVertex2f(POS_INDEX, cosf(angle) * size, sinf(angle) * size);
@@ -1724,7 +1724,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
/* Dashed lines first. */
if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE)) {
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
UNUSED_VARS_NDEBUG(shdr_pos); /* silence warning */
BLI_assert(shdr_pos == POS_INDEX);
@@ -1742,7 +1742,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(POS_INDEX, cent);
immVertex2f(POS_INDEX, (float)t->mval[0], (float)t->mval[1]);
immEnd();
@@ -1751,7 +1751,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
}
/* And now, solid lines. */
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
UNUSED_VARS_NDEBUG(pos); /* silence warning */
BLI_assert(pos == POS_INDEX);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -6879,7 +6879,7 @@ static void drawEdgeSlide(TransInfo *t)
gpuPushMatrix();
gpuMultMatrix(t->obedit->obmat);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -6896,7 +6896,7 @@ static void drawEdgeSlide(TransInfo *t)
glLineWidth(line_size);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
- immBeginAtMost(PRIM_LINES, 4);
+ immBeginAtMost(GWN_PRIM_LINES, 4);
if (curr_sv->v_side[0]) {
immVertex3fv(pos, curr_sv->v_side[0]->co);
immVertex3fv(pos, curr_sv->v_co_orig);
@@ -6909,7 +6909,7 @@ static void drawEdgeSlide(TransInfo *t)
immUniformThemeColorShadeAlpha(TH_SELECT, -30, alpha_shade);
glPointSize(ctrl_size);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
if (sld->flipped) {
if (curr_sv->v_side[1]) immVertex3fv(pos, curr_sv->v_side[1]->co);
}
@@ -6920,7 +6920,7 @@ static void drawEdgeSlide(TransInfo *t)
immUniformThemeColorShadeAlpha(TH_SELECT, 255, alpha_shade);
glPointSize(guide_size);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
interp_line_v3_v3v3v3(co_mark, co_b, curr_sv->v_co_orig, co_a, fac);
immVertex3fv(pos, co_mark);
immEnd();
@@ -6934,7 +6934,7 @@ static void drawEdgeSlide(TransInfo *t)
glLineWidth(line_size);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
- immBegin(PRIM_LINES, sld->totsv * 2);
+ immBegin(GWN_PRIM_LINES, sld->totsv * 2);
sv = sld->sv;
for (i = 0; i < sld->totsv; i++, sv++) {
@@ -7493,12 +7493,12 @@ static void drawVertSlide(TransInfo *t)
glLineWidth(line_size);
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
- immBegin(PRIM_LINES, sld->totsv * 2);
+ immBegin(GWN_PRIM_LINES, sld->totsv * 2);
if (is_clamp) {
sv = sld->sv;
for (i = 0; i < sld->totsv; i++, sv++) {
@@ -7524,7 +7524,7 @@ static void drawVertSlide(TransInfo *t)
glPointSize(ctrl_size);
- immBegin(PRIM_POINTS, 1);
+ immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(shdr_pos, (sld->flipped && sld->use_even) ?
curr_sv->co_link_orig_3d[curr_sv->co_link_curr] :
curr_sv->co_orig_3d);
@@ -7567,7 +7567,7 @@ static void drawVertSlide(TransInfo *t)
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(shdr_pos, curr_sv->co_orig_3d);
immVertex3fv(shdr_pos, co_dest_3d);
immEnd();
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 9360727e9cf..654072766a8 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -733,7 +733,7 @@ void drawConstraint(TransInfo *t)
if (depth_test_enabled)
glDisable(GL_DEPTH_TEST);
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_COLOR);
@@ -746,7 +746,7 @@ void drawConstraint(TransInfo *t)
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_factor", 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(shdr_pos, t->center_global);
immVertex3fv(shdr_pos, vec);
immEnd();
@@ -809,7 +809,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
if (depth_test_enabled)
glDisable(GL_DEPTH_TEST);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_GRID);
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 3d80ac11ec9..ca9e15f5de4 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1054,12 +1054,12 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
}
UI_make_axis_color(col, col2, axis);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(col2);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, v1);
immVertex3fv(pos, v2);
immEnd();
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 18996de068b..1181f584313 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -164,7 +164,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
invert_m4_m4(imat, rv3d->viewmat);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -189,7 +189,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
if (usingSnappingNormal(t) && validSnappingNormal(t)) {
immUniformColor4ubv(activeCol);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex3f(pos, t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
immVertex3f(pos, t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
t->tsnap.snapPoint[1] + t->tsnap.snapNormal[1],
@@ -219,7 +219,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
glEnable(GL_BLEND);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 6ae1de3fead..f028293d219 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -321,7 +321,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info
const float mval_dst[2] = {win->eventstate->x - ar->winrct.xmin,
win->eventstate->y - ar->winrct.ymin};
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -334,7 +334,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(shdr_pos, mval_src);
immVertex2fv(shdr_pos, mval_dst);
immEnd();
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 8ef287b7f4d..f8c0e24c061 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -87,7 +87,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
gpuTranslate2fv(cursor);
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -99,7 +99,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 8.0f);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex2f(shdr_pos, -0.05f * x_fac, 0.0f);
immVertex2f(shdr_pos, 0.0f, 0.05f * y_fac);
@@ -118,7 +118,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
immUniform1f("dash_width", 2.0f);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immVertex2f(shdr_pos, -0.020f * x_fac, 0.0f);
immVertex2f(shdr_pos, -0.1f * x_fac, 0.0f);
@@ -165,7 +165,7 @@ static void draw_uvs_shadow(Object *obedit)
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -228,7 +228,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con
}
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -240,7 +240,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
- immBegin(PRIM_TRIANGLE_FAN, efa->len);
+ immBegin(GWN_PRIM_TRI_FAN, efa->len);
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -280,7 +280,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con
immUniformColor3fv(col);
/* TODO: use editmesh tessface */
- immBegin(PRIM_TRIANGLE_FAN, efa->len);
+ immBegin(GWN_PRIM_TRI_FAN, efa->len);
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -307,9 +307,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con
col[3] = 0.5f; /* hard coded alpha, not that nice */
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
@@ -352,7 +352,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con
}
/* TODO: use editmesh tessface */
- immBegin(PRIM_TRIANGLE_FAN, efa->len);
+ immBegin(GWN_PRIM_TRI_FAN, efa->len);
BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
a = fabsf(uvang[i] - ang[i]) / (float)M_PI;
@@ -390,7 +390,7 @@ static void draw_uvs_lineloop_bmface(BMFace *efa, const int cd_loop_uv_offset, c
BMLoop *l;
MLoopUV *luv;
- immBegin(PRIM_LINE_LOOP, efa->len);
+ immBegin(GWN_PRIM_LINE_LOOP, efa->len);
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -405,7 +405,7 @@ static void draw_uvs_lineloop_mpoly(Mesh *me, MPoly *mpoly, unsigned int pos)
MLoopUV *mloopuv;
int i;
- immBegin(PRIM_LINE_LOOP, mpoly->totloop);
+ immBegin(GWN_PRIM_LINE_LOOP, mpoly->totloop);
mloopuv = &me->mloopuv[mpoly->loopstart];
for (i = mpoly->totloop; i != 0; i--, mloopuv++) {
@@ -520,7 +520,7 @@ static void draw_uvs_other_mesh(Object *ob, const Image *curimage, const bool ne
static void draw_uvs_other(SceneLayer *sl, Object *obedit, const Image *curimage, const bool new_shading_nodes,
const int other_uv_filter)
{
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -562,7 +562,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, SceneLayer *sl, Ob
mloopuv = me->mloopuv;
}
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -574,7 +574,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, SceneLayer *sl, Ob
if ((scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE) && mpoly->mat_nr != ob->actcol - 1)
continue;
- immBegin(PRIM_LINE_LOOP, mpoly->totloop);
+ immBegin(GWN_PRIM_LINE_LOOP, mpoly->totloop);
mloopuv = mloopuv_base + mpoly->loopstart;
for (b = 0; b < mpoly->totloop; b++, mloopuv++) {
@@ -678,7 +678,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -696,7 +696,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
immUniformColor4ubv(is_select ? col2 : col1);
}
- immBegin(PRIM_TRIANGLES, (em->looptris[i][0]->f->len - 2) * 3);
+ immBegin(GWN_PRIM_TRIS, (em->looptris[i][0]->f->len - 2) * 3);
draw_uvs_looptri(em, &i, cd_loop_uv_offset, pos);
immEnd();
}
@@ -741,7 +741,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
switch (sima->dt_uv) {
case SI_UVDT_DASH:
{
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -766,7 +766,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
}
case SI_UVDT_BLACK: /* black/white */
case SI_UVDT_WHITE:
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -788,7 +788,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
break;
case SI_UVDT_OUTLINE:
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -811,9 +811,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
int sel;
UI_GetThemeColor4ubv(TH_EDGE_SELECT, col1);
- VertexFormat *format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
if (interpedges) {
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
@@ -822,7 +822,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
continue;
- immBegin(PRIM_LINE_LOOP, efa->len);
+ immBegin(GWN_PRIM_LINE_LOOP, efa->len);
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
sel = uvedit_uv_select_test(scene, l, cd_loop_uv_offset);
@@ -846,7 +846,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
continue;
- immBegin(PRIM_LINES, efa->len * 2);
+ immBegin(GWN_PRIM_LINES, efa->len * 2);
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
sel = uvedit_edge_select_test(scene, l, cd_loop_uv_offset);
@@ -868,7 +868,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
}
}
else {
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv(col2);
@@ -898,16 +898,16 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
float cent[2];
bool col_set = false;
- VertexFormat *format = immVertexFormat();
- pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE);
glPointSize(pointsize);
- immBeginAtMost(PRIM_POINTS, bm->totface);
+ immBeginAtMost(GWN_PRIM_POINTS, bm->totface);
/* unselected faces */
@@ -959,7 +959,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
/* 6. draw uv vertices */
if (drawfaces != 2) { /* 2 means Mesh Face Mode */
- pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -968,7 +968,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
glPointSize(pointsize);
- immBeginAtMost(PRIM_POINTS, bm->totloop);
+ immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
@@ -988,7 +988,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
glPointSize(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0));
imm_cpack(0xFF);
- immBeginAtMost(PRIM_POINTS, bm->totloop);
+ immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
@@ -1008,7 +1008,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe
immUniformThemeColor(TH_VERTEX_SELECT);
glPointSize(pointsize);
- immBeginAtMost(PRIM_POINTS, bm->totloop);
+ immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index f3191581d49..55c439924cd 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1541,13 +1541,13 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no
normalize_v2(normal);
}
-static void stitch_draw_vbo(VertexBuffer *vbo, PrimitiveType prim_type, const float col[4])
+static void stitch_draw_vbo(Gwn_VertBuf *vbo, Gwn_PrimType prim_type, const float col[4])
{
- Batch *batch = Batch_create(prim_type, vbo, NULL);
+ Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL);
Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR);
- Batch_Uniform4fv(batch, "color", col);
- Batch_draw(batch);
- Batch_discard_all(batch);
+ GWN_batch_uniform_4fv(batch, "color", col);
+ GWN_batch_draw(batch);
+ GWN_batch_discard_all(batch);
}
/* TODO make things pretier : store batches inside StitchPreviewer instead of the bare verts pos */
@@ -1557,24 +1557,24 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar
unsigned int num_line = 0, num_tri, tri_idx = 0, line_idx = 0;
StitchState *state = (StitchState *)arg;
StitchPreviewer *stitch_preview = state->stitch_preview;
- VertexBuffer *vbo, *vbo_line;
+ Gwn_VertBuf *vbo, *vbo_line;
float col[4];
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
glEnable(GL_BLEND);
/* Static Tris */
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_ACTIVE, col);
- vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, stitch_preview->num_static_tris * 3);
+ vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, stitch_preview->num_static_tris * 3);
for (int i = 0; i < stitch_preview->num_static_tris * 3; i++)
- VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->static_tris[i*2]);
- stitch_draw_vbo(vbo, PRIM_TRIANGLES, col);
+ GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->static_tris[i*2]);
+ stitch_draw_vbo(vbo, GWN_PRIM_TRIS, col);
/* Preview Polys */
@@ -1584,38 +1584,38 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar
num_tri = num_line - 2 * stitch_preview->num_polys;
/* we need to convert the polys into triangles / lines */
- vbo = VertexBuffer_create_with_format(&format);
- vbo_line = VertexBuffer_create_with_format(&format);
+ vbo = GWN_vertbuf_create_with_format(&format);
+ vbo_line = GWN_vertbuf_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, num_tri * 3);
- VertexBuffer_allocate_data(vbo_line, num_line * 2);
+ GWN_vertbuf_data_alloc(vbo, num_tri * 3);
+ GWN_vertbuf_data_alloc(vbo_line, num_line * 2);
for (int i = 0; i < stitch_preview->num_polys; i++) {
BLI_assert(stitch_preview->uvs_per_polygon[i] >= 3);
/* Start line */
- VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]);
- VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + 2]);
+ GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]);
+ GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + 2]);
for (j = 1; j < stitch_preview->uvs_per_polygon[i] - 1; ++j) {
- VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]);
- VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+0)*2]);
- VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+1)*2]);
+ GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]);
+ GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+0)*2]);
+ GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+1)*2]);
- VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+0)*2]);
- VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+1)*2]);
+ GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+0)*2]);
+ GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+1)*2]);
}
/* Closing line */
- VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]);
- VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j*2]); /* j = uvs_per_polygon[i] - 1*/
+ GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]);
+ GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j*2]); /* j = uvs_per_polygon[i] - 1*/
index += stitch_preview->uvs_per_polygon[i] * 2;
}
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_FACE, col);
- stitch_draw_vbo(vbo, PRIM_TRIANGLES, col);
+ stitch_draw_vbo(vbo, GWN_PRIM_TRIS, col);
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_EDGE, col);
- stitch_draw_vbo(vbo_line, PRIM_LINES, col);
+ stitch_draw_vbo(vbo_line, GWN_PRIM_LINES, col);
glDisable(GL_BLEND);
@@ -1625,33 +1625,33 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2.0f);
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col);
- vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, stitch_preview->num_stitchable);
+ vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable);
for (int i = 0; i < stitch_preview->num_stitchable; i++)
- VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]);
- stitch_draw_vbo(vbo, PRIM_POINTS, col);
+ GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]);
+ stitch_draw_vbo(vbo, GWN_PRIM_POINTS, col);
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col);
- vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, stitch_preview->num_unstitchable);
+ vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable);
for (int i = 0; i < stitch_preview->num_unstitchable; i++)
- VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]);
- stitch_draw_vbo(vbo, PRIM_POINTS, col);
+ GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]);
+ stitch_draw_vbo(vbo, GWN_PRIM_POINTS, col);
}
else {
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col);
- vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, stitch_preview->num_stitchable * 2);
+ vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable * 2);
for (int i = 0; i < stitch_preview->num_stitchable * 2; i++)
- VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]);
- stitch_draw_vbo(vbo, PRIM_LINES, col);
+ GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]);
+ stitch_draw_vbo(vbo, GWN_PRIM_LINES, col);
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col);
- vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, stitch_preview->num_unstitchable * 2);
+ vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable * 2);
for (int i = 0; i < stitch_preview->num_unstitchable * 2; i++)
- VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]);
- stitch_draw_vbo(vbo, PRIM_LINES, col);
+ GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]);
+ stitch_draw_vbo(vbo, GWN_PRIM_LINES, col);
}
}
diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
index f27153ccecf..d052a2d831f 100644
--- a/source/blender/gpu/GPU_batch.h
+++ b/source/blender/gpu/GPU_batch.h
@@ -38,12 +38,12 @@
#include "GPU_shader.h"
-/* Extend Batch_set_program to use Blender’s library of built-in shader programs. */
-void Batch_set_builtin_program(Batch*, GPUBuiltinShader);
+/* Extend GWN_batch_program_set to use Blender’s library of built-in shader programs. */
+void Batch_set_builtin_program(Gwn_Batch*, GPUBuiltinShader);
/* Replacement for gluSphere */
-Batch *Batch_get_sphere(int lod);
-Batch *Batch_get_sphere_wire(int lod);
+Gwn_Batch *Batch_get_sphere(int lod);
+Gwn_Batch *Batch_get_sphere_wire(int lod);
void gpu_batch_init(void);
void gpu_batch_exit(void);
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index b4d271ed3b9..30fd4bd30b8 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -51,7 +51,7 @@ struct GPUVertPointLink;
struct GPUDrawObject;
struct GridCommonGPUBuffer;
struct PBVH;
-struct Batch;
+struct Gwn_Batch;
struct MVert;
typedef struct GPUBuffer {
@@ -261,7 +261,7 @@ void GPU_pbvh_grid_buffers_update(
void GPU_pbvh_buffers_draw(
GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
bool wireframe, bool fast);
-struct Batch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast);
+struct Gwn_Batch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast);
/* debug PBVH draw */
void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf, unsigned int pos);
diff --git a/source/blender/gpu/GPU_immediate_util.h b/source/blender/gpu/GPU_immediate_util.h
index b68b353e717..f91dd6147a0 100644
--- a/source/blender/gpu/GPU_immediate_util.h
+++ b/source/blender/gpu/GPU_immediate_util.h
@@ -32,7 +32,7 @@ void imm_cpack(unsigned int x);
void imm_draw_circle_wire(uint shdr_pos, float x, float y, float radius, int nsegments);
void imm_draw_circle_fill(uint shdr_pos, float x, float y, float radius, int nsegments);
-/* use this version when VertexFormat has a vec3 position */
+/* use this version when Gwn_VertFormat has a vec3 position */
void imm_draw_circle_wire_3d(unsigned pos, float x, float y, float radius, int nsegments);
void imm_draw_circle_fill_3d(unsigned pos, float x, float y, float radius, int nsegments);
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
index b62506c154f..a3fd75b662b 100644
--- a/source/blender/gpu/GPU_matrix.h
+++ b/source/blender/gpu/GPU_matrix.h
@@ -111,7 +111,7 @@ const float (*gpuGetNormalMatrixInverse(float m[3][3]))[3];
/* set uniform values for currently bound shader */
-void gpuBindMatrices(const ShaderInterface*);
+void gpuBindMatrices(const Gwn_ShaderInterface*);
bool gpuMatricesDirty(void); /* since last bind */
#ifdef __cplusplus
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c
index e98f07cb0e9..92bab13dcb5 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -31,20 +31,20 @@
#include "GPU_batch.h"
#include "gpu_shader_private.h"
-void Batch_set_builtin_program(Batch *batch, GPUBuiltinShader shader_id)
+void Batch_set_builtin_program(Gwn_Batch *batch, GPUBuiltinShader shader_id)
{
GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
- Batch_set_program(batch, shader->program, shader->interface);
+ GWN_batch_program_set(batch, shader->program, shader->interface);
}
-static Batch *sphere_high = NULL;
-static Batch *sphere_med = NULL;
-static Batch *sphere_low = NULL;
-static Batch *sphere_wire_low = NULL;
-static Batch *sphere_wire_med = NULL;
+static Gwn_Batch *sphere_high = NULL;
+static Gwn_Batch *sphere_med = NULL;
+static Gwn_Batch *sphere_low = NULL;
+static Gwn_Batch *sphere_wire_low = NULL;
+static Gwn_Batch *sphere_wire_med = NULL;
-static VertexBuffer *vbo;
-static VertexFormat format = {0};
+static Gwn_VertBuf *vbo;
+static Gwn_VertFormat format = {0};
static unsigned int pos_id, nor_id;
static unsigned int vert;
@@ -55,24 +55,24 @@ static void batch_sphere_lat_lon_vert(float lat, float lon)
pos[1] = cosf(lat);
pos[2] = sinf(lat) * sinf(lon);
- VertexBuffer_set_attrib(vbo, nor_id, vert, pos);
- VertexBuffer_set_attrib(vbo, pos_id, vert++, pos);
+ GWN_vertbuf_attr_set(vbo, nor_id, vert, pos);
+ GWN_vertbuf_attr_set(vbo, pos_id, vert++, pos);
}
/* Replacement for gluSphere */
-static Batch *batch_sphere(int lat_res, int lon_res)
+static Gwn_Batch *batch_sphere(int lat_res, int lon_res)
{
const float lon_inc = 2 * M_PI / lon_res;
const float lat_inc = M_PI / lat_res;
float lon, lat;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, (lat_res - 1) * lon_res * 6);
+ vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, (lat_res - 1) * lon_res * 6);
vert = 0;
lon = 0.0f;
@@ -93,22 +93,22 @@ static Batch *batch_sphere(int lat_res, int lon_res)
}
}
- return Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ return GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
-static Batch *batch_sphere_wire(int lat_res, int lon_res)
+static Gwn_Batch *batch_sphere_wire(int lat_res, int lon_res)
{
const float lon_inc = 2 * M_PI / lon_res;
const float lat_inc = M_PI / lat_res;
float lon, lat;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, (lat_res * lon_res * 2) + ((lat_res - 1) * lon_res * 2));
+ vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, (lat_res * lon_res * 2) + ((lat_res - 1) * lon_res * 2));
vert = 0;
lon = 0.0f;
@@ -125,10 +125,10 @@ static Batch *batch_sphere_wire(int lat_res, int lon_res)
}
}
- return Batch_create(PRIM_LINES, vbo, NULL);
+ return GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
-Batch *Batch_get_sphere(int lod)
+Gwn_Batch *Batch_get_sphere(int lod)
{
BLI_assert(lod >= 0 && lod <= 2);
@@ -140,7 +140,7 @@ Batch *Batch_get_sphere(int lod)
return sphere_high;
}
-Batch *Batch_get_sphere_wire(int lod)
+Gwn_Batch *Batch_get_sphere_wire(int lod)
{
BLI_assert(lod >= 0 && lod <= 1);
@@ -163,9 +163,9 @@ void gpu_batch_init(void)
void gpu_batch_exit(void)
{
- Batch_discard_all(sphere_low);
- Batch_discard_all(sphere_med);
- Batch_discard_all(sphere_high);
- Batch_discard_all(sphere_wire_low);
- Batch_discard_all(sphere_wire_med);
+ GWN_batch_discard_all(sphere_low);
+ GWN_batch_discard_all(sphere_med);
+ GWN_batch_discard_all(sphere_high);
+ GWN_batch_discard_all(sphere_wire_low);
+ GWN_batch_discard_all(sphere_wire_med);
}
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 6281d0a3b67..fb2e271f9a2 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -108,7 +108,7 @@ static ThreadMutex buffer_mutex = BLI_MUTEX_INITIALIZER;
/* multires global buffer, can be used for many grids having the same grid size */
typedef struct GridCommonGPUBuffer {
- ElementList *mres_buffer;
+ Gwn_IndexBuf *mres_buffer;
int mres_prev_gridsize;
unsigned mres_prev_totquad;
} GridCommonGPUBuffer;
@@ -945,11 +945,11 @@ void GPU_buffer_draw_elements(GPUBuffer *UNUSED(elements), unsigned int mode, in
* drawing and doesn't interact at all with the buffer code above */
struct GPU_PBVH_Buffers {
- ElementList *index_buf, *index_buf_fast;
- VertexBuffer *vert_buf;
+ Gwn_IndexBuf *index_buf, *index_buf_fast;
+ Gwn_VertBuf *vert_buf;
- Batch *triangles;
- Batch *triangles_fast;
+ Gwn_Batch *triangles;
+ Gwn_Batch *triangles_fast;
/* mesh pointers in case buffer allocation fails */
const MPoly *mpoly;
@@ -988,30 +988,30 @@ typedef struct {
uint pos, nor, col;
} VertexBufferAttrID;
-static void gpu_pbvh_vert_format_init__gwn(VertexFormat *format, VertexBufferAttrID *vbo_id)
+static void gpu_pbvh_vert_format_init__gwn(Gwn_VertFormat *format, VertexBufferAttrID *vbo_id)
{
- vbo_id->pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- vbo_id->nor = VertexFormat_add_attrib(format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
- vbo_id->col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ vbo_id->pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ vbo_id->nor = GWN_vertformat_attr_add(format, "nor", GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ vbo_id->col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
static void gpu_pbvh_batch_init(GPU_PBVH_Buffers *buffers)
{
/* force flushing to the GPU */
if (buffers->vert_buf->data) {
- VertexBuffer_use(buffers->vert_buf);
+ GWN_vertbuf_use(buffers->vert_buf);
}
- BATCH_DISCARD_SAFE(buffers->triangles);
- buffers->triangles = Batch_create(
- PRIM_TRIANGLES, buffers->vert_buf,
+ GWN_BATCH_DISCARD_SAFE(buffers->triangles);
+ buffers->triangles = GWN_batch_create(
+ GWN_PRIM_TRIS, buffers->vert_buf,
/* can be NULL */
buffers->index_buf);
- BATCH_DISCARD_SAFE(buffers->triangles_fast);
+ GWN_BATCH_DISCARD_SAFE(buffers->triangles_fast);
if (buffers->index_buf_fast) {
- buffers->triangles_fast = Batch_create(
- PRIM_TRIANGLES, buffers->vert_buf,
+ buffers->triangles_fast = GWN_batch_create(
+ GWN_PRIM_TRIS, buffers->vert_buf,
/* can be NULL */
buffers->index_buf_fast);
}
@@ -1078,15 +1078,15 @@ void GPU_pbvh_mesh_buffers_update(
rgba_float_to_uchar(diffuse_color_ub, diffuse_color);
/* Build VBO */
- VERTEXBUFFER_DISCARD_SAFE(buffers->vert_buf);
+ GWN_VERTBUF_DISCARD_SAFE(buffers->vert_buf);
/* match 'VertexBufferFormat' */
- VertexFormat format = {0};
+ Gwn_VertFormat format = {0};
VertexBufferAttrID vbo_id;
gpu_pbvh_vert_format_init__gwn(&format, &vbo_id);
- buffers->vert_buf = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(buffers->vert_buf, totelem);
+ buffers->vert_buf = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(buffers->vert_buf, totelem);
if (buffers->vert_buf->data) {
/* Vertex data is shared if smooth-shaded, but separate
@@ -1095,8 +1095,8 @@ void GPU_pbvh_mesh_buffers_update(
if (buffers->smooth) {
for (uint i = 0; i < totvert; ++i) {
const MVert *v = &mvert[vert_indices[i]];
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.pos, i, v->co);
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.nor, i, v->no);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.pos, i, v->co);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.nor, i, v->no);
}
for (uint i = 0; i < buffers->face_indices_len; i++) {
@@ -1107,10 +1107,10 @@ void GPU_pbvh_mesh_buffers_update(
int v_index = buffers->mloop[lt->tri[j]].v;
uchar color_ub[3];
gpu_color_from_mask_copy(vmask[v_index], diffuse_color, color_ub);
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.col, vidx, color_ub);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.col, vidx, color_ub);
}
else {
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.col, vidx, diffuse_color_ub);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.col, vidx, diffuse_color_ub);
}
}
}
@@ -1153,9 +1153,9 @@ void GPU_pbvh_mesh_buffers_update(
for (uint j = 0; j < 3; j++) {
const MVert *v = &mvert[vtri[j]];
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.pos, vbo_index, v->co);
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.nor, vbo_index, no);
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.col, vbo_index, color_ub);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.pos, vbo_index, v->co);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.nor, vbo_index, no);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.col, vbo_index, color_ub);
vbo_index++;
}
@@ -1165,7 +1165,7 @@ void GPU_pbvh_mesh_buffers_update(
gpu_pbvh_batch_init(buffers);
}
else {
- VERTEXBUFFER_DISCARD_SAFE(buffers->vert_buf);
+ GWN_VERTBUF_DISCARD_SAFE(buffers->vert_buf);
}
}
@@ -1220,8 +1220,8 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
if (buffers->smooth) {
/* Fill the triangle buffer */
buffers->index_buf = NULL;
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, tottri, INT_MAX);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, tottri, INT_MAX);
for (i = 0; i < face_indices_len; ++i) {
const MLoopTri *lt = &looptri[face_indices[i]];
@@ -1230,13 +1230,13 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
if (paint_is_face_hidden(lt, mvert, mloop))
continue;
- add_triangle_vertices(&elb, UNPACK3(face_vert_indices[i]));
+ GWN_indexbuf_add_tri_verts(&elb, UNPACK3(face_vert_indices[i]));
}
- buffers->index_buf = ElementList_build(&elb);
+ buffers->index_buf = GWN_indexbuf_build(&elb);
}
else {
if (!buffers->is_index_buf_global) {
- ELEMENTLIST_DISCARD_SAFE(buffers->index_buf);
+ GWN_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
}
buffers->index_buf = NULL;
buffers->is_index_buf_global = false;
@@ -1281,14 +1281,14 @@ void GPU_pbvh_grid_buffers_update(
copy_v4_v4(buffers->diffuse_color, diffuse_color);
- VertexFormat format = {0};
+ Gwn_VertFormat format = {0};
VertexBufferAttrID vbo_id;
gpu_pbvh_vert_format_init__gwn(&format, &vbo_id);
/* Build coord/normal VBO */
- VERTEXBUFFER_DISCARD_SAFE(buffers->vert_buf);
- buffers->vert_buf = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(buffers->vert_buf, totgrid * key->grid_area);
+ GWN_VERTBUF_DISCARD_SAFE(buffers->vert_buf);
+ buffers->vert_buf = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(buffers->vert_buf, totgrid * key->grid_area);
uint vbo_index_offset = 0;
if (buffers->vert_buf->data) {
@@ -1299,18 +1299,18 @@ void GPU_pbvh_grid_buffers_update(
for (y = 0; y < key->grid_size; y++) {
for (x = 0; x < key->grid_size; x++) {
CCGElem *elem = CCG_grid_elem(key, grid, x, y);
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.pos, vbo_index, CCG_elem_co(key, elem));
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.pos, vbo_index, CCG_elem_co(key, elem));
if (buffers->smooth) {
short no_short[3];
normal_float_to_short_v3(no_short, CCG_elem_no(key, elem));
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.nor, vbo_index, no_short);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.nor, vbo_index, no_short);
if (has_mask) {
uchar color_ub[3];
gpu_color_from_mask_copy(*CCG_elem_mask(key, elem),
diffuse_color, color_ub);
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.col, vbo_index, color_ub);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.col, vbo_index, color_ub);
}
}
vbo_index += 1;
@@ -1337,7 +1337,7 @@ void GPU_pbvh_grid_buffers_update(
vbo_index = vbo_index_offset + ((j + 1) * key->grid_size + k);
short no_short[3];
normal_float_to_short_v3(no_short, fno);
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.nor, vbo_index, no_short);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.nor, vbo_index, no_short);
if (has_mask) {
uchar color_ub[3];
@@ -1348,7 +1348,7 @@ void GPU_pbvh_grid_buffers_update(
elems[3],
diffuse_color,
color_ub);
- VertexBuffer_set_attrib(buffers->vert_buf, vbo_id.col, vbo_index, color_ub);
+ GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.col, vbo_index, color_ub);
}
}
}
@@ -1360,7 +1360,7 @@ void GPU_pbvh_grid_buffers_update(
gpu_pbvh_batch_init(buffers);
}
else {
- VERTEXBUFFER_DISCARD_SAFE(buffers->vert_buf);
+ GWN_VERTBUF_DISCARD_SAFE(buffers->vert_buf);
}
}
@@ -1380,9 +1380,9 @@ void GPU_pbvh_grid_buffers_update(
int offset = 0; \
int i, j, k; \
\
- ElementListBuilder elb; \
- ElementListBuilder_init( \
- &elb, PRIM_TRIANGLES, tot_quad_ * 2, max_vert_); \
+ Gwn_IndexBufBuilder elb; \
+ GWN_indexbuf_init( \
+ &elb, GWN_PRIM_TRIS, tot_quad_ * 2, max_vert_); \
\
/* Fill the buffer */ \
for (i = 0; i < totgrid; ++i) { \
@@ -1398,23 +1398,23 @@ void GPU_pbvh_grid_buffers_update(
{ \
continue; \
} \
- add_generic_vertex(&elb, offset + j * gridsize + k + 1); \
- add_generic_vertex(&elb, offset + j * gridsize + k); \
- add_generic_vertex(&elb, offset + (j + 1) * gridsize + k); \
+ GWN_indexbuf_add_generic_vert(&elb, offset + j * gridsize + k + 1); \
+ GWN_indexbuf_add_generic_vert(&elb, offset + j * gridsize + k); \
+ GWN_indexbuf_add_generic_vert(&elb, offset + (j + 1) * gridsize + k); \
\
- add_generic_vertex(&elb, offset + (j + 1) * gridsize + k + 1); \
- add_generic_vertex(&elb, offset + j * gridsize + k + 1); \
- add_generic_vertex(&elb, offset + (j + 1) * gridsize + k); \
+ GWN_indexbuf_add_generic_vert(&elb, offset + (j + 1) * gridsize + k + 1); \
+ GWN_indexbuf_add_generic_vert(&elb, offset + j * gridsize + k + 1); \
+ GWN_indexbuf_add_generic_vert(&elb, offset + (j + 1) * gridsize + k); \
} \
} \
\
offset += gridsize * gridsize; \
} \
- buffer_ = ElementList_build(&elb); \
+ buffer_ = GWN_indexbuf_build(&elb); \
} (void)0
/* end FILL_QUAD_BUFFER */
-static ElementList *gpu_get_grid_buffer(
+static Gwn_IndexBuf *gpu_get_grid_buffer(
int gridsize, unsigned *totquad, GridCommonGPUBuffer **grid_common_gpu_buffer,
/* remove this arg when gawain gets base-vertex support! */
int totgrid)
@@ -1440,7 +1440,7 @@ static ElementList *gpu_get_grid_buffer(
}
/* we can't reuse old, delete the existing buffer */
else if (gridbuff->mres_buffer) {
- ElementList_discard(gridbuff->mres_buffer);
+ GWN_indexbuf_discard(gridbuff->mres_buffer);
gridbuff->mres_buffer = NULL;
}
@@ -1457,17 +1457,17 @@ static ElementList *gpu_get_grid_buffer(
#define FILL_FAST_BUFFER() \
{ \
- ElementListBuilder elb; \
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, 6 * totgrid, INT_MAX); \
+ Gwn_IndexBufBuilder elb; \
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, 6 * totgrid, INT_MAX); \
for (int i = 0; i < totgrid; i++) { \
- add_generic_vertex(&elb, i * gridsize * gridsize + gridsize - 1); \
- add_generic_vertex(&elb, i * gridsize * gridsize); \
- add_generic_vertex(&elb, (i + 1) * gridsize * gridsize - gridsize); \
- add_generic_vertex(&elb, (i + 1) * gridsize * gridsize - 1); \
- add_generic_vertex(&elb, i * gridsize * gridsize + gridsize - 1); \
- add_generic_vertex(&elb, (i + 1) * gridsize * gridsize - gridsize); \
+ GWN_indexbuf_add_generic_vert(&elb, i * gridsize * gridsize + gridsize - 1); \
+ GWN_indexbuf_add_generic_vert(&elb, i * gridsize * gridsize); \
+ GWN_indexbuf_add_generic_vert(&elb, (i + 1) * gridsize * gridsize - gridsize); \
+ GWN_indexbuf_add_generic_vert(&elb, (i + 1) * gridsize * gridsize - 1); \
+ GWN_indexbuf_add_generic_vert(&elb, i * gridsize * gridsize + gridsize - 1); \
+ GWN_indexbuf_add_generic_vert(&elb, (i + 1) * gridsize * gridsize - gridsize); \
} \
- buffers->index_buf_fast = ElementList_build(&elb); \
+ buffers->index_buf_fast = GWN_indexbuf_build(&elb); \
} (void)0
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(
@@ -1538,7 +1538,7 @@ GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(
*/
static void gpu_bmesh_vert_to_buffer_copy__gwn(
BMVert *v,
- VertexBuffer *vert_buf,
+ Gwn_VertBuf *vert_buf,
const VertexBufferAttrID *vbo_id,
int *v_index,
const float fno[3],
@@ -1549,12 +1549,12 @@ static void gpu_bmesh_vert_to_buffer_copy__gwn(
if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
/* Set coord, normal, and mask */
- VertexBuffer_set_attrib(vert_buf, vbo_id->pos, *v_index, v->co);
+ GWN_vertbuf_attr_set(vert_buf, vbo_id->pos, *v_index, v->co);
{
short no_short[3];
normal_float_to_short_v3(no_short, fno ? fno : v->no);
- VertexBuffer_set_attrib(vert_buf, vbo_id->nor, *v_index, no_short);
+ GWN_vertbuf_attr_set(vert_buf, vbo_id->nor, *v_index, no_short);
}
{
@@ -1564,7 +1564,7 @@ static void gpu_bmesh_vert_to_buffer_copy__gwn(
BM_ELEM_CD_GET_FLOAT(v, cd_vert_mask_offset),
diffuse_color,
color_ub);
- VertexBuffer_set_attrib(vert_buf, vbo_id->col, *v_index, color_ub);
+ GWN_vertbuf_attr_set(vert_buf, vbo_id->col, *v_index, color_ub);
}
/* Assign index for use in the triangle index buffer */
@@ -1660,14 +1660,14 @@ void GPU_pbvh_bmesh_buffers_update(
copy_v4_v4(buffers->diffuse_color, diffuse_color);
/* Initialize vertex buffer */
- VERTEXBUFFER_DISCARD_SAFE(buffers->vert_buf);
+ GWN_VERTBUF_DISCARD_SAFE(buffers->vert_buf);
/* match 'VertexBufferFormat' */
- VertexFormat format = {0};
+ Gwn_VertFormat format = {0};
VertexBufferAttrID vbo_id;
gpu_pbvh_vert_format_init__gwn(&format, &vbo_id);
- buffers->vert_buf = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(buffers->vert_buf, totvert);
+ buffers->vert_buf = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(buffers->vert_buf, totvert);
/* Fill vertex buffer */
if (buffers->vert_buf->data) {
@@ -1736,7 +1736,7 @@ void GPU_pbvh_bmesh_buffers_update(
bm->elem_index_dirty |= BM_VERT;
}
else {
- VERTEXBUFFER_DISCARD_SAFE(buffers->vert_buf);
+ GWN_VERTBUF_DISCARD_SAFE(buffers->vert_buf);
/* Memory map failed */
return;
}
@@ -1744,12 +1744,12 @@ void GPU_pbvh_bmesh_buffers_update(
if (buffers->smooth) {
/* Fill the triangle buffer */
buffers->index_buf = NULL;
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, tottri, maxvert);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, tottri, maxvert);
/* Initialize triangle index buffer */
if (buffers->triangles && !buffers->is_index_buf_global) {
- BATCH_DISCARD_SAFE(buffers->triangles);
+ GWN_BATCH_DISCARD_SAFE(buffers->triangles);
}
buffers->is_index_buf_global = false;
@@ -1767,19 +1767,19 @@ void GPU_pbvh_bmesh_buffers_update(
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
- add_generic_vertex(&elb, BM_elem_index_get(l_iter->v));
+ GWN_indexbuf_add_generic_vert(&elb, BM_elem_index_get(l_iter->v));
} while ((l_iter = l_iter->next) != l_first);
}
}
buffers->tot_tri = tottri;
- buffers->index_buf = ElementList_build(&elb);
+ buffers->index_buf = GWN_indexbuf_build(&elb);
}
}
else if (buffers->index_buf) {
if (!buffers->is_index_buf_global) {
- ELEMENTLIST_DISCARD_SAFE(buffers->index_buf);
+ GWN_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
}
buffers->index_buf = NULL;
buffers->is_index_buf_global = false;
@@ -1807,7 +1807,7 @@ void GPU_pbvh_buffers_draw(
{
UNUSED_VARS(wireframe, fast, setMaterial);
bool do_fast = fast && buffers->triangles_fast;
- Batch *triangles = do_fast ? buffers->triangles_fast : buffers->triangles;
+ Gwn_Batch *triangles = do_fast ? buffers->triangles_fast : buffers->triangles;
if (triangles) {
@@ -1817,7 +1817,7 @@ void GPU_pbvh_buffers_draw(
buffers->smooth ? GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR : GPU_SHADER_SIMPLE_LIGHTING_FLAT_COLOR;
GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
- Batch_set_program(
+ GWN_batch_program_set(
triangles,
GPU_shader_get_program(shader), GPU_shader_get_interface(shader));
@@ -1830,11 +1830,11 @@ void GPU_pbvh_buffers_draw(
GPU_shader_uniform_vector(shader, GPU_shader_get_uniform(shader, "global"), 1, 1, &world_light);
}
- Batch_draw(triangles);
+ GWN_batch_draw(triangles);
}
}
-Batch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast)
+Gwn_Batch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast)
{
return (fast && buffers->triangles_fast) ?
buffers->triangles_fast : buffers->triangles;
@@ -1886,13 +1886,13 @@ bool GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, GSet *bm_faces,
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers)
{
if (buffers) {
- BATCH_DISCARD_SAFE(buffers->triangles);
- BATCH_DISCARD_SAFE(buffers->triangles_fast);
+ GWN_BATCH_DISCARD_SAFE(buffers->triangles);
+ GWN_BATCH_DISCARD_SAFE(buffers->triangles_fast);
if (!buffers->is_index_buf_global) {
- ELEMENTLIST_DISCARD_SAFE(buffers->index_buf);
+ GWN_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
}
- ELEMENTLIST_DISCARD_SAFE(buffers->index_buf_fast);
- VertexBuffer_discard(buffers->vert_buf);
+ GWN_INDEXBUF_DISCARD_SAFE(buffers->index_buf_fast);
+ GWN_vertbuf_discard(buffers->vert_buf);
#ifdef USE_BASE_ELEM
if (buffers->baseelemarray)
@@ -1912,7 +1912,7 @@ void GPU_pbvh_multires_buffers_free(GridCommonGPUBuffer **grid_common_gpu_buffer
if (gridbuff) {
if (gridbuff->mres_buffer) {
BLI_mutex_lock(&buffer_mutex);
- ELEMENTLIST_DISCARD_SAFE(gridbuff->mres_buffer);
+ GWN_INDEXBUF_DISCARD_SAFE(gridbuff->mres_buffer);
BLI_mutex_unlock(&buffer_mutex);
}
MEM_freeN(gridbuff);
@@ -1932,7 +1932,7 @@ void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf, unsigned int pos)
* could keep a static batch & index buffer, change the VBO contents per draw
*/
- immBegin(PRIM_LINES, 24);
+ immBegin(GWN_PRIM_LINES, 24);
/* top */
immVertex3f(pos, min[0], min[1], max[2]);
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 7e80021f8fc..1f0f5e375ce 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -783,7 +783,7 @@ static const char *attrib_prefix_get(CustomDataType type)
case CD_TANGENT: return "t";
case CD_MCOL: return "c";
case CD_AUTO_FROM_NAME: return "a";
- default: BLI_assert(false && "Attrib Prefix type not found : This should not happen!"); return "";
+ default: BLI_assert(false && "Gwn_VertAttr Prefix type not found : This should not happen!"); return "";
}
}
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index c3fab8117b8..afd28aece12 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -195,8 +195,8 @@ struct GPUFX {
/* we have a stencil, restore the previous state */
bool restore_stencil;
- Batch *quad_batch;
- Batch *point_batch;
+ Gwn_Batch *quad_batch;
+ Gwn_Batch *point_batch;
};
#if 0
@@ -273,31 +273,31 @@ GPUFX *GPU_fx_compositor_create(void)
GPUFX *fx = MEM_callocN(sizeof(GPUFX), "GPUFX compositor");
/* Quad buffer */
- static VertexFormat format = {0};
+ static Gwn_VertFormat format = {0};
static unsigned int pos, uvs;
if (format.attrib_ct == 0) {
- pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
- uvs = VertexFormat_add_attrib(&format, "uvs", COMP_F32, 2, KEEP_FLOAT);
+ pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ uvs = GWN_vertformat_attr_add(&format, "uvs", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 4);
for (int i = 0; i < 4; ++i) {
- VertexBuffer_set_attrib(vbo, pos, i, fullscreencos[i]);
- VertexBuffer_set_attrib(vbo, uvs, i, fullscreenuvs[i]);
+ GWN_vertbuf_attr_set(vbo, pos, i, fullscreencos[i]);
+ GWN_vertbuf_attr_set(vbo, uvs, i, fullscreenuvs[i]);
}
- fx->quad_batch = Batch_create(PRIM_TRIANGLE_STRIP, vbo, NULL);
+ fx->quad_batch = GWN_batch_create(GWN_PRIM_TRI_STRIP, vbo, NULL);
/* Point Buffer */
- static VertexFormat format_point = {0};
+ static Gwn_VertFormat format_point = {0};
static unsigned int dummy_attrib;
if (format_point.attrib_ct == 0) {
- dummy_attrib = VertexFormat_add_attrib(&format_point, "pos", COMP_F32, 2, KEEP_FLOAT);
+ dummy_attrib = GWN_vertformat_attr_add(&format_point, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
float dummy[2] = {0.0f, 0.0f};
- VertexBuffer *vbo_point = VertexBuffer_create_with_format(&format_point);
- VertexBuffer_allocate_data(vbo_point, 1);
- VertexBuffer_set_attrib(vbo_point, dummy_attrib, 0, &dummy);
- fx->point_batch = Batch_create(PRIM_POINTS, vbo_point, NULL);
+ Gwn_VertBuf *vbo_point = GWN_vertbuf_create_with_format(&format_point);
+ GWN_vertbuf_data_alloc(vbo_point, 1);
+ GWN_vertbuf_attr_set(vbo_point, dummy_attrib, 0, &dummy);
+ fx->point_batch = GWN_batch_create(GWN_PRIM_POINTS, vbo_point, NULL);
return fx;
}
@@ -387,8 +387,8 @@ static void cleanup_fx_gl_data(GPUFX *fx, bool do_fbo)
void GPU_fx_compositor_destroy(GPUFX *fx)
{
cleanup_fx_gl_data(fx, true);
- Batch_discard_all(fx->quad_batch);
- Batch_discard_all(fx->point_batch);
+ GWN_batch_discard_all(fx->quad_batch);
+ GWN_batch_discard_all(fx->point_batch);
MEM_freeN(fx);
}
@@ -731,7 +731,7 @@ void GPU_fx_compositor_XRay_resolve(GPUFX *fx)
GPUDepthResolveInterface *interface = GPU_fx_shader_get_interface(depth_resolve_shader);
/* set up quad buffer */
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(depth_resolve_shader), GPU_shader_get_interface(depth_resolve_shader));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(depth_resolve_shader), GPU_shader_get_interface(depth_resolve_shader));
GPU_texture_bind(fx->depth_buffer_xray, 0);
GPU_texture_compare_mode(fx->depth_buffer_xray, false);
@@ -739,7 +739,7 @@ void GPU_fx_compositor_XRay_resolve(GPUFX *fx)
GPU_shader_uniform_texture(depth_resolve_shader, interface->depth_uniform, fx->depth_buffer_xray);
/* draw */
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* disable bindings */
GPU_texture_compare_mode(fx->depth_buffer_xray, true);
@@ -837,7 +837,7 @@ bool GPU_fx_do_composite_pass(
GPUSSAOShaderInterface *interface = GPU_fx_shader_get_interface(ssao_shader);
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(ssao_shader), GPU_shader_get_interface(ssao_shader));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(ssao_shader), GPU_shader_get_interface(ssao_shader));
GPU_shader_uniform_vector(ssao_shader, interface->ssao_uniform, 4, 1, ssao_params);
GPU_shader_uniform_vector(ssao_shader, interface->ssao_color_uniform, 4, 1, fx_ssao->color);
@@ -861,7 +861,7 @@ bool GPU_fx_do_composite_pass(
/* draw */
gpu_fx_bind_render_target(&passes_left, fx, ofs, target);
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* disable bindings */
GPU_texture_unbind(src);
@@ -930,7 +930,7 @@ bool GPU_fx_do_composite_pass(
GPUDOFHQPassOneInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass1);
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(dof_shader_pass1), GPU_shader_get_interface(dof_shader_pass1));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass1), GPU_shader_get_interface(dof_shader_pass1));
GPU_shader_uniform_vector(dof_shader_pass1, interface->dof_uniform, 4, 1, dof_params);
GPU_shader_uniform_vector(dof_shader_pass1, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
@@ -957,7 +957,7 @@ bool GPU_fx_do_composite_pass(
GPU_framebuffer_check_valid(fx->gbuffer, NULL);
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* disable bindings */
GPU_texture_filter_mode(src, true);
@@ -982,7 +982,7 @@ bool GPU_fx_do_composite_pass(
GPUDOFHQPassTwoInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass2);
- Batch_set_program(fx->point_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
+ GWN_batch_program_set(fx->point_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
GPU_texture_bind(fx->dof_nearfar_coc, numslots++);
GPU_texture_bind(fx->dof_half_downsampled_far, numslots++);
@@ -1007,7 +1007,7 @@ bool GPU_fx_do_composite_pass(
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* the draw call we all waited for, draw a point per pixel, scaled per circle of confusion */
- Batch_draw_stupid_instanced(fx->point_batch, 0, fx->dof_downsampled_w * fx->dof_downsampled_h, 0, 0, NULL, NULL);
+ GWN_batch_draw_stupid_instanced(fx->point_batch, 0, fx->dof_downsampled_w * fx->dof_downsampled_h, 0, 0, NULL, NULL);
GPU_texture_unbind(fx->dof_half_downsampled_far);
GPU_framebuffer_texture_detach(fx->dof_far_blur);
@@ -1023,8 +1023,8 @@ bool GPU_fx_do_composite_pass(
/* have to clear the buffer unfortunately */
glClear(GL_COLOR_BUFFER_BIT);
/* the draw call we all waited for, draw a point per pixel, scaled per circle of confusion */
- Batch_draw_stupid_instanced(fx->point_batch, 0, fx->dof_downsampled_w * fx->dof_downsampled_h, 0, 0, NULL, NULL);
- Batch_done_using_program(fx->point_batch);
+ GWN_batch_draw_stupid_instanced(fx->point_batch, 0, fx->dof_downsampled_w * fx->dof_downsampled_h, 0, 0, NULL, NULL);
+ GWN_batch_program_use_end(fx->point_batch);
/* disable bindings */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1045,7 +1045,7 @@ bool GPU_fx_do_composite_pass(
GPUDOFHQPassThreeInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass3);
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(dof_shader_pass3), GPU_shader_get_interface(dof_shader_pass3));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass3), GPU_shader_get_interface(dof_shader_pass3));
GPU_shader_uniform_vector(dof_shader_pass3, interface->dof_uniform, 4, 1, dof_params);
@@ -1071,7 +1071,7 @@ bool GPU_fx_do_composite_pass(
/* if this is the last pass, prepare for rendering on the frambuffer */
gpu_fx_bind_render_target(&passes_left, fx, ofs, target);
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* disable bindings */
GPU_texture_unbind(fx->dof_near_blur);
@@ -1124,7 +1124,7 @@ bool GPU_fx_do_composite_pass(
GPUDOFPassOneInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass1);
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(dof_shader_pass1), GPU_shader_get_interface(dof_shader_pass1));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass1), GPU_shader_get_interface(dof_shader_pass1));
GPU_shader_uniform_vector(dof_shader_pass1, interface->dof_uniform, 4, 1, dof_params);
GPU_shader_uniform_vector(dof_shader_pass1, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
@@ -1143,7 +1143,7 @@ bool GPU_fx_do_composite_pass(
/* binding takes care of setting the viewport to the downsampled size */
GPU_texture_bind_as_framebuffer(fx->dof_near_coc_buffer);
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* disable bindings */
GPU_texture_unbind(src);
GPU_texture_compare_mode(fx->depth_buffer, true);
@@ -1166,7 +1166,7 @@ bool GPU_fx_do_composite_pass(
dof_params[2] = GPU_texture_width(fx->dof_near_coc_blurred_buffer) / (scale_camera * fx_dof->sensor);
/* Blurring vertically */
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
GPU_shader_uniform_vector(dof_shader_pass2, interface->dof_uniform, 4, 1, dof_params);
GPU_shader_uniform_vector(dof_shader_pass2, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
@@ -1184,10 +1184,10 @@ bool GPU_fx_do_composite_pass(
GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_final_buffer, 0, 0);
/* Drawing quad */
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* Rebind Shader */
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
/* *unbind/detach */
GPU_texture_unbind(fx->dof_near_coc_buffer);
@@ -1204,7 +1204,7 @@ bool GPU_fx_do_composite_pass(
GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_blurred_buffer, 0, 0);
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* *unbind/detach */
GPU_texture_compare_mode(fx->depth_buffer, true);
@@ -1223,7 +1223,7 @@ bool GPU_fx_do_composite_pass(
{
GPUDOFPassThreeInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass3);
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(dof_shader_pass3), GPU_shader_get_interface(dof_shader_pass3));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass3), GPU_shader_get_interface(dof_shader_pass3));
GPU_texture_bind(fx->dof_near_coc_buffer, numslots++);
GPU_shader_uniform_texture(dof_shader_pass3, interface->near_coc_downsampled, fx->dof_near_coc_buffer);
@@ -1233,7 +1233,7 @@ bool GPU_fx_do_composite_pass(
GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_final_buffer, 0, 0);
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* disable bindings */
GPU_texture_unbind(fx->dof_near_coc_buffer);
GPU_texture_unbind(fx->dof_near_coc_blurred_buffer);
@@ -1251,7 +1251,7 @@ bool GPU_fx_do_composite_pass(
GPUDOFPassFourInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass4);
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(dof_shader_pass4), GPU_shader_get_interface(dof_shader_pass4));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass4), GPU_shader_get_interface(dof_shader_pass4));
GPU_texture_bind(fx->dof_near_coc_final_buffer, numslots++);
GPU_shader_uniform_texture(dof_shader_pass4, interface->near_coc_downsampled, fx->dof_near_coc_final_buffer);
@@ -1259,7 +1259,7 @@ bool GPU_fx_do_composite_pass(
GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_buffer, 0, 0);
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* disable bindings */
GPU_texture_unbind(fx->dof_near_coc_final_buffer);
@@ -1276,7 +1276,7 @@ bool GPU_fx_do_composite_pass(
GPUDOFPassFiveInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass5);
- Batch_set_program(fx->quad_batch, GPU_shader_get_program(dof_shader_pass5), GPU_shader_get_interface(dof_shader_pass5));
+ GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass5), GPU_shader_get_interface(dof_shader_pass5));
GPU_shader_uniform_vector(dof_shader_pass5, interface->dof_uniform, 4, 1, dof_params);
GPU_shader_uniform_vector(dof_shader_pass5, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
@@ -1299,7 +1299,7 @@ bool GPU_fx_do_composite_pass(
/* if this is the last pass, prepare for rendering on the frambuffer */
gpu_fx_bind_render_target(&passes_left, fx, ofs, target);
- Batch_draw(fx->quad_batch);
+ GWN_batch_draw(fx->quad_batch);
/* disable bindings */
GPU_texture_unbind(fx->dof_near_coc_buffer);
GPU_texture_unbind(fx->dof_near_coc_blurred_buffer);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 529727b5e17..9ed6f387e90 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -2369,7 +2369,7 @@ static GPUAttribStack state = {
};
#define AttribStack state
-#define Attrib state.attrib_stack[state.top]
+#define Gwn_VertAttr state.attrib_stack[state.top]
/**
* Replacement for glPush/PopAttributes
@@ -2379,48 +2379,48 @@ static GPUAttribStack state = {
*/
void gpuPushAttrib(eGPUAttribMask mask)
{
- Attrib.mask = mask;
+ Gwn_VertAttr.mask = mask;
if ((mask & GPU_DEPTH_BUFFER_BIT) != 0) {
- Attrib.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
- glGetIntegerv(GL_DEPTH_FUNC, &Attrib.depth_func);
- glGetDoublev(GL_DEPTH_CLEAR_VALUE, &Attrib.depth_clear_value);
- glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&Attrib.depth_write_mask);
+ Gwn_VertAttr.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
+ glGetIntegerv(GL_DEPTH_FUNC, &Gwn_VertAttr.depth_func);
+ glGetDoublev(GL_DEPTH_CLEAR_VALUE, &Gwn_VertAttr.depth_clear_value);
+ glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&Gwn_VertAttr.depth_write_mask);
}
if ((mask & GPU_ENABLE_BIT) != 0) {
- Attrib.is_blend = glIsEnabled(GL_BLEND);
+ Gwn_VertAttr.is_blend = glIsEnabled(GL_BLEND);
for (int i = 0; i < 6; i++) {
- Attrib.is_clip_plane[i] = glIsEnabled(GL_CLIP_PLANE0 + i);
+ Gwn_VertAttr.is_clip_plane[i] = glIsEnabled(GL_CLIP_PLANE0 + i);
}
- Attrib.is_cull_face = glIsEnabled(GL_CULL_FACE);
- Attrib.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
- Attrib.is_dither = glIsEnabled(GL_DITHER);
- Attrib.is_line_smooth = glIsEnabled(GL_LINE_SMOOTH);
- Attrib.is_color_logic_op = glIsEnabled(GL_COLOR_LOGIC_OP);
- Attrib.is_multisample = glIsEnabled(GL_MULTISAMPLE);
- Attrib.is_polygon_offset_line = glIsEnabled(GL_POLYGON_OFFSET_LINE);
- Attrib.is_polygon_offset_fill = glIsEnabled(GL_POLYGON_OFFSET_FILL);
- Attrib.is_polygon_smooth = glIsEnabled(GL_POLYGON_SMOOTH);
- Attrib.is_sample_alpha_to_coverage = glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE);
- Attrib.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
- Attrib.is_stencil_test = glIsEnabled(GL_STENCIL_TEST);
+ Gwn_VertAttr.is_cull_face = glIsEnabled(GL_CULL_FACE);
+ Gwn_VertAttr.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
+ Gwn_VertAttr.is_dither = glIsEnabled(GL_DITHER);
+ Gwn_VertAttr.is_line_smooth = glIsEnabled(GL_LINE_SMOOTH);
+ Gwn_VertAttr.is_color_logic_op = glIsEnabled(GL_COLOR_LOGIC_OP);
+ Gwn_VertAttr.is_multisample = glIsEnabled(GL_MULTISAMPLE);
+ Gwn_VertAttr.is_polygon_offset_line = glIsEnabled(GL_POLYGON_OFFSET_LINE);
+ Gwn_VertAttr.is_polygon_offset_fill = glIsEnabled(GL_POLYGON_OFFSET_FILL);
+ Gwn_VertAttr.is_polygon_smooth = glIsEnabled(GL_POLYGON_SMOOTH);
+ Gwn_VertAttr.is_sample_alpha_to_coverage = glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ Gwn_VertAttr.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
+ Gwn_VertAttr.is_stencil_test = glIsEnabled(GL_STENCIL_TEST);
}
if ((mask & GPU_SCISSOR_BIT) != 0) {
- Attrib.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
- glGetIntegerv(GL_SCISSOR_BOX, (GLint *)&Attrib.scissor_box);
+ Gwn_VertAttr.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
+ glGetIntegerv(GL_SCISSOR_BOX, (GLint *)&Gwn_VertAttr.scissor_box);
}
if ((mask & GPU_VIEWPORT_BIT) != 0) {
- glGetDoublev(GL_DEPTH_RANGE, (GLdouble *)&Attrib.near_far);
- glGetIntegerv(GL_VIEWPORT, (GLint *)&Attrib.viewport);
+ glGetDoublev(GL_DEPTH_RANGE, (GLdouble *)&Gwn_VertAttr.near_far);
+ glGetIntegerv(GL_VIEWPORT, (GLint *)&Gwn_VertAttr.viewport);
}
if ((mask & GPU_BLEND_BIT) != 0) {
- Attrib.is_blend = glIsEnabled(GL_BLEND);
+ Gwn_VertAttr.is_blend = glIsEnabled(GL_BLEND);
}
BLI_assert(AttribStack.top < STATE_STACK_DEPTH);
@@ -2441,52 +2441,52 @@ void gpuPopAttrib(void)
BLI_assert(AttribStack.top > 0);
AttribStack.top--;
- GLint mask = Attrib.mask;
+ GLint mask = Gwn_VertAttr.mask;
if ((mask & GPU_DEPTH_BUFFER_BIT) != 0) {
- restore_mask(GL_DEPTH_TEST, Attrib.is_depth_test);
- glDepthFunc(Attrib.depth_func);
- glClearDepth(Attrib.depth_clear_value);
- glDepthMask(Attrib.depth_write_mask);
+ restore_mask(GL_DEPTH_TEST, Gwn_VertAttr.is_depth_test);
+ glDepthFunc(Gwn_VertAttr.depth_func);
+ glClearDepth(Gwn_VertAttr.depth_clear_value);
+ glDepthMask(Gwn_VertAttr.depth_write_mask);
}
if ((mask & GPU_ENABLE_BIT) != 0) {
- restore_mask(GL_BLEND, Attrib.is_blend);
+ restore_mask(GL_BLEND, Gwn_VertAttr.is_blend);
for (int i = 0; i < 6; i++) {
- restore_mask(GL_CLIP_PLANE0 + i, Attrib.is_clip_plane[i]);
+ restore_mask(GL_CLIP_PLANE0 + i, Gwn_VertAttr.is_clip_plane[i]);
}
- restore_mask(GL_CULL_FACE, Attrib.is_cull_face);
- restore_mask(GL_DEPTH_TEST, Attrib.is_depth_test);
- restore_mask(GL_DITHER, Attrib.is_dither);
- restore_mask(GL_LINE_SMOOTH, Attrib.is_line_smooth);
- restore_mask(GL_COLOR_LOGIC_OP, Attrib.is_color_logic_op);
- restore_mask(GL_MULTISAMPLE, Attrib.is_multisample);
- restore_mask(GL_POLYGON_OFFSET_LINE, Attrib.is_polygon_offset_line);
- restore_mask(GL_POLYGON_OFFSET_FILL, Attrib.is_polygon_offset_fill);
- restore_mask(GL_POLYGON_SMOOTH, Attrib.is_polygon_smooth);
- restore_mask(GL_SAMPLE_ALPHA_TO_COVERAGE, Attrib.is_sample_alpha_to_coverage);
- restore_mask(GL_SCISSOR_TEST, Attrib.is_scissor_test);
- restore_mask(GL_STENCIL_TEST, Attrib.is_stencil_test);
+ restore_mask(GL_CULL_FACE, Gwn_VertAttr.is_cull_face);
+ restore_mask(GL_DEPTH_TEST, Gwn_VertAttr.is_depth_test);
+ restore_mask(GL_DITHER, Gwn_VertAttr.is_dither);
+ restore_mask(GL_LINE_SMOOTH, Gwn_VertAttr.is_line_smooth);
+ restore_mask(GL_COLOR_LOGIC_OP, Gwn_VertAttr.is_color_logic_op);
+ restore_mask(GL_MULTISAMPLE, Gwn_VertAttr.is_multisample);
+ restore_mask(GL_POLYGON_OFFSET_LINE, Gwn_VertAttr.is_polygon_offset_line);
+ restore_mask(GL_POLYGON_OFFSET_FILL, Gwn_VertAttr.is_polygon_offset_fill);
+ restore_mask(GL_POLYGON_SMOOTH, Gwn_VertAttr.is_polygon_smooth);
+ restore_mask(GL_SAMPLE_ALPHA_TO_COVERAGE, Gwn_VertAttr.is_sample_alpha_to_coverage);
+ restore_mask(GL_SCISSOR_TEST, Gwn_VertAttr.is_scissor_test);
+ restore_mask(GL_STENCIL_TEST, Gwn_VertAttr.is_stencil_test);
}
if ((mask & GPU_VIEWPORT_BIT) != 0) {
- glViewport(Attrib.viewport[0], Attrib.viewport[1], Attrib.viewport[2], Attrib.viewport[3]);
- glDepthRange(Attrib.near_far[0], Attrib.near_far[1]);
+ glViewport(Gwn_VertAttr.viewport[0], Gwn_VertAttr.viewport[1], Gwn_VertAttr.viewport[2], Gwn_VertAttr.viewport[3]);
+ glDepthRange(Gwn_VertAttr.near_far[0], Gwn_VertAttr.near_far[1]);
}
if ((mask & GPU_SCISSOR_BIT) != 0) {
- restore_mask(GL_SCISSOR_TEST, Attrib.is_scissor_test);
- glScissor(Attrib.scissor_box[0], Attrib.scissor_box[1], Attrib.scissor_box[2], Attrib.scissor_box[3]);
+ restore_mask(GL_SCISSOR_TEST, Gwn_VertAttr.is_scissor_test);
+ glScissor(Gwn_VertAttr.scissor_box[0], Gwn_VertAttr.scissor_box[1], Gwn_VertAttr.scissor_box[2], Gwn_VertAttr.scissor_box[3]);
}
if ((mask & GPU_BLEND_BIT) != 0) {
- restore_mask(GL_BLEND, Attrib.is_blend);
+ restore_mask(GL_BLEND, Gwn_VertAttr.is_blend);
}
}
-#undef Attrib
+#undef Gwn_VertAttr
#undef AttribStack
/** \} */
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 96c740410c5..d791f839e20 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -448,9 +448,9 @@ void GPU_framebuffer_blur(
const float fullscreencos[4][2] = {{-1.0f, -1.0f}, {1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}};
const float fullscreenuvs[4][2] = {{0.0f, 0.0f}, {1.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}};
- static VertexFormat format = {0};
- static VertexBuffer vbo = {{0}};
- static Batch batch = {{0}};
+ static Gwn_VertFormat format = {0};
+ static Gwn_VertBuf vbo = {{0}};
+ static Gwn_Batch batch = {{0}};
const float scaleh[2] = {1.0f / GPU_texture_width(blurtex), 0.0f};
const float scalev[2] = {0.0f, 1.0f / GPU_texture_height(tex)};
@@ -464,23 +464,23 @@ void GPU_framebuffer_blur(
if (format.attrib_ct == 0) {
unsigned int i = 0;
/* Vertex format */
- unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int uvs = VertexFormat_add_attrib(&format, "uvs", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int uvs = GWN_vertformat_attr_add(&format, "uvs", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
/* Vertices */
- VertexBuffer_init_with_format(&vbo, &format);
- VertexBuffer_allocate_data(&vbo, 36);
+ GWN_vertbuf_init_with_format(&vbo, &format);
+ GWN_vertbuf_data_alloc(&vbo, 36);
for (int j = 0; j < 3; ++j) {
- VertexBuffer_set_attrib(&vbo, uvs, i, fullscreenuvs[j]);
- VertexBuffer_set_attrib(&vbo, pos, i++, fullscreencos[j]);
+ GWN_vertbuf_attr_set(&vbo, uvs, i, fullscreenuvs[j]);
+ GWN_vertbuf_attr_set(&vbo, pos, i++, fullscreencos[j]);
}
for (int j = 1; j < 4; ++j) {
- VertexBuffer_set_attrib(&vbo, uvs, i, fullscreenuvs[j]);
- VertexBuffer_set_attrib(&vbo, pos, i++, fullscreencos[j]);
+ GWN_vertbuf_attr_set(&vbo, uvs, i, fullscreenuvs[j]);
+ GWN_vertbuf_attr_set(&vbo, pos, i++, fullscreencos[j]);
}
- Batch_init(&batch, GL_TRIANGLES, &vbo, NULL);
+ GWN_batch_init(&batch, GL_TRIANGLES, &vbo, NULL);
}
glDisable(GL_DEPTH_TEST);
@@ -499,9 +499,9 @@ void GPU_framebuffer_blur(
GPU_texture_bind(tex, 0);
Batch_set_builtin_program(&batch, GPU_SHADER_SEP_GAUSSIAN_BLUR);
- Batch_Uniform2f(&batch, "ScaleU", scaleh[0], scaleh[1]);
- Batch_Uniform1i(&batch, "textureSource", GL_TEXTURE0);
- Batch_draw(&batch);
+ GWN_batch_uniform_2f(&batch, "ScaleU", scaleh[0], scaleh[1]);
+ GWN_batch_uniform_1i(&batch, "textureSource", GL_TEXTURE0);
+ GWN_batch_draw(&batch);
/* Blurring vertically */
glBindFramebuffer(GL_FRAMEBUFFER, fb->object);
@@ -515,9 +515,9 @@ void GPU_framebuffer_blur(
/* Hack to make the following uniform stick */
Batch_set_builtin_program(&batch, GPU_SHADER_SEP_GAUSSIAN_BLUR);
- Batch_Uniform2f(&batch, "ScaleU", scalev[0], scalev[1]);
- Batch_Uniform1i(&batch, "textureSource", GL_TEXTURE0);
- Batch_draw(&batch);
+ GWN_batch_uniform_2f(&batch, "ScaleU", scalev[0], scalev[1]);
+ GWN_batch_uniform_1i(&batch, "textureSource", GL_TEXTURE0);
+ GWN_batch_draw(&batch);
}
void GPU_framebuffer_blit(GPUFrameBuffer *fb_read, int read_slot, GPUFrameBuffer *fb_write, int write_slot, bool use_depth)
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index 40da4cf091b..a4e54d15034 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -51,7 +51,7 @@ void imm_cpack(unsigned int x)
(((x) >> 16) & 0xFF));
}
-static void imm_draw_circle(PrimitiveType prim_type, const uint shdr_pos, float x, float y, float rad, int nsegments)
+static void imm_draw_circle(Gwn_PrimType prim_type, const uint shdr_pos, float x, float y, float rad, int nsegments)
{
immBegin(prim_type, nsegments);
for (int i = 0; i < nsegments; ++i) {
@@ -73,7 +73,7 @@ static void imm_draw_circle(PrimitiveType prim_type, const uint shdr_pos, float
*/
void imm_draw_circle_wire(uint shdr_pos, float x, float y, float rad, int nsegments)
{
- imm_draw_circle(PRIM_LINE_LOOP, shdr_pos, x, y, rad, nsegments);
+ imm_draw_circle(GWN_PRIM_LINE_LOOP, shdr_pos, x, y, rad, nsegments);
}
/**
@@ -88,14 +88,14 @@ void imm_draw_circle_wire(uint shdr_pos, float x, float y, float rad, int nsegme
*/
void imm_draw_circle_fill(uint shdr_pos, float x, float y, float rad, int nsegments)
{
- imm_draw_circle(PRIM_TRIANGLE_FAN, shdr_pos, x, y, rad, nsegments);
+ imm_draw_circle(GWN_PRIM_TRI_FAN, shdr_pos, x, y, rad, nsegments);
}
/**
* \note We could have `imm_draw_lined_disk_partial` but currently there is no need.
*/
static void imm_draw_disk_partial(
- PrimitiveType prim_type, unsigned pos, float x, float y,
+ Gwn_PrimType prim_type, unsigned pos, float x, float y,
float rad_inner, float rad_outer, int nsegments, float start, float sweep)
{
/* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */
@@ -132,11 +132,11 @@ void imm_draw_disk_partial_fill(
unsigned pos, float x, float y,
float rad_inner, float rad_outer, int nsegments, float start, float sweep)
{
- imm_draw_disk_partial(PRIM_TRIANGLE_STRIP, pos, x, y, rad_inner, rad_outer, nsegments, start, sweep);
+ imm_draw_disk_partial(GWN_PRIM_TRI_STRIP, pos, x, y, rad_inner, rad_outer, nsegments, start, sweep);
}
static void imm_draw_circle_3D(
- PrimitiveType prim_type, unsigned pos, float x, float y,
+ Gwn_PrimType prim_type, unsigned pos, float x, float y,
float rad, int nsegments)
{
immBegin(prim_type, nsegments);
@@ -149,12 +149,12 @@ static void imm_draw_circle_3D(
void imm_draw_circle_wire_3d(unsigned pos, float x, float y, float rad, int nsegments)
{
- imm_draw_circle_3D(PRIM_LINE_LOOP, pos, x, y, rad, nsegments);
+ imm_draw_circle_3D(GWN_PRIM_LINE_LOOP, pos, x, y, rad, nsegments);
}
void imm_draw_circle_fill_3d(unsigned pos, float x, float y, float rad, int nsegments)
{
- imm_draw_circle_3D(PRIM_TRIANGLE_FAN, pos, x, y, rad, nsegments);
+ imm_draw_circle_3D(GWN_PRIM_TRI_FAN, pos, x, y, rad, nsegments);
}
/**
@@ -168,7 +168,7 @@ void imm_draw_circle_fill_3d(unsigned pos, float x, float y, float rad, int nseg
*/
void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2)
{
- immBegin(PRIM_LINE_LOOP, 4);
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex2f(pos, x1, y1);
immVertex2f(pos, x1, y2);
immVertex2f(pos, x2, y2);
@@ -178,8 +178,8 @@ void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2)
void imm_draw_line_box_3d(unsigned pos, float x1, float y1, float x2, float y2)
{
- /* use this version when VertexFormat has a vec3 position */
- immBegin(PRIM_LINE_LOOP, 4);
+ /* use this version when Gwn_VertFormat has a vec3 position */
+ immBegin(GWN_PRIM_LINE_LOOP, 4);
immVertex3f(pos, x1, y1, 0.0f);
immVertex3f(pos, x1, y2, 0.0f);
immVertex3f(pos, x2, y2, 0.0f);
@@ -192,7 +192,7 @@ void imm_draw_line_box_3d(unsigned pos, float x1, float y1, float x2, float y2)
*/
void imm_draw_checker_box(float x1, float y1, float x2, float y2)
{
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_CHECKER);
immUniform4f("color1", 0.15f, 0.15f, 0.15f, 1.0f);
@@ -219,7 +219,7 @@ void imm_draw_checker_box(float x1, float y1, float x2, float y2)
void imm_draw_cylinder_fill_normal_3d(
unsigned int pos, unsigned int nor, float base, float top, float height, int slices, int stacks)
{
- immBegin(PRIM_TRIANGLES, 6 * slices * stacks);
+ immBegin(GWN_PRIM_TRIS, 6 * slices * stacks);
for (int i = 0; i < slices; ++i) {
const float angle1 = 2 * M_PI * ((float)i / (float)slices);
const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices);
@@ -270,7 +270,7 @@ void imm_draw_cylinder_fill_normal_3d(
void imm_draw_cylinder_wire_3d(unsigned int pos, float base, float top, float height, int slices, int stacks)
{
- immBegin(PRIM_LINES, 6 * slices * stacks);
+ immBegin(GWN_PRIM_LINES, 6 * slices * stacks);
for (int i = 0; i < slices; ++i) {
const float angle1 = 2 * M_PI * ((float)i / (float)slices);
const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices);
@@ -307,7 +307,7 @@ void imm_draw_cylinder_wire_3d(unsigned int pos, float base, float top, float he
void imm_draw_cylinder_fill_3d(unsigned int pos, float base, float top, float height, int slices, int stacks)
{
- immBegin(PRIM_TRIANGLES, 6 * slices * stacks);
+ immBegin(GWN_PRIM_TRIS, 6 * slices * stacks);
for (int i = 0; i < slices; ++i) {
const float angle1 = 2 * M_PI * ((float)i / (float)slices);
const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices);
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c
index 775d1cd87b2..f03a076a9fd 100644
--- a/source/blender/gpu/intern/gpu_matrix.c
+++ b/source/blender/gpu/intern/gpu_matrix.c
@@ -554,20 +554,20 @@ const float (*gpuGetNormalMatrixInverse(float m[3][3]))[3]
return m;
}
-void gpuBindMatrices(const ShaderInterface* shaderface)
+void gpuBindMatrices(const Gwn_ShaderInterface* shaderface)
{
/* set uniform values to matrix stack values
* call this before a draw call if desired matrices are dirty
* call glUseProgram before this, as glUniform expects program to be bound
*/
- const ShaderInput *MV = ShaderInterface_builtin_uniform(shaderface, UNIFORM_MODELVIEW);
- const ShaderInput *P = ShaderInterface_builtin_uniform(shaderface, UNIFORM_PROJECTION);
- const ShaderInput *MVP = ShaderInterface_builtin_uniform(shaderface, UNIFORM_MVP);
+ const Gwn_ShaderInput *MV = GWN_shaderinterface_uniform_builtin(shaderface, GWN_UNIFORM_MODELVIEW);
+ const Gwn_ShaderInput *P = GWN_shaderinterface_uniform_builtin(shaderface, GWN_UNIFORM_PROJECTION);
+ const Gwn_ShaderInput *MVP = GWN_shaderinterface_uniform_builtin(shaderface, GWN_UNIFORM_MVP);
- const ShaderInput *N = ShaderInterface_builtin_uniform(shaderface, UNIFORM_NORMAL);
- const ShaderInput *MV_inv = ShaderInterface_builtin_uniform(shaderface, UNIFORM_MODELVIEW_INV);
- const ShaderInput *P_inv = ShaderInterface_builtin_uniform(shaderface, UNIFORM_PROJECTION_INV);
+ const Gwn_ShaderInput *N = GWN_shaderinterface_uniform_builtin(shaderface, GWN_UNIFORM_NORMAL);
+ const Gwn_ShaderInput *MV_inv = GWN_shaderinterface_uniform_builtin(shaderface, GWN_UNIFORM_MODELVIEW_INV);
+ const Gwn_ShaderInput *P_inv = GWN_shaderinterface_uniform_builtin(shaderface, GWN_UNIFORM_PROJECTION_INV);
if (MV) {
#if DEBUG_MATRIX_BIND
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 24eb88d0114..f0a1c182713 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -426,24 +426,24 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode,
return NULL;
}
- shader->interface = ShaderInterface_create(shader->program);
+ shader->interface = GWN_shaderinterface_create(shader->program);
#ifdef WITH_OPENSUBDIV
/* TODO(sergey): Find a better place for this. */
if (use_opensubdiv) {
if (GLEW_VERSION_4_1) {
glProgramUniform1i(shader->program,
- ShaderInterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location,
+ GWN_shaderinterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location,
30); /* GL_TEXTURE30 */
glProgramUniform1i(shader->program,
- ShaderInterface_uniform(shader->interface, "FVarDataBuffer")->location,
+ GWN_shaderinterface_uniform(shader->interface, "FVarDataBuffer")->location,
31); /* GL_TEXTURE31 */
}
else {
glUseProgram(shader->program);
- glUniform1i(ShaderInterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location, 30);
- glUniform1i(ShaderInterface_uniform(shader->interface, "FVarDataBuffer")->location, 31);
+ glUniform1i(GWN_shaderinterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location, 30);
+ glUniform1i(GWN_shaderinterface_uniform(shader->interface, "FVarDataBuffer")->location, 31);
glUseProgram(0);
}
}
@@ -482,7 +482,7 @@ void GPU_shader_free(GPUShader *shader)
MEM_freeN(shader->uniform_interface);
if (shader->interface)
- ShaderInterface_discard(shader->interface);
+ GWN_shaderinterface_discard(shader->interface);
MEM_freeN(shader);
}
@@ -490,7 +490,7 @@ void GPU_shader_free(GPUShader *shader)
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
{
BLI_assert(shader && shader->program);
- const ShaderInput *uniform = ShaderInterface_uniform(shader->interface, name);
+ const Gwn_ShaderInput *uniform = GWN_shaderinterface_uniform(shader->interface, name);
return uniform ? uniform->location : -1;
}
@@ -599,7 +599,7 @@ void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUText
int GPU_shader_get_attribute(GPUShader *shader, const char *name)
{
BLI_assert(shader && shader->program);
- const ShaderInput *attrib = ShaderInterface_attrib(shader->interface, name);
+ const Gwn_ShaderInput *attrib = GWN_shaderinterface_attr(shader->interface, name);
return attrib ? attrib->location : -1;
}
diff --git a/source/blender/gpu/intern/gpu_shader_private.h b/source/blender/gpu/intern/gpu_shader_private.h
index c0c24187da5..2de05b5746b 100644
--- a/source/blender/gpu/intern/gpu_shader_private.h
+++ b/source/blender/gpu/intern/gpu_shader_private.h
@@ -38,7 +38,7 @@ struct GPUShader {
void *uniform_interface; /* cached uniform interface for shader. Data depends on shader */
/* NOTE: ^-- only FX compositing shaders use this */
- ShaderInterface *interface; /* cached uniform & attrib interface for shader */
+ Gwn_ShaderInterface *interface; /* cached uniform & attrib interface for shader */
};
#endif /* __GPU_SHADER_PRIVATE_H__ */
diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c
index 50d2f1e6b18..9bd990e9796 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -399,16 +399,16 @@ static void draw_ofs_to_screen(GPUViewport *viewport)
const float w = (float)GPU_texture_width(color);
const float h = (float)GPU_texture_height(color);
- VertexFormat *format = immVertexFormat();
- unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA);
GPU_texture_bind(color, 0);
immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
- immBegin(PRIM_TRIANGLE_STRIP, 4);
+ immBegin(GWN_PRIM_TRI_STRIP, 4);
immAttrib2f(texcoord, 0.0f, 0.0f);
immVertex2f(pos, 0.0f, 0.0f);
@@ -535,9 +535,9 @@ void GPU_viewport_debug_depth_draw(GPUViewport *viewport, const float znear, con
const float w = (float)GPU_texture_width(viewport->debug_depth);
const float h = (float)GPU_texture_height(viewport->debug_depth);
- VertexFormat *format = immVertexFormat();
- unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_DEPTH);
@@ -547,7 +547,7 @@ void GPU_viewport_debug_depth_draw(GPUViewport *viewport, const float znear, con
immUniform1f("zfar", zfar);
immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
- immBegin(PRIM_TRIANGLE_STRIP, 4);
+ immBegin(GWN_PRIM_TRI_STRIP, 4);
immAttrib2f(texcoord, 0.0f, 0.0f);
immVertex2f(pos, 0.0f, 0.0f);
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 5be3429f2de..7aaed4086ed 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -441,9 +441,9 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
halfy /= triple->y;
#endif
- VertexFormat *format = immVertexFormat();
- unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
const int activeTex = 7; /* arbitrary */
glActiveTexture(GL_TEXTURE0 + activeTex);
@@ -460,7 +460,7 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
immUniform1f("alpha", alpha);
immUniform1i("image", activeTex);
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texcoord, halfx, halfy);
immVertex2f(pos, 0.0f, 0.0f);
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 92215757d88..1ffe96181f0 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -172,7 +172,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
- uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -187,7 +187,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
float xmin = (float)rect->xmin;
float ymin = (float)rect->ymin;
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(shdr_pos, xmin, ymin);
immVertex2f(shdr_pos, (float)rect->xmax, (float)rect->ymax);
immEnd();
@@ -199,7 +199,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
- uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
+ uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
glEnable(GL_BLEND);
@@ -212,7 +212,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
glDisable(GL_BLEND);
- shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -237,7 +237,7 @@ static void wm_gesture_draw_circle(wmGesture *gt)
glEnable(GL_BLEND);
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -353,7 +353,7 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
return;
}
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -365,7 +365,7 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 2.0f);
- immBegin((gt->type == WM_GESTURE_LASSO) ? PRIM_LINE_LOOP : PRIM_LINE_STRIP, numverts);
+ immBegin((gt->type == WM_GESTURE_LASSO) ? GWN_PRIM_LINE_LOOP : GWN_PRIM_LINE_STRIP, numverts);
for (i = 0; i < gt->points; i++, lasso += 2) {
immVertex2f(shdr_pos, (float)lasso[0], (float)lasso[1]);
@@ -384,7 +384,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
float x1, x2, y1, y2;
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
@@ -396,7 +396,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 8.0f);
- immBegin(PRIM_LINES, 4);
+ immBegin(GWN_PRIM_LINES, 4);
x1 = (float)(rect->xmin - winsize_x);
y1 = (float)rect->ymin;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index f925f22e878..5001fc7817f 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3071,12 +3071,12 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
RNA_property_float_get_array(fill_ptr, fill_prop, col);
}
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
if (rc->gltex) {
- unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
glBindTexture(GL_TEXTURE_2D, rc->gltex);
@@ -3099,7 +3099,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
}
/* draw textured quad */
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texCoord, 0, 0);
immVertex2f(pos, -radius, -radius);
@@ -3203,8 +3203,8 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
if (rc->col_prop)
RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col);
- VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3fvAlpha(col, 0.5f);
@@ -3214,14 +3214,14 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
/* draw original angle line */
gpuRotate2D(RAD2DEGF(rc->initial_value));
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
/* draw new angle line */
gpuRotate2D(RAD2DEGF(rc->current_value - rc->initial_value));
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 434c6414c01..445516ffda7 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -364,12 +364,12 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
gpuPushMatrix();
gpuLoadIdentity();
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ub(0, 255, 0);
- immBegin(PRIM_LINES, 2);
+ immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, fac, -1.0f);
immVertex2f(pos, fac, 1.0f);
immEnd();
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index f8c4639c1b1..1e63a0e4483 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -115,9 +115,9 @@ static void wm_method_draw_stereo3d_interlace(wmWindow *win)
float halfx = GLA_PIXEL_OFS;
float halfy = GLA_PIXEL_OFS;
- VertexFormat *format = immVertexFormat();
- unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_INTERLACE);
@@ -132,7 +132,7 @@ static void wm_method_draw_stereo3d_interlace(wmWindow *win)
immUniform1i("interlace_id", interlace_gpu_id_from_type(interlace_type));
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texcoord, halfx, halfy);
immVertex2f(pos, 0.0f, 0.0f);
@@ -199,9 +199,9 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
int soffx;
bool cross_eyed = (win->stereo3d_format->flag & S3D_SIDEBYSIDE_CROSSEYED) != 0;
- VertexFormat *format = immVertexFormat();
- unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
for (view = 0; view < 2; view ++) {
drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);
@@ -242,7 +242,7 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
immUniform1f("alpha", 1.0f);
immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texcoord, halfx, halfy);
immVertex2f(pos, soffx, 0.0f);
@@ -272,9 +272,9 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
int view;
int soffy;
- VertexFormat *format = immVertexFormat();
- unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
for (view = 0; view < 2; view ++) {
drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);
@@ -312,7 +312,7 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
immUniform1f("alpha", 1.0f);
immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib2f(texcoord, halfx, halfy);
immVertex2f(pos, 0.0f, soffy);