Metal: Fixed MRT.

This commit is contained in:
Branimir Karadžić 2015-10-09 22:13:32 -07:00
parent c5ed5d3b00
commit faebec1f05
3 changed files with 9 additions and 12 deletions

View file

@ -1621,7 +1621,7 @@ again:
}
else
{
#if 0
#if 1
if (s_rendererCreator[RendererType::Metal].supported)
{
_type = RendererType::Metal;

View file

@ -412,10 +412,7 @@ namespace bgfx { namespace mtl
);
g_caps.maxTextureSize = 2048; //ASK: real caps width/height: 4096, but max depth(3D) size is only: 2048
//TODO: OSX
#if BX_PLATFORM_IOS
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet(MTLFeatureSet_iOS_GPUFamily2_v1) ? 8 :4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS));
#endif // BX_PLATFORM_*
g_caps.maxFBAttachments = 4; // uint8_t(bx::uint32_min(m_device.supportsFeatureSet(MTLFeatureSet_iOS_GPUFamily2_v1) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS));
//todo: vendor id, device id, gpu enum
//todo: texture format caps
@ -1819,7 +1816,7 @@ namespace bgfx { namespace mtl
);
// const bool bufferOnly = 0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
const bool bufferOnly = 0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
// const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK);
const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
@ -1847,7 +1844,7 @@ 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 = 1 /*MTLStorageModeManaged*/;
desc.storageMode = bufferOnly ? 1 /*MTLStorageModeManaged*/ : 2 /*MTLStorageModePrivate*/;
desc.usage = MTLTextureUsageShaderRead;
//TODO: set resource flags depending on usage(renderTarget/computeWrite/etc) on iOS9/OSX