561 Commits

Author SHA1 Message Date
Bill Hollings
834d391aec Update dependency libraries to match Vulkan SDK 1.2.148.
fetchDependencies support option to skip all library builds.
fetchDependencies avoid sync locks if not building in parallel.
fetchDependencies build glslang headers.
Update ExternalRevisions/README.md glslang build integration section.
Update What's New.
2020-07-27 22:25:44 -04:00
Bill Hollings
f7a1c87c71 Update pipeline cache to latest CompilerMSL::Options struct content.
SPIRVToMSLConversionOptions compare instances using memcmp(CompilerMSL::Options).
Update What's New document.
2020-07-27 15:02:56 -04:00
Bill Hollings
6b25c816b5
Merge pull request #976 from cdavis5e/pipeline-sample-mask
MVKPipeline: Pass the pipeline sample mask, if present, to SPIRV-Cross.
2020-07-27 10:31:44 -04:00
Chip Davis
cda8a2cf44 MVKPipeline: Pass the pipeline sample mask, if present, to SPIRV-Cross.
SPIRV-Cross can now AND the `gl_SampleMask` output with an additional
fixed mask, presumably from the pipeline. Use this new functionality to
implement pipeline sample mask handling.

Special thanks to Tomek Pontika and Corentin Wallez of Google for
graciously contributing their implementation to SPIRV-Cross.

Update SPIRV-Cross to pull in the change necessary for this.
2020-07-24 15:15:11 -05:00
Chip Davis
b1803ea5d7 MVKDevice: Support the VK_EXT_image_robustness extension.
This extension provides weaker guarantees than `VK_EXT_robustness2` and
its `robustImageAccess2` feature. Metal easily meets those guarantees,
with no action on our part necessary.
2020-07-24 15:13:58 -05:00
Bill Hollings
1f68d5fc2a Fix intermittent concurrent shader specialization race condition.
MVKShaderLibrary::getMTLFunction() synchronize and refactor release of Metal objects.
Make use of existing autorelease pool instead of discrete retain/release.
Wrap entire specialization operation in @synchronized() to guard against
Metal internals not coping with multiple simultaneous specializations.
2020-07-22 17:48:19 -04:00
Bill Hollings
81ec314787 Track if indirect tessellation drawing is supported.
Add MVKPhysicalDeviceMetalFeatures::indirectTessellationDrawing.
Return error if indirect tessellated draw command is used when not supported.
2020-07-21 14:10:20 -04:00
Bill Hollings
fc0750d67c Set VkPhysicalDeviceDriverPropertiesKHR::driverID to VK_DRIVER_ID_MOLTENVK.
Update to latest version of Vulkan-Headers.
2020-07-20 14:51:40 -04:00
Bill Hollings
f5b937c7f9 Add native support for VK_FORMAT_D16_UNORM on iOS 13.0+ and tvOS 13.0+. 2020-07-18 00:06:51 -04:00
Bill Hollings
5ff8531bba Include vertex attribute size when testing whether attribute offset exceeds stride.
Track Metal vertex binding stride alignment.
Add MVKPhysicalDeviceMetalFeatures::vertexStrideAlignment.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 27.
Update pipeline cache archive description for CompilerMSL::Options.
2020-07-11 15:36:44 -04:00
Bill Hollings
e39dde02ec Fix new and unexpected App Store failure on newly deprecated color space values. 2020-07-08 14:58:29 -04:00
Bill Hollings
cd18cec727 Fix small memory leak when setting swapchain color space.
Add CAMetalLayer::colorspaceNameMVK property to handle retain/release automatically.
2020-07-06 17:36:05 -04:00
Bill Hollings
e40153abae Update to latest SPIRV-Cross version,
MSL: Workaround broken scalar access chain behavior in LLVM IR / AIR
2020-07-06 13:05:55 -04:00
Bill Hollings
40d3485cec Remove unneeded switch default for MTLLanguageVersion.
Minor doc fixes from PR review.
2020-06-24 17:04:30 -04:00
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