all: move standalone libraries to libs/ subdirectory

The root dir of our repository has grown quite a lot the past few months.

I'd like to make it more clear where the bulk of the engine lives (`src/`) and
also make it more clear which Mach libraries are consumable as standalone projects.

As for the name of this directory, `libs` was my first choice but there's a bit of
a convention of that being external libraries in Zig projects _today_, while these
are libraries maintained as part of Mach in this repository - not external ones.

We will name this directory `libs`, and if we have a need for external libraries
we will use `external` or `deps` for that directory name. I considered other names
such as `components`, `systems`, `modules` (which are bad as they overlap with
major ECS / engine concepts), and it seems likely the official Zig package manager
will break the convention of using a `libs` dir anyway.

Performed via:

```sh
mkdir libs/
git mv freetype libs/
git mv basisu libs/
git mv gamemode libs/
git mv glfw libs/
git mv gpu libs/
git mv gpu-dawn libs/
git mv sysaudio libs/
git mv sysjs libs/
git mv ecs libs/
```

git-subtree-dir: glfw
git-subtree-mainline: 0d5b853443
git-subtree-split: 572d1144f11b353abdb64fff828b25a4f0fbb7ca

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>

git mv ecs libs/

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-26 13:29:04 -07:00 committed by Stephen Gutekanst
parent 79ec61396f
commit 0645429df9
240 changed files with 6 additions and 6 deletions

View file

@ -1,104 +0,0 @@
const std = @import("std");
const CommandBuffer = @import("command_buffer.zig").CommandBuffer;
const Buffer = @import("buffer.zig").Buffer;
const Texture = @import("texture.zig").Texture;
const ImageCopyTexture = @import("types.zig").ImageCopyTexture;
const ChainedStruct = @import("types.zig").ChainedStruct;
const Extent3D = @import("types.zig").Extent3D;
const CopyTextureForBrowserOptions = @import("types.zig").CopyTextureForBrowserOptions;
const Impl = @import("interface.zig").Impl;
pub const Queue = opaque {
pub const WorkDoneCallback = if (@import("builtin").zig_backend == .stage1)
fn (
status: WorkDoneStatus,
userdata: ?*anyopaque,
) callconv(.C) void
else
*const fn (
status: WorkDoneStatus,
userdata: ?*anyopaque,
) callconv(.C) void;
pub const WorkDoneStatus = enum(u32) {
success = 0x00000000,
err = 0x00000001,
unknown = 0x00000002,
device_lost = 0x00000003,
};
pub const Descriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
};
pub inline fn copyTextureForBrowser(queue: *Queue, source: *const ImageCopyTexture, destination: *const ImageCopyTexture, copy_size: *const Extent3D, options: *const CopyTextureForBrowserOptions) void {
Impl.queueCopyTextureForBrowser(queue, source, destination, copy_size, options);
}
// TODO: dawn: does not allow unsetting this callback to null
pub inline fn onSubmittedWorkDone(
queue: *Queue,
signal_value: u64,
context: anytype,
comptime callback: fn (ctx: @TypeOf(context), status: WorkDoneStatus) callconv(.Inline) void,
) void {
const Context = @TypeOf(context);
const Helper = struct {
pub fn cCallback(status: WorkDoneStatus, userdata: ?*anyopaque) callconv(.C) void {
callback(if (Context == void) {} else @ptrCast(Context, @alignCast(@alignOf(std.meta.Child(Context)), userdata)), status);
}
};
Impl.queueOnSubmittedWorkDone(queue, signal_value, Helper.cCallback, if (Context == void) null else context);
}
pub inline fn setLabel(queue: *Queue, label: [*:0]const u8) void {
Impl.queueSetLabel(queue, label);
}
pub inline fn submit(queue: *Queue, commands: []*const CommandBuffer) void {
Impl.queueSubmit(queue, @intCast(u32, commands.len), commands.ptr);
}
pub inline fn writeBuffer(
queue: *Queue,
buffer: *Buffer,
buffer_offset_bytes: u64,
data_span: anytype,
) void {
const data_slice = std.mem.span(data_span);
Impl.queueWriteBuffer(
queue,
buffer,
buffer_offset_bytes,
@ptrCast(*const anyopaque, data_slice.ptr),
@intCast(u64, data_slice.len) * @sizeOf(std.meta.Elem(@TypeOf(data_slice))),
);
}
pub inline fn writeTexture(
queue: *Queue,
destination: *const ImageCopyTexture,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
data_span: anytype,
) void {
const data_slice = std.mem.span(data_span);
Impl.queueWriteTexture(
queue,
destination,
@ptrCast(*const anyopaque, data_slice.ptr),
@intCast(usize, data_slice.len) * @sizeOf(std.meta.Elem(@TypeOf(data_slice))),
data_layout,
write_size,
);
}
pub inline fn reference(queue: *Queue) void {
Impl.queueReference(queue);
}
pub inline fn release(queue: *Queue) void {
Impl.queueRelease(queue);
}
};