gpu: throw error if texture data is not slice #289

Merged
alichraghi merged 1 commit from main into main 2022-05-24 21:34:13 +00:00
alichraghi commented 2022-05-23 07:13:55 +00:00 (Migrated from github.com)
  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
- [x] By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
emidoots (Migrated from github.com) reviewed 2022-05-23 07:26:12 +00:00
@ -65,4 +65,3 @@
destination: *const ImageCopyTexture,
data: anytype,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
emidoots (Migrated from github.com) commented 2022-05-23 07:26:11 +00:00

Nice! I think there are more places than just here that we need to update - though.

  • Queue.zig fn writeBuffer
  • CommandEncoder.zig fn writeBuffer
Nice! I think there are more places than just here that we need to update - though. * `Queue.zig` `fn writeBuffer` * `CommandEncoder.zig` `fn writeBuffer`
alichraghi (Migrated from github.com) reviewed 2022-05-23 07:27:09 +00:00
@ -65,4 +65,3 @@
destination: *const ImageCopyTexture,
data: anytype,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
alichraghi (Migrated from github.com) commented 2022-05-23 07:27:09 +00:00

yeah im aware. will update this soon

yeah im aware. will update this soon
alichraghi (Migrated from github.com) reviewed 2022-05-23 07:27:53 +00:00
@ -65,4 +65,3 @@
destination: *const ImageCopyTexture,
data: anytype,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
alichraghi (Migrated from github.com) commented 2022-05-23 07:27:53 +00:00

also this seems wrong (check CI log)

also this seems wrong (check CI log)
emidoots (Migrated from github.com) reviewed 2022-05-24 02:54:00 +00:00
@ -65,4 +65,3 @@
destination: *const ImageCopyTexture,
data: anytype,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
emidoots (Migrated from github.com) commented 2022-05-24 02:54:00 +00:00

It looks like std.meta.isSliceOf(T) might do what we want https://sourcegraph.com/github.com/ziglang/zig/-/blob/lib/std/meta/trait.zig?L142:7

It looks like `std.meta.isSliceOf(T)` might do what we want https://sourcegraph.com/github.com/ziglang/zig/-/blob/lib/std/meta/trait.zig?L142:7
alichraghi (Migrated from github.com) reviewed 2022-05-24 15:42:28 +00:00
@ -65,4 +65,3 @@
destination: *const ImageCopyTexture,
data: anytype,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
alichraghi (Migrated from github.com) commented 2022-05-24 15:42:28 +00:00

about writeBuffer, you mean remove comptime T: type and just take data slice as anytype and check it?

about `writeBuffer`, you mean remove `comptime T: type` and just take data slice as `anytype` and check it?
emidoots (Migrated from github.com) reviewed 2022-05-24 18:54:41 +00:00
@ -65,4 +65,3 @@
destination: *const ImageCopyTexture,
data: anytype,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
emidoots (Migrated from github.com) commented 2022-05-24 18:54:41 +00:00

Oh, dang - It's confusing we ended up with different APIs here. I looked around, and actually it seems like comptime T: type, data: []const T is pretty reasonable. Maybe we should just change this writeTexture function signature to that instead of data: anytype?

Oh, dang - It's confusing we ended up with different APIs here. I looked around, and actually it seems like `comptime T: type, data: []const T` is pretty reasonable. Maybe we should just change this `writeTexture` function signature to that instead of `data: anytype`?
alichraghi (Migrated from github.com) reviewed 2022-05-24 18:56:16 +00:00
@ -65,4 +65,3 @@
destination: *const ImageCopyTexture,
data: anytype,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
alichraghi (Migrated from github.com) commented 2022-05-24 18:56:15 +00:00

yeah make sense 👍

yeah make sense :+1:
emidoots (Migrated from github.com) approved these changes 2022-05-24 21:34:07 +00:00
emidoots (Migrated from github.com) left a comment

Even better, thank you for doing this!

Even better, thank you for doing this!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach!289
No description provided.