510 Commits

Author SHA1 Message Date
Bill Hollings
7658bccfba Fix memory leak when pre-filling MTLCommandBuffers.
Wrap MVKCommandBuffer::prefill() in autoreleasepool.
For non-reusable MVKCommandBuffers, release command instances
once prefilling is done to reduce memory pressure.
2020-03-14 16:56:12 -04:00
Bill Hollings
30658f05f5 Add ability to disable command memory pooling using MVK_CONFIG_USE_COMMAND_POOLING
environment variable.

Add ability to track MVKObjectPool allocation and pool residency counts.
2020-03-11 17:50:49 -04:00
Bill Hollings
9e0ed9fbf4 Increase value of VkPhysicalDeviceLimits::minStorageBufferOffsetAlignment
to 16 to avoid Metal validation assertions.
2020-03-03 18:07:26 -05:00
Bill Hollings
73984ba20c Guard against Metal validation assertion from reuse of
query number within a single MTLRenderEncoder.

Track MTLRenderEncoder used for each query and validate query is not reused within the
scope of a single MTLRenderEncoder, logging error and ending current query if encountered.
Remove _t from pre-typedef struct declarations.
Move declaration of MVKSwapchainImageAvailability from MVKImage.h to MVKSwapchain.h.
Update What's New document.
2020-02-15 21:49:13 -05:00
Bill Hollings
d7574d879d Fix issue where immutable samplers are removed during descriptor update.
Suppress spurious debug message.
Minor syntax fix.
Update MoltenVK version to 1.0.41.
2020-02-04 12:56:13 -05:00
Bill Hollings
71c3b4da75 Update Templates/spirv-tools/build.zip. 2020-01-22 09:14:51 -05:00
Bill Hollings
0c754fb036 Update dependency libraries to match Vulkan SDK 1.2.131.
Update What's New document.
2020-01-21 19:14:14 -05:00
Bill Hollings
593f773f48 Fix issue where preallocated descriptor count was not reset during vkResetDescriptorPool().
Document MVK_CONFIG_PREALLOCATE_DESCRIPTORS runtime environment variable.
Update MoltenVK_Runtime_UserGuide.md to better explain runtime environment variables.
Update Whats_New.md document.
2020-01-21 14:05:58 -05:00
Bill Hollings
8ec682938b Update copyright to 2020. 2020-01-07 16:47:29 -05:00
Bill Hollings
7fb0880374 Document recommendation to use 3 swapchain images, particularly with full-screen rendering. 2020-01-07 13:50:35 -05:00
Bill Hollings
e6224803f6 Track performance of CAMetalLayer nextDrawable call.
Add MVKQueuePerformance::nextCAMetalDrawable.
2020-01-06 09:38:14 -05:00
Bill Hollings
537c7b0040 Fix Metal validation error on push constant sizing differences between C and MSL structs.
Add MVKPhysicalDeviceMetalFeatures::pushConstantSizeAlignment, set value to 16 (size of
float4), and ensure push constant buffers have a size that is a multiple of that value.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 24.
2019-12-28 21:13:58 -05:00
Bill Hollings
e28a1b4b8b Fix buffer offset in vkCmdPushDescriptorSet() for non-dedicated buffer memory. 2019-12-18 18:22:30 -05:00
Bill Hollings
8ad03bf0d5 Fix crash when app does not use queue family zero.
Add MVKDevice::getAnyQueue() to safely find the first available queue.
Update MoltenVK version to 1.0.40.
2019-12-18 16:44:35 -05:00
Bill Hollings
a64f62ee53 Update dependency libraries to match Vulkan SDK 1.1.130.
Update ExternalRevisions/README.md to document new glslang build settings.
Update What's New document.
2019-12-16 14:24:57 -05:00
Bill Hollings
5ba074a125 Avoid reading env vars inside library constructor functions. 2019-12-15 21:47:20 -05:00
Bill Hollings
3f025bc63f Fix bug where dynamic shader buffers are overflowing.
Change MVKPhysicalDeviceMetalFeatures::dynamicMTLBuffers from boolean to uint
dynamicMTLBufferSize limit and guard dynamic buffer usage sizes against it.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 23.
2019-12-12 15:46:28 -05:00
Bill Hollings
b213996c5e Support Xcode 11.3.
Update What's New document.
2019-12-12 12:38:17 -05:00
Bill Hollings
98e0b79a52 Fix inconsistency in reporting device local memory between type and heap on macOS. 2019-12-06 10:18:13 -05:00
Bill Hollings
5b1425b73d Cube demo use VK_EXT_metal_surface extension. 2019-12-02 13:46:31 -05:00
Bill Hollings
9f64cc4bef Fix tessellation break when control stage declares but does not use position builtin.
Add SPIRVShaderOutput::isUsed retrieved from shader reflection.
mvk::sizeOfOutput() returns zero if output var is not used.
Update to latest SPIRV-Cross version.
2019-11-26 16:11:52 -05:00
Michael Barriault
ddf108153d Support for EXT_inline_uniform_block 2019-11-25 21:35:38 +00:00
Bill Hollings
3bb70e8749 Fix MTLHeap memory leak in MVKDeviceMemory. 2019-11-18 13:06:05 -05:00
Bill Hollings
15cdb32ae9 Fix image subresource sizing calculations for heap-based textures.
Add MVKImage::_rowByteAlignment separate from _byteAlignment.
2019-11-16 19:05:44 -05:00
Bill Hollings
ddfa225f79 Fix crash in fetchDependencies on build paths containing spaces. 2019-11-14 17:11:10 -05:00
Bill Hollings
0b6916aa23 Clamp image copy extents to image extent. 2019-11-13 15:40:43 -05:00
Bill Hollings
9b13006018 Support linear filtering when using vkCmdBlitImage().
Fixes linear filtering when using vkCmdBlitImage(), useful for mipmap generation.
Move MVKCmdBlitImage sampler definition to shader as a constexpr sampler,
and ensure mip_filter and filter are set correctly.
Add MVKRPSKeyBlitImg::srcFilter.
Include MVKCommonEnvironment.h in MVKLogging.h.
Update MoltenVK version to 1.0.39.
2019-11-12 16:47:33 -05:00
Bill Hollings
f97b827fa5 Update What's New document. 2019-10-30 17:08:16 -04:00
Bill Hollings
d96ee9b0ca Fix severe FPS degradation caused by certain swapchain recreation situations.
Ensure swapchain clears all cached CAMetalDrawables when destroyed.
2019-10-30 14:18:11 -04:00
Bill Hollings
0b1189dc03 Update external libraries to support Vulkan SDK 1.1.126.
Update What's New document.
2019-10-29 11:55:16 -04:00
Bill Hollings
93ae214bc8 Support additional capabilities in 1D images, including rendering, clearing, and mipmaps.
Add `MVK_CONFIG_TEXTURE_1D_AS_2D` environment variable, enabled by default.
Modify 1D warning messages to recommend use of `MVK_CONFIG_TEXTURE_1D_AS_2D`.
Update to latest version of SPIRV-Cross.
Align pipeline cache contents to latest CompilerMSL::Options structure.
Clean up code signing on demo Xcode projects.
2019-10-25 14:40:59 -04:00
Bill Hollings
47d38df764 Log format substitution error when MTLPixelFormatDepth24Unorm_Stencil8 is not supported. 2019-10-17 16:59:52 -04:00
Bill Hollings
f14e44800a Enable use of MTLFence for Vulkan semaphores, by default. 2019-10-17 15:16:16 -04:00
Bill Hollings
c6ea99e4db Support Metal 3.0.
Merge Metal-3.0 branch into master branch.
Update What's New document with merged features.
2019-10-16 18:26:58 -04:00
Bill Hollings
ebe38ba2ea Reduce memory usage by replacing use of MVKVectorDefault
with std::vector in descriptor set bindings.
2019-10-11 15:12:17 -04:00
Bill Hollings
5c87700732 Reduce memory usage by adjusting default memory allocs for many MVKVectorInline uses.
MVKRenderPass use emplace_back() instead of push_back()
when populating _subpasses  & _attachments vectors.
Add mvkLogSizeOf(T) development debugging function.
2019-10-10 16:46:17 -04:00
Bill Hollings
1d628baca4 Fix memory leaks when compiling shaders and pipelines without default OS autorelease pool.
Wrap MVKMetalCompiler compiling execution in an @autoreleasepool.
2019-10-07 18:52:24 -04:00
Bill Hollings
62fa0d4a65 Fix memory leaks of system classes during VkInstance and VkQueue creation.
Wrap retrieval of MTLDevice and MTLCommandQueue in an @autoreleasepool.
2019-10-04 13:26:04 -04:00
Bill Hollings
a2951a19e6 Support Xcode 11.
Declare _formatDescriptions[] in mvk_datatypes.mm as officially writable
because Clang now locates static const in non-writable memory.
Update build settings to Xcode 11.
Update MoltenVK_Runtime_UserGuide.md about embedding `libMoltenVK.dylib` in an application.
2019-10-01 00:25:09 -04:00
Bill Hollings
b805ccf702 Allow MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS build setting to be overridden. 2019-09-26 15:28:30 -05:00
Bill Hollings
9f7eeb46a0 Clarify static linking as the recommended linking approach for iOS app store distribution. 2019-09-25 19:04:33 -05:00
Bill Hollings
5c7904c3a7 Add request for feedback from people who reject MoltenVK to README.md document.
Update MoltenVK version to 1.0.38.
2019-09-25 15:41:40 -05:00
Bill Hollings
5636233f47 Report error only on the first time a format substitution is made. 2019-09-10 15:40:18 -04:00
Bill Hollings
d585a9819e Updates to support Vulkan SDK 1.1.121.
Remove obsolescence log message for vkCreateMacOSSurfaceMVK()
and vkCreateIOSSurfaceMVK() functions.
Fix test for alignment of invalid pixel formats.
Update dependency libraries to match Vulkan SDK 1.1.121.
Update to renaming of VK_INTEL_shader_integer_functions2
enums and structs in latest Vulkan headers.
Update Whats_New.md document.
2019-09-10 13:25:19 -04:00
Chip Davis
deaaab8eff Support the VK_EXT_fragment_shader_interlock extension.
This extension allows fragment shaders to delineate critical sections
where pairs of invocations may not execute simultaneously. In Metal, the
nearest equivalent functionality is raster order groups. This
implementation is thus implemented on top of them.

