752 Commits

Author SHA1 Message Date
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
Chip Davis
2b4f29abd7 Take advantage of native texture swizzling support.
When available, use it instead of doing it manually in the shaders.
Unfortunately, it's only available on Apple GPU family 4 and up, and
desktop GPU family 2. Should still provide a nice boost.
2019-08-08 15:01:07 -05:00
Chip Davis
df5c5655cf Take advantage of Metal 3.0's support for 3D compressed textures.
Mac-only for now. Mostly because I don't know which formats beyond DXTn
and ASTC support 3D textures. Also, the extension to support 3D ASTC
compression isn't ready yet.
2019-08-06 11:08:37 -05:00
Chip Davis
f558cacd03 Advertise the shaderResourceMinLod feature.
This has now been implemented in SPIRV-Cross. It's supported on Mac as
of Metal 3.0 (10.15).
2019-08-06 10:09:39 -05:00
Chip Davis
02f66bba3f Support the VK_EXT_hdr_metadata extension.
This extension requires macOS 10.15. For some reason, even though
Apple said that the new Apple TV supports HDR10 and DolbyVision, the
`CAEDRMetadata` type underlying this is not supported on either iOS or
tvOS.

Also set the `wantsExtendedDynamicRangeContent` property on macOS to
enable HDR output. It's not only set if HDR metadata is attached, but
also if an HDR color space is selected.
2019-08-06 09:13:55 -05:00
Chip Davis
d2f1b59c4c Add more supported color spaces as of the latest OS versions.
Support `VK_EXT_swapchain_colorspace` on iOS as well. The 13.0 headers
add the `colorspace` property needed for this.
2019-08-05 14:51:16 -05: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
Chip Davis
5cc70bf6f0 MVKDevice: Remove usage of MTLSoftwareVersion.
Apple removed this from all SDKs as of Xcode 11 beta 5.
2019-08-05 11:57:48 -05: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
4d32b6620a Merge master 1.0.36 into Metal-3.0 branch. 2019-07-29 23:15:35 -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
232520a4c8 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-07-22 15:54:47 -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
6da89d6bbe
Merge pull request #680 from cdavis5e/device-group-creation
Add a minimal implementation of VK_KHR_device_group_creation.
2019-07-19 17:34:20 -04:00
Bill Hollings
9813a4bf92 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-07-19 16:44:40 -04:00
Chip Davis
9c18530aac Add a minimal implementation of VK_KHR_device_group_creation.
This is the instance half of device-group support. This provides the
means to enumerate all known physical device groups, and to create
grouped logical devices.

This provides just enough to satisfy the Vulkan spec. Metal won't
support this fully until Metal 3.0 in the upcoming macOS 10.15.
2019-07-19 15:39:01 -05:00
Chip Davis
f5ed08eea1 MVKDevice: Enable VK_EXT_scalar_block_layout features. 2019-07-19 13:42:37 -05: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
Chip Davis
55c7ba1a62 MVKDevice: Enable features added by recently added extensions.
Keep track of the enabled status of
`VK_KHR_uniform_buffer_standard_layout` and
`VK_EXT_texel_buffer_alignment`.
2019-07-19 12:32:21 -05:00
Bill Hollings
948cd1a2c4
Merge pull request #678 from cdavis5e/more-format-fixes
More format feature fixes.
2019-07-18 07:29:33 -04:00
Chip Davis
b6034d8fd0 More format feature fixes.
Advertise linear filtering of linear textures on macOS. I don't see any
reason this was disabled, and I don't know why I didn't turn it on in
PR #391.

Advertise that texel buffers of `VK_FORMAT_A2R10G10B10_UNORM_PACK32` are
supported. This was another oversight of mine in #391.

*Don't* advertise that sRGB formats can be used as vertex attributes.
I'm not sure what that would even mean--I'm guessing that the
implementation performs sRGB->linear conversion on the attribute before
loading it? But we don't do that and neither does Metal.
2019-07-17 17:39:53 -05:00
Bill Hollings
65eed2fe33 Reduce memory leaks when autorelease pools are not available.
Remove use of autorelease.
Rename getXXX() functions that returned autoreleased objects to newXXX() that don't.
Calling functions now responsible for releasing returned objects from these functions.
Move creation and tracking of texture->texture views for copying to MVKImage.
MVKCmdCopyImage retrieve texture view from MVKImage.
MVKMTLFunction responsible for releasing its MTLFunction.
Add dev notes to README.md.
2019-07-17 18:24:07 -04:00
Bill Hollings
27a1c44f0a Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-07-17 17:38:11 -04:00
Bill Hollings
c1aa02adad
Merge pull request #675 from cdavis5e/native-texture-buffer-fix-2
Fix implementation of VK_EXT_texel_buffer_alignment.
2019-07-17 16:39:25 -04:00
Bill Hollings
be5fc2c979
Merge pull request #674 from cdavis5e/swapchain-texture-view
MVKImage: Swapchain images do support texture views.
2019-07-17 16:36:48 -04:00
Bill Hollings
88d07f7dcb
Merge pull request #673 from cdavis5e/bgr10a2-surface
Advertise VK_FORMAT_A2R10G10B10_UNORM_PACK32 as a surface format.
2019-07-17 16:36:02 -04:00
Chip Davis
55fc3a11c7 Fix implementation of VK_EXT_texel_buffer_alignment.
Correct maximum number of texel buffer elements for the native texture
buffer case. With an 8-bit format, I assume it's possible to create a
texture buffer spanning the entire 3.5 GiB (the maximum size of a buffer
on my GPU).

