2144 Commits

Author SHA1 Message Date
Bill Hollings
d78de04b56 Update external dependency libraries for Vulkan SDK 1.2.170. 2021-02-22 19:14:00 -05:00
Bill Hollings
d2ddba1b52
Merge pull request #1275 from cdavis5e/private-temp-buffers
MVKMTLBufferAllocation: Support private temp buffers.
2021-02-22 06:18:48 -05:00
Chip Davis
c225c423ba MVKMTLBufferAllocation: Support private temp buffers.
Some buffers, particularly those used by tessellation, indirect
multiview, or occlusion queries, are never written or read from the
host. Keeping the relevant data in VRAM should improve performance by
reducing the need for the GPU to make expensive accesses over the PCI
bus.

VRAM is a scarce resource on discrete GPUs, but this is part of why we
marked the buffers volatile.
2021-02-21 15:06:04 -06:00
Bill Hollings
3058a130d1
Merge pull request #1273 from billhollings/simulator-buffer-alignment
Set Metal buffer alignment to 256 on non-Apple Silicon iOS/tvOS simulators.
2021-02-21 13:03:22 -05:00
Bill Hollings
4675481a06 Redefine derivations of MVK_APPLE_SILICON, MVK_MACOS_APPLE_SILICON, and MVK_XCODE_12.
Derive MVK_APPLE_SILICON from target CPU.
Derive MVK_MACOS_APPLE_SILICON from target CPU and macOS platform.
Derive MVK_XCODE_12 from macOS and iOS SDK versions.
Test for simulator on non-Apple GPU using MVK_OS_SIMULATOR && !MVK_APPLE_SILICON.
2021-02-20 09:33:32 -05:00
Bill Hollings
ef64dc4654
Merge pull request #1272 from billhollings/cts-descset-crash
Report accurate value for VkPhysicalDeviceLimits::maxBoundDescriptorSets.
2021-02-18 17:44:54 -05:00
Bill Hollings
0d1975907e Set Metal buffer alignment to 256 on non-Apple Silicon iOS/tvOS simulators. 2021-02-18 17:13:34 -05:00
Bill Hollings
c38f19dd20 Report accurate value for VkPhysicalDeviceLimits::maxBoundDescriptorSets.
This value is derived from limit expected by SPIRV-Cross.
The previous unbounded value was breaking CTS tests that used this value.
2021-02-18 13:47:45 -05:00
Bill Hollings
82ab40e52f
Merge pull request #1270 from billhollings/cts-multithreading
Fixes for CTS multithread tests.
2021-02-17 17:01:35 -05:00
Bill Hollings
14dc8578ce Fix code formatting on completion handler blocks. 2021-02-17 14:09:05 -05:00
Bill Hollings
a1e33384c1 Remove @synchronized from MTLFunction specialization to avoid reentrant hang. 2021-02-17 13:56:37 -05:00
Bill Hollings
0b90a53d76 Fixes for CTS multithread tests.
MTLDevice retains an internal object web that is used during the creation of
new objects, such as pipeline states, libraries, functions, and samplers.
Simultaneously creating and destroying objects of these types can trigger
race conditions on the internal MTLDevice content.

Wrap the following in @synchronized (mtlDevice) {...}:
- MTLRenderPipelineState creation and destruction
- MTLComputePipelineState creation and destruction
- MTLLibrary creation
- MTLFunction creation and specialization
- MTLSampler creation and destruction
2021-02-17 09:33:04 -05:00
Bill Hollings
4a0a5cd0b4
Merge pull request #1267 from billhollings/rmv-cmd-enc-state-reset
Remove MVKCommandEncoderState::reset().
2021-02-12 19:28:02 -05:00
Bill Hollings
c9b5a3bffc
Merge pull request #1266 from billhollings/undoc-direct-msl
Remove official support for direct MSL shader loading from documentation.
2021-02-12 19:24:36 -05:00
Bill Hollings
acf2a80535 Remove MVKCommandEncoderState::reset().
MVKCommandEncoderState has numerous subclasses, and the polymorphic
MVKCommandEncoderState::resetImpl() requires significant maintenance
across these subclasses. It's only use was in disabling depth-stencil state.

