From ce4ebddd17dd9839011db4a6e532fae829e2fdf3 Mon Sep 17 00:00:00 2001 From: Attila Kocsis Date: Fri, 18 Jan 2019 21:43:37 +0100 Subject: [PATCH] Fixed Metal cubemap bind validation error --- src/renderer_mtl.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/renderer_mtl.mm b/src/renderer_mtl.mm index 454306729..2e4a11c12 100644 --- a/src/renderer_mtl.mm +++ b/src/renderer_mtl.mm @@ -2878,7 +2878,14 @@ namespace bgfx { namespace mtl { if ( NULL == m_ptrMips[_mip] ) { - m_ptrMips[_mip] = m_ptr.newTextureViewWithPixelFormat(m_ptr.pixelFormat(), m_ptr.textureType(), NSMakeRange(_mip,1), NSMakeRange(0,m_ptr.arrayLength() * (m_type == TextureCube ? 6 : 1))); + if (TextureCube == m_type) + { + m_ptrMips[_mip] = m_ptr.newTextureViewWithPixelFormat(m_ptr.pixelFormat(), MTLTextureType2DArray, NSMakeRange(_mip,1), NSMakeRange(0,m_ptr.arrayLength() * 6)); + } + else + { + m_ptrMips[_mip] = m_ptr.newTextureViewWithPixelFormat(m_ptr.pixelFormat(), m_ptr.textureType(), NSMakeRange(_mip,1), NSMakeRange(0,m_ptr.arrayLength())); + } } return m_ptrMips[_mip];