1352 Commits

Author SHA1 Message Date
Bill Hollings
b99a2ea53f Merge master 1.0.37 into Metal-3.0 branch. 2019-09-18 14:15:41 -04:00
Bill Hollings
0934e3216f
Merge pull request #736 from billhollings/master
Updates to support Vulkan SDK 1.1.121.
2019-09-10 16:59:25 -04: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
1a0bf648b9 vkCmdFillBuffer(): Avoid threadgroup Metal validation error on Intel devices.
On Intel devices, Metal reports different values for max threadgroup width
between the pipeline state and device, so conservatively use the minimum of
these two reported values.
2019-09-10 14:41:26 -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
Bill Hollings
f8d8f9bd57
Merge pull request #734 from cdavis5e/fragment-shader-interlock
Support the VK_EXT_fragment_shader_interlock extension.
2019-09-07 21:07:26 -04:00
Bill Hollings
055466bec6
Merge pull request #733 from aerofly/master
Avoid MTLDevice minimumLinearTextureAlignmentForPixelFormat failed assertion
2019-09-07 21:05:32 -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
aerofly
5a02641fa1 fixes for iOS 13 2019-09-06 11:49:55 +02:00
aerofly
813c5300a1 mvk_vector 2019-09-06 11:48:37 +02:00
Bill Hollings
73ac6b63e7
Merge pull request #731 from cdavis5e/uniform-buffer-max-size
MVKDevice: Constant buffer bindings on macOS cannot exceed 64k.
2019-09-05 14:30:48 -04:00
Chip Davis
e7e8610a62 MVKDevice: Constant buffer bindings on macOS cannot exceed 64k.
This limitation appears to be have been present all along (cf. Metal
Feature Set Tables, under "Maximum function memory allocation for a
buffer in the constant address space"). I guess we never ran into it
before.

Prompted by #730.
2019-09-03 11:08:04 -05:00
Bill Hollings
4695b63532
Merge pull request #728 from billhollings/master
Support optional use of MTLFence for Vulkan semaphores via the MVK_ALLOW_METAL_FENCES environment variable.
2019-08-31 23:11:15 -04: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
99743c8f84
Merge pull request #727 from billhollings/master
Improve performance of vkCmdFillBuffer().
2019-08-31 15:44:04 -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
90f2b7a1af
Merge pull request #724 from billhollings/master
Streamline design and use of MVKSemaphore
2019-08-27 15:58:01 -04:00
Bill Hollings
a2b5d0dd18 MVKSwapchain::signalWhenAvailable() add autoreleasepool around MTLCommandBuffer use. 2019-08-27 12:04:58 -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
a87ef6bc77
Merge pull request #723 from billhollings/master
Track supported instance and device extensions correctly.
2019-08-18 23:45:44 -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
8fd5e183f2
Merge pull request #722 from billhollings/master
Fixes to issues found during CTS testing
2019-08-17 12:30:22 -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
0bc3be3707
Merge pull request #718 from billhollings/master
vkCmdBlitImage() fix test for different sample counts.
2019-08-12 23:55:56 -04:00
Bill Hollings
95e805c8c2 vkCmdBlitImage() fix test for different sample counts. 2019-08-12 23:55:18 -04:00
Bill Hollings
95f5b58145
Merge pull request #717 from billhollings/master
Fixes to vkCmdBlitImage() & vkCmdClearImage().
2019-08-12 17:50:44 -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
b6328641a4
Merge pull request #715 from billhollings/master
Add ability to automatically cause an Xcode GPU capture without developer intervention.
2019-08-11 20:16:23 -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
8db6177cf8
Merge pull request #714 from billhollings/master
Fix crash in vkDestroyPipelineLayout()
2019-08-10 00:02:04 -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
97a9e70b1e
Merge pull request #713 from cdavis5e/metal3-numa-heaps
MVKDevice: Report a second heap for non-UMA devices.
2019-08-09 15:23:35 -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
Bill Hollings
1c02662afa
Merge pull request #712 from cdavis5e/device-group
Support the VK_KHR_device_group extension.
2019-08-09 14:31:10 -04:00
Chip Davis
92f0bec6e2 MVKDevice: Report a second heap for non-UMA devices.
This is the heap representing system memory. The memory type
corresponding to `MTLStorageModeShared` is reported as belonging to this
heap.

I've tried to correct the reported size of the heaps as well while I'm
at it. UMA GPUs and the system heap for NUMA GPUs use the system memory
size as the heap size, and the amount of available memory as the budget.
iOS 13 uses the new `os_proc_available_memory()` API for this purpose.
NUMA GPUs additionally use the memory used by the process as a crude
measure of system heap usage.
2019-08-09 11:53:39 -05:00
Bill Hollings
69b238f95e
Merge pull request #711 from cdavis5e/metal3-placement-heaps
Use placement heaps for VkDeviceMemory when possible.
2019-08-09 12:48:57 -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
Chip Davis
17759a2b33 Use placement heaps for VkDeviceMemory when possible.
All Apple GPUs support this, as does Mac GPU family 2. With this, we can
avoid expensive copies between buffers and textures allocated from the
same memory, and reduce memory usage to boot.

macOS is, unfortunately, constrained by the fact that `MTLHeap` objects
do not support any storage mode other than `MTLStorageModePrivate`--not
even `MTLStorageModeManaged`. This won't help for managed textures
there. Perhaps Apple will fix this in a later version.
2019-08-09 10:44:43 -05:00
Bill Hollings
75b4c27d14 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-08-09 10:59:08 -04:00
Bill Hollings
4abc4d45e7
Merge pull request #710 from cdavis5e/metal3-new-colorspaces-fix-name
Fix name of Display-P3 linear color space.
2019-08-09 10:56:36 -04:00
Bill Hollings
f43169e441
Merge pull request #709 from cdavis5e/buffer-no-prefer-dedicated
Don't prefer dedicated allocations for buffer memory.
2019-08-09 10:55:55 -04:00
Bill Hollings
a93595e743
Merge pull request #708 from billhollings/master
Add support for VkEvent.
2019-08-09 10:55:02 -04:00
Chip Davis
57bcfe64f4 Fix name of Display-P3 linear color space.
The old `DCI_P3_LINEAR` enum is deprecated. Use
`VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT` instead. This is a closer match
for the Core Graphics name anyhow.
2019-08-08 23:45:13 -05:00
Chip Davis
28fb7be085 MVKImage: Don't prefer dedicated allocations for buffer-backed images.
For the same reason we don't prefer them for buffers.
2019-08-08 23:42:12 -05:00