Set the structure type in the physical device's
`_texelBuffAlignProperties` struct. Otherwise, when it gets written out
to a chain, the structure type will be lost, and it wouldn't e.g. show
up in `vulkaninfo`.

Fix enumeration of formats when one of the members of the
`VkFormatProperties` is zero. I intended that to mean "don't care," but
it was erroneously filtering out, well, everything. Now we actually
accurately report the minimum alignment requirements.
2019-07-17 14:52:34 -05:00
Chip Davis
1eb1adabdc MVKImage: Swapchain images do support texture views.
I forgot to make this change when I added support for
`VK_KHR_swapchain_mutable_format`. The extension isn't very useful
without this.
2019-07-17 12:43:46 -05:00
Chip Davis
c479c37aad Advertise VK_FORMAT_A2R10G10B10_UNORM_PACK32 as a surface format.
The documentation for the corresponding Metal format recommends using it
on displays with wide-color output to reduce banding artifacts, and thus
implies that it is possible to use it with a CAMetalLayer.
2019-07-17 12:09:40 -05: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
Chip Davis
b2ae0f011c Support the VK_EXT_scalar_block_layout extension. 2019-07-17 11:36:58 -05:00
Bill Hollings
de29ba9318 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-07-16 22:48:46 -04:00
Bill Hollings
463a104c10
Merge pull request #671 from cdavis5e/texel-buffer-alignment
Support the VK_EXT_texel_buffer_alignment extension.
2019-07-16 22:44:50 -04:00
Bill Hollings
745b929fb3
Merge pull request #670 from cdavis5e/amd-shader-image-ldst-lod
Advertise the VK_AMD_shader_image_load_store_lod extension.
2019-07-16 22:43:53 -04:00
Bill Hollings
1d4d29e2e2
Merge pull request #669 from cdavis5e/native-texture-buffer-fix
MVKBuffer: Correct _mtlBytesPerRow value for the native texture buffer case.
2019-07-16 22:43:37 -04:00
Chip Davis
7771b00bee Support the VK_EXT_texel_buffer_alignment extension.
This extension lets implementations report separate limits for uniform
and storage texel buffers, as well as whether or not the required
alignment is only a single texel of the buffer view's format.

This information is available in Metal, but only through an API query.
We must query the required alignment for every buffer view format we
support.

Update Vulkan-Headers to pull in support for this new extension.
2019-07-16 14:51:45 -05:00
Chip Davis
eb330056e6 Advertise the VK_AMD_shader_image_load_store_lod extension.
iOS only for now. Metal textures on Mac don't support non-zero `lod` in
the `write()` method.
2019-07-16 14:48:58 -05:00
Bill Hollings
fe3b2fbd5f
Merge pull request #666 from cdavis5e/swapchain-colorspace
Support the VK_EXT_swapchain_colorspace extension.
2019-07-16 15:37:06 -04:00
Chip Davis
dc16c3cc22 MVKBuffer: Correct _mtlBytesPerRow value for the native texture buffer case. 2019-07-16 11:58:06 -05:00
Chip Davis
8c3d30b12b Support the VK_EXT_swapchain_colorspace extension.
Only some of the color spaces provided by this extension are supported.
macOS 10.12 supports a few more. macOS 10.14 (at least, according to the
*10.15* SDK) supports even more. (But that needs a change to the
Metal-3.0 branch.)

I've chosen to group by color space. That way, programs will find the
all the supported formats early on. Programs that are interested in
the color space can keep looking.
2019-07-16 10:14:28 -05:00
Bill Hollings
ab643baa5b Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-07-16 11:09:05 -04:00
Bill Hollings
8a1d7f4f81
Merge pull request #668 from cdavis5e/native-texture-buffer
Use native texture buffers when available.
2019-07-16 10:15:02 -04:00
Chip Davis
47082fd4c3 Use native texture buffers when available.
These were added in Metal 2.1.
2019-07-16 00:02:46 -05:00