1692 Commits

Author SHA1 Message Date
Bill Hollings
7af7a3b29b create_xcframework_func.sh script check for header availability before copying.
XCFramework headers are still unusable due to an Xcode bug (documented in
create_xcframework_func.sh), but in testing for this, modifications to
create_xcframework_func.sh were made to test for the header file so that this
will work correctly when the Xcode bug is fixed and headers can be reintroduced.
2020-09-04 12:09:45 -04:00
Bill Hollings
257d3dfb7c
Merge pull request #1005 from billhollings/xcode12
Sync Xcode12 branch with master
2020-09-02 12:01:46 -04:00
Bill Hollings
4e45ddfbe7 Merge branch 'master' of https://github.com/billhollings/MoltenVK into xcode12 2020-09-02 11:21:35 -04:00
Bill Hollings
9ef4130edd
Merge pull request #1004 from js6i/master
MVKImagePlane: account for swapchain images in get/releaseMTLTexture()
2020-09-02 10:47:04 -04:00
Jan Sikorski
3c3683ebef MVKImagePlane: account for swapchain images in get/releaseMTLTexture()
Delegate to MVKImage's getMTLTexture() method to use the overriden one
for swapchain images.
Also, the _mtlTextureViews member should be cleared to prevent accidental
reuse of released views.
2020-09-02 12:17:10 +02:00
Bill Hollings
e4126becc6
Merge pull request #1003 from billhollings/xcode12
Replace building fat libraries and frameworks with XCFramework
2020-09-01 16:56:36 -04:00
Bill Hollings
aa496c8789
Merge pull request #1001 from cdavis5e/null-draws
MVKCmdDraw: Don't encode commands that draw zero vertices.
2020-09-01 16:55:03 -04:00
Bill Hollings
a52098d29a
Merge pull request #1000 from cdavis5e/clear-vertex-count
MVKCmdClearAttachments: Fix vertex count for clearing multiple layers.
2020-09-01 16:47:02 -04:00
Bill Hollings
dbb0b58671
Merge pull request #999 from cdavis5e/null-clear-atts
MVKCmdClearAttachments: Don't attempt to clear unused attachments.
2020-09-01 16:19:44 -04:00
Bill Hollings
3262af3849
Merge pull request #998 from cdavis5e/deferred-store-actions
Use deferred store actions instead of tracking multi-pass draws.
2020-09-01 16:15:16 -04: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
Chip Davis
245286f57c MVKCmdDraw: Don't encode commands that draw zero vertices.
Nothing will be drawn in that case. Nothing would've been drawn anyway,
but Metal's validation layer complains if you issue a draw command with
zero vertices or instances.

We unfortunately cannot do anything about indirect draws, since we won't
know how many vertices to draw until execute time.
2020-08-31 21:18:02 -05:00
Chip Davis
864a6a6b94 MVKCmdClearAttachments: Fix vertex count for clearing multiple layers.
Prior to this, we were assuming one layer per clear rect. When that
assumption were broken, we wound up smashing the stack. This will be
more important once multiview support lands, since all views must be
cleared by the clear command.
2020-08-31 21:16:33 -05:00
Chip Davis
2d7717b708 MVKCmdClearAttachments: Don't attempt to clear unused attachments.
The attachment index in the `VkClearAttachment` struct is an index into
the current subpass attachment array, not the render pass attachment
array; so it's not enough to check `VkClearAttachment` for
`VK_ATTACHMENT_UNUSED`. We also need to check the current subpass.

If no attachments can be cleared, don't encode a command to the Metal
command buffer.

Perhaps I should bring back `recordBeginRenderPass()` and
`recordEndRenderPass()` and keep track of the current subpass; then we
can avoid recording the command entirely if the intersection of the sets
"attachments to clear" and "used attachments" is null.
2020-08-31 21:12:51 -05:00
Chip Davis
e2ba444aa6 Use deferred store actions instead of tracking multi-pass draws.
The current code does not handle multiple subpasses, nor does it handle
secondary command buffers. Handling subpasses was easy enough. The
problem came with secondary command buffers. Tracking them became
extremely complicated, particularly since pipelines may be set either
inside or outside a render pass, and further, a pipeline set in one
buffer might be used in another.

