160 Commits

Author SHA1 Message Date
Bill Hollings
d3155bd811 VK_EXT_descriptor_indexing add support for update after binding.
MVKDevice track enabled VkPhysicalDeviceInlineUniformBlockFeaturesEXT features.
Disable prefilled MTLCommandBuffers if update after binding enabled.
Update to latest SPIRV-Cross that includes support for unsized arrays.
2020-11-03 11:40:10 -05:00
Chip Davis
da0872b047 MVKPipeline: Fix calculation of atomic image buffer addresses.
Align the row address using the linear texture alignment for an
`R32Uint` texture.

Pull in the SPIRV-Cross changes needed to make this work.
2020-10-16 10:26:20 -05:00
Bill Hollings
9f2fc8f7d0 Update dependency libraries to match Vulkan SDK 1.2.154. 2020-09-28 19:03:00 -04:00
Bill Hollings
487305de6a Merge branch 'master' of https://github.com/billhollings/MoltenVK into xcode12 2020-09-21 13:09:06 -04:00
Bill Hollings
76828818ce Add support for VK_KHR_portability_subset extension.
Remove support for VK_EXTX_portability_subset extension.
2020-09-21 11:33:29 -04:00
Bill Hollings
122c15b696 Update Vulkan-Headers to version 1.1.154 to include VK_KHR_portability_subset. 2020-09-21 09:43:51 -04:00
Bill Hollings
51777ca49c Merge branch 'master' of https://github.com/billhollings/MoltenVK into xcode12 2020-09-11 14:03:03 -04:00
Chip Davis
34930eaf5b Support the VK_KHR_multiview extension.
Originally, Metal did not support this directly, and still largely
doesn't on GPUs other than Apple family 6. Therefore, this
implementation uses vertex instancing to draw the needed views. To
support the Vulkan requirement that only the layers for the enabled
views are loaded and stored in a multiview render pass, this
implementation uses multiple Metal render passes for multiple "clumps"
of enabled views.

For indirect draws, as with tessellation, we must adjust the draw
parameters at execution time to account for the extra views, so we need
to use deferred store actions here. Without them, tracking the state
becomes too involved.

If the implementation doesn't support either layered rendering or
deferred store actions, multiview render passes are instead unrolled and
rendered one view at a time. This will enable us to support the
extension even on older devices and OSes, but at the cost of additional
command buffer memory and (possibly) worse performance.

Eventually, we should consider using vertex amplification to accelerate
this, particularly since indirect multiview draws are terrible and
currently require a compute pass to adjust the instance count. Also,
instanced drawing in itself is terrible due to its subpar performance.
But, since vertex amplification on family 6 only supports two views,
when `VK_KHR_multiview` mandates a minimum of 6, we'll still need to use
instancing to support more than two views.

I have tested this extensively against the CTS. I'm very confident in
its correctness. The only failing tests are
`dEQP-VK.multiview.queries.*`, due to our inadequate implementation of
timestamp queries; and `dEQP-VK.multiview.depth.*`, due to what I assume
is a bug in the way Metal handles arrayed packed depth/stencil textures,
and which may only be a problem on Mojave. I need to test this on
Catalina and Big Sur.

Update SPIRV-Cross to pull in some fixes necessary for this to work.

Fixes #347.
2020-09-03 17:14:46 -05:00
Bill Hollings
56df7d61d7 Remove MoltenVK fat libraries and frameworks and use XCFramework instead.
- Delete fat library and framework scripts and templates.
- MoltenVK build package now only includes one XCFramework, and separate platform dylibs.
- Modify fetchDependencies and Makefile targets to not build fat libraries,
  and to build simulators separately than platforms instead.
