Closed Bug 2081416 Opened 1 month ago Closed 25 days ago

WebGPU: Avoid redundant texture import code

Categories

(Core :: Graphics: WebGPU, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
161 Branch
Tracking Status
firefox161 --- fixed

People

(Reporter: aleiserson, Assigned: aleiserson)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

gfx/wgpu_bindings/src/server.rs contains code to import system-shared textures to wgpu. Currently, there are two versions of what is largely the same code, for the swapchain and external textures cases. Vulkan does not currently have an external texture version, but needs it soon. In the case of Vulkan, wgpu offers the import functionality, so it should not be necessary to reimplement it in wgpu_bindings at all.

Refactors texture import code so that it can be reused for swapchain
surfaces and external textures.

  • Identical calls to wgpu_server_ensure_shared_texture_for_swap_chain
    previously existed in all three create_texture_with_shared_texture_*
    functions. These calls, and the rest of the swapchain shared texture
    creation code in handling of CreateTexture, move into a new function
    create_shared_texture_for_swap_chain.
  • The code at the start of the create_texture_with_shared_texture_*
    functions that obtains the platform shared texture resource from
    the prepared swap chain surface moves out of those functions into
    create_shared_texture_for_swap_chain.
  • The IOSurface swap chain path previously set
    MTLTextureUsage::PixelFormatView. wgpu uses that only for
    depth/stencil textures. I don't see why it is needed for swap chain
    textures (the Metal docs say not to use it for component swizzle or
    sRGB conversion), so I've left it out of the combined import.
Assignee: nobody → aleiserson
Status: NEW → ASSIGNED
Priority: -- → P1
Blocks: 2008705
Status: ASSIGNED → RESOLVED
Closed: 25 days ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
QA Whiteboard: [qa-triage-done-c162/b161]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: