adding backend agnostic IR
Test / build_and_test (push) Successful in 5m16s
Build / build (push) Successful in 6m50s

This commit is contained in:
2026-07-20 22:07:41 +02:00
parent 2375abf688
commit 9b1b223186
70 changed files with 7358 additions and 250 deletions
+5 -5
View File
@@ -17,7 +17,7 @@ pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const v
var interface = try Interface.init(device, allocator, info);
interface.allowed_memory_types = std.bit_set.IntegerBitSet(32).initEmpty();
interface.allowed_memory_types.set(lib.MEMORY_TYPE_GENERIC_BIT);
interface.allowed_memory_types.set(lib.memory_type_generic_bit);
interface.vtable = &.{
.destroy = destroy,
@@ -36,15 +36,15 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
}
pub fn getMemoryRequirements(interface: *Interface, requirements: *vk.MemoryRequirements) void {
requirements.alignment = lib.MEMORY_REQUIREMENTS_BUFFER_ALIGNMENT;
requirements.alignment = lib.memory_requirements_buffer_alignment;
if (interface.usage.uniform_texel_buffer_bit or interface.usage.storage_texel_buffer_bit) {
requirements.alignment = @max(requirements.alignment, lib.MIN_TEXEL_BUFFER_ALIGNMENT);
requirements.alignment = @max(requirements.alignment, lib.min_texel_buffer_alignment);
}
if (interface.usage.storage_buffer_bit) {
requirements.alignment = @max(requirements.alignment, lib.MIN_STORAGE_BUFFER_ALIGNMENT);
requirements.alignment = @max(requirements.alignment, lib.min_storage_buffer_alignment);
}
if (interface.usage.uniform_buffer_bit) {
requirements.alignment = @max(requirements.alignment, lib.MIN_UNIFORM_BUFFER_ALIGNMENT);
requirements.alignment = @max(requirements.alignment, lib.min_uniform_buffer_alignment);
}
}
+8 -8
View File
@@ -407,7 +407,7 @@ pub fn beginRenderPass(interface: *Interface, render_pass: *base.RenderPass, fra
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
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));
const allocator = self.command_allocator.allocator();
@@ -416,7 +416,7 @@ pub fn bindDescriptorSets(interface: *Interface, bind_point: vk.PipelineBindPoin
bind_point: vk.PipelineBindPoint,
first_set: u32,
sets: [base.VULKAN_MAX_DESCRIPTOR_SETS]?*base.DescriptorSet,
sets: [base.vulkan_max_descriptor_sets]?*base.DescriptorSet,
dynamic_offsets: []const u32,
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
@@ -430,7 +430,7 @@ pub fn bindDescriptorSets(interface: *Interface, bind_point: vk.PipelineBindPoin
state.sets[i] = soft_set;
const dynamic_count = soft_set.interface.layout.dynamic_descriptor_count;
if (dynamic_count > ExecutionDevice.MAX_DYNAMIC_DESCRIPTORS_PER_SET or
if (dynamic_count > ExecutionDevice.max_dynamic_descriptors_per_set or
dynamic_offset_index + dynamic_count > impl.dynamic_offsets.len)
{
return VkError.ValidationFailed;
@@ -496,7 +496,7 @@ pub fn bindIndexBuffer(interface: *Interface, buffer: *base.Buffer, offset: usiz
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
const impl: *Impl = @ptrCast(@alignCast(context));
device.pipeline_states[ExecutionDevice.GRAPHICS_PIPELINE_STATE].data.graphics.index_buffer = .{
device.pipeline_states[ExecutionDevice.graphics_pipeline_state].data.graphics.index_buffer = .{
.buffer = impl.buffer,
.offset = impl.offset,
.index_type = impl.index_type,
@@ -527,7 +527,7 @@ pub fn bindVertexBuffer(interface: *Interface, index: usize, buffer: *base.Buffe
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
const impl: *Impl = @ptrCast(@alignCast(context));
device.pipeline_states[ExecutionDevice.GRAPHICS_PIPELINE_STATE].data.graphics.vertex_buffers[impl.index] = .{
device.pipeline_states[ExecutionDevice.graphics_pipeline_state].data.graphics.vertex_buffers[impl.index] = .{
.buffer = impl.buffer,
.offset = impl.offset,
.size = 0,
@@ -1191,7 +1191,7 @@ pub fn pushConstants(interface: *Interface, stages: vk.ShaderStageFlags, offset:
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
const impl: *Impl = @ptrCast(@alignCast(context));
const size = @min(lib.PUSH_CONSTANT_SIZE - impl.offset, impl.blob.len);
const size = @min(lib.push_constant_size - impl.offset, impl.blob.len);
if (impl.stages.vertex_bit or
impl.stages.tessellation_control_bit or
@@ -1199,12 +1199,12 @@ pub fn pushConstants(interface: *Interface, stages: vk.ShaderStageFlags, offset:
impl.stages.geometry_bit or
impl.stages.fragment_bit)
{
const state = &device.pipeline_states[ExecutionDevice.GRAPHICS_PIPELINE_STATE];
const state = &device.pipeline_states[ExecutionDevice.graphics_pipeline_state];
@memcpy(state.push_constant_blob[impl.offset .. impl.offset + size], impl.blob[0..size]);
}
if (impl.stages.compute_bit) {
const state = &device.pipeline_states[ExecutionDevice.COMPUTE_PIPELINE_STATE];
const state = &device.pipeline_states[ExecutionDevice.compute_pipeline_state];
@memcpy(state.push_constant_blob[impl.offset .. impl.offset + size], impl.blob[0..size]);
}
}
+1 -1
View File
@@ -97,7 +97,7 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
}
pub fn getMemoryRequirements(_: *Interface, requirements: *vk.MemoryRequirements) VkError!void {
requirements.alignment = lib.MEMORY_REQUIREMENTS_IMAGE_ALIGNMENT;
requirements.alignment = lib.memory_requirements_image_alignment;
}
pub fn getClearFormat(self: *Self) VkError!vk.Format {
+1 -1
View File
@@ -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_creation),
castExtension(vk.extensions.khr_get_physical_device_properties_2),
castExtension(vk.extensions.khr_surface),
+27 -27
View File
@@ -22,7 +22,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),
};
@@ -56,11 +56,11 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S
.getSurfaceSupportKHR = getSurfaceSupportKHR,
};
interface.props.api_version = @bitCast(lib.VULKAN_VERSION);
interface.props.driver_version = @bitCast(base.DRIVER_VERSION);
interface.props.device_id = lib.DEVICE_ID;
interface.props.api_version = @bitCast(lib.vulkan_version);
interface.props.driver_version = @bitCast(base.driver_version);
interface.props.device_id = lib.device_id;
interface.props.device_type = .cpu;
interface.props.pipeline_cache_uuid = lib.PIPELINE_CACHE_UUID;
interface.props.pipeline_cache_uuid = lib.pipeline_cache_uuid;
interface.props.limits = .{
.max_image_dimension_1d = 4096,
.max_image_dimension_2d = 4096,
@@ -70,12 +70,12 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S
.max_texel_buffer_elements = 65536,
.max_uniform_buffer_range = 16384,
.max_storage_buffer_range = 134217728,
.max_push_constants_size = lib.PUSH_CONSTANT_SIZE,
.max_push_constants_size = lib.push_constant_size,
.max_memory_allocation_count = std.math.maxInt(u32),
.max_sampler_allocation_count = 4096,
.buffer_image_granularity = 131072,
.sparse_address_space_size = 0,
.max_bound_descriptor_sets = base.VULKAN_MAX_DESCRIPTOR_SETS,
.max_bound_descriptor_sets = base.vulkan_max_descriptor_sets,
.max_per_stage_descriptor_samplers = 16,
.max_per_stage_descriptor_uniform_buffers = 12,
.max_per_stage_descriptor_storage_buffers = 4,
@@ -91,8 +91,8 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S
.max_descriptor_set_sampled_images = 96,
.max_descriptor_set_storage_images = 24,
.max_descriptor_set_input_attachments = 4,
.max_vertex_input_attributes = lib.MAX_VERTEX_INPUT_ATTRIBUTES,
.max_vertex_input_bindings = lib.MAX_VERTEX_INPUT_BINDINGS,
.max_vertex_input_attributes = lib.max_vertex_input_attributes,
.max_vertex_input_bindings = lib.max_vertex_input_bindings,
.max_vertex_input_attribute_offset = 2047,
.max_vertex_input_binding_stride = 2048,
.max_vertex_output_components = 64,
@@ -182,7 +182,7 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S
};
interface.mem_props.memory_heap_count = 1;
interface.mem_props.memory_heaps[0] = .{
.size = std.process.totalSystemMemory() catch lib.PHYSICAL_DEVICE_FALLBACK_HEAP_SIZE,
.size = std.process.totalSystemMemory() catch lib.physical_device_fallback_heap_size,
.flags = .{ .device_local_bit = true },
};
@@ -240,12 +240,12 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S
}
}
break :blk command_allocator.dupe(u8, lib.PHYSICAL_DEVICE_DEFAULT_NAME) catch return VkError.OutOfHostMemory;
break :blk command_allocator.dupe(u8, lib.physical_device_default_name) catch return VkError.OutOfHostMemory;
};
defer command_allocator.free(name);
var writer = std.Io.Writer.fixed(device_name[0 .. vk.MAX_PHYSICAL_DEVICE_NAME_SIZE - 1]);
writer.print("{s} [" ++ lib.DRIVER_NAME ++ " ApeDriver]", .{name}) catch return VkError.InitializationFailed;
writer.print("{s} [" ++ lib.driver_name ++ " ApeDriver]", .{name}) catch return VkError.InitializationFailed;
}
@memcpy(&interface.props.device_name, &device_name);
@@ -277,10 +277,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);
@@ -752,26 +752,26 @@ pub fn getImageFormatProperties(
var properties: vk.ImageFormatProperties = .{
.max_extent = .{ .width = 0, .height = 0, .depth = 1 },
.max_mip_levels = 1,
.max_array_layers = lib.MAX_IMAGE_ARRAY_LAYERS,
.max_array_layers = lib.max_image_array_layers,
.sample_counts = .{ .@"1_bit" = true },
.max_resource_size = std.math.maxInt(u32),
};
switch (image_type) {
.@"1d" => {
properties.max_mip_levels = lib.MAX_IMAGE_LEVELS_1D;
properties.max_extent.width = 1 << (lib.MAX_IMAGE_LEVELS_1D - 1);
properties.max_mip_levels = lib.max_image_levels_1d;
properties.max_extent.width = 1 << (lib.max_image_levels_1d - 1);
properties.max_extent.height = 1;
},
.@"2d" => {
if (flags.cube_compatible_bit) {
properties.max_mip_levels = lib.MAX_IMAGE_LEVELS_CUBE;
properties.max_extent.width = 1 << (lib.MAX_IMAGE_LEVELS_CUBE - 1);
properties.max_extent.height = 1 << (lib.MAX_IMAGE_LEVELS_CUBE - 1);
properties.max_mip_levels = lib.max_image_levels_cube;
properties.max_extent.width = 1 << (lib.max_image_levels_cube - 1);
properties.max_extent.height = 1 << (lib.max_image_levels_cube - 1);
} else {
properties.max_mip_levels = lib.MAX_IMAGE_LEVELS_2D;
properties.max_extent.width = 1 << (lib.MAX_IMAGE_LEVELS_2D - 1);
properties.max_extent.height = 1 << (lib.MAX_IMAGE_LEVELS_2D - 1);
properties.max_mip_levels = lib.max_image_levels_2d;
properties.max_extent.width = 1 << (lib.max_image_levels_2d - 1);
properties.max_extent.height = 1 << (lib.max_image_levels_2d - 1);
const format_properties = try interface.getFormatProperties(format);
const format_features = if (tiling == .linear) format_properties.linear_tiling_features else format_properties.optimal_tiling_features;
@@ -781,10 +781,10 @@ pub fn getImageFormatProperties(
}
},
.@"3d" => {
properties.max_mip_levels = lib.MAX_IMAGE_LEVELS_3D;
properties.max_extent.width = 1 << (lib.MAX_IMAGE_LEVELS_3D - 1);
properties.max_extent.height = 1 << (lib.MAX_IMAGE_LEVELS_3D - 1);
properties.max_extent.depth = 1 << (lib.MAX_IMAGE_LEVELS_3D - 1);
properties.max_mip_levels = lib.max_image_levels_3d;
properties.max_extent.width = 1 << (lib.max_image_levels_3d - 1);
properties.max_extent.height = 1 << (lib.max_image_levels_3d - 1);
properties.max_extent.depth = 1 << (lib.max_image_levels_3d - 1);
properties.max_array_layers = 1;
},
else => return VkError.FormatNotSupported,
+11 -11
View File
@@ -13,9 +13,9 @@ const Renderer = @import("Renderer.zig");
const Self = @This();
pub const GRAPHICS_PIPELINE_STATE = 0;
pub const COMPUTE_PIPELINE_STATE = 1;
pub const MAX_DYNAMIC_DESCRIPTORS_PER_SET = 64;
pub const graphics_pipeline_state = 0;
pub const compute_pipeline_state = 1;
pub const max_dynamic_descriptors_per_set = 64;
pub const ActiveOcclusionQuery = struct {
pool: *base.QueryPool,
@@ -24,14 +24,14 @@ pub const ActiveOcclusionQuery = struct {
pub const PipelineState = struct {
pipeline: ?*SoftPipeline,
sets: [base.VULKAN_MAX_DESCRIPTOR_SETS]?*SoftDescriptorSet,
dynamic_offsets: [base.VULKAN_MAX_DESCRIPTOR_SETS][MAX_DYNAMIC_DESCRIPTORS_PER_SET]u32,
push_constant_blob: [lib.PUSH_CONSTANT_SIZE]u8,
sets: [base.vulkan_max_descriptor_sets]?*SoftDescriptorSet,
dynamic_offsets: [base.vulkan_max_descriptor_sets][max_dynamic_descriptors_per_set]u32,
push_constant_blob: [lib.push_constant_size]u8,
data: union {
compute: struct {},
graphics: struct {
index_buffer: Renderer.IndexBuffer,
vertex_buffers: [lib.MAX_VERTEX_INPUT_BINDINGS]Renderer.VertexBuffer,
vertex_buffers: [lib.max_vertex_input_bindings]Renderer.VertexBuffer,
},
},
};
@@ -48,11 +48,11 @@ pub fn setup(self: *Self, device: *SoftDevice) void {
for (self.pipeline_states[0..], 0..) |*state, i| {
state.* = .{
.pipeline = null,
.sets = [_]?*SoftDescriptorSet{null} ** base.VULKAN_MAX_DESCRIPTOR_SETS,
.dynamic_offsets = [_][MAX_DYNAMIC_DESCRIPTORS_PER_SET]u32{[_]u32{0} ** MAX_DYNAMIC_DESCRIPTORS_PER_SET} ** base.VULKAN_MAX_DESCRIPTOR_SETS,
.sets = [_]?*SoftDescriptorSet{null} ** base.vulkan_max_descriptor_sets,
.dynamic_offsets = [_][max_dynamic_descriptors_per_set]u32{[_]u32{0} ** max_dynamic_descriptors_per_set} ** base.vulkan_max_descriptor_sets,
.push_constant_blob = @splat(0),
.data = switch (i) {
GRAPHICS_PIPELINE_STATE => .{
graphics_pipeline_state => .{
.graphics = .{
// SAFETY: indexed draws bind the index buffer before the renderer reads it.
.index_buffer = undefined,
@@ -60,7 +60,7 @@ pub fn setup(self: *Self, device: *SoftDevice) void {
.vertex_buffers = undefined,
},
},
COMPUTE_PIPELINE_STATE => .{ .compute = .{} },
compute_pipeline_state => .{ .compute = .{} },
else => unreachable,
},
};
+4 -4
View File
@@ -10,7 +10,7 @@ const Renderer = @import("Renderer.zig");
const Vertex = Renderer.Vertex;
const VkError = base.VkError;
const INTERFACE_BLOB_PADDING = @sizeOf(F32x4);
const interface_blob_padding = @sizeOf(F32x4);
const ClipPlane = enum {
left,
@@ -21,7 +21,7 @@ const ClipPlane = enum {
far,
};
const MAX_CLIPPED_POLYGON_VERTICES = 16;
const max_clipped_polygon_vertices = 16;
pub const ClippedLine = struct {
v0: Vertex,
@@ -29,7 +29,7 @@ pub const ClippedLine = struct {
};
const ClippedPolygon = struct {
vertices: [MAX_CLIPPED_POLYGON_VERTICES]Vertex = std.mem.zeroes([MAX_CLIPPED_POLYGON_VERTICES]Vertex),
vertices: [max_clipped_polygon_vertices]Vertex = std.mem.zeroes([max_clipped_polygon_vertices]Vertex),
len: usize = 0,
fn append(self: *@This(), vertex: Vertex) VkError!void {
@@ -146,7 +146,7 @@ fn isVertexInsidePlane(vertex: *const Vertex, plane: ClipPlane) bool {
fn interpolateBlob(allocator: std.mem.Allocator, a: []const u8, b: []const u8, size: usize, t: f32) VkError![]u8 {
const len = @min(size, a.len, b.len);
const result = allocator.alloc(u8, len + INTERFACE_BLOB_PADDING) catch return VkError.OutOfDeviceMemory;
const result = allocator.alloc(u8, len + interface_blob_padding) catch return VkError.OutOfDeviceMemory;
@memset(result, 0);
var byte_index: usize = 0;
+9 -9
View File
@@ -11,8 +11,8 @@ const Renderer = @import("Renderer.zig");
const SoftPipeline = @import("../SoftPipeline.zig");
const SpvRuntimeError = spv.Runtime.RuntimeError;
const INTERFACE_BLOB_PADDING = @sizeOf(zm.F32x4);
const PROCESSED_INPUTS_STACK_CAPACITY = 4096;
const interface_blob_padding = @sizeOf(zm.F32x4);
const processed_inputs_stack_capacity = 4096;
pub const InvocationResult = struct {
outputs: [spv.SPIRV_MAX_OUTPUT_LOCATIONS][@sizeOf(zm.F32x4)]u8,
@@ -131,7 +131,7 @@ pub fn shaderInvocation(
const entry = try rt.getEntryPointByName(shader.entry);
var processed_inputs_stack: [PROCESSED_INPUTS_STACK_CAPACITY]bool = undefined;
var processed_inputs_stack: [processed_inputs_stack_capacity]bool = undefined;
const processed_inputs = if (rt.results.len <= processed_inputs_stack.len)
processed_inputs_stack[0..rt.results.len]
else
@@ -169,7 +169,7 @@ pub fn shaderInvocation(
else
input.size;
if (input.size == 0) {
const zeroes = allocator.alloc(u8, memory_size + INTERFACE_BLOB_PADDING) catch return SpvRuntimeError.OutOfMemory;
const zeroes = allocator.alloc(u8, memory_size + interface_blob_padding) catch return SpvRuntimeError.OutOfMemory;
@memset(zeroes, 0);
fragment_inputs[location][component] = .{
.blob = zeroes,
@@ -296,7 +296,7 @@ fn writeAggregateInputLocations(
},
}
const bytes = allocator.alloc(u8, memory_size + INTERFACE_BLOB_PADDING) catch return SpvRuntimeError.OutOfMemory;
const bytes = allocator.alloc(u8, memory_size + interface_blob_padding) catch return SpvRuntimeError.OutOfMemory;
defer allocator.free(bytes);
@memset(bytes, 0);
@@ -357,7 +357,7 @@ fn readFragmentOutput(
return SpvRuntimeError.OutOfBounds;
const memory_size = try element.getPlainMemorySize();
const output = allocator.alloc(u8, memory_size + INTERFACE_BLOB_PADDING) catch return SpvRuntimeError.OutOfMemory;
const output = allocator.alloc(u8, memory_size + interface_blob_padding) catch return SpvRuntimeError.OutOfMemory;
defer allocator.free(output);
@memset(output, 0);
@@ -370,14 +370,14 @@ fn readFragmentOutput(
}
const memory_size = try rt.getResultMemorySize(result_word);
if (memory_size <= INTERFACE_BLOB_PADDING) {
var output = std.mem.zeroes([INTERFACE_BLOB_PADDING]u8);
if (memory_size <= interface_blob_padding) {
var output = std.mem.zeroes([interface_blob_padding]u8);
try rt.readOutput(output[0..memory_size], result_word);
try copyFragmentOutputBytes(outputs, output[0..memory_size], location, component);
return;
}
const output = allocator.alloc(u8, memory_size + INTERFACE_BLOB_PADDING) catch return SpvRuntimeError.OutOfMemory;
const output = allocator.alloc(u8, memory_size + interface_blob_padding) catch return SpvRuntimeError.OutOfMemory;
defer allocator.free(output);
@memset(output, 0);
+3 -3
View File
@@ -12,7 +12,7 @@ const SoftPipeline = @import("../SoftPipeline.zig");
const blitter = @import("blitter.zig");
const VkError = base.VkError;
const INTERFACE_BLOB_PADDING = @sizeOf(F32x4);
const interface_blob_padding = @sizeOf(F32x4);
pub const RunData = struct {
allocator: std.mem.Allocator,
@@ -214,7 +214,7 @@ fn readVertexOutput(data: RunData, output: *Renderer.Vertex, rt: *spv.Runtime, l
output.outputs[location][component] = .{
.interpolation_type = interpolation_type,
.centroid = centroid,
.blob = data.allocator.alloc(u8, memory_size + INTERFACE_BLOB_PADDING) catch return VkError.OutOfDeviceMemory,
.blob = data.allocator.alloc(u8, memory_size + interface_blob_padding) catch return VkError.OutOfDeviceMemory,
.size = memory_size,
};
@memset(output.outputs[location][component].?.blob, 0);
@@ -264,7 +264,7 @@ fn writeVertexOutputValue(
output.outputs[location][component] = .{
.interpolation_type = interpolation_type,
.centroid = centroid,
.blob = data.allocator.alloc(u8, memory_size + INTERFACE_BLOB_PADDING) catch return VkError.OutOfDeviceMemory,
.blob = data.allocator.alloc(u8, memory_size + interface_blob_padding) catch return VkError.OutOfDeviceMemory,
.size = memory_size,
};
@memset(output.outputs[location][component].?.blob, 0);
+20 -20
View File
@@ -36,45 +36,45 @@ pub const SoftShaderModule = @import("SoftShaderModule.zig");
pub const Instance = SoftInstance;
pub const DRIVER_NAME = "Soft";
pub const driver_name = "Soft";
pub const VULKAN_VERSION = vk.makeApiVersion(
pub const vulkan_version = vk.makeApiVersion(
0,
config.soft_vulkan_version.major,
config.soft_vulkan_version.minor,
config.soft_vulkan_version.patch,
);
pub const DEVICE_ID = 0x600DCAFE;
pub const PIPELINE_CACHE_UUID: [vk.UUID_SIZE]u8 = "ApeSoftCacheUUID".*;
pub const device_id = 0x600DCAFE;
pub const pipeline_cache_uuid: [vk.UUID_SIZE]u8 = "ApeSoftCacheUUID".*;
/// Generic system memory.
pub const MEMORY_TYPE_GENERIC_BIT = 0;
pub const memory_type_generic_bit = 0;
/// 16 bytes for 128-bit vector types.
pub const MEMORY_REQUIREMENTS_BUFFER_ALIGNMENT = 16;
pub const memory_requirements_buffer_alignment = 16;
pub const MEMORY_REQUIREMENTS_IMAGE_ALIGNMENT = 256;
pub const memory_requirements_image_alignment = 256;
/// Vulkan 1.2 requires buffer offset alignment to be at most 256.
pub const MIN_TEXEL_BUFFER_ALIGNMENT = 256;
pub const min_texel_buffer_alignment = 256;
/// Vulkan 1.2 requires buffer offset alignment to be at most 256.
pub const MIN_UNIFORM_BUFFER_ALIGNMENT = 256;
pub const min_uniform_buffer_alignment = 256;
/// Vulkan 1.2 requires buffer offset alignment to be at most 256.
pub const MIN_STORAGE_BUFFER_ALIGNMENT = 256;
pub const min_storage_buffer_alignment = 256;
pub const MAX_VERTEX_INPUT_BINDINGS = 16;
pub const MAX_VERTEX_INPUT_ATTRIBUTES = 16;
pub const max_vertex_input_bindings = 16;
pub const max_vertex_input_attributes = 16;
pub const PUSH_CONSTANT_SIZE = 128;
pub const push_constant_size = 128;
pub const MAX_IMAGE_LEVELS_1D = 15;
pub const MAX_IMAGE_LEVELS_2D = 15;
pub const MAX_IMAGE_LEVELS_3D = 12;
pub const MAX_IMAGE_LEVELS_CUBE = 15;
pub const MAX_IMAGE_ARRAY_LAYERS = 2048;
pub const max_image_levels_1d = 15;
pub const max_image_levels_2d = 15;
pub const max_image_levels_3d = 12;
pub const max_image_levels_cube = 15;
pub const max_image_array_layers = 2048;
pub const PHYSICAL_DEVICE_DEFAULT_NAME = "Ape software device";
pub const PHYSICAL_DEVICE_FALLBACK_HEAP_SIZE = 0x10000000; // 256MB
pub const physical_device_default_name = "Ape software device";
pub const physical_device_fallback_heap_size = 0x10000000; // 256MB
pub const std_options = base.std_options;