From 17b6e943606f5cbabd48de027154cad3bab07006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 7 Oct 2015 20:24:34 -0700 Subject: [PATCH] Cleanup. --- src/renderer_mtl.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/renderer_mtl.mm b/src/renderer_mtl.mm index 408c7d2b..c4fad58a 100644 --- a/src/renderer_mtl.mm +++ b/src/renderer_mtl.mm @@ -867,7 +867,7 @@ namespace bgfx { namespace mtl { m_textureDescriptor.textureType = MTLTextureType2D; - m_textureDescriptor.pixelFormat = MTLPixelFormatDepth32Float; + m_textureDescriptor.pixelFormat = MTLPixelFormatDepth32Float_Stencil8; m_textureDescriptor.width = width; m_textureDescriptor.height = height; @@ -878,6 +878,7 @@ namespace bgfx { namespace mtl m_textureDescriptor.resourceOptions = MTLResourceStorageModePrivate; m_textureDescriptor.cpuCacheMode = MTLCPUCacheModeDefaultCache; m_textureDescriptor.storageMode = MTLStorageModePrivate; + m_textureDescriptor.usage = MTLTextureUsageRenderTarget; if (NULL != m_backBufferDepth) { @@ -1459,7 +1460,7 @@ namespace bgfx { namespace mtl { pd.colorAttachments[0].pixelFormat = s_renderMtl->m_drawable.texture.pixelFormat; pd.depthAttachmentPixelFormat = s_renderMtl->m_backBufferDepth.m_obj.pixelFormat; - pd.stencilAttachmentPixelFormat = MTLPixelFormatInvalid; //s_renderMtl->m_backBufferStencil.m_obj.pixelFormat; + pd.stencilAttachmentPixelFormat = s_renderMtl->m_backBufferStencil.m_obj.pixelFormat; } else { @@ -1846,7 +1847,8 @@ namespace bgfx { namespace mtl desc.sampleCount = 1; //TODO: set samplecount - If textureType is not MTLTextureType2DMultisample, the value must be 1. desc.resourceOptions = MTLResourceStorageModePrivate; desc.cpuCacheMode = MTLCPUCacheModeDefaultCache; - desc.storageMode = MTLStorageModePrivate; + desc.storageMode = MTLStorageModeManaged; //MTLStorageModePrivate; + desc.usage = MTLTextureUsageShaderRead; //TODO: set resource flags depending on usage(renderTarget/computeWrite/etc) on iOS9/OSX