Skip to content

Metal is unable to copy depth formats into colors #1692

Closed

Description

@kvark

Currently the spec allows D32 -> R32 and D16 -> R16 copies.

On Metal, we generally implement copies between different formats by "casting" one of the sides to the other (i.e .newTextureViewWithPixelFormat], followed by the copy command on BlitCommandEncoder.

However, Metal defines "cast" only within certain groups, and it places color formats in a separate group from the depth formats. So we end up with:

source texture pixelFormat (MTLPixelFormatDepth32Float) not castable

I suggest we remove any notion of Depth -> Color copies from the spec, at least for MVP, to address this.

Activity

  1. kainino0x commented on Apr 29, 2021

    @kainino0x
    Contributor

    @austinEng I thought Dawn implemented this - did we use another approach or am I misremembering?

  2. austinEng commented on Apr 29, 2021

    @austinEng
    Contributor
  3. kainino0x commented on Apr 29, 2021

    @kainino0x
    Contributor

    OK. Seems like we should make this change then.

  4. Kangz commented on Apr 29, 2021

    @Kangz
    Contributor

    It seems the spec is already requiring format equality:

    copyTextureToTexture(source, destination, copySize)
    ...

    • source.texture.[[format]] is equal to destination. texture.[[format]].
  5. kvark commented on Apr 29, 2021

    @kvark
    ContributorAuthor

    The bits that need be fixes are:

    Copies between depth textures can only happen within the following sets of formats:
    depth16unorm, r16uint
    Additionally, depth32float textures can be copied into depth32float and r32float textures

  6. added this to the V1.0 milestone on Sep 2, 2021
  7. kainino0x commented on Sep 10, 2021

    @kainino0x
    Contributor

    Pretty sure this is a duplicate of #1464

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions