Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot copy 3D texture data #237

Closed
almarklein opened this issue Jan 24, 2023 · 1 comment · Fixed by #238
Closed

Cannot copy 3D texture data #237

almarklein opened this issue Jan 24, 2023 · 1 comment · Fixed by #238

Comments

@almarklein
Copy link
Collaborator

almarklein commented Jan 24, 2023

In the latest release, I am having trouble getting some of our tests at wgpu-py to work. In particular, everything related to 3D textures fails. Some (incomplete) Python code to illustrate the problem:

        size = 64
        
        buffer = device.create_buffer_with_data(data=<64x64x64x4 bytes array>)

        texture = device.create_texture(
            size=(size, size, size),
            dimension=wgpu.TextureDimension.d3,
            format=wgpu.TextureFormat.rgba8uint,
            usage=wgpu.TextureUsage.TEXTURE_BINDING | wgpu.TextureUsage.COPY_DST,
        )

        command_encoder.copy_buffer_to_texture(
            {
                "buffer": buffer,
                "offset": 0,
                "bytes_per_row": 4 * size,
                "rows_per_image": size,
            },
            {"texture": texture, "mip_level": 0, "origin": (0, 0, 0)},
            (size, size, size),
        )

I get :

thread '<unnamed>' panicked at 'Unable to copy buffer to texture:
Transfer(BufferOverrun { start_offset: 0, end_offset: 4145152, buffer_size: 1048576, side: Source })',
src/command.rs:167:6

The buffer_size is correct (1048576 == 64*64*64*4), but that end_offset does not seem to make any sense ...

From skimming through the wgpu-core's commit history, there have been some changes related to the validation of data transfers. Am I missing something or could it be that it is broken (in wgpu-core 0.14.2)?

@almarklein
Copy link
Collaborator Author

Found it. It's a bug here in wgpu-native.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant