| ... | ... | @@ -296,9 +296,8 @@ fn writeCapabilities(spv: *SpvModule, target: std.Target) !void { |
| 296 | 296 | // TODO: Integrate with a hypothetical feature system |
| 297 | 297 | const caps: []const spec.Capability = switch (target.os.tag) { |
| 298 | 298 | .opencl => &.{ .Kernel, .Addresses, .Int8, .Int16, .Int64, .Float64, .Float16, .Vector16, .GenericPointer }, |
| 299 | | .opengl => &.{.Shader}, |
| 300 | | .vulkan => &.{ .Shader, .VariablePointersStorageBuffer, .Int8, .Int16, .Int64, .Float64, .Float16 }, |
| 301 | | else => unreachable, // TODO |
| 299 | .vulkan => &.{ .Shader, .PhysicalStorageBufferAddresses, .StoragePushConstant16, .Int8, .Int16, .Int64, .Float64, .Float16 }, |
| 300 | else => unreachable, |
| 302 | 301 | }; |
| 303 | 302 | |
| 304 | 303 | for (caps) |cap| { |
| ... | ... | @@ -306,19 +305,32 @@ fn writeCapabilities(spv: *SpvModule, target: std.Target) !void { |
| 306 | 305 | .capability = cap, |
| 307 | 306 | }); |
| 308 | 307 | } |
| 308 | |
| 309 | switch (target.os.tag) { |
| 310 | .vulkan => { |
| 311 | try spv.sections.extensions.emit(gpa, .OpExtension, .{ |
| 312 | .name = "SPV_KHR_physical_storage_buffer", |
| 313 | }); |
| 314 | }, |
| 315 | else => {}, |
| 316 | } |
| 309 | 317 | } |
| 310 | 318 | |
| 311 | 319 | fn writeMemoryModel(spv: *SpvModule, target: std.Target) !void { |
| 312 | 320 | const gpa = spv.gpa; |
| 313 | 321 | |
| 314 | | const addressing_model = switch (target.os.tag) { |
| 322 | const addressing_model: spec.AddressingModel = switch (target.os.tag) { |
| 315 | 323 | .opencl => switch (target.cpu.arch) { |
| 316 | | .spirv32 => spec.AddressingModel.Physical32, |
| 317 | | .spirv64 => spec.AddressingModel.Physical64, |
| 318 | | else => unreachable, // TODO |
| 324 | .spirv32 => .Physical32, |
| 325 | .spirv64 => .Physical64, |
| 326 | else => unreachable, |
| 327 | }, |
| 328 | .opengl, .vulkan => switch (target.cpu.arch) { |
| 329 | .spirv32 => .Logical, // TODO: I don't think this will ever be implemented. |
| 330 | .spirv64 => .PhysicalStorageBuffer64, |
| 331 | else => unreachable, |
| 319 | 332 | }, |
| 320 | | .opengl, .vulkan => spec.AddressingModel.Logical, |
| 321 | | else => unreachable, // TODO |
| 333 | else => unreachable, |
| 322 | 334 | }; |
| 323 | 335 | |
| 324 | 336 | const memory_model: spec.MemoryModel = switch (target.os.tag) { |