158 Commits

Author SHA1 Message Date
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
9f7eeb46a0 Clarify static linking as the recommended linking approach for iOS app store distribution. 2019-09-25 19:04:33 -05: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
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
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
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
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
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
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
Chip Davis
a2533116b3 Support the VK_KHR_uniform_buffer_standard_layout extension.
This happens to fall out of the way structure layouts are handled in
SPIRV-Cross.
2019-07-16 00:01:48 -05:00
Chip Davis
fc13aec2af Advertise the VK_EXT_shader_stencil_export extension.
This is supported by Mac GPU Family 2 starting on macOS 10.14, and Apple
GPU Family 5 starting on iOS 12.

Supporting this is a bit tricky. Because only some devices support this
extension, we now have to keep track of supported device extensions per
device.
2019-07-15 12:12:39 -05:00
Bill Hollings
aa6a10570a Support VK_EXT_metal_surface extension.
Modify demo apps to pass OS layer instead of view.
2019-07-03 20:23:43 -04:00
Bill Hollings
fb4dd158d0 Document each function in vk_mvk_moltenvk.h to indicate they cannot be used
with objects retrieved through the Vulkan SDK Loader and Layers framework.
2019-06-30 11:16:08 -04:00
Bill Hollings
7c71263f98 Add note in MoltenVK_Runtime_UserGuide.md that the functions in vk_mvk_moltenvk.h cannot
be used with objects retrieved through the Vulkan SDK Loader and Layers framework.
2019-06-29 19:55:07 -04:00
Bill Hollings
c3aaf976ae Add support for the VK_NV_glsl_shader extension.
Support runtime shader compilation from GLSL.
Return VK_ERROR_INVALID_SHADER_NV on shader and pipeline compilation errors.
Add MVKShaderCompilationPerformance::glslToSPRIV to track GLSL conversion performance.
Rename MoltenVKGLSLToSPIRVConverter MVKShaderStage enum to MVKGLSLConversionShaderStage
to avoid naming conflicts with MoltenVK MVKShaderStage enum.
Hologram demo load SPIR-V directly instead of using GLSL through either
MoltenVKGLSLToSPIRVConverter or VK_NV_glsl_shader extension.
Update to latest version of VulkanSamples that supports MVKGLSLConversionShaderStage.
2019-05-10 12:21:03 -04:00
Bill Hollings
173d8cc5f3 Add support for the VK_EXT_debug_report extension.
Add MVKDebugReportCallback class.
Add MVKVulkanAPIObject class as base class of classes exposed in Vulkan API.
Remove MVKRefCountedDeviceObject class and move ref-counting to MVKVulkanAPIObject.
Rename MVKDispatchableObject class to MVKDispatchableVulkanAPIObject.
Introduce multiple inheritance mixin classes into class hierarchy.
Add MVKBaseObject::getVulkanAPIObject() function to find Vulkan API object
controlling any subobject that needs to report something.
MVKCommandResourceFactory functions pass in calling object for reporting.
Add MVKBaseObject::reportMessage() & reportError() functions.
Replace mvkNotifyErrorWithText() static function with reportError()
instance function to allow access to debug reporting.
Redefine MVKLog*() functions to call reportError() instance method.
Delete MVKLogging.cpp.
Remove MVKLogging.h from MoltenVKShaderConverter project.
Add mvk_datatypes.hpp to redirect errors in mvk_datatypes.h functions to debug
reporting. Use mvk_datatypes.hpp internally for all references to these functions.
Convert several static methods to instance methods.
Refactor platform defines in MVKSurface.h.
Explicitly count MVKExtensionList extension count to avoid relying on struct size.
Remove MVKCommandBuffer::recordResult() and use setConfigurationResult().
Change log indication of error in logs from [***MoltenVK ERROR***] to [mvk-error],
for consistency with other log level indications.
Update MoltenVK version to 1.0.35.
2019-05-01 22:27:03 -04:00
Bill Hollings
b3240794fc Fix PVRTC texture content loading via memory mapping.
MoltenVK_Runtime_UserGuide.md: Add limitation explanation
about loading PVRTC using host-visible memory only.
Update What's New document.
2019-03-26 13:31:26 -04:00
Bill Hollings
bdaf306233 Update VK_KHR_swapchain and VK_KHR_get_surface_capabilities2 extensions.
Add support for VK_KHR_get_surface_capabilities2 extension.
Implement newer VK_KHR_swapchain extension functions.
Fix when the following functions return VK_INCOMPLETE:
    vkGetPhysicalDeviceSurfaceFormatsKHR()
    vkGetSwapchainImagesKHR()
    vkEnumeratePhysicalDevices()
    vkEnumerateInstanceLayerProperties()
    vkGetPhysicalDeviceQueueFamilyProperties()
CTS: Pass supported *.macos.surface.* and *.macos.swapchain.* tests.
Update What's New document.
2019-03-21 08:53:18 -04:00
Chip Davis
4468f36bc6 Support the VK_EXT_host_query_reset extension.
This allows clients to reset query pools on the host, instead of with a
GPU command.

This updates Vulkan headers to 1.1.104... but, there's a problem. This
change has not been merged to `master` in the `Vulkan-Headers` repo yet,
because of an issue building the C++ binding headers. Luckily, we only
need the core C header.
2019-03-17 19:59:15 -05:00
Bill Hollings
6f2dc4bdcb Add static and dynamic libraries to MoltenVKShaderConverter project.
Refactor build scripts.
Update paths to MoltenVKGLSLToSPIRVConverter framework in demos.
Fix rare build race condition on MoltenVKShaderConverter link to MoltenVK.
2019-02-18 22:19:37 +00:00
Bill Hollings
c57e29bc5c Clarify Xcode version requirements in documentation. 2019-02-13 14:34:55 -05:00
Chip Davis
3df6d2d00f Support the VK_EXT_memory_budget extension.
This requires macOS 10.13 or iOS 11, for the `currentAllocatedSize`
property of `MTLDevice`. Ideally, we'd check for that method instead of
keying on the version.
2019-01-31 12:10:57 -06:00
Bill Hollings
e5a890775b Add support for VK_EXTX_portability_subset extension.
Add KhronosGroup/Vulkan-Portability as external dependency repo.
Add ExternalRevisions/Vulkan-Portability_repo_revision.
Add vk_extx_portability_subset.h header file to mvk_vulkan.h.
MVKImageView allow constructor with no image or device.
Add mvkVkComponentMappingsMatch() & mvkVkComponentSwizzlesMatch() functions.
Cleanup some local var init warnings.
2019-01-27 19:52:59 -05:00
Chip Davis
acefcca1ff Support the VK_KHR_variable_pointers extension. 2019-01-15 16:53:08 -06:00
Chip Davis
2450c890dd
Merge branch 'master' into amd-gpu-shader-half-float 2019-01-15 15:44:47 -06:00
Chip Davis
361cbd61e9 Advertise the VK_AMD_gpu_shader_half_float extension. 2019-01-15 15:01:12 -06:00
Bill Hollings
02aeb0797a Add full texture swizzling to config, and disable it by default.
Add MVKConfiguration::fullTextureSwizzle and corresponding MVK_CONFIG_FULL_TEXTURE_SWIZZLE
env var & build setting, and set to false, to disable texture swizzling by default.
Add SPIRVToMSLConverterOptions::shouldSwizzleTextureSamples.
Lazily init queue families to allow time for specializedQueueFamilies config change.
Fix consistency of pipeline encoding state auxiliary buffer binding.
Improve documentation of MVKConfiguration environment variables and build settings.
2019-01-12 12:19:01 -05:00
Bill Hollings
fe55930fd5 Update Brenwill copyright noticies to 2019. 2019-01-01 21:13:25 -05:00
Chip Davis
89aaaee0b8 Support the VK_KHR_bind_memory2 extension.
This extension allows multiple device memory objects to be bound in one
call. It also provides extensible versions of the memory binding calls.
It is a prerequisite for both the `VK_KHR_device_group` and
`VK_KHR_sampler_ycbcr_conversion` extensions.

The `VK_IMAGE_CREATE_ALIAS_BIT`, also added in this extension, would be
more interesting if we used `MTLHeap` objects for device memory, since
that would determine whether or not we would make images aliasable.
2018-12-06 11:50:43 -06:00
Chip Davis
528d3daf2a Support the VK_KHR_swapchain_mutable_format extension.
This allows clients to create views of a swapchain image with a
different format, just like a regular image created with the
`VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT` set. This extension also supports
the additional features provided by `VK_KHR_maintenance2` and
`VK_KHR_image_format_list` for swapchain images.

We... admittedly don't do much with any of this. There wasn't really
anything in Metal stopping clients from doing this to begin with. This
change does, however, set the `MUTABLE_FORMAT` and `EXTENDED_USAGE`
image bits on any swapchain created with the new
`VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR`.
2018-12-05 12:15:55 -06:00
Chip Davis
f4295ab3f1 Support the VK_KHR_shader_float16_int8 extension.
Only the `shaderFloat16` feature is supported for now. The `shaderInt8`
feature may require additional work on SPIRV-Cross.

