183 Commits

Author SHA1 Message Date
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
Bill Hollings
2b398fe610 Track supported instance and device extensions correctly.
MVKExtensionList add support for identifying and enabling instance or device extensions.
Rename MVKLayer::getExtensionProperties() to getInstanceExtensionProperties() and
MVKLayer::getSupportedExtensions() to getSupportedInstanceExtensions().
2019-08-18 23:17:03 -04:00
Bill Hollings
25acafdb3f Disable depth and/or stencil testing if corresponding attachment is missing.
MVKDepthStencilCommandEncoderState track whether depth and
stencil attachements exist, and modify testing accordingly.
Add MVKMTLDepthStencilDescriptorData::disable() function.
MoltenVK_Runtime_UserGuide.md remove VkEvent as known limitation.
2019-08-15 13:39:34 -04:00
Bill Hollings
e2ce1a6329 vkCreateRenderPass() return VK_ERROR_FORMAT_NOT_SUPPORTED if format not supported. 2019-08-13 17:34:14 -04:00
Bill Hollings
74e8af1525 vkCmdBlitImage() support format component swizzling. 2019-08-12 16:35:59 -04:00
Bill Hollings
f824c1a955 vkCmdClearImage() fix validation of depth attachment formats. 2019-08-12 14:45:53 -04:00
Bill Hollings
f93c572001 vkInvalidateMappedMemoryRanges() synchronizes managed device memory to CPU.
Add MVKDevice::invalidateMappedMemoryRanges().
Add MVKMTLBlitEncoder struct.
MVKDevice::getQueue() defaults to queue family zero and queue zero.
2019-08-11 19:59:40 -04:00
Bill Hollings
fdd1c85b50 Add ability to automatically cause an Xcode GPU capture without developer intervention.
Add MVK_CONFIG_AUTO_GPU_CAPTURE_SCOPE env var and build setting.
2019-08-10 15:23:18 -04:00
Bill Hollings
607941ebd7 vkCmdClearImage() set error if attempt made to clear 1D image.
VkPhysicalDevicePortabilitySubsetFeaturesEXTX::events set to true.
2019-08-09 23:10:04 -04:00
Bill Hollings
0fc3036983 Fix crash in vkDestroyPipelineLayout().
MVKPipelineLayout hold retained/released pointers to MVKDescriptorSetLayout,
instead of copies of MVKDescriptorSetLayout instances.
2019-08-09 14:48:24 -04:00
Bill Hollings
ce3757a56e Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-08-09 14:32:38 -04:00
Chip Davis
100d7aa543 Support the VK_KHR_device_group extension.
Largely minimal for now. Much of it, particularly most of the
interactions with `VK_KHR_swapchain`, was already implemented
previously. The only interesting bits are the `vkCmdDispatchBase()`
command, and the ability to create arbitrary swapchain images and bind
them to swapchain memory, which requires the use of the previously
implemented `VK_KHR_bind_memory2` extension. Most everything else can be
safely ignored for now.

Non-zero dispatch bases use the compute stage-input region to pass the
dispatch base group to the shader, which must manually adjust the
`WorkgroupId` and `GlobalInvocationId` builtins, since Metal does not do
this for us. I have tested that this approach works well--at least, well
enough to pass the CTS.

Because of the ability to bind arbitrary images to swapchain memory,
I've sucked the guts out of `MVKSwapchainImage` and into `MVKSwapchain`
itself. Availability and drawable management is now performed by the
swapchain object. `MVKSwapchainImage` is now just a specialized kind of
image, created when requested with a `VkImageCreateSwapchainInfoKHR`
structure.

Update SPIRV-Cross so we can support the `vkCmdDispatchBase()` command.

One more step towards Vulkan 1.1.
2019-08-09 11:41:10 -05:00
Bill Hollings
95def90d06 Remove error logging on VK_TIMEOUT of VkSemaphore and VkFence. 2019-08-08 17:10:35 -04:00
Bill Hollings
7dc642196a Add support for VkEvent.
Add MVKEvent class. MVKEventNative subclass uses native MTLEvent. MVKEventEmulated
subclass uses emulation using CPU blocking and MTLCommandBuffer completion handling.
MVKConfiguration::synchronousQueueSubmits now disabled by default if MTLEvents are not supported.
Document updated use of MVK_ALLOW_METAL_EVENTS and MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS
environment variables and synchronousQueueSubmits config setting, in vk_mvk_moltenvk.h.
2019-08-08 16:13:47 -04:00
Bill Hollings
1745bfee98 Fix crash when VkDeviceCreateInfo specifies queue families out of numerical order.
MVKDevice check highest queue family index before expanding queue family collection.
MVKVector add bounds check to at(), [], front() & back() functions.
2019-08-05 15:49:08 -04:00
Bill Hollings
e904d63138 Use MVKVector whenever possible in MoltenVK, especially within render loop.
Minor fixes and extensions to MVKVector implementations.
2019-08-01 15:05:01 -04:00
Bill Hollings
da7a4420f5 Consolidate the various linkable objects into a MVKLinkableMixin template base class.
Update MoltenVK version number to 1.0.37.
2019-07-30 00:54:27 -04:00
Bill Hollings
c857014bb3 Ensure Vulkan loader magic number persists in objects pooled by MoltenVK.
MVKDispatchableVulkanAPIObject::getVkHandle() re-establishes the loader magic number
before returning, in case the loader overwrote it before returning the object.
2019-07-29 17:50:42 -04:00
Bill Hollings
355e200a29 Revert to supporting host-coherent memory for linear images on macOS.
MVKImage::getMemoryRequirements() include host-coherent for linear images.
Cube demo on macOS not use staging buffers for loading images.
2019-07-29 15:52:24 -04:00
Bill Hollings
095dd3339b Update to latest version of SPIRV-Cross.
Update demos to latest dependency library versions.
Update to Xcode 10.3.
Update What's New document.
2019-07-24 14:39:38 -04:00
Bill Hollings
2f468db9a2 Updates for SDK 1.1.114 release.
Update to latest external dependency libraries.
Rename components of VK_INTEL_shader_integer_functions2 to match 1.1.114 Vulkan spec.
Update What's New document.
2019-07-23 14:29:32 -04:00
Bill Hollings
1a9b0cba51 Fix crash when binding descriptor set to layout that has been destroyed and recreated.
Remove the descriptor set pool associated with a MVKDescriptorSetLayout when the layout
is destroyed. MVKDescriptorPool and MVKDescriptorSetLayout track each other to tell the
other when it has been destroyed.
2019-07-22 15:53:59 -04:00
Bill Hollings
6cc4b484db Return error when MVKImage created as 1D attachment. 2019-07-19 19:25:54 -04:00
Bill Hollings
a1fb3b106e Fix issue with push constants used across multiple draw calls not being applied.
Ensure MVKPushConstantsCommandEncoderState stays dirty until it actually makes changes.
2019-07-19 13:32:50 -04:00
Bill Hollings
27a1c44f0a Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-07-17 17:38:11 -04:00
Chip Davis
4fbbb313f2 Support the VK_INTEL_shader_integer_functions2 extension. 2019-07-17 11:36:58 -05:00
Chip Davis
530d84ba42 Advertise the VK_AMD_shader_trinary_minmax extension. 2019-07-17 11:36:58 -05:00
Chip Davis
3f3810afbd Advertise the VK_EXT_post_depth_coverage extension.
iOS only, and only on A11/A12 devices (GPU Family 4/5).
2019-07-17 11:36:58 -05:00