Update maximum number of framebuffer layers to 2048.
diff --git a/Docs/Whats_New.md b/Docs/Whats_New.md
index 104f105..a2583dd 100644
--- a/Docs/Whats_New.md
+++ b/Docs/Whats_New.md
@@ -39,6 +39,7 @@
- Fix buffer offset calculation.
- Fixes to maximum FPS calculations.
- Fix buffer size passed to shaders when `VkDescriptorBufferInfo.range` set to `VK_WHOLE_SIZE`.
+- Update maximum number of framebuffer layers to 2048.
- Support stencil only image formats in identity swizzle case.
- Enables format atomic capabilities only when format supports it.
- Add `MVKSmallVector` as a more memory efficient substitute of `MVKVector`.
diff --git a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
index effbd3d..6df8dd1 100644
--- a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
+++ b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
@@ -609,7 +609,8 @@
VkBool32 native3DCompressedTextures; /**< If true, 3D compressed images are supported natively, without manual decompression. */
VkBool32 nativeTextureSwizzle; /**< If true, component swizzle is supported natively, without manual swizzling in shaders. */
VkBool32 placementHeaps; /**< If true, MTLHeap objects support placement of resources. */
- VkDeviceSize pushConstantSizeAlignment; /**< The alignment used internally when allocating memory for push constants. Must be PoT. */
+ VkDeviceSize pushConstantSizeAlignment; /**< The alignment used internally when allocating memory for push constants. Must be PoT. */
+ uint32_t maxTextureLayers; /**< The maximum number of layers in an array texture. */
} MVKPhysicalDeviceMetalFeatures;
/** MoltenVK performance of a particular type of activity. */
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
index 6bdaa3f..aec27ae 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
@@ -867,6 +867,8 @@
_metalFeatures.pushConstantSizeAlignment = 16; // Min float4 alignment for typical uniform structs.
+ _metalFeatures.maxTextureLayers = (2 * KIBI);
+
_metalFeatures.ioSurfaces = MVK_SUPPORT_IOSURFACE_BOOL;
// Metal supports 2 or 3 concurrent CAMetalLayer drawables.
@@ -1235,7 +1237,7 @@
_properties.limits.maxImageDimensionCube = _metalFeatures.maxTextureDimension;
_properties.limits.maxFramebufferWidth = _metalFeatures.maxTextureDimension;
_properties.limits.maxFramebufferHeight = _metalFeatures.maxTextureDimension;
- _properties.limits.maxFramebufferLayers = _metalFeatures.layeredRendering ? 256 : 1;
+ _properties.limits.maxFramebufferLayers = _metalFeatures.layeredRendering ? _metalFeatures.maxTextureLayers : 1;
_properties.limits.maxViewportDimensions[0] = _metalFeatures.maxTextureDimension;
_properties.limits.maxViewportDimensions[1] = _metalFeatures.maxTextureDimension;
@@ -1244,8 +1246,8 @@
_properties.limits.viewportBoundsRange[1] = (2.0 * maxVPDim) - 1;
_properties.limits.maxViewports = _features.multiViewport ? kMVKCachedViewportScissorCount : 1;
- _properties.limits.maxImageDimension3D = (2 * KIBI);
- _properties.limits.maxImageArrayLayers = (2 * KIBI);
+ _properties.limits.maxImageDimension3D = _metalFeatures.maxTextureLayers;
+ _properties.limits.maxImageArrayLayers = _metalFeatures.maxTextureLayers;
_properties.limits.maxSamplerAnisotropy = 16;
_properties.limits.maxVertexInputAttributes = 31;