Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/typegpu/src/core/texture/texture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ class TgpuTextureImpl<TProps extends TextureProps>
texture: this[$internal].unwrap(),
mipLevel,
},
source,
'buffer' in source ? source.buffer : source,
{
bytesPerRow: this.#formatInfo.texelSize * mipWidth,
rowsPerImage: mipHeight,
Expand Down
4 changes: 2 additions & 2 deletions packages/typegpu/tests/texture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ Overload 2 of 2, '(schema: "(Error) Storage texture format 'rgba8snorm' incompat
texture: expect.anything(),
mipLevel: 0,
}),
data,
data.buffer,
expect.objectContaining({
bytesPerRow: 16, // 4 pixels * 4 bytes per pixel
rowsPerImage: 4,
Expand All @@ -503,7 +503,7 @@ Overload 2 of 2, '(schema: "(Error) Storage texture format 'rgba8snorm' incompat

expect(device.mock.queue.writeTexture).toHaveBeenCalledWith(
{ texture: expect.anything(), mipLevel: 2 },
data,
data.buffer,
{ bytesPerRow: 8, rowsPerImage: 2 }, // 2 pixels * 4 bytes per pixel
[2, 2, 1], // Mip level 2 dimensions
);
Expand Down
Loading
Loading