Orkid GeometryBufferInterface (GBI) Reference
When answering questions about geometry, vertex buffers, or draw calls in orkid, consult the files below. All under ork.lev2/.
Key Files
| Component | File |
|-----------|------|
| GBI Interface | inc/ork/lev2/gfx/gbi.h (lines 18–152) |
| Vertex/Index Buffers | inc/ork/lev2/gfx/gfxvtxbuf.h |
| Vertex Format Structs | inc/ork/lev2/gfx/gfxvtxbuf_structs.h |
| Vertex Buffer Inline | inc/ork/lev2/gfx/gfxvtxbuf.inl |
| Enums (formats, primitives) | inc/ork/lev2/gfx/gfxenv_enum.h |
| Base Implementation | src/gfx/context/gbi.cpp |
| Vulkan GBI | src/gfx/vulkan/vulkan_gbi.cpp |
| Python Bindings | pyext/src/pyext_gfx.cpp (lines 259–370) |
GBI Interface (gbi.h:18–152)
Vertex Buffer Operations
LockVB(VBuf, ivbase, icount)→void*— lock for writingUnLockVB(VBuf)— unlock after writingReleaseVB(VBuf)— release GPU resourcesFlushVB(VBuf)— flush to GPU
Index Buffer Operations
LockIB(IBuf, ibase, icount)→void*UnLockIB(IBuf)ReleaseIB(IBuf)
Draw Methods (EML — direct, no material management)
DrawPrimitiveEML(VBuf, type, ivbase, ivcount)— from vertex bufferDrawPrimitiveEML(SSBO, type, ivbase, ivcount)— from storage bufferDrawIndexedPrimitiveEML(VBuf, IdxBuf, type)— indexed drawDrawInstancedIndexedPrimitiveEML(VBuf, IdxBuf, type, instance_count)— instancedDrawInstancedIndexedPrimitiveEML(VBuf, IdxBuf, type, instance_count, first_instance)— with offset
Draw Methods (with material)
DrawPrimitive(GfxMaterial*, VtxWriter, type, icount)— from writerDrawPrimitive(GfxMaterial*, VBuf, type, ivbase, ivcount)— from bufferDrawIndexedPrimitive(GfxMaterial*, VBuf, IdxBuf, type)— indexed
2D Helpers
render2dQuadEML(quadrect, uvrecta, uvrectb, depth)— screen-space quadrender2dQuadEMLCCL(quadrect, uvrecta, uvrectb, depth)— CCL variant
PrimitiveType (gfxenv_enum.h:165–178)
| Type | Description |
|------|-------------|
| POINTS | Point list |
| LINES | Line list |
| LINESTRIP | Connected line strip |
| LINELOOP | Closed line loop |
| TRIANGLES | Triangle list |
| TRIANGLESTRIP | Triangle strip |
| TRIANGLEFAN | Triangle fan |
| QUADS | Quad list |
| PATCHES | Tessellation patches |
Vertex Format Structs (gfxvtxbuf_structs.h)
| Struct | BPV | Components |
|--------|-----|-----------|
| VtxV12C4 | 16 | position(3f) + color(u32) |
| SVtxV12C4T16 | 32 | position(3f) + color(u32) + uv0(2f) + uv1(2f) |
| SVtxV12N12B12T8C4 | 48 | position(3f) + normal(3f) + binormal(3f) + uv(2f) + color(u32) |
| SVtxV12N12B12T16 | 52 | position(3f) + normal(3f) + binormal(3f) + uv0(2f) + uv1(2f) |
| SVtxV12N12T8I4W4 | 40 | position(3f) + normal(3f) + uv(2f) + boneIndices(u32) + boneWeights(u32) |
| SVtxV16T16C16 | 48 | position(4f) + texcoord(4f) + color(4f) |
EVtxStreamFormat enum (gfxenv_enum.h:350–401)
Compact format identifiers: V12, V12C4, V12T8, V12C4T16, V12N12B12T8C4, V12N12B12T16, V12N12T8I4W4, V16T16C16, VU32, VU32INST, etc.
Vertex Buffers (gfxvtxbuf.h)
VertexBufferBase (line 79)
GetMax(),GetNumVertices(),GetVtxSize()GetStreamFormat()→EVtxStreamFormatIsStatic()— pure virtualIsLocked(),Lock(),Unlock()CreateVertexBuffer(format, numverts, static)— factory
Typed Buffers
CVtxBuffer<T>— base typed bufferStaticVertexBuffer<T>— GPU-resident, write-onceDynamicVertexBuffer<T>— CPU-writable each frame
Common Aliases
using dvb_V12C4T16 = DynamicVertexBuffer<SVtxV12C4T16>;
using dvb_V12N12B12T8C4 = DynamicVertexBuffer<SVtxV12N12B12T8C4>;
using dvb_V16T16C16 = DynamicVertexBuffer<SVtxV16T16C16>;
Index Buffers (gfxvtxbuf.h:26–75)
IndexBufferBase— base withGetNumIndices(),indexSize()StaticIndexBuffer<T>— write-onceDynamicIndexBuffer<T>— per-frame writable- Index types: typically
uint16_toruint32_t
VtxWriter (gfxvtxbuf.h:140–163)
Dynamic geometry helper for building vertex data:
VtxWriter<SVtxV12C4T16> writer;
writer.Lock(ctx, &dynVB, vertexCount);
auto& vtx = writer.RefAndIncrement();
vtx._position = fvec3(x, y, z);
vtx._color = 0xFFFFFFFF;
vtx._uv0 = fvec2(u, v);
writer.UnLock(ctx);
ctx->GBI()->DrawPrimitiveEML(writer, PrimitiveType::TRIANGLES);
Members: miWriteBase, miWriteCounter, miWriteMax, mpBase, mpVB
Python API
gbi = ctx.GBI
# VtxWriter
writer = lev2.Writer_V12N12B12T8C4()
# Lock VB for raw access
memview = gbi.lockVB(vb, base, count) # Returns memoryview
gbi.unlockVB(vb)
# Draw from writer
gbi.drawTriangles(writer)
gbi.drawTriangleStrip(writer)
gbi.drawLines(writer)
How to Answer
- For GBI methods: check
gbi.h:18–152 - For vertex formats: check
gfxvtxbuf_structs.h— search by struct name - For buffer types: check
gfxvtxbuf.h(Static/Dynamic) - For primitive types: check
gfxenv_enum.h:165–178 - For Vulkan mapping: check
vulkan_gbi.cpp(topology + vertex stream config) - For Python: check
pyext_gfx.cpp:259–370