Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VkSemaphore optionally uses MTLEvent, if available and MVK_ALLOW_METAL_EVENTS environment variable is enabled. #633

Merged
merged 1 commit into from
Jun 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Docs/Whats_New.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Released TBD
- Fix tessellated indirect draws using wrong kernels to map parameters.
- Work around potential Metal bug with stage-in indirect buffers.
- Fix zero local threadgroup size in indirect tessellated rendering.
- `VkSemaphore` optionally uses `MTLEvent`, if available and
`MVK_ALLOW_METAL_EVENTS` environment variable is enabled.
- Fix crash when clearing attachments using layered rendering on older macOS devices.
- Fixes to Metal renderpass layered rendering settings.
- Fix sporadic crash on `vkDestroySwapchainKHR()`.
Expand Down
4 changes: 4 additions & 0 deletions MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ typedef unsigned long MTLLanguageVersion;
*
* 3. Setting the MVK_CONFIG_FORCE_LOW_POWER_GPU runtime environment variable or MoltenVK compile-time
* build setting to 1 will force MoltenVK to use a low-power GPU, if one is availble on the device.
*
* 4. Setting the MVK_ALLOW_METAL_EVENTS runtime environment variable or MoltenVK compile-time build
* setting to 1 will cause MoltenVK to use Metal events, if they are available on the device, for
* Vulkan sychronization components such as VkSemaphore. This is disabled by default.
*/
typedef struct {

Expand Down
4 changes: 2 additions & 2 deletions MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@

if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v5] ) {
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_1;
_metalFeatures.events = true;
MVK_SET_FROM_ENV_OR_BUILD_BOOL(_metalFeatures.events, MVK_ALLOW_METAL_EVENTS);
}

if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v1] ) {
Expand Down Expand Up @@ -793,7 +793,7 @@
if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily1_v4] ) {
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_1;
_metalFeatures.multisampleArrayTextures = true;
_metalFeatures.events = true;
MVK_SET_FROM_ENV_OR_BUILD_BOOL(_metalFeatures.events, MVK_ALLOW_METAL_EVENTS);
_metalFeatures.memoryBarriers = true;
}

Expand Down
5 changes: 5 additions & 0 deletions MoltenVK/MoltenVK/Utility/MVKEnvironment.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@
# define MVK_CONFIG_FORCE_LOW_POWER_GPU 0
#endif

/** Allow the use of Metal events for Vulkan synchronizations such as VkSemaphores. Disabled by default. */
#ifndef MVK_ALLOW_METAL_EVENTS
# define MVK_ALLOW_METAL_EVENTS 0
#endif


/**
* IOSurfaces are supported on macOS, and on iOS starting with iOS 11.
Expand Down