347 Commits

Author SHA1 Message Date
Bill Hollings
5e5d6439da Update documentation to cover tvOS, iOS Simulator, and tvOS Simulator. 2020-06-23 23:06:08 -04:00
Bill Hollings
abb8792843 fetchDependencies build external libraries in parallel by platform.
Log ext lib build steps to provide user feedback.
Add package_ext_libs_finish.sh script to separate packaging
libraries from building them, to avoid build database conflicts.
Travis only build macOS ext libs.
2020-06-22 00:00:00 -04:00
Chip Davis
75da0c694b Advertise the VK_EXT_robustness2 extension.
We only support the `robustImageAccess2` feature for now. Metal's
guarantees around out-of-bounds accesses to textures give us this for
free. `nullDescriptor` should also be possible to implement, but it
needs testing. Null image descriptors will probably just work, but null
buffer pointers probably not. We may need help, either from SPIRV-Cross
or a pass in SPIRV-Tools. `robustBufferAccess2` definitely needs an
assist from SPIRV-Tools. All three are useful for Direct3D compatibility
layers (DXVK, wined3d).
2020-06-16 12:06:38 -05:00
Bill Hollings
205b859580 Fix issue where mapped host-coherent device memory not updated from image contents on macOS.
Currently, when a mapping is initiated for host-coherent device memory, existing
image contents are copied from the MTLTexture to host memory. However, if
host-coherent device memory is already mapped in a long-standing memory mapping,
changes to MTLTexture content are not reflected to the host memory.

This change adds that capability to open memory mappings. When the image pipeline
barrier is applied to an image that is attached to a host-coherent device memory
that currently has an open memory mapping, the MTLTexture contents are copied to
the open host memory binding.

Add MVKMappedMemoryRange to retrieve the currently mapped range in an MVKDeviceMemory.

MVKImage cleanup use of isHostCoherent(). Let it be same as MVKDeviceMemory
and don't test for it from macOS because it is unnecessary.
2020-06-15 22:18:53 -04:00
Bill Hollings
c1c49def22 Move applyImageMemoryBarrier() logic to MVKImagePlane.
Mark MVKResource::bindDeviceMemory() as virtual.
Remove use of !! from mvkIsAnyFlagEnabled().
Update What's New document for VK_KHR_sampler_ycbcr_conversion.
2020-06-14 19:15:39 -04:00
Bill Hollings
348c064b75
Merge pull request #909 from Lichtso/VK_KHR_sampler_ycbcr_conversion
VK_KHR_sampler_ycbcr_conversion
2020-06-11 17:09:34 -04:00
Bill Hollings
89fce99ef1 Update What's New document. 2020-06-11 12:49:42 -04:00
Alexander Meißner
f2e8552caf Merge master into VK_KHR_sampler_ycbcr_conversion 2020-06-11 12:40:55 +02:00
Bill Hollings
752c1a908d Refactor Xcode build architectures
Set ARCHS build setting to $(ARCHS_STANDARD_64_BIT) in Xcode projects.
Remove ARCHS and VALID_ARCHS build settings in Xcode targets.
2020-06-09 16:39:23 -04:00
Bill Hollings
b408557c7e Set maxVertexInputBindingStride and maxVertexInputAttributeOffset to min Vulkan values.
Ensure kMVKUndefinedLarge... family of constant values are each a power-of-two.
Change several power-of-two math functions to template functions.
2020-06-09 14:44:50 -04:00
Bill Hollings
f39486666a Fix issue in reporting properties of substitutable VkFormats.
Report format properties only based on the primary MTLPixelFormat
of a VkFormat, not any possible substitution MTLPixelFormat.
Update MoltenVK version to 1.0.43 and VK_MVK_MOLTENVK_SPEC_VERSION to 26.
2020-06-09 12:01:55 -04:00
Alexander Meißner
5e4e2d83cc Merge master into VK_KHR_sampler_ycbcr_conversion 2020-06-08 00:05:16 +02:00
Bill Hollings
8d7468effb Update maximum number of framebuffer layers to 2048. 2020-06-01 23:41:36 -04:00
Bill Hollings
4840c97e94 Update dependency libraries to match Vulkan SDK 1.2.141. 2020-06-01 17:35:31 -04:00
Bill Hollings
1ef26259a7 Remove checking translated vertex bindings on inline buffers. 2020-05-31 21:38:05 -04:00
Bill Hollings
8671295570 Support vertex attribute offsets larger than the vertex buffer stride.
Add MVKTranslatedVertexBinding to describe a translated vertex binding, track these in
MVKGraphicsPipeline, and add a Metal vertex layout for each additional translated binding.
MVKGraphicsResourcesCommandEncoderState query MVKGraphicsPipeline for translated bindings
associated with existing bindings and binds the same MTLBuffer multiple times with
different offsets.
2020-05-31 14:16:12 -04:00
Bill Hollings
e302a6d023 Update to latest version of SPIRV-Cross.
Remove use of obsolete SPIRV-Cross API MSLVertexAttr content.
ExternalDependencies.xcodeproj updated to Xcode 11.5.
Update What's New document.
2020-05-30 16:07:47 -04:00
OliverBalfour
b11992d4a0
Fix markdown link in MoltenVK_Runtime_UserGuide.md
The link contains a space between the right square bracket and subsequent left round bracket causing the link to display incorrectly in GitHub's markdown reader.
2020-05-30 15:45:29 +10:00
Bill Hollings
ea7303e8e6 Fix crash when more than two GPUs.
Crash happened because MVKPhysicalDevices created inline in MVKSmallVector<, 2>
using emplace_back(). Crash occurred when attempting to reallocate memory in
MVKSmallVector, and move inline MVKPhysicalDevice instances. Revert to tracking
MVKPhysicalDevice as pointers, which are easy to move after memory reallocation.

