forked from mirror/vulkan-zig
Allow custom dispatch structs
This commit is contained in:
@@ -1440,13 +1440,14 @@ fn Renderer(comptime WriterType: type) type {
|
|||||||
const name = dispatch_type.name();
|
const name = dispatch_type.name();
|
||||||
|
|
||||||
try self.writer.print(
|
try self.writer.print(
|
||||||
\\pub const {0s}Wrapper = struct {{
|
\\pub const {0s}Wrapper = {0s}WrapperWithCustomDispatch({0s}Dispatch);
|
||||||
|
\\pub fn {0s}WrapperWithCustomDispatch(DispatchType: type) type {{
|
||||||
|
\\ return struct {{
|
||||||
\\ const Self = @This();
|
\\ const Self = @This();
|
||||||
\\ pub const Dispatch = {0s}Dispatch;
|
\\ pub const Dispatch = DispatchType;
|
||||||
\\
|
\\
|
||||||
\\ dispatch: Dispatch,
|
\\ dispatch: Dispatch,
|
||||||
\\
|
\\
|
||||||
\\
|
|
||||||
, .{name});
|
, .{name});
|
||||||
|
|
||||||
try self.renderWrapperLoader(dispatch_type);
|
try self.renderWrapperLoader(dispatch_type);
|
||||||
@@ -1473,7 +1474,7 @@ fn Renderer(comptime WriterType: type) type {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try self.writer.writeAll("};\n");
|
try self.writer.writeAll("};}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn renderWrapperLoader(self: *Self, dispatch_type: CommandDispatchType) !void {
|
fn renderWrapperLoader(self: *Self, dispatch_type: CommandDispatchType) !void {
|
||||||
@@ -1520,9 +1521,11 @@ fn Renderer(comptime WriterType: type) type {
|
|||||||
const loader_name = dispatch_type.name();
|
const loader_name = dispatch_type.name();
|
||||||
|
|
||||||
try self.writer.print(
|
try self.writer.print(
|
||||||
\\pub const {0s}Proxy = struct {{
|
\\pub const {0s}Proxy = {0s}ProxyWithCustomDispatch({1s}Dispatch);
|
||||||
|
\\pub fn {0s}ProxyWithCustomDispatch(DispatchType: type) type {{
|
||||||
|
\\ return struct {{
|
||||||
\\ const Self = @This();
|
\\ const Self = @This();
|
||||||
\\ pub const Wrapper = {1s}Wrapper;
|
\\ pub const Wrapper = {1s}WrapperWithCustomDispatch(DispatchType);
|
||||||
\\
|
\\
|
||||||
\\ handle: {0s},
|
\\ handle: {0s},
|
||||||
// Note: This is a pointer because in the past there were some performance
|
// Note: This is a pointer because in the past there were some performance
|
||||||
@@ -1572,7 +1575,7 @@ fn Renderer(comptime WriterType: type) type {
|
|||||||
|
|
||||||
try self.writer.writeAll(
|
try self.writer.writeAll(
|
||||||
\\ };
|
\\ };
|
||||||
\\
|
\\}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user