Integrating new surface

This commit is contained in:
Mitchell Hashimoto
2023-02-22 14:37:37 -08:00
parent 3d8c62c41f
commit fbe35c226b
12 changed files with 1831 additions and 146 deletions

View File

@@ -47,8 +47,8 @@ cursor_h: xev.Timer,
cursor_c: xev.Completion = .{},
cursor_c_cancel: xev.Completion = .{},
/// The window we're rendering to.
window: apprt.runtime.Window,
/// The surface we're rendering to.
surface: *apprt.Surface,
/// The underlying renderer implementation.
renderer: *renderer.Renderer,
@@ -65,7 +65,7 @@ mailbox: *Mailbox,
/// is up to the caller to start the thread with the threadMain entrypoint.
pub fn init(
alloc: Allocator,
win: apprt.runtime.Window,
surface: *apprt.Surface,
renderer_impl: *renderer.Renderer,
state: *renderer.State,
) !Thread {
@@ -100,7 +100,7 @@ pub fn init(
.stop = stop_h,
.render_h = render_h,
.cursor_h = cursor_timer,
.window = win,
.surface = surface,
.renderer = renderer_impl,
.state = state,
.mailbox = mailbox,
@@ -135,7 +135,7 @@ fn threadMain_(self: *Thread) !void {
// Run our thread start/end callbacks. This is important because some
// renderers have to do per-thread setup. For example, OpenGL has to set
// some thread-local state since that is how it works.
try self.renderer.threadEnter(self.window);
try self.renderer.threadEnter(self.surface);
defer self.renderer.threadExit();
// Start the async handlers
@@ -305,7 +305,7 @@ fn renderCallback(
return .disarm;
};
t.renderer.render(t.window, t.state) catch |err|
t.renderer.render(t.surface, t.state) catch |err|
log.warn("error rendering err={}", .{err});
return .disarm;
}