Review and optimize all uses of MVKSmallVector::emplace_back().
Set VkPhysicalDeviceLimits::maxSamplerLodBias to zero since it's unsupported.
Return error and use VK_POLYGON_MODE_LINE for unsupported VK_POLYGON_MODE_POINT.
2020-05-27 21:22:25 -04:00
Bill Hollings
9685f5d00a Support Xcode 11.5. 2020-05-22 18:48:29 -04:00
Alexander Meißner
3da5ecf628 Adds support for VK_KHR_sampler_ycbcr_conversion formats and sampler.
However, the binding of descriptors for
multi-planar / disjoint images is still missing.
2020-05-07 16:02:10 +02:00
Bill Hollings
d343fed52e Add support for VK_KHR_external_memory extension.
Functions and functionality supported, but don't currently do anything
until Metal-friendly enumerations added to VkExternalMemoryHandleTypeFlagBits.
Updated What's New document.
2020-05-06 19:43:21 -04:00
Bill Hollings
efde388cbd Add support for VK_KHR_external_memory_capabilities extension.
Capability functions and functionality supported, but don't currently do anything
until Metal-friendly enumerations added to VkExternalMemoryHandleTypeFlagBits.
Rename MVKPhysicalDevice::getPhysicalDeviceMemoryProperties() to
getMemoryProperties() for consistency.
Updated What's New document.
2020-05-05 18:12:17 -04:00
Bill Hollings
e581266cc7 vkQueuePresentKHR() returns VkResult for each swapchain.
Add MVKSwapchain::getSurfaceStatus().
2020-04-15 15:31:29 -04:00
Bill Hollings
bd35b76b8d API-Samples demos add input_attachment and push_descriptors demos. 2020-04-11 21:45:47 -04:00
Bill Hollings
dc7eab64ae Consolidate frame and non-frame performance reporting.
Added MVKQueuePerformance::frameInterval performance tracker.
Added MVKPerformanceTracker::latestDuration to track duration of most recent activity.
Swapchain performance can be retrieved with other activity performance through
vkGetPerformanceStatisticsMVK().
Performance logging of all activities can be performed periodically
on a frame-count basis, or inline as the activity occurs.
Add MVK_CONFIG_PERFORMANCE_LOGGING_INLINE env var to enable/disable
logging of performance of each activity when it happens.
Removed vkGetSwapchainPerformanceMVK() and MVKSwapchainPerformance from API.
Updated VK_MVK_MOLTENVK_SPEC_VERSION to 25.
Updated MoltenVK version to 1.0.42.
2020-04-09 14:02:08 -04:00
Bill Hollings
a644c98864 Disable API-Samples demos and document in Demos/README.md. 2020-04-05 20:44:44 -04:00
Bill Hollings
70bf788f9f Fix issue of reseting CAMetalDrawable and MTLTexture of peer swapchain images.
Add MVKPresentableSwapchainImage and MVKPeerSwapchainImage subclasses to
MVKSwapchainImage, with MVKPresentableSwapchainImage instances created inside
swapchain, and MVKPeerSwapchainImage instances created using vkCreateImage().
MVKPeerSwapchainImage retrieve and share CAMetalDrawable from corresponding
MVKPresentableSwapchainImage.
2020-04-05 15:15:24 -04:00
Bill Hollings
23818e30ec Fixes for the make install build command.
Fix the make install build command to overwrite the existing framework
in the system framework library.
Update README.md to clarify the instructions for using make install.
2020-04-02 21:11:14 -04:00
Bill Hollings
98fadbf68b Fix memory estimates for iOS 13+.
Fix os_proc_available_memory() not being called.
2020-04-02 18:54:22 -04:00
Bill Hollings
a58f6bc441 Update to Vulkan SDK 1.2.135 library dependencies.
Add Scripts/packagePregenSpirvToolsHeaders script to automate packaging Spirv-Tools
headers in support of the fetchDependencies --skip-spirv-tools-build option.
Update Docs/Whats_New.md.
2020-04-02 16:35:48 -04:00
Bill Hollings
327418a6b6 Broaden conditions for host read sync for image memory barriers on macOS.
Ignore pipeline dstStageMask and accept VK_ACCESS_MEMORY_READ_BIT in dstAccessMask.
2020-04-01 16:22:30 -04:00
Bill Hollings
bd4e78d5a4 Update to latest SPIRV-Cross and Vulkan-Headers and fixes to pipeline cache loading.
Update Cereal archive structs to match latest MoltenVK and SPIRV-Cross structs.
Fix recent error that caused pipeline cache data to be ignored during loading.
Update to Vulkan-Headers version 1.2.135.
Update to latest SPIRV-Cross version.
Update Whats_New.md document.
2020-03-26 18:57:46 -04:00
Bill Hollings
4f1cdef6af Validate format capabilities for MSAA, renderpass attachments, and vkCmdResolveImage().
vkGetPhysicalDeviceImageFormatProperties() tests whether format supports MSAA.
vkCreateRenderPass() validate each attachment supports format capabilities required
by each subpass that uses it.
vkCmdResolveImage() validate that destination attachment supports being resolved to.
MVKPixelFormats add getVkFormatCapabilities(), getMTLPixelFormatCapabilities(),
and vkFormatIsSupportedOrSubstitutable().
Rework type handling in flag functions in MVKFoundation.h.
2020-03-26 00:05:01 -04:00
Bill Hollings
50eba6fee1 Support Xcode 11.4. 2020-03-25 20:24:07 -04:00
Bill Hollings
0c03f09df3 Accurately populate Vulkan VkFormatProperties from MTLPixelFormat capabilities,
taking into consideration variations across MTLDevice Features Sets.

Simplify contents and names in MVKMTLFmtCaps enum.
Add MVKVkFormatFeatureFlags enum to map capabilities from MVKMTLFmtCaps to VkFormat.
Derive three VkFormatFeatureFlags in VkFormatProperties from documented
MTLPixelFormat capabilities, customizing based on MTLDevice feature sets.
Include VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT and
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT in writable features.
MVKPixelFormats modify VkFormatProperties unit test to log differences.
2020-03-23 21:28:36 -04:00
Bill Hollings
c1f1dd09d5 Update documentation to clarify that MoltenVK is not a fully-compliant implementation of Vulkan. 2020-03-19 18:01:05 -04:00
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