mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
opengl: setting buffer data with array must get proper pointer
This finally gets the terminal compiling with the self-hosted Zig compiler! Wow! And this was one of those things that... should've never worked.
This commit is contained in:
@ -40,7 +40,7 @@ pub const Binding = struct {
|
|||||||
data: anytype,
|
data: anytype,
|
||||||
usage: Usage,
|
usage: Usage,
|
||||||
) !void {
|
) !void {
|
||||||
const info = dataInfo(data);
|
const info = dataInfo(&data);
|
||||||
c.glBufferData(@enumToInt(b.target), info.size, info.ptr, @enumToInt(usage));
|
c.glBufferData(@enumToInt(b.target), info.size, info.ptr, @enumToInt(usage));
|
||||||
try errors.getError();
|
try errors.getError();
|
||||||
}
|
}
|
||||||
@ -84,10 +84,6 @@ pub const Binding = struct {
|
|||||||
ptr: *const anyopaque,
|
ptr: *const anyopaque,
|
||||||
} {
|
} {
|
||||||
return switch (@typeInfo(@TypeOf(data))) {
|
return switch (@typeInfo(@TypeOf(data))) {
|
||||||
.Array => .{
|
|
||||||
.size = @sizeOf(@TypeOf(data)),
|
|
||||||
.ptr = &data,
|
|
||||||
},
|
|
||||||
.Pointer => |ptr| switch (ptr.size) {
|
.Pointer => |ptr| switch (ptr.size) {
|
||||||
.One => .{
|
.One => .{
|
||||||
.size = @sizeOf(ptr.child) * data.len,
|
.size = @sizeOf(ptr.child) * data.len,
|
||||||
|
Reference in New Issue
Block a user