Skip to content

Commit

Permalink
remove deprecated VkGenerateStep
Browse files Browse the repository at this point in the history
  • Loading branch information
Snektron committed Sep 4, 2024
1 parent ced1c2b commit cf6f008
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 231 deletions.
21 changes: 0 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,6 @@ exe.root_module.addImport("vulkan", vulkan_zig);

See [examples/build.zig](examples/build.zig) and [examples/build.zig.zon](examples/build.zig.zon) for a concrete example.

### (Deprecated) Generation from build.zig

Vulkan bindings can be generated from the Vulkan XML registry at compile time with build.zig, by using the provided Vulkan generation step. This requires adding vulkan-zig to your dependencies as shown above. After than, vulkan-zig can be imported at build time as follows:
```zig
const vkgen = @import("vulkan_zig");
pub fn build(b: *Builder) void {
...
const exe = b.addExecutable("my-executable", "src/main.zig");
// Create a step that generates vk.zig (stored in zig-cache) from the provided vulkan registry.
const gen = vkgen.VkGenerateStep.create(b, "path/to/vk.xml");
// Add the generated file as package to the final executable
exe.addModule("vulkan", gen.getModule());
}
```
This reads vk.xml, parses its contents, and renders the Vulkan bindings to "vk.zig", which is then formatted and placed in `zig-cache`. The resulting file can then be added to an executable by using `addModule`, after which the bindings will be made available to the executable under the name passed to `getModule`.

This feature is only provided for legacy reasons. If you are still using this, please migrate to one of the methods that involve the package manager, as this method will be removed in the near future.

### Function & field renaming

Functions and fields are renamed to be more or less in line with [Zig's standard library style](https://ziglang.org/documentation/master/#Style-Guide):
Expand Down
4 changes: 0 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
const std = @import("std");

const vkgen = @import("src/main.zig");
pub const ShaderCompileStep = vkgen.ShaderCompileStep;
pub const VkGenerateStep = vkgen.VkGenerateStep;

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
Expand Down
4 changes: 0 additions & 4 deletions src/main.zig
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
const std = @import("std");
const generator = @import("vulkan/generator.zig");

pub const generateVk = generator.generate;
pub const VkGenerateStep = @import("vulkan/build_integration.zig").GenerateStep;
pub const ShaderCompileStep = @import("build_integration.zig").ShaderCompileStep;

fn invalidUsage(prog_name: []const u8, comptime fmt: []const u8, args: anytype) noreturn {
std.log.err(fmt, args);
std.log.err("see {s} --help for usage", .{prog_name});
Expand Down
202 changes: 0 additions & 202 deletions src/vulkan/build_integration.zig

This file was deleted.

0 comments on commit cf6f008

Please sign in to comment.