forked from mirror/vulkan-zig
always provide default opaque{} external type implementations
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
@@ -349,9 +349,9 @@ Note that this information is not everywhere as useful in the registry, leading
|
|||||||
|
|
||||||
Defaults with the same ABI layout are generated for most platform-defined types. These can either by bitcasted to, or overridden by defining them in the project root:
|
Defaults with the same ABI layout are generated for most platform-defined types. These can either by bitcasted to, or overridden by defining them in the project root:
|
||||||
```zig
|
```zig
|
||||||
pub const xcb_connection_t = if (@hasDecl(root, "xcb_connection_t")) root.xcb_connection_t else @Type(.Opaque);
|
pub const xcb_connection_t = if (@hasDecl(root, "xcb_connection_t")) root.xcb_connection_t else opaque{};
|
||||||
```
|
```
|
||||||
For some times (such as those from Google Games Platform) no default is known. Usage of these without providing a concrete type in the project root generates a compile error.
|
For some times (such as those from Google Games Platform) no default is known, but an `opaque{}` will be used by default. Usage of these without providing a concrete type in the project root is likely an error.
|
||||||
|
|
||||||
### Shader compilation
|
### Shader compilation
|
||||||
|
|
||||||
|
|||||||
@@ -1031,7 +1031,7 @@ fn Renderer(comptime WriterType: type) type {
|
|||||||
try self.writer.writeAll(default);
|
try self.writer.writeAll(default);
|
||||||
try self.writer.writeAll(";\n");
|
try self.writer.writeAll(";\n");
|
||||||
} else {
|
} else {
|
||||||
try self.writer.print("@compileError(\"Missing type definition of '{s}'\");\n", .{name});
|
try self.writer.print("opaque {{}};\n", .{});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user