mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-06-21 08:02:03 -04:00
d7d131c050
Closes #35240 Fixes #35238 Fixes #35259 Supported types are: - `OpTypeSampler` - `OpTypeImage` - `OpTypeSampledImage` - `OpTypeRuntimeArray` with indexing and `.len` field The SPIR-V backend is bit-rotted so behavior tests no longer pass (compiler crashes). However I've verified the new added tests are passing.
48 lines
1.4 KiB
Zig
48 lines
1.4 KiB
Zig
const Sampler = @SpirvType(.sampler);
|
|
const Image = @SpirvType(.{ .image = .{
|
|
.usage = .{ .sampled = u32 },
|
|
.format = .unknown,
|
|
.dim = .@"2d",
|
|
.depth = .unknown,
|
|
.arrayed = false,
|
|
.multisampled = false,
|
|
.access = .unknown,
|
|
} });
|
|
const SampledImage = @SpirvType(.{ .sampled_image = Image });
|
|
const StorageImage = @SpirvType(.{ .image = .{
|
|
.usage = .storage,
|
|
.format = .unknown,
|
|
.dim = .@"2d",
|
|
.depth = .unknown,
|
|
.arrayed = false,
|
|
.multisampled = false,
|
|
.access = .unknown,
|
|
} });
|
|
const RuntimeArray = @SpirvType(.{ .runtime_array = u32 });
|
|
|
|
const RuntimeArrayBuf = extern struct { e: RuntimeArray };
|
|
|
|
const sampler = @extern(*addrspace(.constant) const Sampler, .{
|
|
.name = "sampler",
|
|
.decoration = .{ .descriptor = .{ .set = 0, .binding = 0 } },
|
|
});
|
|
const sampled_image = @extern(*addrspace(.constant) const SampledImage, .{
|
|
.name = "sampled_image",
|
|
.decoration = .{ .descriptor = .{ .set = 0, .binding = 1 } },
|
|
});
|
|
const storage_image = @extern(*addrspace(.constant) const StorageImage, .{
|
|
.name = "storage_image",
|
|
.decoration = .{ .descriptor = .{ .set = 0, .binding = 2 } },
|
|
});
|
|
const runtime_array = @extern(*addrspace(.storage_buffer) const RuntimeArrayBuf, .{
|
|
.name = "runtime_array",
|
|
.decoration = .{ .descriptor = .{ .set = 0, .binding = 3 } },
|
|
});
|
|
|
|
test "@SpirvType" {
|
|
_ = sampler;
|
|
_ = sampled_image;
|
|
_ = storage_image;
|
|
_ = runtime_array;
|
|
}
|