Update SPIRV-Cross to pull in SPIR-V support for this new extension.
2019-09-06 12:52:39 -05:00
Bill Hollings
fd5f0ada2c Support optional use of MTLFence for Vulkan semaphores via the
MVK_ALLOW_METAL_FENCES environment variable.

Refactor MVKSemaphore class into separate MVKSemaphoreMTLFence,
MVKSemaphoreMTLEvent, and MVKSemaphoreEmulated subclasses.
Add MVK_ALLOW_METAL_FENCES environment variable to optionally
enable using MTLFence for Vulkan semaphores.
Add MVKPhysicalDeviceMetalFeatures::fences to track MTLFence availability.
Update VK_MVK_MOLTENVK_SPEC_VERSION to version 22.
2019-08-31 22:37:33 -04:00
Bill Hollings
399d24c1e2 Improve performance of vkCmdFillBuffer().
Use  parallelism more effectively to massively cover buffer with
multiple full threadgroups, instead of serial looping in shader.
Performance improvement measured at 150x (yes...x not %) on macOS.
MVKCmdFillBuffer move validation test to setContent() instead of encode().
2019-08-31 14:45:21 -04:00
Bill Hollings
937813f48e Don't use MTLCommandBuffer push/popDebugGroup if not available.
Log use of MTLEvent for semaphores.
2019-08-27 11:38:32 -04:00
Bill Hollings
bb3cdd7af4 Streamline design and use of MVKSemaphore.
One set of MVKSemaphore::encodeWait() & encodeSignal() functions either use MTLEvent
or not, and are called twice with and without MTLCommandBuffer to handle both cases
of encoded and inline waits and signals.
Always submit surface presentations using MTLCommandBuffer.
MVKConfiguration::presentWithCommandBuffer is now obsolete.
Fix memory leak of MVKQueueCommandBufferSubmissions with no content.
2019-08-26 23:47:55 -04:00
Bill Hollings
98d59025f3 Fix crash when signalling swapchain semaphore using MTLEvent.
Clear out some dead swapchain image code.
2019-08-26 16:10:13 -04:00