I then realized a simpler and more elegant solution: Metal's deferred
store actions feature. This allows you to defer setting the store action
for a render pass until encoding time. This is exactly what we need,
since we won't know what store action we actually want until we start
encoding draws. This solution should now work with multiple subpasses
and secondary command buffers, with much less code.
2020-08-31 21:09:11 -05:00
Bill Hollings
536d6cf0d4 Add MoltenVK XCFramework.
Add package_moltenvk_xcframework.sh.
Rename package_shader_converter.sh to package_shader_converter_xcframework.sh.
2020-08-27 23:43:06 -04:00
Bill Hollings
e97d11a4f5 Shader converters as XCFramework.
Create shader converters as XCFrameworks.
Don't create shader converters as fat libs, dylibs, or regular frameworks.
Rename create_xcframework.sh to create_xcframework_func.sh.
Use separate MoltenVK packaging scripts for one or all OS's.
Add package_one_os.sh.
Remove package_shader_converter_lib.sh.
Remove redundant GLSL shader converter dependencies in MoltenVK packaging targets.
2020-08-27 19:29:14 -04:00
Bill Hollings
5c6d171a38
Merge pull request #995 from billhollings/xcode12
Build successfully on Xcode12
2020-08-25 14:51:13 -04:00
Bill Hollings
7c2951f419 Demos exclude arm64 architectures on macOS and Simulators.
Demos exclude arm64e architectures on iOS and tvOS.
2020-08-25 14:22:49 -04:00
Bill Hollings
5f6dd8fe81 Fix build errors on Simulator not supporting MTLDrawable present time options. 2020-08-25 13:04:52 -04:00
Bill Hollings
dd59aea71f Use external libraries as XCFrameworks.
Exclude arm64 architectures on macOS and Simulators.
Exclude arm64e architectures on iOS and tvOS.
Stop building fat libraries for external libraries.
Remove package_ext_libs.sh script.
Don't include Headers in ext lib XCFrameworks because of Xcode12 bug in using them.
2020-08-20 15:24:35 -04:00
Bill Hollings
7579cf6a3b Create external libraries as XCFrameworks.
Add script copy_to_staging.sh.
Add script copy_ext_lib_to_staging.sh.
Add script create_xcframework.sh.
Add script create_ext_lib_xcframeworks.sh.
2020-08-20 12:45:12 -04:00
Bill Hollings
43c0a08472
Merge pull request #993 from js6i/master
Initialize tessellation related variables conditionally in indirect draws
2020-08-14 20:43:20 -04:00
Jan Sikorski
7c99bb9430 Initialize tessellation related variables conditionally in indirect draws 2020-08-14 12:38:33 +02:00
Bill Hollings
769f0e4592
Merge pull request #992 from cdavis5e/fix-988-991
MVKCommandBuffer: Don't set renderTargetArrayLength on devices that don't support it.
2020-08-13 18:39:25 -04:00
Chip Davis
07c2054cc8 MVKCommandBuffer: Don't set renderTargetArrayLength on devices that don't support it.
It's a hard validation error to do so. We originally had a check for
this, but it was erroneously completely removed in #988, instead of
being limited to `renderTargetArrayLength`.

