In the Metal renderer, a simple call to createTexture2D to create a RGB5A1 texture has side effects that breaks reset, specifically when the depth buffer is resized.
After calling createTexture2D with a pixel format that uses texture swizzle which applies swizzle that isn't just R -> R, G -> G, B -> B, A -> A (for RGB5A1 it is R -> B, G -> G, B -> R, A -> A), then I get the following error when calling reset, which I call after window resize:
-[MTLTextureDescriptorInternal validateWithDevice:]:1357: failed assertion `Texture Descriptor Validation
Texture swizzling is not compatable with MTLTextureUsageRenderTarget
Describe the bug
In the Metal renderer, a simple call to
createTexture2D
to create a RGB5A1 texture has side effects that breaksreset
, specifically when the depth buffer is resized.After calling
createTexture2D
with a pixel format that uses texture swizzle which applies swizzle that isn't justR -> R, G -> G, B -> B, A -> A
(forRGB5A1
it isR -> B, G -> G, B -> R, A -> A
), then I get the following error when callingreset
, which I call after window resize:To Reproduce
Expected behavior
reset
to complete without hitting an assertion.Additional context
I can fix the problem by editing the
SwapChainMtl::resize
function inrenderer_mtl.mm
, where I change this:To this:
Happy to make a PR but cognisant of the fact I'm not entirely sure what/if there are any other issues this would cause.