From eb4539a27d72defc2f90a0b164a5d7f27df79ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 10 Aug 2024 15:25:41 +0200 Subject: [PATCH] std.Target: Rename glsl450 Arch tag to opengl. Versions can simply use the normal version range mechanism, or alternatively an Abi tag if that makes more sense. For now, we only care about 4.5 anyway. --- lib/compiler/aro/aro/target.zig | 2 +- lib/std/Target.zig | 16 ++++++++-------- src/codegen/llvm.zig | 4 ++-- src/link/SpirV.zig | 8 ++++---- test/llvm_targets.zig | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/compiler/aro/aro/target.zig b/lib/compiler/aro/aro/target.zig index a8767233024dd1465c3ce4ddd350ca21c6dab40b..95be478230f28f7136391ce92c81bcfb1a8ddddd 100644 --- a/lib/compiler/aro/aro/target.zig +++ b/lib/compiler/aro/aro/target.zig @@ -652,7 +652,7 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 { .shadermodel => "shadermodel", .liteos => "liteos", .opencl, - .glsl450, + .opengl, .vulkan, .plan9, .other, diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 13b269bfcc92bceaa49d974acad377d453a5a2c8..cfbb2f25dce92accac98bde8a999c4846883e291 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -63,10 +63,10 @@ pub const Os = struct { amdhsa, amdpal, cuda, - glsl450, mesa3d, nvcl, opencl, + opengl, shadermodel, vulkan, @@ -171,7 +171,7 @@ pub const Os = struct { .liteos, .uefi, .opencl, // TODO: OpenCL versions - .glsl450, // TODO: GLSL versions + .opengl, // TODO: GLSL versions .vulkan, .plan9, .illumos, @@ -402,7 +402,7 @@ pub const Os = struct { .liteos, .uefi, .opencl, // TODO: OpenCL versions - .glsl450, // TODO: GLSL versions + .opengl, // TODO: GLSL versions .vulkan, .plan9, .illumos, @@ -601,7 +601,7 @@ pub const Os = struct { .liteos, .uefi, .opencl, - .glsl450, + .opengl, .vulkan, .plan9, .other, @@ -715,7 +715,7 @@ pub const Abi = enum { => .musl, .liteos => .ohos, .opencl, // TODO: SPIR-V ABIs with Linkage capability - .glsl450, + .opengl, .vulkan, .plan9, // TODO specify abi .macos, @@ -1661,7 +1661,7 @@ pub inline fn hasDynamicLinker(target: Target) bool { .windows, .emscripten, .opencl, - .glsl450, + .opengl, .vulkan, .plan9, .other, @@ -1829,7 +1829,7 @@ pub const DynamicLinker = struct { .emscripten, .wasi, .opencl, - .glsl450, + .opengl, .vulkan, .other, .plan9, @@ -2346,7 +2346,7 @@ pub fn c_type_bit_size(target: Target, c_type: CType) u16 { .contiki, .hermit, .hurd, - .glsl450, + .opengl, .driverkit, .shadermodel, .liteos, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index b900c15d8203ebd18538b9b51074f3eef32dd7e3..959d5fa65887517f9e6caf207129cd07b4fc7930 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -140,7 +140,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { .serenity => "serenity", .vulkan => "vulkan", - .glsl450, + .opengl, .plan9, .minix, .contiki, @@ -210,7 +210,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { .freestanding, .other, .opencl, - .glsl450, + .opengl, .plan9, .minix, .contiki, diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig index e97c80c3feb6662aefc03a0d92adc8a4113f5fff..57e69ed860e217b96d3b837b8744a7e8968ee5a2 100644 --- a/src/link/SpirV.zig +++ b/src/link/SpirV.zig @@ -85,7 +85,7 @@ pub fn createEmpty( } switch (target.os.tag) { - .opencl, .glsl450, .vulkan => {}, + .opencl, .opengl, .vulkan => {}, else => unreachable, // Caught by Compilation.Config.resolve. } @@ -290,7 +290,7 @@ fn writeCapabilities(spv: *SpvModule, target: std.Target) !void { // TODO: Integrate with a hypothetical feature system const caps: []const spec.Capability = switch (target.os.tag) { .opencl => &.{ .Kernel, .Addresses, .Int8, .Int16, .Int64, .Float64, .Float16, .Vector16, .GenericPointer }, - .glsl450 => &.{.Shader}, + .opengl => &.{.Shader}, .vulkan => &.{ .Shader, .VariablePointersStorageBuffer, .Int8, .Int16, .Int64, .Float64, .Float16 }, else => unreachable, // TODO }; @@ -311,13 +311,13 @@ fn writeMemoryModel(spv: *SpvModule, target: std.Target) !void { .spirv64 => spec.AddressingModel.Physical64, else => unreachable, // TODO }, - .glsl450, .vulkan => spec.AddressingModel.Logical, + .opengl, .vulkan => spec.AddressingModel.Logical, else => unreachable, // TODO }; const memory_model: spec.MemoryModel = switch (target.os.tag) { .opencl => .OpenCL, - .glsl450 => .GLSL450, + .opengl => .GLSL450, .vulkan => .GLSL450, else => unreachable, }; diff --git a/test/llvm_targets.zig b/test/llvm_targets.zig index 71dc9e30a387597a2b2d85a9c2eb22fc7cc84840..76b9e668fa8c8fea0a114e824ba843b8c6a0b720 100644 --- a/test/llvm_targets.zig +++ b/test/llvm_targets.zig @@ -90,10 +90,10 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .sparc64, .os_tag = .freestanding, .abi = .none }, .{ .cpu_arch = .sparc64, .os_tag = .linux, .abi = .gnu }, //.{ .cpu_arch = .spirv32, .os_tag = .opencl, .abi = .none }, - //.{ .cpu_arch = .spirv32, .os_tag = .glsl450, .abi = .none }, + //.{ .cpu_arch = .spirv32, .os_tag = .opengl, .abi = .none }, //.{ .cpu_arch = .spirv32, .os_tag = .vulkan, .abi = .none }, //.{ .cpu_arch = .spirv64, .os_tag = .opencl, .abi = .none }, - //.{ .cpu_arch = .spirv64, .os_tag = .glsl450, .abi = .none }, + //.{ .cpu_arch = .spirv64, .os_tag = .opengl, .abi = .none }, //.{ .cpu_arch = .spirv64, .os_tag = .vulkan, .abi = .none }, .{ .cpu_arch = .thumb, .os_tag = .freestanding, .abi = .none }, .{ .cpu_arch = .thumbeb, .os_tag = .freestanding, .abi = .none }, -- 2.54.0