Fixes #991.
2020-08-13 15:20:57 -05:00
Bill Hollings
4f8643c97b Travis use Xcode 12. 2020-08-13 13:30:46 -04:00
Bill Hollings
fe89118435 Support Xcode 12 settings. 2020-08-13 13:13:30 -04:00
Bill Hollings
24610ca6b7 Merge branch 'master' of https://github.com/KhronosGroup/MoltenVK into xcode12 2020-08-12 18:53:53 -04:00
Bill Hollings
f3e938fafa
Merge pull request #990 from billhollings/master
Re-add support for bitcode generation on iOS and tvOS.
2020-08-12 17:41:36 -04:00
Bill Hollings
d4b5df532e Re-add support for bitcode generation on iOS and tvOS.
Set BITCODE_GENERATION_MODE build setting in all Xcode projects.
create_dylib.sh support BITCODE_GENERATION_MODE.
2020-08-11 20:18:50 -04:00
Bill Hollings
285346293d
Merge pull request #988 from js6i/master
Validation warning fixes
2020-08-11 11:27:03 -04:00
Jan Sikorski
77cbe56101 Detect support for having no attachments in a render pass
When we do have support, don't create a dummy texture to attach.
2020-08-11 10:56:33 +02:00
Bill Hollings
2594bef1f6
Merge pull request #982 from jherico/dtk
Enable building on xcode 12 beta
2020-08-07 09:52:00 -04:00
Jan Sikorski
c3254cb546 Ensure the base texture is created when creating a view texture 2020-08-07 12:24:22 +02:00
Jan Sikorski
babefe6608 Always set renderTarget* properties in MTLRenderPassDescriptor
A shader might still use array index even if array length is 1
causing a validation warning if renderTargetArrayLength is not set.
2020-08-07 11:39:17 +02:00
Jan Sikorski
8f8395dcdf Enable MTLRenderPassDescriptor renderTargetWidth and renderTargetHeight API
on macOS, as it's available on 10.15 and newer.
2020-08-07 11:39:11 +02:00
Bradley Austin Davis
df672f99bb Enable building on xcode 12 beta 2020-08-05 18:50:13 -07:00
Bill Hollings
72ef14ed27
Merge pull request #985 from billhollings/master
Update MoltenVK version to 1.0.45.
2020-08-05 20:55:15 -04:00
Bill Hollings
5126aaed3e Update MoltenVK version to 1.0.45.
Update What's New document.
2020-08-05 19:58:59 -04:00
Bill Hollings
7708b08c10
Merge pull request #983 from cdavis5e/multi-patch-workgroup
Process multiple patches per workgroup in a tessellation control shader.
2020-08-05 18:51:34 -04:00
Chip Davis
3db2cbff6b Process multiple patches per workgroup in a tessellation control shader.
This should hopefully reduce underutilization of the GPU, especially on
GPUs where the thread execution width is greater than the number of
control points.

This also eliminates the extra invocations previously needed to read the
varyings from the vertex shader into the tessellation shader. The number
of threads per workgroup is now lcm(SIMD-size, output control points).
This should ensure we always process a whole number of patches per
workgroup, and further reduce underutilization of the GPU's SIMD units.

To avoid complexity handling indices in the tessellation control shader,
I've also changed the way vertex shaders for tessellation are handled.
They are now compute kernels using Metal's support for vertex-style
stage input. This lets us always emit vertices into the buffer in order
of vertex shader execution. Now we no longer have to deal with indexing
in the tessellation control shader, nor do we always have to duplicate
the index buffer to insert gaps. This also fixes a long-standing issue
where if an index were greater than the number of vertices to draw, the
vertex shader would wind up writing outside the buffer, and the vertex
would be lost.
2020-08-05 16:03:25 -05:00
Bill Hollings
15dae8af71
Merge pull request #984 from js6i/master
Images in coherent memory
2020-08-05 16:23:18 -04:00
Jan Sikorski
8f52521b1d Flush source image of a transfer
Since on macOS textures cannot be resident in shared (host-coherent) memory,
they need to be flushed before making the copy, to ensure that the modified
data is transferred.
2020-08-05 15:34:10 +02:00
Bill Hollings
4609416ef2
Merge pull request #980 from mbechard/master
dynamicOffsets are supposed to be ordered by binding index
2020-07-30 12:06:12 -04:00
Bill Hollings
8f6edef8ba
Merge pull request #979 from billhollings/master
Fix issue where expected buffer-sizes buffer not bound to Metal compute encoder.
2020-07-28 19:06:16 -04:00
Malcolm Bechard
5874616d78 dynamicOffsets are supposed to be ordered by binding index
not by layout element index. Fixes #978
2020-07-28 17:25:53 -04:00
Bill Hollings
2c7734eda8 Fix issue where expected buffer-sizes buffer not bound to Metal compute encoder.
MVKComputeResourcesCommandEncoderState update buffer-size value before buffer
bindings are encoded into Metal and are no longer marked as dirty.
2020-07-28 15:38:39 -04:00
Bill Hollings
1e993f8907
Merge pull request #977 from billhollings/master
Update dependency libraries to match Vulkan SDK 1.2.148
2020-07-28 11:35:35 -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