Skip to content

Commit 558c070

Browse files
committed
Added missing OpenGL 1.5 buffer functions to wrapper
1 parent 8204237 commit 558c070

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

src/wrapper.zig

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,43 @@ pub fn Wrap(comptime bindings: anytype) type {
12311231
uniform_buffer = UNIFORM_BUFFER,
12321232
};
12331233

1234+
pub const Access = enum(Enum) {
1235+
//--------------------------------------------------------------------------------------
1236+
// OpenGL 1.5 (Core Profile)
1237+
//--------------------------------------------------------------------------------------
1238+
read_only = READ_ONLY,
1239+
write_only = WRITE_ONLY,
1240+
read_write = READ_WRITE,
1241+
};
1242+
1243+
pub const BufferParameter = enum(Enum) {
1244+
//--------------------------------------------------------------------------------------
1245+
// OpenGL 1.5 (Core Profile)
1246+
//--------------------------------------------------------------------------------------
1247+
buffer_size = BUFFER_SIZE,
1248+
buffer_usage = BUFFER_USAGE,
1249+
buffer_access = BUFFER_ACCESS,
1250+
buffer_mapped = BUFFER_MAPPED,
1251+
//--------------------------------------------------------------------------------------
1252+
// OpenGL 3.0 (Core Profile)
1253+
//--------------------------------------------------------------------------------------
1254+
buffer_access_flags = BUFFER_ACCESS_FLAGS,
1255+
buffer_map_offset = BUFFER_MAP_OFFSET,
1256+
buffer_map_length = BUFFER_MAP_LENGTH,
1257+
//--------------------------------------------------------------------------------------
1258+
// OpenGL 4.4 (Core Profile)
1259+
//--------------------------------------------------------------------------------------
1260+
buffer_immutable_storage = BUFFER_IMMUTABLE_STORAGE,
1261+
buffer_storage_flags = BUFFER_STORAGE_FLAGS,
1262+
};
1263+
1264+
pub const BufferPointerParameter = enum(Enum) {
1265+
//--------------------------------------------------------------------------------------
1266+
// OpenGL 1.5 (Core Profile)
1267+
//--------------------------------------------------------------------------------------
1268+
buffer_map_pointer = BUFFER_MAP_POINTER,
1269+
};
1270+
12341271
pub const IndexedBufferTarget = enum(Enum) {
12351272
//--------------------------------------------------------------------------------------
12361273
// OpenGL 3.0 (Core Profile)
@@ -2614,6 +2651,9 @@ pub fn Wrap(comptime bindings: anytype) type {
26142651
}
26152652

26162653
// pub var isBuffer: *const fn (buffer: Uint) callconv(.c) Boolean = undefined;
2654+
pub fn isBuffer(buffer: Buffer) bool {
2655+
return bindings.isBuffer(@intFromEnum(buffer)) == TRUE;
2656+
}
26172657

26182658
// pub var bufferData: *const fn (
26192659
// target: Enum,
@@ -2656,14 +2696,52 @@ pub fn Wrap(comptime bindings: anytype) type {
26562696
// size: Sizeiptr,
26572697
// data: ?*anyopaque,
26582698
// ) callconv(.c) void = undefined;
2699+
pub fn getBufferSubData(
2700+
target: BufferTarget,
2701+
offset: usize,
2702+
size: usize,
2703+
data: ?[*]u8,
2704+
) void {
2705+
bindings.getBufferSubData(
2706+
@intFromEnum(target),
2707+
@as(Intptr, @bitCast(offset)),
2708+
@as(Sizeiptr, @bitCast(size)),
2709+
data,
2710+
);
2711+
}
2712+
26592713
// pub var mapBuffer: *const fn (target: Enum, access: Enum) callconv(.c) ?*anyopaque = undefined;
2714+
pub fn mapBuffer(target: BufferTarget, access: Access) ?[*]u8 {
2715+
return @ptrCast(bindings.mapBuffer(@intFromEnum(target), @intFromEnum(access)));
2716+
}
2717+
26602718
// pub var unmapBuffer: *const fn (target: Enum) callconv(.c) Boolean = undefined;
2719+
pub fn unmapBuffer(target: BufferTarget) bool {
2720+
return bindings.unmapBuffer(@intFromEnum(target)) == TRUE;
2721+
}
2722+
26612723
// pub var getBufferParameteriv: *const fn (target: Enum, pname: Enum, params: [*c]Int) callconv(.c) void = undefined;
2724+
pub fn getBufferParameteriv(target: BufferTarget, pname: BufferParameter, params: []i32) void {
2725+
bindings.getBufferParameteriv(
2726+
@intFromEnum(target),
2727+
@intFromEnum(pname),
2728+
@as([*c]Int, @ptrCast(params.ptr)),
2729+
);
2730+
}
2731+
26622732
// pub var getBufferPointerv: *const fn (
26632733
// target: Enum,
26642734
// pname: Enum,
26652735
// params: [*c]?*anyopaque,
26662736
// ) callconv(.c) void = undefined;
2737+
pub fn getBufferPointerv(target: BufferTarget, pname: BufferPointerParameter, params: *?[*]u8) void {
2738+
bindings.getBufferPointerv(
2739+
@intFromEnum(target),
2740+
@intFromEnum(pname),
2741+
@as([*c]?*anyopaque, @ptrCast(params)),
2742+
);
2743+
}
2744+
26672745
//------------------------------------------------------------------------------------------
26682746
//
26692747
// OpenGL 2.0 (Core Profile)

0 commit comments

Comments
 (0)