adding backend agnostic IR
This commit is contained in:
@@ -154,7 +154,7 @@ pub fn beginRenderPass(interface: *Interface, render_pass: *base.RenderPass, fra
|
||||
_ = clear_values;
|
||||
}
|
||||
|
||||
pub fn bindDescriptorSets(interface: *Interface, bind_point: vk.PipelineBindPoint, first_set: u32, sets: [base.VULKAN_MAX_DESCRIPTOR_SETS]?*base.DescriptorSet, dynamic_offsets: []const u32) VkError!void {
|
||||
pub fn bindDescriptorSets(interface: *Interface, bind_point: vk.PipelineBindPoint, first_set: u32, sets: [base.vulkan_max_descriptor_sets]?*base.DescriptorSet, dynamic_offsets: []const u32) VkError!void {
|
||||
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
|
||||
self.cmd_count += 1;
|
||||
_ = bind_point;
|
||||
|
||||
@@ -27,7 +27,7 @@ fn castExtension(comptime ext: vk.ApiInfo) vk.ExtensionProperties {
|
||||
return props;
|
||||
}
|
||||
|
||||
pub const EXTENSIONS = [_]vk.ExtensionProperties{
|
||||
pub const extensions = [_]vk.ExtensionProperties{
|
||||
castExtension(vk.extensions.khr_device_group_creation),
|
||||
castExtension(vk.extensions.khr_get_physical_device_properties_2),
|
||||
castExtension(vk.extensions.khr_surface),
|
||||
|
||||
@@ -24,7 +24,7 @@ fn castExtension(comptime ext: vk.ApiInfo) vk.ExtensionProperties {
|
||||
return props;
|
||||
}
|
||||
|
||||
pub const EXTENSIONS = [_]vk.ExtensionProperties{
|
||||
pub const extensions = [_]vk.ExtensionProperties{
|
||||
castExtension(vk.extensions.khr_device_group),
|
||||
castExtension(vk.extensions.khr_swapchain),
|
||||
};
|
||||
@@ -55,8 +55,8 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance, mic_device
|
||||
.getSurfaceSupportKHR = getSurfaceSupportKHR,
|
||||
};
|
||||
|
||||
interface.props.api_version = @bitCast(lib.VULKAN_VERSION);
|
||||
interface.props.driver_version = @bitCast(base.DRIVER_VERSION);
|
||||
interface.props.api_version = @bitCast(lib.vulkan_version);
|
||||
interface.props.driver_version = @bitCast(base.driver_version);
|
||||
interface.props.device_type = .other;
|
||||
|
||||
@memset(interface.props.device_name[0..], 0);
|
||||
@@ -292,10 +292,10 @@ pub fn enumerateExtensionProperties(_: *const Interface, layer_name: ?[]const u8
|
||||
return VkError.LayerNotPresent;
|
||||
}
|
||||
|
||||
const available = EXTENSIONS.len;
|
||||
const available = extensions.len;
|
||||
if (p_properties) |properties| {
|
||||
const write_count = @min(count.*, available);
|
||||
for (EXTENSIONS[0..write_count], properties[0..write_count]) |ext, *prop| {
|
||||
for (extensions[0..write_count], properties[0..write_count]) |ext, *prop| {
|
||||
prop.* = ext;
|
||||
}
|
||||
count.* = @intCast(write_count);
|
||||
|
||||
@@ -96,7 +96,7 @@ pub fn statusToErr(status: c_int) VkError {
|
||||
fn writeAll(self: *Self, bytes: []const u8) VkError!void {
|
||||
var offset: usize = 0;
|
||||
while (offset < bytes.len) {
|
||||
const written = scif.send(self.epd, bytes[offset..].ptr, bytes.len - offset, scif.SEND_BLOCK);
|
||||
const written = scif.send(self.epd, bytes[offset..].ptr, bytes.len - offset, scif.send_block);
|
||||
if (written <= 0) {
|
||||
return VkError.InitializationFailed;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ fn writeAll(self: *Self, bytes: []const u8) VkError!void {
|
||||
fn readAll(self: *Self, bytes: []u8) VkError!void {
|
||||
var offset: usize = 0;
|
||||
while (offset < bytes.len) {
|
||||
const read = scif.recv(self.epd, bytes[offset..].ptr, bytes.len - offset, scif.RECV_BLOCK);
|
||||
const read = scif.recv(self.epd, bytes[offset..].ptr, bytes.len - offset, scif.recv_block);
|
||||
if (read <= 0) {
|
||||
return VkError.InitializationFailed;
|
||||
}
|
||||
|
||||
+3
-3
@@ -38,11 +38,11 @@ pub const PhiShaderModule = @import("PhiShaderModule.zig");
|
||||
|
||||
pub const Instance = PhiInstance;
|
||||
|
||||
pub const DRIVER_NAME = "Phi";
|
||||
pub const driver_name = "Phi";
|
||||
|
||||
pub const PHYSICAL_DEVICE_DEFAULT_NAME = "Intel(R) Xeon Phi(TM) Coprocessor";
|
||||
pub const physical_device_default_name = "Intel(R) Xeon Phi(TM) Coprocessor";
|
||||
|
||||
pub const VULKAN_VERSION = vk.makeApiVersion(
|
||||
pub const vulkan_version = vk.makeApiVersion(
|
||||
0,
|
||||
config.phi_vulkan_version.major,
|
||||
config.phi_vulkan_version.minor,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
const PciInfo = struct {
|
||||
id: u16,
|
||||
name: []const u8,
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ pub const PortId = extern struct {
|
||||
port: u16,
|
||||
};
|
||||
|
||||
pub const SEND_BLOCK = 1;
|
||||
pub const RECV_BLOCK = 1;
|
||||
pub const send_block = 1;
|
||||
pub const recv_block = 1;
|
||||
|
||||
// SAFETY: load assigns every function pointer before the public wrappers can be used.
|
||||
var scif_open: *const fn () callconv(.c) epd_t = undefined;
|
||||
|
||||
Reference in New Issue
Block a user