Remove MVKCommandEncoderState::reset() and all implementations of resetImpl()
across all MVKCommandEncoderState subclasses.
Remove MVKPipeline::__hasDepthStencilInfo and disable depth-stencil state
automatically via cleared Vulkan struct in MVKPipeline.
2021-02-12 19:04:17 -05:00
Bill Hollings
612c84d79e Remove official support for direct MSL shader loading from documentation. 2021-02-12 18:33:28 -05:00
Bill Hollings
4d46cf7375
Merge pull request #1262 from billhollings/add-github-discussions
GitHub repository enhancements.
2021-02-12 11:49:14 -05:00
Bill Hollings
40e00c3da9
Merge pull request #1258 from billhollings/remove-debug-ONLY_ACTIVE_ARCH
Remove ONLY_ACTIVE_ARCH from Debug builds.
2021-02-12 11:48:35 -05:00
Bill Hollings
bce76f1d29 GitHub repository enhancements.
Document availability of GitHub Discussions in `README.md`.
Expose .github/workflows/CI.yml in MoltenVKPackaging Xcode project.
2021-02-12 10:46:57 -05:00
Bill Hollings
4d60058efb Remove ONLY_ACTIVE_ARCH from Debug builds.
Debug builds now build for all platform architectures.
2021-02-12 09:50:17 -05:00
Bill Hollings
54e5723ff7
Merge pull request #1255 from billhollings/vizbuff-index
Fix Metal validation error of duplicate visibility offsets.
2021-02-10 19:37:59 -05:00
Bill Hollings
a015e39158
Merge pull request #1254 from cdavis5e/family-1-no-simd-permute
MVKPhysicalDevice: Disable SIMD-group permutation for Mac family 1.
2021-02-10 19:18:16 -05:00
Bill Hollings
bbe87fe2fc Fix Metal validation error of duplicate visibility offsets.
Don't reset MVKOcclusionQueryCommandEncoderState::_mtlVisibilityResultOffset
when ending occlusion query, as subsequent queries need different offsets.

Also, remove MVKOcclusionQueryCommandEncoderState::_needsVisibilityResultMTLBuffer,
as it is always set once from MVKCommandBuffer::_needsVisibilityResultMTLBuffer.

When app setting MVKConfiguration it with a partial copy, start with existing.
2021-02-10 18:51:42 -05:00
Chip Davis
0ac65c87b8 MVKPhysicalDevice: Disable SIMD-group permutation for Mac family 1.
Our testing shows that none of the SIMD-group functions work on family
1, including `simd_is_first()`, which is needed for even `BASIC`
support.
2021-02-10 13:25:41 -06:00
Bill Hollings
84c6095fbf
Merge pull request #1243 from billhollings/config-strings
Test for null string on MVKConfiguration copy.
2021-02-08 07:14:08 -05:00
Bill Hollings
bbea8dabc9 Test for null string on MVKConfiguration copy.
When app sets MVKConfig not fully populated by app, or if app sets strings to null,
copy can fail. Test for this before copying.
2021-02-06 21:42:30 -05:00
Bill Hollings
05066429e2
Merge pull request #1242 from cdavis5e/max-buffer-range-4gib
MVKPhysicalDevice: Clamp maximum buffer range to 4 GiB - 1.
2021-02-06 20:16:19 -05:00
Chip Davis
515a2cbcfe MVKPhysicalDevice: Clamp maximum buffer range to 4 GiB - 1.
It is possible for the maximum buffer size to be 4 binary gigabytes or
greater. In that case, the upper 32 bits will be lost, and the value of
the `maxUniformBufferRange` and `maxStorageBufferRange` limits would be
too small or even zero. Clamp it to 4 GiB - 1 in that case, since that
is the maximum value of a 32-bit integer.

