forked from mirror/vulkan-zig
test that refs all decls
This commit is contained in:
12
build.zig
12
build.zig
@@ -75,9 +75,6 @@ pub const ResourceGenStep = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *Builder) void {
|
||||||
var test_step = b.step("test", "Run all the tests");
|
|
||||||
test_step.dependOn(&b.addTest("generator/index.zig").step);
|
|
||||||
|
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
|
|
||||||
@@ -107,4 +104,13 @@ pub fn build(b: *Builder) void {
|
|||||||
triangle_run_cmd.step.dependOn(b.getInstallStep());
|
triangle_run_cmd.step.dependOn(b.getInstallStep());
|
||||||
const triangle_run_step = b.step("run-triangle", "Run the triangle example");
|
const triangle_run_step = b.step("run-triangle", "Run the triangle example");
|
||||||
triangle_run_step.dependOn(&triangle_run_cmd.step);
|
triangle_run_step.dependOn(&triangle_run_cmd.step);
|
||||||
|
|
||||||
|
var test_step = b.step("test", "Run all the tests");
|
||||||
|
test_step.dependOn(&b.addTest("generator/index.zig").step);
|
||||||
|
|
||||||
|
// This test needs to be an object so that vulkan-zig can import types from the root.
|
||||||
|
// It does not need to run anyway.
|
||||||
|
const ref_all_decls_test = b.addObject("ref-all-decls-test", "test/ref_all_decls.zig");
|
||||||
|
ref_all_decls_test.addPackage(gen.package);
|
||||||
|
test_step.dependOn(&ref_all_decls_test.step);
|
||||||
}
|
}
|
||||||
|
|||||||
110
test/ref_all_decls.zig
Normal file
110
test/ref_all_decls.zig
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
const vk = @import("vulkan");
|
||||||
|
|
||||||
|
// Provide bogus defaults for unknown platform types
|
||||||
|
// The actual type does not really matter here...
|
||||||
|
pub const GgpFrameToken = u32;
|
||||||
|
pub const GgpStreamDescriptor = u32;
|
||||||
|
pub const ANativeWindow = u32;
|
||||||
|
pub const AHardwareBuffer = u32;
|
||||||
|
pub const CAMetalLayer = u32;
|
||||||
|
pub const MTLDevice_id = u32;
|
||||||
|
pub const MTLCommandQueue_id = u32;
|
||||||
|
pub const MTLBuffer_id = u32;
|
||||||
|
pub const MTLTexture_id = u32;
|
||||||
|
pub const MTLSharedEvent_id = u32;
|
||||||
|
pub const IOSurfaceRef = u32;
|
||||||
|
|
||||||
|
// For some reason these types are exported in a different header, and not described in vk.xml.
|
||||||
|
pub const StdVideoH264ProfileIdc = u32;
|
||||||
|
pub const StdVideoH264LevelIdc = u32;
|
||||||
|
pub const StdVideoH264ChromaFormatIdc = u32;
|
||||||
|
pub const StdVideoH264PocType = u32;
|
||||||
|
pub const StdVideoH264SpsFlags = u32;
|
||||||
|
pub const StdVideoH264ScalingLists = u32;
|
||||||
|
pub const StdVideoH264SequenceParameterSetVui = u32;
|
||||||
|
pub const StdVideoH264AspectRatioIdc = u32;
|
||||||
|
pub const StdVideoH264HrdParameters = u32;
|
||||||
|
pub const StdVideoH264SpsVuiFlags = u32;
|
||||||
|
pub const StdVideoH264WeightedBipredIdc = u32;
|
||||||
|
pub const StdVideoH264PpsFlags = u32;
|
||||||
|
pub const StdVideoH264SliceType = u32;
|
||||||
|
pub const StdVideoH264CabacInitIdc = u32;
|
||||||
|
pub const StdVideoH264DisableDeblockingFilterIdc = u32;
|
||||||
|
pub const StdVideoH264PictureType = u32;
|
||||||
|
pub const StdVideoH264ModificationOfPicNumsIdc = u32;
|
||||||
|
pub const StdVideoH264MemMgmtControlOp = u32;
|
||||||
|
pub const StdVideoDecodeH264PictureInfo = u32;
|
||||||
|
pub const StdVideoDecodeH264ReferenceInfo = u32;
|
||||||
|
pub const StdVideoDecodeH264PictureInfoFlags = u32;
|
||||||
|
pub const StdVideoDecodeH264ReferenceInfoFlags = u32;
|
||||||
|
pub const StdVideoH264SequenceParameterSet = u32;
|
||||||
|
pub const StdVideoH264PictureParameterSet = u32;
|
||||||
|
pub const StdVideoH265ProfileIdc = u32;
|
||||||
|
pub const StdVideoH265VideoParameterSet = u32;
|
||||||
|
pub const StdVideoH265SequenceParameterSet = u32;
|
||||||
|
pub const StdVideoH265PictureParameterSet = u32;
|
||||||
|
pub const StdVideoH265DecPicBufMgr = u32;
|
||||||
|
pub const StdVideoH265HrdParameters = u32;
|
||||||
|
pub const StdVideoH265VpsFlags = u32;
|
||||||
|
pub const StdVideoH265LevelIdc = u32;
|
||||||
|
pub const StdVideoH265SpsFlags = u32;
|
||||||
|
pub const StdVideoH265ScalingLists = u32;
|
||||||
|
pub const StdVideoH265SequenceParameterSetVui = u32;
|
||||||
|
pub const StdVideoH265PredictorPaletteEntries = u32;
|
||||||
|
pub const StdVideoH265PpsFlags = u32;
|
||||||
|
pub const StdVideoH265SubLayerHrdParameters = u32;
|
||||||
|
pub const StdVideoH265HrdFlags = u32;
|
||||||
|
pub const StdVideoH265SpsVuiFlags = u32;
|
||||||
|
pub const StdVideoH265SliceType = u32;
|
||||||
|
pub const StdVideoH265PictureType = u32;
|
||||||
|
pub const StdVideoDecodeH265PictureInfo = u32;
|
||||||
|
pub const StdVideoDecodeH265ReferenceInfo = u32;
|
||||||
|
pub const StdVideoDecodeH265PictureInfoFlags = u32;
|
||||||
|
pub const StdVideoDecodeH265ReferenceInfoFlags = u32;
|
||||||
|
pub const StdVideoEncodeH264SliceHeader = u32;
|
||||||
|
pub const StdVideoEncodeH264PictureInfo = u32;
|
||||||
|
pub const StdVideoEncodeH264ReferenceInfo = u32;
|
||||||
|
pub const StdVideoEncodeH264SliceHeaderFlags = u32;
|
||||||
|
pub const StdVideoEncodeH264RefMemMgmtCtrlOperations = u32;
|
||||||
|
pub const StdVideoEncodeH264PictureInfoFlags = u32;
|
||||||
|
pub const StdVideoEncodeH264ReferenceInfoFlags = u32;
|
||||||
|
pub const StdVideoEncodeH264RefMgmtFlags = u32;
|
||||||
|
pub const StdVideoEncodeH264RefListModEntry = u32;
|
||||||
|
pub const StdVideoEncodeH264RefPicMarkingEntry = u32;
|
||||||
|
pub const StdVideoEncodeH265PictureInfoFlags = u32;
|
||||||
|
pub const StdVideoEncodeH265PictureInfo = u32;
|
||||||
|
pub const StdVideoEncodeH265SliceSegmentHeader = u32;
|
||||||
|
pub const StdVideoEncodeH265ReferenceInfo = u32;
|
||||||
|
pub const StdVideoEncodeH265ReferenceModifications = u32;
|
||||||
|
pub const StdVideoEncodeH265SliceSegmentHeaderFlags = u32;
|
||||||
|
pub const StdVideoEncodeH265ReferenceInfoFlags = u32;
|
||||||
|
pub const StdVideoEncodeH265ReferenceModificationFlags = u32;
|
||||||
|
|
||||||
|
comptime {
|
||||||
|
@setEvalBranchQuota(100000);
|
||||||
|
reallyRefAllDecls(vk);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn reallyRefAllDecls(comptime T: type) void {
|
||||||
|
switch (@typeInfo(T)) {
|
||||||
|
.Struct, .Union => {
|
||||||
|
reallyRefAllContainerDecls(T);
|
||||||
|
inline for (std.meta.fields(T)) |field| {
|
||||||
|
reallyRefAllDecls(field.field_type);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.Enum, .Opaque => {
|
||||||
|
reallyRefAllContainerDecls(T);
|
||||||
|
},
|
||||||
|
else => {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn reallyRefAllContainerDecls(comptime T: type) void {
|
||||||
|
inline for (comptime std.meta.declarations(T)) |decl| {
|
||||||
|
if (decl.is_pub and @TypeOf(@field(T, decl.name)) == type) {
|
||||||
|
reallyRefAllDecls(@field(T, decl.name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user