adding cleaning engines, adding image engine
This commit is contained in:
@@ -84,3 +84,7 @@ int main(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
A full documentation on how to use this interpreter will come soon (when I'll stop being lazy).
|
||||||
|
|||||||
+3
-2
@@ -139,7 +139,9 @@ pub const TypeData = union(Type) {
|
|||||||
access: ?spv.SpvAccessQualifier,
|
access: ?spv.SpvAccessQualifier,
|
||||||
},
|
},
|
||||||
Sampler: struct {},
|
Sampler: struct {},
|
||||||
SampledImage: struct {},
|
SampledImage: struct {
|
||||||
|
image_type: SpvWord,
|
||||||
|
},
|
||||||
Pointer: struct {
|
Pointer: struct {
|
||||||
storage_class: spv.SpvStorageClass,
|
storage_class: spv.SpvStorageClass,
|
||||||
target: SpvWord,
|
target: SpvWord,
|
||||||
@@ -460,7 +462,6 @@ pub fn getMemberCounts(self: *const Self) usize {
|
|||||||
.Vector2f32, .Vector2i32, .Vector2u32 => return 2,
|
.Vector2f32, .Vector2i32, .Vector2u32 => return 2,
|
||||||
.Matrix => |m| return m.member_count,
|
.Matrix => |m| return m.member_count,
|
||||||
.Array => |a| return a.member_count,
|
.Array => |a| return a.member_count,
|
||||||
.SampledImage => return 2,
|
|
||||||
.Structure => |s| return s.members_type_word.len,
|
.Structure => |s| return s.members_type_word.len,
|
||||||
.Function => |f| return f.params.len,
|
.Function => |f| return f.params.len,
|
||||||
else => {},
|
else => {},
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ pub const ImageAPI = struct {
|
|||||||
readImageInt4: *const fn (driver_image: *anyopaque, dim: spv.SpvDim, x: i32, y: i32, z: i32) RuntimeError!Vec4(u32),
|
readImageInt4: *const fn (driver_image: *anyopaque, dim: spv.SpvDim, x: i32, y: i32, z: i32) RuntimeError!Vec4(u32),
|
||||||
writeImageFloat4: *const fn (driver_image: *anyopaque, dim: spv.SpvDim, x: i32, y: i32, z: i32, pixel: Vec4(f32)) RuntimeError!void,
|
writeImageFloat4: *const fn (driver_image: *anyopaque, dim: spv.SpvDim, x: i32, y: i32, z: i32, pixel: Vec4(f32)) RuntimeError!void,
|
||||||
writeImageInt4: *const fn (driver_image: *anyopaque, dim: spv.SpvDim, x: i32, y: i32, z: i32, pixel: Vec4(u32)) RuntimeError!void,
|
writeImageInt4: *const fn (driver_image: *anyopaque, dim: spv.SpvDim, x: i32, y: i32, z: i32, pixel: Vec4(u32)) RuntimeError!void,
|
||||||
|
sampleImageFloat4: *const fn (driver_image: *anyopaque, driver_sampler: *anyopaque, dim: spv.SpvDim, x: f32, y: f32, z: f32) RuntimeError!Vec4(f32),
|
||||||
};
|
};
|
||||||
|
|
||||||
mod: *Module,
|
mod: *Module,
|
||||||
|
|||||||
+16
-2
@@ -113,7 +113,11 @@ pub const Value = union(Type) {
|
|||||||
driver_image: *anyopaque,
|
driver_image: *anyopaque,
|
||||||
},
|
},
|
||||||
Sampler: struct {},
|
Sampler: struct {},
|
||||||
SampledImage: struct {},
|
SampledImage: struct {
|
||||||
|
type_word: SpvWord,
|
||||||
|
driver_image: *anyopaque,
|
||||||
|
driver_sampler: *anyopaque,
|
||||||
|
},
|
||||||
Pointer: struct {
|
Pointer: struct {
|
||||||
ptr: union(enum) {
|
ptr: union(enum) {
|
||||||
common: *Self,
|
common: *Self,
|
||||||
@@ -244,7 +248,13 @@ pub const Value = union(Type) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
.Sampler => RuntimeError.ToDo,
|
.Sampler => RuntimeError.ToDo,
|
||||||
.SampledImage => RuntimeError.ToDo,
|
.SampledImage => .{
|
||||||
|
.SampledImage = .{
|
||||||
|
.type_word = target_type,
|
||||||
|
.driver_image = undefined,
|
||||||
|
.driver_sampler = undefined,
|
||||||
|
},
|
||||||
|
},
|
||||||
.Pointer => .{
|
.Pointer => .{
|
||||||
.Pointer = .{
|
.Pointer = .{
|
||||||
.ptr = undefined,
|
.ptr = undefined,
|
||||||
@@ -469,6 +479,10 @@ pub const Value = union(Type) {
|
|||||||
},
|
},
|
||||||
.RuntimeArray => |*arr| arr.data = @constCast(input[0..]),
|
.RuntimeArray => |*arr| arr.data = @constCast(input[0..]),
|
||||||
.Image => |*img| img.driver_image = @ptrFromInt(std.mem.bytesToValue(usize, input[0..])),
|
.Image => |*img| img.driver_image = @ptrFromInt(std.mem.bytesToValue(usize, input[0..])),
|
||||||
|
.SampledImage => |*img| {
|
||||||
|
img.driver_image = @ptrFromInt(std.mem.bytesToValue(usize, input[0..]));
|
||||||
|
img.driver_sampler = @ptrFromInt(std.mem.bytesToValue(usize, input[@sizeOf(usize)..]));
|
||||||
|
},
|
||||||
else => return RuntimeError.InvalidValueType,
|
else => return RuntimeError.InvalidValueType,
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+688
-547
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user