For #1240.
2021-02-06 15:42:40 -06:00
Bill Hollings
efba5968a0
Merge pull request #1239 from billhollings/gpucapture
Add ability to automatically capture first GPU frame.
2021-02-04 13:47:48 -05:00
Bill Hollings
ffbe364b77
Merge pull request #1238 from past-due/github_actions_xcode_legacy_1
CI enhancements - update to Xcode 12.4, add (legacy) Xcode 11.7 build
2021-02-04 12:26:41 -05:00
Bill Hollings
1735a22512
Merge pull request #1237 from billhollings/getphysicaldevice
Add MVKDeviceTrackingMixin::getPhysicalDevice() to streamline access.
2021-02-04 12:04:24 -05:00
Bill Hollings
95cf144ccf Add ability to automatically capture first GPU frame.
Refactor auto GPU capture code to support both device and frame capture.
Add ability to automatically capture first GPU frame by setting
`MVK_CONFIG_AUTO_GPU_CAPTURE_SCOPE` to `2`.
Wrap GPU capture in autorelease pool to handle both cases of capture call
being made in run loop as in an app GUI, or in one-shot app like CTS.
2021-02-04 11:56:28 -05:00
past-due
023290503d [GitHub Actions] Add "legacy" Xcode 11.7 build configuration 2021-02-03 16:00:38 -05:00
past-due
ac04d80cb9 [GitHub Actions] Update to Xcode 12.4, adjust build matrix 2021-02-03 15:59:50 -05:00
Bill Hollings
51188b5932 Add MVKDeviceTrackingMixin::getPhysicalDevice() to streamline access. 2021-02-03 14:17:53 -05:00
Bill Hollings
fcb4701f47
Merge pull request #1232 from cdavis5e/volatile-temp-buffers
MVKMTLBufferAllocation: Mark temp buffers as volatile.
2021-02-01 17:46:52 -05:00
Chip Davis
e1ac50c07e MVKMTLBufferAllocation: Mark temp buffers as volatile.
They are not expected to be useful beyond the commands that use them,
but they take up memory nonetheless. This is exactly the use case
purgeability was designed for. Tell the system that it's OK to reclaim
their memory if necessary.

Doing this every time the buffer is used will cause the purgeable state
to be reset from `MTLPurgeableStateEmpty`, in case the system really did
reclaim their memory.

In accordance with Apple's advice, lock the pages for the buffer when
loading it, so the memory isn't pulled out from under us.
2021-02-01 16:15:17 -06:00
Bill Hollings
ae347c4f6f
Merge pull request #1230 from billhollings/xc124
Update Xcode build settings to cover Xcode 12.4.
2021-02-01 15:51:30 -05:00
Bill Hollings
e5e1f65dfc Update Xcode build settings to cover Xcode 12.4. 2021-02-01 13:50:42 -05:00
Bill Hollings
6cee2fe190
Merge pull request #1229 from cdavis5e/occlusion-query-temp-buffers
MVKCommandEncoder: Use the temp buffer mechanism for visibility buffers.
2021-02-01 13:22:52 -05:00
Chip Davis
55d206e058 MVKCommandEncoder: Use the temp buffer mechanism for visibility buffers.
Add support for "dedicated" temp buffers, where instead of allocating a
big buffer and carving regions out of it, a unique buffer is returned
for each allocation request. This is necessary for visibility buffers,
because the offset passed to `-[MTLRenderCommandEncoder
setVisibilityResultMode:offset:]` cannot exceed an
implementation-defined value, currently 256k less 8 bytes for Mac family
2 on Catalina and up, and on Apple family 7; and 64k less 8 bytes
otherwise.
2021-02-01 10:41:29 -06:00
Bill Hollings
ff7737beb5
Merge pull request #1226 from billhollings/fastmath
MSL compilations settings: ffast-math and position invariance
2021-01-29 18:33:45 -05:00
Bill Hollings
a69982ef38 Add guard code for XCode 11. 2021-01-29 17:54:50 -05:00
Bill Hollings
4083dd1229 Merge branch 'master' of https://github.com/billhollings/MoltenVK into fastmath 2021-01-29 17:30:23 -05:00
Bill Hollings
05fe007de8
Merge pull request #1227 from cdavis5e/xcode-11-fixes
Fix build on Xcode 11.
2021-01-29 17:22:08 -05:00
Chip Davis
2bfb5ed77b Fix build on Xcode 11.
I missed this.
2021-01-29 14:53:03 -06:00
Bill Hollings
7ce4e0ccbb Update to latest SPIRV-Cross to query shader invariance. 2021-01-29 15:33:27 -05:00
Bill Hollings
b80a620afc
Merge pull request #1223 from cdavis5e/occlusion-query-rewrite
MVKQueryPool: Totally rework the way occlusion queries work.
2021-01-29 14:58:52 -05:00
Bill Hollings
5d00644d7f
Merge pull request #1224 from cdavis5e/mac-family-2-features
Require Mac family 2 for some features
2021-01-29 13:04:42 -05:00
Chip Davis
24c1b7276e MVKPhysicalDevice: Require Mac family 2 for quad-scope permutation.
According to the Metal Feature Set Tables, only family 2 supports
quad-scope permutation. We've been seeing issues with SIMD-group
functions on family 1 hardware, so for now I'm moving quad-group
permutation to family 2.
2021-01-28 22:07:43 -06:00