gpu: taked slice child type in writeTexture

This commit is contained in:
Ali Chraghi 2022-05-23 11:43:11 +04:30 committed by Stephen Gutekanst
parent 6922435110
commit b5d10fb167
4 changed files with 10 additions and 7 deletions

View file

@ -129,11 +129,11 @@ pub fn init(app: *App, engine: *mach.Engine) !void {
.rows_per_image = @intCast(u32, img.height),
};
switch (img.pixels.?) {
.Rgba32 => |pixels| queue.writeTexture(&.{ .texture = cube_texture }, pixels, &data_layout, &img_size),
.Rgba32 => |pixels| queue.writeTexture(&.{ .texture = cube_texture }, &data_layout, &img_size, zigimg.color.Rgba32, pixels),
.Rgb24 => |pixels| {
const data = try rgb24ToRgba32(engine.allocator, pixels);
//defer data.deinit(allocator);
queue.writeTexture(&.{ .texture = cube_texture }, data.Rgba32, &data_layout, &img_size);
queue.writeTexture(&.{ .texture = cube_texture }, &data_layout, &img_size, zigimg.color.Rgba32, data.Rgba32);
},
else => @panic("unsupported image color format"),
}