adding base image
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
const spv = @import("spv.zig");
|
||||||
|
|
||||||
|
const SpvVoid = spv.SpvVoid;
|
||||||
|
const SpvByte = spv.SpvByte;
|
||||||
|
const SpvWord = spv.SpvWord;
|
||||||
|
const SpvBool = spv.SpvBool;
|
||||||
|
|
||||||
|
width: u32,
|
||||||
|
height: u32,
|
||||||
|
depth: u32,
|
||||||
|
layers: u32,
|
||||||
|
levels: u32,
|
||||||
|
|||||||
@@ -129,7 +129,15 @@ pub const TypeData = union(Type) {
|
|||||||
return_type: SpvWord,
|
return_type: SpvWord,
|
||||||
params: []const SpvWord,
|
params: []const SpvWord,
|
||||||
},
|
},
|
||||||
Image: struct {},
|
Image: struct {
|
||||||
|
dim: spv.SpvDim,
|
||||||
|
depth: SpvByte,
|
||||||
|
arrayed: SpvByte,
|
||||||
|
ms: SpvByte,
|
||||||
|
sampled: SpvByte,
|
||||||
|
format: spv.SpvImageFormat,
|
||||||
|
access: ?spv.SpvAccessQualifier,
|
||||||
|
},
|
||||||
Sampler: struct {},
|
Sampler: struct {},
|
||||||
SampledImage: struct {},
|
SampledImage: struct {},
|
||||||
Pointer: struct {
|
Pointer: struct {
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ pub const SetupDispatcher = block: {
|
|||||||
.IAdd = autoSetupConstant,
|
.IAdd = autoSetupConstant,
|
||||||
.IAddCarry = autoSetupConstant,
|
.IAddCarry = autoSetupConstant,
|
||||||
.IEqual = autoSetupConstant,
|
.IEqual = autoSetupConstant,
|
||||||
|
.ImageRead = autoSetupConstant,
|
||||||
.IMul = autoSetupConstant,
|
.IMul = autoSetupConstant,
|
||||||
.INotEqual = autoSetupConstant,
|
.INotEqual = autoSetupConstant,
|
||||||
.ISub = autoSetupConstant,
|
.ISub = autoSetupConstant,
|
||||||
@@ -190,6 +191,7 @@ pub const SetupDispatcher = block: {
|
|||||||
.TypeBool = opTypeBool,
|
.TypeBool = opTypeBool,
|
||||||
.TypeFloat = opTypeFloat,
|
.TypeFloat = opTypeFloat,
|
||||||
.TypeFunction = opTypeFunction,
|
.TypeFunction = opTypeFunction,
|
||||||
|
.TypeImage = opTypeImage,
|
||||||
.TypeInt = opTypeInt,
|
.TypeInt = opTypeInt,
|
||||||
.TypeMatrix = opTypeMatrix,
|
.TypeMatrix = opTypeMatrix,
|
||||||
.TypePointer = opTypePointer,
|
.TypePointer = opTypePointer,
|
||||||
@@ -2371,6 +2373,26 @@ fn opTypeFunction(allocator: std.mem.Allocator, word_count: SpvWord, rt: *Runtim
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn opTypeImage(_: std.mem.Allocator, word_count: SpvWord, rt: *Runtime) RuntimeError!void {
|
||||||
|
const id = try rt.it.next();
|
||||||
|
rt.results[id].variant = .{
|
||||||
|
.Type = .{
|
||||||
|
.Image = .{
|
||||||
|
.dim = try rt.it.nextAs(spv.SpvDim),
|
||||||
|
.depth = @truncate(try rt.it.next()),
|
||||||
|
.arrayed = @truncate(try rt.it.next()),
|
||||||
|
.ms = @truncate(try rt.it.next()),
|
||||||
|
.sampled = @truncate(try rt.it.next()),
|
||||||
|
.format = try rt.it.nextAs(spv.SpvImageFormat),
|
||||||
|
.access = null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
if (word_count > 8) {
|
||||||
|
rt.results[id].variant.?.Type.Image.access = try rt.it.nextAs(spv.SpvAccessQualifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn opTypeInt(_: std.mem.Allocator, _: SpvWord, rt: *Runtime) RuntimeError!void {
|
fn opTypeInt(_: std.mem.Allocator, _: SpvWord, rt: *Runtime) RuntimeError!void {
|
||||||
const id = try rt.it.next();
|
const id = try rt.it.next();
|
||||||
rt.results[id].variant = .{
|
rt.results[id].variant = .{
|
||||||
|
|||||||
Reference in New Issue
Block a user