Small Update
This commit is contained in:
parent
b03bb1a70a
commit
7a3fe658ef
8 changed files with 94 additions and 12 deletions
|
|
@ -17,8 +17,8 @@
|
||||||
.hash = "app-0.0.0-AOV9_YDvAAAjjuCldX-9p7mt3Oswbv8bTB2rvcZ67Fn1",
|
.hash = "app-0.0.0-AOV9_YDvAAAjjuCldX-9p7mt3Oswbv8bTB2rvcZ67Fn1",
|
||||||
},
|
},
|
||||||
.gtl = .{
|
.gtl = .{
|
||||||
.url = "git+http://2.120.146.66:25569/abux/gtl.git#3c7fcfcb1276b76ec4695ce5ce9dba4d8255a176",
|
.url = "git+http://192.168.0.11:25569/abux/GTL.git#f9772950b5097bbbda39cd68d86f6b6062c41fec",
|
||||||
.hash = "gtl-0.0.0-e3QoJMRYAADChgXn2sogTxsbUpEBSHjOGZeoEx4ccMMD",
|
.hash = "gtl-0.0.0-e3QoJPNxAABpkY1nvYNN7r02CI4z2aki1_FHDPzdWi9P",
|
||||||
},
|
},
|
||||||
.NYXMath = .{
|
.NYXMath = .{
|
||||||
.url = "git+http://192.168.0.11:25569/abux/NYXMath.git#cb7b54995bdb46321f112bba2a704d58cf53aeb1",
|
.url = "git+http://192.168.0.11:25569/abux/NYXMath.git#cb7b54995bdb46321f112bba2a704d58cf53aeb1",
|
||||||
|
|
|
||||||
16
src/main.zig
16
src/main.zig
|
|
@ -6,6 +6,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const gtl = @import("gtl");
|
||||||
const math = @import("math");
|
const math = @import("math");
|
||||||
const App = @import("app");
|
const App = @import("app");
|
||||||
|
|
||||||
|
|
@ -44,18 +45,25 @@ pub fn main(init: std.process.Init) !void {
|
||||||
});
|
});
|
||||||
try app.plugins.build(&app);
|
try app.plugins.build(&app);
|
||||||
|
|
||||||
{ // DEBUG
|
// DEBUG
|
||||||
std.debug.print("\x1b[33m┏━\x1b[0m PLUGINS\n", .{});
|
if (gtl.log.print(.debug, "PLUGINS", gtl.ansi.yellow)) |v| {
|
||||||
|
defer v.end();
|
||||||
|
|
||||||
for (app.plugins.data.items) |plugin| {
|
for (app.plugins.data.items) |plugin| {
|
||||||
std.debug.print("\x1b[33m┃\x1b[0m {s:<12} {s}\n", .{ plugin.name, plugin.description });
|
v.write("{s}", .{plugin.name});
|
||||||
}
|
}
|
||||||
std.debug.print("\x1b[33m┗━\x1b[0m\n", .{});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- LIFETIME ---
|
// --- LIFETIME ---
|
||||||
try app.schedules.run(App.stage.init, &app);
|
try app.schedules.run(App.stage.init, &app);
|
||||||
defer app.schedules.runReversed(App.stage.deinit, &app) catch unreachable;
|
defer app.schedules.runReversed(App.stage.deinit, &app) catch unreachable;
|
||||||
|
|
||||||
|
// --- # ---
|
||||||
|
errdefer {
|
||||||
|
app.schedules.runReversed(App.stage.deinit, &app) catch unreachable;
|
||||||
|
app.deinit();
|
||||||
|
}
|
||||||
|
|
||||||
// --- MAIN LOOP ---
|
// --- MAIN LOOP ---
|
||||||
while (true) {
|
while (true) {
|
||||||
// --- # ---
|
// --- # ---
|
||||||
|
|
|
||||||
26
src/plugins/device/resource/adapter_info.zig
Normal file
26
src/plugins/device/resource/adapter_info.zig
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
//! ----------------------------------------------------
|
||||||
|
//! ----------------------------------------------------
|
||||||
|
|
||||||
|
const wgpu = @import("wgpu");
|
||||||
|
|
||||||
|
/// ----------------------------------------------------
|
||||||
|
/// ----------------------------------------------------
|
||||||
|
pub const Backend = enum {
|
||||||
|
vulkan,
|
||||||
|
webgpu,
|
||||||
|
opengl,
|
||||||
|
|
||||||
|
d3d11,
|
||||||
|
d3d12,
|
||||||
|
metal,
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// FIELDS
|
||||||
|
//
|
||||||
|
|
||||||
|
device: []const u8,
|
||||||
|
vendor: []const u8,
|
||||||
|
|
||||||
|
backend: Backend,
|
||||||
|
surface_format: wgpu.WGPUTextureFormat,
|
||||||
|
|
@ -12,6 +12,7 @@ const lifetime = @import("system/lifetime.zig");
|
||||||
// PUBLIC
|
// PUBLIC
|
||||||
//
|
//
|
||||||
|
|
||||||
|
pub const AdapterInfo = @import("resource/adapter_info.zig");
|
||||||
pub const WGPUDevice = @import("resource/wgpu_device.zig");
|
pub const WGPUDevice = @import("resource/wgpu_device.zig");
|
||||||
|
|
||||||
/// ----------------------------------------------------
|
/// ----------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ const wgpu = @import("wgpu");
|
||||||
const App = @import("app");
|
const App = @import("app");
|
||||||
|
|
||||||
const WGPUInstance = @import("../../platform/resource/wgpu_instance.zig");
|
const WGPUInstance = @import("../../platform/resource/wgpu_instance.zig");
|
||||||
|
const AdapterInfo = @import("../resource/adapter_info.zig");
|
||||||
const WGPUDevice = @import("../resource/wgpu_device.zig");
|
const WGPUDevice = @import("../resource/wgpu_device.zig");
|
||||||
|
|
||||||
/// ----------------------------------------------------
|
/// ----------------------------------------------------
|
||||||
|
|
@ -51,6 +52,42 @@ pub fn init(app: *App) !void {
|
||||||
const adapter = if (adapter_userdata.adapter) |v| v else return error.NoAdapter;
|
const adapter = if (adapter_userdata.adapter) |v| v else return error.NoAdapter;
|
||||||
defer wgpu.wgpuAdapterRelease(adapter);
|
defer wgpu.wgpuAdapterRelease(adapter);
|
||||||
|
|
||||||
|
// --- GET ADAPTER INFO ---
|
||||||
|
var adapter_info: wgpu.WGPUAdapterInfo = .{};
|
||||||
|
switch (wgpu.wgpuAdapterGetInfo(adapter, &adapter_info)) {
|
||||||
|
wgpu.WGPUStatus_Success => {},
|
||||||
|
else => return error.AdapterInfoFailed,
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- GET SURFACE CAPABILITIES ---
|
||||||
|
// var surface_caps: wgpu.WGPUSurfaceCapabilities = .{};
|
||||||
|
// defer wgpu.wgpuSurfaceCapabilitiesFreeMembers(surface_caps);
|
||||||
|
|
||||||
|
// switch (wgpu.wgpuSurfaceGetCapabilities(
|
||||||
|
// surface,
|
||||||
|
// adapter,
|
||||||
|
// &surface_caps,
|
||||||
|
// )) {
|
||||||
|
// wgpu.WGPUStatus_Success => {},
|
||||||
|
// else => return error.SurfaceCapabilitiesFailed,
|
||||||
|
// }
|
||||||
|
|
||||||
|
// --- SET ADAPTER INFO ---
|
||||||
|
try app.resources.set(AdapterInfo{
|
||||||
|
.device = std.mem.span(adapter_info.device.data),
|
||||||
|
.vendor = std.mem.span(adapter_info.vendor.data),
|
||||||
|
.backend = switch (adapter_info.backendType) {
|
||||||
|
wgpu.WGPUBackendType_Vulkan => .vulkan,
|
||||||
|
wgpu.WGPUBackendType_WebGPU => .webgpu,
|
||||||
|
wgpu.WGPUBackendType_OpenGL => .opengl,
|
||||||
|
wgpu.WGPUBackendType_D3D11 => .d3d11,
|
||||||
|
wgpu.WGPUBackendType_D3D12 => .d3d12,
|
||||||
|
wgpu.WGPUBackendType_Metal => .metal,
|
||||||
|
else => return error.InvalidBackendType,
|
||||||
|
},
|
||||||
|
.surface_format = 28,
|
||||||
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// DEVICE
|
// DEVICE
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ fn start(app: *App) !void {
|
||||||
Transform3D{},
|
Transform3D{},
|
||||||
});
|
});
|
||||||
|
|
||||||
const count: usize = 100;
|
const count: usize = 200;
|
||||||
const radius: f32 = 5.0;
|
const radius: f32 = 5.0;
|
||||||
|
|
||||||
for (0..count) |i| {
|
for (0..count) |i| {
|
||||||
|
|
@ -90,7 +90,12 @@ fn start(app: *App) !void {
|
||||||
Material{
|
Material{
|
||||||
.value = try render_world.materials.put(.{
|
.value = try render_world.materials.put(.{
|
||||||
.style = .{
|
.style = .{
|
||||||
.albedo = .{ 0.2, 0.2, 0.8, 1 },
|
.albedo = .{
|
||||||
|
0.2,
|
||||||
|
0.0 + (angle * std.math.pi) * 0.01,
|
||||||
|
0.0 + (angle * std.math.pi) * 0.02,
|
||||||
|
1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
.unique = .{
|
.unique = .{
|
||||||
.cull_mode = .none,
|
.cull_mode = .none,
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ const Mesh = @import("../../cache/resource/mesh_cache.zig").MeshID;
|
||||||
const Handle = gtl.Handle;
|
const Handle = gtl.Handle;
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
// TODO:
|
|
||||||
const Camera = struct {};
|
|
||||||
|
|
||||||
/// ----------------------------------------------------
|
/// ----------------------------------------------------
|
||||||
/// ----------------------------------------------------
|
/// ----------------------------------------------------
|
||||||
pub const DrawCMD = union(enum) {
|
pub const DrawCMD = union(enum) {
|
||||||
|
|
@ -22,6 +19,7 @@ pub const DrawCMD = union(enum) {
|
||||||
|
|
||||||
draw_indexed: struct {
|
draw_indexed: struct {
|
||||||
mesh: Mesh,
|
mesh: Mesh,
|
||||||
|
entity: u64,
|
||||||
material: Handle(Material),
|
material: Handle(Material),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -476,7 +476,14 @@ fn createPipeline(
|
||||||
.mask = ~@as(u32, 0),
|
.mask = ~@as(u32, 0),
|
||||||
.alphaToCoverageEnabled = 0,
|
.alphaToCoverageEnabled = 0,
|
||||||
},
|
},
|
||||||
.depthStencil = null,
|
// .depthStencil = &wgpu.WGPUDepthStencilState{
|
||||||
|
// .format = wgpu.WGPUTextureFormat_Depth24Plus,
|
||||||
|
// .depthCompare = wgpu.WGPUCompareFunction_Less,
|
||||||
|
// .depthWriteEnabled = 1,
|
||||||
|
//
|
||||||
|
// .stencilReadMask = 0,
|
||||||
|
// .stencilWriteMask = 0,
|
||||||
|
// },
|
||||||
}) orelse {
|
}) orelse {
|
||||||
return error.PipelineCreationFailed;
|
return error.PipelineCreationFailed;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue