aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2025-03-18 22:31:57 +0100
committerGitHub <noreply@github.com>2025-03-18 22:31:57 +0100
commit5105c3c7fa46969dc731b7447415436fd7572e87 (patch)
treef3bdcc2b4f9193476cfc738a25b6d8869908999a /lib/std
parent074dd4d083b8ddefc370425568b61c890efe905d (diff)
parentee06b2ce760d927b62726de1e2e3cb33b48d4932 (diff)
downloadzig-5105c3c7fa46969dc731b7447415436fd7572e87.tar.gz
zig-5105c3c7fa46969dc731b7447415436fd7572e87.zip
Merge pull request #23158 from alichraghi/ali_spirv
spirv: miscellaneous stuff #2
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/Target/spirv.zig38
-rw-r--r--lib/std/gpu.zig15
2 files changed, 29 insertions, 24 deletions
diff --git a/lib/std/Target/spirv.zig b/lib/std/Target/spirv.zig
index 6657bfd971..a2575b2fe8 100644
--- a/lib/std/Target/spirv.zig
+++ b/lib/std/Target/spirv.zig
@@ -10,18 +10,18 @@ pub const Feature = enum {
v1_4,
v1_5,
v1_6,
- int8,
- int16,
int64,
float16,
float64,
- addresses,
matrix,
storage_push_constant16,
+ arbitrary_precision_integers,
kernel,
+ addresses,
generic_pointer,
vector16,
shader,
+ physical_storage_buffer,
};
pub const featureSet = CpuFeature.FeatureSetFns(Feature).featureSet;
@@ -69,16 +69,6 @@ pub const all_features = blk: {
.description = "Enable version 1.6",
.dependencies = featureSet(&[_]Feature{.v1_5}),
};
- result[@intFromEnum(Feature.int8)] = .{
- .llvm_name = null,
- .description = "Enable Int8 capability",
- .dependencies = featureSet(&[_]Feature{.v1_0}),
- };
- result[@intFromEnum(Feature.int16)] = .{
- .llvm_name = null,
- .description = "Enable Int16 capability",
- .dependencies = featureSet(&[_]Feature{.v1_0}),
- };
result[@intFromEnum(Feature.int64)] = .{
.llvm_name = null,
.description = "Enable Int64 capability",
@@ -94,11 +84,6 @@ pub const all_features = blk: {
.description = "Enable Float64 capability",
.dependencies = featureSet(&[_]Feature{.v1_0}),
};
- result[@intFromEnum(Feature.addresses)] = .{
- .llvm_name = null,
- .description = "Enable either the Addresses capability or, SPV_KHR_physical_storage_buffer extension and the PhysicalStorageBufferAddresses capability",
- .dependencies = featureSet(&[_]Feature{.v1_0}),
- };
result[@intFromEnum(Feature.matrix)] = .{
.llvm_name = null,
.description = "Enable Matrix capability",
@@ -109,11 +94,21 @@ pub const all_features = blk: {
.description = "Enable SPV_KHR_16bit_storage extension and the StoragePushConstant16 capability",
.dependencies = featureSet(&[_]Feature{.v1_3}),
};
+ result[@intFromEnum(Feature.arbitrary_precision_integers)] = .{
+ .llvm_name = null,
+ .description = "Enable SPV_INTEL_arbitrary_precision_integers extension and the ArbitraryPrecisionIntegersINTEL capability",
+ .dependencies = featureSet(&[_]Feature{.v1_5}),
+ };
result[@intFromEnum(Feature.kernel)] = .{
.llvm_name = null,
.description = "Enable Kernel capability",
.dependencies = featureSet(&[_]Feature{.v1_0}),
};
+ result[@intFromEnum(Feature.addresses)] = .{
+ .llvm_name = null,
+ .description = "Enable Addresses capability",
+ .dependencies = featureSet(&[_]Feature{.v1_0}),
+ };
result[@intFromEnum(Feature.generic_pointer)] = .{
.llvm_name = null,
.description = "Enable GenericPointer capability",
@@ -129,6 +124,11 @@ pub const all_features = blk: {
.description = "Enable Shader capability",
.dependencies = featureSet(&[_]Feature{ .v1_0, .matrix }),
};
+ result[@intFromEnum(Feature.physical_storage_buffer)] = .{
+ .llvm_name = null,
+ .description = "Enable SPV_KHR_physical_storage_buffer extension and the PhysicalStorageBufferAddresses capability",
+ .dependencies = featureSet(&[_]Feature{.v1_0}),
+ };
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
@@ -147,7 +147,7 @@ pub const cpu = struct {
pub const vulkan_v1_2: CpuModel = .{
.name = "vulkan_v1_2",
.llvm_name = null,
- .features = featureSet(&[_]Feature{ .v1_5, .shader, .addresses }),
+ .features = featureSet(&[_]Feature{ .v1_5, .shader, .physical_storage_buffer }),
};
pub const opencl_v2: CpuModel = .{
diff --git a/lib/std/gpu.zig b/lib/std/gpu.zig
index b9ad2fcda0..d02b2424d4 100644
--- a/lib/std/gpu.zig
+++ b/lib/std/gpu.zig
@@ -80,7 +80,8 @@ pub fn fragmentDepth(comptime ptr: *addrspace(.output) f32) void {
/// Forms the main linkage for `input` and `output` address spaces.
/// `ptr` must be a reference to variable or struct field.
pub fn location(comptime ptr: anytype, comptime loc: u32) void {
- asm volatile ("OpDecorate %ptr Location $loc"
+ asm volatile (
+ \\OpDecorate %ptr Location $loc
:
: [ptr] "" (ptr),
[loc] "c" (loc),
@@ -110,7 +111,8 @@ pub const Origin = enum(u32) {
/// The coordinates appear to originate in the specified `origin`.
/// Only valid with the `Fragment` calling convention.
pub fn fragmentOrigin(comptime entry_point: anytype, comptime origin: Origin) void {
- asm volatile ("OpExecutionMode %entry_point $origin"
+ asm volatile (
+ \\OpExecutionMode %entry_point $origin
:
: [entry_point] "" (entry_point),
[origin] "c" (@intFromEnum(origin)),
@@ -137,7 +139,8 @@ pub const DepthMode = enum(u32) {
/// Only valid with the `Fragment` calling convention.
pub fn depthMode(comptime entry_point: anytype, comptime mode: DepthMode) void {
- asm volatile ("OpExecutionMode %entry_point $mode"
+ asm volatile (
+ \\OpExecutionMode %entry_point $mode
:
: [entry_point] "" (entry_point),
[mode] "c" (mode),
@@ -147,7 +150,8 @@ pub fn depthMode(comptime entry_point: anytype, comptime mode: DepthMode) void {
/// Indicates the workgroup size in the `x`, `y`, and `z` dimensions.
/// Only valid with the `GLCompute` or `Kernel` calling conventions.
pub fn workgroupSize(comptime entry_point: anytype, comptime size: @Vector(3, u32)) void {
- asm volatile ("OpExecutionMode %entry_point LocalSize %x %y %z"
+ asm volatile (
+ \\OpExecutionMode %entry_point LocalSize %x %y %z
:
: [entry_point] "" (entry_point),
[x] "c" (size[0]),
@@ -159,7 +163,8 @@ pub fn workgroupSize(comptime entry_point: anytype, comptime size: @Vector(3, u3
/// A hint to the client, which indicates the workgroup size in the `x`, `y`, and `z` dimensions.
/// Only valid with the `GLCompute` or `Kernel` calling conventions.
pub fn workgroupSizeHint(comptime entry_point: anytype, comptime size: @Vector(3, u32)) void {
- asm volatile ("OpExecutionMode %entry_point LocalSizeHint %x %y %z"
+ asm volatile (
+ \\OpExecutionMode %entry_point LocalSizeHint %x %y %z
:
: [entry_point] "" (entry_point),
[x] "c" (size[0]),