Update Vulkan-Headers to 1.1.95 to pull in the definitions for this new
extension.
2018-12-05 10:32:30 -06:00
Chip Davis
faa455cec6 Support the VK_KHR_8bit_storage extension.
This isn't part of Vulkan 1.1, but it will almost certainly be part of
Vulkan 1.2. (Or whatever the new version is.)
2018-12-05 09:50:32 -06:00
Chip Davis
533e25c342 Add all the extensions I added over the past few months to the user guide.
Sort the list.
2018-12-04 15:55:18 -06:00
Bill Hollings
025259426c Refactor the build environment.
Support creation of static library and build framework and dynamic library from it.
Add Makefile to better support command line or script building integration.
Update demos to each use one of framework, static library, and dynamic library.
Refactor and rename the build scripts.
Refactor and rename the Xcode Schemes.
Update build and runtime documentation.
Update What's New document.
2018-10-30 23:16:12 -04:00
Bill Hollings
2adc450c62 Include struct size parameter in VK_MVK_moltenvk extension functions
that pass structs that might change size across extension versions
2018-10-08 20:22:12 -04:00
Bill Hollings
5d8d4d2440 Fixes to documentation for extensions and building.
Indicate both vk_KHR_maintenance1 & vk_AMD_negative_viewport_height extensions are available.
2018-09-16 14:46:01 -04:00
Bill Hollings
e546b83852 When creating a surface, accept either a CAMetalLayer or an
NSView/UIView in the pView member, and improve error logging.
2018-09-16 12:39:03 -04:00
Bill Hollings
55e80b20a6 Move MoltenVK config to instance instead of device.
Add MVKConfiguration and deprecate MVKDeviceConfiguration.
Add vkGetMoltenVKConfigurationMVK() and deprecate vkGetMoltenVKDeviceConfigurationMVK().
Add vkSetMoltenVKConfigurationMVK() and deprecate vkSetMoltenVKDeviceConfigurationMVK().
Add build setting overrides for all initial MVKConfiguration member values.
Update to MoltenVK version 1.0.19.
Update to VK_MVK_moltenvk spec version 7.
2018-08-22 10:41:50 -04:00
Bill Hollings
2d4de6db68 Fixes to attachment and image clearing to pass CTS tests.
MVKCmdClearAttachments support clearing multiple attachment layers.
MVKCmdClearImage use renderpass clear, and support clearning multiple image layers.
Rename mvkCmdClearImage() to mvkCmdClearColorImage().
MVKDevice add getFormatIsSupported() to allow devices to test for format support.
MVKFramebuffer support multiple layers.
mvk_datatypes.h support both 2D and 3D mipmap calculations and allow
mvkMTLPrimitiveTopologyClassFromVkPrimitiveTopology() in iOS.
Remove support for VK_FORMAT_B10G11R11_UFLOAT_PACK32 & VK_FORMAT_E5B9G9R9_UFLOAT_PACK32
since format components are reversed on Metal.
Move OS extension source files to new OS directory.
Update to latest SPIRV-Cross version.
Update MoltenVK version to 1.0.16.
2018-07-23 20:12:57 -04:00
Bill Hollings
86bb51554b Support IOSurface on iOS only if IPHONEOS_DEPLOYMENT_TARGET is at least iOS 11.0.
On iOS, only compile IOSurface support, and link IOSurface framework to
libMoltenVK.dylib, if IPHONEOS_DEPLOYMENT_TARGET is at least iOS 11.0.
Update to latest version of SPIRV-Cross.
Update MoltenVK version to 1.0.15.
2018-07-12 18:26:54 -04:00
Karl Schultz
d2a5c02f03 docs: Improve layer limitations description 2018-07-09 08:09:48 -06:00
Hanton Yang
7e6f6b0257 Fix typos in Docs/MoltenVK_Runtime_UserGuide.md 2018-05-24 13:23:29 +08:00
Hanton Yang
3eb4179df9 Fix typo in MoltenVK_Runtime_UserGuide.md 2018-05-18 21:24:16 +08:00
Bill Hollings
40cdcbba5c Remove mutex locks on MVKDescriptorPool.
Update docs to indicate support for Vulkan 1.0, instead of 1.1.
2018-05-14 15:48:27 -04:00
Bill Hollings
20c98e5e46 Add support for caching converted MSL shader code offline from pipeline cache
via vkGetPipelineCacheData(), vkCreatePipelineCache() & vkMergePipelineCaches().

Add the cereal serialization framework as a dependency.
Update documentation. Update project settings to Xcode 9.3.
2018-03-30 12:13:50 -04:00
Bill Hollings
9e9aae4687 Remove executable permissions from non-executable files. 2018-03-12 16:59:34 -04:00
Bill Hollings
00fda690ca Align versioning of external libraries with those used by LunarG SDK.
Load external library versions using script instead of Git submodules.
SPIRV-Cross, Vulkan-LoaderAndValidationLayers & VulkanSamples versions recorded in files.
glslang version determined by Vulkan-LoaderAndValidationLayers.
SPIRV-Tools & SPIRV-Headers versions loaded by glslang.
When MoltenVK is built as part of the LunarG SDK, use external libraries
sourced from parent Vulkan-LoaderAndValidationLayers.
Use Vulkan headers from Vulkan-LoaderAndValidationLayers.
No longer generate Vulkan specification.
Update documentation.
2018-03-12 10:02:13 -04:00