Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Metal Validation Layers require sourceBytesPerImage >= 512 bytes #537

@austinEng

Description

@austinEng

Ran into this undocumented restriction when running with Metal validation layers:

-[MTLDebugBlitCommandEncoder validateCopyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:]:532: failed assertion `sourceBytesPerImage(448) must be >= (512).'
Process 31489 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007fff5e1df2c2 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff5e1df2c2 <+10>: jae    0x7fff5e1df2cc            ; <+20>
    0x7fff5e1df2c4 <+12>: movq   %rax, %rdi
    0x7fff5e1df2c7 <+15>: jmp    0x7fff5e1d9453            ; cerror_nocancel
    0x7fff5e1df2cc <+20>: retq   

Also, sourceBytesPerRow must be >= 64, but that's fine because WebGPU has rowPitch be a multiple of 256.

This has some validation implications on permissible values for imageHeight or (zPitch in #519), and it also means that imageHeight == 0 cannot truly mean "tightly packed" in #517.

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