wrap readme

This commit is contained in:
Robin Voetter
2023-09-25 21:51:52 +02:00
parent 14259cc6f5
commit 1e4e90ffb1

View File

@@ -289,8 +289,7 @@ For some times (such as those from Google Games Platform) no default is known. U
### Shader compilation ### Shader compilation
vulkan-zig provides functionality to help compile shaders to SPIR-V using glslc. vulkan-zig provides functionality to help compile shaders to SPIR-V using glslc. It can be used from build.zig as follows:
It can be used from build.zig as follows:
```zig ```zig
const vkgen = @import("vulkan_zig"); const vkgen = @import("vulkan_zig");
@@ -308,14 +307,7 @@ pub fn build(b: *Builder) void {
} }
``` ```
Upon compilation, glslc is invoked to compile each shader, and the result is Upon compilation, glslc is invoked to compile each shader, and the result is placed within `zig-cache`. All shaders which are compiled using a particular `ShaderCompileStep` are imported in a single Zig file using `@embedFile`, and this file can be added to an executable as a module using `addModule`. To slightly improve compile times, shader compilation is cached; as long as a shader's source and its compile commands stay the same, the shader is not recompiled. The SPIR-V code for any particular shader is aligned to that of a 32-bit integer as follows, as required by vkCreateShaderModule:
placed within `zig-cache`. All shaders which are compiled using a particular
`ShaderCompileStep` are imported in a single Zig file using `@embedFile`, and
this file can be added to an executable as a module using `addModule`. To
slightly improve compile times, shader compilation is cached; as long as a
shader's source and its compile commands stay the same, the shader is not
recompiled. The SPIR-V code for any particular shader is aligned to that of a
32-bit integer as follows, as required by vkCreateShaderModule:
```zig ```zig
pub const ${name} align(@alignOf(u32)) = @embedFile("${path}").*; pub const ${name} align(@alignOf(u32)) = @embedFile("${path}").*;