- Script package_moltenvk.sh now copies dylibs for all built platforms.
- Consolidate package_all.sh and delete package_one_os.sh.
- Swap names of copy_lib_to_staging.sh and copy_to_staging.sh scripts.
- Cube demo now uses MoltenVK as XCFramework, and support Simulator builds.
- Hologram demo now uses MoltenVK as dylibs from new packaging location.
- API-Samples demo now uses MoltenVK as XCFramework.
- Update documentation.
2020-09-01 14:39:46 -04:00
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
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
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
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
Chip Davis
d14d4e918d MVKPipeline: Fix fragment inputs to have as many components as vertex outputs.
Metal is picky about interface matching. If the types of a vertex output
and its corresponding fragment input don't match, down to the number of
vector components, it fails pipeline compilation. To support cases where
the number of components in the fragment input is less than the
corresponding vertex output, we need to fix up the fragment shader to
accept the extra components.
2020-06-19 14:20:29 -05:00
Bill Hollings
4a5bf6953c Update fetchDependencies script to use pre-built spirv-tools files by default. 2020-06-02 13:30:52 -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
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
Chip Davis
06662071a4 Update SPIRV-Cross again to pull in a fix for KhronosGroup/SPIRV-Cross#1322. 2020-04-15 13:40:44 -05:00
Chip Davis
4b479fefd4 Update SPIRV-Cross. 2020-04-14 14:32:00 -05: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
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
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
8ec682938b Update copyright to 2020. 2020-01-07 16:47:29 -05:00
Bill Hollings
a64f62ee53 Update dependency libraries to match Vulkan SDK 1.1.130.
Update ExternalRevisions/README.md to document new glslang build settings.
Update What's New document.
2019-12-16 14:24:57 -05:00
Bill Hollings
5b1425b73d Cube demo use VK_EXT_metal_surface extension. 2019-12-02 13:46:31 -05:00
Bill Hollings
9f64cc4bef Fix tessellation break when control stage declares but does not use position builtin.
Add SPIRVShaderOutput::isUsed retrieved from shader reflection.
mvk::sizeOfOutput() returns zero if output var is not used.
Update to latest SPIRV-Cross version.
2019-11-26 16:11:52 -05:00
Bill Hollings
c7fe2e3230 Update contents of Templates/spirv-tools/build.zip. 2019-10-29 15:10:50 -04:00
Bill Hollings
0b1189dc03 Update external libraries to support Vulkan SDK 1.1.126.
Update What's New document.
2019-10-29 11:55:16 -04:00
Bill Hollings
93ae214bc8 Support additional capabilities in 1D images, including rendering, clearing, and mipmaps.
Add `MVK_CONFIG_TEXTURE_1D_AS_2D` environment variable, enabled by default.
Modify 1D warning messages to recommend use of `MVK_CONFIG_TEXTURE_1D_AS_2D`.
Update to latest version of SPIRV-Cross.
Align pipeline cache contents to latest CompilerMSL::Options structure.
Clean up code signing on demo Xcode projects.
2019-10-25 14:40:59 -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
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
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
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
Chip Davis
0263808763 Update SPIRV-Cross. 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
84ea825ea3 Separate SPIRVToMSLConverterContext into input config and output results.
Refactor SPIRVToMSLConverterContext into distinct SPIRVToMSLConversionConfiguration
and SPIRVToMSLConversionResults for conversion input and output, respectively.
Update to latest SPIRV-Cross version.
Update What's New document.
2019-06-29 18:01:07 -04:00
Bill Hollings
bf8c7f8bb8 Updates for SDK 1.1.108 release.
Update to latest external dependency libraries.
MVKDescriptorSetLayoutBinding allow binding of null MVKBuffer.
Update What's New document.
2019-06-13 17:11:44 -04:00
Chip Davis
f075adc93f Update SPIRV-Cross.
This adds support for the `OpArrayLength` instruction.
2019-05-29 10:49:28 -05: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
04cf30a0b5 Update to latest version of SPIRV-Cross. 2019-05-08 17:19:24 -04:00
Bill Hollings
e91d2f6b35 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK 2019-04-18 15:12:42 -04:00
Bill Hollings
62f374bf7e Allow building external dependency libraries in Debug mode.
Add ExternalDependencies (Debug) scheme to ExternalDependencies Xcode project.
Add --debug option to fetchDependencies script.
Support Release, Debug & Latest directories in External/build directory.
Enable DEPLOYMENT_POSTPROCESSING build setting when compiling
SPIRV-Tools to avoid warning spam when building dylibs.
Disable visibility warnings when building MoltenVKShaderConverter
in Release mode from external libraries built in Debug mode.
Always use -Xlinker -w option when creating dylibs to disable visibility warnings.
2019-04-18 15:08:39 -04:00
Michael Barriault
08d3d91016 Update to latest SPIRV-Cross. 2019-04-17 22:37:52 +01:00
Bill Hollings
189a41e8d2 Update dependency libraries for SDK 1.1.106. 2019-04-11 17:52:50 -04:00
Bill Hollings
ef86d58552 Update to latest version of SPIRV-Cross.
Clean up demo build warnings.
Update What's New document.
2019-04-05 12:08:32 -04:00
Bill Hollings
4183a6489b
Merge branch 'master' into master 2019-03-29 13:06:00 -04:00
Hans-Kristian Arntzen
38edfdb3de Override namespace for SPIRV-Cross.
Some projects also link against SPIRV-Cross statically, and in order to
avoid ABI conflicts, we should use a private namespace for the
SPIRV-Cross dependency to avoid bugs. See SPIRV-Cross issue #902 for
more information. The new namespace is MVK_spirv_cross, and the code
now makes use of the SPIRV_CROSS_NAMESPACE macro rather than spirv_cross.
2019-03-29 11:34:55 +01:00
Bill Hollings
0f22e2a70e MSL: Fix crash where variable storage buffer pointers are passed down.
Explicitly build dSYM files in BUILT_PRODUCTS_DIR
to avoid conflict between macOS and iOS build locations.
Update to latest SPIRV-Cross version.
2019-03-28 11:58:05 -04:00