adding base image
All checks were successful
Build / build (push) Successful in 2m5s
Test / build (push) Successful in 10m33s

This commit is contained in:
2026-04-06 22:49:23 +02:00
parent 85e0fe4362
commit b051c71f02
3 changed files with 44 additions and 1 deletions

View File

@@ -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,

View File

@@ -129,7 +129,15 @@ pub const TypeData = union(Type) {
return_type: 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 {},
SampledImage: struct {},
Pointer: struct {

View File

@@ -144,6 +144,7 @@ pub const SetupDispatcher = block: {
.IAdd = autoSetupConstant,
.IAddCarry = autoSetupConstant,
.IEqual = autoSetupConstant,
.ImageRead = autoSetupConstant,
.IMul = autoSetupConstant,
.INotEqual = autoSetupConstant,
.ISub = autoSetupConstant,
@@ -190,6 +191,7 @@ pub const SetupDispatcher = block: {
.TypeBool = opTypeBool,
.TypeFloat = opTypeFloat,
.TypeFunction = opTypeFunction,
.TypeImage = opTypeImage,
.TypeInt = opTypeInt,
.TypeMatrix = opTypeMatrix,
.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 {
const id = try rt.it.next();
rt.results[id].variant = .{