Просмотр исходного кода

Merge pull request #1628 from attilaz/mtl-cubemap-bind-fix

Fixed Metal cubemap bind validation error
Бранимир Караџић 7 лет назад
Родитель
Сommit
eeb2bf4f9e
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      src/renderer_mtl.mm

+ 8 - 1
src/renderer_mtl.mm

@@ -2878,7 +2878,14 @@ namespace bgfx { namespace mtl
 		{
 		{
 			if ( NULL == m_ptrMips[_mip] )
 			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];
 			return m_ptrMips[_mip];