You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
No, the PR would be good. Just apply the swizzle always, instead of inside the if body.
The TextureDescription is being reused to avoid allocations, which is why this causes the swizzle to be wrong. Basically we should treat all fields as uninitialised garbage. So while you're at it, go through the list of members in TextureDescription and make sure they are all set properly, in all cases.
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.
The text was updated successfully, but these errors were encountered: