Skip to content

Texture upload either doesn't happen, or is not reflected in subsequent sampling #658

@yanchith

Description

@yanchith

Description
Hello, this is the bug I mentioned on the wgpu matrix channel.

My intuition is that the bug is probably not on wgpu's side, unless missing
validations in wgpu allowed me to do something terrible, that was also missed by
the vulkan validation layers.

Bug description:

  • A texture is being uploaded to the GPU semi-regularly, this is driven by user
    interaction and doesn't happen every frame. The upload happens via
    create_buffer_mapped and copy_buffer_to_texture.

  • Once per frame, this texture (whatever its contents may be at
    that moment) is blitted onto another texture, which is, with
    some post-processing blitted onto the swapchain.

  • The bug is, that the uploaded texture is stops being updates after some time.
    Subsequent transfers to that texture either don't
    change it, or those changes are not reflected later, when it is
    sampled. The texture has both TextureUsage::COPY_DST | TextureUsage::SAMPLED. I also manually checked the contents of that texture
    and the data I am uploading is correct.

To record traces, I've also tried wgpu-rs master branch on linux. The bug still
reproduces there, at least under linux.

Repro steps
Unfortunately can't provide a runnable example. But I am attaching a recorded trace + screenshots + png encoded textures I uploaded to webgpu. Look for label "UI_TEXTURE" in trace.ron.

Expected vs observed behavior
I expect to see on the screen the texture I upload to wgpu. Instead, I see a solid color - see screenshot in attachment.

Extra materials
Attached zipfile contains the trace, captures of the uploaded textures, and a sreenshot of the error.

Platform
I can reproduce on two machines. Everywhere else the bug doesn't manifest at
all. On the two machines I can reproduce with (at least) these configurations:

Machine 1

  • wgpu 0.4 + Linux + Intel HD 630 + Vulkan
  • wgpu 0.5 + Linux + Intel HD 630 + Vulkan
  • wgpu 0.4 + Windows + Intel HD 630 + Vulkan
  • wgpu 0.5 + Windows + Intel HD 630 + Vulkan
  • wgpu 0.4 + Windows + NVIDIA GeForce GTX 1650 + Vulkan
  • wgpu 0.5 + Windows + NVIDIA GeForce GTX 1650 + Vulkan

Machine 2 (I only had it borrowed for a limited time, so I could only test one configuration)

  • wgpu 0.5 + Windows + NVIDIA GeForce GTX 1080 Ti + Vulkan

deios-texture-update-bug-repro.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions