rive-app / rive-ios

iOS runtime for Rive
MIT License
468 stars 53 forks source link

Errors when view height is zero #243

Open DagAgren opened 1 year ago

DagAgren commented 1 year ago

Description

RiveView will try to render to a Metal view when its height is zero, which does not work:

-[MTLTextureDescriptorInternal validateWithDevice:], line 1344: error 'Texture Descriptor Validation
MTLTextureDescriptor has height of zero.
'
-[MTLTextureDescriptorInternal validateWithDevice:]:1344: failed assertion `Texture Descriptor Validation
MTLTextureDescriptor has height of zero.
'

It is perfectly fine for UIKit views to have a zero height, and this often happens when doing things like reveal or hide animations. However, Metal does not support rendering to a zero pixel high texture, so the rendering code needs to special-case check if any dimension of the view is zero and skip rendering in that case.