Small Update

This commit is contained in:
abux 2026-08-01 00:12:19 +01:00
parent b03bb1a70a
commit 7a3fe658ef
8 changed files with 94 additions and 12 deletions

View file

@ -17,8 +17,8 @@
.hash = "app-0.0.0-AOV9_YDvAAAjjuCldX-9p7mt3Oswbv8bTB2rvcZ67Fn1",
},
.gtl = .{
.url = "git+http://2.120.146.66:25569/abux/gtl.git#3c7fcfcb1276b76ec4695ce5ce9dba4d8255a176",
.hash = "gtl-0.0.0-e3QoJMRYAADChgXn2sogTxsbUpEBSHjOGZeoEx4ccMMD",
.url = "git+http://192.168.0.11:25569/abux/GTL.git#f9772950b5097bbbda39cd68d86f6b6062c41fec",
.hash = "gtl-0.0.0-e3QoJPNxAABpkY1nvYNN7r02CI4z2aki1_FHDPzdWi9P",
},
.NYXMath = .{
.url = "git+http://192.168.0.11:25569/abux/NYXMath.git#cb7b54995bdb46321f112bba2a704d58cf53aeb1",

View file

@ -6,6 +6,7 @@
//
const std = @import("std");
const gtl = @import("gtl");
const math = @import("math");
const App = @import("app");
@ -44,18 +45,25 @@ pub fn main(init: std.process.Init) !void {
});
try app.plugins.build(&app);
{ // DEBUG
std.debug.print("\x1b[33m┏━\x1b[0m PLUGINS\n", .{});
// DEBUG
if (gtl.log.print(.debug, "PLUGINS", gtl.ansi.yellow)) |v| {
defer v.end();
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 ---
try app.schedules.run(App.stage.init, &app);
defer app.schedules.runReversed(App.stage.deinit, &app) catch unreachable;
// --- # ---
errdefer {
app.schedules.runReversed(App.stage.deinit, &app) catch unreachable;
app.deinit();
}
// --- MAIN LOOP ---
while (true) {
// --- # ---

View 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,

View file

@ -12,6 +12,7 @@ const lifetime = @import("system/lifetime.zig");
// PUBLIC
//
pub const AdapterInfo = @import("resource/adapter_info.zig");
pub const WGPUDevice = @import("resource/wgpu_device.zig");
/// ----------------------------------------------------

View file

@ -6,6 +6,7 @@ const wgpu = @import("wgpu");
const App = @import("app");
const WGPUInstance = @import("../../platform/resource/wgpu_instance.zig");
const AdapterInfo = @import("../resource/adapter_info.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;
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
//

View file

@ -79,7 +79,7 @@ fn start(app: *App) !void {
Transform3D{},
});
const count: usize = 100;
const count: usize = 200;
const radius: f32 = 5.0;
for (0..count) |i| {
@ -90,7 +90,12 @@ fn start(app: *App) !void {
Material{
.value = try render_world.materials.put(.{
.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 = .{
.cull_mode = .none,

View file

@ -8,9 +8,6 @@ const Mesh = @import("../../cache/resource/mesh_cache.zig").MeshID;
const Handle = gtl.Handle;
const Self = @This();
// TODO:
const Camera = struct {};
/// ----------------------------------------------------
/// ----------------------------------------------------
pub const DrawCMD = union(enum) {
@ -22,6 +19,7 @@ pub const DrawCMD = union(enum) {
draw_indexed: struct {
mesh: Mesh,
entity: u64,
material: Handle(Material),
},

View file

@ -476,7 +476,14 @@ fn createPipeline(
.mask = ~@as(u32, 0),
.alphaToCoverageEnabled = 0,
},
.depthStencil = null,
// .depthStencil = &wgpu.WGPUDepthStencilState{
// .format = wgpu.WGPUTextureFormat_Depth24Plus,
// .depthCompare = wgpu.WGPUCompareFunction_Less,
// .depthWriteEnabled = 1,
//
// .stencilReadMask = 0,
// .stencilWriteMask = 0,
// },
}) orelse {
return error.PipelineCreationFailed;
};